60df7961d6690b38d1ce5fc879f77fc27a9cbdf0
[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 Tue Aug 10 20:19:08 EET DST 1999 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_endspent=''
346 d_fchmod=''
347 d_fchown=''
348 d_fcntl=''
349 d_fd_macros=''
350 d_fd_set=''
351 d_fds_bits=''
352 d_fgetpos=''
353 d_flexfnam=''
354 d_flock=''
355 d_fork=''
356 d_fseeko=''
357 d_fsetpos=''
358 d_ftello=''
359 d_ftime=''
360 d_gettimeod=''
361 d_Gconvert=''
362 d_getgrent=''
363 d_getgrps=''
364 d_gethbyaddr=''
365 d_gethbyname=''
366 d_gethent=''
367 aphostname=''
368 d_gethname=''
369 d_phostname=''
370 d_uname=''
371 d_gethostprotos=''
372 d_getlogin=''
373 d_getmntent=''
374 d_getnbyaddr=''
375 d_getnbyname=''
376 d_getnent=''
377 d_getnetprotos=''
378 d_getpent=''
379 d_getpgid=''
380 d_getpgrp2=''
381 d_bsdgetpgrp=''
382 d_getpgrp=''
383 d_getppid=''
384 d_getprior=''
385 d_getpbyname=''
386 d_getpbynumber=''
387 d_getprotoprotos=''
388 d_getpwent=''
389 d_getsent=''
390 d_getservprotos=''
391 d_getspent=''
392 d_getspnam=''
393 d_getsbyname=''
394 d_getsbyport=''
395 d_gnulibc=''
396 d_hasmntopt=''
397 d_htonl=''
398 d_inetaton=''
399 d_isascii=''
400 d_killpg=''
401 d_lchown=''
402 d_link=''
403 d_locconv=''
404 d_lockf=''
405 d_longdbl=''
406 longdblsize=''
407 d_longlong=''
408 longlongsize=''
409 d_lstat=''
410 d_madvise=''
411 d_mblen=''
412 d_mbstowcs=''
413 d_mbtowc=''
414 d_memchr=''
415 d_memcmp=''
416 d_memcpy=''
417 d_memmove=''
418 d_memset=''
419 d_mkdir=''
420 d_mkfifo=''
421 d_mktime=''
422 d_mmap=''
423 mmaptype=''
424 d_mprotect=''
425 d_msg=''
426 d_msgctl=''
427 d_msgget=''
428 d_msgrcv=''
429 d_msgsnd=''
430 d_msync=''
431 d_munmap=''
432 d_nice=''
433 d_open3=''
434 d_fpathconf=''
435 d_pathconf=''
436 d_pause=''
437 d_pipe=''
438 d_poll=''
439 d_portable=''
440 d_old_pthread_create_joinable=''
441 old_pthread_create_joinable=''
442 d_pthread_yield=''
443 d_sched_yield=''
444 sched_yield=''
445 d_readdir=''
446 d_rewinddir=''
447 d_seekdir=''
448 d_telldir=''
449 d_readlink=''
450 d_readv=''
451 d_rename=''
452 d_rmdir=''
453 d_safebcpy=''
454 d_safemcpy=''
455 d_sanemcmp=''
456 d_select=''
457 d_sem=''
458 d_semctl=''
459 d_semget=''
460 d_semop=''
461 d_setegid=''
462 d_seteuid=''
463 d_setgrent=''
464 d_setgrps=''
465 d_sethent=''
466 d_setlinebuf=''
467 d_setlocale=''
468 d_setnent=''
469 d_setpent=''
470 d_setpgid=''
471 d_setpgrp2=''
472 d_bsdsetpgrp=''
473 d_setpgrp=''
474 d_setprior=''
475 d_setpwent=''
476 d_setregid=''
477 d_setresgid=''
478 d_setresuid=''
479 d_setreuid=''
480 d_setrgid=''
481 d_setruid=''
482 d_setsent=''
483 d_setsid=''
484 d_setspent=''
485 d_setvbuf=''
486 d_sfio=''
487 usesfio=''
488 d_shm=''
489 d_shmat=''
490 d_shmatprototype=''
491 shmattype=''
492 d_shmctl=''
493 d_shmdt=''
494 d_shmget=''
495 d_sigaction=''
496 d_sigsetjmp=''
497 d_cmsghdr_s=''
498 d_msg_ctrunc=''
499 d_msg_dontroute=''
500 d_msg_oob=''
501 d_msg_peek=''
502 d_msg_proxy=''
503 d_msghdr_s=''
504 d_oldsock=''
505 d_recvmsg=''
506 d_scm_rights=''
507 d_sendmsg=''
508 d_socket=''
509 d_sockpair=''
510 sockethdr=''
511 socketlib=''
512 d_statblks=''
513 d_fstatfs=''
514 d_statfs=''
515 d_statfsflags=''
516 d_fstatvfs=''
517 d_statvfs=''
518 d_stdio_cnt_lval=''
519 d_stdio_ptr_lval=''
520 d_stdiobase=''
521 d_stdstdio=''
522 stdio_base=''
523 stdio_bufsiz=''
524 stdio_cnt=''
525 stdio_filbuf=''
526 stdio_ptr=''
527 d_index=''
528 d_strchr=''
529 d_strcoll=''
530 d_strctcpy=''
531 d_strerrm=''
532 d_strerror=''
533 d_sysernlst=''
534 d_syserrlst=''
535 d_strtod=''
536 d_strtol=''
537 d_strtoul=''
538 d_strxfrm=''
539 d_symlink=''
540 d_syscall=''
541 d_sysconf=''
542 d_system=''
543 d_tcgetpgrp=''
544 d_tcsetpgrp=''
545 d_telldirproto=''
546 d_time=''
547 timetype=''
548 clocktype=''
549 d_times=''
550 d_truncate=''
551 d_tzname=''
552 d_umask=''
553 d_semctl_semid_ds=''
554 d_semctl_semun=''
555 d_union_semun=''
556 d_vfork=''
557 usevfork=''
558 d_voidsig=''
559 signal_t=''
560 d_volatile=''
561 d_charvspr=''
562 d_vprintf=''
563 d_wait4=''
564 d_waitpid=''
565 d_wcstombs=''
566 d_wctomb=''
567 d_writev=''
568 d_dbmclose64=''
569 d_dbminit64=''
570 d_delete64=''
571 d_fetch64=''
572 d_firstkey64=''
573 d_nextkey64=''
574 d_store64=''
575 dlext=''
576 cccdlflags=''
577 ccdlflags=''
578 dlsrc=''
579 ld=''
580 lddlflags=''
581 usedl=''
582 doublesize=''
583 ebcdic=''
584 fflushNULL=''
585 fflushall=''
586 fpostype=''
587 gidtype=''
588 groupstype=''
589 h_fcntl=''
590 h_sysfile=''
591 i_arpainet=''
592 db_hashtype=''
593 db_prefixtype=''
594 i_db=''
595 i_dbm=''
596 i_rpcsvcdbm=''
597 d_dirnamlen=''
598 direntrytype=''
599 i_dirent=''
600 i_dld=''
601 i_dlfcn=''
602 i_fcntl=''
603 i_float=''
604 i_gdbm=''
605 d_grpasswd=''
606 i_grp=''
607 d_int64t=''
608 i_inttypes=''
609 i_limits=''
610 i_locale=''
611 i_machcthr=''
612 i_malloc=''
613 i_math=''
614 i_memory=''
615 i_mntent=''
616 i_ndbm=''
617 i_netdb=''
618 i_neterrno=''
619 i_netinettcp=''
620 i_niin=''
621 i_sysin=''
622 i_poll=''
623 i_pthread=''
624 d_pwage=''
625 d_pwchange=''
626 d_pwclass=''
627 d_pwcomment=''
628 d_pwexpire=''
629 d_pwgecos=''
630 d_pwpasswd=''
631 d_pwquota=''
632 i_pwd=''
633 i_sfio=''
634 i_shadow=''
635 i_socks=''
636 i_stddef=''
637 i_stdlib=''
638 i_string=''
639 strings=''
640 i_sysaccess=''
641 i_sysdir=''
642 i_sysfile=''
643 d_voidtty=''
644 i_bsdioctl=''
645 i_sysfilio=''
646 i_sysioctl=''
647 i_syssockio=''
648 i_sysmman=''
649 i_sysmount=''
650 i_sysndir=''
651 i_sysparam=''
652 i_sysresrc=''
653 i_syssecrt=''
654 i_sysselct=''
655 i_sysstat=''
656 i_sysstatvfs=''
657 i_systimes=''
658 i_systypes=''
659 d_iovec_s=''
660 i_sysuio=''
661 i_sysun=''
662 i_syswait=''
663 i_sgtty=''
664 i_termio=''
665 i_termios=''
666 i_systime=''
667 i_systimek=''
668 i_time=''
669 timeincl=''
670 i_unistd=''
671 i_utime=''
672 i_values=''
673 i_stdarg=''
674 i_varargs=''
675 i_varhdr=''
676 i_vfork=''
677 installprefix=''
678 installprefixexp=''
679 installstyle=''
680 installusrbinperl=''
681 intsize=''
682 longsize=''
683 shortsize=''
684 d_dirent64_s=''
685 d_flock64_s=''
686 d_fstat64=''
687 d_ftruncate64=''
688 d_ino64_t=''
689 d_llseek=''
690 d_lockf64=''
691 d_lseek64=''
692 d_lstat64=''
693 d_off64_t=''
694 d_offset_t=''
695 d_open64=''
696 d_opendir64=''
697 d_readdir64=''
698 d_seekdir64=''
699 d_stat64=''
700 d_telldir64=''
701 d_truncate64=''
702 libc=''
703 ldlibpthname=''
704 libperl=''
705 shrpenv=''
706 useshrplib=''
707 glibpth=''
708 libpth=''
709 loclibpth=''
710 plibpth=''
711 xlibpth=''
712 ignore_versioned_solibs=''
713 libs=''
714 lns=''
715 d_PRIEldbl=''
716 d_PRIFldbl=''
717 d_PRIGldbl=''
718 d_PRIeldbl=''
719 d_PRIfldbl=''
720 d_PRIgldbl=''
721 sPRIEldbl=''
722 sPRIFldbl=''
723 sPRIGldbl=''
724 sPRIeldbl=''
725 sPRIfldbl=''
726 sPRIgldbl=''
727 lseeksize=''
728 lseektype=''
729 make_set_make=''
730 d_mymalloc=''
731 freetype=''
732 mallocobj=''
733 mallocsrc=''
734 malloctype=''
735 usemymalloc=''
736 installman1dir=''
737 man1dir=''
738 man1direxp=''
739 man1ext=''
740 installman3dir=''
741 man3dir=''
742 man3direxp=''
743 man3ext=''
744 huge=''
745 large=''
746 medium=''
747 models=''
748 small=''
749 split=''
750 modetype=''
751 multiarch=''
752 mydomain=''
753 myhostname=''
754 phostname=''
755 c=''
756 n=''
757 d_eofnblk=''
758 eagain=''
759 o_nonblock=''
760 rd_nodata=''
761 netdb_hlen_type=''
762 netdb_host_type=''
763 netdb_name_type=''
764 netdb_net_type=''
765 groupcat=''
766 hostcat=''
767 passcat=''
768 orderlib=''
769 ranlib=''
770 package=''
771 spackage=''
772 pager=''
773 apiversion=''
774 patchlevel=''
775 subversion=''
776 version=''
777 perladmin=''
778 perlpath=''
779 pidtype=''
780 prefix=''
781 prefixexp=''
782 installprivlib=''
783 privlib=''
784 privlibexp=''
785 prototype=''
786 ptrsize=''
787 d_PRIX64=''
788 d_PRId64=''
789 d_PRIi64=''
790 d_PRIo64=''
791 d_PRIu64=''
792 d_PRIx64=''
793 sPRIX64=''
794 sPRId64=''
795 sPRIi64=''
796 sPRIo64=''
797 sPRIu64=''
798 sPRIx64=''
799 drand01=''
800 randbits=''
801 randfunc=''
802 randseedtype=''
803 seedfunc=''
804 installscript=''
805 scriptdir=''
806 scriptdirexp=''
807 selectminbits=''
808 selecttype=''
809 sh=''
810 sig_count=''
811 sig_name=''
812 sig_name_init=''
813 sig_num=''
814 sig_num_init=''
815 installsitearch=''
816 sitearch=''
817 sitearchexp=''
818 installsitelib=''
819 sitelib=''
820 sitelibexp=''
821 siteprefix=''
822 siteprefixexp=''
823 sizetype=''
824 so=''
825 sharpbang=''
826 shsharp=''
827 spitshell=''
828 src=''
829 ssizetype=''
830 startperl=''
831 startsh=''
832 stdchar=''
833 d_fgetpos64=''
834 d_fopen64=''
835 d_freopen64=''
836 d_fseek64=''
837 d_fseeko64=''
838 d_fsetpos64=''
839 d_ftell64=''
840 d_ftello64=''
841 d_tmpfile64=''
842 d_stdio_stream_array=''
843 stdio_stream_array=''
844 d_strtoull=''
845 sysman=''
846 trnl=''
847 uidtype=''
848 archname64=''
849 use64bits=''
850 usemultiplicity=''
851 nm_opt=''
852 nm_so_opt=''
853 runnm=''
854 usenm=''
855 useperlio=''
856 usesocks=''
857 d_oldpthreads=''
858 usethreads=''
859 incpath=''
860 mips=''
861 mips_type=''
862 usrinc=''
863 d_vendorlib=''
864 installvendorlib=''
865 vendorlib=''
866 vendorlibexp=''
867 usevendorprefix=''
868 vendorprefix=''
869 vendorprefixexp=''
870 defvoidused=''
871 voidflags=''
872 CONFIG=''
873
874 define='define'
875 undef='undef'
876 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
877 rmlist=''
878
879 : We must find out about Eunice early
880 eunicefix=':'
881 if test -f /etc/unixtovms; then
882         eunicefix=/etc/unixtovms
883 fi
884 if test -f /etc/unixtovms.exe; then
885         eunicefix=/etc/unixtovms.exe
886 fi
887
888 i_whoami=''
889 : Possible local include directories to search.
890 : Set locincpth to "" in a hint file to defeat local include searches.
891 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
892 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
893 :
894 : no include file wanted by default
895 inclwanted=''
896
897 : list of known cpp symbols, sorted alphabetically
898 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
899 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
900 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
901 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
902 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
903 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
904 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
905 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
906 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
907 al="$al VMS Xenix286"
908 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
909 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
910 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
911 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
912 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
913 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
914 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
915 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
916 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
917 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
918 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
919 al="$al __SVR4_2__ __UMAXV__"
920 al="$al ____386BSD____ __alpha __alpha__ __amiga"
921 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
922 al="$al __host_mips__"
923 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
924 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
925 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
926 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
927 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
928 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
929 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
930 al="$al __mc88100 __mc88100__ __mips __mips__"
931 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
932 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
933 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
934 al="$al _host_mips _mips _unix"
935 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
936 al="$al apollo ardent att386 att3b"
937 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
938 al="$al cadmus clipper concurrent convex cray ctix"
939 al="$al dmert encore gcos gcx gimpel gould"
940 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
941 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
942 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
943 al="$al i186 i286 i386 i486 i8086"
944 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
945 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
946 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
947 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
948 al="$al mc88000 mc88100 merlin mert mips mvs n16"
949 al="$al ncl_el ncl_mr"
950 al="$al news1500 news1700 news1800 news1900 news3700"
951 al="$al news700 news800 news900 ns16000 ns32000"
952 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
953 al="$al parisc pc532 pdp11 plexus posix pyr"
954 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
955 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
956 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
957 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
958 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
959 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
960 al="$al xenix z8000"
961
962 : Trailing extension.  Override this in a hint file, if needed.
963 _exe=''
964 : Extra object files, if any, needed on this platform.
965 archobjs=''
966 groupstype=''
967 : change the next line if compiling for Xenix/286 on Xenix/386
968 xlibpth='/usr/lib/386 /lib/386'
969
970 : Possible local library directories to search.
971 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
972 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
973
974 : general looking path for locating libraries
975 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
976 glibpth="$glibpth /lib /usr/lib $xlibpth"
977 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
978 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
979
980 : Private path used by Configure to find libraries.  Its value
981 : is prepended to libpth. This variable takes care of special
982 : machines, like the mips.  Usually, it should be empty.
983 plibpth=''
984
985 : default library list
986 libswanted=''
987 : some systems want to use only the non-versioned libso:s
988 ignore_versioned_solibs=''
989 : full support for void wanted by default
990 defvoidused=15
991
992 : set useposix=false in your hint file to disable the POSIX extension.
993 useposix=true
994 : set useopcode=false in your hint file to disable the Opcode extension.
995 useopcode=true
996 : set usemultiplicity on the Configure command line to enable multiplicity.
997 : set usesocks on the Configure command line to enable socks.
998 : set usethreads on the Configure command line to enable threads.
999 : List of libraries we want.
1000 : If anyone needs -lnet, put it in a hint file.
1001 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1002 libswanted="$libswanted dld ld sun m rt c cposix posix"
1003 libswanted="$libswanted ndir dir crypt sec"
1004 libswanted="$libswanted ucb bsd BSD PW x"
1005 : We probably want to search /usr/shlib before most other libraries.
1006 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1007 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1008 glibpth="/usr/shlib $glibpth"
1009 : Do not use vfork unless overridden by a hint file.
1010 usevfork=false
1011
1012 : Find the basic shell for Bourne shell scripts
1013 case "$sh" in
1014 '')
1015         case "$SYSTYPE" in
1016         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1017         *) xxx='/bin/sh';;
1018         esac
1019         if test -f "$xxx"; then
1020                 sh="$xxx"
1021         else
1022                 : Build up a list and do a single loop so we can 'break' out.
1023                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1024                 for xxx in sh bash ksh pdksh ash; do
1025                         for p in $pth; do
1026                                 try="$try ${p}/${xxx}"
1027                         done
1028                 done
1029                 for xxx in $try; do
1030                         if test -f "$xxx"; then
1031                                 sh="$xxx";
1032                                 break
1033                         elif test -f "$xxx.exe"; then
1034                                 sh="$xxx";
1035                                 break
1036                         fi
1037                 done
1038         fi
1039         ;;
1040 esac
1041
1042 case "$sh" in
1043 '')     cat <<EOM >&2
1044 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1045
1046 Usually it's in /bin/sh.  How did you even get this far?
1047 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1048 we'll try to straighten this all out.
1049 EOM
1050         exit 1
1051         ;;
1052 esac
1053
1054 : see if sh knows # comments
1055 if `$sh -c '#' >/dev/null 2>&1`; then
1056         shsharp=true
1057         spitshell=cat
1058         xcat=/bin/cat
1059         test -f $xcat || xcat=/usr/bin/cat
1060         echo "#!$xcat" >try
1061         $eunicefix try
1062         chmod +x try
1063         ./try > today
1064         if test -s today; then
1065                 sharpbang='#!'
1066         else
1067                 echo "#! $xcat" > try
1068                 $eunicefix try
1069                 chmod +x try
1070                 ./try > today
1071                 if test -s today; then
1072                         sharpbang='#! '
1073                 else
1074                         sharpbang=': use '
1075                 fi
1076         fi
1077 else
1078         echo " "
1079         echo "Your $sh doesn't grok # comments--I will strip them later on."
1080         shsharp=false
1081         cd ..
1082         echo "exec grep -v '^[  ]*#'" >spitshell
1083         chmod +x spitshell
1084         $eunicefix spitshell
1085         spitshell=`pwd`/spitshell
1086         cd UU
1087         echo "I presume that if # doesn't work, #! won't work either!"
1088         sharpbang=': use '
1089 fi
1090 rm -f try today
1091
1092 : figure out how to guarantee sh startup
1093 case "$startsh" in
1094 '') startsh=${sharpbang}${sh} ;;
1095 *)
1096 esac
1097 cat >try <<EOSS
1098 $startsh
1099 set abc
1100 test "$?abc" != 1
1101 EOSS
1102
1103 chmod +x try
1104 $eunicefix try
1105 if ./try; then
1106         : echo "Yup, it does."
1107 else
1108         echo "Hmm... '$startsh' does not guarantee sh startup..."
1109         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1110 fi
1111 rm -f try
1112
1113
1114 : Save command line options in file UU/cmdline.opt for later use in
1115 : generating config.sh.
1116 cat > cmdline.opt <<EOSH
1117 # Configure command line arguments.
1118 config_arg0='$0'
1119 config_args='$*'
1120 config_argc=$#
1121 EOSH
1122 argn=1
1123 for arg in "$@"; do
1124         cat >>cmdline.opt <<EOSH
1125 config_arg$argn='$arg'
1126 EOSH
1127         argn=`expr $argn + 1`
1128 done
1129
1130 : produce awk script to parse command line options
1131 cat >options.awk <<'EOF'
1132 BEGIN {
1133         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
1134
1135         len = length(optstr);
1136         for (i = 1; i <= len; i++) {
1137                 c = substr(optstr, i, 1);
1138                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1139                 if (a == ":") {
1140                         arg[c] = 1;
1141                         i++;
1142                 }
1143                 opt[c] = 1;
1144         }
1145 }
1146 {
1147         expect = 0;
1148         str = $0;
1149         if (substr(str, 1, 1) != "-") {
1150                 printf("'%s'\n", str);
1151                 next;
1152         }
1153         len = length($0);
1154         for (i = 2; i <= len; i++) {
1155                 c = substr(str, i, 1);
1156                 if (!opt[c]) {
1157                         printf("-%s\n", substr(str, i));
1158                         next;
1159                 }
1160                 printf("-%s\n", c);
1161                 if (arg[c]) {
1162                         if (i < len)
1163                                 printf("'%s'\n", substr(str, i + 1));
1164                         else
1165                                 expect = 1;
1166                         next;
1167                 }
1168         }
1169 }
1170 END {
1171         if (expect)
1172                 print "?";
1173 }
1174 EOF
1175
1176 : process the command line options
1177 set X `for arg in "$@"; do echo "X$arg"; done |
1178         sed -e s/X// | awk -f options.awk`
1179 eval "set $*"
1180 shift
1181 rm -f options.awk
1182
1183 : set up default values
1184 fastread=''
1185 reuseval=false
1186 config_sh=''
1187 alldone=''
1188 error=''
1189 silent=''
1190 extractsh=''
1191 override=''
1192 knowitall=''
1193 rm -f optdef.sh
1194 cat >optdef.sh <<EOS
1195 $startsh
1196 EOS
1197
1198
1199 : option parsing
1200 while test $# -gt 0; do
1201         case "$1" in
1202         -d) shift; fastread=yes;;
1203         -e) shift; alldone=cont;;
1204         -f)
1205                 shift
1206                 cd ..
1207                 if test -r "$1"; then
1208                         config_sh="$1"
1209                 else
1210                         echo "$me: cannot read config file $1." >&2
1211                         error=true
1212                 fi
1213                 cd UU
1214                 shift;;
1215         -h) shift; error=true;;
1216         -r) shift; reuseval=true;;
1217         -s) shift; silent=true; realsilent=true;;
1218         -E) shift; alldone=exit;;
1219         -K) shift; knowitall=true;;
1220         -O) shift; override=true;;
1221         -S) shift; silent=true; extractsh=true;;
1222         -D)
1223                 shift
1224                 case "$1" in
1225                 *=)
1226                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1227                         echo "$me: ignoring -D $1" >&2
1228                         ;;
1229                 *=*) echo "$1" | \
1230                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1231                 *) echo "$1='define'" >> optdef.sh;;
1232                 esac
1233                 shift
1234                 ;;
1235         -U)
1236                 shift
1237                 case "$1" in
1238                 *=) echo "$1" >> optdef.sh;;
1239                 *=*)
1240                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1241                         echo "$me: ignoring -U $1" >&2
1242                         ;;
1243                 *) echo "$1='undef'" >> optdef.sh;;
1244                 esac
1245                 shift
1246                 ;;
1247         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1248                 exit 0;;
1249         --) break;;
1250         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1251         *) break;;
1252         esac
1253 done
1254
1255 case "$error" in
1256 true)
1257         cat >&2 <<EOM
1258 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1259                  [-U symbol] [-U symbol=]
1260   -d : use defaults for all answers.
1261   -e : go on without questioning past the production of config.sh.
1262   -f : specify an alternate default configuration file.
1263   -h : print this help message and exit (with an error status).
1264   -r : reuse C symbols value if possible (skips costly nm extraction).
1265   -s : silent mode, only echoes questions and essential information.
1266   -D : define symbol to have some value:
1267          -D symbol         symbol gets the value 'define'
1268          -D symbol=value   symbol gets the value 'value'
1269   -E : stop at the end of questions, after having produced config.sh.
1270   -K : do not use unless you know what you are doing.
1271   -O : let -D and -U override definitions from loaded configuration file.
1272   -S : perform variable substitutions on all .SH files (can mix with -f)
1273   -U : undefine symbol:
1274          -U symbol    symbol gets the value 'undef'
1275          -U symbol=   symbol gets completely empty
1276   -V : print version number and exit (with a zero status).
1277 EOM
1278         exit 1
1279         ;;
1280 esac
1281
1282 : Sanity checks
1283 case "$fastread$alldone" in
1284 yescont|yesexit) ;;
1285 *)
1286         if test ! -t 0; then
1287                 echo "Say 'sh Configure', not 'sh <Configure'"
1288                 exit 1
1289         fi
1290         ;;
1291 esac
1292
1293 exec 4>&1
1294 case "$silent" in
1295 true) exec 1>/dev/null;;
1296 esac
1297
1298 : run the defines and the undefines, if any, but leave the file out there...
1299 touch optdef.sh
1300 . ./optdef.sh
1301
1302 : set package name
1303 package=perl5
1304 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1305 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1306 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1307 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1308 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1309 esac
1310
1311 : Some greps do not return status, grrr.
1312 echo "grimblepritz" >grimble
1313 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1314         contains=contains
1315 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1316         contains=grep
1317 else
1318         contains=contains
1319 fi
1320 rm -f grimble
1321 : the following should work in any shell
1322 case "$contains" in
1323 contains*)
1324         echo " "
1325         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1326         cat >contains <<'EOSS'
1327 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1328 EOSS
1329 chmod +x contains
1330 esac
1331
1332 : Find the path to the source tree
1333 case "$src" in
1334 '') case "$0" in
1335     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1336          case "$src" in
1337          /*)    ;;
1338          *)     src=`cd ../$src && pwd` ;;
1339          esac
1340          ;;
1341     *)   src='.';;
1342     esac;;
1343 esac
1344 case "$src" in
1345 '')     src=/
1346         rsrc=/
1347         ;;
1348 /*) rsrc="$src";;
1349 *) rsrc="../$src";;
1350 esac
1351 if test -f $rsrc/Configure && \
1352         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1353 then
1354    : found it, so we are ok.
1355 else
1356         rsrc=''
1357         for src in . .. ../.. ../../.. ../../../..; do
1358                 if test -f ../$src/Configure && \
1359                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1360                 then
1361                         rsrc=../$src
1362                         break
1363                 fi
1364         done
1365 fi
1366 case "$rsrc" in
1367 '')
1368         cat <<EOM >&4
1369
1370 Sorry, I can't seem to locate the source dir for $package.  Please start
1371 Configure with an explicit path -- i.e. /some/path/Configure.
1372
1373 EOM
1374         exit 1
1375         ;;
1376 ../.)   rsrc='..';;
1377 *)
1378         echo " "
1379         echo "Sources for $package found in \"$src\"." >&4
1380         ;;
1381 esac
1382
1383 : script used to extract .SH files with variable substitutions
1384 cat >extract <<'EOS'
1385 CONFIGDOTSH=true
1386 echo "Doing variable substitutions on .SH files..."
1387 if test -f $src/MANIFEST; then
1388         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1389 else
1390         echo "(Looking for .SH files under the source directory.)"
1391         set x `(cd $src; find . -name "*.SH" -print)`
1392 fi
1393 shift
1394 case $# in
1395 0) set x `(cd $src; echo *.SH)`; shift;;
1396 esac
1397 if test ! -f $src/$1; then
1398         shift
1399 fi
1400 mkdir_p='
1401 name=$1;
1402 create="";
1403 while test $name; do
1404         if test ! -d "$name"; then
1405                 create="$name $create";
1406                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1407                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1408         else
1409                 name="";
1410         fi;
1411 done;
1412 for file in $create; do
1413         mkdir $file;
1414 done
1415 '
1416 for file in $*; do
1417         case "$src" in
1418         ".")
1419                 case "$file" in
1420                 */*)
1421                         dir=`expr X$file : 'X\(.*\)/'`
1422                         file=`expr X$file : 'X.*/\(.*\)'`
1423                         (cd $dir && . ./$file)
1424                         ;;
1425                 *)
1426                         . ./$file
1427                         ;;
1428                 esac
1429                 ;;
1430         *)
1431                 case "$file" in
1432                 */*)
1433                         dir=`expr X$file : 'X\(.*\)/'`
1434                         file=`expr X$file : 'X.*/\(.*\)'`
1435                         (set x $dir; shift; eval $mkdir_p)
1436                         sh <$src/$dir/$file
1437                         ;;
1438                 *)
1439                         sh <$src/$file
1440                         ;;
1441                 esac
1442                 ;;
1443         esac
1444 done
1445 if test -f $src/config_h.SH; then
1446         if test ! -f config.h; then
1447         : oops, they left it out of MANIFEST, probably, so do it anyway.
1448         . $src/config_h.SH
1449         fi
1450 fi
1451 EOS
1452
1453 : extract files and exit if asked to do so
1454 case "$extractsh" in
1455 true)
1456         case "$realsilent" in
1457         true) ;;
1458         *) exec 1>&4;;
1459         esac
1460         case "$config_sh" in
1461         '') config_sh='config.sh';;
1462         esac
1463         echo " "
1464         echo "Fetching answers from $config_sh..."
1465         cd ..
1466         . $config_sh
1467         test "$override" && . ./optdef.sh
1468         echo " "
1469         . UU/extract
1470         rm -rf UU
1471         echo "Done."
1472         exit 0
1473         ;;
1474 esac
1475
1476 : Eunice requires " " instead of "", can you believe it
1477 echo " "
1478 : Here we go...
1479 echo "Beginning of configuration questions for $package."
1480
1481 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1482
1483 : first determine how to suppress newline on echo command
1484 echo " "
1485 echo "Checking echo to see how to suppress newlines..."
1486 (echo "hi there\c" ; echo " ") >.echotmp
1487 if $contains c .echotmp >/dev/null 2>&1 ; then
1488         echo "...using -n."
1489         n='-n'
1490         c=''
1491 else
1492         cat <<'EOM'
1493 ...using \c
1494 EOM
1495         n=''
1496         c='\c'
1497 fi
1498 echo $n "The star should be here-->$c"
1499 echo '*'
1500 rm -f .echotmp
1501
1502 : Now test for existence of everything in MANIFEST
1503 echo " "
1504 if test -f $rsrc/MANIFEST; then
1505         echo "First let's make sure your kit is complete.  Checking..." >&4
1506         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1507         rm -f missing
1508         tmppwd=`pwd`
1509         for filelist in x??; do
1510                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1511         done
1512         if test -s missing; then
1513                 cat missing >&4
1514                 cat >&4 <<'EOM'
1515
1516 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1517
1518 You have the option of continuing the configuration process, despite the
1519 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1520 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1521 and contact the author (perlbug@perl.com).
1522
1523 EOM
1524                 echo $n "Continue? [n] $c" >&4
1525                 read ans
1526                 case "$ans" in
1527                 y*)
1528                         echo "Continuing..." >&4
1529                         rm -f missing
1530                         ;;
1531                 *)
1532                         echo "ABORTING..." >&4
1533                         kill $$
1534                         ;;
1535                 esac
1536         else
1537                 echo "Looks good..."
1538         fi
1539 else
1540         echo "There is no MANIFEST file.  I hope your kit is complete !"
1541 fi
1542 rm -f missing x??
1543
1544 echo " "
1545 : Find the appropriate value for a newline for tr
1546 if test -n "$DJGPP"; then
1547        trnl='\012'
1548 fi
1549 if test X"$trnl" = X; then
1550         case "`echo foo|tr '\n' x 2>/dev/null`" in
1551         foox) trnl='\n' ;;
1552         esac
1553 fi
1554 if test X"$trnl" = X; then
1555         case "`echo foo|tr '\012' x 2>/dev/null`" in
1556         foox) trnl='\012' ;;
1557         esac
1558 fi
1559 if test X"$trnl" = X; then
1560         cat <<EOM >&2
1561
1562 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1563
1564 EOM
1565         exit 1
1566 fi
1567
1568 : compute the number of columns on the terminal for proper question formatting
1569 case "$COLUMNS" in
1570 '') COLUMNS='80';;
1571 esac
1572
1573 : set up the echo used in my read
1574 myecho="case \"\$xxxm\" in
1575 '') echo $n \"\$rp $c\" >&4;;
1576 *) case \"\$rp\" in
1577         '') echo $n \"[\$xxxm] $c\";;
1578         *)
1579                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1580                         echo \"\$rp\" >&4
1581                         echo $n \"[\$xxxm] $c\" >&4
1582                 else
1583                         echo $n \"\$rp [\$xxxm] $c\" >&4
1584                 fi
1585                 ;;
1586         esac;;
1587 esac"
1588
1589 : now set up to do reads with possible shell escape and default assignment
1590 cat <<EOSC >myread
1591 $startsh
1592 xxxm=\$dflt
1593 $myecho
1594 ans='!'
1595 case "\$fastread" in
1596 yes) case "\$dflt" in
1597         '') ;;
1598         *) ans='';
1599                 case "\$silent-\$rp" in
1600                 true-) ;;
1601                 *) echo " " >&4;;
1602                 esac;;
1603         esac;;
1604 *) case "\$silent" in
1605         true) case "\$rp" in
1606                 '') ans='';;
1607                 esac;;
1608         esac;;
1609 esac
1610 while expr "X\$ans" : "X!" >/dev/null; do
1611         read answ
1612         set x \$xxxm
1613         shift
1614         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1615         case  "\$answ" in
1616         "!")
1617                 sh 1>&4
1618                 echo " "
1619                 $myecho
1620                 ;;
1621         !*)
1622                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1623                 shift
1624                 sh 1>&4 -c "\$*"
1625                 echo " "
1626                 $myecho
1627                 ;;
1628         "\$ans")
1629                 case "\$ans" in
1630                 \\&*)
1631                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1632                         shift
1633                         case "\$1" in
1634                         -d)
1635                                 fastread=yes
1636                                 echo "(OK, I'll run with -d after this question.)" >&4
1637                                 ;;
1638                         -*)
1639                                 echo "*** Sorry, \$1 not supported yet." >&4
1640                                 ;;
1641                         esac
1642                         $myecho
1643                         ans=!
1644                         ;;
1645                 esac;;
1646         *)
1647                 case "\$aok" in
1648                 y)
1649                         echo "*** Substitution done -- please confirm."
1650                         xxxm="\$ans"
1651                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1652                         xxxm="\$ans"
1653                         ans=!
1654                         ;;
1655                 *)
1656                         echo "*** Error -- try again."
1657                         ans=!
1658                         ;;
1659                 esac
1660                 $myecho
1661                 ;;
1662         esac
1663         case "\$ans\$xxxm\$nostick" in
1664         '')
1665                 ans=!
1666                 $myecho
1667                 ;;
1668         esac
1669 done
1670 case "\$ans" in
1671 '') ans="\$xxxm";;
1672 esac
1673 EOSC
1674
1675 : create .config dir to save info across Configure sessions
1676 test -d ../.config || mkdir ../.config
1677 cat >../.config/README <<EOF
1678 This directory created by Configure to save information that should
1679 persist across sessions for $package.
1680
1681 You may safely delete it if you wish.
1682 EOF
1683
1684 : general instructions
1685 needman=true
1686 firsttime=true
1687 user=`(logname) 2>/dev/null`
1688 case "$user" in
1689 '') user=`whoami 2>&1`;;
1690 esac
1691 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1692         firsttime=false
1693         echo " "
1694         rp='Would you like to see the instructions?'
1695         dflt=n
1696         . ./myread
1697         case "$ans" in
1698         [yY]*) ;;
1699         *) needman=false;;
1700         esac
1701 fi
1702 if $needman; then
1703         cat <<EOH
1704
1705 This installation shell script will examine your system and ask you questions
1706 to determine how the perl5 package should be installed. If you get
1707 stuck on a question, you may use a ! shell escape to start a subshell or
1708 execute a command.  Many of the questions will have default answers in square
1709 brackets; typing carriage return will give you the default.
1710
1711 On some of the questions which ask for file or directory names you are allowed
1712 to use the ~name construct to specify the login directory belonging to "name",
1713 even if you don't have a shell which knows about that.  Questions where this is
1714 allowed will be marked "(~name ok)".
1715
1716 EOH
1717         rp=''
1718         dflt='Type carriage return to continue'
1719         . ./myread
1720         cat <<'EOH'
1721
1722 The prompter used in this script allows you to use shell variables and
1723 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1724 in the default answer, as if the default line was a set of arguments given to a
1725 script shell.  This means you may also use $* to repeat the whole default line,
1726 so you do not have to re-type everything to add something to the default.
1727
1728 Everytime there is a substitution, you will have to confirm.  If there is an
1729 error (e.g. an unmatched backtick), the default answer will remain unchanged
1730 and you will be prompted again.
1731
1732 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1733 the questions and use the computed defaults (or the previous answers if there
1734 was already a config.sh file). Type 'Configure -h' for a list of options.
1735 You may also start interactively and then answer '& -d' at any prompt to turn
1736 on the non-interactive behaviour for the remainder of the execution.
1737
1738 EOH
1739         . ./myread
1740         cat <<EOH
1741
1742 Much effort has been expended to ensure that this shell script will run on any
1743 Unix system.  If despite that it blows up on yours, your best bet is to edit
1744 Configure and run it again.  If you can't run Configure for some reason,
1745 you'll have to generate a config.sh file by hand.  Whatever problems you
1746 have, let me (perlbug@perl.com) know how I blew it.
1747
1748 This installation script affects things in two ways:
1749
1750 1) it may do direct variable substitutions on some of the files included
1751    in this kit.
1752 2) it builds a config.h file for inclusion in C programs.  You may edit
1753    any of these files as the need arises after running this script.
1754
1755 If you make a mistake on a question, there is no easy way to back up to it
1756 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1757 files.  Configure will offer to let you do this before it runs the SH files.
1758
1759 EOH
1760         dflt='Type carriage return to continue'
1761         . ./myread
1762         case "$firsttime" in
1763         true) echo $user >>../.config/instruct;;
1764         esac
1765 fi
1766
1767 : find out where common programs are
1768 echo " "
1769 echo "Locating common programs..." >&4
1770 cat <<EOSC >loc
1771 $startsh
1772 case \$# in
1773 0) exit 1;;
1774 esac
1775 thing=\$1
1776 shift
1777 dflt=\$1
1778 shift
1779 for dir in \$*; do
1780         case "\$thing" in
1781         .)
1782         if test -d \$dir/\$thing; then
1783                 echo \$dir
1784                 exit 0
1785         fi
1786         ;;
1787         *)
1788         for thisthing in \$dir/\$thing; do
1789                 : just loop through to pick last item
1790         done
1791         if test -f \$thisthing; then
1792                 echo \$thisthing
1793                 exit 0
1794         elif test -f \$dir/\$thing.exe; then
1795                 if test -n "$DJGPP"; then
1796                         echo \$dir/\$thing.exe
1797                 else
1798                         : on Eunice apparently
1799                         echo \$dir/\$thing
1800                 fi
1801                 exit 0
1802         fi
1803         ;;
1804         esac
1805 done
1806 echo \$dflt
1807 exit 1
1808 EOSC
1809 chmod +x loc
1810 $eunicefix loc
1811 loclist="
1812 awk
1813 cat
1814 comm
1815 cp
1816 echo
1817 expr
1818 grep
1819 ls
1820 make
1821 mkdir
1822 rm
1823 sed
1824 sort
1825 touch
1826 tr
1827 uniq
1828 "
1829 trylist="
1830 Mcc
1831 ar
1832 byacc
1833 cpp
1834 csh
1835 date
1836 egrep
1837 gzip
1838 less
1839 ln
1840 more
1841 nm
1842 nroff
1843 pg
1844 test
1845 uname
1846 zip
1847 "
1848 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1849 pth="$pth /lib /usr/lib"
1850 for file in $loclist; do
1851         eval xxx=\$$file
1852         case "$xxx" in
1853         /*|?:[\\/]*)
1854                 if test -f "$xxx"; then
1855                         : ok
1856                 else
1857                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1858                         xxx=`./loc $file $file $pth`
1859                 fi
1860                 ;;
1861         '') xxx=`./loc $file $file $pth`;;
1862         *) xxx=`./loc $xxx $xxx $pth`;;
1863         esac
1864         eval $file=$xxx
1865         eval _$file=$xxx
1866         case "$xxx" in
1867         /*)
1868                 echo $file is in $xxx.
1869                 ;;
1870         ?:[\\/]*)
1871                 echo $file is in $xxx.
1872                 ;;
1873         *)
1874                 echo "I don't know where '$file' is, and my life depends on it." >&4
1875                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1876                 exit 1
1877                 ;;
1878         esac
1879 done
1880 echo " "
1881 echo "Don't worry if any of the following aren't found..."
1882 say=offhand
1883 for file in $trylist; do
1884         eval xxx=\$$file
1885         case "$xxx" in
1886         /*|?:[\\/]*)
1887                 if test -f "$xxx"; then
1888                         : ok
1889                 else
1890                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1891                         xxx=`./loc $file $file $pth`
1892                 fi
1893                 ;;
1894         '') xxx=`./loc $file $file $pth`;;
1895         *) xxx=`./loc $xxx $xxx $pth`;;
1896         esac
1897         eval $file=$xxx
1898         eval _$file=$xxx
1899         case "$xxx" in
1900         /*)
1901                 echo $file is in $xxx.
1902                 ;;
1903         ?:[\\/]*)
1904                 echo $file is in $xxx.
1905                 ;;
1906         *)
1907                 echo "I don't see $file out there, $say."
1908                 say=either
1909                 ;;
1910         esac
1911 done
1912 case "$egrep" in
1913 egrep)
1914         echo "Substituting grep for egrep."
1915         egrep=$grep
1916         ;;
1917 esac
1918 case "$ln" in
1919 ln)
1920         echo "Substituting cp for ln."
1921         ln=$cp
1922         ;;
1923 esac
1924 case "$test" in
1925 test)
1926         echo "Hopefully test is built into your sh."
1927         ;;
1928 *)
1929         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1930                 echo "Using the test built into your sh."
1931                 test=test
1932                 _test=test
1933         fi
1934         ;;
1935 esac
1936 case "$echo" in
1937 echo)
1938         echo "Hopefully echo is built into your sh."
1939         ;;
1940 '') ;;
1941 *)
1942         echo " "
1943 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1944         $echo $n "hi there$c" >foo1
1945         echo $n "hi there$c" >foo2
1946         if cmp foo1 foo2 >/dev/null 2>&1; then
1947                 echo "They are compatible.  In fact, they may be identical."
1948         else
1949                 case "$n" in
1950                 '-n') n='' c='\c';;
1951                 *) n='-n' c='';;
1952                 esac
1953                 cat <<FOO
1954 They are not compatible!  You are probably running ksh on a non-USG system.
1955 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1956 have echo built in and we may have to run some Bourne shell scripts.  That
1957 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1958
1959 FOO
1960                 $echo $n "The star should be here-->$c"
1961                 $echo "*"
1962         fi
1963         $rm -f foo1 foo2
1964         ;;
1965 esac
1966
1967 : determine whether symbolic links are supported
1968 echo " "
1969 $touch blurfl
1970 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1971         echo "Symbolic links are supported." >&4
1972         lns="$ln -s"
1973 else
1974         echo "Symbolic links are NOT supported." >&4
1975         lns="$ln"
1976 fi
1977 $rm -f blurfl sym
1978
1979 : see whether [:lower:] and [:upper:] are supported character classes
1980 echo " "
1981 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1982 ABYZ)
1983         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1984         up='[:upper:]'
1985         low='[:lower:]'
1986         ;;
1987 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
1988         # (0xc9 and 0xd1), therefore that is a nice testing point.
1989         if test "X$up" = X -o "X$low" = X; then
1990             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1991             ij) up='[A-Z]'
1992                 low='[a-z]'
1993                 ;;
1994             esac
1995         fi
1996         if test "X$up" = X -o "X$low" = X; then
1997             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1998             ij) up='A-Z'
1999                 low='a-z'
2000                 ;;
2001             esac
2002         fi
2003         if test "X$up" = X -o "X$low" = X; then
2004             case "`echo IJ | od -x 2>/dev/null`" in
2005             *C9D1*|*c9d1*)
2006                 echo "Hey, this might be EBCDIC." >&4
2007                 if test "X$up" = X -o "X$low" = X; then
2008                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2009                     ij) up='[A-IJ-RS-Z]'
2010                         low='[a-ij-rs-z]'
2011                         ;;
2012                     esac
2013                 fi
2014                 if test "X$up" = X -o "X$low" = X; then
2015                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2016                     ij) up='A-IJ-RS-Z'
2017                         low='a-ij-rs-z'
2018                         ;;
2019                     esac
2020                 fi
2021                 ;;
2022             esac
2023         fi
2024 esac
2025 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2026 ij)
2027     echo "Using $up and $low to convert case." >&4
2028     ;;
2029 *)
2030     echo "I don't know how to translate letters from upper to lower case." >&4
2031     echo "Your tr is not acting any way I know of." >&4
2032     exit 1
2033     ;;
2034 esac
2035 : set up the translation script tr, must be called with ./tr of course
2036 cat >tr <<EOSC
2037 $startsh
2038 case "\$1\$2" in
2039 '[A-Z][a-z]') exec $tr '$up' '$low';;
2040 '[a-z][A-Z]') exec $tr '$low' '$up';;
2041 esac
2042 exec $tr "\$@"
2043 EOSC
2044 chmod +x tr
2045 $eunicefix tr
2046
2047 : Try to determine whether config.sh was made on this system
2048 case "$config_sh" in
2049 '')
2050 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2051 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2052 # because the A-Z/a-z are not consecutive.
2053 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2054         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2055 newmyuname="$myuname"
2056 dflt=n
2057 case "$knowitall" in
2058 '')
2059         if test -f ../config.sh; then
2060                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2061                         eval "`grep myuname= ../config.sh`"
2062                 fi
2063                 if test "X$myuname" = "X$newmyuname"; then
2064                         dflt=y
2065                 fi
2066         fi
2067         ;;
2068 *) dflt=y;;
2069 esac
2070
2071 : Get old answers from old config file if Configure was run on the
2072 : same system, otherwise use the hints.
2073 hint=default
2074 cd ..
2075 if test -f config.sh; then
2076         echo " "
2077         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2078         . UU/myread
2079         case "$ans" in
2080         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2081         *)  echo "Fetching default answers from your old config.sh file..." >&4
2082                 tmp_n="$n"
2083                 tmp_c="$c"
2084                 tmp_sh="$sh"
2085                 . ./config.sh
2086                 cp config.sh UU
2087                 n="$tmp_n"
2088                 c="$tmp_c"
2089                 : Older versions did not always set $sh.  Catch re-use of such
2090                 : an old config.sh.
2091                 case "$sh" in
2092                 '') sh="$tmp_sh" ;;
2093                 esac
2094                 hint=previous
2095                 ;;
2096         esac
2097 fi
2098 if test ! -f config.sh; then
2099         $cat <<EOM
2100
2101 First time through, eh?  I have some defaults handy for some systems
2102 that need some extra help getting the Configure answers right:
2103
2104 EOM
2105         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2106         dflt=''
2107         : Half the following guesses are probably wrong... If you have better
2108         : tests or hints, please send them to perlbug@perl.com
2109         : The metaconfig authors would also appreciate a copy...
2110         $test -f /irix && osname=irix
2111         $test -f /xenix && osname=sco_xenix
2112         $test -f /dynix && osname=dynix
2113         $test -f /dnix && osname=dnix
2114         $test -f /lynx.os && osname=lynxos
2115         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2116         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2117         $test -f /bin/mips && /bin/mips && osname=mips
2118         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2119                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2120         $test -d /usr/apollo/bin && osname=apollo
2121         $test -f /etc/saf/_sactab && osname=svr4
2122         $test -d /usr/include/minix && osname=minix
2123         if $test -d /MachTen -o -d /MachTen_Folder; then
2124                 osname=machten
2125                 if $test -x /sbin/version; then
2126                         osvers=`/sbin/version | $awk '{print $2}' |
2127                         $sed -e 's/[A-Za-z]$//'`
2128                 elif $test -x /usr/etc/version; then
2129                         osvers=`/usr/etc/version | $awk '{print $2}' |
2130                         $sed -e 's/[A-Za-z]$//'`
2131                 else
2132                         osvers="$2.$3"
2133                 fi
2134         fi
2135        $test -f /sys/posix.dll &&
2136                $test -f /usr/bin/what &&
2137                set X `/usr/bin/what /sys/posix.dll` &&
2138                $test "$3" = UWIN &&
2139                osname=uwin &&
2140                osvers="$5"
2141         if $test -f $uname; then
2142                 set X $myuname
2143                 shift
2144
2145                 case "$5" in
2146                 fps*) osname=fps ;;
2147                 mips*)
2148                         case "$4" in
2149                         umips) osname=umips ;;
2150                         *) osname=mips ;;
2151                         esac;;
2152                 [23]100) osname=mips ;;
2153                 next*) osname=next ;;
2154                 i386*)
2155                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2156                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2157                                 osname='sco'
2158                                 osvers=$tmp
2159                         elif $test -f /etc/kconfig; then
2160                                 osname=isc
2161                                 if test "$lns" = "$ln -s"; then
2162                                         osvers=4
2163                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2164                                         osvers=3
2165                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2166                                         osvers=2
2167                                 fi
2168                         fi
2169                         tmp=''
2170                         ;;
2171                 pc*)
2172                         if test -n "$DJGPP"; then
2173                                 osname=dos
2174                                 osvers=djgpp
2175                         fi
2176                         ;;
2177                 esac
2178
2179                 case "$1" in
2180                 aix) osname=aix
2181                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2182                         case "$tmp" in
2183                         'not found') osvers="$4"."$3" ;;
2184                         '<3240'|'<>3240') osvers=3.2.0 ;;
2185                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2186                         '=3250'|'>3250') osvers=3.2.5 ;;
2187                         *) osvers=$tmp;;
2188                         esac
2189                         ;;
2190                 *dc.osx) osname=dcosx
2191                         osvers="$3"
2192                         ;;
2193                 dnix) osname=dnix
2194                         osvers="$3"
2195                         ;;
2196                 domainos) osname=apollo
2197                         osvers="$3"
2198                         ;;
2199                 dgux) osname=dgux 
2200                         osvers="$3"
2201                         ;;
2202                 dynixptx*) osname=dynixptx
2203                         osvers=`echo "$4"|sed 's/^v//'`
2204                         ;;
2205                 freebsd) osname=freebsd 
2206                         osvers="$3" ;;
2207                 genix) osname=genix ;;
2208                 hp*) osname=hpux 
2209                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2210                         ;;
2211                 irix*) osname=irix
2212                         case "$3" in
2213                         4*) osvers=4 ;;
2214                         5*) osvers=5 ;;
2215                         *)      osvers="$3" ;;
2216                         esac
2217                         ;;
2218                 linux) osname=linux
2219                         case "$3" in
2220                         *)      osvers="$3" ;;
2221                         esac
2222                         ;;
2223                 MiNT) osname=mint
2224                         ;;
2225                 netbsd*) osname=netbsd
2226                         osvers="$3"
2227                         ;;
2228                 news-os) osvers="$3"
2229                         case "$3" in
2230                         4*) osname=newsos4 ;;
2231                         *) osname=newsos ;;
2232                         esac
2233                         ;;
2234                 bsd386) osname=bsd386
2235                         osvers=`$uname -r`
2236                         ;;
2237                 POSIX-BC | posix-bc ) osname=posix-bc
2238                         osvers="$3"
2239                         ;;
2240                 powerux | power_ux | powermax_os | powermaxos | \
2241                 powerunix | power_unix) osname=powerux
2242                         osvers="$3"
2243                         ;;
2244                 next*) osname=next ;;
2245                 solaris) osname=solaris
2246                         case "$3" in
2247                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2248                         *)      osvers="$3" ;;
2249                         esac
2250                         ;;
2251                 sunos) osname=sunos
2252                         case "$3" in
2253                         5*) osname=solaris
2254                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2255                         *)      osvers="$3" ;;
2256                         esac
2257                         ;;
2258                 titanos) osname=titanos
2259                         case "$3" in
2260                         1*) osvers=1 ;;
2261                         2*) osvers=2 ;;
2262                         3*) osvers=3 ;;
2263                         4*) osvers=4 ;;
2264                         *)      osvers="$3" ;;
2265                         esac
2266                         ;;
2267                 ultrix) osname=ultrix
2268                         osvers="$3"
2269                         ;;
2270                 osf1|mls+)      case "$5" in
2271                                 alpha)
2272                                         osname=dec_osf
2273                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2274                                         ;;
2275                         hp*)    osname=hp_osf1  ;;
2276                         mips)   osname=mips_osf1 ;;
2277                         esac
2278                         ;;
2279                 uts) osname=uts 
2280                         osvers="$3"
2281                         ;;
2282                 qnx) osname=qnx
2283                         osvers="$4"
2284                         ;;
2285                 $2) case "$osname" in
2286                         *isc*) ;;
2287                         *freebsd*) ;;
2288                         svr*)
2289                                 : svr4.x or possibly later
2290                                 case "svr$3" in 
2291                                 ${osname}*)
2292                                         osname=svr$3
2293                                         osvers=$4
2294                                         ;;
2295                                 esac
2296                                 case "$osname" in
2297                                 svr4.0)
2298                                         : Check for ESIX
2299                                         if test -f /stand/boot ; then
2300                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2301                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2302                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2303                                                         if test -n "$isesix"; then
2304                                                                 osname=esix4
2305                                                         fi
2306                                                 fi
2307                                         fi
2308                                         ;;
2309                                 esac
2310                                 ;;
2311                         *)      if test -f /etc/systemid; then
2312                                         osname=sco
2313                                         set `echo $3 | $sed 's/\./ /g'` $4
2314                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2315                                                 osvers=$1.$2.$3
2316                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2317                                                 osvers=$1.$2
2318                                         elif $test -f $src/hints/sco_$1.sh; then
2319                                                 osvers=$1
2320                                         fi
2321                                 else
2322                                         case "$osname" in
2323                                         '') : Still unknown.  Probably a generic Sys V.
2324                                                 osname="sysv"
2325                                                 osvers="$3"
2326                                                 ;;
2327                                         esac
2328                                 fi
2329                                 ;;
2330                         esac
2331                         ;;
2332                 *)      case "$osname" in
2333                         '') : Still unknown.  Probably a generic BSD.
2334                                 osname="$1"
2335                                 osvers="$3"
2336                                 ;;
2337                         esac
2338                         ;;
2339                 esac
2340         else
2341                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2342                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2343                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2344                                 osname=news_os
2345                         fi
2346                         $rm -f UU/kernel.what
2347                 elif test -d c:/.; then
2348                         set X $myuname
2349                         osname=os2
2350                         osvers="$5"
2351                 fi
2352         fi
2353         
2354         : Now look for a hint file osname_osvers, unless one has been
2355         : specified already.
2356         case "$hintfile" in
2357         ''|' ')
2358                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2359                 : Also try without trailing minor version numbers.
2360                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2361                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2362                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2363                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2364                 case "$file" in
2365                 '') dflt=none ;;
2366                 *)  case "$osvers" in
2367                         '') dflt=$file
2368                                 ;;
2369                         *)  if $test -f $src/hints/$file.sh ; then
2370                                         dflt=$file
2371                                 elif $test -f $src/hints/$xfile.sh ; then
2372                                         dflt=$xfile
2373                                 elif $test -f $src/hints/$xxfile.sh ; then
2374                                         dflt=$xxfile
2375                                 elif $test -f $src/hints/$xxxfile.sh ; then
2376                                         dflt=$xxxfile
2377                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2378                                         dflt=$xxxxfile
2379                                 elif $test -f "$src/hints/${osname}.sh" ; then
2380                                         dflt="${osname}"
2381                                 else
2382                                         dflt=none
2383                                 fi
2384                                 ;;
2385                         esac
2386                         ;;
2387                 esac
2388                 if $test -f Policy.sh ; then
2389                         case "$dflt" in
2390                         *Policy*) ;;
2391                         none) dflt="Policy" ;;
2392                         *) dflt="Policy $dflt" ;;
2393                         esac
2394                 fi
2395                 ;;
2396         *)
2397                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2398                 ;;
2399         esac
2400
2401         if $test -f Policy.sh ; then
2402                 $cat <<EOM
2403
2404 There's also a Policy hint file available, which should make the
2405 site-specific (policy) questions easier to answer.
2406 EOM
2407
2408         fi
2409
2410         $cat <<EOM
2411
2412 You may give one or more space-separated answers, or "none" if appropriate.
2413 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2414 is a good thing.  DO NOT give a wrong version or a wrong OS.
2415
2416 EOM
2417
2418         rp="Which of these apply, if any?"
2419         . UU/myread
2420         tans=$ans
2421         for file in $tans; do
2422                 if $test X$file = XPolicy -a -f Policy.sh; then
2423                         . Policy.sh
2424                         $cat Policy.sh >> UU/config.sh
2425                 elif $test -f $src/hints/$file.sh; then
2426                         . $src/hints/$file.sh
2427                         $cat $src/hints/$file.sh >> UU/config.sh
2428                 elif $test X$tans = X -o X$tans = Xnone ; then
2429                         : nothing
2430                 else
2431                         : Give one chance to correct a possible typo.
2432                         echo "$file.sh does not exist"
2433                         dflt=$file
2434                         rp="hint to use instead?"
2435                         . UU/myread
2436                         for file in $ans; do
2437                                 if $test -f "$src/hints/$file.sh"; then
2438                                         . $src/hints/$file.sh
2439                                         $cat $src/hints/$file.sh >> UU/config.sh
2440                                 elif $test X$ans = X -o X$ans = Xnone ; then
2441                                         : nothing
2442                                 else
2443                                         echo "$file.sh does not exist -- ignored."
2444                                 fi
2445                         done
2446                 fi
2447         done
2448
2449         hint=recommended
2450         : Remember our hint file for later.
2451         if $test -f "$src/hints/$file.sh" ; then
2452                 hintfile="$file"
2453         else
2454                 hintfile=''
2455         fi
2456 fi
2457 cd UU
2458 ;;
2459 *)
2460         echo " "
2461         echo "Fetching default answers from $config_sh..." >&4
2462         tmp_n="$n"
2463         tmp_c="$c"
2464         cd ..
2465         cp $config_sh config.sh 2>/dev/null
2466         chmod +w config.sh
2467         . ./config.sh
2468         cd UU
2469         cp ../config.sh .
2470         n="$tmp_n"
2471         c="$tmp_c"
2472         hint=previous
2473         ;;
2474 esac
2475 test "$override" && . ./optdef.sh
2476 myuname="$newmyuname"
2477
2478 : Restore computed paths
2479 for file in $loclist $trylist; do
2480         eval $file="\$_$file"
2481 done
2482
2483 cat << EOM
2484
2485 Configure uses the operating system name and version to set some defaults.
2486 The default value is probably right if the name rings a bell. Otherwise,
2487 since spelling matters for me, either accept the default or answer "none"
2488 to leave it blank.
2489
2490 EOM
2491 case "$osname" in
2492         ''|' ')
2493                 case "$hintfile" in
2494                 ''|' '|none) dflt=none ;;
2495                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2496                 esac
2497                 ;;
2498         *) dflt="$osname" ;;
2499 esac
2500 rp="Operating system name?"
2501 . ./myread
2502 case "$ans" in
2503 none)  osname='' ;;
2504 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2505 esac
2506 echo " "
2507 case "$osvers" in
2508         ''|' ')
2509                 case "$hintfile" in
2510                 ''|' '|none) dflt=none ;;
2511                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2512                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2513                         case "$dflt" in
2514                         ''|' ') dflt=none ;;
2515                         esac
2516                         ;;
2517                 esac
2518                 ;;
2519         *) dflt="$osvers" ;;
2520 esac
2521 rp="Operating system version?"
2522 . ./myread
2523 case "$ans" in
2524 none)  osvers='' ;;
2525 *) osvers="$ans" ;;
2526 esac
2527
2528 : who configured the system
2529 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2530 cf_by=`(logname) 2>/dev/null`
2531 case "$cf_by" in
2532 "")
2533         cf_by=`(whoami) 2>/dev/null`
2534         case "$cf_by" in
2535         "") cf_by=unknown ;;
2536         esac ;;
2537 esac
2538
2539 : set up the script used to warn in case of inconsistency
2540 cat <<EOS >whoa
2541 $startsh
2542 EOS
2543 cat <<'EOSC' >>whoa
2544 dflt=y
2545 echo " "
2546 echo "*** WHOA THERE!!! ***" >&4
2547 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2548 rp="    Keep the $hint value?"
2549 . ./myread
2550 case "$ans" in
2551 y) td=$was; tu=$was;;
2552 esac
2553 EOSC
2554
2555 : function used to set $1 to $val
2556 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2557 case "$val$was" in
2558 $define$undef) . ./whoa; eval "$var=\$td";;
2559 $undef$define) . ./whoa; eval "$var=\$tu";;
2560 *) eval "$var=$val";;
2561 esac'
2562
2563 cat <<EOM
2564
2565 Perl can be built to take advantage of threads, on some systems.
2566 To do so, Configure must be run with -Dusethreads.
2567
2568 Note that threading is a highly experimental feature, and
2569 some known race conditions still remain.  If you choose to try
2570 it, be very sure to not actually deploy it for production
2571 purposes.  README.threads has more details, and is required
2572 reading if you enable threads.
2573 EOM
2574 case "$usethreads" in
2575 $define|true|[yY]*)     dflt='y';;
2576 *) dflt='n';;
2577 esac
2578 rp='Build a threading Perl?'
2579 . ./myread
2580 case "$ans" in
2581 y|Y)    val="$define" ;;     
2582 *)      val="$undef" ;;
2583 esac
2584 set usethreads
2585 eval $setvar 
2586
2587 case "$d_oldpthreads" in
2588 '')     : Configure tests would be welcome here.  For now, assume undef.
2589         val="$undef" ;;
2590 *)      val="$d_oldpthreads" ;;
2591 esac
2592 set d_oldpthreads
2593 eval $setvar
2594
2595
2596 case "$usethreads" in
2597 "$define"|true|[yY]*)
2598 : Look for a hint-file generated 'call-back-unit'.  If the
2599 : user has specified that a threading perl is to be built,
2600 : we may need to set or change some other defaults.
2601         if $test -f usethreads.cbu; then
2602                 echo "Your platform has some specific hints for threaded builds, using them..."
2603                 . ./usethreads.cbu
2604         else
2605                 $cat <<EOM
2606 (Your platform doesn't have any specific hints for threaded builds.
2607  Assuming POSIX threads, then.)
2608 EOM
2609         fi
2610     ;;
2611 esac
2612
2613 cat <<EOM
2614
2615 Perl can be built so that multiple Perl interpreters can coexist
2616 within the same Perl executable.  To do so, Configure must be run with
2617 -Dusemultiplicity.
2618
2619 Normally you do not need this and you should answer no.
2620
2621 EOM
2622 case "$usemultiplicity" in
2623 $define|true|[yY]*)     dflt='y';;
2624 *) dflt='n';;
2625 esac
2626 rp='Build Perl for multiplicity?'
2627 . ./myread
2628 case "$ans" in
2629 y|Y)    val="$define" ;;     
2630 *)      val="$undef" ;;
2631 esac
2632 set usemultiplicity
2633 eval $setvar 
2634
2635 : determine where manual pages are on this system
2636 echo " "
2637 case "$sysman" in
2638 '') 
2639         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2640         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2641         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2642         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2643         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2644         sysman=`./loc . /usr/man/man1 $syspath`
2645         ;;
2646 esac
2647 if $test -d "$sysman"; then
2648         echo "System manual is in $sysman." >&4
2649 else
2650         echo "Could not find manual pages in source form." >&4
2651 fi
2652
2653 : see what memory models we can support
2654 case "$models" in
2655 '')
2656         $cat >pdp11.c <<'EOP'
2657 int main() {
2658 #ifdef pdp11
2659         exit(0);
2660 #else
2661         exit(1);
2662 #endif
2663 }
2664 EOP
2665         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2666         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2667                 dflt='unsplit split'
2668         else
2669                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2670                 case "$tans" in
2671                 X) dflt='none';;
2672                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2673                                 dflt='small'
2674                         else
2675                                 dflt=''
2676                         fi
2677                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2678                                 dflt="$dflt medium"
2679                         fi
2680                         if $test -d /lib/large || $test -d /usr/lib/large; then
2681                                 dflt="$dflt large"
2682                         fi
2683                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2684                                 dflt="$dflt huge"
2685                         fi
2686                 esac
2687         fi;;
2688 *) dflt="$models";;
2689 esac
2690 $cat <<EOM
2691  
2692 Some systems have different model sizes.  On most systems they are called
2693 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2694 split.  If your system doesn't support different memory models, say "none".
2695 If you wish to force everything to one memory model, say "none" here and
2696 put the appropriate flags later when it asks you for other cc and ld flags.
2697 Venix systems may wish to put "none" and let the compiler figure things out.
2698 (In the following question multiple model names should be space separated.)
2699
2700 The default for most systems is "none".
2701
2702 EOM
2703 rp="Which memory models are supported?"
2704 . ./myread
2705 models="$ans"
2706
2707 case "$models" in
2708 none)
2709         small=''
2710         medium=''
2711         large=''
2712         huge=''
2713         unsplit=''
2714         split=''
2715         ;;
2716 *split)
2717         case "$split" in
2718         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2719                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2720                         dflt='-i'
2721                 else
2722                         dflt='none'
2723                 fi;;
2724         *) dflt="$split";;
2725         esac
2726         rp="What flag indicates separate I and D space?"
2727         . ./myread
2728         tans="$ans"
2729         case "$tans" in
2730         none) tans='';;
2731         esac
2732         split="$tans"
2733         unsplit='';;
2734 *large*|*small*|*medium*|*huge*)
2735         case "$models" in
2736         *large*)
2737                 case "$large" in
2738                 '') dflt='-Ml';;
2739                 *) dflt="$large";;
2740                 esac
2741         rp="What flag indicates large model?"
2742         . ./myread
2743         tans="$ans"
2744         case "$tans" in
2745         none) tans='';
2746         esac
2747         large="$tans";;
2748         *) large='';;
2749         esac
2750         case "$models" in
2751         *huge*) case "$huge" in
2752                 '') dflt='-Mh';;
2753                 *) dflt="$huge";;
2754                 esac
2755                 rp="What flag indicates huge model?"
2756                 . ./myread
2757                 tans="$ans"
2758                 case "$tans" in
2759                 none) tans='';
2760                 esac
2761                 huge="$tans";;
2762         *) huge="$large";;
2763         esac
2764         case "$models" in
2765         *medium*) case "$medium" in
2766                 '') dflt='-Mm';;
2767                 *) dflt="$medium";;
2768                 esac
2769                 rp="What flag indicates medium model?"
2770                 . ./myread
2771                 tans="$ans"
2772                 case "$tans" in
2773                 none) tans='';
2774                 esac
2775                 medium="$tans";;
2776         *) medium="$large";;
2777         esac
2778         case "$models" in
2779         *small*) case "$small" in
2780                 '') dflt='none';;
2781                 *) dflt="$small";;
2782                 esac
2783                 rp="What flag indicates small model?"
2784                 . ./myread
2785                 tans="$ans"
2786                 case "$tans" in
2787                 none) tans='';
2788                 esac
2789                 small="$tans";;
2790         *) small='';;
2791         esac
2792         ;;
2793 *)
2794         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2795         ;;
2796 esac
2797 $rm -f pdp11.* pdp11
2798
2799 : make some quick guesses about what we are up against
2800 echo " "
2801 $echo $n "Hmm...  $c"
2802 echo exit 1 >bsd
2803 echo exit 1 >usg
2804 echo exit 1 >v7
2805 echo exit 1 >osf1
2806 echo exit 1 >eunice
2807 echo exit 1 >xenix
2808 echo exit 1 >venix
2809 echo exit 1 >os2
2810 d_bsd="$undef"
2811 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2812 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2813 then
2814         echo "Looks kind of like an OSF/1 system, but we'll see..."
2815         echo exit 0 >osf1
2816 elif test `echo abc | tr a-z A-Z` = Abc ; then
2817         xxx=`./loc addbib blurfl $pth`
2818         if $test -f $xxx; then
2819         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2820                 echo exit 0 >bsd
2821                 echo exit 0 >usg
2822         else
2823                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2824                         echo "Looks kind of like an extended USG system, but we'll see..."
2825                 else
2826                         echo "Looks kind of like a USG system, but we'll see..."
2827                 fi
2828                 echo exit 0 >usg
2829         fi
2830 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2831         echo "Looks kind of like a BSD system, but we'll see..."
2832         d_bsd="$define"
2833         echo exit 0 >bsd
2834 else
2835         echo "Looks kind of like a Version 7 system, but we'll see..."
2836         echo exit 0 >v7
2837 fi
2838 case "$eunicefix" in
2839 *unixtovms*)
2840         $cat <<'EOI'
2841 There is, however, a strange, musty smell in the air that reminds me of
2842 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2843 EOI
2844         echo exit 0 >eunice
2845         d_eunice="$define"
2846 : it so happens the Eunice I know will not run shell scripts in Unix format
2847         ;;
2848 *)
2849         echo " "
2850         echo "Congratulations.  You aren't running Eunice."
2851         d_eunice="$undef"
2852         ;;
2853 esac
2854 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2855 case "$p_" in
2856 :) ;;
2857 *)
2858         $cat <<'EOI'
2859 I have the feeling something is not exactly right, however...don't tell me...
2860 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2861 EOI
2862         echo exit 0 >os2
2863         ;;
2864 esac
2865 if test -f /xenix; then
2866         echo "Actually, this looks more like a XENIX system..."
2867         echo exit 0 >xenix
2868         d_xenix="$define"
2869 else
2870         echo " "
2871         echo "It's not Xenix..."
2872         d_xenix="$undef"
2873 fi
2874 chmod +x xenix
2875 $eunicefix xenix
2876 if test -f /venix; then
2877         echo "Actually, this looks more like a VENIX system..."
2878         echo exit 0 >venix
2879 else
2880         echo " "
2881         if ./xenix; then
2882                 : null
2883         else
2884                 echo "Nor is it Venix..."
2885         fi
2886 fi
2887 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2888 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2889 $rm -f foo
2890
2891 : see if we need a special compiler
2892 echo " "
2893 if ./usg; then
2894         case "$cc" in
2895         '') case "$Mcc" in
2896                 /*) dflt='Mcc';;
2897                 *) case "$large" in
2898                         -M*) dflt='cc';;
2899                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2900                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2901                                                 dflt='cc'
2902                                         else
2903                                                 dflt='cc -M'
2904                                         fi
2905                                 else
2906                                         dflt='cc'
2907                                 fi;;
2908                         esac;;
2909                 esac;;
2910         *)  dflt="$cc";;
2911         esac
2912         case "$dflt" in
2913         *M*)    $cat <<'EOM'
2914 On some older systems the default C compiler will not resolve multiple global
2915 references that happen to have the same name.  On some such systems the "Mcc"
2916 command may be used to force these to be resolved.  On other systems a "cc -M"
2917 command is required.  (Note that the -M flag on other systems indicates a
2918 memory model to use!) If you have the Gnu C compiler, you might wish to use
2919 that instead.
2920
2921 EOM
2922         ;;
2923         esac
2924         rp="Use which C compiler?"
2925         . ./myread
2926         cc="$ans"
2927 else
2928         case "$cc" in
2929         '') dflt=cc;;
2930         *) dflt="$cc";;
2931         esac
2932         rp="Use which C compiler?"
2933         . ./myread
2934         cc="$ans"
2935 fi
2936 : Look for a hint-file generated 'call-back-unit'.  Now that the
2937 : user has specified the compiler, we may need to set or change some
2938 : other defaults.
2939 if $test -f cc.cbu; then
2940     . ./cc.cbu
2941 fi
2942 echo " "
2943 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2944 $cat >gccvers.c <<EOM
2945 #include <stdio.h>
2946 int main() {
2947 #ifdef __GNUC__
2948 #ifdef __VERSION__
2949         printf("%s\n", __VERSION__);
2950 #else
2951         printf("%s\n", "1");
2952 #endif
2953 #endif
2954         exit(0);
2955 }
2956 EOM
2957 if $cc -o gccvers gccvers.c; then
2958         gccversion=`./gccvers`
2959         case "$gccversion" in
2960         '') echo "You are not using GNU cc." ;;
2961         *)  echo "You are using GNU cc $gccversion." ;;
2962         esac
2963 else
2964         echo " "
2965         echo "*** WHOA THERE!!! ***" >&4
2966         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
2967         case "$knowitall" in
2968         '')
2969         echo "    You'd better start hunting for one and let me know about it." >&4
2970                 exit 1
2971                 ;;
2972         esac
2973 fi
2974 $rm -f gccvers*
2975 case "$gccversion" in
2976 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2977 esac
2978
2979 cat <<EOM
2980
2981 Perl can be built to take advantage of explicit 64-bit interfaces,
2982 on some systems.  To do so, Configure must be run with -Duse64bits.
2983
2984 If this doesn't make any sense to you, just accept the default 'n'.
2985 EOM
2986 case "$use64bits" in
2987 $define|true|[yY]*)     dflt='y';;
2988 *) dflt='n';;
2989 esac
2990 rp='Try to use explicit 64-bit interfaces, if available?'
2991 . ./myread
2992 case "$ans" in
2993 y|Y) 
2994         val="$define"
2995         ;;     
2996 *)      
2997         val="$undef"
2998         ;;
2999 esac
3000 set use64bits
3001 eval $setvar
3002
3003 case "$archname64" in
3004 '') archname64='' ;;    # not a typo
3005 esac
3006
3007 case "$use64bits" in
3008 "$define"|true|[yY]*)
3009 : Look for a hint-file generated 'call-back-unit'.  If the
3010 : user has specified that a 64 bit perl is to be built,
3011 : we may need to set or change some other defaults.
3012         if $test -f use64bits.cbu; then
3013                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3014                 . ./use64bits.cbu
3015         else
3016                 $cat <<EOM
3017 (Your platform doesn't have any specific hints for 64-bit builds.
3018  This is probably okay, especially if your system is a true 64-bit system.)
3019 EOM
3020                 case "$gccversion" in
3021                 '')     ;;
3022                 *)      $cat <<EOM
3023 But since you seem to be using gcc,
3024 I will now add -DUSE_LONG_LONG to the compilation flags.
3025 EOM
3026                         ccflags="$ccflags -DUSE_LONG_LONG"
3027                         ;;
3028                 esac
3029         fi
3030         ;;
3031 esac
3032
3033 : determine the architecture name
3034 echo " "
3035 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3036         tarch=`arch`"-$osname"
3037 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3038         if uname -m > tmparch 2>&1 ; then
3039                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3040                         -e 's/$/'"-$osname/" tmparch`
3041         else
3042                 tarch="$osname"
3043         fi
3044         $rm -f tmparch
3045 else
3046         tarch="$osname"
3047 fi
3048 case "$myarchname" in
3049 ''|"$tarch") ;;
3050 *)
3051         echo "(Your architecture name used to be $myarchname.)"
3052         archname=''
3053         ;;
3054 esac
3055 myarchname="$tarch"
3056 case "$archname" in
3057 '') dflt="$tarch";;
3058 *) dflt="$archname";;
3059 esac
3060 rp='What is your architecture name'
3061 . ./myread
3062 archname="$ans"
3063 case "$usethreads" in
3064 $define)
3065         echo "Threads selected." >&4
3066         case "$archname" in
3067         *-thread*) echo "...and architecture name already has -thread." >&4
3068                 ;;
3069         *)      archname="$archname-thread"
3070                 echo "...setting architecture name to $archname." >&4
3071                 ;;
3072         esac
3073         ;;
3074 esac
3075 case "$usemultiplicity" in
3076 $define)
3077         echo "Multiplicity selected." >&4
3078         case "$archname" in
3079         *-multi*) echo "...and architecture name already has -multi." >&4
3080                 ;;
3081         *)      archname="$archname-multi"
3082                 echo "...setting architecture name to $archname." >&4
3083                 ;;
3084         esac
3085         ;;
3086 esac
3087 case "$use64bits" in
3088 $define)
3089         echo "Explicit 64-bitness selected." >&4
3090         case "$archname64" in
3091         '')
3092                 ;;
3093         *)
3094                 case "$archname" in
3095                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3096                         ;;
3097                 *)      archname="$archname-$archname64"
3098                         echo "...setting architecture name to $archname." >&4
3099                         ;;
3100                 esac
3101                 ;;
3102         esac
3103 esac
3104
3105 : decide how portable to be.  Allow command line overrides.
3106 case "$d_portable" in
3107 "$undef") ;;
3108 *)      d_portable="$define" ;;
3109 esac
3110
3111 : set up shell script to do ~ expansion
3112 cat >filexp <<EOSS
3113 $startsh
3114 : expand filename
3115 case "\$1" in
3116  ~/*|~)
3117         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3118         ;;
3119  ~*)
3120         if $test -f /bin/csh; then
3121                 /bin/csh -f -c "glob \$1"
3122                 failed=\$?
3123                 echo ""
3124                 exit \$failed
3125         else
3126                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3127                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3128                 if $test ! -d "\$dir"; then
3129                         me=\`basename \$0\`
3130                         echo "\$me: can't locate home directory for: \$name" >&2
3131                         exit 1
3132                 fi
3133                 case "\$1" in
3134                 */*)
3135                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3136                         ;;
3137                 *)
3138                         echo \$dir
3139                         ;;
3140                 esac
3141         fi
3142         ;;
3143 *)
3144         echo \$1
3145         ;;
3146 esac
3147 EOSS
3148 chmod +x filexp
3149 $eunicefix filexp
3150
3151 : now set up to get a file name
3152 cat <<EOS >getfile
3153 $startsh
3154 EOS
3155 cat <<'EOSC' >>getfile
3156 tilde=''
3157 fullpath=''
3158 already=''
3159 skip=''
3160 none_ok=''
3161 exp_file=''
3162 nopath_ok=''
3163 orig_rp="$rp"
3164 orig_dflt="$dflt"
3165 case "$gfpth" in
3166 '') gfpth='.' ;;
3167 esac
3168
3169 case "$fn" in
3170 *\(*)
3171         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3172         fn=`echo $fn | sed 's/(.*)//'`
3173         ;;
3174 esac
3175
3176 case "$fn" in
3177 *:*)
3178         loc_file=`expr $fn : '.*:\(.*\)'`
3179         fn=`expr $fn : '\(.*\):.*'`
3180         ;;
3181 esac
3182
3183 case "$fn" in
3184 *~*) tilde=true;;
3185 esac
3186 case "$fn" in
3187 */*) fullpath=true;;
3188 esac
3189 case "$fn" in
3190 *+*) skip=true;;
3191 esac
3192 case "$fn" in
3193 *n*) none_ok=true;;
3194 esac
3195 case "$fn" in
3196 *e*) exp_file=true;;
3197 esac
3198 case "$fn" in
3199 *p*) nopath_ok=true;;
3200 esac
3201
3202 case "$fn" in
3203 *f*) type='File';;
3204 *d*) type='Directory';;
3205 *l*) type='Locate';;
3206 esac
3207
3208 what="$type"
3209 case "$what" in
3210 Locate) what='File';;
3211 esac
3212
3213 case "$exp_file" in
3214 '')
3215         case "$d_portable" in
3216         "$define") ;;
3217         *) exp_file=true;;
3218         esac
3219         ;;
3220 esac
3221
3222 cd ..
3223 while test "$type"; do
3224         redo=''
3225         rp="$orig_rp"
3226         dflt="$orig_dflt"
3227         case "$tilde" in
3228         true) rp="$rp (~name ok)";;
3229         esac
3230         . UU/myread
3231         if test -f UU/getfile.ok && \
3232                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3233         then
3234                 value="$ans"
3235                 ansexp="$ans"
3236                 break
3237         fi
3238         case "$ans" in
3239         none)
3240                 value=''
3241                 ansexp=''
3242                 case "$none_ok" in
3243                 true) type='';;
3244                 esac
3245                 ;;
3246         *)
3247                 case "$tilde" in
3248                 '') value="$ans"
3249                         ansexp="$ans";;
3250                 *)
3251                         value=`UU/filexp $ans`
3252                         case $? in
3253                         0)
3254                                 if test "$ans" != "$value"; then
3255                                         echo "(That expands to $value on this system.)"
3256                                 fi
3257                                 ;;
3258                         *) value="$ans";;
3259                         esac
3260                         ansexp="$value"
3261                         case "$exp_file" in
3262                         '') value="$ans";;
3263                         esac
3264                         ;;
3265                 esac
3266                 case "$fullpath" in
3267                 true)
3268                         case "$ansexp" in
3269                         /*) value="$ansexp" ;;
3270                         *)
3271                                 redo=true
3272                                 case "$already" in
3273                                 true)
3274                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3275                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3276                                         ;;
3277                                 *)
3278                                 echo "Please give a full path name, starting with slash." >&4
3279                                         case "$tilde" in
3280                                         true)
3281                                 echo "Note that using ~name is ok provided it expands well." >&4
3282                                                 already=true
3283                                                 ;;
3284                                         esac
3285                                 esac
3286                                 ;;
3287                         esac
3288                         ;;
3289                 esac
3290                 case "$redo" in
3291                 '')
3292                         case "$type" in
3293                         File)
3294                                 for fp in $gfpth; do
3295                                         if test "X$fp" = X.; then
3296                                             pf="$ansexp"
3297                                         else    
3298                                             pf="$fp/$ansexp"
3299                                         fi
3300                                         if test -f "$pf"; then
3301                                                 type=''
3302                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3303                                         then
3304                                                 echo "($value is not a plain file, but that's ok.)"
3305                                                 type=''
3306                                         fi
3307                                         if test X"$type" = X; then
3308                                             value="$pf"
3309                                             break
3310                                         fi
3311                                 done
3312                                 ;;
3313                         Directory)
3314                                 for fp in $gfpth; do
3315                                         if test "X$fp" = X.; then
3316                                             pf="$ansexp"
3317                                         else    
3318                                             pf="$fp/$ansexp"
3319                                         fi
3320                                         if test -d "$pf"; then
3321                                                 type=''
3322                                                 value="$pf"
3323                                                 break
3324                                         fi
3325                                 done
3326                                 ;;
3327                         Locate)
3328                                 if test -d "$ansexp"; then
3329                                         echo "(Looking for $loc_file in directory $value.)"
3330                                         value="$value/$loc_file"
3331                                         ansexp="$ansexp/$loc_file"
3332                                 fi
3333                                 if test -f "$ansexp"; then
3334                                         type=''
3335                                 fi
3336                                 case "$nopath_ok" in
3337                                 true)   case "$value" in
3338                                         */*) ;;
3339                                         *)      echo "Assuming $value will be in people's path."
3340                                                 type=''
3341                                                 ;;
3342                                         esac
3343                                         ;;
3344                                 esac
3345                                 ;;
3346                         esac
3347
3348                         case "$skip" in
3349                         true) type='';
3350                         esac
3351
3352                         case "$type" in
3353                         '') ;;
3354                         *)
3355                                 if test "$fastread" = yes; then
3356                                         dflt=y
3357                                 else
3358                                         dflt=n
3359                                 fi
3360                                 rp="$what $value doesn't exist.  Use that name anyway?"
3361                                 . UU/myread
3362                                 dflt=''
3363                                 case "$ans" in
3364                                 y*) type='';;
3365                                 *) echo " ";;
3366                                 esac
3367                                 ;;
3368                         esac
3369                         ;;
3370                 esac
3371                 ;;
3372         esac
3373 done
3374 cd UU
3375 ans="$value"
3376 rp="$orig_rp"
3377 dflt="$orig_dflt"
3378 rm -f getfile.ok
3379 test "X$gfpthkeep" != Xy && gfpth=""
3380 EOSC
3381
3382 : determine root of directory hierarchy where package will be installed.
3383 case "$prefix" in
3384 '')
3385         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3386         ;;
3387 *)
3388         dflt="$prefix"
3389         ;;
3390 esac
3391 $cat <<EOM
3392
3393 By default, $package will be installed in $dflt/bin, manual pages
3394 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3395 installation directories. Typically this is something like /usr/local.
3396 If you wish to have binaries under /usr/bin but other parts of the
3397 installation under /usr/local, that's ok: you will be prompted
3398 separately for each of the installation directories, the prefix being
3399 only used to set the defaults.
3400
3401 EOM
3402 fn=d~
3403 rp='Installation prefix to use?'
3404 . ./getfile
3405 oldprefix=''
3406 case "$prefix" in
3407 '') ;;
3408 *)
3409         case "$ans" in
3410         "$prefix") ;;
3411         *) oldprefix="$prefix";;
3412         esac
3413         ;;
3414 esac
3415 prefix="$ans"
3416 prefixexp="$ansexp"
3417
3418 : is AFS running?
3419 echo " "
3420 case "$afs" in
3421 $define|true)   afs=true ;;
3422 $undef|false)   afs=false ;;
3423 *)      if test -d /afs; then
3424                 afs=true
3425         else
3426                 afs=false
3427         fi
3428         ;;
3429 esac
3430 if $afs; then
3431         echo "AFS may be running... I'll be extra cautious then..." >&4
3432 else
3433         echo "AFS does not seem to be running..." >&4
3434 fi
3435
3436 : determine installation prefix for where package is to be installed.
3437 if $afs; then 
3438 $cat <<EOM
3439
3440 Since you are running AFS, I need to distinguish the directory in which
3441 files will reside from the directory in which they are installed (and from
3442 which they are presumably copied to the former directory by occult means).
3443
3444 EOM
3445         case "$installprefix" in
3446         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3447         *) dflt="$installprefix";;
3448         esac
3449 else
3450 $cat <<EOM
3451
3452 In some special cases, particularly when building $package for distribution,
3453 it is convenient to distinguish between the directory in which files should 
3454 be installed from the directory ($prefix) in which they 
3455 will eventually reside.  For most users, these two directories are the same.
3456
3457 EOM
3458         case "$installprefix" in
3459         '') dflt=$prefix ;;
3460         *) dflt=$installprefix;;
3461         esac
3462 fi
3463 fn=d~
3464 rp='What installation prefix should I use for installing files?'
3465 . ./getfile
3466 installprefix="$ans"
3467 installprefixexp="$ansexp"
3468
3469 : set the prefixit variable, to compute a suitable default value
3470 prefixit='case "$3" in
3471 ""|none)
3472         case "$oldprefix" in
3473         "") eval "$1=\"\$$2\"";;
3474         *)
3475                 case "$3" in
3476                 "") eval "$1=";;
3477                 none)
3478                         eval "tp=\"\$$2\"";
3479                         case "$tp" in
3480                         ""|" ") eval "$1=\"\$$2\"";;
3481                         *) eval "$1=";;
3482                         esac;;
3483                 esac;;
3484         esac;;
3485 *)
3486         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3487         case "$tp" in
3488         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3489         /*-$oldprefix/*|\~*-$oldprefix/*)
3490                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3491         *) eval "$1=\"\$$2\"";;
3492         esac;;
3493 esac'
3494
3495 : set the base revision
3496 baserev=5.0
3497
3498 : get the patchlevel
3499 echo " "
3500 echo "Getting the current patchlevel..." >&4
3501 if $test -r $rsrc/patchlevel.h;then
3502         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3503         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3504 else
3505         patchlevel=0
3506         subversion=0
3507 fi
3508 $echo $n "(You have $package" $c
3509 case "$package" in
3510 "*$baserev")    ;;
3511 *)              $echo $n " $baserev" $c ;;
3512 esac
3513 $echo $n " patchlevel $patchlevel" $c
3514 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3515 echo ".)"
3516
3517 if test 0 -eq "$subversion"; then
3518         version=`LC_ALL=C; export LC_ALL; \
3519                  echo $baserev $patchlevel | \
3520                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3521 else
3522         version=`LC_ALL=C; export LC_ALL; \
3523                  echo $baserev $patchlevel $subversion | \
3524                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3525 fi
3526 : Figure out perl API version.  Perhaps this should be in patchlevel.h
3527 if test "$subversion" -lt 50; then
3528         apiversion=`LC_ALL=C; export LC_ALL; \
3529                  LANGUAGE=C; export LANGUAGE; \
3530                  echo $baserev $patchlevel | \
3531                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3532 else
3533         apiversion="$version"
3534 fi
3535
3536 : determine installation style
3537 : For now, try to deduce it from prefix unless it is already set.
3538 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3539 case "$installstyle" in
3540 '')     case "$prefix" in
3541                 *perl*) dflt='lib';;
3542                 *) dflt='lib/perl5' ;;
3543         esac
3544         ;;
3545 *)      dflt='lib/perl5' ;;
3546 esac
3547 : Probably not worth prompting for this since we prompt for all
3548 : the directories individually, and the prompt would be too long and
3549 : confusing anyway.
3550 installstyle=$dflt
3551
3552 : determine where private library files go
3553 : Usual default is /usr/local/lib/perl5/$version.
3554 : Also allow things like /opt/perl/lib/$version, since 
3555 : /opt/perl/lib/perl5... would be redundant.
3556 : The default "style" setting is made in installstyle.U
3557 case "$installstyle" in
3558 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3559 *)       set dflt privlib lib/$version ;;
3560 esac
3561 eval $prefixit
3562 $cat <<EOM
3563
3564 There are some auxiliary files for $package that need to be put into a
3565 private library directory that is accessible by everyone.
3566
3567 EOM
3568 fn=d~+
3569 rp='Pathname where the private library files will reside?'
3570 . ./getfile
3571 privlib="$ans"
3572 privlibexp="$ansexp"
3573 : Change installation prefix, if necessary.
3574 if $test X"$prefix" != X"$installprefix"; then
3575         installprivlib=`echo $privlibexp | sed 's#^$prefix#$installprefix#'`
3576 else
3577         installprivlib="$privlibexp"
3578 fi
3579
3580 : set the prefixup variable, to restore leading tilda escape
3581 prefixup='case "$prefixexp" in
3582 "$prefix") ;;
3583 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3584 esac'
3585
3586 : determine where public architecture dependent libraries go
3587 set archlib archlib
3588 eval $prefixit
3589 : privlib default is /usr/local/lib/$package/$version
3590 : archlib default is /usr/local/lib/$package/$version/$archname
3591 : privlib may have an optional trailing /share.
3592 tdflt=`echo $privlib | $sed 's,/share$,,'`
3593 tdflt=$tdflt/$archname
3594 case "$archlib" in
3595 '')     dflt=$tdflt
3596         ;;
3597 *)      dflt="$archlib"
3598     ;;
3599 esac
3600 $cat <<EOM
3601
3602 $spackage contains architecture-dependent library files.  If you are
3603 sharing libraries in a heterogeneous environment, you might store
3604 these files in a separate location.  Otherwise, you can just include
3605 them with the rest of the public library files.
3606
3607 EOM
3608 fn=d+~
3609 rp='Where do you want to put the public architecture-dependent libraries?'
3610 . ./getfile
3611 archlib="$ans"
3612 archlibexp="$ansexp"
3613 if $test X"$archlib" = X"$privlib"; then
3614         d_archlib="$undef"
3615 else
3616         d_archlib="$define"
3617 fi
3618 : Change installation prefix, if necessary.
3619 if $test X"$prefix" != X"$installprefix"; then
3620         installarchlib=`echo $archlibexp | sed 's#^$prefix#$installprefix#'`
3621 else
3622         installarchlib="$archlibexp"
3623 fi
3624
3625
3626 : Binary compatibility with 5.005 is not possible for builds
3627 : with advanced features
3628 case "$usethreads$usemultiplicity" in
3629 *define*)
3630         bincompat5005="$undef"
3631         d_bincompat5005="$undef"
3632         ;;
3633 *)      $cat <<EOM
3634
3635 Perl 5.006 can be compiled for binary compatibility with 5.005.
3636 If you decide to do so, you will be able to continue using most
3637 of the extensions that were compiled for Perl 5.005.
3638
3639 EOM
3640         case "$bincompat5005$d_bincompat5005" in
3641         *"$undef"*) dflt=n ;;
3642         *) dflt=y ;;
3643         esac
3644         rp='Binary compatibility with Perl 5.005?'
3645         . ./myread
3646         case "$ans" in
3647         y*) val="$define" ;;
3648         *)  val="$undef" ;;
3649         esac
3650         set d_bincompat5005
3651         eval $setvar
3652         case "$d_bincompat5005" in
3653         "$define")
3654                 bincompat5005="$define"
3655                 ;;
3656         *)      bincompat5005="$undef"
3657                 d_bincompat5005="$undef"
3658                 ;;
3659         esac
3660         ;;
3661 esac
3662
3663
3664 : see if setuid scripts can be secure
3665 $cat <<EOM
3666
3667 Some kernels have a bug that prevents setuid #! scripts from being
3668 secure.  Some sites have disabled setuid #! scripts because of this.
3669
3670 First let's decide if your kernel supports secure setuid #! scripts.
3671 (If setuid #! scripts would be secure but have been disabled anyway,
3672 don't say that they are secure if asked.)
3673
3674 EOM
3675
3676 val="$undef"
3677 if $test -d /dev/fd; then
3678         echo "#!$ls" >reflect
3679         chmod +x,u+s reflect
3680         ./reflect >flect 2>&1
3681         if $contains "/dev/fd" flect >/dev/null; then
3682                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3683                 val="$define"
3684         else
3685                 $cat <<EOM
3686 If you are not sure if they are secure, I can check but I'll need a
3687 username and password different from the one you are using right now.
3688 If you don't have such a username or don't want me to test, simply
3689 enter 'none'.
3690
3691 EOM
3692                 rp='Other username to test security of setuid scripts with?'
3693                 dflt='none'
3694                 . ./myread
3695                 case "$ans" in
3696                 n|none)
3697                         case "$d_suidsafe" in
3698                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3699                                 dflt=n;;
3700                         "$undef")
3701                                 echo "Well, the $hint value is *not* secure." >&4
3702                                 dflt=n;;
3703                         *)      echo "Well, the $hint value *is* secure." >&4
3704                                 dflt=y;;
3705                         esac
3706                         ;;
3707                 *)
3708                         $rm -f reflect flect
3709                         echo "#!$ls" >reflect
3710                         chmod +x,u+s reflect
3711                         echo >flect
3712                         chmod a+w flect
3713                         echo '"su" will (probably) prompt you for '"$ans's password."
3714                         su $ans -c './reflect >flect'
3715                         if $contains "/dev/fd" flect >/dev/null; then
3716                                 echo "Okay, it looks like setuid scripts are secure." >&4
3717                                 dflt=y
3718                         else
3719                                 echo "I don't think setuid scripts are secure." >&4
3720                                 dflt=n
3721                         fi
3722                         ;;
3723                 esac
3724                 rp='Does your kernel have *secure* setuid scripts?'
3725                 . ./myread
3726                 case "$ans" in
3727                 [yY]*)  val="$define";;
3728                 *)      val="$undef";;
3729                 esac
3730         fi
3731 else
3732         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3733         echo "(That's for file descriptors, not floppy disks.)"
3734         val="$undef"
3735 fi
3736 set d_suidsafe
3737 eval $setvar
3738
3739 $rm -f reflect flect
3740
3741 : now see if they want to do setuid emulation
3742 echo " "
3743 val="$undef"
3744 case "$d_suidsafe" in
3745 "$define")
3746         val="$undef"
3747         echo "No need to emulate SUID scripts since they are secure here." >& 4
3748         ;;
3749 *)
3750         $cat <<EOM
3751 Some systems have disabled setuid scripts, especially systems where
3752 setuid scripts cannot be secure.  On systems where setuid scripts have
3753 been disabled, the setuid/setgid bits on scripts are currently
3754 useless.  It is possible for $package to detect those bits and emulate
3755 setuid/setgid in a secure fashion.  This emulation will only work if
3756 setuid scripts have been disabled in your kernel.
3757
3758 EOM
3759         case "$d_dosuid" in
3760         "$define") dflt=y ;;
3761         *) dflt=n ;;
3762         esac
3763         rp="Do you want to do setuid/setgid emulation?"
3764         . ./myread
3765         case "$ans" in
3766         [yY]*)  val="$define";;
3767         *)      val="$undef";;
3768         esac
3769         ;;
3770 esac
3771 set d_dosuid
3772 eval $setvar
3773
3774 : What should the include directory be ?
3775 echo " "
3776 $echo $n "Hmm...  $c"
3777 dflt='/usr/include'
3778 incpath=''
3779 mips_type=''
3780 if $test -f /bin/mips && /bin/mips; then
3781         echo "Looks like a MIPS system..."
3782         $cat >usr.c <<'EOCP'
3783 #ifdef SYSTYPE_BSD43
3784 /bsd43
3785 #endif
3786 EOCP
3787         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3788                 dflt='/bsd43/usr/include'
3789                 incpath='/bsd43'
3790                 mips_type='BSD 4.3'
3791         else
3792                 mips_type='System V'
3793         fi
3794         $rm -f usr.c usr.out
3795         echo "and you're compiling with the $mips_type compiler and libraries."
3796         xxx_prompt=y
3797         echo "exit 0" >mips
3798 else
3799         echo "Doesn't look like a MIPS system."
3800         xxx_prompt=n
3801         echo "exit 1" >mips
3802 fi
3803 chmod +x mips
3804 $eunicefix mips
3805 case "$usrinc" in
3806 '') ;;
3807 *) dflt="$usrinc";;
3808 esac
3809 case "$xxx_prompt" in
3810 y)      fn=d/
3811         echo " "
3812         rp='Where are the include files you want to use?'
3813         . ./getfile
3814         usrinc="$ans"
3815         ;;
3816 *)      usrinc="$dflt"
3817         ;;
3818 esac
3819
3820 : see how we invoke the C preprocessor
3821 echo " "
3822 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3823 cat <<'EOT' >testcpp.c
3824 #define ABC abc
3825 #define XYZ xyz
3826 ABC.XYZ
3827 EOT
3828 cd ..
3829 if test ! -f cppstdin; then
3830         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3831                 # AIX cc -E doesn't show the absolute headerfile
3832                 # locations but we'll cheat by using the -M flag.
3833                 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
3834         else
3835                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3836         fi
3837 else
3838         echo "Keeping your $hint cppstdin wrapper."
3839 fi
3840 chmod 755 cppstdin
3841 wrapper=`pwd`/cppstdin
3842 ok='false'
3843 cd UU
3844
3845 if $test "X$cppstdin" != "X" && \
3846         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3847         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3848 then
3849         echo "You used to use $cppstdin $cppminus so we'll use that again."
3850         case "$cpprun" in
3851         '') echo "But let's see if we can live without a wrapper..." ;;
3852         *)
3853                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3854                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3855                 then
3856                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3857                         ok='true'
3858                 else
3859                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3860                 fi
3861                 ;;
3862         esac
3863 else
3864         case "$cppstdin" in
3865         '') ;;
3866         *)
3867                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3868                 ;;
3869         esac
3870 fi
3871
3872 if $ok; then
3873         : nothing
3874 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3875         $cc -E <testcpp.c >testcpp.out 2>&1; \
3876         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3877         echo "Yup, it does."
3878         x_cpp="$cc -E"
3879         x_minus='';
3880 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3881         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3882         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3883         echo "Yup, it does."
3884         x_cpp="$cc -E"
3885         x_minus='-';
3886 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3887         $cc -P <testcpp.c >testcpp.out 2>&1; \
3888         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3889         echo "Yipee, that works!"
3890         x_cpp="$cc -P"
3891         x_minus='';
3892 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3893         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3894         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3895         echo "At long last!"
3896         x_cpp="$cc -P"
3897         x_minus='-';
3898 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3899         $cpp <testcpp.c >testcpp.out 2>&1; \
3900         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3901         echo "It works!"
3902         x_cpp="$cpp"
3903         x_minus='';
3904 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3905         $cpp - <testcpp.c >testcpp.out 2>&1; \
3906         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3907         echo "Hooray, it works!  I was beginning to wonder."
3908         x_cpp="$cpp"
3909         x_minus='-';
3910 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3911         $wrapper <testcpp.c >testcpp.out 2>&1; \
3912         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3913         x_cpp="$wrapper"
3914         x_minus=''
3915         echo "Eureka!"
3916 else
3917         dflt=''
3918         rp="No dice.  I can't find a C preprocessor.  Name one:"
3919         . ./myread
3920         x_cpp="$ans"
3921         x_minus=''
3922         $x_cpp <testcpp.c >testcpp.out 2>&1
3923         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3924                 echo "OK, that will do." >&4
3925         else
3926 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3927                 exit 1
3928         fi
3929 fi
3930
3931 case "$ok" in
3932 false)
3933         cppstdin="$x_cpp"
3934         cppminus="$x_minus"
3935         cpprun="$x_cpp"
3936         cpplast="$x_minus"
3937         set X $x_cpp
3938         shift
3939         case "$1" in
3940         "$cpp")
3941                 echo "Perhaps can we force $cc -E using a wrapper..."
3942                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3943                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3944                 then
3945                         echo "Yup, we can."
3946                         cppstdin="$wrapper"
3947                         cppminus='';
3948                 else
3949                         echo "Nope, we'll have to live without it..."
3950                 fi
3951                 ;;
3952         esac
3953         case "$cpprun" in
3954         "$wrapper")
3955                 cpprun=''
3956                 cpplast=''
3957                 ;;
3958         esac
3959         ;;
3960 esac
3961
3962 case "$cppstdin" in
3963 "$wrapper"|'cppstdin') ;;
3964 *) $rm -f $wrapper;;
3965 esac
3966 $rm -f testcpp.c testcpp.out
3967
3968 : Set private lib path
3969 case "$plibpth" in
3970 '') if ./mips; then
3971                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3972         fi;;
3973 esac
3974 case "$libpth" in
3975 ' ') dlist='';;
3976 '') dlist="$loclibpth $plibpth $glibpth";;
3977 *) dlist="$libpth";;
3978 esac
3979
3980 : Now check and see which directories actually exist, avoiding duplicates
3981 libpth=''
3982 for xxx in $dlist
3983 do
3984     if $test -d $xxx; then
3985                 case " $libpth " in
3986                 *" $xxx "*) ;;
3987                 *) libpth="$libpth $xxx";;
3988                 esac
3989     fi
3990 done
3991 $cat <<'EOM'
3992
3993 Some systems have incompatible or broken versions of libraries.  Among
3994 the directories listed in the question below, please remove any you
3995 know not to be holding relevant libraries, and add any that are needed.
3996 Say "none" for none.
3997
3998 EOM
3999 case "$libpth" in
4000 '') dflt='none';;
4001 *)
4002         set X $libpth
4003         shift
4004         dflt=${1+"$@"}
4005         ;;
4006 esac
4007 rp="Directories to use for library searches?"
4008 . ./myread
4009 case "$ans" in
4010 none) libpth=' ';;
4011 *) libpth="$ans";;
4012 esac
4013
4014 : compute shared library extension
4015 case "$so" in
4016 '')
4017         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4018                 dflt='sl'
4019         else
4020                 dflt='so'
4021         fi
4022         ;;
4023 *) dflt="$so";;
4024 esac
4025 $cat <<EOM
4026
4027 On some systems, shared libraries may be available.  Answer 'none' if
4028 you want to suppress searching of shared libraries for the remaining
4029 of this configuration.
4030
4031 EOM
4032 rp='What is the file extension used for shared libraries?'
4033 . ./myread
4034 so="$ans"
4035
4036 : Define several unixisms.
4037 : Hints files or command line option can be used to override them.
4038 : The convoluted testing is in case hints files set either the old
4039 : or the new name.
4040 case "$_exe" in
4041 '')     case "$exe_ext" in
4042     '') ;;
4043         *)      _exe="$exe_ext" ;;
4044         esac
4045         ;;
4046 esac
4047 case "$_a" in
4048 '')     case "$lib_ext" in
4049     '') _a='.a';;
4050         *)      _a="$lib_ext" ;;
4051         esac
4052         ;;
4053 esac
4054 case "$_o" in
4055 '') case "$obj_ext" in
4056         '')     _o='.o';;
4057         *)      _o="$obj_ext";;
4058         esac
4059         ;;
4060 esac
4061 case "$p_" in
4062 '') case "$path_sep" in
4063         '')     p_=':';;
4064         *)      p_="$path_sep";;
4065         esac
4066         ;;
4067 esac
4068 exe_ext=$_exe
4069 lib_ext=$_a
4070 obj_ext=$_o
4071 path_sep=$p_
4072
4073 : Which makefile gets called first.  This is used by make depend.
4074 case "$firstmakefile" in
4075 '') firstmakefile='makefile';;
4076 esac
4077
4078 cat <<EOM
4079
4080 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4081 Configure must be run with -Dusesocks.
4082
4083 Normally you do not need this and you should answer no.
4084
4085 EOM
4086 case "$usesocks" in
4087 $define|true|[yY]*)     dflt='y';;
4088 *) dflt='n';;
4089 esac
4090 rp='Build Perl for SOCKS?'
4091 . ./myread
4092 case "$ans" in
4093 y|Y)    val="$define" ;;     
4094 *)      val="$undef" ;;
4095 esac
4096 set usesocks
4097 eval $setvar
4098
4099 : Looking for optional libraries
4100 echo " "
4101 echo "Checking for optional libraries..." >&4
4102 case "$libs" in
4103 ' '|'') dflt='';;
4104 *) dflt="$libs";;
4105 esac
4106 case "$libswanted" in
4107 '') libswanted='c_s';;
4108 esac
4109 case "$usesocks" in
4110 $define)
4111         libswanted="$libswanted socks5 socks5_sh"
4112         ;;
4113 esac
4114 for thislib in $libswanted; do
4115         
4116         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4117                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4118                 echo "Found -l$thislib (shared)."
4119                 case " $dflt " in
4120                 *"-l$thislib "*);;
4121                 *) dflt="$dflt -l$thislib";;
4122                 esac
4123         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4124                 echo "Found -l$thislib (shared)."
4125                 case " $dflt " in
4126                 *"-l$thislib "*);;
4127                 *) dflt="$dflt -l$thislib";;
4128                 esac
4129         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4130                 echo "Found -l$thislib."
4131                 case " $dflt " in
4132                 *"-l$thislib "*);;
4133                 *) dflt="$dflt -l$thislib";;
4134                 esac
4135         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4136                 echo "Found -l$thislib."
4137                 case " $dflt " in
4138                 *"-l$thislib "*);;
4139                 *) dflt="$dflt -l$thislib";;
4140                 esac
4141         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4142                 echo "Found -l${thislib}_s."
4143                 case " $dflt " in
4144                 *"-l$thislib "*);;
4145                 *) dflt="$dflt -l${thislib}_s";;
4146                 esac
4147         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4148                 echo "Found -l$thislib."
4149                 case " $dflt " in
4150                 *"-l$thislib "*);;
4151                 *) dflt="$dflt -l$thislib";;
4152                 esac
4153         else
4154                 echo "No -l$thislib."
4155         fi
4156 done
4157 set X $dflt
4158 shift
4159 dflt="$*"
4160 case "$libs" in
4161 '') dflt="$dflt";;
4162 *) dflt="$libs";;
4163 esac
4164 case "$dflt" in
4165 ' '|'') dflt='none';;
4166 esac
4167
4168 $cat <<EOM
4169
4170 In order to compile $package on your machine, a number of libraries
4171 are usually needed.  Include any other special libraries here as well.
4172 Say "none" for none.  The default list is almost always right.
4173 EOM
4174
4175 echo " "
4176 rp="What libraries to use?"
4177 . ./myread
4178 case "$ans" in
4179 none) libs=' ';;
4180 *) libs="$ans";;
4181 esac
4182
4183 : determine optimize, if desired, or use for debug flag also
4184 case "$optimize" in
4185 ' '|$undef) dflt='none';;
4186 '') dflt='-O';;
4187 *) dflt="$optimize";;
4188 esac
4189 $cat <<EOH
4190
4191 Some C compilers have problems with their optimizers.  By default, $package
4192 compiles with the -O flag to use the optimizer.  Alternately, you might want
4193 to use the symbolic debugger, which uses the -g flag (on traditional Unix
4194 systems).  Either flag can be specified here.  To use neither flag, specify
4195 the word "none".
4196
4197 EOH
4198 rp="What optimizer/debugger flag should be used?"
4199 . ./myread
4200 optimize="$ans"
4201 case "$optimize" in
4202 'none') optimize=" ";;
4203 esac
4204
4205 dflt=''
4206 : We will not override a previous value, but we might want to
4207 : augment a hint file
4208 case "$hint" in
4209 none|recommended)
4210         case "$gccversion" in
4211         1*) dflt='-fpcc-struct-return' ;;
4212         esac
4213         case "$optimize" in
4214         *-g*) dflt="$dflt -DDEBUGGING";;
4215         esac
4216         case "$gccversion" in
4217         2*) if test -d /etc/conf/kconfig.d &&
4218                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4219                 then
4220                         dflt="$dflt -posix"
4221                 fi
4222                 ;;
4223         esac
4224         ;;
4225 esac
4226
4227 case "$mips_type" in
4228 *BSD*|'') inclwanted="$locincpth $usrinc";;
4229 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4230 esac
4231 for thisincl in $inclwanted; do
4232         if $test -d $thisincl; then
4233                 if $test x$thisincl != x$usrinc; then
4234                         case "$dflt" in
4235                         *$thisincl*);;
4236                         *) dflt="$dflt -I$thisincl";;
4237                         esac
4238                 fi
4239         fi
4240 done
4241
4242 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4243         xxx=true;
4244 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4245         xxx=true;
4246 else
4247         xxx=false;
4248 fi;
4249 if $xxx; then
4250         case "$dflt" in
4251         *$2*);;
4252         *) dflt="$dflt -D$2";;
4253         esac;
4254 fi'
4255
4256 set signal.h LANGUAGE_C; eval $inctest
4257
4258 case "$usesocks" in
4259 $define)
4260         ccflags="$ccflags -DSOCKS"
4261         ;;
4262 esac
4263
4264 case "$hint" in
4265 none|recommended) dflt="$ccflags $dflt" ;;
4266 *) dflt="$ccflags";;
4267 esac
4268
4269 case "$dflt" in
4270 ''|' ') dflt=none;;
4271 esac
4272 $cat <<EOH
4273
4274 Your C compiler may want other flags.  For this question you should include
4275 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4276 but you should NOT include libraries or ld flags like -lwhatever.  If you
4277 want $package to honor its debug switch, you should include -DDEBUGGING here.
4278 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4279
4280 To use no flags, specify the word "none".
4281
4282 EOH
4283 set X $dflt
4284 shift
4285 dflt=${1+"$@"}
4286 rp="Any additional cc flags?"
4287 . ./myread
4288 case "$ans" in
4289 none) ccflags='';;
4290 *) ccflags="$ans";;
4291 esac
4292
4293 : the following weeds options from ccflags that are of no interest to cpp
4294 cppflags="$ccflags"
4295 case "$gccversion" in
4296 1*) cppflags="$cppflags -D__GNUC__"
4297 esac
4298 case "$mips_type" in
4299 '');;
4300 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4301 esac
4302 case "$cppflags" in
4303 '');;
4304 *)
4305         echo " "
4306         echo "Let me guess what the preprocessor flags are..." >&4
4307         set X $cppflags
4308         shift
4309         cppflags=''
4310         $cat >cpp.c <<'EOM'
4311 #define BLURFL foo
4312
4313 BLURFL xx LFRULB
4314 EOM
4315         previous=''
4316         for flag in $*
4317         do
4318                 case "$flag" in
4319                 -*) ftry="$flag";;
4320                 *) ftry="$previous $flag";;
4321                 esac
4322                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4323                         >cpp1.out 2>/dev/null && \
4324                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4325                         >cpp2.out 2>/dev/null && \
4326                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4327                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4328                 then
4329                         cppflags="$cppflags $ftry"
4330                         previous=''
4331                 else
4332                         previous="$flag"
4333                 fi
4334         done
4335         set X $cppflags
4336         shift
4337         cppflags=${1+"$@"}
4338         case "$cppflags" in
4339         *-*)  echo "They appear to be: $cppflags";;
4340         esac
4341         $rm -f cpp.c cpp?.out
4342         ;;
4343 esac
4344
4345 : flags used in final linking phase
4346 case "$ldflags" in
4347 '') if ./venix; then
4348                 dflt='-i -z'
4349         else
4350                 dflt=''
4351         fi
4352         case "$ccflags" in
4353         *-posix*) dflt="$dflt -posix" ;;
4354         esac
4355         ;;
4356 *) dflt="$ldflags";;
4357 esac
4358
4359 : Try to guess additional flags to pick up local libraries.
4360 for thislibdir in $libpth; do
4361         case " $loclibpth " in
4362         *" $thislibdir "*)
4363                 case "$dflt " in 
4364                 *"-L$thislibdir "*) ;;
4365                 *)  dflt="$dflt -L$thislibdir" ;;
4366                 esac
4367                 ;;
4368         esac
4369 done
4370
4371 case "$dflt" in
4372 '') dflt='none' ;;
4373 esac
4374
4375 $cat <<EOH
4376
4377 Your C linker may need flags.  For this question you should
4378 include -L/whatever and any other flags used by the C linker, but you
4379 should NOT include libraries like -lwhatever.
4380
4381 Make sure you include the appropriate -L/path flags if your C linker
4382 does not normally search all of the directories you specified above,
4383 namely
4384         $libpth
4385 To use no flags, specify the word "none".
4386
4387 EOH
4388
4389 rp="Any additional ld flags (NOT including libraries)?"
4390 . ./myread
4391 case "$ans" in
4392 none) ldflags='';;
4393 *) ldflags="$ans";;
4394 esac
4395 rmlist="$rmlist pdp11"
4396
4397 : coherency check
4398 echo " "
4399 echo "Checking your choice of C compiler and flags for coherency..." >&4
4400 $cat > try.c <<'EOF'
4401 #include <stdio.h>
4402 int main() { printf("Ok\n"); exit(0); }
4403 EOF
4404 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4405 shift
4406 $cat >try.msg <<'EOM'
4407 I've tried to compile and run the following simple program:
4408
4409 EOM
4410 $cat try.c >> try.msg
4411
4412 $cat >> try.msg <<EOM
4413
4414 I used the command:
4415
4416         $*
4417         ./try
4418
4419 and I got the following output:
4420
4421 EOM
4422 dflt=y
4423 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4424         if sh -c './try' >>try.msg 2>&1; then
4425                 xxx=`./try`
4426                 case "$xxx" in
4427                 "Ok") dflt=n ;;
4428                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4429                         case " $libs " in
4430                         *" -lsfio "*)
4431                                 cat >> try.msg <<'EOQS'
4432 If $libs contains -lsfio, and sfio is mis-configured, then it
4433 sometimes (apparently) runs and exits with a 0 status, but with no
4434 output!  It may have to do with sfio's use of _exit vs. exit.
4435
4436 EOQS
4437                                 rp="You have a big problem.  Shall I abort Configure"
4438                                 dflt=y
4439                                 ;;
4440                         esac
4441                         ;;
4442                 esac
4443         else
4444                 echo "The program compiled OK, but exited with status $?." >>try.msg
4445                 rp="You have a problem.  Shall I abort Configure"
4446                 dflt=y
4447         fi
4448 else
4449         echo "I can't compile the test program." >>try.msg
4450         rp="You have a BIG problem.  Shall I abort Configure"
4451         dflt=y
4452 fi
4453 case "$dflt" in
4454 y)
4455         $cat try.msg >&4
4456         case "$knowitall" in
4457         '')
4458                 echo "(The supplied flags or libraries might be incorrect.)"
4459                 ;;
4460         *) dflt=n;;
4461         esac
4462         echo " "
4463         . ./myread
4464         case "$ans" in
4465         n*|N*) ;;
4466         *)      echo "Ok.  Stopping Configure." >&4
4467                 exit 1
4468                 ;;
4469         esac
4470         ;;
4471 n) echo "OK, that should do.";;
4472 esac
4473 $rm -f try try.* core
4474
4475 : determine filename position in cpp output
4476 echo " "
4477 echo "Computing filename position in cpp output for #include directives..." >&4
4478 echo '#include <stdio.h>' > foo.c
4479 $cat >fieldn <<EOF
4480 $startsh
4481 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4482 $grep '^[       ]*#.*stdio\.h' | \
4483 while read cline; do
4484         pos=1
4485         set \$cline
4486         while $test \$# -gt 0; do
4487                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4488                         echo "\$pos"
4489                         exit 0
4490                 fi
4491                 shift
4492                 pos=\`expr \$pos + 1\`
4493         done
4494 done
4495 EOF
4496 chmod +x fieldn
4497 fieldn=`./fieldn`
4498 $rm -f foo.c fieldn
4499 case $fieldn in
4500 '') pos='???';;
4501 1) pos=first;;
4502 2) pos=second;;
4503 3) pos=third;;
4504 *) pos="${fieldn}th";;
4505 esac
4506 echo "Your cpp writes the filename in the $pos field of the line."
4507
4508 : locate header file
4509 $cat >findhdr <<EOF
4510 $startsh
4511 wanted=\$1
4512 name=''
4513 for usrincdir in $usrinc
4514 do
4515         if test -f \$usrincdir/\$wanted; then
4516                 echo "\$usrincdir/\$wanted"
4517                 exit 0
4518         fi
4519 done
4520 awkprg='{ print \$$fieldn }'
4521 echo "#include <\$wanted>" > foo\$\$.c
4522 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4523 $grep "^[       ]*#.*\$wanted" | \
4524 while read cline; do
4525         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4526         case "\$name" in
4527         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4528         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4529         *) exit 2;;
4530         esac;
4531 done;
4532 #
4533 # status = 0: grep returned 0 lines, case statement not executed
4534 # status = 1: headerfile found
4535 # status = 2: while loop executed, no headerfile found
4536 #
4537 status=\$?
4538 $rm -f foo\$\$.c;
4539 if test \$status -eq 1; then
4540         exit 0;
4541 fi
4542 exit 1
4543 EOF
4544 chmod +x findhdr
4545
4546 : define an alternate in-header-list? function
4547 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4548 cont=true; xxf="echo \"<\$1> found.\" >&4";
4549 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4550 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4551 esac;
4552 case $# in 4) instead=instead;; *) instead="at last";; esac;
4553 while $test "$cont"; do
4554         xxx=`./findhdr $1`
4555         var=$2; eval "was=\$$2";
4556         if $test "$xxx" && $test -r "$xxx";
4557         then eval $xxf;
4558         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4559                 cont="";
4560         else eval $xxnf;
4561         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4562         set $yyy; shift; shift; yyy=$@;
4563         case $# in 0) cont="";;
4564         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4565                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4566         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4567                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4568         esac;
4569 done;
4570 while $test "$yyy";
4571 do set $yyy; var=$2; eval "was=\$$2";
4572         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4573         set $yyy; shift; shift; yyy=$@;
4574 done'
4575
4576 : see if this is a malloc.h system
4577 set malloc.h i_malloc
4578 eval $inhdr
4579
4580 : see if stdlib is available
4581 set stdlib.h i_stdlib
4582 eval $inhdr
4583
4584 : determine which malloc to compile in
4585 echo " "
4586 case "$usemymalloc" in
4587 ''|[yY]*|true|$define)  dflt='y' ;;
4588 *)      dflt='n' ;;
4589 esac
4590 rp="Do you wish to attempt to use the malloc that comes with $package?"
4591 . ./myread
4592 usemymalloc="$ans"
4593 case "$ans" in
4594 y*|true)
4595         usemymalloc='y'
4596         mallocsrc='malloc.c'
4597         mallocobj="malloc$_o"
4598         d_mymalloc="$define"
4599         case "$libs" in
4600         *-lmalloc*)
4601                 : Remove malloc from list of libraries to use
4602                 echo "Removing unneeded -lmalloc from library list" >&4
4603                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4604                 shift
4605                 libs="$*"
4606                 echo "libs = $libs" >&4
4607                 ;;
4608         esac
4609         ;;
4610 *)
4611         usemymalloc='n'
4612         mallocsrc=''
4613         mallocobj=''
4614         d_mymalloc="$undef"
4615         ;;
4616 esac
4617
4618 : compute the return types of malloc and free
4619 echo " "
4620 $cat >malloc.c <<END
4621 #$i_malloc I_MALLOC
4622 #$i_stdlib I_STDLIB
4623 #include <stdio.h>
4624 #include <sys/types.h>
4625 #ifdef I_MALLOC
4626 #include <malloc.h>
4627 #endif
4628 #ifdef I_STDLIB
4629 #include <stdlib.h>
4630 #endif
4631 #ifdef TRY_MALLOC
4632 void *malloc();
4633 #endif
4634 #ifdef TRY_FREE
4635 void free();
4636 #endif
4637 END
4638 case "$malloctype" in
4639 '')
4640         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4641                 malloctype='void *'
4642         else
4643                 malloctype='char *'
4644         fi
4645         ;;
4646 esac
4647 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4648
4649 case "$freetype" in
4650 '')
4651         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4652                 freetype='void'
4653         else
4654                 freetype='int'
4655         fi
4656         ;;
4657 esac
4658 echo "Your system uses $freetype free(), it would seem." >&4
4659 $rm -f malloc.[co]
4660 $cat <<EOM
4661
4662 The installation process will also create a directory for
4663 vendor-supplied add-ons.  Vendors who supply perl with their system
4664 may find it convenient to place all vendor-supplied files in this
4665 directory rather than in the main distribution directory.  This will
4666 ease upgrades between binary-compatible maintenance versions of perl.
4667
4668 Of course you may also use these directories in whatever way you see
4669 fit.  For example, you might use them to access modules shared over a
4670 company-wide network.
4671
4672 The default answer should be fine for most people.
4673 This causes further questions about vendor add-ons to be skipped
4674 and no vendor-specific directories will be configured for perl.
4675
4676 EOM
4677 rp='Do you want to configure vendor-specific add-on directories?'
4678 case "$usevendorprefix" in
4679 define|true|[yY]*) dflt=y ;;
4680 *) dflt=n ;;
4681 esac
4682 . ./myread
4683 case "$ans" in
4684 [yY]*)  fn=d~+
4685         rp='Installation prefix to use for vendor-supplied add-ons?'
4686         case "$vendorprefix" in
4687         '') dflt='' ;;
4688         *)  dflt=$vendorprefix ;;
4689         esac
4690         . ./getfile
4691         oldvendorprefix=''
4692         case "$vendorprefix" in
4693         '') ;;
4694         *)      case "$ans" in
4695                 "$prefix") ;;
4696                 *) oldvendorprefix="$prefix";;
4697                 esac
4698                 ;;
4699         esac
4700         usevendorprefix="$define"
4701         vendorprefix="$ans"
4702         vendorprefixexp="$ansexp"
4703         ;;
4704 *)      usevendorprefix="$undef"
4705         vendorprefix=''
4706         vendorprefixexp=''
4707         ;;
4708 esac
4709
4710 case "$vendorprefix" in
4711 '')     d_vendorlib="$undef"
4712         vendorlib=''
4713         vendorlibexp=''
4714         ;;
4715 *)      d_vendorlib="$define"
4716         : determine where vendor-supplied modules go.
4717         : Usual default is /usr/local/lib/perl5/vendor_perl
4718         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4719         case "$installstyle" in
4720         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4721         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4722         esac
4723         fn=d~+
4724         rp='Pathname for the vendor-supplied library files?'
4725         . ./getfile
4726         vendorlib="$ans"
4727         vendorlibexp="$ansexp"
4728         : Change installation prefix, if necessary.
4729         if $test X"$prefix" != X"$installprefix"; then
4730                 installvendorlib=`echo $vendorlibexp | $sed 's#^$prefix#$installprefix#'`
4731         else
4732                 installvendorlib="$vendorlibexp"
4733         fi
4734         ;;
4735 esac
4736
4737 : Cruising for prototypes
4738 echo " "
4739 echo "Checking out function prototypes..." >&4
4740 $cat >prototype.c <<'EOCP'
4741 int main(int argc, char *argv[]) {
4742         exit(0);}
4743 EOCP
4744 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4745         echo "Your C compiler appears to support function prototypes."
4746         val="$define"
4747 else
4748         echo "Your C compiler doesn't seem to understand function prototypes."
4749         val="$undef"
4750 fi
4751 set prototype
4752 eval $setvar
4753 $rm -f prototype*
4754
4755 case "$prototype" in
4756 "$define") ;;
4757 *)      ansi2knr='ansi2knr'
4758         echo " "
4759         cat <<EOM >&4
4760
4761 $me:  FATAL ERROR:
4762 This version of $package can only be compiled by a compiler that 
4763 understands function prototypes.  Unfortunately, your C compiler 
4764         $cc $ccflags
4765 doesn't seem to understand them.  Sorry about that.
4766
4767 If GNU cc is available for your system, perhaps you could try that instead.  
4768
4769 Eventually, we hope to support building Perl with pre-ANSI compilers.
4770 If you would like to help in that effort, please contact <perlbug@perl.org>.
4771
4772 Aborting Configure now.
4773 EOM
4774         exit 2
4775         ;;
4776 esac
4777
4778 : determine where public executables go
4779 echo " "
4780 set dflt bin bin
4781 eval $prefixit
4782 fn=d~
4783 rp='Pathname where the public executables will reside?'
4784 . ./getfile
4785 if $test "X$ansexp" != "X$binexp"; then
4786         installbin=''
4787 fi
4788 bin="$ans"
4789 binexp="$ansexp"
4790 : Change installation prefix, if necessary.
4791 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4792 if $test X"$prefix" != X"$installprefix"; then
4793         installbin=`echo $binexp | sed 's#^$prefix#$installprefix#'`
4794 else
4795         installbin="$binexp"
4796 fi
4797
4798 : determine whether to install perl also as /usr/bin/perl
4799
4800 echo " "
4801 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4802         $cat <<EOM
4803 Many scripts expect to perl to be installed as /usr/bin/perl.
4804 I can install the perl you are about to compile also as /usr/bin/perl
4805 (in addition to $installbin/perl).
4806 EOM
4807         case "$installusrbinperl" in
4808         "$undef"|[nN]*) dflt='n';;
4809         *)              dflt='y';;
4810         esac
4811         rp="Do you want to install perl as /usr/bin/perl?"
4812         . ./myread
4813         case "$ans" in
4814         [yY]*)  val="$define";;
4815         *)      val="$undef" ;;
4816         esac
4817 else
4818         val="$undef"
4819 fi
4820 set installusrbinperl
4821 eval $setvar
4822
4823 : define a shorthand compile call
4824 compile='
4825 mc_file=$1;
4826 shift;
4827 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4828 : define a shorthand compile call for compilations that should be ok.
4829 compile_ok='
4830 mc_file=$1;
4831 shift;
4832 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4833
4834 echo " "
4835 echo "Checking for GNU C Library..." >&4
4836 cat >gnulibc.c <<EOM
4837 #include <stdio.h>
4838 int main()
4839 {
4840 #ifdef __GLIBC__
4841     exit(0);
4842 #else
4843     exit(1);
4844 #endif
4845 }
4846 EOM
4847 set gnulibc
4848 if eval $compile_ok && ./gnulibc; then
4849         val="$define"
4850         echo "You are using the GNU C Library"
4851 else
4852         val="$undef"
4853         echo "You are not using the GNU C Library"
4854 fi
4855 $rm -f gnulibc*
4856 set d_gnulibc
4857 eval $setvar
4858
4859 : see if nm is to be used to determine whether a symbol is defined or not
4860 case "$usenm" in
4861 '')
4862         dflt=''
4863         case "$d_gnulibc" in
4864         "$define")
4865                 echo " "
4866                 echo "nm probably won't work on the GNU C Library." >&4
4867                 dflt=n
4868                 ;;
4869         esac
4870         case "$dflt" in
4871         '') 
4872                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4873                         echo " "
4874                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4875                         echo "'nm' won't be sufficient on this sytem." >&4
4876                         dflt=n
4877                 fi
4878                 ;;
4879         esac
4880         case "$dflt" in
4881         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4882                 if $test $dflt -gt 20; then
4883                         dflt=y
4884                 else
4885                         dflt=n
4886                 fi
4887                 ;;
4888         esac
4889         ;;
4890 *)
4891         case "$usenm" in
4892         true|$define) dflt=y;;
4893         *) dflt=n;;
4894         esac
4895         ;;
4896 esac
4897 $cat <<EOM
4898
4899 I can use $nm to extract the symbols from your C libraries. This
4900 is a time consuming task which may generate huge output on the disk (up
4901 to 3 megabytes) but that should make the symbols extraction faster. The
4902 alternative is to skip the 'nm' extraction part and to compile a small
4903 test program instead to determine whether each symbol is present. If
4904 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4905 this may be the best solution.
4906
4907 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4908
4909 EOM
4910 rp="Shall I use $nm to extract C symbols from the libraries?"
4911 . ./myread
4912 case "$ans" in
4913 [Nn]*) usenm=false;;
4914 *) usenm=true;;
4915 esac
4916
4917 runnm=$usenm
4918 case "$reuseval" in
4919 true) runnm=false;;
4920 esac
4921
4922 : nm options which may be necessary
4923 case "$nm_opt" in
4924 '') if $test -f /mach_boot; then
4925                 nm_opt=''       # Mach
4926         elif $test -d /usr/ccs/lib; then
4927                 nm_opt='-p'     # Solaris (and SunOS?)
4928         elif $test -f /dgux; then
4929                 nm_opt='-p'     # DG-UX
4930         elif $test -f /lib64/rld; then
4931                 nm_opt='-p'     # 64-bit Irix
4932         else
4933                 nm_opt=''
4934         fi;;
4935 esac
4936
4937 : nm options which may be necessary for shared libraries but illegal
4938 : for archive libraries.  Thank you, Linux.
4939 case "$nm_so_opt" in
4940 '')     case "$myuname" in
4941         *linux*)
4942                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4943                         nm_so_opt='--dynamic'
4944                 fi
4945                 ;;
4946         esac
4947         ;;
4948 esac
4949
4950 case "$runnm" in
4951 true)
4952 : get list of predefined functions in a handy place
4953 echo " "
4954 case "$libc" in
4955 '') libc=unknown
4956         case "$libs" in
4957         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4958         esac
4959         ;;
4960 esac
4961 libnames='';
4962 case "$libs" in
4963 '') ;;
4964 *)  for thislib in $libs; do
4965         case "$thislib" in
4966         -lc|-lc_s)
4967                 : Handle C library specially below.
4968                 ;;
4969         -l*)
4970                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4971                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4972                         :
4973                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4974                         :
4975                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4976                         :
4977                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4978                         :
4979                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4980                         :
4981                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4982                         :
4983                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4984                         :
4985                 else
4986                         try=''
4987                 fi
4988                 libnames="$libnames $try"
4989                 ;;
4990         *) libnames="$libnames $thislib" ;;
4991         esac
4992         done
4993         ;;
4994 esac
4995 xxx=normal
4996 case "$libc" in
4997 unknown)
4998         set /lib/libc.$so
4999         for xxx in $libpth; do
5000                 $test -r $1 || set $xxx/libc.$so
5001                 : The messy sed command sorts on library version numbers.
5002                 $test -r $1 || \
5003                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5004                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5005                                 h
5006                                 s/[0-9][0-9]*/0000&/g
5007                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5008                                 G
5009                                 s/\n/ /' | \
5010                          sort | $sed -e 's/^.* //'`
5011                 eval set \$$#
5012         done
5013         $test -r $1 || set /usr/ccs/lib/libc.$so
5014         $test -r $1 || set /lib/libsys_s$_a
5015         ;;
5016 *)
5017         set blurfl
5018         ;;
5019 esac
5020 if $test -r "$1"; then
5021         echo "Your (shared) C library seems to be in $1."
5022         libc="$1"
5023 elif $test -r /lib/libc && $test -r /lib/clib; then
5024         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5025         xxx=apollo
5026         libc='/lib/clib /lib/libc'
5027         if $test -r /lib/syslib; then
5028                 echo "(Your math library is in /lib/syslib.)"
5029                 libc="$libc /lib/syslib"
5030         fi
5031 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5032         echo "Your C library seems to be in $libc, as you said before."
5033 elif $test -r $incpath/usr/lib/libc$_a; then
5034         libc=$incpath/usr/lib/libc$_a;
5035         echo "Your C library seems to be in $libc.  That's fine."
5036 elif $test -r /lib/libc$_a; then
5037         libc=/lib/libc$_a;
5038         echo "Your C library seems to be in $libc.  You're normal."
5039 else
5040         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5041                 :
5042         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5043                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5044         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5045                 :
5046         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5047                 :
5048         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5049                 :
5050         else
5051                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5052         fi
5053         if $test -r "$tans"; then
5054                 echo "Your C library seems to be in $tans, of all places."
5055                 libc=$tans
5056         else
5057                 libc='blurfl'
5058         fi
5059 fi
5060 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5061         dflt="$libc"
5062         cat <<EOM
5063
5064 If the guess above is wrong (which it might be if you're using a strange
5065 compiler, or your machine supports multiple models), you can override it here.
5066
5067 EOM
5068 else
5069         dflt=''
5070         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5071         cat >&4 <<EOM
5072 I can't seem to find your C library.  I've looked in the following places:
5073
5074 EOM
5075         $sed 's/^/      /' libpath
5076         cat <<EOM
5077
5078 None of these seems to contain your C library. I need to get its name...
5079
5080 EOM
5081 fi
5082 fn=f
5083 rp='Where is your C library?'
5084 . ./getfile
5085 libc="$ans"
5086
5087 echo " "
5088 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5089 set X `cat libnames`
5090 shift
5091 xxx=files
5092 case $# in 1) xxx=file; esac
5093 echo "Extracting names from the following $xxx for later perusal:" >&4
5094 echo " "
5095 $sed 's/^/      /' libnames >&4
5096 echo " "
5097 $echo $n "This may take a while...$c" >&4
5098
5099 for file in $*; do
5100         case $file in
5101         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5102         *) $nm $nm_opt $file 2>/dev/null;;
5103         esac
5104 done >libc.tmp
5105
5106 $echo $n ".$c"
5107 $grep fprintf libc.tmp > libc.ptf
5108 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5109 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5110 xxx='[ADTSIW]'
5111 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5112         eval $xscan;\
5113         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5114                 eval $xrun
5115 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5116         eval $xscan;\
5117         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5118                 eval $xrun
5119 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5120         eval $xscan;\
5121         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5122                 eval $xrun
5123 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5124         eval $xscan;\
5125         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5126                 eval $xrun
5127 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5128         eval $xscan;\
5129         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5130                 eval $xrun
5131 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5132         eval $xscan;\
5133         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5134                 eval $xrun
5135 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5136                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5137         eval $xscan;\
5138         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5139                 eval $xrun
5140 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5141         eval $xscan;\
5142         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5143                 eval $xrun
5144 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5145         eval $xscan;\
5146         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5147                 eval $xrun
5148 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5149         eval $xscan;\
5150         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5151                 eval $xrun
5152 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5153         eval $xscan;\
5154         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5155                 eval $xrun
5156 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5157         eval $xscan;\
5158         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5159                 eval $xrun
5160 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5161         eval $xscan;\
5162         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5163                 eval $xrun
5164 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5165         eval $xscan;\
5166         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5167                 eval $xrun
5168 else
5169         $nm -p $* 2>/dev/null >libc.tmp
5170         $grep fprintf libc.tmp > libc.ptf
5171         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5172                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5173         then
5174                 nm_opt='-p'
5175                 eval $xrun
5176         else
5177                 echo " "
5178                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5179                 com=''
5180                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5181                         for thisname in $libnames $libc; do
5182                                 $ar t $thisname >>libc.tmp
5183                         done
5184                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5185                         echo "Ok." >&4
5186                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5187                         # Repeat libc to extract forwarders to DLL entries too
5188                         for thisname in $libnames $libc; do
5189                                 $ar tv $thisname >>libc.tmp
5190                                 # Revision 50 of EMX has bug in $ar.
5191                                 # it will not extract forwarders to DLL entries
5192                                 # Use emximp which will extract exactly them.
5193                                 emximp -o tmp.imp $thisname \
5194                                     2>/dev/null && \
5195                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5196                                     < tmp.imp >>libc.tmp
5197                                 $rm tmp.imp
5198                         done
5199                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5200                         echo "Ok." >&4
5201                 else
5202                         echo "$ar didn't seem to work right." >&4
5203                         echo "Maybe this is a Cray...trying bld instead..." >&4
5204                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5205                         then
5206                                 for thisname in $libnames; do
5207                                         bld t $libnames | \
5208                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5209                                         $ar t $thisname >>libc.tmp
5210                                 done
5211                                 echo "Ok." >&4
5212                         else
5213                                 echo "That didn't work either.  Giving up." >&4
5214                                 exit 1
5215                         fi
5216                 fi
5217         fi
5218 fi
5219 nm_extract="$com"
5220 if $test -f /lib/syscalls.exp; then
5221         echo " "
5222         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5223         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5224 fi
5225 ;;
5226 esac
5227 $rm -f libnames libpath
5228
5229 : see if dld is available
5230 set dld.h i_dld
5231 eval $inhdr
5232
5233 : is a C symbol defined?
5234 csym='tlook=$1;
5235 case "$3" in
5236 -v) tf=libc.tmp; tc=""; tdc="";;
5237 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5238 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5239 esac;
5240 tx=yes;
5241 case "$reuseval-$4" in
5242 true-) ;;
5243 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5244 esac;
5245 case "$tx" in
5246 yes)
5247         case "$runnm" in
5248         true)
5249                 if $contains $tlook $tf >/dev/null 2>&1;
5250                 then tval=true;
5251                 else tval=false;
5252                 fi;;
5253         *)
5254                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5255                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5256                 then tval=true;
5257                 else tval=false;
5258                 fi;
5259                 $rm -f t t.c;;
5260         esac;;
5261 *)
5262         case "$tval" in
5263         $define) tval=true;;
5264         *) tval=false;;
5265         esac;;
5266 esac;
5267 eval "$2=$tval"'
5268
5269 : define an is-in-libc? function
5270 inlibc='echo " "; td=$define; tu=$undef;
5271 sym=$1; var=$2; eval "was=\$$2";
5272 tx=yes;
5273 case "$reuseval$was" in
5274 true) ;;
5275 true*) tx=no;;
5276 esac;
5277 case "$tx" in
5278 yes)
5279         set $sym tres -f;
5280         eval $csym;
5281         case "$tres" in
5282         true)
5283                 echo "$sym() found." >&4;
5284                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5285         *)
5286                 echo "$sym() NOT found." >&4;
5287                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5288         esac;;
5289 *)
5290         case "$was" in
5291         $define) echo "$sym() found." >&4;;
5292         *) echo "$sym() NOT found." >&4;;
5293         esac;;
5294 esac'
5295
5296 : see if dlopen exists
5297 xxx_runnm="$runnm"
5298 runnm=false
5299 set dlopen d_dlopen
5300 eval $inlibc
5301 runnm="$xxx_runnm"
5302
5303 : determine which dynamic loading, if any, to compile in
5304 echo " "
5305 dldir="ext/DynaLoader"
5306 case "$usedl" in
5307 $define|y|true)
5308         dflt='y'
5309         usedl="$define"
5310         ;;
5311 $undef|n|false)
5312         dflt='n'
5313         usedl="$undef"
5314         ;;
5315 *) 
5316         dflt='n'
5317         case "$d_dlopen" in
5318             $define) dflt='y' ;;
5319         esac
5320         case "$i_dld" in
5321             $define) dflt='y' ;;
5322         esac
5323         : Does a dl_xxx.xs file exist for this operating system
5324         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5325         ;;
5326 esac
5327 rp="Do you wish to use dynamic loading?"
5328 . ./myread
5329 usedl="$ans"
5330 case "$ans" in
5331 y*) usedl="$define"
5332         case "$dlsrc" in
5333         '')
5334                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5335                         dflt="$dldir/dl_${osname}.xs"
5336                 elif $test "$d_dlopen" = "$define" ; then
5337                         dflt="$dldir/dl_dlopen.xs"
5338                 elif $test "$i_dld" = "$define" ; then
5339                         dflt="$dldir/dl_dld.xs"
5340                 else
5341                         dflt=''
5342                 fi
5343                 ;;
5344         *)      dflt="$dldir/$dlsrc"
5345                 ;;
5346         esac
5347     echo "The following dynamic loading files are available:"
5348         : Can not go over to $dldir because getfile has path hard-coded in.
5349         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5350         rp="Source file to use for dynamic loading"
5351         fn="fne"
5352         gfpth="$src"
5353         . ./getfile
5354         usedl="$define"
5355         : emulate basename
5356         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5357
5358         $cat << EOM
5359
5360 Some systems may require passing special flags to $cc -c to
5361 compile modules that will be used to create a shared library.
5362 To use no flags, say "none".
5363
5364 EOM
5365     case "$cccdlflags" in
5366     '') case "$gccversion" in
5367                 '') case "$osname" in
5368                         hpux)   dflt='+z' ;;
5369                         next)   dflt='none' ;;
5370                         irix*)  dflt='-KPIC' ;;
5371                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5372                         sunos)  dflt='-pic' ;;
5373                         *)      dflt='none' ;;
5374                     esac
5375                         ;;
5376                 *)  case "$osname" in
5377                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5378                         *)      dflt='-fpic' ;;
5379                     esac ;;
5380             esac ;;
5381         ' ') dflt='none' ;;
5382     *)  dflt="$cccdlflags" ;;
5383     esac
5384     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5385     . ./myread
5386     case "$ans" in
5387     none) cccdlflags=' ' ;;
5388     *) cccdlflags="$ans" ;;
5389     esac
5390
5391     cat << EOM
5392
5393 Some systems use ld to create libraries that can be dynamically loaded,
5394 while other systems (such as those using ELF) use $cc.
5395
5396 EOM
5397         case "$ld" in
5398         '')     $cat >try.c <<'EOM'
5399 /* Test for whether ELF binaries are produced */
5400 #include <fcntl.h>
5401 #include <stdlib.h>
5402 int main() {
5403         char b[4];
5404         int i = open("a.out",O_RDONLY);
5405         if(i == -1) 
5406                 exit(1); /* fail */
5407         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5408                 exit(0); /* succeed (yes, it's ELF) */
5409         else
5410                 exit(1); /* fail */
5411 }
5412 EOM
5413                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5414                         cat <<EOM
5415 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5416 EOM
5417                         dflt="$cc"
5418                 else
5419                         echo "I'll use ld to build dynamic libraries."
5420                         dflt='ld'
5421                 fi
5422                 rm -f try.c a.out
5423                 ;;
5424         *)      dflt="$ld"
5425                 ;;
5426         esac
5427
5428     rp="What command should be used to create dynamic libraries?"
5429     . ./myread
5430         ld="$ans"
5431
5432     cat << EOM
5433
5434 Some systems may require passing special flags to $ld to create a
5435 library that can be dynamically loaded.  If your ld flags include
5436 -L/other/path options to locate libraries outside your loader's normal
5437 search path, you may need to specify those -L options here as well.  To
5438 use no flags, say "none".
5439
5440 EOM
5441     case "$lddlflags" in
5442     '') case "$osname" in
5443                         beos) dflt='-nostart' ;;
5444                         hpux)  dflt='-b' ;;
5445                         linux|irix*)    dflt='-shared' ;;
5446                         next)  dflt='none' ;;
5447                         solaris) dflt='-G' ;;
5448                         sunos) dflt='-assert nodefinitions' ;;
5449                         svr4*|esix*) dflt="-G $ldflags" ;;
5450                 *)     dflt='none' ;;
5451                         esac
5452                         ;;
5453     *) dflt="$lddlflags" ;;
5454     esac
5455
5456         : Try to guess additional flags to pick up local libraries.
5457         : Be careful not to append to a plain 'none'
5458         case "$dflt" in
5459         none) dflt='' ;;
5460         esac
5461         for thisflag in $ldflags; do
5462                 case "$thisflag" in
5463                 -L*)
5464                         case " $dflt " in
5465                         *" $thisflag "*) ;;
5466                         *) dflt="$dflt $thisflag" ;;
5467                         esac
5468                         ;;
5469                 esac
5470         done
5471
5472         case "$dflt" in
5473         ''|' ') dflt='none' ;;
5474         esac
5475
5476     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5477     . ./myread
5478     case "$ans" in
5479     none) lddlflags=' ' ;;
5480     *) lddlflags="$ans" ;;
5481     esac
5482
5483         cat <<EOM
5484
5485 Some systems may require passing special flags to $cc to indicate that
5486 the resulting executable will use dynamic linking.  To use no flags,
5487 say "none".
5488
5489 EOM
5490     case "$ccdlflags" in
5491     '') case "$osname" in
5492                 hpux)   dflt='-Wl,-E' ;;
5493                 linux)  dflt='-rdynamic' ;;
5494                 next)   dflt='none' ;;
5495                 sunos)  dflt='none' ;;
5496                 *)      dflt='none' ;;
5497             esac ;;
5498     ' ')  dflt='none' ;;
5499     *)  dflt="$ccdlflags" ;;
5500     esac
5501     rp="Any special flags to pass to $cc to use dynamic loading?"
5502     . ./myread
5503     case "$ans" in
5504     none) ccdlflags=' ' ;;
5505     *) ccdlflags="$ans" ;;
5506     esac
5507     ;;
5508 *)  usedl="$undef"
5509         ld='ld'
5510     dlsrc='dl_none.xs'
5511     lddlflags=''
5512     ccdlflags=''
5513     ;;
5514 esac
5515
5516 also=''
5517 case "$usedl" in
5518 $undef)
5519         # No dynamic loading being used, so don't bother even to prompt.
5520         useshrplib='false'
5521         ;;
5522 *)      case "$useshrplib" in
5523         '')     case "$osname" in
5524                 svr4*|dgux|dynixptx|esix|powerux|beos)
5525                         dflt=y
5526                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5527                         ;;
5528                 next*)
5529                         case "$osvers" in
5530                         4*)     dflt=y
5531                                 also='Building a shared libperl is needed for MAB support.'
5532                                 ;;
5533                         *)      dflt=n
5534                                 ;;
5535                         esac
5536                         ;;
5537                 *)      dflt=n
5538                         ;;
5539                 esac
5540                 ;;
5541         $define|true|[Yy]*)
5542                 dflt=y
5543                 ;;
5544         *)      dflt=n
5545                 ;;
5546         esac
5547         $cat << EOM
5548
5549 The perl executable is normally obtained by linking perlmain.c with
5550 libperl${_a}, any static extensions (usually just DynaLoader), and
5551 any other libraries needed on this system (such as -lm, etc.).  Since
5552 your system supports dynamic loading, it is probably possible to build
5553 a shared libperl.$so.  If you will have more than one executable linked
5554 to libperl.$so, this will significantly reduce the size of each
5555 executable, but it may have a noticeable affect on performance.  The
5556 default is probably sensible for your system.
5557 $also
5558
5559 EOM
5560         rp="Build a shared libperl.$so (y/n)"
5561         . ./myread
5562         case "$ans" in
5563         true|$define|[Yy]*)
5564                 useshrplib='true'  ;;
5565         *)      useshrplib='false' ;;
5566         esac
5567         ;;
5568 esac
5569
5570 case "$useshrplib" in
5571 true)
5572         case "$libperl" in
5573         '')
5574                 # Figure out a good name for libperl.so.  Since it gets stored in
5575                 # a version-specific architecture-dependent library, the version
5576                 # number isn't really that important, except for making cc/ld happy.
5577                 #
5578                 # A name such as libperl.so.3.1
5579                 majmin="libperl.$so.$patchlevel.$subversion"
5580                 # A name such as libperl.so.301
5581                 majonly=`echo $patchlevel $subversion |
5582                         $awk '{printf "%d%02d", $1, $2}'`
5583                 majonly=libperl.$so.$majonly
5584                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5585                 # rely on figuring it out from the naming of libc.
5586                 case "${osname}${osvers}" in
5587                 next4*)
5588                         dflt=libperl.5.$so
5589                         # XXX How handle the --version stuff for MAB?
5590                         ;;
5591                 linux*)  # ld won't link with a bare -lperl otherwise.
5592                         dflt=libperl.$so
5593                         ;;
5594                 *)      # Try to guess based on whether libc has major.minor.
5595                         case "$libc" in
5596                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5597                         *libc.$so.[0-9]*) dflt=$majonly ;;
5598                         *)      dflt=libperl.$so ;;
5599                         esac
5600                         ;;
5601                 esac
5602                 ;;
5603         *)      dflt=$libperl
5604                 ;;
5605         esac
5606         cat << EOM
5607
5608 I need to select a good name for the shared libperl.  If your system uses
5609 library names with major and minor numbers, then you might want something
5610 like $majmin.  Alternatively, if your system uses a single version
5611 number for shared libraries, then you might want to use $majonly.
5612 Or, your system might be quite happy with a simple libperl.$so.
5613
5614 Since the shared libperl will get installed into a version-specific
5615 architecture-dependent directory, the version number of the shared perl
5616 library probably isn't important, so the default should be o.k.
5617
5618 EOM
5619         rp='What name do you want to give to the shared libperl?'
5620         . ./myread
5621         libperl=$ans
5622         echo "Ok, I'll use $libperl"
5623         ;;
5624 *)
5625         libperl="libperl${_a}"
5626         ;;
5627 esac
5628
5629 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5630 case "$shrpdir" in
5631 '') ;;
5632 *)      $cat >&4 <<EOM
5633 WARNING:  Use of the shrpdir variable for the installation location of
5634 the shared $libperl is not supported.  It was never documented and
5635 will not work in this version.  Let me (perlbug@perl.com)
5636 know of any problems this may cause.
5637
5638 EOM
5639         case "$shrpdir" in
5640         "$archlibexp/CORE")
5641                 $cat >&4 <<EOM
5642 But your current setting of $shrpdir is
5643 the default anyway, so it's harmless.
5644 EOM
5645                 ;;
5646         *)
5647                 $cat >&4 <<EOM
5648 Further, your current attempted setting of $shrpdir
5649 conflicts with the value of $archlibexp/CORE
5650 that installperl will use.
5651 EOM
5652                 ;;
5653         esac
5654         ;;
5655 esac
5656
5657 # How will the perl executable find the installed shared $libperl?
5658 # Add $xxx to ccdlflags.
5659 # If we can't figure out a command-line option, use $shrpenv to
5660 # set env LD_RUN_PATH.  The main perl makefile uses this.
5661 shrpdir=$archlibexp/CORE
5662 xxx=''
5663 tmp_shrpenv=''
5664 if "$useshrplib"; then
5665     case "$osname" in 
5666         aix)
5667                 # We'll set it in Makefile.SH...
5668                 ;;
5669         solaris|netbsd)
5670                 xxx="-R $shrpdir"
5671                 ;;
5672         freebsd)
5673                 xxx="-Wl,-R$shrpdir"
5674                 ;;
5675         linux|irix*|dec_osf)
5676                 xxx="-Wl,-rpath,$shrpdir"
5677                 ;;
5678         next)
5679                 # next doesn't like the default...
5680                 ;;
5681         beos)
5682                 # beos doesn't like the default, either.
5683                 ;;
5684         hpux*)
5685                 # hpux doesn't like the default, either.
5686                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5687                 ;;
5688         *)
5689                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5690                 ;;
5691         esac
5692         case "$xxx" in
5693         '') ;;
5694         *)      
5695                 # Only add $xxx if it isn't already in ccdlflags.
5696                 case " $ccdlflags " in
5697                 *" $xxx "*)     ;;
5698                 *)      ccdlflags="$ccdlflags $xxx"
5699                         cat <<EOM >&4
5700
5701 Adding $xxx to the flags
5702 passed to $ld so that the perl executable will find the 
5703 installed shared $libperl.
5704
5705 EOM
5706                         ;;
5707                 esac
5708                 ;;
5709         esac
5710 fi
5711 # Fix ccdlflags in AIX for building external extensions.
5712 # (For building Perl itself bare -bE:perl.exp is needed,
5713 #  Makefile.SH takes care of this.)
5714 case "$osname" in
5715 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5716 esac
5717 # Respect a hint or command-line value.
5718 case "$shrpenv" in
5719 '') shrpenv="$tmp_shrpenv" ;;
5720 esac
5721 case "$ldlibpthname" in
5722 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5723 none)   ldlibpthname='' ;;
5724 esac
5725
5726 : determine where manual pages go
5727 set man1dir man1dir none
5728 eval $prefixit
5729 $cat <<EOM
5730
5731 $spackage has manual pages available in source form.
5732 EOM
5733 case "$nroff" in
5734 nroff)
5735         echo "However, you don't have nroff, so they're probably useless to you."
5736         case "$man1dir" in
5737         '') man1dir="none";;
5738         esac;;
5739 esac
5740 echo "If you don't want the manual sources installed, answer 'none'."
5741 case "$man1dir" in
5742 ' ') dflt=none
5743         ;;
5744 '')
5745         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5746         lookpath="$lookpath $prefixexp/man/p_man/man1"
5747         lookpath="$lookpath $prefixexp/man/u_man/man1"
5748         lookpath="$lookpath $prefixexp/man/man.1"
5749         case "$sysman" in
5750         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5751         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5752         esac
5753         set dflt
5754         eval $prefixup
5755         ;;
5756 *)  dflt="$man1dir"
5757         ;;
5758 esac
5759 echo " "
5760 fn=dn+~
5761 rp="Where do the main $spackage manual pages (source) go?"
5762 . ./getfile
5763 if $test "X$man1direxp" != "X$ansexp"; then
5764         installman1dir=''
5765 fi
5766 man1dir="$ans"
5767 man1direxp="$ansexp"
5768 case "$man1dir" in
5769 '')     man1dir=' '
5770         installman1dir='';;
5771 esac
5772
5773 : Change installation prefix, if necessary.
5774 if $test X"$prefix" != X"$installprefix"; then
5775         installman1dir=`echo $man1direxp | $sed 's#^$prefix#$installprefix#'`
5776 else
5777         installman1dir="$man1direxp"
5778 fi
5779
5780 : What suffix to use on installed man pages
5781
5782 case "$man1dir" in
5783 ' ')
5784         man1ext='0'
5785         ;;
5786 *)
5787         rp="What suffix should be used for the main $spackage man pages?"
5788         case "$man1ext" in
5789         '')     case "$man1dir" in
5790                 *1)  dflt=1 ;;
5791                 *1p) dflt=1p ;;
5792                 *1pm) dflt=1pm ;;
5793                 *l) dflt=l;;
5794                 *n) dflt=n;;
5795                 *o) dflt=o;;
5796                 *p) dflt=p;;
5797                 *C) dflt=C;;
5798                 *L) dflt=L;;
5799                 *L1) dflt=L1;;
5800                 *) dflt=1;;
5801                 esac
5802                 ;;
5803         *)      dflt="$man1ext";;
5804         esac
5805         . ./myread
5806         man1ext="$ans"
5807         ;;
5808 esac
5809
5810 : see if we can have long filenames
5811 echo " "
5812 rmlist="$rmlist /tmp/cf$$"
5813 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5814 first=123456789abcdef
5815 second=/tmp/cf$$/$first
5816 $rm -f $first $second
5817 if (echo hi >$first) 2>/dev/null; then
5818         if $test -f 123456789abcde; then
5819                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5820                 val="$undef"
5821         else
5822                 if (echo hi >$second) 2>/dev/null; then
5823                         if $test -f /tmp/cf$$/123456789abcde; then
5824                                 $cat <<'EOM'
5825 That's peculiar... You can have filenames longer than 14 characters, but only
5826 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5827 I shall consider your system cannot support long filenames at all.
5828 EOM
5829                                 val="$undef"
5830                         else
5831                                 echo 'You can have filenames longer than 14 characters.' >&4
5832                                 val="$define"
5833                         fi
5834                 else
5835                         $cat <<'EOM'
5836 How confusing! Some of your filesystems are sane enough to allow filenames
5837 longer than 14 characters but some others like /tmp can't even think about them.
5838 So, for now on, I shall assume your kernel does not allow them at all.
5839 EOM
5840                         val="$undef"
5841                 fi
5842         fi
5843 else
5844         $cat <<'EOM'
5845 You can't have filenames longer than 14 chars.  You can't even think about them!
5846 EOM
5847         val="$undef"
5848 fi 
5849 set d_flexfnam
5850 eval $setvar
5851 $rm -rf /tmp/cf$$ 123456789abcde*
5852
5853 : determine where library module manual pages go
5854 set man3dir man3dir none
5855 eval $prefixit
5856 $cat <<EOM
5857
5858 $spackage has manual pages for many of the library modules.
5859 EOM
5860
5861 case "$nroff" in
5862 nroff)
5863         $cat <<'EOM'
5864 However, you don't have nroff, so they're probably useless to you.
5865 EOM
5866         case "$man3dir" in
5867         '') man3dir="none";;
5868         esac;;
5869 esac
5870
5871 case "$d_flexfnam" in
5872 undef)
5873         $cat <<'EOM'
5874 However, your system can't handle the long file names like File::Basename.3. 
5875 EOM
5876         case "$man3dir" in
5877         '') man3dir="none";;
5878         esac;;
5879 esac
5880
5881 echo "If you don't want the manual sources installed, answer 'none'."
5882 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5883 case "$man3dir" in
5884 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5885         if $test -d "$privlib/man/man3"; then
5886                 cat <<EOM >&4
5887
5888 WARNING:  Previous versions of perl installed man3 pages into
5889 $privlib/man/man3.  This version will suggest a 
5890 new default of $dflt.  
5891 EOM
5892                 tdflt=$dflt
5893                 dflt='n'
5894                 rp='Do you wish to preserve the old behavior?(y/n)'
5895                 . ./myread
5896                 case "$ans" in
5897                 y*) dflt="$privlib/man/man3" ;;
5898                 *)  dflt=$tdflt ;;
5899                 esac
5900     fi
5901         ;;
5902 ' ') dflt=none;;
5903 *)      dflt="$man3dir" ;;
5904 esac
5905 echo " "
5906 fn=dn+~
5907 rp="Where do the $package library man pages (source) go?"
5908 . ./getfile
5909 man3dir="$ans"
5910 man3direxp="$ansexp"
5911 case "$man1dir" in
5912 '')     man3dir=' '
5913         installman3dir='';;
5914 esac
5915
5916 : Change installation prefix, if necessary.
5917 if $test X"$prefix" != X"$installprefix"; then
5918         installman3dir=`echo $man3direxp | $sed 's#^$prefix#$installprefix#'`
5919 else
5920         installman3dir="$man3direxp"
5921 fi
5922
5923 : What suffix to use on installed man pages
5924 case "$man3dir" in
5925 ' ')
5926         man3ext='0'
5927         ;;
5928 *)
5929         rp="What suffix should be used for the $package library man pages?"
5930         case "$man3ext" in
5931         '')     case "$man3dir" in
5932                 *3)  dflt=3 ;;
5933                 *3p) dflt=3p ;;
5934                 *3pm) dflt=3pm ;;
5935                 *l) dflt=l;;
5936                 *n) dflt=n;;
5937                 *o) dflt=o;;
5938                 *p) dflt=p;;
5939                 *C) dflt=C;;
5940                 *L) dflt=L;;
5941                 *L3) dflt=L3;;
5942                 *) dflt=3;;
5943                 esac
5944                 ;;
5945         *)      dflt="$man3ext";;
5946         esac
5947         . ./myread
5948         man3ext="$ans"
5949         ;;
5950 esac
5951
5952 : see if we have to deal with yellow pages, now NIS.
5953 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5954         if $test -f /usr/etc/nibindd; then
5955                 echo " "
5956                 echo "I'm fairly confident you're on a NeXT."
5957                 echo " "
5958                 rp='Do you get the hosts file via NetInfo?'
5959                 dflt=y
5960                 case "$hostcat" in
5961                 nidump*) ;;
5962                 '') ;;
5963                 *) dflt=n;;
5964                 esac
5965                 . ./myread
5966                 case "$ans" in
5967                 y*) hostcat='nidump hosts .';;
5968                 *)      case "$hostcat" in
5969                         nidump*) hostcat='';;
5970                         esac
5971                         ;;
5972                 esac
5973         fi
5974         case "$hostcat" in
5975         nidump*) ;;
5976         *)
5977                 case "$hostcat" in
5978                 *ypcat*) dflt=y;;
5979                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5980                                 dflt=y
5981                         else
5982                                 dflt=n
5983                         fi;;
5984                 *) dflt=n;;
5985                 esac
5986                 echo " "
5987                 rp='Are you getting the hosts file via yellow pages?'
5988                 . ./myread
5989                 case "$ans" in
5990                 y*) hostcat='ypcat hosts';;
5991                 *) hostcat='cat /etc/hosts';;
5992                 esac
5993                 ;;
5994         esac
5995 fi
5996 case "$hostcat" in
5997 '') hostcat='cat /etc/hosts';;
5998 esac
5999 case "$groupcat" in
6000 '') groupcat='cat /etc/group';;
6001 esac
6002 case "$passcat" in
6003 '') passcat='cat /etc/passwd';;
6004 esac
6005
6006 : now get the host name
6007 echo " "
6008 echo "Figuring out host name..." >&4
6009 case "$myhostname" in
6010 '') cont=true
6011         echo 'Maybe "hostname" will work...'
6012         if tans=`sh -c hostname 2>&1` ; then
6013                 myhostname=$tans
6014                 phostname=hostname
6015                 cont=''
6016         fi
6017         ;;
6018 *) cont='';;
6019 esac
6020 if $test "$cont"; then
6021         if ./xenix; then
6022                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6023                 if tans=`cat /etc/systemid 2>&1` ; then
6024                         myhostname=$tans
6025                         phostname='cat /etc/systemid'
6026                         echo "Whadyaknow.  Xenix always was a bit strange..."
6027                         cont=''
6028                 fi
6029         elif $test -r /etc/systemid; then
6030                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6031         fi
6032 fi
6033 if $test "$cont"; then
6034         echo 'No, maybe "uuname -l" will work...'
6035         if tans=`sh -c 'uuname -l' 2>&1` ; then
6036                 myhostname=$tans
6037                 phostname='uuname -l'
6038         else
6039                 echo 'Strange.  Maybe "uname -n" will work...'
6040                 if tans=`sh -c 'uname -n' 2>&1` ; then
6041                         myhostname=$tans
6042                         phostname='uname -n'
6043                 else
6044                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6045                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6046                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6047                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6048                         else
6049                                 case "$myhostname" in
6050                                 '') echo "Does this machine have an identity crisis or something?"
6051                                         phostname='';;
6052                                 *)
6053                                         echo "Well, you said $myhostname before..."
6054                                         phostname='echo $myhostname';;
6055                                 esac
6056                         fi
6057                 fi
6058         fi
6059 fi
6060 : you do not want to know about this
6061 set $myhostname
6062 myhostname=$1
6063
6064 : verify guess
6065 if $test "$myhostname" ; then
6066         dflt=y
6067         rp='Your host name appears to be "'$myhostname'".'" Right?"
6068         . ./myread
6069         case "$ans" in
6070         y*) ;;
6071         *) myhostname='';;
6072         esac
6073 fi
6074
6075 : bad guess or no guess
6076 while $test "X$myhostname" = X ; do
6077         dflt=''
6078         rp="Please type the (one word) name of your host:"
6079         . ./myread
6080         myhostname="$ans"
6081 done
6082
6083 : translate upper to lower if necessary
6084 case "$myhostname" in
6085 *[A-Z]*)
6086         echo "(Normalizing case in your host name)"
6087         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6088         ;;
6089 esac
6090
6091 case "$myhostname" in
6092 *.*)
6093         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6094         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6095         echo "(Trimming domain name from host name--host name is now $myhostname)"
6096         ;;
6097 *) case "$mydomain" in
6098         '')
6099                 {
6100                         test "X$hostcat" = "Xypcat hosts" &&
6101                         ypmatch "$myhostname" hosts 2>/dev/null |\
6102                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6103                         $test -s hosts
6104                 } || {
6105                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6106                                         /[       ]$myhostname[  . ]/p" > hosts
6107                 }
6108                 tmp_re="[       . ]"
6109                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6110                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6111                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6112                         hosts | $sort | $uniq | \
6113                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6114                 case `$echo X$dflt` in
6115                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6116                         dflt=.
6117                         ;;
6118                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6119                         ;;
6120                 esac
6121                 case "$dflt" in
6122                 .)
6123                         tans=`./loc resolv.conf X /etc /usr/etc`
6124                         if $test -f "$tans"; then
6125                                 echo "(Attempting domain name extraction from $tans)"
6126                                 dflt=.`$sed -n -e 's/   / /g' \
6127                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6128                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6129                                 case "$dflt" in
6130                                 .) dflt=.`$sed -n -e 's/        / /g' \
6131                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6132                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6133                                         ;;
6134                                 esac
6135                         fi
6136                         ;;
6137                 esac
6138                 case "$dflt" in
6139                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6140                         dflt=.`sh -c domainname 2>/dev/null`
6141                         case "$dflt" in
6142                         '') dflt='.';;
6143                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6144                         esac
6145                         ;;
6146                 esac
6147                 case "$dflt" in
6148                 .) echo "(Lost all hope -- silly guess then)"
6149                         dflt='.uucp'
6150                         ;;
6151                 esac
6152                 $rm -f hosts
6153                 ;;
6154         *) dflt="$mydomain";;
6155         esac;;
6156 esac
6157 echo " "
6158 rp="What is your domain name?"
6159 . ./myread
6160 tans="$ans"
6161 case "$ans" in
6162 '') ;;
6163 .*) ;;
6164 *) tans=".$tans";;
6165 esac
6166 mydomain="$tans"
6167
6168 : translate upper to lower if necessary
6169 case "$mydomain" in
6170 *[A-Z]*)
6171         echo "(Normalizing case in your domain name)"
6172         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6173         ;;
6174 esac
6175
6176 : a little sanity check here
6177 case "$phostname" in
6178 '') ;;
6179 *)
6180         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6181         $myhostname$mydomain|$myhostname) ;;
6182         *)
6183                 case "$phostname" in
6184                 sed*)
6185                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6186                         ;;
6187                 *)
6188                         echo "(That doesn't agree with your $phostname command, by the way.)"
6189                         ;;
6190                 esac
6191         ;;
6192         esac
6193         ;;
6194 esac
6195
6196 $cat <<EOM
6197
6198 I need to get your e-mail address in Internet format if possible, i.e.
6199 something like user@host.domain. Please answer accurately since I have
6200 no easy means to double check it. The default value provided below
6201 is most probably close to the reality but may not be valid from outside
6202 your organization...
6203
6204 EOM
6205 cont=x
6206 while test "$cont"; do
6207         case "$cf_email" in
6208         '') dflt="$cf_by@$myhostname$mydomain";;
6209         *) dflt="$cf_email";;
6210         esac
6211         rp='What is your e-mail address?'
6212         . ./myread
6213         cf_email="$ans"
6214         case "$cf_email" in
6215         *@*.*) cont='' ;;
6216         *)
6217                 rp='Address does not look like an Internet one.  Use it anyway?'
6218                 case "$fastread" in
6219                 yes) dflt=y ;;
6220                 *) dflt=n ;;
6221                 esac
6222                 . ./myread
6223                 case "$ans" in
6224                 y*) cont='' ;;
6225                 *) echo " " ;;
6226                 esac
6227                 ;;
6228         esac
6229 done
6230
6231 $cat <<EOM
6232
6233 If you or somebody else will be maintaining perl at your site, please
6234 fill in the correct e-mail address here so that they may be contacted
6235 if necessary. Currently, the "perlbug" program included with perl
6236 will send mail to this address in addition to perlbug@perl.com. You may
6237 enter "none" for no administrator.
6238
6239 EOM
6240 case "$perladmin" in
6241 '') dflt="$cf_email";;
6242 *) dflt="$perladmin";;
6243 esac
6244 rp='Perl administrator e-mail address'
6245 . ./myread
6246 perladmin="$ans"
6247
6248 : figure out how to guarantee perl startup
6249 case "$startperl" in
6250 '')
6251         case "$sharpbang" in
6252         *!)
6253                 $cat <<EOH
6254
6255 I can use the #! construct to start perl on your system. This will
6256 make startup of perl scripts faster, but may cause problems if you
6257 want to share those scripts and perl is not in a standard place
6258 ($binexp/perl) on all your platforms. The alternative is to force
6259 a shell by starting the script with a single ':' character.
6260
6261 EOH
6262                 dflt="$binexp/perl"
6263                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6264                 . ./myread
6265                 case "$ans" in
6266                 none)   startperl=": # use perl";;
6267                 *)      startperl="#!$ans"
6268                         if $test 30 -lt `echo "$ans" | wc -c`; then
6269                                 $cat >&4 <<EOM
6270
6271 WARNING:  Some systems limit the #! command to 32 characters.
6272 If you experience difficulty running Perl scripts with #!, try
6273 installing Perl in a directory with a shorter pathname.
6274
6275 EOM
6276                         fi ;;
6277                 esac
6278                 ;;
6279         *) startperl=": # use perl"
6280                 ;;
6281         esac
6282         ;;
6283 esac
6284 echo "I'll use $startperl to start perl scripts."
6285
6286 : figure best path for perl in scripts
6287 case "$perlpath" in
6288 '')
6289         perlpath="$binexp/perl"
6290         case "$startperl" in
6291         *!*) ;;
6292         *)
6293                 $cat <<EOH
6294
6295 I will use the "eval 'exec'" idiom to start Perl on your system.
6296 I can use the full path of your Perl binary for this purpose, but
6297 doing so may cause problems if you want to share those scripts and
6298 Perl is not always in a standard place ($binexp/perl).
6299
6300 EOH
6301                 dflt="$binexp/perl"
6302                 rp="What path shall I use in \"eval 'exec'\"?"
6303                 . ./myread
6304                 perlpath="$ans"
6305                 ;;
6306         esac
6307         ;;
6308 esac
6309 case "$startperl" in
6310 *!*)    ;;
6311 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6312 esac
6313
6314 : determine where public executable scripts go
6315 set scriptdir scriptdir
6316 eval $prefixit
6317 case "$scriptdir" in
6318 '')
6319         dflt="$bin"
6320         : guess some guesses
6321         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6322         $test -d /usr/share/bin     && dflt=/usr/share/bin
6323         $test -d /usr/local/script  && dflt=/usr/local/script
6324         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6325         $test -d $prefixexp/script  && dflt=$prefixexp/script
6326         set dflt
6327         eval $prefixup
6328         ;;
6329 *)  dflt="$scriptdir"
6330         ;;
6331 esac
6332 $cat <<EOM
6333  
6334 Some installations have a separate directory just for executable scripts so
6335 that they can mount it across multiple architectures but keep the scripts in
6336 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6337 Or you might just lump your scripts in with all your other executables.
6338  
6339 EOM
6340 fn=d~
6341 rp='Where do you keep publicly executable scripts?'
6342 . ./getfile
6343 if $test "X$ansexp" != "X$scriptdirexp"; then
6344         installscript=''
6345 fi
6346 scriptdir="$ans"
6347 scriptdirexp="$ansexp"
6348 : Change installation prefix, if necessary.
6349 if $test X"$prefix" != X"$installprefix"; then
6350         installscript=`echo $scriptdirexp | sed 's#^$prefix#$installprefix#'`
6351 else
6352         installscript="$scriptdirexp"
6353 fi
6354
6355 $cat <<EOM
6356
6357 After $package is installed, you may wish to install various
6358 add-on modules and utilities.  Typically, these add-ons will
6359 be installed under $prefix with the rest
6360 of this package.  However, you may wish to install such add-ons
6361 elsewhere under a different prefix.
6362
6363 If you do not wish to put everything under a single prefix, that's
6364 ok.  You will be prompted for the individual locations; this siteprefix
6365 is only used to suggest the defaults.
6366
6367 The default should be fine for most people.
6368
6369 EOM
6370 fn=d~+
6371 rp='Installation prefix to use for add-on modules and utilities?'
6372 : XXX Here might be another good place for an installstyle setting.
6373 case "$siteprefix" in
6374 '') dflt=$prefix ;;
6375 *)  dflt=$siteprefix ;;
6376 esac
6377 . ./getfile
6378 oldsiteprefix=''
6379 case "$siteprefix" in
6380 '') ;;
6381 *)
6382         case "$ans" in
6383         "$prefix") ;;
6384         *) oldsiteprefix="$prefix";;
6385         esac
6386         ;;
6387 esac
6388 siteprefix="$ans"
6389 siteprefixexp="$ansexp"
6390
6391 : determine where site specific libraries go.
6392 : Usual default is /usr/local/lib/perl5/site_perl
6393 : The default "style" setting is made in installstyle.U
6394 : XXX No longer works with Prefixit stuff.
6395 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6396 case "$installstyle" in
6397 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6398 *)       dflt=$siteprefix/lib/site_$prog ;;
6399 esac
6400 $cat <<EOM
6401
6402 The installation process will create a directory for
6403 site-specific extensions and modules.  Most users find it convenient
6404 to place all site-specific files in this directory rather than in the
6405 main distribution directory.
6406
6407 EOM
6408 fn=d~+
6409 rp='Pathname for the site-specific library files?'
6410 . ./getfile
6411 sitelib="$ans"
6412 sitelibexp="$ansexp"
6413 : Change installation prefix, if necessary.
6414 if $test X"$prefix" != X"$installprefix"; then
6415         installsitelib=`echo $sitelibexp | sed 's#^$prefix#$installprefix#'`
6416 else
6417         installsitelib="$sitelibexp"
6418 fi
6419
6420 : determine where site specific architecture-dependent libraries go.
6421 : sitelib  default is /usr/local/lib/perl5/site_perl/
6422 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6423 : sitelib may have an optional trailing /share.
6424 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6425 tdflt="$tdflt/$apiversion/$archname"
6426 set sitearch sitearch none
6427 eval $prefixit
6428 case "$sitearch" in
6429 '')     dflt="$tdflt" ;;
6430 *)      dflt="$sitearch" ;;
6431 esac
6432 $cat <<EOM
6433
6434 The installation process will also create a directory for
6435 architecture-dependent site-specific extensions and modules.
6436
6437 EOM
6438 fn=nd~+
6439 rp='Pathname for the site-specific architecture-dependent library files?'
6440 . ./getfile
6441 sitearch="$ans"
6442 sitearchexp="$ansexp"
6443 : Change installation prefix, if necessary.
6444 if $test X"$prefix" != X"$installprefix"; then
6445         installsitearch=`echo $sitearchexp | sed 's#^$prefix#$installprefix#'`
6446 else
6447         installsitearch="$sitearchexp"
6448 fi
6449
6450 cat <<EOM
6451
6452 Previous version of $package used the standard IO mechanisms as defined
6453 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6454 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6455 the default.  This abstraction layer can use AT&T's sfio (if you already
6456 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6457 problems with some extension modules.  Using PerlIO with stdio is safe,
6458 but it is slower than plain stdio and therefore is not the default.
6459
6460 If this doesn't make any sense to you, just accept the default 'n'.
6461 EOM
6462 case "$useperlio" in
6463 $define|true|[yY]*)     dflt='y';;
6464 *) dflt='n';;
6465 esac
6466 rp='Use the experimental PerlIO abstraction layer?'
6467 . ./myread
6468 case "$ans" in
6469 y|Y) 
6470         val="$define"
6471         ;;     
6472 *)      
6473         echo "Ok, doing things the stdio way"
6474         val="$undef"
6475         ;;
6476 esac
6477 set useperlio
6478 eval $setvar 
6479
6480 : Check how to convert floats to strings.
6481 if test "X$d_Gconvert" = X; then
6482         echo " "
6483         echo "Checking for an efficient way to convert floats to strings."
6484         $cat >try.c <<'EOP'
6485 #ifdef TRY_gconvert
6486 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6487 char *myname = "gconvert";
6488 #endif
6489 #ifdef TRY_gcvt
6490 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6491 char *myname = "gcvt";
6492 #endif
6493 #ifdef TRY_sprintf
6494 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6495 char *myname = "sprintf";
6496 #endif
6497
6498 #include <stdio.h>
6499
6500 int
6501 checkit(expect, got)
6502 char *expect;
6503 char *got;
6504 {
6505     if (strcmp(expect, got)) {
6506                 printf("%s oddity:  Expected %s, got %s\n",
6507                         myname, expect, got);
6508                 exit(1);
6509         }
6510 }
6511
6512 int main()
6513
6514         char buf[64]; 
6515         buf[63] = '\0';
6516
6517         /* This must be 1st test on (which?) platform */
6518         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6519         Gconvert(0.1, 8, 0, buf);
6520         checkit("0.1", buf);
6521
6522         Gconvert(1.0, 8, 0, buf); 
6523         checkit("1", buf);
6524
6525         Gconvert(0.0, 8, 0, buf); 
6526         checkit("0", buf);
6527
6528         Gconvert(-1.0, 8, 0, buf); 
6529         checkit("-1", buf);
6530
6531         /* Some Linux gcvt's give 1.e+5 here. */
6532         Gconvert(100000.0, 8, 0, buf); 
6533         checkit("100000", buf);
6534         
6535         /* Some Linux gcvt's give -1.e+5 here. */
6536         Gconvert(-100000.0, 8, 0, buf); 
6537         checkit("-100000", buf);
6538
6539         exit(0);
6540 }
6541 EOP
6542         case "$d_Gconvert" in
6543         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6544         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6545         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6546         *) xxx_list='gconvert gcvt sprintf' ;;
6547         esac
6548
6549         for xxx_convert in $xxx_list; do
6550                 echo "Trying $xxx_convert"
6551                 $rm -f try try$_o
6552                 set try -DTRY_$xxx_convert
6553                 if eval $compile; then
6554                         echo "$xxx_convert" found. >&4
6555                         if ./try; then
6556                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6557                                 break;
6558                         else
6559                                 echo "...But $xxx_convert didn't work as I expected."
6560                         fi
6561                 else
6562                         echo "$xxx_convert NOT found." >&4
6563                 fi
6564         done
6565                 
6566         case "$xxx_convert" in
6567         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6568         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6569         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6570         esac
6571 fi
6572
6573 : see if inttypes.h is available
6574 : we want a real compile instead of Inhdr because some systems
6575 : have an inttypes.h which includes non-existent headers
6576 echo " "
6577 $cat >try.c <<EOCP
6578 #include <inttypes.h>
6579 int main() {
6580         static int32_t foo32 = 0x12345678;
6581 }
6582 EOCP
6583 set try
6584 if eval $compile; then
6585         echo "<inttypes.h> found." >&4
6586         val="$define"
6587 else
6588         echo "<inttypes.h> NOT found." >&4
6589         val="$undef"
6590 fi
6591 $rm -f try.c try
6592 set i_inttypes
6593 eval $setvar
6594
6595 : check for int64_t
6596 case "$use64bits" in
6597 "$define" )
6598         echo " "
6599         echo $n "Checking to see if your system supports int64_t...$c" >&4
6600         $cat >try.c <<EOCP
6601 #include <sys/types.h>
6602 #$i_inttypes I_INTTYPES
6603 #ifdef I_INTTYPES
6604 #include <inttypes.h>
6605 #endif
6606 int64_t foo() { int64_t x; x = 7; return x; }
6607 EOCP
6608         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6609                 val="$define"
6610                 echo " Yup, it does." >&4
6611         else
6612                 val="$undef"
6613                 echo " Nope, it doesn't." >&4
6614         fi
6615         $rm -f try.*
6616         ;;
6617 *)      val="$undef"
6618         ;;
6619 esac
6620 set d_int64t
6621 eval $setvar
6622
6623
6624 : check for lengths of integral types
6625 echo " "
6626 case "$intsize" in
6627 '')
6628         echo "Checking to see how big your integers are..." >&4
6629         $cat >intsize.c <<'EOCP'
6630 #include <stdio.h>
6631 int main()
6632 {
6633         printf("intsize=%d;\n", sizeof(int));
6634         printf("longsize=%d;\n", sizeof(long));
6635         printf("shortsize=%d;\n", sizeof(short));
6636         exit(0);
6637 }
6638 EOCP
6639         set intsize
6640         if eval $compile_ok && ./intsize > /dev/null; then
6641                 eval `./intsize`
6642                 echo "Your integers are $intsize bytes long."
6643                 echo "Your long integers are $longsize bytes long."
6644                 echo "Your short integers are $shortsize bytes long."
6645         else
6646                 $cat >&4 <<EOM
6647 !
6648 Help! I can't compile and run the intsize test program: please enlighten me!
6649 (This is probably a misconfiguration in your system or libraries, and
6650 you really ought to fix it.  Still, I'll try anyway.)
6651 !
6652 EOM
6653                 dflt=4
6654                 rp="What is the size of an integer (in bytes)?"
6655                 . ./myread
6656                 intsize="$ans"
6657                 dflt=$intsize
6658                 rp="What is the size of a long integer (in bytes)?"
6659                 . ./myread
6660                 longsize="$ans"
6661                 dflt=2
6662                 rp="What is the size of a short integer (in bytes)?"
6663                 . ./myread
6664                 shortsize="$ans"
6665         fi
6666         ;;
6667 esac
6668 $rm -f intsize intsize.*
6669
6670 : check for long long
6671 echo " "
6672 echo $n "Checking to see if your system supports long long...$c" >&4
6673 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6674 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6675         val="$define"
6676         echo " Yup, it does." >&4
6677 else
6678         val="$undef"
6679         echo " Nope, it doesn't." >&4
6680 fi
6681 $rm try.*
6682 set d_longlong
6683 eval $setvar
6684
6685 : check for length of long long
6686 case "${d_longlong}${longlongsize}" in
6687 $define)
6688         echo " "
6689         $echo $n "Checking to see how big your long longs are...$c" >&4
6690         $cat >try.c <<'EOCP'
6691 #include <stdio.h>
6692 int main()
6693 {
6694         printf("%d\n", sizeof(long long));
6695 }
6696 EOCP
6697         set try
6698         if eval $compile_ok; then
6699                 longlongsize=`./try`
6700                 $echo " $longlongsize bytes." >&4
6701         else
6702                 dflt='8'
6703                 echo " "
6704                 echo "(I can't seem to compile the test program.  Guessing...)"
6705                 rp="What is the size of a long long (in bytes)?"
6706                 . ./myread
6707                 longlongsize="$ans"
6708         fi
6709         if $test "X$longsize" = "X$longlongsize"; then
6710                 echo "(That isn't any different from an ordinary long.)"
6711         fi      
6712         ;;
6713 esac
6714 $rm -f try.c try
6715
6716 echo " "
6717
6718 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6719
6720 echo "Checking how to print 64-bit integers..." >&4
6721
6722 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6723         quad=int
6724         $cat >try.c <<'EOCP'
6725 #include <sys/types.h>
6726 #include <stdio.h>
6727 int main() {
6728   int q = 12345678901;
6729   printf("%ld\n", q);
6730 }
6731 EOCP
6732         set try
6733         if eval $compile; then
6734                 yyy=`./try$exe_ext`
6735                 case "$yyy" in
6736                 12345678901)
6737                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6738                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6739                         echo "We will use %d."
6740                         ;;
6741                 esac
6742         fi
6743 fi
6744
6745 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6746         quad=long
6747         $cat >try.c <<'EOCP'
6748 #include <sys/types.h>
6749 #include <stdio.h>
6750 int main() {
6751   long q = 12345678901;
6752   printf("%ld\n", q);
6753 }
6754 EOCP
6755         set try
6756         if eval $compile; then
6757                 yyy=`./try$exe_ext`
6758                 case "$yyy" in
6759                 12345678901)
6760                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6761                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6762                         echo "We will use %ld."
6763                         ;;
6764                 esac
6765         fi
6766 fi
6767
6768 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6769         quad=int64_t
6770         $cat >try.c <<'EOCP'
6771 #include <sys/types.h>
6772 #include <inttypes.h>
6773 #include <stdio.h>
6774 int main() {
6775   int64_t q = 12345678901;
6776   printf("%" PRId64 "\n", q);
6777 }
6778 EOCP
6779         set try
6780         if eval $compile; then
6781                 yyy=`./try$exe_ext`
6782                 case "$yyy" in
6783                 12345678901)
6784                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6785                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6786                         echo "We will use the C9X style."
6787                         ;;
6788                 esac
6789         fi
6790 fi
6791
6792 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6793         quad="long long"
6794         $cat >try.c <<'EOCP'
6795 #include <sys/types.h>
6796 #include <stdio.h>
6797 int main() {
6798   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6799   printf("%lld\n", q);
6800 }
6801 EOCP
6802         set try
6803         if eval $compile; then
6804                 yyy=`./try$exe_ext`
6805                 case "$yyy" in
6806                 12345678901)
6807                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6808                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6809                         echo "We will use the %lld style."
6810                         ;;
6811                 esac
6812         fi
6813 fi
6814
6815 if $test X"$sPRId64" = X -a X"$quad" != X; then
6816         $cat >try.c <<EOCP
6817 #include <sys/types.h>
6818 #include <stdio.h>
6819 int main() {
6820   $quad q = 12345678901;
6821   printf("%Ld\n", q);
6822 }
6823 EOCP
6824         set try
6825         if eval $compile; then
6826                 yyy=`./try$exe_ext`
6827                 case "$yyy" in
6828                 12345678901)
6829                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6830                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6831                         echo "We will use %lld."
6832                         ;;
6833                 esac
6834         fi
6835 fi
6836
6837 if $test X"$sPRId64" = X -a X"$quad" != X; then
6838         $cat >try.c <<EOCP
6839 #include <sys/types.h>
6840 #include <stdio.h>
6841 int main() {
6842   $quad q = 12345678901;
6843   printf("%qd\n", q);
6844 }
6845 EOCP
6846         set try
6847         if eval $compile; then
6848                 yyy=`./try$exe_ext`
6849                 case "$yyy" in
6850                 12345678901)
6851                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6852                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6853                         echo "We will use %qd."
6854                         ;;
6855                 esac
6856         fi
6857 fi
6858
6859 if $test X"$sPRId64" = X; then
6860         echo "Cannot figure out how to print 64-bit integers." >&4
6861 fi
6862
6863 $rm -f try try.*
6864
6865 fi # intsize -o longsize -o d_int64t -o d_longlong
6866
6867 case "$sPRId64" in
6868 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
6869         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
6870         ;;
6871 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
6872         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
6873         ;;
6874 esac
6875
6876 : check for length of double
6877 echo " "
6878 case "$doublesize" in
6879 '')
6880         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
6881         $cat >try.c <<'EOCP'
6882 #include <stdio.h>
6883 int main()
6884 {
6885         printf("%d\n", sizeof(double));
6886 }
6887 EOCP
6888         set try
6889         if eval $compile_ok; then
6890                 doublesize=`./try`
6891                 $echo " $doublesize bytes." >&4
6892         else
6893                 dflt='8'
6894                 echo "(I can't seem to compile the test program.  Guessing...)"
6895                 rp="What is the size of a double precision number (in bytes)?"
6896                 . ./myread
6897                 doublesize="$ans"
6898         fi
6899         ;;
6900 esac
6901 $rm -f try.c try
6902
6903 : check for long doubles
6904 echo " "
6905 echo $n "Checking to see if your system supports long doubles...$c" >&4
6906 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
6907 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6908         val="$define"
6909         echo " Yup, it does." >&4
6910 else
6911         val="$undef"
6912         echo " Nope, it doesn't." >&4
6913 fi
6914 $rm try.*
6915 set d_longdbl
6916 eval $setvar
6917
6918 : check for length of long double
6919 case "${d_longdbl}${longdblsize}" in
6920 $define)
6921         echo " "
6922         $echo $n "Checking to see how big your long doubles are...$c" >&4
6923         $cat >try.c <<'EOCP'
6924 #include <stdio.h>
6925 int main()
6926 {
6927         printf("%d\n", sizeof(long double));
6928 }
6929 EOCP
6930         set try
6931         if eval $compile; then
6932                 longdblsize=`./try`
6933                 $echo " $longdblsize bytes." >&4
6934         else
6935                 dflt='8'
6936                 echo " "
6937                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6938                 rp="What is the size of a long double (in bytes)?"
6939                 . ./myread
6940                 longdblsize="$ans"
6941         fi
6942         if $test "X$doublesize" = "X$longdblsize"; then
6943                 echo "(That isn't any different from an ordinary double.)"
6944         fi      
6945         ;;
6946 esac
6947 $rm -f try.c try
6948
6949 echo " "
6950
6951 if $test X"$d_longdbl" = X"$define"; then
6952
6953 echo "Checking how to print long doubles..." >&4
6954
6955 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6956         $cat >try.c <<'EOCP'
6957 #include <sys/types.h>
6958 #include <stdio.h>
6959 int main() {
6960   double d = 123.456;
6961   printf("%.3f\n", d);
6962 }
6963 EOCP
6964         set try
6965         if eval $compile; then
6966                 yyy=`./try$exe_ext`
6967                 case "$yyy" in
6968                 123.456)
6969                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6970                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
6971                         echo "We will use %f."
6972                         ;;
6973                 esac
6974         fi
6975 fi
6976
6977 if $test X"$sPRIfldbl" = X; then
6978         $cat >try.c <<'EOCP'
6979 #include <sys/types.h>
6980 #include <stdio.h>
6981 int main() {
6982   long double d = 123.456;
6983   printf("%.3llf\n", d);
6984 }
6985 EOCP
6986         set try
6987         if eval $compile; then
6988                 yyy=`./try$exe_ext`
6989                 case "$yyy" in
6990                 123.456)
6991                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6992                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
6993                         echo "We will use %llf."
6994                         ;;
6995                 esac
6996         fi
6997 fi
6998
6999 if $test X"$sPRIfldbl" = X; then
7000         echo "Cannot figure out how to print long doubles." >&4
7001 fi
7002
7003 if $test X"$sPRIfldbl" = X; then
7004         $cat >try.c <<'EOCP'
7005 #include <sys/types.h>
7006 #include <stdio.h>
7007 int main() {
7008   long double d = 123.456;
7009   printf("%.3Lf\n", d);
7010 }
7011 EOCP
7012         set try
7013         if eval $compile; then
7014                 yyy=`./try$exe_ext`
7015                 case "$yyy" in
7016                 123.456)
7017                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7018                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7019                         echo "We will use %Lf."
7020                         ;;
7021                 esac
7022         fi
7023 fi
7024
7025 if $test X"$sPRIfldbl" = X; then
7026         $cat >try.c <<'EOCP'
7027 #include <sys/types.h>
7028 #include <stdio.h>
7029 int main() {
7030   long double d = 123.456;
7031   printf("%.3lf\n", d);
7032 }
7033 EOCP
7034         set try
7035         if eval $compile; then
7036                 yyy=`./try$exe_ext`
7037                 case "$yyy" in
7038                 123.456)
7039                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7040                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7041                         echo "We will use %lf."
7042                         ;;
7043                 esac
7044         fi
7045 fi
7046
7047 $rm -f try try.*
7048
7049 fi # d_longdbl
7050
7051 case "$sPRIfldbl" in
7052 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7053         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7054         ;;
7055 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7056         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7057         ;;
7058 esac
7059
7060 : Initialize h_fcntl
7061 h_fcntl=false
7062
7063 : Initialize h_sysfile
7064 h_sysfile=false
7065
7066 : access call always available on UNIX
7067 set access d_access
7068 eval $inlibc
7069
7070 : locate the flags for 'access()'
7071 case "$d_access" in
7072 "$define")
7073         echo " "
7074         $cat >access.c <<'EOCP'
7075 #include <sys/types.h>
7076 #ifdef I_FCNTL
7077 #include <fcntl.h>
7078 #endif
7079 #ifdef I_SYS_FILE
7080 #include <sys/file.h>
7081 #endif
7082 #ifdef I_UNISTD
7083 #include <unistd.h>
7084 #endif
7085 int main() {
7086         exit(R_OK);
7087 }
7088 EOCP
7089         : check sys/file.h first, no particular reason here
7090         if $test `./findhdr sys/file.h` && \
7091                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7092                 h_sysfile=true;
7093                 echo "<sys/file.h> defines the *_OK access constants." >&4
7094         elif $test `./findhdr fcntl.h` && \
7095                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7096                 h_fcntl=true;
7097                 echo "<fcntl.h> defines the *_OK access constants." >&4
7098         elif $test `./findhdr unistd.h` && \
7099                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7100                 echo "<unistd.h> defines the *_OK access constants." >&4
7101         else
7102                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7103         fi
7104         ;;
7105 esac
7106 $rm -f access*
7107
7108 : see if accessx exists
7109 set accessx d_accessx
7110 eval $inlibc
7111
7112 : see if alarm exists
7113 set alarm d_alarm
7114 eval $inlibc
7115
7116 : see if atolf exists
7117 set atolf d_atolf
7118 eval $inlibc
7119
7120 : see if atoll exists
7121 set atoll d_atoll
7122 eval $inlibc
7123
7124 : Look for GNU-cc style attribute checking
7125 echo " "
7126 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7127 $cat >attrib.c <<'EOCP'
7128 #include <stdio.h>
7129 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7130 EOCP
7131 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7132         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7133                 echo "Your C compiler doesn't fully support __attribute__."
7134                 val="$undef"
7135         else
7136                 echo "Your C compiler supports __attribute__."
7137                 val="$define"
7138         fi
7139 else
7140         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7141         val="$undef"
7142 fi
7143 set d_attribut
7144 eval $setvar
7145 $rm -f attrib*
7146
7147 : see if bcmp exists
7148 set bcmp d_bcmp
7149 eval $inlibc
7150
7151 : see if bcopy exists
7152 set bcopy d_bcopy
7153 eval $inlibc
7154
7155 : see if this is a unistd.h system
7156 set unistd.h i_unistd
7157 eval $inhdr
7158
7159 : see if getpgrp exists
7160 set getpgrp d_getpgrp
7161 eval $inlibc
7162
7163 case "$d_getpgrp" in
7164 "$define")
7165         echo " "
7166         echo "Checking to see which flavor of getpgrp is in use..."
7167         $cat >set.c <<EOP
7168 #$i_unistd I_UNISTD
7169 #include <sys/types.h>
7170 #ifdef I_UNISTD
7171 #  include <unistd.h>
7172 #endif
7173 int main()
7174 {
7175         if (getuid() == 0) {
7176                 printf("(I see you are running Configure as super-user...)\n");
7177                 setuid(1);
7178         }
7179 #ifdef TRY_BSD_PGRP
7180         if (getpgrp(1) == 0)
7181                 exit(0);
7182 #else
7183         if (getpgrp() > 0)
7184                 exit(0);
7185 #endif
7186         exit(1);
7187 }
7188 EOP
7189         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7190                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7191                 val="$define"
7192         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7193                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7194                 val="$undef"
7195         else
7196                 echo "I can't seem to compile and run the test program."
7197                 if ./usg; then
7198                         xxx="a USG one, i.e. you use getpgrp()."
7199                 else
7200                         # SVR4 systems can appear rather BSD-ish.
7201                         case "$i_unistd" in
7202                         $undef)
7203                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7204                                 val="$define"
7205                                 ;;
7206                         $define)
7207                                 xxx="probably a USG one, i.e. you use getpgrp()."
7208                                 val="$undef"
7209                                 ;;
7210                         esac
7211                 fi
7212                 echo "Assuming your getpgrp is $xxx" >&4
7213         fi
7214         ;;
7215 *) val="$undef";;
7216 esac
7217 set d_bsdgetpgrp
7218 eval $setvar
7219 $rm -f set set.c
7220
7221 : see if setpgrp exists
7222 set setpgrp d_setpgrp
7223 eval $inlibc
7224
7225 case "$d_setpgrp" in
7226 "$define")
7227         echo " "
7228         echo "Checking to see which flavor of setpgrp is in use..."
7229         $cat >set.c <<EOP
7230 #$i_unistd I_UNISTD
7231 #include <sys/types.h>
7232 #ifdef I_UNISTD
7233 #  include <unistd.h>
7234 #endif
7235 int main()
7236 {
7237         if (getuid() == 0) {
7238                 printf("(I see you are running Configure as super-user...)\n");
7239                 setuid(1);
7240         }
7241 #ifdef TRY_BSD_PGRP
7242         if (-1 == setpgrp(1, 1))
7243                 exit(0);
7244 #else
7245         if (setpgrp() != -1)
7246                 exit(0);
7247 #endif
7248         exit(1);
7249 }
7250 EOP
7251         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7252                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7253                 val="$define"
7254         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7255                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7256                 val="$undef"
7257         else
7258                 echo "(I can't seem to compile and run the test program.)"
7259                 if ./usg; then
7260                         xxx="a USG one, i.e. you use setpgrp()."
7261                 else
7262                         # SVR4 systems can appear rather BSD-ish.
7263                         case "$i_unistd" in
7264                         $undef)
7265                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7266                                 val="$define"
7267                                 ;;
7268                         $define)
7269                                 xxx="probably a USG one, i.e. you use setpgrp()."
7270                                 val="$undef"
7271                                 ;;
7272                         esac
7273                 fi
7274                 echo "Assuming your setpgrp is $xxx" >&4
7275         fi
7276         ;;
7277 *) val="$undef";;
7278 esac
7279 set d_bsdsetpgrp
7280 eval $setvar
7281 $rm -f set set.c
7282 : see if bzero exists
7283 set bzero d_bzero
7284 eval $inlibc
7285
7286 : see if signal is declared as pointer to function returning int or void
7287 echo " "
7288 xxx=`./findhdr signal.h`
7289 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7290 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7291         echo "You have int (*signal())() instead of void." >&4
7292         val="$undef"
7293 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7294         echo "You have void (*signal())()." >&4
7295         val="$define"
7296 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7297         echo "You have int (*signal())() instead of void." >&4
7298         val="$undef"
7299 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7300         echo "You have void (*signal())()." >&4
7301         val="$define"
7302 else
7303         case "$d_voidsig" in
7304         '')
7305         echo "I can't determine whether signal handler returns void or int..." >&4
7306                 dflt=void
7307                 rp="What type does your signal handler return?"
7308                 . ./myread
7309                 case "$ans" in
7310                 v*) val="$define";;
7311                 *) val="$undef";;
7312                 esac;;
7313         "$define")
7314                 echo "As you already told me, signal handler returns void." >&4
7315                 val="$define"
7316                 ;;
7317         *)      echo "As you already told me, signal handler returns int." >&4
7318                 val="$undef"
7319                 ;;
7320         esac
7321 fi
7322 set d_voidsig
7323 eval $setvar
7324 case "$d_voidsig" in
7325 "$define") signal_t="void";;
7326 *) signal_t="int";;
7327 esac
7328 $rm -f $$.tmp
7329
7330 : check for ability to cast large floats to 32-bit ints.
7331 echo " "
7332 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7333 if $test "$intsize" -ge 4; then
7334         xxx=int
7335 else
7336         xxx=long
7337 fi
7338 $cat >try.c <<EOCP
7339 #include <stdio.h>
7340 #include <sys/types.h>
7341 #include <signal.h>
7342 $signal_t blech(s) int s; { exit(3); }
7343 int main()
7344 {
7345         $xxx i32;
7346         double f, g;
7347         int result = 0;
7348         char str[16];
7349         signal(SIGFPE, blech);
7350
7351         /* Don't let compiler optimize the test away.  Store the number 
7352            in a writable string for gcc to pass to sscanf under HP/UX.
7353         */
7354         sprintf(str, "2147483647");
7355         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7356         g = 10 * f;
7357         i32  = ($xxx) g;
7358
7359         /* x86 processors will probably give 0x8000 0000, which is a
7360        sign change.  We don't want that.  We want to mimic SPARC
7361            behavior here, which is to preserve the sign and give
7362            back 0x7fff ffff.
7363         */
7364         if (i32 != ($xxx) f)
7365                 result |= 1;
7366         exit(result);
7367 }
7368 EOCP
7369 set try
7370 if eval $compile_ok; then
7371         ./try
7372         yyy=$?
7373 else
7374         echo "(I can't seem to compile the test program--assuming it can't)"
7375         yyy=1
7376 fi
7377 case "$yyy" in
7378 0)      val="$define"
7379         echo "Yup, it can."
7380         ;;
7381 *)      val="$undef"
7382         echo "Nope, it can't."
7383         ;;
7384 esac
7385 set d_casti32
7386 eval $setvar
7387 $rm -f try try.*
7388
7389 : check for ability to cast negative floats to unsigned
7390 echo " "
7391 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7392 $cat >try.c <<EOCP
7393 #include <stdio.h>
7394 #include <sys/types.h>
7395 #include <signal.h>
7396 $signal_t blech(s) int s; { exit(7); }
7397 $signal_t blech_in_list(s) int s; { exit(4); }
7398 unsigned long dummy_long(p) unsigned long p; { return p; }
7399 unsigned int dummy_int(p) unsigned int p; { return p; }
7400 unsigned short dummy_short(p) unsigned short p; { return p; }
7401 int main()
7402 {
7403         double f;
7404         unsigned long along;
7405         unsigned int aint;
7406         unsigned short ashort;
7407         int result = 0;
7408         char str[16];
7409         
7410         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7411            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7412            optimized the whole file away
7413         */
7414         /* Store the number in a writable string for gcc to pass to 
7415            sscanf under HP/UX.
7416         */
7417         sprintf(str, "-123");
7418         sscanf(str, "%lf", &f);  /* f = -123.; */
7419
7420         signal(SIGFPE, blech);
7421         along = (unsigned long)f;
7422         aint = (unsigned int)f;
7423         ashort = (unsigned short)f;
7424         if (along != (unsigned long)-123)
7425                 result |= 1;
7426         if (aint != (unsigned int)-123)
7427                 result |= 1;
7428         if (ashort != (unsigned short)-123)
7429                 result |= 1;
7430         sprintf(str, "1073741824.");
7431         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7432         f = f + f;
7433         along = 0;
7434         along = (unsigned long)f;
7435         if (along != 0x80000000)
7436                 result |= 2;
7437         f -= 1.;
7438         along = 0;
7439         along = (unsigned long)f;
7440         if (along != 0x7fffffff)
7441                 result |= 1;
7442         f += 2.;
7443         along = 0;
7444         along = (unsigned long)f;
7445         if (along != 0x80000001)
7446                 result |= 2;
7447         if (result)
7448                 exit(result);
7449         signal(SIGFPE, blech_in_list);
7450         sprintf(str, "123.");
7451         sscanf(str, "%lf", &f);  /* f = 123.; */
7452         along = dummy_long((unsigned long)f);
7453         aint = dummy_int((unsigned int)f);
7454         ashort = dummy_short((unsigned short)f);
7455         if (along != (unsigned long)123)
7456                 result |= 4;
7457         if (aint != (unsigned int)123)
7458                 result |= 4;
7459         if (ashort != (unsigned short)123)
7460                 result |= 4;
7461         exit(result);
7462
7463 }
7464 EOCP
7465 set try
7466 if eval $compile_ok; then
7467         ./try
7468         castflags=$?
7469 else
7470         echo "(I can't seem to compile the test program--assuming it can't)"
7471         castflags=7
7472 fi
7473 case "$castflags" in
7474 0)      val="$define"
7475         echo "Yup, it can."
7476         ;;
7477 *)      val="$undef"
7478         echo "Nope, it can't."
7479         ;;
7480 esac
7481 set d_castneg
7482 eval $setvar
7483 $rm -f try.*
7484
7485 : see if vprintf exists
7486 echo " "
7487 if set vprintf val -f d_vprintf; eval $csym; $val; then
7488         echo 'vprintf() found.' >&4
7489         val="$define"
7490         $cat >vprintf.c <<'EOF'
7491 #include <varargs.h>
7492
7493 int main() { xxx("foo"); }
7494
7495 xxx(va_alist)
7496 va_dcl
7497 {
7498         va_list args;
7499         char buf[10];
7500
7501         va_start(args);
7502         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7503 }
7504 EOF
7505         set vprintf
7506         if eval $compile && ./vprintf; then
7507                 echo "Your vsprintf() returns (int)." >&4
7508                 val2="$undef"
7509         else
7510                 echo "Your vsprintf() returns (char*)." >&4
7511                 val2="$define"
7512         fi
7513 else
7514         echo 'vprintf() NOT found.' >&4
7515                 val="$undef"
7516                 val2="$undef"
7517 fi
7518 set d_vprintf
7519 eval $setvar
7520 val=$val2
7521 set d_charvspr
7522 eval $setvar
7523
7524 : see if chown exists
7525 set chown d_chown
7526 eval $inlibc
7527
7528 : see if chroot exists
7529 set chroot d_chroot
7530 eval $inlibc
7531
7532 : see if chsize exists
7533 set chsize d_chsize
7534 eval $inlibc
7535
7536 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7537 while $test $# -ge 2; do
7538         case "$1" in
7539         $define) echo "#include <$2>";;
7540         esac ;
7541     shift 2;
7542 done > try.c;
7543 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7544 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7545         val="$define";
7546 else
7547         val="$undef";
7548 fi;
7549 set $varname;
7550 eval $setvar;
7551 $rm -f try.c try.o'
7552
7553 : see if this is a sys/uio.h system
7554 set sys/uio.h i_sysuio
7555 eval $inhdr
7556
7557 echo "Checking to see if your system supports struct iovec..." >&4
7558 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7559 eval $hasfield
7560 case "$d_iovec_s" in
7561 "$define")      echo "Yup, it does." >&4
7562                 ;;
7563 *)              echo "Nope, it doesn't." >&4
7564                 ;;
7565 esac
7566
7567 socketlib=''
7568 sockethdr=''
7569 : see whether socket exists
7570 echo " "
7571 $echo $n "Hmm... $c" >&4
7572 if set socket val -f d_socket; eval $csym; $val; then
7573         echo "Looks like you have Berkeley networking support." >&4
7574         d_socket="$define"
7575         if set setsockopt val -f; eval $csym; $val; then
7576                 d_oldsock="$undef"
7577         else
7578                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7579                 d_oldsock="$define"
7580         fi
7581 else
7582         if $contains socklib libc.list >/dev/null 2>&1; then
7583                 echo "Looks like you have Berkeley networking support." >&4
7584                 d_socket="$define"
7585                 : we will have to assume that it supports the 4.2 BSD interface
7586                 d_oldsock="$undef"
7587         else
7588                 echo "You don't have Berkeley networking in libc$_a..." >&4
7589                 if test "X$d_socket" = "X$define"; then
7590                    echo "...but you seem to believe that you have sockets." >&4
7591                 else
7592                         for net in net socket
7593                         do
7594                                 if test -f /usr/lib/lib$net$_a; then
7595                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7596                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7597                                         if $contains socket libc.list >/dev/null 2>&1; then
7598                                                 d_socket="$define"
7599                                                 socketlib="-l$net"
7600                                                 case "$net" in
7601                                                 net)
7602                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7603                                                         sockethdr="-I/usr/netinclude"
7604                                                         ;;
7605                                                 esac
7606                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7607                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7608                                                         d_oldsock="$undef"
7609                                                 else
7610                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7611                                                         d_oldsock="$define"
7612                                                 fi
7613                                                 break
7614                                         fi
7615                                 fi
7616                         done
7617                         if test "X$d_socket" != "X$define"; then
7618                            echo "or anywhere else I see." >&4
7619                            d_socket="$undef"
7620                            d_oldsock="$undef"
7621                         fi
7622                 fi
7623         fi
7624 fi
7625
7626 : see if socketpair exists
7627 set socketpair d_sockpair
7628 eval $inlibc
7629
7630
7631 echo " "
7632 echo "Checking the availability of certain socket constants..." >& 4
7633 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7634         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7635         $cat >try.c <<EOF
7636 #include <sys/types.h>
7637 #include <sys/socket.h>
7638 int main() {
7639     int i = $ENUM;
7640 }
7641 EOF
7642         val="$undef"
7643         set try; if eval $compile; then
7644                 val="$define"
7645         fi
7646         set d_${enum}; eval $setvar
7647         $rm -f try.c try
7648 done
7649
7650 set sendmsg d_sendmsg
7651 eval $inlibc
7652
7653 set recvmsg d_recvmsg
7654 eval $inlibc
7655
7656 echo " "
7657 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7658 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7659 eval $hasfield
7660 case "$d_msghdr_s" in
7661 "$define")      echo "Yup, it does." >&4
7662                 ;;
7663 *)              echo "Nope, it doesn't." >&4
7664                 ;;
7665 esac
7666
7667 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7668 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7669 eval $hasfield
7670 case "$d_cmsghdr_s" in
7671 "$define")      echo "Yup, it does." >&4
7672                 ;;
7673 *)              echo "Nope, it doesn't." >&4
7674                 ;;
7675 esac
7676
7677 : check for const keyword
7678 echo " "
7679 echo 'Checking to see if your C compiler knows about "const"...' >&4
7680 $cat >const.c <<'EOCP'
7681 typedef struct spug { int drokk; } spug;
7682 int main()
7683 {
7684         const char *foo;
7685         const spug y;
7686 }
7687 EOCP
7688 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7689         val="$define"
7690         echo "Yup, it does."
7691 else
7692         val="$undef"
7693         echo "Nope, it doesn't."
7694 fi
7695 set d_const
7696 eval $setvar
7697
7698 : see if crypt exists
7699 echo " "
7700 if set crypt val -f d_crypt; eval $csym; $val; then
7701         echo 'crypt() found.' >&4
7702         val="$define"
7703         cryptlib=''
7704 else
7705         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7706         if $test -z "$cryptlib"; then
7707                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7708         else
7709                 cryptlib=-lcrypt
7710         fi
7711         if $test -z "$cryptlib"; then
7712                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7713         else
7714                 cryptlib=-lcrypt
7715         fi
7716         if $test -z "$cryptlib"; then
7717                 cryptlib=`./loc libcrypt$_a "" $libpth`
7718         else
7719                 cryptlib=-lcrypt
7720         fi
7721         if $test -z "$cryptlib"; then
7722                 echo 'crypt() NOT found.' >&4
7723                 val="$undef"
7724         else
7725                 val="$define"
7726         fi
7727 fi
7728 set d_crypt
7729 eval $setvar
7730
7731 : get csh whereabouts
7732 case "$csh" in
7733 'csh') val="$undef" ;;
7734 *) val="$define" ;;
7735 esac
7736 set d_csh
7737 eval $setvar
7738 : Respect a hint or command line value for full_csh.
7739 case "$full_csh" in
7740 '') full_csh=$csh ;;
7741 esac
7742
7743 : see if cuserid exists
7744 set cuserid d_cuserid
7745 eval $inlibc
7746
7747 : see if this is a limits.h system
7748 set limits.h i_limits
7749 eval $inhdr
7750
7751 : see if this is a float.h system
7752 set float.h i_float
7753 eval $inhdr
7754
7755 : See if number of significant digits in a double precision number is known
7756 echo " "
7757 $cat >dbl_dig.c <<EOM
7758 #$i_limits I_LIMITS
7759 #$i_float I_FLOAT
7760 #ifdef I_LIMITS
7761 #include <limits.h>
7762 #endif
7763 #ifdef I_FLOAT
7764 #include <float.h>
7765 #endif
7766 #ifdef DBL_DIG
7767 printf("Contains DBL_DIG");
7768 #endif
7769 EOM
7770 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7771 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7772         echo "DBL_DIG found." >&4
7773         val="$define"
7774 else
7775         echo "DBL_DIG NOT found." >&4
7776         val="$undef"
7777 fi
7778 $rm -f dbl_dig.?
7779 set d_dbl_dig
7780 eval $setvar
7781
7782
7783 if $test X"$use64bits" = X"$define"; then
7784         : see if dbminit64 exists
7785         set dbminit64 d_dbminit64
7786         eval $inlibc
7787
7788         : see if dbmclose64 exists
7789         set dbmclose64 d_dbmclose64
7790         eval $inlibc
7791
7792         : see if fetch64 exists
7793         set fetch64 d_fetch64
7794         eval $inlibc
7795
7796         : see if store64 exists
7797         set store64 d_store64
7798         eval $inlibc
7799
7800         : see if delete64 exists
7801         set delete64 d_delete64
7802         eval $inlibc
7803
7804         : see if firstkey64 exists
7805         set firstkey64 d_firstkey64
7806         eval $inlibc
7807
7808         : see if nextkey64 exists
7809         set nextkey64 d_nextkey64
7810         eval $inlibc
7811 else
7812         val="$undef"
7813         for xxx in d_dbminit64 d_dbmclose64 d_fetch64 d_store64 d_delete64 d_firstkey64 d_nextkey64
7814         do
7815                 set $xxx
7816                 eval $setvar
7817         done
7818 fi
7819
7820 : see if difftime exists
7821 set difftime d_difftime
7822 eval $inlibc
7823
7824 : see if sys/stat.h is available
7825 set sys/stat.h i_sysstat
7826 eval $inhdr
7827
7828 : see if this is a dirent system
7829 echo " "
7830 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7831         val="$define"
7832         echo "<dirent.h> found." >&4
7833 else
7834         val="$undef"
7835         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7836                 echo "<sys/dir.h> found." >&4
7837                 echo " "
7838         else
7839                 xinc=`./findhdr sys/ndir.h`
7840         fi
7841         echo "<dirent.h> NOT found." >&4
7842 fi
7843 set i_dirent
7844 eval $setvar
7845
7846 : Look for type of directory structure.
7847 echo " "
7848 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7849
7850 case "$direntrytype" in
7851 ''|' ')
7852         case "$i_dirent" in
7853         $define) guess1='struct dirent' ;;
7854         *) guess1='struct direct'  ;;
7855         esac
7856         ;;
7857 *)      guess1="$direntrytype"
7858         ;;
7859 esac
7860
7861 case "$guess1" in
7862 'struct dirent') guess2='struct direct' ;;
7863 *) guess2='struct dirent' ;;
7864 esac
7865                 
7866 if $contains "$guess1" try.c >/dev/null 2>&1; then
7867         direntrytype="$guess1"
7868         echo "Your directory entries are $direntrytype." >&4
7869 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7870         direntrytype="$guess2"
7871         echo "Your directory entries seem to be $direntrytype." >&4
7872 else
7873         echo "I don't recognize your system's directory entries." >&4
7874         rp="What type is used for directory entries on this system?"
7875         dflt="$guess1"
7876         . ./myread
7877         direntrytype="$ans"
7878 fi
7879 $rm -f try.c
7880
7881
7882 : see if the directory entry stores field length
7883 echo " "
7884 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7885 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7886         echo "Good, your directory entry keeps length information in d_namlen." >&4
7887         val="$define"
7888 else
7889         echo "Your directory entry does not know about the d_namlen field." >&4
7890         val="$undef"
7891 fi
7892 set d_dirnamlen
7893 eval $setvar
7894 $rm -f try.c
7895
7896
7897 if $test X"$use64bits" = X"$define"; then
7898         : see if fstat64 exists
7899         set fstat64 d_fstat64
7900         eval $inlibc
7901
7902         : see if ftruncate64 exists
7903         set ftruncate64 d_ftruncate64
7904         eval $inlibc
7905
7906         : see if lockf64 exists
7907         set lockf64 d_lockf64
7908         eval $inlibc
7909
7910         : see if llseek exists
7911         set llseek d_llseek
7912         eval $inlibc
7913
7914         : see if lseek64 exists
7915         set lseek64 d_lseek64
7916         eval $inlibc
7917
7918         : see if lstat64 exists
7919         set lstat64 d_lstat64
7920         eval $inlibc
7921
7922         : see if open64 exists
7923         set open64 d_open64
7924         eval $inlibc
7925
7926         : see if opendir64 exists
7927         set opendir64 d_opendir64
7928         eval $inlibc
7929
7930         : see if readdir64 exists
7931         set readdir64 d_readdir64
7932         eval $inlibc
7933
7934         : see if seekdir64 exists
7935         set seekdir64 d_seekdir64
7936         eval $inlibc
7937
7938         : see if stat64 exists
7939         set stat64 d_stat64
7940         eval $inlibc
7941
7942         : see if telldir64 exists
7943         set telldir64 d_telldir64
7944         eval $inlibc
7945
7946         : see if truncate64 exists
7947         set truncate64 d_truncate64
7948         eval $inlibc
7949
7950         : check for off64_t
7951         echo " "
7952         echo $n "Checking to see if your system supports off64_t...$c" >&4
7953         $cat >try.c <<EOCP
7954 #include <sys/types.h>
7955 #include <unistd.h>
7956 off64_t foo() { off64_t x; x = 7; return x; }'
7957 EOCP
7958         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7959                 val="$define"
7960                 echo " Yup, it does." >&4
7961         else
7962                 val="$undef"
7963                 echo " Nope, it doesn't." >&4
7964         fi
7965         $rm -f try.*
7966         set d_off64_t
7967         eval $setvar
7968
7969         : check for offset_t
7970         echo " "
7971         echo $n "Checking to see if your system supports offset_t...$c" >&4
7972         $cat >try.c <<EOCP
7973 #include <sys/types.h>
7974 #include <unistd.h>
7975 offset_t foo() { offset_t x; x = 7; return x; }'
7976 EOCP
7977         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7978                 val="$define"
7979                 echo " Yup, it does." >&4
7980         else
7981                 val="$undef"
7982                 echo " Nope, it doesn't." >&4
7983         fi
7984         $rm -f try.*
7985         set d_offset_t
7986         eval $setvar
7987
7988         : check for ino64_t
7989         echo " "
7990         echo $n "Checking to see if your system supports ino64_t...$c" >&4
7991         val="$undef"
7992         case "$i_sysstat" in
7993         "$define" )
7994                 $cat >try.c <<EOCP
7995 #include <sys/types.h>
7996 #include <sys/stat.h>
7997 ino64_t foo() { ino64_t x; x = 7; return x; }'
7998 EOCP
7999                 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8000                         val="$define"
8001                 fi
8002                 $rm -f try.*
8003                 ;;
8004         esac
8005         if $test "X$val" = X"$define"; then
8006                 echo " Yup, it does." >&4
8007         else
8008                 echo " Nope, it doesn't." >&4
8009         fi
8010         set d_ino64_t
8011         eval $setvar
8012
8013         : check for struct flock64
8014         echo " "
8015         echo "Checking to see if your system supports struct flock64..." >&4
8016         if $h_fcntl; then
8017                 set d_flock64_s flock64 l_len define fcntl.h
8018                 eval $hasfield
8019         else
8020                 val="$undef"
8021                 set d_flock64_s
8022                 eval $setvar
8023         fi
8024         case "$d_flock64_s" in
8025         "$define")      echo "Yup, it does." >&4
8026                         ;;
8027         *)              echo "Nope, it doesn't." >&4
8028                         ;;
8029         esac
8030
8031         : check for struct dirent64
8032         echo " "
8033         echo "Checking to see if your system supports struct dirent64..." >&4
8034         set d_dirent64_s dirent64 d_off $i_dirent dirent.h
8035         eval $hasfield
8036         case "$d_dirent64_s" in
8037         "$define")      echo "Yup, it does." >&4
8038                         ;;
8039         *)              echo "Nope, it doesn't." >&4
8040                         ;;
8041         esac
8042
8043 else
8044         val="$undef"
8045         for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64_t d_offset_t d_ino64_t d_flock64_s d_dirent64_s
8046         do
8047                 set $xxx
8048                 eval $setvar
8049         done
8050 fi
8051
8052 : see if dlerror exists
8053 xxx_runnm="$runnm"
8054 runnm=false
8055 set dlerror d_dlerror
8056 eval $inlibc
8057 runnm="$xxx_runnm"
8058
8059 : see if dlfcn is available
8060 set dlfcn.h i_dlfcn
8061 eval $inhdr
8062
8063 case "$usedl" in
8064 $define|y|true)
8065         $cat << EOM
8066
8067 On a few systems, the dynamically loaded modules that perl generates and uses
8068 will need a different extension than shared libs. The default will probably
8069 be appropriate.
8070
8071 EOM
8072         case "$dlext" in
8073         '')     dflt="$so" ;;
8074         *)      dflt="$dlext" ;;
8075         esac
8076         rp='What is the extension of dynamically loaded modules'
8077         . ./myread
8078         dlext="$ans"
8079         ;;
8080 *)
8081         dlext="none"
8082         ;;
8083 esac
8084
8085 : Check if dlsym need a leading underscore
8086 echo " "
8087 val="$undef"
8088
8089 case "$dlsrc" in
8090 dl_dlopen.xs)
8091         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8092         $cat >dyna.c <<'EOM'
8093 fred () { }
8094 EOM
8095
8096 $cat >fred.c<<EOM
8097
8098 #include <stdio.h>
8099 #$i_dlfcn I_DLFCN
8100 #ifdef I_DLFCN
8101 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8102 #else
8103 #include <sys/types.h>
8104 #include <nlist.h>
8105 #include <link.h>
8106 #endif
8107
8108 extern int fred() ;
8109
8110 int main()
8111 {
8112     void * handle ;
8113     void * symbol ;
8114 #ifndef RTLD_LAZY
8115     int mode = 1 ;
8116 #else
8117     int mode = RTLD_LAZY ;
8118 #endif
8119     handle = dlopen("./dyna.$dlext", mode) ;
8120     if (handle == NULL) {
8121         printf ("1\n") ;
8122         fflush (stdout) ;
8123         exit(0);
8124     }
8125     symbol = dlsym(handle, "fred") ;
8126     if (symbol == NULL) {
8127         /* try putting a leading underscore */
8128         symbol = dlsym(handle, "_fred") ;
8129         if (symbol == NULL) {
8130             printf ("2\n") ;
8131             fflush (stdout) ;
8132             exit(0);
8133         }
8134         printf ("3\n") ;
8135     }
8136     else
8137         printf ("4\n") ;
8138     fflush (stdout) ;
8139     exit(0);
8140 }
8141 EOM
8142         : Call the object file tmp-dyna.o in case dlext=o.
8143         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8144                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8145                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8146                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8147                 xxx=`./fred`
8148                 case $xxx in
8149                 1)      echo "Test program failed using dlopen." >&4
8150                         echo "Perhaps you should not use dynamic loading." >&4;;
8151                 2)      echo "Test program failed using dlsym." >&4
8152                         echo "Perhaps you should not use dynamic loading." >&4;;
8153                 3)      echo "dlsym needs a leading underscore" >&4
8154                         val="$define" ;;
8155                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8156                 esac
8157         else
8158                 echo "I can't compile and run the test program." >&4
8159         fi
8160         ;;
8161 esac
8162                 
8163 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8164
8165 set d_dlsymun
8166 eval $setvar
8167
8168 hasproto='varname=$1; func=$2; shift; shift;
8169 while $test $# -ge 2; do
8170         case "$1" in
8171         $define) echo "#include <$2>";;
8172         esac ;
8173     shift 2;
8174 done > try.c;
8175 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8176 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8177         echo "$func() prototype found.";
8178         val="$define";
8179 else
8180         echo "$func() prototype NOT found.";
8181         val="$undef";
8182 fi;
8183 set $varname;
8184 eval $setvar;
8185 $rm -f try.c tryout.c'
8186
8187 : see if prototype for drand48 is available
8188 echo " "
8189 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8190 eval $hasproto
8191
8192 : see if dup2 exists
8193 set dup2 d_dup2
8194 eval $inlibc
8195
8196 : see if eaccess exists
8197 set eaccess d_eaccess
8198 eval $inlibc
8199
8200 : see if endgrent exists
8201 set endgrent d_endgrent
8202 eval $inlibc
8203
8204 : see if endhostent exists
8205 set endhostent d_endhent
8206 eval $inlibc
8207
8208 : see if endnetent exists
8209 set endnetent d_endnent
8210 eval $inlibc
8211
8212 : see if endprotoent exists
8213 set endprotoent d_endpent
8214 eval $inlibc
8215
8216 : see if endpwent exists
8217 set endpwent d_endpwent
8218 eval $inlibc
8219
8220 : see if endservent exists
8221 set endservent d_endsent
8222 eval $inlibc
8223
8224 : see if endspent exists
8225 set endspent d_endspent
8226 eval $inlibc
8227
8228 : Locate the flags for 'open()'
8229 echo " "
8230 $cat >open3.c <<'EOCP'
8231 #include <sys/types.h>
8232 #ifdef I_FCNTL
8233 #include <fcntl.h>
8234 #endif
8235 #ifdef I_SYS_FILE
8236 #include <sys/file.h>
8237 #endif
8238 int main() {
8239         if(O_RDONLY);
8240 #ifdef O_TRUNC
8241         exit(0);
8242 #else
8243         exit(1);
8244 #endif
8245 }
8246 EOCP
8247 : check sys/file.h first to get FREAD on Sun
8248 if $test `./findhdr sys/file.h` && \
8249                 set open3 -DI_SYS_FILE && eval $compile; then
8250         h_sysfile=true;
8251         echo "<sys/file.h> defines the O_* constants..." >&4
8252         if ./open3; then
8253                 echo "and you have the 3 argument form of open()." >&4
8254                 val="$define"
8255         else
8256                 echo "but not the 3 argument form of open().  Oh, well." >&4
8257                 val="$undef"
8258         fi
8259 elif $test `./findhdr fcntl.h` && \
8260                 set open3 -DI_FCNTL && eval $compile; then
8261         h_fcntl=true;
8262         echo "<fcntl.h> defines the O_* constants..." >&4
8263         if ./open3; then
8264                 echo "and you have the 3 argument form of open()." >&4
8265                 val="$define"
8266         else
8267                 echo "but not the 3 argument form of open().  Oh, well." >&4
8268                 val="$undef"
8269         fi
8270 else
8271         val="$undef"
8272         echo "I can't find the O_* constant definitions!  You got problems." >&4
8273 fi
8274 set d_open3
8275 eval $setvar
8276 $rm -f open3*
8277
8278 : check for non-blocking I/O stuff
8279 case "$h_sysfile" in
8280 true) echo "#include <sys/file.h>" > head.c;;
8281 *)
8282         case "$h_fcntl" in
8283         true) echo "#include <fcntl.h>" > head.c;;
8284         *) echo "#include <sys/fcntl.h>" > head.c;;
8285         esac
8286         ;;
8287 esac
8288 echo " "
8289 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8290 case "$o_nonblock" in
8291 '')
8292         $cat head.c > try.c
8293         $cat >>try.c <<'EOCP'
8294 int main() {
8295 #ifdef O_NONBLOCK
8296         printf("O_NONBLOCK\n");
8297         exit(0);
8298 #endif
8299 #ifdef O_NDELAY
8300         printf("O_NDELAY\n");
8301         exit(0);
8302 #endif
8303 #ifdef FNDELAY
8304         printf("FNDELAY\n");
8305         exit(0);
8306 #endif
8307         exit(0);
8308 }
8309 EOCP
8310         set try
8311         if eval $compile_ok; then
8312                 o_nonblock=`./try`
8313                 case "$o_nonblock" in
8314                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8315                 *) echo "Seems like we can use $o_nonblock.";;
8316                 esac
8317         else
8318                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8319         fi
8320         ;;
8321 *) echo "Using $hint value $o_nonblock.";;
8322 esac
8323 $rm -f try try.* .out core
8324
8325 echo " "
8326 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8327 case "$eagain" in
8328 '')
8329         $cat head.c > try.c
8330         $cat >>try.c <<EOCP
8331 #include <errno.h>
8332 #include <sys/types.h>
8333 #include <signal.h>
8334 #define MY_O_NONBLOCK $o_nonblock
8335 #ifndef errno  /* XXX need better Configure test */
8336 extern int errno;
8337 #endif
8338 $signal_t blech(x) int x; { exit(3); }
8339 EOCP
8340         $cat >> try.c <<'EOCP'
8341 int main()
8342 {
8343         int pd[2];
8344         int pu[2];
8345         char buf[1];
8346         char string[100];
8347
8348         pipe(pd);       /* Down: child -> parent */
8349         pipe(pu);       /* Up: parent -> child */
8350         if (0 != fork()) {
8351                 int ret;
8352                 close(pd[1]);   /* Parent reads from pd[0] */
8353                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8354                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8355                         exit(1);
8356                 signal(SIGALRM, blech);
8357                 alarm(5);
8358                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8359                         exit(2);
8360                 sprintf(string, "%d\n", ret);
8361                 write(2, string, strlen(string));
8362                 alarm(0);
8363 #ifdef EAGAIN
8364                 if (errno == EAGAIN) {
8365                         printf("EAGAIN\n");
8366                         goto ok;
8367                 }
8368 #endif
8369 #ifdef EWOULDBLOCK
8370                 if (errno == EWOULDBLOCK)
8371                         printf("EWOULDBLOCK\n");
8372 #endif
8373         ok:
8374                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8375                 sleep(2);                               /* Give it time to close our pipe */
8376                 alarm(5);
8377                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8378                 alarm(0);
8379                 sprintf(string, "%d\n", ret);
8380                 write(3, string, strlen(string));
8381                 exit(0);
8382         }
8383
8384         close(pd[0]);                   /* We write to pd[1] */
8385         close(pu[1]);                   /* We read from pu[0] */
8386         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8387         close(pd[1]);                   /* Pipe pd is now fully closed! */
8388         exit(0);                                /* Bye bye, thank you for playing! */
8389 }
8390 EOCP
8391         set try
8392         if eval $compile_ok; then
8393                 echo "$startsh" >mtry
8394                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8395                 chmod +x mtry
8396                 ./mtry >/dev/null 2>&1
8397                 case $? in
8398                 0) eagain=`$cat try.out`;;
8399                 1) echo "Could not perform non-blocking setting!";;
8400                 2) echo "I did a successful read() for something that was not there!";;
8401                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8402                 *) echo "Something terribly wrong happened during testing.";;
8403                 esac
8404                 rd_nodata=`$cat try.ret`
8405                 echo "A read() system call with no data present returns $rd_nodata."
8406                 case "$rd_nodata" in
8407                 0|-1) ;;
8408                 *)
8409                         echo "(That's peculiar, fixing that to be -1.)"
8410                         rd_nodata=-1
8411                         ;;
8412                 esac
8413                 case "$eagain" in
8414                 '')
8415                         echo "Forcing errno EAGAIN on read() with no data available."
8416                         eagain=EAGAIN
8417                         ;;
8418                 *)
8419                         echo "Your read() sets errno to $eagain when no data is available."
8420                         ;;
8421                 esac
8422                 status=`$cat try.err`
8423                 case "$status" in
8424                 0) echo "And it correctly returns 0 to signal EOF.";;
8425                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8426                 *) echo "However, your read() returns '$status' on EOF??";;
8427                 esac
8428                 val="$define"
8429                 if test "$status" = "$rd_nodata"; then
8430                         echo "WARNING: you can't distinguish between EOF and no data!"
8431                         val="$undef"
8432                 fi
8433         else
8434                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8435                 eagain=EAGAIN
8436         fi
8437         set d_eofnblk
8438         eval $setvar
8439         ;;
8440 *)
8441         echo "Using $hint value $eagain."
8442         echo "Your read() returns $rd_nodata when no data is present."
8443         case "$d_eofnblk" in
8444         "$define") echo "And you can see EOF because read() returns 0.";;
8445         "$undef") echo "But you can't see EOF status from read() returned value.";;
8446         *)
8447                 echo "(Assuming you can't see EOF status from read anyway.)"
8448                 d_eofnblk=$undef
8449                 ;;
8450         esac
8451         ;;
8452 esac
8453 $rm -f try try.* .out core head.c mtry
8454
8455 : see if fchmod exists
8456 set fchmod d_fchmod
8457 eval $inlibc
8458
8459 : see if fchown exists
8460 set fchown d_fchown
8461 eval $inlibc
8462
8463 : see if this is an fcntl system
8464 set fcntl d_fcntl
8465 eval $inlibc
8466
8467 : see if sys/select.h has to be included
8468 set sys/select.h i_sysselct
8469 eval $inhdr
8470
8471 : see if we should include time.h, sys/time.h, or both
8472 echo " "
8473 if test "X$timeincl" = X; then
8474         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8475         $echo $n "I'm now running the test program...$c"
8476         $cat >try.c <<'EOCP'
8477 #include <sys/types.h>
8478 #ifdef I_TIME
8479 #include <time.h>
8480 #endif
8481 #ifdef I_SYSTIME
8482 #ifdef SYSTIMEKERNEL
8483 #define KERNEL
8484 #endif
8485 #include <sys/time.h>
8486 #endif
8487 #ifdef I_SYSSELECT
8488 #include <sys/select.h>
8489 #endif
8490 int main()
8491 {
8492         struct tm foo;
8493 #ifdef S_TIMEVAL
8494         struct timeval bar;
8495 #endif
8496 #ifdef S_TIMEZONE
8497         struct timezone tzp;
8498 #endif
8499         if (foo.tm_sec == foo.tm_sec)
8500                 exit(0);
8501 #ifdef S_TIMEVAL
8502         if (bar.tv_sec == bar.tv_sec)
8503                 exit(0);
8504 #endif
8505         exit(1);
8506 }
8507 EOCP
8508         flags=''
8509         for s_timezone in '-DS_TIMEZONE' ''; do
8510         sysselect=''
8511         for s_timeval in '-DS_TIMEVAL' ''; do
8512         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8513         for i_time in '' '-DI_TIME'; do
8514         for i_systime in '-DI_SYSTIME' ''; do
8515                 case "$flags" in
8516                 '') $echo $n ".$c"
8517                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8518                         if eval $compile; then
8519                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8520                                 shift
8521                                 flags="$*"
8522                                 echo " "
8523                                 $echo $n "Succeeded with $flags$c"
8524                         fi
8525                         ;;
8526                 esac
8527         done
8528         done
8529         done
8530         done
8531         done
8532         timeincl=''
8533         echo " "
8534         case "$flags" in
8535         *SYSTIMEKERNEL*) i_systimek="$define"
8536                 timeincl=`./findhdr sys/time.h`
8537                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8538         *) i_systimek="$undef";;
8539         esac
8540         case "$flags" in
8541         *I_TIME*) i_time="$define"
8542                 timeincl=`./findhdr time.h`" $timeincl"
8543                 echo "We'll include <time.h>." >&4;;
8544         *) i_time="$undef";;
8545         esac
8546         case "$flags" in
8547         *I_SYSTIME*) i_systime="$define"
8548                 timeincl=`./findhdr sys/time.h`" $timeincl"
8549                 echo "We'll include <sys/time.h>." >&4;;
8550         *) i_systime="$undef";;
8551         esac
8552         $rm -f try.c try
8553 fi
8554
8555 : check for fd_set items
8556 $cat <<EOM
8557
8558 Checking to see how well your C compiler handles fd_set and friends ...
8559 EOM
8560 $cat >fd_set.c <<EOCP
8561 #$i_systime I_SYS_TIME
8562 #$i_sysselct I_SYS_SELECT
8563 #$d_socket HAS_SOCKET
8564 #include <sys/types.h>
8565 #ifdef HAS_SOCKET
8566 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8567 #endif
8568 #ifdef I_SYS_TIME
8569 #include <sys/time.h>
8570 #endif
8571 #ifdef I_SYS_SELECT
8572 #include <sys/select.h>
8573 #endif
8574 int main() {
8575         fd_set fds;
8576
8577 #ifdef TRYBITS
8578         if(fds.fds_bits);
8579 #endif
8580
8581 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8582         exit(0);
8583 #else
8584         exit(1);
8585 #endif
8586 }
8587 EOCP
8588 set fd_set -DTRYBITS
8589 if eval $compile; then
8590         d_fds_bits="$define"
8591         d_fd_set="$define"
8592         echo "Well, your system knows about the normal fd_set typedef..." >&4
8593         if ./fd_set; then
8594                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8595                 d_fd_macros="$define"
8596         else
8597                 $cat >&4 <<'EOM'
8598 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8599 EOM
8600                 d_fd_macros="$undef"
8601         fi
8602 else
8603         $cat <<'EOM'
8604 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8605 EOM
8606         set fd_set
8607         if eval $compile; then
8608                 d_fds_bits="$undef"
8609                 d_fd_set="$define"
8610                 echo "Well, your system has some sort of fd_set available..." >&4
8611                 if ./fd_set; then
8612                         echo "and you have the normal fd_set macros." >&4
8613                         d_fd_macros="$define"
8614                 else
8615                         $cat <<'EOM'
8616 but not the normal fd_set macros!  Gross!  More work for me...
8617 EOM
8618                         d_fd_macros="$undef"
8619                 fi
8620         else
8621         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8622                 d_fd_set="$undef"
8623                 d_fds_bits="$undef"
8624                 d_fd_macros="$undef"
8625         fi
8626 fi
8627 $rm -f fd_set*
8628
8629 : see if fgetpos exists
8630 set fgetpos d_fgetpos
8631 eval $inlibc
8632
8633
8634 if $test X"$use64bits" = X"$define"; then
8635         : see if fgetpos64 exists
8636         set fgetpos64 d_fgetpos64
8637         eval $inlibc
8638
8639         : see if fopen64 exists
8640         set freopen64 d_fopen64
8641         eval $inlibc
8642
8643         : see if freopen64 exists
8644         set freopen64 d_freopen64
8645         eval $inlibc
8646
8647         : see if fseek64 exists
8648         set fseek64 d_fseek64
8649         eval $inlibc
8650
8651         : see if fseeko64 exists
8652         set fseeko64 d_fseeko64
8653         eval $inlibc
8654
8655         : see if fsetpos64 exists
8656         set fsetpos64 d_fsetpos64
8657         eval $inlibc
8658
8659         : see if ftell64 exists
8660         set ftell64 d_ftell64
8661         eval $inlibc
8662
8663         : see if ftello64 exists
8664         set ftello64 d_ftello64
8665         eval $inlibc
8666
8667         : see if tmpfile64 exists
8668         set tmpfile64 d_tmpfile64
8669         eval $inlibc
8670 else
8671         val="$undef"
8672         for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
8673         do
8674                 set $xxx
8675                 eval $setvar
8676         done
8677 fi
8678
8679 : see if flock exists
8680 set flock d_flock
8681 eval $inlibc
8682
8683 : see if fork exists
8684 set fork d_fork
8685 eval $inlibc
8686
8687 : see if pathconf exists
8688 set pathconf d_pathconf
8689 eval $inlibc
8690
8691 : see if fpathconf exists
8692 set fpathconf d_fpathconf
8693 eval $inlibc
8694
8695 : see if fseeko exists
8696 set fseeko d_fseeko
8697 eval $inlibc
8698
8699 : see if fsetpos exists
8700 set fsetpos d_fsetpos
8701 eval $inlibc
8702
8703 : see if this is a sys/param system
8704 set sys/param.h i_sysparam
8705 eval $inhdr
8706
8707 : see if this is a sys/mount.h system
8708 set sys/mount.h i_sysmount
8709 eval $inhdr
8710
8711
8712 : see if statfs exists
8713 set statfs d_statfs
8714 eval $inlibc
8715
8716 : see if fstatfs exists
8717 set fstatfs d_fstatfs
8718 eval $inlibc
8719
8720 : see if statfs knows about mount flags
8721 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8722 eval $hasfield
8723
8724
8725 : see if statvfs exists
8726 set statvfs d_statvfs
8727 eval $inlibc
8728
8729 : see if fstatvfs exists
8730 set fstatvfs d_fstatvfs
8731 eval $inlibc
8732
8733
8734 : see if ftello exists
8735 set ftello d_ftello
8736 eval $inlibc
8737
8738 : see if getgrent exists
8739 set getgrent d_getgrent
8740 eval $inlibc
8741
8742 : see if gethostbyaddr exists
8743 set gethostbyaddr d_gethbyaddr
8744 eval $inlibc
8745
8746 : see if gethostbyname exists
8747 set gethostbyname d_gethbyname
8748 eval $inlibc
8749
8750 : see if gethostent exists
8751 set gethostent d_gethent
8752 eval $inlibc
8753
8754 : see how we will look up host name
8755 echo " "
8756 call=''
8757 if set gethostname val -f d_gethname; eval $csym; $val; then
8758         echo 'gethostname() found.' >&4
8759         d_gethname="$define"
8760         call=gethostname
8761 fi
8762 if set uname val -f d_uname; eval $csym; $val; then
8763         if ./xenix; then
8764                 $cat <<'EOM'
8765 uname() was found, but you're running xenix, and older versions of xenix
8766 have a broken uname(). If you don't really know whether your xenix is old
8767 enough to have a broken system call, use the default answer.
8768
8769 EOM
8770                 dflt=y
8771                 case "$d_uname" in
8772                 "$define") dflt=n;;
8773                 esac
8774                 rp='Is your uname() broken?'
8775                 . ./myread
8776                 case "$ans" in
8777                 n*) d_uname="$define"; call=uname;;
8778                 esac
8779         else
8780                 echo 'uname() found.' >&4
8781                 d_uname="$define"
8782                 case "$call" in
8783                 '') call=uname ;;
8784                 esac
8785         fi
8786 fi
8787 case "$d_gethname" in
8788 '') d_gethname="$undef";;
8789 esac
8790 case "$d_uname" in
8791 '') d_uname="$undef";;
8792 esac
8793 case "$d_uname$d_gethname" in
8794 *define*)
8795         dflt=n
8796         cat <<EOM
8797  
8798 Every now and then someone has a $call() that lies about the hostname
8799 but can't be fixed for political or economic reasons.  If you wish, I can
8800 pretend $call() isn't there and maybe compute hostname at run-time
8801 thanks to the '$phostname' command.
8802
8803 EOM
8804         rp="Shall I ignore $call() from now on?"
8805         . ./myread
8806         case "$ans" in
8807         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8808         esac;;
8809 esac
8810 case "$phostname" in
8811 '') aphostname='';;
8812 *) case "$aphostname" in
8813         /*) ;;
8814         *) set X $phostname
8815                 shift
8816                 file=$1
8817                 shift
8818                 file=`./loc $file $file $pth`
8819                 aphostname=`echo $file $*`
8820                 ;;
8821         esac
8822         ;;
8823 esac
8824 case "$d_uname$d_gethname" in
8825 *define*) ;;
8826 *)
8827         case "$phostname" in
8828         '')
8829                 echo "There will be no way for $package to get your hostname." >&4;;
8830         *)
8831         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8832                 ;;
8833         esac;;
8834 esac
8835 case "$d_phostname" in
8836 '') d_phostname="$undef";;
8837 esac
8838
8839 : see if this is a netdb.h system
8840 set netdb.h i_netdb
8841 eval $inhdr
8842
8843 : see if prototypes for various gethostxxx netdb.h functions are available
8844 echo " "
8845 set d_gethostprotos gethostent $i_netdb netdb.h
8846 eval $hasproto
8847
8848 : see if getlogin exists
8849 set getlogin d_getlogin
8850 eval $inlibc
8851
8852 : see if getmntent exists
8853 set getmntent d_getmntent
8854 eval $inlibc
8855
8856 : see if getnetbyaddr exists
8857 set getnetbyaddr d_getnbyaddr
8858 eval $inlibc
8859
8860 : see if getnetbyname exists
8861 set getnetbyname d_getnbyname
8862 eval $inlibc
8863
8864 : see if getnetent exists
8865 set getnetent d_getnent
8866 eval $inlibc
8867
8868 : see if prototypes for various getnetxxx netdb.h functions are available
8869 echo " "
8870 set d_getnetprotos getnetent $i_netdb netdb.h
8871 eval $hasproto
8872
8873
8874 : see if getprotobyname exists
8875 set getprotobyname d_getpbyname
8876 eval $inlibc
8877
8878 : see if getprotobynumber exists
8879 set getprotobynumber d_getpbynumber
8880 eval $inlibc
8881
8882 : see if getprotoent exists
8883 set getprotoent d_getpent
8884 eval $inlibc
8885
8886 : see if getpgid exists
8887 set getpgid d_getpgid
8888 eval $inlibc
8889
8890 : see if getpgrp2 exists
8891 set getpgrp2 d_getpgrp2
8892 eval $inlibc
8893
8894 : see if getppid exists
8895 set getppid d_getppid
8896 eval $inlibc
8897
8898 : see if getpriority exists
8899 set getpriority d_getprior
8900 eval $inlibc
8901
8902 : see if prototypes for various getprotoxxx netdb.h functions are available
8903 echo " "
8904 set d_getprotoprotos getprotoent $i_netdb netdb.h
8905 eval $hasproto
8906
8907 : see if getpwent exists
8908 set getpwent d_getpwent
8909 eval $inlibc
8910
8911
8912 : see if getservbyname exists
8913 set getservbyname d_getsbyname
8914 eval $inlibc
8915
8916 : see if getservbyport exists
8917 set getservbyport d_getsbyport
8918 eval $inlibc
8919
8920 : see if getservent exists
8921 set getservent d_getsent
8922 eval $inlibc
8923
8924 : see if prototypes for various getservxxx netdb.h functions are available
8925 echo " "
8926 set d_getservprotos getservent $i_netdb netdb.h
8927 eval $hasproto
8928
8929 : see if getspent exists
8930 set getspent d_getspent
8931 eval $inlibc
8932
8933 : see if getspnam exists
8934 set getspnam d_getspnam
8935 eval $inlibc
8936
8937 : see if gettimeofday or ftime exists
8938 set gettimeofday d_gettimeod
8939 eval $inlibc
8940 case "$d_gettimeod" in
8941 "$undef")
8942         set ftime d_ftime 
8943         eval $inlibc
8944         ;;
8945 *)
8946         val="$undef"; set d_ftime; eval $setvar
8947         ;;
8948 esac
8949 case "$d_gettimeod$d_ftime" in
8950 "$undef$undef")
8951         echo " "
8952         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8953         ;;
8954 esac
8955
8956 : see if this is an grp system
8957 set grp.h i_grp
8958 eval $inhdr
8959
8960 case "$i_grp" in
8961 $define)
8962         xxx=`./findhdr grp.h`
8963         $cppstdin $cppflags $cppminus < $xxx >$$.h
8964
8965         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8966                 val="$define"
8967         else
8968                 val="$undef"
8969         fi
8970         set d_grpasswd
8971         eval $setvar
8972
8973         $rm -f $$.h
8974         ;;
8975 *)
8976         val="$undef";
8977         set d_grpasswd; eval $setvar
8978         ;;
8979 esac
8980
8981 : see if hasmntopt exists
8982 set hasmntopt d_hasmntopt
8983 eval $inlibc
8984
8985 : see if this is a netinet/in.h or sys/in.h system
8986 set netinet/in.h i_niin sys/in.h i_sysin
8987 eval $inhdr
8988
8989 : see if arpa/inet.h has to be included
8990 set arpa/inet.h i_arpainet
8991 eval $inhdr
8992
8993 : see if htonl --and friends-- exists
8994 val=''
8995 set htonl val
8996 eval $inlibc
8997
8998 : Maybe they are macros.
8999 case "$val" in
9000 $undef)
9001         $cat >htonl.c <<EOM
9002 #include <stdio.h>
9003 #include <sys/types.h>
9004 #$i_niin I_NETINET_IN
9005 #$i_sysin I_SYS_IN
9006 #$i_arpainet I_ARPA_INET
9007 #ifdef I_NETINET_IN
9008 #include <netinet/in.h>
9009 #endif
9010 #ifdef I_SYS_IN
9011 #include <sys/in.h>
9012 #endif
9013 #ifdef I_ARPA_INET
9014 #include <arpa/inet.h>
9015 #endif
9016 #ifdef htonl
9017 printf("Defined as a macro.");
9018 #endif
9019 EOM
9020         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9021         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9022                 val="$define"
9023                 echo "But it seems to be defined as a macro." >&4
9024         fi
9025         $rm -f htonl.?
9026         ;;
9027 esac
9028 set d_htonl
9029 eval $setvar
9030
9031 : see which of string.h or strings.h is needed
9032 echo " "
9033 strings=`./findhdr string.h`
9034 if $test "$strings" && $test -r "$strings"; then
9035         echo "Using <string.h> instead of <strings.h>." >&4
9036         val="$define"
9037 else
9038         val="$undef"
9039         strings=`./findhdr strings.h`
9040         if $test "$strings" && $test -r "$strings"; then
9041                 echo "Using <strings.h> instead of <string.h>." >&4
9042         else
9043                 echo "No string header found -- You'll surely have problems." >&4
9044         fi
9045 fi
9046 set i_string
9047 eval $setvar
9048 case "$i_string" in
9049 "$undef") strings=`./findhdr strings.h`;;
9050 *)        strings=`./findhdr string.h`;;
9051 esac
9052
9053 : index or strchr
9054 echo " "
9055 if set index val -f; eval $csym; $val; then
9056         if set strchr val -f d_strchr; eval $csym; $val; then
9057                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9058                         val="$define"
9059                         vali="$undef"
9060                         echo "strchr() found." >&4
9061                 else
9062                         val="$undef"
9063                         vali="$define"
9064                         echo "index() found." >&4
9065                 fi
9066         else
9067                 val="$undef"
9068                 vali="$define"
9069                 echo "index() found." >&4
9070         fi
9071 else
9072         if set strchr val -f d_strchr; eval $csym; $val; then
9073                 val="$define"
9074                 vali="$undef"
9075                 echo "strchr() found." >&4
9076         else
9077                 echo "No index() or strchr() found!" >&4
9078                 val="$undef"
9079                 vali="$undef"
9080         fi
9081 fi
9082 set d_strchr; eval $setvar
9083 val="$vali"
9084 set d_index; eval $setvar
9085
9086 : check whether inet_aton exists
9087 set inet_aton d_inetaton
9088 eval $inlibc
9089
9090 : Look for isascii
9091 echo " "
9092 $cat >isascii.c <<'EOCP'
9093 #include <stdio.h>
9094 #include <ctype.h>
9095 int main() {
9096         int c = 'A';
9097         if (isascii(c))
9098                 exit(0);
9099         else
9100                 exit(1);
9101 }
9102 EOCP
9103 set isascii
9104 if eval $compile; then
9105         echo "isascii() found." >&4
9106         val="$define"
9107 else
9108         echo "isascii() NOT found." >&4
9109         val="$undef"
9110 fi
9111 set d_isascii
9112 eval $setvar
9113 $rm -f isascii*
9114
9115 : see if killpg exists
9116 set killpg d_killpg
9117 eval $inlibc
9118
9119 : see if lchown exists
9120 echo " "
9121 $cat > try.c <<'EOCP'
9122 /* System header to define __stub macros and hopefully few prototypes,
9123     which can conflict with char lchown(); below.  */
9124 #include <assert.h>
9125 /* Override any gcc2 internal prototype to avoid an error.  */
9126 /* We use char because int might match the return type of a gcc2
9127    builtin and then its argument prototype would still apply.  */
9128 char lchown();
9129 int main() {
9130     /*  The GNU C library defines this for functions which it implements
9131         to always fail with ENOSYS.  Some functions are actually named
9132         something starting with __ and the normal name is an alias.  */
9133 #if defined (__stub_lchown) || defined (__stub___lchown)
9134 choke me
9135 #else
9136 lchown();
9137 #endif
9138 ; return 0; }
9139 EOCP
9140 set try
9141 if eval $compile; then
9142     $echo "lchown() found." >&4
9143     val="$define"
9144 else
9145     $echo "lchown() NOT found." >&4
9146     val="$undef"
9147 fi
9148 set d_lchown
9149 eval $setvar
9150
9151 : see if link exists
9152 set link d_link
9153 eval $inlibc
9154
9155 : see if localeconv exists
9156 set localeconv d_locconv
9157 eval $inlibc
9158
9159 : see if lockf exists
9160 set lockf d_lockf
9161 eval $inlibc
9162
9163 : see if lstat exists
9164 set lstat d_lstat
9165 eval $inlibc
9166
9167 : see if madvise exists
9168 set madvise d_madvise
9169 eval $inlibc
9170
9171 : see if mblen exists
9172 set mblen d_mblen
9173 eval $inlibc
9174
9175 : see if mbstowcs exists
9176 set mbstowcs d_mbstowcs
9177 eval $inlibc
9178
9179 : see if mbtowc exists
9180 set mbtowc d_mbtowc
9181 eval $inlibc
9182
9183 : see if memchr exists
9184 set memchr d_memchr
9185 eval $inlibc
9186
9187 : see if memcmp exists
9188 set memcmp d_memcmp
9189 eval $inlibc
9190
9191 : see if memcpy exists
9192 set memcpy d_memcpy
9193 eval $inlibc
9194
9195 : see if memmove exists
9196 set memmove d_memmove
9197 eval $inlibc
9198
9199 : see if memset exists
9200 set memset d_memset
9201 eval $inlibc
9202
9203 : see if mkdir exists
9204 set mkdir d_mkdir
9205 eval $inlibc
9206
9207 : see if mkfifo exists
9208 set mkfifo d_mkfifo
9209 eval $inlibc
9210
9211 : see if mktime exists
9212 set mktime d_mktime
9213 eval $inlibc
9214
9215 : see if this is a sys/mman.h system
9216 set sys/mman.h i_sysmman
9217 eval $inhdr
9218
9219 : see if mmap exists
9220 set mmap d_mmap
9221 eval $inlibc
9222 : see what shmat returns
9223 : default to something harmless
9224 mmaptype='void *'
9225 case "$i_sysmman$d_mmap" in
9226 "$define$define")
9227         $cat >mmap.c <<'END'
9228 #include <sys/mman.h>
9229 void *mmap();
9230 END
9231         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9232                 mmaptype='void *'
9233         else
9234                 mmaptype='caddr_t'
9235         fi
9236         echo "and it returns ($mmaptype)." >&4
9237         ;;
9238 esac
9239
9240
9241
9242 : see if mprotect exists
9243 set mprotect d_mprotect
9244 eval $inlibc
9245
9246 : see if msgctl exists
9247 set msgctl d_msgctl
9248 eval $inlibc
9249
9250 : see if msgget exists
9251 set msgget d_msgget
9252 eval $inlibc
9253
9254 : see if msgsnd exists
9255 set msgsnd d_msgsnd
9256 eval $inlibc
9257
9258 : see if msgrcv exists
9259 set msgrcv d_msgrcv
9260 eval $inlibc
9261
9262 : see how much of the 'msg*(2)' library is present.
9263 h_msg=true
9264 echo " "
9265 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9266 *"$undef"*) h_msg=false;;
9267 esac
9268 case "$osname" in
9269 freebsd)
9270     case "`ipcs 2>&1`" in
9271     "SVID messages"*"not configured"*)
9272         echo "Your $osname does not have the msg*(2) configured." >&4
9273         h_msg=false
9274         val="$undef"
9275         set msgctl d_msgctl
9276         eval $setvar
9277         set msgget d_msgget
9278         eval $setvar
9279         set msgsnd d_msgsnd
9280         eval $setvar
9281         set msgrcv d_msgrcv
9282         eval $setvar
9283         ;;
9284     esac
9285     ;;
9286 esac
9287 : we could also check for sys/ipc.h ...
9288 if $h_msg && $test `./findhdr sys/msg.h`; then
9289         echo "You have the full msg*(2) library." >&4
9290         val="$define"
9291 else
9292         echo "You don't have the full msg*(2) library." >&4
9293         val="$undef"
9294 fi
9295 set d_msg
9296 eval $setvar
9297
9298 : see if msync exists
9299 set msync d_msync
9300 eval $inlibc
9301
9302 : see if munmap exists
9303 set munmap d_munmap
9304 eval $inlibc
9305
9306 : see if nice exists
9307 set nice d_nice
9308 eval $inlibc
9309
9310 : see if POSIX threads are available
9311 if test "X$usethreads" = "X$define"; then
9312         set pthread.h i_pthread
9313         eval $inhdr
9314 else
9315         i_pthread="$undef"
9316 fi
9317
9318
9319
9320 : how to create joinable pthreads
9321 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9322         echo " "
9323         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9324         $cat >try.c <<'EOCP'
9325 #include <pthread.h>
9326 int main() {
9327     int detachstate = JOINABLE;
9328 }
9329 EOCP
9330         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9331         if eval $compile; then
9332                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9333                 val="$undef" # Yes, undef.
9334                 set d_old_pthread_create_joinable
9335                 eval $setvar
9336                 val=""
9337                 set old_pthread_create_joinable
9338                 eval $setvar
9339         else
9340                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9341                 if eval $compile; then
9342                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9343                         val="$define"
9344                         set d_old_pthread_create_joinable
9345                         eval $setvar
9346                         val=PTHREAD_CREATE_UNDETACHED
9347                         set old_pthread_create_joinable
9348                         eval $setvar
9349                 else            
9350                         set try -DJOINABLE=__UNDETACHED
9351                         if eval $compile; then
9352                                 echo "You seem to use __UNDETACHED." >&4
9353                                 val="$define"
9354                                 set d_old_pthread_create_joinable
9355                                 eval $setvar
9356                                 val=__UNDETACHED
9357                                 set old_pthread_create_joinable
9358                                 eval $setvar
9359                         else
9360                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9361                                 val="$define"
9362                                 set d_old_pthread_create_joinable
9363                                 eval $setvar
9364                                 val=0
9365                                 set old_pthread_create_joinable
9366                                 eval $setvar
9367                         fi
9368                 fi
9369         fi
9370         $rm -f try try.*
9371 else
9372     d_old_pthread_create_joinable="$undef"
9373     old_pthread_create_joinable=""
9374 fi
9375
9376 : see if pause exists
9377 set pause d_pause
9378 eval $inlibc
9379
9380 : see if pipe exists
9381 set pipe d_pipe
9382 eval $inlibc
9383
9384 : see if poll exists
9385 set poll d_poll
9386 eval $inlibc
9387
9388
9389 : see whether the various POSIXish _yields exist
9390 $cat >try.c <<EOP
9391 #include <pthread.h>
9392 #include <stdio.h>
9393 int main() {
9394 #ifdef SCHED_YIELD
9395         sched_yield();
9396 #else
9397 #ifdef PTHREAD_YIELD
9398         pthread_yield();
9399 #else
9400 #ifdef PTHREAD_YIELD_NULL
9401         pthread_yield(NULL);
9402 #endif
9403 #endif
9404 #endif
9405 }
9406 EOP
9407 : see if sched_yield exists
9408 set try -DSCHED_YIELD
9409 if eval $compile; then
9410     val="$define"
9411     sched_yield='sched_yield()'
9412 else
9413     val="$undef"
9414 fi
9415 case "$usethreads" in
9416 $define)
9417         case "$val" in
9418         $define) echo 'sched_yield() found.' >&4        ;;
9419         *)       echo 'sched_yield() NOT found.' >&4    ;;
9420         esac
9421 esac
9422 set d_sched_yield
9423 eval $setvar
9424
9425 : see if pthread_yield exists
9426 set try -DPTHREAD_YIELD
9427 if eval $compile; then
9428     val="$define"
9429     case "$sched_yield" in
9430     '') sched_yield='pthread_yield()' ;;
9431     esac
9432 else
9433     set try -DPTHREAD_YIELD_NULL
9434     if eval $compile; then
9435         val="$define"
9436         case "$sched_yield" in
9437         '') sched_yield='pthread_yield(NULL)' ;;
9438         esac
9439     else
9440         val="$undef"
9441     fi
9442 fi
9443 case "$usethreads" in
9444 $define)
9445         case "$val" in
9446         $define) echo 'pthread_yield() found.' >&4      ;;
9447         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9448         esac
9449         ;;
9450 esac
9451 set d_pthread_yield
9452 eval $setvar
9453
9454 case "$sched_yield" in
9455 '') sched_yield=undef ;;
9456 esac
9457
9458 $rm -f try try.*
9459
9460 : see if this is a pwd.h system
9461 set pwd.h i_pwd
9462 eval $inhdr
9463
9464 case "$i_pwd" in
9465 $define)
9466         xxx=`./findhdr pwd.h`
9467         $cppstdin $cppflags $cppminus < $xxx >$$.h
9468
9469         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9470                 val="$define"
9471         else
9472                 val="$undef"
9473         fi
9474         set d_pwquota
9475         eval $setvar
9476
9477         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9478                 val="$define"
9479         else
9480                 val="$undef"
9481         fi
9482         set d_pwage
9483         eval $setvar
9484
9485         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9486                 val="$define"
9487         else
9488                 val="$undef"
9489         fi
9490         set d_pwchange
9491         eval $setvar
9492
9493         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9494                 val="$define"
9495         else
9496                 val="$undef"
9497         fi
9498         set d_pwclass
9499         eval $setvar
9500
9501         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9502                 val="$define"
9503         else
9504                 val="$undef"
9505         fi
9506         set d_pwexpire
9507         eval $setvar
9508
9509         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9510                 val="$define"
9511         else
9512                 val="$undef"
9513         fi
9514         set d_pwcomment
9515         eval $setvar
9516
9517         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9518                 val="$define"
9519         else
9520                 val="$undef"
9521         fi
9522         set d_pwgecos
9523         eval $setvar
9524
9525         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9526                 val="$define"
9527         else
9528                 val="$undef"
9529         fi
9530         set d_pwpasswd
9531         eval $setvar
9532
9533         $rm -f $$.h
9534         ;;
9535 *)
9536         val="$undef"; 
9537         set d_pwquota; eval $setvar
9538         set d_pwage; eval $setvar
9539         set d_pwchange; eval $setvar
9540         set d_pwclass; eval $setvar
9541         set d_pwexpire; eval $setvar
9542         set d_pwcomment; eval $setvar
9543         set d_pwgecos; eval $setvar
9544         set d_pwpasswd; eval $setvar
9545         ;;
9546 esac
9547
9548 : see if readdir and friends exist
9549 set readdir d_readdir
9550 eval $inlibc
9551 set seekdir d_seekdir
9552 eval $inlibc
9553 set telldir d_telldir
9554 eval $inlibc
9555 set rewinddir d_rewinddir
9556 eval $inlibc
9557
9558 : see if readlink exists
9559 set readlink d_readlink
9560 eval $inlibc
9561
9562 : see if readv exists
9563 set readv d_readv
9564 eval $inlibc
9565
9566 : see if rename exists
9567 set rename d_rename
9568 eval $inlibc
9569
9570 : see if rmdir exists
9571 set rmdir d_rmdir
9572 eval $inlibc
9573
9574 : see if memory.h is available.
9575 val=''
9576 set memory.h val
9577 eval $inhdr
9578
9579 : See if it conflicts with string.h
9580 case "$val" in
9581 $define)
9582         case "$strings" in
9583         '') ;;
9584         *)
9585                 $cppstdin $cppflags $cppminus < $strings > mem.h
9586                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9587                         echo " "
9588                         echo "We won't be including <memory.h>."
9589                         val="$undef"
9590                 fi
9591                 $rm -f mem.h
9592                 ;;
9593         esac
9594 esac
9595 set i_memory
9596 eval $setvar
9597
9598 : can bcopy handle overlapping blocks?
9599 val="$undef"
9600 case "$d_bcopy" in
9601 "$define")
9602         echo " "
9603         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9604         $cat >try.c <<EOCP
9605 #$i_memory I_MEMORY
9606 #$i_stdlib I_STDLIB
9607 #$i_string I_STRING
9608 #$i_unistd I_UNISTD
9609 EOCP
9610         $cat >>try.c <<'EOCP'
9611 #include <stdio.h>
9612 #ifdef I_MEMORY
9613 #  include <memory.h>
9614 #endif
9615 #ifdef I_STDLIB
9616 #  include <stdlib.h>
9617 #endif
9618 #ifdef I_STRING
9619 #  include <string.h>
9620 #else
9621 #  include <strings.h>
9622 #endif
9623 #ifdef I_UNISTD
9624 #  include <unistd.h>  /* Needed for NetBSD */
9625 #endif
9626 int main()
9627 {
9628 char buf[128], abc[128];
9629 char *b;
9630 int len;
9631 int off;
9632 int align;
9633
9634 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9635
9636 for (align = 7; align >= 0; align--) {
9637         for (len = 36; len; len--) {
9638                 b = buf+align;
9639                 bcopy(abc, b, len);
9640                 for (off = 1; off <= len; off++) {
9641                         bcopy(b, b+off, len);
9642                         bcopy(b+off, b, len);
9643                         if (bcmp(b, abc, len))
9644                                 exit(1);
9645                 }
9646         }
9647 }
9648 exit(0);
9649 }
9650 EOCP
9651         set try
9652         if eval $compile_ok; then
9653                 if ./try 2>/dev/null; then
9654                         echo "Yes, it can."
9655                         val="$define"
9656                 else
9657                         echo "It can't, sorry."
9658                         case "$d_memmove" in
9659                         "$define") echo "But that's Ok since you have memmove()." ;;
9660                         esac
9661                 fi
9662         else
9663                 echo "(I can't compile the test program, so we'll assume not...)"
9664                 case "$d_memmove" in
9665                 "$define") echo "But that's Ok since you have memmove()." ;;
9666                 esac
9667         fi
9668         ;;
9669 esac
9670 $rm -f try.* try core
9671 set d_safebcpy
9672 eval $setvar
9673
9674 : can memcpy handle overlapping blocks?
9675 val="$undef"
9676 case "$d_memcpy" in
9677 "$define")
9678         echo " "
9679         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9680         $cat >try.c <<EOCP
9681 #$i_memory I_MEMORY
9682 #$i_stdlib I_STDLIB
9683 #$i_string I_STRING
9684 #$i_unistd I_UNISTD
9685 EOCP
9686         $cat >>try.c <<'EOCP'
9687 #include <stdio.h>
9688 #ifdef I_MEMORY
9689 #  include <memory.h>
9690 #endif
9691 #ifdef I_STDLIB
9692 #  include <stdlib.h>
9693 #endif
9694 #ifdef I_STRING
9695 #  include <string.h>
9696 #else
9697 #  include <strings.h>
9698 #endif
9699 #ifdef I_UNISTD
9700 #  include <unistd.h>  /* Needed for NetBSD */
9701 #endif
9702 int main()
9703 {
9704 char buf[128], abc[128];
9705 char *b;
9706 int len;
9707 int off;
9708 int align;
9709
9710 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9711    try to store the string in read-only memory. */
9712 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9713
9714 for (align = 7; align >= 0; align--) {
9715         for (len = 36; len; len--) {
9716                 b = buf+align;
9717                 memcpy(b, abc, len);
9718                 for (off = 1; off <= len; off++) {
9719                         memcpy(b+off, b, len);
9720                         memcpy(b, b+off, len);
9721                         if (memcmp(b, abc, len))
9722                                 exit(1);
9723                 }
9724         }
9725 }
9726 exit(0);
9727 }
9728 EOCP
9729         set try
9730         if eval $compile_ok; then
9731                 if ./try 2>/dev/null; then
9732                         echo "Yes, it can."
9733                         val="$define"
9734                 else
9735                         echo "It can't, sorry."
9736                         case "$d_memmove" in
9737                         "$define") echo "But that's Ok since you have memmove()." ;;
9738                         esac
9739                 fi
9740         else
9741                 echo "(I can't compile the test program, so we'll assume not...)"
9742                 case "$d_memmove" in
9743                 "$define") echo "But that's Ok since you have memmove()." ;;
9744                 esac
9745         fi
9746         ;;
9747 esac
9748 $rm -f try.* try core
9749 set d_safemcpy
9750 eval $setvar
9751
9752 : can memcmp be trusted to compare relative magnitude?
9753 val="$undef"
9754 case "$d_memcmp" in
9755 "$define")
9756         echo " "
9757         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9758         $cat >try.c <<EOCP
9759 #$i_memory I_MEMORY
9760 #$i_stdlib I_STDLIB
9761 #$i_string I_STRING
9762 #$i_unistd I_UNISTD
9763 EOCP
9764         $cat >>try.c <<'EOCP'
9765 #include <stdio.h>
9766 #ifdef I_MEMORY
9767 #  include <memory.h>
9768 #endif
9769 #ifdef I_STDLIB
9770 #  include <stdlib.h>
9771 #endif
9772 #ifdef I_STRING
9773 #  include <string.h>
9774 #else
9775 #  include <strings.h>
9776 #endif
9777 #ifdef I_UNISTD
9778 #  include <unistd.h>  /* Needed for NetBSD */
9779 #endif
9780 int main()
9781 {
9782 char a = -1;
9783 char b = 0;
9784 if ((a < b) && memcmp(&a, &b, 1) < 0)
9785         exit(1);
9786 exit(0);
9787 }
9788 EOCP
9789         set try
9790         if eval $compile_ok; then
9791                 if ./try 2>/dev/null; then
9792                         echo "Yes, it can."
9793                         val="$define"
9794                 else
9795                         echo "No, it can't (it uses signed chars)."
9796                 fi
9797         else
9798                 echo "(I can't compile the test program, so we'll assume not...)"
9799         fi
9800         ;;
9801 esac
9802 $rm -f try.* try core
9803 set d_sanemcmp
9804 eval $setvar
9805
9806 : see if select exists
9807 set select d_select
9808 eval $inlibc
9809
9810 : see if semctl exists
9811 set semctl d_semctl
9812 eval $inlibc
9813
9814 : see if semget exists
9815 set semget d_semget
9816 eval $inlibc
9817
9818 : see if semop exists
9819 set semop d_semop
9820 eval $inlibc
9821
9822 : see how much of the 'sem*(2)' library is present.
9823 h_sem=true
9824 echo " "
9825 case "$d_semctl$d_semget$d_semop" in
9826 *"$undef"*) h_sem=false;;
9827 esac
9828 case "$osname" in
9829 freebsd)
9830     case "`ipcs 2>&1`" in
9831     "SVID messages"*"not configured"*)
9832         echo "Your $osname does not have the sem*(2) configured." >&4
9833         h_sem=false
9834         val="$undef"
9835         set semctl d_semctl
9836         eval $setvar
9837         set semget d_semget
9838         eval $setvar
9839         set semop d_semop
9840         eval $setvar
9841         ;;
9842     esac
9843     ;;
9844 esac
9845 : we could also check for sys/ipc.h ...
9846 if $h_sem && $test `./findhdr sys/sem.h`; then
9847         echo "You have the full sem*(2) library." >&4
9848         val="$define"
9849 else
9850         echo "You don't have the full sem*(2) library." >&4
9851         val="$undef"
9852 fi
9853 set d_sem
9854 eval $setvar
9855
9856 : see whether sys/sem.h defines union semun
9857 echo " "
9858 $cat > try.c <<'END'
9859 #include <sys/types.h>
9860 #include <sys/ipc.h>
9861 #include <sys/sem.h>
9862 int main () { union semun semun; semun.buf = 0; }
9863 END
9864 set try
9865 if eval $compile; then
9866     echo "You have union semun in <sys/sem.h>." >&4
9867     val="$define"
9868 else
9869     echo "You do not have union semun in <sys/sem.h>." >&4
9870     val="$undef"
9871 fi
9872 $rm -f try try.c try.h
9873 set d_union_semun
9874 eval $setvar
9875
9876 : see how to do semctl IPC_STAT
9877 case "$d_sem" in
9878 $define)
9879     : see whether semctl IPC_STAT can use union semun
9880     echo " "
9881     $cat > try.h <<END
9882 #ifndef S_IRUSR
9883 #   ifdef S_IREAD
9884 #       define S_IRUSR S_IREAD
9885 #       define S_IWUSR S_IWRITE
9886 #       define S_IXUSR S_IEXEC
9887 #   else
9888 #       define S_IRUSR 0400
9889 #       define S_IWUSR 0200
9890 #       define S_IXUSR 0100
9891 #   endif
9892 #   define S_IRGRP (S_IRUSR>>3)
9893 #   define S_IWGRP (S_IWUSR>>3)
9894 #   define S_IXGRP (S_IXUSR>>3)
9895 #   define S_IROTH (S_IRUSR>>6)
9896 #   define S_IWOTH (S_IWUSR>>6)
9897 #   define S_IXOTH (S_IXUSR>>6)
9898 #endif
9899 #ifndef S_IRWXU
9900 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9901 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9902 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9903 #endif
9904 END
9905
9906     $cat > try.c <<END
9907 #include <sys/types.h>
9908 #include <sys/ipc.h>
9909 #include <sys/sem.h>
9910 #include <sys/stat.h>
9911 #include <stdio.h>
9912 #include <errno.h>
9913 #include "try.h"
9914 #ifndef errno
9915 extern int errno;
9916 #endif
9917 #$d_union_semun HAS_UNION_SEMUN
9918 int main() {
9919     union semun
9920 #ifndef HAS_UNION_SEMUN
9921     {
9922         int val;
9923         struct semid_ds *buf;
9924         unsigned short *array;
9925     }
9926 #endif
9927     arg;
9928     int sem, st;
9929
9930 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9931     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9932     if (sem > -1) {
9933         struct semid_ds argbuf;
9934         arg.buf = &argbuf;
9935 #       ifdef IPC_STAT
9936         st = semctl(sem, 0, IPC_STAT, arg);
9937         if (st == 0)
9938             printf("semun\n");
9939         else
9940 #       endif /* IPC_STAT */
9941             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9942 #       ifdef IPC_RMID
9943         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9944 #       endif /* IPC_RMID */
9945             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9946     } else
9947 #endif /* IPC_PRIVATE && ... */
9948         printf("semget failed: errno = %d\n", errno);
9949   return 0;
9950 }
9951 END
9952     val="$undef"
9953     set try
9954     if eval $compile; then
9955         xxx=`./try`
9956         case "$xxx" in
9957         semun) val="$define" ;;
9958         esac
9959     fi
9960     $rm -f try try.c
9961     set d_semctl_semun
9962     eval $setvar
9963     case "$d_semctl_semun" in
9964     $define)
9965         echo "You can use union semun for semctl IPC_STAT." >&4
9966         also='also'
9967         ;;
9968     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9969         also=''
9970         ;;
9971     esac
9972
9973     : see whether semctl IPC_STAT can use struct semid_ds pointer
9974     $cat > try.c <<'END'
9975 #include <sys/types.h>
9976 #include <sys/ipc.h>
9977 #include <sys/sem.h>
9978 #include <sys/stat.h>
9979 #include "try.h"
9980 #include <stdio.h>
9981 #include <errno.h>
9982 #ifndef errno
9983 extern int errno;
9984 #endif
9985 int main() {
9986     struct semid_ds arg;
9987     int sem, st;
9988
9989 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9990     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9991     if (sem > -1) {
9992 #       ifdef IPC_STAT
9993         st = semctl(sem, 0, IPC_STAT, &arg);
9994         if (st == 0)
9995             printf("semid_ds\n");
9996         else
9997 #       endif /* IPC_STAT */
9998             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9999 #       ifdef IPC_RMID
10000         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10001 #       endif /* IPC_RMID */
10002             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10003     } else
10004 #endif /* IPC_PRIVATE && ... */
10005         printf("semget failed: errno = %d\n", errno);
10006
10007     return 0;
10008 }
10009 END
10010     val="$undef"
10011     set try
10012     if eval $compile; then
10013         xxx=`./try`
10014         case "$xxx" in
10015         semid_ds) val="$define" ;;
10016         esac
10017     fi
10018     $rm -f try try.c
10019     set d_semctl_semid_ds
10020     eval $setvar
10021     case "$d_semctl_semid_ds" in
10022     $define)
10023         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10024         ;;
10025     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10026         ;;
10027     esac
10028     $rm -f try.h
10029     ;;
10030 *)  val="$undef"
10031
10032     # We do not have the full sem*(2) library, so assume we can not
10033     # use either.
10034
10035     set d_semctl_semun
10036     eval $setvar
10037
10038     set d_semctl_semid_ds
10039     eval $setvar
10040     ;;
10041 esac
10042
10043 : see if setegid exists
10044 set setegid d_setegid
10045 eval $inlibc
10046
10047 : see if seteuid exists
10048 set seteuid d_seteuid
10049 eval $inlibc
10050
10051 : see if setgrent exists
10052 set setgrent d_setgrent
10053 eval $inlibc
10054
10055 : see if sethostent exists
10056 set sethostent d_sethent
10057 eval $inlibc
10058
10059 : see if setlinebuf exists
10060 set setlinebuf d_setlinebuf
10061 eval $inlibc
10062
10063 : see if setlocale exists
10064 set setlocale d_setlocale
10065 eval $inlibc
10066
10067 : see if setnetent exists
10068 set setnetent d_setnent
10069 eval $inlibc
10070
10071 : see if setprotoent exists
10072 set setprotoent d_setpent
10073 eval $inlibc
10074
10075 : see if setpgid exists
10076 set setpgid d_setpgid
10077 eval $inlibc
10078
10079 : see if setpgrp2 exists
10080 set setpgrp2 d_setpgrp2
10081 eval $inlibc
10082
10083 : see if setpriority exists
10084 set setpriority d_setprior
10085 eval $inlibc
10086
10087 : see if setpwent exists
10088 set setpwent d_setpwent
10089 eval $inlibc
10090
10091 : see if setregid exists
10092 set setregid d_setregid
10093 eval $inlibc
10094 set setresgid d_setresgid
10095 eval $inlibc
10096
10097 : see if setreuid exists
10098 set setreuid d_setreuid
10099 eval $inlibc
10100 set setresuid d_setresuid
10101 eval $inlibc
10102
10103 : see if setrgid exists
10104 set setrgid d_setrgid
10105 eval $inlibc
10106
10107 : see if setruid exists
10108 set setruid d_setruid
10109 eval $inlibc
10110
10111 : see if setservent exists
10112 set setservent d_setsent
10113 eval $inlibc
10114
10115 : see if setsid exists
10116 set setsid d_setsid
10117 eval $inlibc
10118
10119 : see if setspent exists
10120 set setspent d_setspent
10121 eval $inlibc
10122
10123 : see if setvbuf exists
10124 set setvbuf d_setvbuf
10125 eval $inlibc
10126
10127 : see if sfio.h is available
10128 set sfio.h i_sfio
10129 eval $inhdr
10130
10131
10132 : see if sfio library is available
10133 case "$i_sfio" in
10134 $define)
10135         val=''
10136         set sfreserve val
10137         eval $inlibc
10138         ;;
10139 *)
10140         val="$undef"
10141         ;;
10142 esac
10143 : Ok, but do we want to use it.
10144 case "$val" in
10145 $define)
10146         case "$usesfio" in
10147         true|$define|[yY]*) dflt='y';;
10148         *) dflt='n';;
10149         esac
10150         echo "$package can use the sfio library, but it is experimental."
10151         rp="You seem to have sfio available, do you want to try using it?"
10152         . ./myread
10153         case "$ans" in
10154         y|Y) ;;
10155         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10156                 val="$undef"
10157                 : Remove sfio from list of libraries to use
10158                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10159                 shift
10160                 libs="$*"
10161                 echo "libs = $libs" >&4
10162                 ;;
10163         esac
10164         ;;
10165 *)      case "$usesfio" in
10166         true|$define|[yY]*)
10167                 echo "Sorry, cannot find sfio on this machine" >&4
10168                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10169                 ;;
10170         esac
10171         ;;
10172 esac
10173 set d_sfio
10174 eval $setvar
10175 case "$d_sfio" in
10176 $define) usesfio='true';;
10177 *) usesfio='false';;
10178 esac
10179
10180 : see if shmctl exists
10181 set shmctl d_shmctl
10182 eval $inlibc
10183
10184 : see if shmget exists
10185 set shmget d_shmget
10186 eval $inlibc
10187
10188 : see if shmat exists
10189 set shmat d_shmat
10190 eval $inlibc
10191 : see what shmat returns
10192 case "$d_shmat" in
10193 "$define")
10194         $cat >shmat.c <<'END'
10195 #include <sys/shm.h>
10196 void *shmat();
10197 END
10198         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10199                 shmattype='void *'
10200         else
10201                 shmattype='char *'
10202         fi
10203         echo "and it returns ($shmattype)." >&4
10204         : see if a prototype for shmat is available
10205         xxx=`./findhdr sys/shm.h`
10206         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10207         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10208                 val="$define"
10209         else
10210                 val="$undef"
10211         fi
10212         $rm -f shmat.[co]
10213         ;;
10214 *)
10215         val="$undef"
10216         ;;
10217 esac
10218 set d_shmatprototype
10219 eval $setvar
10220
10221 : see if shmdt exists
10222 set shmdt d_shmdt
10223 eval $inlibc
10224
10225 : see how much of the 'shm*(2)' library is present.
10226 h_shm=true
10227 echo " "
10228 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10229 *"$undef"*) h_shm=false;;
10230 esac
10231 case "$osname" in
10232 freebsd)
10233     case "`ipcs 2>&1`" in
10234     "SVID shared memory"*"not configured"*)
10235         echo "Your $osname does not have the shm*(2) configured." >&4
10236         h_shm=false
10237         val="$undef"
10238         set shmctl d_shmctl
10239         evat $setvar
10240         set shmget d_shmget
10241         evat $setvar
10242         set shmat d_shmat
10243         evat $setvar
10244         set shmdt d_shmdt
10245         evat $setvar
10246         ;;
10247     esac
10248     ;;
10249 esac
10250 : we could also check for sys/ipc.h ...
10251 if $h_shm && $test `./findhdr sys/shm.h`; then
10252         echo "You have the full shm*(2) library." >&4
10253         val="$define"
10254 else
10255         echo "You don't have the full shm*(2) library." >&4
10256         val="$undef"
10257 fi
10258 set d_shm
10259 eval $setvar
10260
10261 echo " "
10262 : see if we have sigaction
10263 if set sigaction val -f d_sigaction; eval $csym; $val; then
10264         echo 'sigaction() found.' >&4
10265         $cat > try.c <<'EOP'
10266 #include <stdio.h>
10267 #include <sys/types.h>
10268 #include <signal.h>
10269 int main()
10270 {
10271     struct sigaction act, oact;
10272 }
10273 EOP
10274         set try
10275         if eval $compile_ok; then
10276                 val="$define"
10277         else
10278                 echo "But you don't seem to have a useable struct sigaction." >&4
10279                 val="$undef"
10280         fi
10281 else
10282         echo 'sigaction NOT found.' >&4
10283         val="$undef"
10284 fi
10285 set d_sigaction; eval $setvar
10286 $rm -f try try$_o try.c
10287
10288 : see if sigsetjmp exists
10289 echo " "
10290 case "$d_sigsetjmp" in
10291 '')
10292         $cat >try.c <<'EOP'
10293 #include <setjmp.h>
10294 sigjmp_buf env;
10295 int set = 1;
10296 int main()
10297 {
10298         if (sigsetjmp(env,1))
10299                 exit(set);
10300         set = 0;
10301         siglongjmp(env, 1);
10302         exit(1);
10303 }
10304 EOP
10305         set try
10306         if eval $compile; then
10307                 if ./try >/dev/null 2>&1; then
10308                         echo "POSIX sigsetjmp found." >&4
10309                         val="$define"
10310                 else
10311                         $cat >&4 <<EOM
10312 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10313 I'll ignore them.
10314 EOM
10315                         val="$undef"
10316                 fi
10317         else
10318                 echo "sigsetjmp not found." >&4
10319                 val="$undef"
10320         fi
10321         ;;
10322 *) val="$d_sigsetjmp"
10323         case "$d_sigsetjmp" in
10324         $define) echo "POSIX sigsetjmp found." >&4;;
10325         $undef) echo "sigsetjmp not found." >&4;;
10326         esac
10327         ;;
10328 esac
10329 set d_sigsetjmp
10330 eval $setvar
10331 $rm -f try.c try
10332
10333 : see if stat knows about block sizes
10334 echo " "
10335 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10336 eval $hasfield
10337
10338 : see if _ptr and _cnt from stdio act std
10339 echo " "
10340 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10341         echo "(Looks like you have stdio.h from Linux.)"
10342         case "$stdio_ptr" in
10343         '') stdio_ptr='((fp)->_IO_read_ptr)'
10344                 ptr_lval=$define
10345                 ;;
10346         *)      ptr_lval=$d_stdio_ptr_lval;;
10347         esac
10348         case "$stdio_cnt" in
10349         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10350                 cnt_lval=$undef
10351                 ;;
10352         *)      cnt_lval=$d_stdio_cnt_lval;;
10353         esac
10354         case "$stdio_base" in
10355         '') stdio_base='((fp)->_IO_read_base)';;
10356         esac
10357         case "$stdio_bufsiz" in
10358         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10359         esac
10360 else
10361         case "$stdio_ptr" in
10362         '') stdio_ptr='((fp)->_ptr)'
10363                 ptr_lval=$define
10364                 ;;
10365         *)      ptr_lval=$d_stdio_ptr_lval;;
10366         esac
10367         case "$stdio_cnt" in
10368         '') stdio_cnt='((fp)->_cnt)'
10369                 cnt_lval=$define
10370                 ;;
10371         *)      cnt_lval=$d_stdio_cnt_lval;;
10372         esac
10373         case "$stdio_base" in
10374         '') stdio_base='((fp)->_base)';;
10375         esac
10376         case "$stdio_bufsiz" in
10377         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10378         esac
10379 fi
10380 : test whether _ptr and _cnt really work
10381 echo "Checking how std your stdio is..." >&4
10382 $cat >try.c <<EOP
10383 #include <stdio.h>
10384 #define FILE_ptr(fp)    $stdio_ptr
10385 #define FILE_cnt(fp)    $stdio_cnt
10386 int main() {
10387         FILE *fp = fopen("try.c", "r");
10388         char c = getc(fp);
10389         if (
10390                 18 <= FILE_cnt(fp) &&
10391                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10392         )
10393                 exit(0);
10394         exit(1);
10395 }
10396 EOP
10397 val="$undef"
10398 set try
10399 if eval $compile; then
10400         if ./try; then
10401                 echo "Your stdio acts pretty std."
10402                 val="$define"
10403         else
10404                 echo "Your stdio isn't very std."
10405         fi
10406 else
10407         echo "Your stdio doesn't appear very std."
10408 fi
10409 $rm -f try.c try
10410 set d_stdstdio
10411 eval $setvar
10412
10413 : Can _ptr be used as an lvalue?
10414 case "$d_stdstdio$ptr_lval" in
10415 $define$define) val=$define ;;
10416 *) val=$undef ;;
10417 esac
10418 set d_stdio_ptr_lval
10419 eval $setvar
10420
10421 : Can _cnt be used as an lvalue?
10422 case "$d_stdstdio$cnt_lval" in
10423 $define$define) val=$define ;;
10424 *) val=$undef ;;
10425 esac
10426 set d_stdio_cnt_lval
10427 eval $setvar
10428
10429 : see if _base is also standard
10430 val="$undef"
10431 case "$d_stdstdio" in
10432 $define)
10433         $cat >try.c <<EOP
10434 #include <stdio.h>
10435 #define FILE_base(fp)   $stdio_base
10436 #define FILE_bufsiz(fp) $stdio_bufsiz
10437 int main() {
10438         FILE *fp = fopen("try.c", "r");
10439         char c = getc(fp);
10440         if (
10441                 19 <= FILE_bufsiz(fp) &&
10442                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10443         )
10444                 exit(0);
10445         exit(1);
10446 }
10447 EOP
10448         set try
10449         if eval $compile; then
10450                 if ./try; then
10451                         echo "And its _base field acts std."
10452                         val="$define"
10453                 else
10454                         echo "But its _base field isn't std."
10455                 fi
10456         else
10457                 echo "However, it seems to be lacking the _base field."
10458         fi
10459         $rm -f try.c try
10460         ;;
10461 esac
10462 set d_stdiobase
10463 eval $setvar
10464
10465 $cat >&4 <<EOM
10466 Checking how to access stdio streams by file descriptor number...
10467 EOM
10468 case "$stdio_stream_array" in
10469 '')     $cat >try.c <<EOCP
10470 #include <stdio.h>
10471 int main() {
10472   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10473     printf("yes\n");
10474 }
10475 EOCP
10476         for s in _iob __iob __sF
10477         do
10478                 set try -DSTDIO_STREAM_ARRAY=$s
10479                 if eval $compile; then
10480                         case "`./try$exe_ext`" in
10481                         yes)    stdio_stream_array=$s; break ;;
10482                         esac
10483                 fi
10484         done
10485         $rm -f try.* try$exe_ext
10486 esac
10487 case "$stdio_stream_array" in
10488 '')     $cat >&4 <<EOM
10489 I can't figure out how to access stdio streams by file descriptor number.
10490 EOM
10491         d_stdio_stream_array="$undef"
10492         ;;
10493 *)      $cat >&4 <<EOM
10494 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10495 EOM
10496         d_stdio_stream_array="$define"
10497         ;;
10498 esac
10499
10500 : see if strcoll exists
10501 set strcoll d_strcoll
10502 eval $inlibc
10503
10504 : check for structure copying
10505 echo " "
10506 echo "Checking to see if your C compiler can copy structs..." >&4
10507 $cat >try.c <<'EOCP'
10508 int main()
10509 {
10510         struct blurfl {
10511                 int dyick;
10512         } foo, bar;
10513
10514         foo = bar;
10515 }
10516 EOCP
10517 if $cc -c try.c >/dev/null 2>&1 ; then
10518         val="$define"
10519         echo "Yup, it can."
10520 else
10521         val="$undef"
10522         echo "Nope, it can't."
10523 fi
10524 set d_strctcpy
10525 eval $setvar
10526 $rm -f try.*
10527
10528 : see if strerror and/or sys_errlist[] exist
10529 echo " "
10530 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10531     if set strerror val -f d_strerror; eval $csym; $val; then
10532                 echo 'strerror() found.' >&4
10533                 d_strerror="$define"
10534                 d_strerrm='strerror(e)'
10535                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10536                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10537                         d_syserrlst="$define"
10538                 else
10539                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10540                         d_syserrlst="$undef"
10541                 fi
10542     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10543                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10544                 echo 'strerror() found in string header.' >&4
10545                 d_strerror="$define"
10546                 d_strerrm='strerror(e)'
10547                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10548                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10549                                 d_syserrlst="$define"
10550                 else
10551                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10552                         d_syserrlst="$undef"
10553                 fi
10554     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10555                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10556                 d_strerror="$undef"
10557                 d_syserrlst="$define"
10558                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10559     else
10560                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10561                 d_strerror="$undef"
10562                 d_syserrlst="$undef"
10563                 d_strerrm='"unknown"'
10564     fi
10565 fi
10566
10567 : see if strtod exists
10568 set strtod d_strtod
10569 eval $inlibc
10570
10571 : see if strtol exists
10572 set strtol d_strtol
10573 eval $inlibc
10574
10575 : see if strtoul exists
10576 set strtoul d_strtoul
10577 eval $inlibc
10578
10579 : see if strtoull exists
10580 set strtoull d_strtoull
10581 eval $inlibc
10582
10583 : see if strxfrm exists
10584 set strxfrm d_strxfrm
10585 eval $inlibc
10586
10587 : see if symlink exists
10588 set symlink d_symlink
10589 eval $inlibc
10590
10591 : see if syscall exists
10592 set syscall d_syscall
10593 eval $inlibc
10594
10595 : see if sysconf exists
10596 set sysconf d_sysconf
10597 eval $inlibc
10598
10599 : see if system exists
10600 set system d_system
10601 eval $inlibc
10602
10603 : see if tcgetpgrp exists
10604 set tcgetpgrp d_tcgetpgrp
10605 eval $inlibc
10606
10607 : see if tcsetpgrp exists
10608 set tcsetpgrp d_tcsetpgrp
10609 eval $inlibc
10610
10611 : see if sys/types.h has to be included
10612 set sys/types.h i_systypes
10613 eval $inhdr
10614
10615 : see if prototype for telldir is available
10616 echo " "
10617 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10618 eval $hasproto
10619
10620 : define an is-a-typedef? function
10621 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10622 case "$inclist" in
10623 "") inclist="sys/types.h";;
10624 esac;
10625 eval "varval=\$$var";
10626 case "$varval" in
10627 "")
10628         $rm -f temp.c;
10629         for inc in $inclist; do
10630                 echo "#include <$inc>" >>temp.c;
10631         done;
10632         echo "#ifdef $type" >> temp.c;
10633         echo "printf(\"We have $type\");" >> temp.c;
10634         echo "#endif" >> temp.c;
10635         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10636         if $contains $type temp.E >/dev/null 2>&1; then
10637                 eval "$var=\$type";
10638         else
10639                 eval "$var=\$def";
10640         fi;
10641         $rm -f temp.?;;
10642 *) eval "$var=\$varval";;
10643 esac'
10644
10645 : define an is-a-typedef? function that prompts if the type is not available.
10646 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10647 case "$inclist" in
10648 "") inclist="sys/types.h";;
10649 esac;
10650 eval "varval=\$$var";
10651 case "$varval" in
10652 "")
10653         $rm -f temp.c;
10654         for inc in $inclist; do
10655                 echo "#include <$inc>" >>temp.c;
10656         done;
10657         echo "#ifdef $type" >> temp.c;
10658         echo "printf(\"We have $type\");" >> temp.c;
10659         echo "#endif" >> temp.c;
10660         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10661         echo " " ;
10662         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10663         if $contains $type temp.E >/dev/null 2>&1; then
10664                 echo "$type found." >&4;
10665                 eval "$var=\$type";
10666         else
10667                 echo "$type NOT found." >&4;
10668                 dflt="$def";
10669                 . ./myread ;
10670                 eval "$var=\$ans";
10671         fi;
10672         $rm -f temp.?;;
10673 *) eval "$var=\$varval";;
10674 esac'
10675
10676 : see if this is a sys/times.h system
10677 set sys/times.h i_systimes
10678 eval $inhdr
10679
10680 : see if times exists
10681 echo " "
10682 if set times val -f d_times; eval $csym; $val; then
10683         echo 'times() found.' >&4
10684         d_times="$define"
10685         inc=''
10686         case "$i_systimes" in
10687         "$define") inc='sys/times.h';;
10688         esac
10689         rp="What is the type returned by times() on this system?"
10690         set clock_t clocktype long stdio.h sys/types.h $inc
10691         eval $typedef_ask
10692 else
10693         echo 'times() NOT found, hope that will do.' >&4
10694         d_times="$undef"
10695         clocktype='int'
10696 fi
10697
10698 : see if truncate exists
10699 set truncate d_truncate
10700 eval $inlibc
10701
10702 : see if tzname[] exists
10703 echo " "
10704 if set tzname val -a d_tzname; eval $csym; $val; then
10705         val="$define"
10706         echo 'tzname[] found.' >&4
10707 else
10708         val="$undef"
10709         echo 'tzname[] NOT found.' >&4
10710 fi
10711 set d_tzname
10712 eval $setvar
10713
10714 : see if umask exists
10715 set umask d_umask
10716 eval $inlibc
10717
10718 : backward compatibility for d_hvfork
10719 if test X$d_hvfork != X; then
10720         d_vfork="$d_hvfork"
10721         d_hvfork=''
10722 fi
10723 : see if there is a vfork
10724 val=''
10725 set vfork val
10726 eval $inlibc
10727
10728 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10729 : perl on Solaris 2.x, and probably elsewhere.
10730 case "$val" in
10731 $define)
10732         echo " "
10733         case "$usevfork" in
10734         false) dflt='n';;
10735         *) dflt='y';;
10736         esac
10737         cat <<'EOM'
10738  
10739 Perl can only use a vfork() that doesn't suffer from strict
10740 restrictions on calling functions or modifying global data in
10741 the child.  For example, glibc-2.1 contains such a vfork()
10742 that is unsuitable.  If your system provides a proper fork()
10743 call, chances are that you do NOT want perl to use vfork().
10744
10745 EOM
10746         rp="Do you still want to use vfork()?"
10747         . ./myread
10748         case "$ans" in
10749         y|Y) ;;
10750         *)
10751                 echo "Ok, we won't use vfork()."
10752                 val="$undef"
10753                 ;;
10754         esac
10755         ;;
10756 esac
10757 set d_vfork
10758 eval $setvar
10759 case "$d_vfork" in
10760 $define) usevfork='true';;
10761 *) usevfork='false';;
10762 esac
10763
10764 : see if this is an sysdir system
10765 set sys/dir.h i_sysdir
10766 eval $inhdr
10767
10768 : see if this is an sysndir system
10769 set sys/ndir.h i_sysndir
10770 eval $inhdr
10771
10772 : see if closedir exists
10773 set closedir d_closedir
10774 eval $inlibc
10775
10776 case "$d_closedir" in
10777 "$define")
10778         echo " "
10779         echo "Checking whether closedir() returns a status..." >&4
10780         cat > closedir.c <<EOM
10781 #$i_dirent I_DIRENT             /**/
10782 #$i_sysdir I_SYS_DIR            /**/
10783 #$i_sysndir I_SYS_NDIR          /**/
10784 #$i_systypes I_SYS_TYPES        /**/
10785
10786 #if defined(I_SYS_TYPES)
10787 #include <sys/types.h>
10788 #endif
10789 #if defined(I_DIRENT)
10790 #include <dirent.h>
10791 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10792 #include <sys/dir.h>
10793 #endif
10794 #else
10795 #ifdef I_SYS_NDIR
10796 #include <sys/ndir.h>
10797 #else
10798 #ifdef I_SYS_DIR
10799 #ifdef hp9000s500
10800 #include <ndir.h>       /* may be wrong in the future */
10801 #else
10802 #include <sys/dir.h>
10803 #endif
10804 #endif
10805 #endif
10806 #endif 
10807 int main() { return closedir(opendir(".")); }
10808 EOM
10809         set closedir
10810         if eval $compile_ok; then
10811                 if ./closedir > /dev/null 2>&1 ; then
10812                         echo "Yes, it does."
10813                         val="$undef"
10814                 else
10815                         echo "No, it doesn't."
10816                         val="$define"
10817                 fi
10818         else
10819                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10820                 val="$define"
10821         fi
10822         ;;
10823 *)
10824         val="$undef";
10825         ;;
10826 esac
10827 set d_void_closedir
10828 eval $setvar
10829 $rm -f closedir*
10830 : check for volatile keyword
10831 echo " "
10832 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10833 $cat >try.c <<'EOCP'
10834 int main()
10835 {
10836         typedef struct _goo_struct goo_struct;
10837         goo_struct * volatile goo = ((goo_struct *)0);
10838         struct _goo_struct {
10839                 long long_int;
10840                 int reg_int;
10841                 char char_var;
10842         };
10843         typedef unsigned short foo_t;
10844         char *volatile foo;
10845         volatile int bar;
10846         volatile foo_t blech;
10847         foo = foo;
10848 }
10849 EOCP
10850 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10851         val="$define"
10852         echo "Yup, it does."
10853 else
10854         val="$undef"
10855         echo "Nope, it doesn't."
10856 fi
10857 set d_volatile
10858 eval $setvar
10859 $rm -f try.*
10860
10861 : see if there is a wait4
10862 set wait4 d_wait4
10863 eval $inlibc
10864
10865 : see if waitpid exists
10866 set waitpid d_waitpid
10867 eval $inlibc
10868
10869 : see if wcstombs exists
10870 set wcstombs d_wcstombs
10871 eval $inlibc
10872
10873 : see if wctomb exists
10874 set wctomb d_wctomb
10875 eval $inlibc
10876
10877 : see if writev exists
10878 set writev d_writev
10879 eval $inlibc
10880
10881 : preserve RCS keywords in files with variable substitution, grrr
10882 Date='$Date'
10883 Id='$Id'
10884 Log='$Log'
10885 RCSfile='$RCSfile'
10886 Revision='$Revision'
10887
10888 case "$crosscompile" in
10889 ''|[nN]*) crosscompile="$undef" ;;
10890 esac
10891
10892 case "$osname" in
10893 next|rhapsody) multiarch="$define" ;;
10894 esac
10895 case "$multiarch" in
10896 ''|[nN]*) multiarch="$undef" ;;
10897 esac
10898
10899 : check for alignment requirements
10900 echo " "
10901 case "$crosscompile$multiarch" in
10902 *$define*)
10903         $cat <<EOM
10904 You seem to be either cross-compiling or doing a multiarchitecture build,
10905 skipping the memory alignment check.
10906
10907 EOM
10908         case "$alignbytes" in
10909         '') alignbytes=8 ;;
10910         esac
10911         ;;
10912 *)
10913         case "$alignbytes" in
10914         '') echo "Checking alignment constraints..." >&4
10915                 $cat >try.c <<'EOCP'
10916 struct foobar {
10917         char foo;
10918         double bar;
10919 } try_algn;
10920 int main()
10921 {
10922         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10923 }
10924 EOCP
10925                 set try
10926                 if eval $compile_ok; then
10927                         dflt=`./try`
10928                 else
10929                         dflt='8'
10930                         echo "(I can't seem to compile the test program...)"
10931                 fi
10932                 ;;
10933         *) dflt="$alignbytes"
10934                 ;;
10935         esac
10936         rp="Doubles must be aligned on a how-many-byte boundary?"
10937         . ./myread
10938         alignbytes="$ans"
10939         $rm -f try.c try
10940         ;;
10941 esac
10942
10943
10944 : check for ordering of bytes in a long
10945 echo " "
10946 case "$crosscompile$multiarch" in
10947 *$define*)
10948         $cat <<EOM
10949 You seem to be either cross-compiling or doing a multiarchitecture build,
10950 skipping the byteorder check.
10951
10952 EOM
10953         byteorder=''
10954         ;;
10955 *)
10956         case "$byteorder" in
10957         '')
10958                 $cat <<'EOM'
10959 In the following, larger digits indicate more significance.  A big-endian
10960 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10961 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10962 machines may have weird orders like 3412.  A Cray will report 87654321. If
10963 the test program works the default is probably right.
10964 I'm now running the test program...
10965 EOM
10966                 $cat >try.c <<'EOCP'
10967 #include <stdio.h>
10968 int main()
10969 {
10970         int i;
10971         union {
10972                 unsigned long l;
10973                 char c[sizeof(long)];
10974         } u;
10975
10976         if (sizeof(long) > 4)
10977                 u.l = (0x08070605L << 32) | 0x04030201L;
10978         else
10979                 u.l = 0x04030201L;
10980         for (i = 0; i < sizeof(long); i++)
10981                 printf("%c", u.c[i]+'0');
10982         printf("\n");
10983         exit(0);
10984 }
10985 EOCP
10986                 xxx_prompt=y
10987                 set try
10988                 if eval $compile && ./try > /dev/null; then
10989                         dflt=`./try`
10990                         case "$dflt" in
10991                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10992                                 echo "(The test program ran ok.)"
10993                                 echo "byteorder=$dflt"
10994                                 xxx_prompt=n
10995                         ;;
10996                         ????|????????) echo "(The test program ran ok.)" ;;
10997                         *) echo "(The test program didn't run right for some reason.)" ;;
10998                         esac
10999                 else
11000                         dflt='4321'
11001                         cat <<'EOM'
11002 (I can't seem to compile the test program.  Guessing big-endian...)
11003 EOM
11004                 fi
11005                 case "$xxx_prompt" in
11006                 y)
11007                         rp="What is the order of bytes in a long?"
11008                         . ./myread
11009                         byteorder="$ans"
11010                         ;;
11011                 *)      byteorder=$dflt
11012                         ;;
11013                 esac
11014                 ;;
11015         esac
11016         $rm -f try.c try
11017         ;;
11018 esac
11019
11020
11021 : how do we catenate cpp tokens here?
11022 echo " "
11023 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11024 $cat >cpp_stuff.c <<'EOCP'
11025 #define RCAT(a,b)a/**/b
11026 #define ACAT(a,b)a ## b
11027 RCAT(Rei,ser)
11028 ACAT(Cir,cus)
11029 EOCP
11030 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11031 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11032         echo "Oh!  Smells like ANSI's been here." >&4
11033         echo "We can catify or stringify, separately or together!"
11034         cpp_stuff=42
11035 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11036         echo "Ah, yes!  The good old days!" >&4
11037         echo "However, in the good old days we don't know how to stringify and"
11038         echo "catify at the same time."
11039         cpp_stuff=1
11040 else
11041         $cat >&4 <<EOM
11042 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11043 to have to edit the values of CAT[2-5] in config.h...
11044 EOM
11045         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11046 fi
11047 $rm -f cpp_stuff.*
11048
11049 : see if this is a db.h system
11050 set db.h i_db
11051 eval $inhdr
11052
11053 case "$i_db" in
11054 $define)
11055         : Check db version.
11056         echo " "
11057         echo "Checking Berkeley DB version ..." >&4
11058         $cat >try.c <<EOCP
11059 #$d_const HASCONST
11060 #ifndef HASCONST
11061 #define const
11062 #endif
11063 #include <sys/types.h>
11064 #include <stdio.h>
11065 #include <db.h>
11066 int main()
11067 {
11068 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11069     int Major, Minor, Patch ;
11070     unsigned long Version ;
11071     (void)db_version(&Major, &Minor, &Patch) ;
11072     printf("You have Berkeley DB Version 2 or greater\n");
11073
11074     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11075                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11076     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11077                 Major, Minor, Patch) ;
11078
11079     /* check that db.h & libdb are compatible */
11080     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11081         printf("db.h and libdb are incompatible\n") ;
11082         exit(3);        
11083     }
11084
11085     printf("db.h and libdb are compatible\n") ;
11086
11087     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11088                 + DB_VERSION_PATCH ;
11089
11090     /* needs to be >= 2.3.4 */
11091     if (Version < 2003004) {
11092     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11093         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11094         exit(2);        
11095     }
11096
11097     exit(0);
11098 #else
11099 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11100     printf("You have Berkeley DB Version 1\n");
11101     exit(0);    /* DB version < 2: the coast is clear. */
11102 #else
11103     exit(1);    /* <db.h> not Berkeley DB? */
11104 #endif
11105 #endif
11106 }
11107 EOCP
11108         set try
11109         if eval $compile && ./try; then
11110                 echo 'Looks OK.' >&4
11111         else
11112                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11113                 i_db=$undef
11114                 case " $libs " in
11115                 *"-ldb "*)
11116                         : Remove db from list of libraries to use
11117                         echo "Removing unusable -ldb from library list" >&4
11118                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11119                         shift
11120                         libs="$*"
11121                         echo "libs = $libs" >&4
11122                         ;;
11123                 esac
11124         fi
11125         $rm -f try.*
11126         ;;
11127 esac
11128
11129 case "$i_db" in
11130 define)
11131         : Check the return type needed for hash 
11132         echo " "
11133         echo "Checking return type needed for hash 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 u_int32_t hash_cb (ptr, size)
11144 const void *ptr;
11145 size_t size;
11146 {
11147 }
11148 HASHINFO info;
11149 int main()
11150 {
11151         info.hash = hash_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_hashtype='int'
11158                 else
11159                         db_hashtype='u_int32_t'
11160                 fi
11161         else
11162                 : XXX Maybe we should just give up here.
11163                 db_hashtype=u_int32_t
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_hashtype." >&4
11167         fi
11168         $rm -f try.*
11169         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11170         ;;
11171 *)      db_hashtype=u_int32_t
11172         ;;
11173 esac
11174 case "$i_db" in
11175 define)
11176         : Check the return type needed for prefix 
11177         echo " "
11178         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11179         cat >try.c <<EOCP
11180 #$d_const HASCONST
11181 #ifndef HASCONST
11182 #define const
11183 #endif
11184 #include <sys/types.h>
11185 #include <db.h>
11186
11187 #ifndef DB_VERSION_MAJOR
11188 size_t prefix_cb (key1, key2)
11189 const DBT *key1;
11190 const DBT *key2;
11191 {
11192 }
11193 BTREEINFO info;
11194 int main()
11195 {
11196         info.prefix = prefix_cb;
11197 }
11198 #endif
11199 EOCP
11200         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11201                 if $contains warning try.out >>/dev/null 2>&1 ; then
11202                         db_prefixtype='int'
11203                 else
11204                         db_prefixtype='size_t'
11205                 fi
11206         else
11207                 db_prefixtype='size_t'
11208                 : XXX Maybe we should just give up here.
11209                 $cat try.out >&4
11210                 echo "Help:  I can't seem to compile the db test program." >&4
11211                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11212         fi
11213         $rm -f try.*
11214         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11215         ;;
11216 *)      db_prefixtype='size_t'
11217         ;;
11218 esac
11219
11220 : check for void type
11221 echo " "
11222 echo "Checking to see how well your C compiler groks the void type..." >&4
11223 case "$voidflags" in
11224 '')
11225         $cat >try.c <<'EOCP'
11226 #if TRY & 1
11227 void sub() {
11228 #else
11229 sub() {
11230 #endif
11231         extern void moo();      /* function returning void */
11232         void (*goo)();          /* ptr to func returning void */
11233 #if TRY & 8
11234         void *hue;              /* generic ptr */
11235 #endif
11236 #if TRY & 2
11237         void (*foo[10])();
11238 #endif
11239
11240 #if TRY & 4
11241         if(goo == moo) {
11242                 exit(0);
11243         }
11244 #endif
11245         exit(0);
11246 }
11247 int main() { sub(); }
11248 EOCP
11249         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11250                 voidflags=$defvoidused
11251         echo "Good.  It appears to support void to the level $package wants.">&4
11252                 if $contains warning .out >/dev/null 2>&1; then
11253                         echo "However, you might get some warnings that look like this:"
11254                         $cat .out
11255                 fi
11256         else
11257 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11258                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11259                         echo "It supports 1..."
11260                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11261                                 echo "It also supports 2..."
11262                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11263                                         voidflags=7
11264                                         echo "And it supports 4 but not 8 definitely."
11265                                 else
11266                                         echo "It doesn't support 4..."
11267                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11268                                                 voidflags=11
11269                                                 echo "But it supports 8."
11270                                         else
11271                                                 voidflags=3
11272                                                 echo "Neither does it support 8."
11273                                         fi
11274                                 fi
11275                         else
11276                                 echo "It does not support 2..."
11277                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11278                                         voidflags=13
11279                                         echo "But it supports 4 and 8."
11280                                 else
11281                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11282                                                 voidflags=5
11283                                                 echo "And it supports 4 but has not heard about 8."
11284                                         else
11285                                                 echo "However it supports 8 but not 4."
11286                                         fi
11287                                 fi
11288                         fi
11289                 else
11290                         echo "There is no support at all for void."
11291                         voidflags=0
11292                 fi
11293         fi
11294 esac
11295 case "$voidflags" in
11296 "$defvoidused") ;;
11297 *)      $cat >&4 <<'EOM'
11298   Support flag bits are:
11299     1: basic void declarations.
11300     2: arrays of pointers to functions returning void.
11301     4: operations between pointers to and addresses of void functions.
11302     8: generic void pointers.
11303 EOM
11304         dflt="$voidflags";
11305         rp="Your void support flags add up to what?"
11306         . ./myread
11307         voidflags="$ans"
11308         ;;
11309 esac
11310 $rm -f try.* .out
11311
11312
11313 : How can we generate normalized random numbers ?
11314 echo " "
11315 echo "Looking for a random number function..." >&4
11316 case "$randfunc" in
11317 '')
11318         if set drand48 val -f; eval $csym; $val; then
11319                 dflt="drand48"
11320                 echo "Good, found drand48()." >&4
11321         elif set random val -f; eval $csym; $val; then
11322                 dflt="random"
11323                 echo "OK, found random()." >&4
11324         else
11325                 dflt="rand"
11326                 echo "Yick, looks like I have to use rand()." >&4
11327         fi
11328         echo " "
11329         ;;
11330 *)
11331         dflt="$randfunc"
11332         ;;
11333 esac
11334 cont=true
11335
11336 case "$ccflags" in
11337 *-Dmy_rand=*|*-Dmy_srand=*)
11338         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11339         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11340         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11341         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11342         ;;
11343 esac
11344
11345 while $test "$cont"; do
11346         rp="Use which function to generate random numbers?"
11347         . ./myread
11348         if $test "$ans" = "$dflt"; then
11349                 : null
11350         else
11351                 randbits=''
11352         fi
11353         randfunc="$ans"
11354         if set $ans val -f; eval $csym; $val; then
11355                 cont=''
11356         else
11357                 dflt=y
11358                 rp="I cannot find function $ans. Use that name anyway?"
11359                 . ./myread
11360                 dflt=rand
11361                 case "$ans" in
11362                         [yY]*) cont='';;
11363                 esac
11364         fi
11365         case "$cont" in
11366         '')
11367                 case "$randfunc" in
11368                 drand48)
11369                         drand01="drand48()"
11370                         seedfunc="srand48"
11371                         randbits=48
11372                         randseedtype=long
11373                         ;;
11374                 rand|random)
11375                         case "$randbits" in
11376                         '')
11377 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11378                                 $cat >try.c <<EOCP
11379 #$i_unistd I_UNISTD
11380 #$i_stdlib I_STDLIB
11381 #include <stdio.h>
11382 #ifdef I_UNISTD
11383 #  include <unistd.h>
11384 #endif
11385 #ifdef I_STDLIB
11386 #  include <stdlib.h>
11387 #endif
11388 int main()
11389 {
11390         register int i;
11391         register unsigned long tmp;
11392         register unsigned long max = 0L;
11393
11394         for (i = 1000; i; i--) {
11395                 tmp = (unsigned long) $randfunc();
11396                 if (tmp > max) max = tmp;
11397         }
11398         for (i = 0; max; i++)
11399                 max /= 2;
11400         printf("%d\n",i);
11401 }
11402 EOCP
11403                                 set try
11404                                 if eval $compile_ok; then
11405                                         dflt=`try`
11406                                 else
11407                                         dflt='?'
11408                                         echo "(I can't seem to compile the test program...)"
11409                                 fi
11410                                 ;;
11411                         *)
11412                                 dflt="$randbits"
11413                                 ;;
11414                         esac
11415                         rp="How many bits does your $randfunc() function produce?"
11416                         . ./myread
11417                         randbits="$ans"
11418                         $rm -f try.c try
11419                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11420                         seedfunc="s$randfunc"
11421                         randseedtype=unsigned
11422                         ;;
11423                 *)
11424                         dflt="31"
11425                         rp="How many bits does your $randfunc() function produce?"
11426                         . ./myread
11427                         randbits="$ans"
11428                         seedfunc="s$randfunc"
11429                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11430                         if set $seedfunc val -f; eval $csym; $val; then
11431                                 echo "(Using $seedfunc() to seed random generator)"
11432                         else
11433                                 echo "(Warning: no $seedfunc() to seed random generator)"
11434                                 seedfunc=rand
11435                         fi
11436                         randseedtype=unsigned
11437                         ;;
11438                 esac
11439                 ;;
11440         esac
11441 done
11442
11443 echo " "
11444 echo "Determining whether or not we are on an EBCDIC system..." >&4
11445 $cat >tebcdic.c <<'EOM'
11446 int main()
11447 {
11448   if ('M'==0xd4) return 0;
11449   return 1;
11450 }
11451 EOM
11452
11453 val=$undef
11454 set tebcdic
11455 if eval $compile_ok; then
11456         if ./tebcdic; then
11457                 echo "You have EBCDIC." >&4
11458                 val="$define"
11459         else
11460                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
11461         fi
11462 else
11463         echo "I'm unable to compile the test program." >&4
11464         echo "I'll assume ASCII or some ISO Latin." >&4
11465 fi
11466 $rm -f tebcdic.c tebcdic
11467 set ebcdic
11468 eval $setvar
11469
11470 echo " "
11471 $cat >&4 <<EOM
11472 Checking how to flush all pending stdio output...
11473 EOM
11474 # I only know how to find the first 32 possibly open files on SunOS.
11475 # See also hints/sunos_4_1.sh and util.c  --AD
11476 case "$osname" in
11477 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11478 esac
11479 $cat >>try.c <<EOCP
11480 #include <stdio.h>
11481 #$i_unistd I_UNISTD
11482 #ifdef I_UNISTD
11483 # include <unistd.h>
11484 #endif
11485 #$d_sysconf HAS_SYSCONF
11486 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11487 #ifdef HAS_STDIO_STREAM_ARRAY
11488 # define STDIO_STREAM_ARRAY $stdio_stream_array
11489 #endif
11490 int main() {
11491   FILE* p = fopen("try.out", "w");
11492 #ifdef TRY_FPUTC
11493   fputc('x', p);
11494 #else
11495 # ifdef TRY_FPRINTF
11496   fprintf(p, "x");
11497 # endif
11498 #endif
11499 #ifdef TRY_FFLUSH_NULL
11500   fflush(NULL);
11501 #endif
11502 #ifdef TRY_FFLUSH_ALL
11503   {
11504     long open_max = -1;
11505 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11506     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11507 # else
11508 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11509     open_max = sysconf(_SC_OPEN_MAX);
11510 #  else
11511 #   ifdef FOPEN_MAX
11512     open_max = FOPEN_MAX;
11513 #   else
11514 #    ifdef OPEN_MAX
11515     open_max = OPEN_MAX;
11516 #    else
11517 #     ifdef _NFILE
11518     open_max = _NFILE;
11519 #     endif
11520 #    endif
11521 #   endif
11522 #  endif
11523 # endif 
11524 # ifdef HAS_STDIO_STREAM_ARRAY
11525     if (open_max > 0) {
11526       long i;
11527       for (i = 0; i < open_max; i++)
11528             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11529                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11530                 STDIO_STREAM_ARRAY[i]._flag)
11531                 fflush(&STDIO_STREAM_ARRAY[i]);
11532     }   
11533   }
11534 # endif
11535 #endif
11536   _exit(42);
11537 }
11538 EOCP
11539 : first we have to find out how _not_ to flush
11540 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11541     output=''
11542     set try -DTRY_FPUTC
11543     if eval $compile; then
11544             $rm -f try.out
11545             ./try$exe_ext 2>/dev/null
11546             if $test ! -s try.out -a "X$?" = X42; then
11547                 output=-DTRY_FPUTC
11548             fi
11549     fi
11550     case "$output" in
11551     '')
11552             set try -DTRY_FPRINTF
11553             $rm -f try.out
11554             if eval $compile; then
11555                     $rm -f try.out
11556                     ./try$exe_ext 2>/dev/null
11557                     if $test ! -s try.out -a "X$?" = X42; then
11558                         output=-DTRY_FPRINTF
11559                     fi
11560             fi
11561         ;;
11562     esac
11563 fi
11564 : check for fflush NULL behaviour
11565 case "$fflushNULL" in
11566 '')     set try -DTRY_FFLUSH_NULL $output
11567         if eval $compile; then
11568                 $rm -f try.out
11569                 ./try$exe_ext 2>/dev/null
11570                 code="$?"
11571                 if $test -s try.out -a "X$code" = X42; then
11572                         fflushNULL="`$cat try.out`"
11573                 else
11574                         if $test "X$code" != X42; then
11575                                 $cat >&4 <<EOM
11576 (If this test failed, don't worry, we'll try another method shortly.)
11577 EOM
11578                         fi
11579                 fi
11580         fi
11581         $rm -f core try.core core.try.*
11582         case "$fflushNULL" in
11583         x)      $cat >&4 <<EOM
11584 Your fflush(NULL) works okay.
11585 EOM
11586                 fflushNULL="$define"
11587                 ;;
11588         '')     $cat >&4 <<EOM
11589 Your fflush(NULL) isn't working (contrary to ANSI C).
11590 EOM
11591                 fflushNULL="$undef"
11592                 ;;
11593         *)      $cat >&4 <<EOM
11594 Cannot figure out whether your fflush(NULL) works or not.
11595 I'm assuming it doesn't (contrary to ANSI C).
11596 EOM
11597                 fflushNULL="$undef"
11598                 ;;
11599         esac
11600         ;;
11601 $define|true|[yY]*)
11602         fflushNULL="$define"
11603         ;;
11604 *)
11605         fflushNULL="$undef"
11606         ;;
11607 esac
11608 : check explicit looping only if NULL did not work
11609 case "$fflushNULL" in
11610 "$undef")
11611         : check for fflush all behaviour
11612         case "$fflushall" in
11613         '')     set try -DTRY_FFLUSH_ALL $output
11614                 if eval $compile; then
11615                         $cat >&4 <<EOM
11616 (Now testing the other method--but note that also this may fail.)
11617 EOM
11618                         $rm -f try.out
11619                         ./try$exe_ext 2>/dev/null
11620                         if $test -s try.out -a "X$?" = X42; then
11621                                 fflushall="`$cat try.out`"
11622                         fi
11623                 fi
11624                 $rm -f core try.core core.try.*
11625                 case "$fflushall" in
11626                 x)      $cat >&4 <<EOM
11627 Whew. Flushing explicitly all the stdio streams works.
11628 EOM
11629                         fflushall="$define"
11630                         ;;
11631                 '')     $cat >&4 <<EOM
11632 Sigh. Flushing explicitly all the stdio streams doesn't work.
11633 EOM
11634                         fflushall="$undef"
11635                         ;;
11636                 *)      $cat >&4 <<EOM
11637 Cannot figure out whether flushing stdio streams explicitly works or not.
11638 I'm assuming it doesn't.
11639 EOM
11640                         fflushall="$undef"
11641                         ;;
11642                 esac
11643                 ;;
11644         "$define"|true|[yY]*)
11645                 fflushall="$define"
11646                 ;;
11647         *)
11648                 fflushall="$undef"
11649                 ;;
11650         esac
11651         ;;
11652 *)      fflushall="$undef"      
11653         ;;
11654 esac
11655 case "$fflushNULL$fflushall" in
11656 undefundef)
11657         $cat <<EOM
11658 I cannot figure out how to flush pending stdio output.
11659 EOM
11660         ;;
11661 esac
11662 $rm -f try.* try$exe_ext
11663
11664 : see what type file positions are declared as in the library
11665 rp="What is the type for file position used by fsetpos()?"
11666 set fpos_t fpostype long stdio.h sys/types.h
11667 eval $typedef_ask
11668
11669 : Store the full pathname to the ar program for use in the C program
11670 : Respect a hint or command line value for full_ar.
11671 case "$full_ar" in
11672 '') full_ar=$ar ;;
11673 esac
11674
11675 : Store the full pathname to the sed program for use in the C program
11676 full_sed=$sed
11677
11678 : see what type gids are declared as in the kernel
11679 echo " "
11680 echo "Looking for the type for group ids returned by getgid()."
11681 set gid_t gidtype xxx stdio.h sys/types.h
11682 eval $typedef
11683 case "$gidtype" in
11684 xxx)
11685         xxx=`./findhdr sys/user.h`
11686         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11687         case $1 in
11688         unsigned) dflt="$1 $2" ;;
11689         *) dflt="$1" ;;
11690         esac
11691         ;;
11692 *) dflt="$gidtype";;
11693 esac
11694 case "$gidtype" in
11695 gid_t) echo "gid_t found." ;;
11696 *)      rp="What is the type for group ids returned by getgid()?"
11697         . ./myread
11698         gidtype="$ans"
11699         ;;
11700 esac
11701
11702 : see if getgroups exists
11703 set getgroups d_getgrps
11704 eval $inlibc
11705
11706 : see if setgroups exists
11707 set setgroups d_setgrps
11708 eval $inlibc
11709
11710
11711 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11712 echo " "
11713 case "$d_getgrps$d_setgrps" in
11714 *define*)
11715         case "$groupstype" in
11716         '') dflt="$gidtype" ;;
11717         *)  dflt="$groupstype" ;;
11718         esac
11719         $cat <<EOM
11720 What type of pointer is the second argument to getgroups() and setgroups()?
11721 Usually this is the same as group ids, $gidtype, but not always.
11722
11723 EOM
11724         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11725         . ./myread
11726         groupstype="$ans"
11727         ;;
11728 *)  groupstype="$gidtype";;
11729 esac
11730
11731 : see what type lseek is declared as in the kernel
11732 rp="What is the type used for lseek's offset on this system?"
11733 set off_t lseektype long stdio.h sys/types.h
11734 eval $typedef_ask
11735
11736 echo " "
11737 $echo $n "Checking to see how big your file offsets are...$c" >&4
11738 $cat >try.c <<EOCP
11739 #include <sys/types.h>
11740 #include <stdio.h>
11741 int main()
11742 {
11743         printf("%d\n", sizeof($lseektype));
11744 }
11745 EOCP
11746 set try
11747 if eval $compile_ok; then
11748         lseeksize=`./try`
11749         $echo " $lseeksize bytes." >&4
11750 else
11751         dflt='4'
11752         echo " "
11753         echo "(I can't seem to compile the test program.  Guessing...)"
11754         rp="What is the size of your file offsets (in bytes)?"
11755         . ./myread
11756         lseeksize="$ans"
11757 fi
11758 $rm -f try.c try
11759
11760 echo " "
11761 echo "Checking if your $make program sets \$(MAKE)..." >&4
11762 case "$make_set_make" in
11763 '')
11764         $sed 's/^X //' > testmake.mak << 'EOF'
11765 Xall:
11766 X       @echo 'maketemp="$(MAKE)"'
11767 EOF
11768         case "`$make -f testmake.mak 2>/dev/null`" in
11769         *maketemp=*) make_set_make='#' ;;
11770         *)      make_set_make="MAKE=$make" ;;
11771         esac
11772         $rm -f testmake.mak
11773         ;;
11774 esac
11775 case "$make_set_make" in
11776 '#') echo "Yup, it does.";;
11777 *) echo "Nope, it doesn't.";;
11778 esac
11779
11780 : see what type is used for mode_t
11781 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11782 set mode_t modetype int stdio.h sys/types.h
11783 eval $typedef_ask
11784
11785 : define a fucntion to check prototypes
11786 $cat > protochk <<EOSH
11787 $startsh
11788 cc="$cc"
11789 optimize="$optimize"
11790 ccflags="$ccflags"
11791 prototype="$prototype"
11792 define="$define"
11793 rm=$rm
11794 EOSH
11795
11796 $cat >> protochk <<'EOSH'
11797
11798 $rm -f try.c
11799 foo="$1"
11800 shift
11801 while test $# -ge 2; do
11802         case "$1" in
11803                 $define) echo "#include <$2>" >> try.c ;;
11804                 literal) echo "$2" >> try.c ;;
11805         esac
11806     shift 2
11807 done
11808 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11809 cat >> try.c <<'EOCP'
11810 #ifdef CAN_PROTOTYPE
11811 #define _(args) args
11812 #else
11813 #define _(args) ()
11814 #endif
11815 EOCP
11816 echo "$foo" >> try.c
11817 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11818 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11819 status=$?
11820 $rm -f try.[co]
11821 exit $status
11822 EOSH
11823 chmod +x protochk
11824 $eunicefix protochk
11825
11826 : see what type is used for size_t
11827 rp="What is the type used for the length parameter for string functions?"
11828 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11829 eval $typedef_ask
11830
11831 : check for type of arguments to gethostbyaddr. 
11832 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11833         case "$d_gethbyaddr" in
11834         $define)
11835                 $cat <<EOM
11836
11837 Checking to see what type of arguments are accepted by gethostbyaddr().
11838 EOM
11839                 hdrs="$define sys/types.h
11840                         $d_socket sys/socket.h 
11841                         $i_niin netinet/in.h 
11842                         $i_netdb netdb.h
11843                         $i_unistd unistd.h"
11844                 : The first arg can 'char *' or 'void *'
11845                 : The second arg is some of integral type
11846                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11847                         for yyy in size_t long int; do
11848                                 case "$netdb_host_type" in
11849                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11850                                         if ./protochk "$try" $hdrs; then
11851                                                 echo "Your system accepts $xxx for the first arg."
11852                                                 echo "...and $yyy for the second arg."
11853                                                 netdb_host_type="$xxx"
11854                                                 netdb_hlen_type="$yyy"
11855                                         fi
11856                                         ;;
11857                                 esac
11858                         done
11859                 done
11860                 : In case none of those worked, prompt the user.
11861                 case "$netdb_host_type" in
11862                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11863                         dflt='char *'
11864                         . ./myread
11865                         netdb_host_type=$ans
11866                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11867                         dflt="$sizetype"
11868                         . ./myread
11869                         netdb_hlen_type=$ans
11870                         ;;
11871                 esac
11872                 ;;
11873         *)      : no gethostbyaddr, so pick harmless defaults
11874                 netdb_host_type='char *'
11875                 netdb_hlen_type="$sizetype"
11876                 ;;
11877         esac
11878         # Remove the "const" if needed. -- but then we'll have a 
11879         # prototype clash!
11880         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11881 fi
11882
11883 : check for type of argument to gethostbyname. 
11884 if test "X$netdb_name_type" = X ; then
11885         case "$d_gethbyname" in
11886         $define)
11887                 $cat <<EOM
11888
11889 Checking to see what type of argument is accepted by gethostbyname().
11890 EOM
11891                 hdrs="$define sys/types.h
11892                         $d_socket sys/socket.h 
11893                         $i_niin netinet/in.h 
11894                         $i_netdb netdb.h
11895                         $i_unistd unistd.h"
11896                 for xxx in "const char *" "char *"; do
11897                         case "$netdb_name_type" in
11898                         '')     try="extern struct hostent *gethostbyname($xxx);"
11899                                 if ./protochk "$try" $hdrs; then
11900                                         echo "Your system accepts $xxx."
11901                                         netdb_name_type="$xxx"
11902                                 fi
11903                                 ;;
11904                         esac
11905                 done
11906                 : In case none of those worked, prompt the user.
11907                 case "$netdb_name_type" in
11908                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11909                         dflt='char *'
11910                         . ./myread
11911                         netdb_name_type=$ans
11912                         ;;
11913                 esac
11914                 ;;
11915         *)      : no gethostbyname, so pick harmless default
11916                 netdb_name_type='char *'
11917                 ;;
11918         esac
11919 fi
11920
11921 : check for type of 1st argument to getnetbyaddr. 
11922 if test "X$netdb_net_type" = X ; then
11923         case "$d_getnbyaddr" in
11924         $define)
11925                 $cat <<EOM
11926
11927 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11928 EOM
11929                 hdrs="$define sys/types.h
11930                         $d_socket sys/socket.h 
11931                         $i_niin netinet/in.h 
11932                         $i_netdb netdb.h
11933                         $i_unistd unistd.h"
11934                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11935                         case "$netdb_net_type" in
11936                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11937                                 if ./protochk "$try" $hdrs; then
11938                                         echo "Your system accepts $xxx."
11939                                         netdb_net_type="$xxx"
11940                                 fi
11941                                 ;;
11942                         esac
11943                 done
11944                 : In case none of those worked, prompt the user.
11945                 case "$netdb_net_type" in
11946                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11947                         dflt='long'
11948                         . ./myread
11949                         netdb_net_type=$ans
11950                         ;;
11951                 esac
11952                 ;;
11953         *)      : no getnetbyaddr, so pick harmless default
11954                 netdb_net_type='long'
11955                 ;;
11956         esac
11957 fi
11958 : locate the preferred pager for this system
11959 case "$pager" in
11960 '')
11961         dflt=''
11962         case "$pg" in
11963         /*) dflt=$pg;;
11964         esac
11965         case "$more" in
11966         /*) dflt=$more;;
11967         esac
11968         case "$less" in
11969         /*) dflt=$less;;
11970         esac
11971         case "$dflt" in
11972         '') dflt=/usr/ucb/more;;
11973         esac
11974         ;;
11975 *) dflt="$pager";;
11976 esac
11977 echo " "
11978 fn=f/
11979 rp='What pager is used on your system?'
11980 . ./getfile
11981 pager="$ans"
11982
11983 : see what type pids are declared as in the kernel
11984 rp="What is the type of process ids on this system?"
11985 set pid_t pidtype int stdio.h sys/types.h
11986 eval $typedef_ask
11987
11988 : check for length of pointer
11989 echo " "
11990 case "$ptrsize" in
11991 '')
11992         $echo $n "Checking to see how big your pointers are...$c" >&4
11993         if test "$voidflags" -gt 7; then
11994                 echo '#define VOID_PTR char *' > try.c
11995         else
11996                 echo '#define VOID_PTR void *' > try.c
11997         fi
11998         $cat >>try.c <<'EOCP'
11999 #include <stdio.h>
12000 int main()
12001 {
12002         printf("%d\n", sizeof(VOID_PTR));
12003         exit(0);
12004 }
12005 EOCP
12006         set try
12007         if eval $compile_ok; then
12008                 ptrsize=`./try`
12009                 $echo " $ptrsize bytes." >&4
12010         else
12011                 dflt='4'
12012                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12013                 rp="What is the size of a pointer (in bytes)?"
12014                 . ./myread
12015                 ptrsize="$ans"
12016         fi
12017         ;;
12018 esac
12019 $rm -f try.c try
12020
12021 : see if ar generates random libraries by itself
12022 echo " "
12023 echo "Checking how to generate random libraries on your machine..." >&4
12024 echo 'int bar1() { return bar2(); }' > bar1.c
12025 echo 'int bar2() { return 2; }' > bar2.c
12026 $cat > foo.c <<'EOP'
12027 int main() { printf("%d\n", bar1()); exit(0); }
12028 EOP
12029 $cc $ccflags -c bar1.c >/dev/null 2>&1
12030 $cc $ccflags -c bar2.c >/dev/null 2>&1
12031 $cc $ccflags -c foo.c >/dev/null 2>&1
12032 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12033 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12034         ./foobar >/dev/null 2>&1; then
12035         echo "$ar appears to generate random libraries itself."
12036         orderlib=false
12037         ranlib=":"
12038 elif $ar ts bar$_a >/dev/null 2>&1 &&
12039         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12040         ./foobar >/dev/null 2>&1; then
12041                 echo "a table of contents needs to be added with '$ar ts'."
12042                 orderlib=false
12043                 ranlib="$ar ts"
12044 else
12045         case "$ranlib" in
12046         :) ranlib='';;
12047         '')
12048                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12049                 $test -f $ranlib || ranlib=''
12050                 ;;
12051         esac
12052         if $test -n "$ranlib"; then
12053                 echo "your system has '$ranlib'; we'll use that."
12054                 orderlib=false
12055         else
12056                 echo "your system doesn't seem to support random libraries"
12057                 echo "so we'll use lorder and tsort to order the libraries."
12058                 orderlib=true
12059                 ranlib=":"
12060         fi
12061 fi
12062 $rm -f foo* bar* 
12063
12064 : check for type of arguments to select. 
12065 case "$selecttype" in
12066 '') case "$d_select" in
12067         $define)
12068                 $cat <<EOM
12069 Checking to see what type of arguments are accepted by select().
12070 EOM
12071                 hdrs="$define sys/types.h
12072                         $i_systime sys/time.h 
12073                         $i_sysselct sys/select.h
12074                         $d_socket sys/socket.h"
12075                 : The first arg can be int, unsigned, or size_t
12076                 : The last arg may or may not be 'const'
12077                 val=''
12078                 : void pointer has been seen but using that
12079                 : breaks the selectminbits test
12080                 for xxx in 'fd_set *' 'int *'; do
12081                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12082                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12083                                         case "$val" in
12084                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12085                                                 if ./protochk "$try" $hdrs; then
12086                                                         echo "Your system accepts $xxx."
12087                                                         val="$xxx"
12088                                                 fi
12089                                                 ;;
12090                                         esac
12091                                 done
12092                         done
12093                 done
12094                 case "$val" in
12095                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12096                         case "$d_fd_set" in
12097                                 $define) dflt="fd_set *" ;;
12098                                 *)              dflt="int *" ;;
12099                         esac
12100                         . ./myread
12101                         val=$ans
12102                         ;;
12103                 esac
12104                 selecttype="$val"
12105                 ;;
12106         *)      : no select, so pick a harmless default
12107                 selecttype='int *'
12108                 ;;
12109         esac
12110         ;;
12111 esac
12112
12113 : check for the select 'width'
12114 case "$selectminbits" in
12115 '') case "$d_select" in
12116         $define)
12117                 $cat <<EOM
12118
12119 Checking to see on how many bits at a time your select() operates...
12120 EOM
12121                 $cat >try.c <<EOCP
12122 #include <sys/types.h>
12123 #$i_time I_TIME
12124 #$i_systime I_SYS_TIME
12125 #$i_systimek I_SYS_TIME_KERNEL
12126 #ifdef I_TIME
12127 #   include <time.h>
12128 #endif
12129 #ifdef I_SYS_TIME
12130 #   ifdef I_SYS_TIME_KERNEL
12131 #       define KERNEL
12132 #   endif
12133 #   include <sys/time.h>
12134 #   ifdef I_SYS_TIME_KERNEL
12135 #       undef KERNEL
12136 #   endif
12137 #endif
12138 #$i_sysselct I_SYS_SELECT
12139 #ifdef I_SYS_SELECT
12140 #include <sys/select.h>
12141 #endif
12142 #$d_socket HAS_SOCKET
12143 #ifdef HAS_SOCKET
12144 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12145 #endif
12146 #include <stdio.h>
12147 $selecttype b;
12148 #define S sizeof(*(b))
12149 #define MINBITS 64
12150 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12151 #define NBITS  (NBYTES * 8)
12152 int main() {
12153     char s[NBYTES];
12154     struct timeval t;
12155     int i;
12156     FILE* fp;
12157     int fd;
12158
12159     fclose(stdin);
12160     fp = fopen("try.c", "r");
12161     if (fp == 0)
12162       exit(1);
12163     fd = fileno(fp);
12164     if (fd < 0)
12165       exit(2);
12166     b = ($selecttype)s;
12167     for (i = 0; i < NBITS; i++)
12168         FD_SET(i, b);
12169     t.tv_sec  = 0;
12170     t.tv_usec = 0;
12171     select(fd + 1, b, 0, 0, &t);
12172     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12173     printf("%d\n", i + 1);
12174     return 0;
12175 }
12176 EOCP
12177                 set try
12178                 if eval $compile_ok; then
12179                         selectminbits=`./try`
12180                         case "$selectminbits" in
12181                         '')     cat >&4 <<EOM
12182 Cannot figure out on how many bits at a time your select() operates.
12183 I'll play safe and guess it is 32 bits.
12184 EOM
12185                                 selectminbits=32
12186                                 bits="32 bits"
12187                                 ;;
12188                         1)      bits="1 bit" ;;
12189                         *)      bits="$selectminbits bits" ;;
12190                         esac
12191                         echo "Your select() operates on $bits at a time." >&4
12192                 else
12193                         rp='What is the minimum number of bits your select() operates on?'
12194                         case "$byteorder" in
12195                         1234|12345678)  dflt=32 ;;
12196                         *)              dflt=1  ;;
12197                         esac
12198                         . ./myread
12199                         val=$ans
12200                         selectminbits="$val"
12201                 fi
12202                 $rm -f try.* try
12203                 ;;
12204         *)      : no select, so pick a harmless default
12205                 selectminbits='32'
12206                 ;;
12207         esac
12208         ;;
12209 esac
12210
12211 : Trace out the files included by signal.h, then look for SIGxxx names.
12212 : Remove SIGARRAYSIZE used by HPUX.
12213 : Remove SIGSTKSIZE used by Linux.
12214 : Remove SIGSTKSZ used by Posix.
12215 : Remove SIGTYP void lines used by OS2.
12216 xxx=`echo '#include <signal.h>' |
12217         $cppstdin $cppminus $cppflags 2>/dev/null |
12218         $grep '^[       ]*#.*include' | 
12219         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12220 : Check this list of files to be sure we have parsed the cpp output ok.
12221 : This will also avoid potentially non-existent files, such 
12222 : as ../foo/bar.h
12223 xxxfiles=''
12224 for xx in $xxx /dev/null ; do
12225         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12226 done
12227 : If we have found no files, at least try signal.h
12228 case "$xxxfiles" in
12229 '')     xxxfiles=`./findhdr signal.h` ;;
12230 esac
12231 xxx=`awk '
12232 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12233         print substr($2, 4, 20)
12234 }
12235 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12236         print substr($3, 4, 20)
12237 }' $xxxfiles`
12238 : Append some common names just in case the awk scan failed.
12239 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12240 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12241 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12242 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12243 : generate a few handy files for later
12244 $cat > signal.c <<'EOCP'
12245 #include <sys/types.h>
12246 #include <signal.h>
12247 #include <stdio.h>
12248 int main() {
12249
12250 /* Strange style to avoid deeply-nested #if/#else/#endif */
12251 #ifndef NSIG
12252 #  ifdef _NSIG
12253 #    define NSIG (_NSIG)
12254 #  endif
12255 #endif
12256
12257 #ifndef NSIG
12258 #  ifdef SIGMAX
12259 #    define NSIG (SIGMAX+1)
12260 #  endif
12261 #endif
12262
12263 #ifndef NSIG
12264 #  ifdef SIG_MAX
12265 #    define NSIG (SIG_MAX+1)
12266 #  endif
12267 #endif
12268
12269 #ifndef NSIG
12270 #  ifdef MAXSIG
12271 #    define NSIG (MAXSIG+1)
12272 #  endif
12273 #endif
12274
12275 #ifndef NSIG
12276 #  ifdef MAX_SIG
12277 #    define NSIG (MAX_SIG+1)
12278 #  endif
12279 #endif
12280
12281 #ifndef NSIG
12282 #  ifdef SIGARRAYSIZE
12283 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12284 #  endif
12285 #endif
12286
12287 #ifndef NSIG
12288 #  ifdef _sys_nsig
12289 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12290 #  endif
12291 #endif
12292
12293 /* Default to some arbitrary number that's big enough to get most
12294    of the common signals.
12295 */
12296 #ifndef NSIG
12297 #    define NSIG 50
12298 #endif
12299
12300 printf("NSIG %d\n", NSIG);
12301
12302 #ifndef JUST_NSIG
12303
12304 EOCP
12305
12306 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12307 {
12308         printf "#ifdef SIG"; printf $1; printf "\n"
12309         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12310         printf $1; printf ");\n"
12311         printf "#endif\n"
12312 }
12313 END {
12314         printf "#endif /* JUST_NSIG */\n";
12315         printf "}\n";
12316 }
12317 ' >>signal.c
12318 $cat >signal.awk <<'EOP'
12319 BEGIN { ndups = 0 }
12320 $1 ~ /^NSIG$/ { nsig = $2 }
12321 ($1 !~ /^NSIG$/) && (NF == 2) {
12322     if ($2 > maxsig) { maxsig = $2 }
12323     if (sig_name[$2]) {
12324         dup_name[ndups] = $1
12325         dup_num[ndups] = $2
12326         ndups++ 
12327     }
12328     else {
12329         sig_name[$2] = $1
12330         sig_num[$2] = $2
12331     }
12332 }
12333 END { 
12334     if (nsig == 0) {
12335         nsig = maxsig + 1
12336     }
12337     printf("NSIG %d\n", nsig);
12338     for (n = 1; n < nsig; n++) {
12339         if (sig_name[n]) {
12340             printf("%s %d\n", sig_name[n], sig_num[n])
12341         }
12342         else {
12343             printf("NUM%d %d\n", n, n) 
12344         }
12345     }
12346     for (n = 0; n < ndups; n++) {
12347         printf("%s %d\n", dup_name[n], dup_num[n])
12348     }
12349 }
12350 EOP
12351 $cat >signal_cmd <<EOS
12352 $startsh
12353 if $test -s signal.lst; then
12354     echo "Using your existing signal.lst file"
12355         exit 0
12356 fi
12357 xxx="$xxx"
12358 EOS
12359 $cat >>signal_cmd <<'EOS'
12360
12361 set signal
12362 if eval $compile_ok; then
12363         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12364 else
12365         echo "(I can't seem be able to compile the whole test program)" >&4
12366         echo "(I'll try it in little pieces.)" >&4
12367         set signal -DJUST_NSIG
12368         if eval $compile_ok; then
12369                 ./signal$_exe > signal.nsg
12370                 $cat signal.nsg
12371         else
12372                 echo "I can't seem to figure out how many signals you have." >&4
12373                 echo "Guessing 50." >&4
12374                 echo 'NSIG 50' > signal.nsg
12375         fi
12376         : Now look at all the signal names, one at a time.
12377         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12378                 $cat > signal.c <<EOCP
12379 #include <sys/types.h>
12380 #include <signal.h>
12381 #include <stdio.h>
12382 int main() {
12383 printf("$xx %d\n", SIG${xx});
12384 return 0;
12385 }
12386 EOCP
12387                 set signal
12388                 if eval $compile; then
12389                         echo "SIG${xx} found."
12390                         ./signal$_exe  >> signal.ls1
12391                 else
12392                         echo "SIG${xx} NOT found."
12393                 fi
12394         done
12395         if $test -s signal.ls1; then
12396                 $cat signal.nsg signal.ls1 |
12397                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12398         fi
12399
12400 fi
12401 if $test -s signal.lst; then
12402         :
12403 else
12404         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12405         echo 'kill -l' >signal
12406         set X `csh -f <signal`
12407         $rm -f signal
12408         shift
12409         case $# in
12410         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12411         esac
12412         echo $@ | $tr ' ' $trnl | \
12413             $awk '{ printf "%s %d\n", $1, ++s; }
12414                   END { printf "NSIG %d\n", ++s }' >signal.lst
12415 fi
12416 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12417 EOS
12418 chmod a+x signal_cmd
12419 $eunicefix signal_cmd
12420
12421 : generate list of signal names
12422 echo " "
12423 case "$sig_name_init" in
12424 '') doinit=yes ;;
12425 *)  case "$sig_num_init" in
12426     ''|*,*) doinit=yes ;;
12427     esac ;;
12428 esac
12429 case "$doinit" in
12430 yes)
12431         echo "Generating a list of signal names and numbers..." >&4
12432         . ./signal_cmd
12433         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12434         sig_name=`$awk 'BEGIN { printf "ZERO " }
12435                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12436         sig_num=`$awk  'BEGIN { printf "0 " }
12437                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12438         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12439                              !/^NSIG/   { printf "\"%s\", ", $1 }
12440                              END        { printf "0\n" }' signal.lst`
12441         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12442                              !/^NSIG/   { printf "%d, ", $2}
12443                              END        { printf "0\n"}' signal.lst`
12444         ;;
12445 esac
12446 echo "The following $sig_count signals are available:"
12447 echo " "
12448 echo $sig_name | $awk \
12449 'BEGIN { linelen = 0 }
12450 {
12451         for (i = 1; i <= NF; i++) {
12452                 name = "SIG" $i " "
12453                 linelen = linelen + length(name)
12454                 if (linelen > 70) {
12455                         printf "\n"
12456                         linelen = length(name)
12457                 }
12458                 printf "%s", name
12459         }
12460         printf "\n"
12461 }'
12462 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12463
12464 : see what type is used for signed size_t
12465 set ssize_t ssizetype int stdio.h sys/types.h
12466 eval $typedef
12467 dflt="$ssizetype"
12468 $cat > ssize.c <<EOM
12469 #include <stdio.h>
12470 #include <sys/types.h>
12471 #define Size_t $sizetype
12472 #define SSize_t $dflt
12473 int main()
12474 {
12475         if (sizeof(Size_t) == sizeof(SSize_t))
12476                 printf("$dflt\n");
12477         else if (sizeof(Size_t) == sizeof(int))
12478                 printf("int\n");
12479         else 
12480                 printf("long\n");
12481         exit(0);
12482 }
12483 EOM
12484 echo " "
12485 set ssize
12486 if eval $compile_ok && ./ssize > /dev/null; then
12487         ssizetype=`./ssize`
12488         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12489 else
12490         $cat >&4 <<EOM
12491 Help! I can't compile and run the ssize_t test program: please enlighten me!
12492 (This is probably a misconfiguration in your system or libraries, and
12493 you really ought to fix it.  Still, I'll try anyway.)
12494
12495 I need a type that is the same size as $sizetype, but is guaranteed to
12496 be signed.  Common values are ssize_t, int and long.
12497
12498 EOM
12499         rp="What signed type is the same size as $sizetype?"
12500         . ./myread
12501         ssizetype="$ans"
12502 fi
12503 $rm -f ssize ssize.*
12504
12505 : see what type of char stdio uses.
12506 echo " "
12507 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12508         echo "Your stdio uses unsigned chars." >&4
12509         stdchar="unsigned char"
12510 else
12511         echo "Your stdio uses signed chars." >&4
12512         stdchar="char"
12513 fi
12514
12515 : see if time exists
12516 echo " "
12517 if test "X$d_time" = X -o X"$timetype" = X; then
12518     if set time val -f d_time; eval $csym; $val; then
12519                 echo 'time() found.' >&4
12520                 val="$define"
12521                 rp="What is the type returned by time() on this system?"
12522                 set time_t timetype long stdio.h sys/types.h
12523                 eval $typedef_ask
12524     else
12525                 echo 'time() not found, hope that will do.' >&4
12526                 val="$undef"
12527                 timetype='int';
12528     fi
12529     set d_time
12530     eval $setvar
12531 fi
12532
12533 : see what type uids are declared as in the kernel
12534 echo " "
12535 echo "Looking for the type for user ids returned by getuid()."
12536 set uid_t uidtype xxx stdio.h sys/types.h
12537 eval $typedef
12538 case "$uidtype" in
12539 xxx)
12540         xxx=`./findhdr sys/user.h`
12541         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12542         case $1 in
12543         unsigned) dflt="$1 $2" ;;
12544         *) dflt="$1" ;;
12545         esac
12546         ;;
12547 *) dflt="$uidtype";;
12548 esac
12549 case "$uidtype" in
12550 uid_t)  echo "uid_t found." ;;
12551 *)      rp="What is the type for user ids returned by getuid()?"
12552         . ./myread
12553         uidtype="$ans"
12554         ;;
12555 esac
12556
12557 : see if dbm.h is available
12558 : see if dbmclose exists
12559 set dbmclose d_dbmclose
12560 eval $inlibc
12561
12562 case "$d_dbmclose" in
12563 $define)
12564         set dbm.h i_dbm
12565         eval $inhdr
12566         case "$i_dbm" in
12567         $define)
12568                 val="$undef"
12569                 set i_rpcsvcdbm
12570                 eval $setvar
12571                 ;;
12572         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12573                 eval $inhdr
12574                 ;;
12575         esac
12576         ;;
12577 *)      echo "We won't be including <dbm.h>"
12578         val="$undef"
12579         set i_dbm
12580         eval $setvar
12581         val="$undef"
12582         set i_rpcsvcdbm
12583         eval $setvar
12584         ;;
12585 esac
12586
12587 : see if this is a sys/file.h system
12588 val=''
12589 set sys/file.h val
12590 eval $inhdr
12591
12592 : do we need to include sys/file.h ?
12593 case "$val" in
12594 "$define")
12595         echo " "
12596         if $h_sysfile; then
12597                 val="$define"
12598                 echo "We'll be including <sys/file.h>." >&4
12599         else
12600                 val="$undef"
12601                 echo "We won't be including <sys/file.h>." >&4
12602         fi
12603         ;;
12604 *)
12605         h_sysfile=false
12606         ;;
12607 esac
12608 set i_sysfile
12609 eval $setvar
12610
12611 : see if fcntl.h is there
12612 val=''
12613 set fcntl.h val
12614 eval $inhdr
12615
12616 : see if we can include fcntl.h
12617 case "$val" in
12618 "$define")
12619         echo " "
12620         if $h_fcntl; then
12621                 val="$define"
12622                 echo "We'll be including <fcntl.h>." >&4
12623         else
12624                 val="$undef"
12625                 if $h_sysfile; then
12626         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12627                 else
12628                         echo "We won't be including <fcntl.h>." >&4
12629                 fi
12630         fi
12631         ;;
12632 *)
12633         h_fcntl=false
12634         val="$undef"
12635         ;;
12636 esac
12637 set i_fcntl
12638 eval $setvar
12639
12640 : see if locale.h is available
12641 set locale.h i_locale
12642 eval $inhdr
12643
12644 : see if mach cthreads are available
12645 if test "X$usethreads" = "X$define"; then
12646         set mach/cthreads.h i_machcthr
12647         eval $inhdr
12648 else
12649         i_machcthr="$undef"
12650 fi
12651
12652
12653
12654 : see if this is a math.h system
12655 set math.h i_math
12656 eval $inhdr
12657
12658 : see if this is a mntent.h system
12659 set mntent.h i_mntent
12660 eval $inhdr
12661
12662 : see if ndbm.h is available
12663 set ndbm.h t_ndbm
12664 eval $inhdr
12665 case "$t_ndbm" in
12666 $define)
12667         : see if dbm_open exists
12668         set dbm_open d_dbm_open
12669         eval $inlibc
12670         case "$d_dbm_open" in
12671         $undef)
12672                 t_ndbm="$undef"
12673                 echo "We won't be including <ndbm.h>"
12674                 ;;
12675         esac
12676         ;;
12677 esac
12678 val="$t_ndbm"
12679 set i_ndbm
12680 eval $setvar
12681
12682 : see if net/errno.h is available
12683 val=''
12684 set net/errno.h val
12685 eval $inhdr
12686
12687 : Unfortunately, it causes problems on some systems.  Arrgh.
12688 case "$val" in
12689 $define)
12690         cat > try.c <<'EOM'
12691 #include <stdio.h>
12692 #include <errno.h>
12693 #include <net/errno.h>
12694 int func()
12695 {
12696         return ENOTSOCK;
12697 }
12698 EOM
12699         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12700                 echo "We'll be including <net/errno.h>." >&4
12701         else
12702                 echo "We won't be including <net/errno.h>." >&4
12703                 val="$undef"
12704         fi
12705         $rm -f try.* try
12706         ;;
12707 esac
12708 set i_neterrno
12709 eval $setvar
12710
12711 : see if netinet/tcp.h is available
12712 set netinet/tcp.h i_netinettcp
12713 eval $inhdr
12714
12715 : see if this is a poll.h system
12716 set poll.h i_poll
12717 eval $inhdr
12718
12719 : get C preprocessor symbols handy
12720 echo " "
12721 $echo $n "Hmm... $c"
12722 echo $al | $tr ' ' $trnl >Cppsym.know
12723 $cat <<EOSS >Cppsym
12724 $startsh
12725 case "\$1" in
12726 -l) list=true
12727         shift
12728         ;;
12729 esac
12730 unknown=''
12731 case "\$list\$#" in
12732 1|2)
12733         for sym do
12734                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12735                         exit 0
12736                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12737                         :
12738                 else
12739                         unknown="\$unknown \$sym"
12740                 fi
12741         done
12742         set X \$unknown
12743         shift
12744         ;;
12745 esac
12746 case \$# in
12747 0) exit 1;;
12748 esac
12749 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12750 #ifdef \1\\
12751 exit 0; _ _ _ _\1\\      \1\\
12752 #endif\\
12753 /' >Cppsym\$\$
12754 echo "exit 1; _ _ _" >>Cppsym\$\$
12755 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12756 case "\$list" in
12757 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12758 *)
12759         sh Cppsym2\$\$
12760         status=\$?
12761         ;;
12762 esac
12763 $rm -f Cppsym\$\$ Cppsym2\$\$
12764 exit \$status
12765 EOSS
12766 chmod +x Cppsym
12767 $eunicefix Cppsym
12768 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12769
12770 : now check the C compiler for additional symbols
12771 postprocess_cc_v=''
12772 case "$osname" in
12773 aix) postprocess_cc_v="|$tr , ' '" ;;
12774 esac
12775 $cat >ccsym <<EOS
12776 $startsh
12777 $cat >tmp.c <<EOF
12778 extern int foo;
12779 EOF
12780 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12781 do
12782         case "\$i" in
12783         -D*) echo "\$i" | $sed 's/^-D//';;
12784         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12785         esac
12786 done
12787 $rm -f try.c
12788 EOS
12789 postprocess_cc_v=''
12790 chmod +x ccsym
12791 $eunicefix ccsym
12792 ./ccsym > ccsym1.raw
12793 if $test -s ccsym1.raw; then
12794        $sort ccsym1.raw | $uniq >ccsym.raw
12795 else
12796        mv ccsym1.raw ccsym.raw
12797 fi
12798
12799 $awk '/\=/ { print $0; next }
12800         { print $0"=1" }' ccsym.raw >ccsym.list
12801 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12802 $comm -13 ccsym.true ccsym.list >ccsym.own
12803 $comm -12 ccsym.true ccsym.list >ccsym.com
12804 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12805 also=''
12806 if $test -z ccsym.raw; then
12807         echo "Your C compiler doesn't seem to define any symbols!" >&4
12808         echo " "
12809         echo "However, your C preprocessor defines the following symbols:"
12810         $cat Cppsym.true
12811         ccsymbols=''
12812         cppsymbols=`$cat Cppsym.true`
12813         cppsymbols=`echo $cppsymbols`
12814         cppccsymbols="$cppsymbols"
12815 else
12816         if $test -s ccsym.com; then
12817                 echo "Your C compiler and pre-processor define these symbols:"
12818                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12819                 also='also '
12820                 symbols='ones'
12821                 cppccsymbols=`$cat ccsym.com`
12822                 cppccsymbols=`echo $cppccsymbols`
12823                 $test "$silent" || sleep 1
12824         fi
12825         if $test -s ccsym.cpp; then
12826                 $test "$also" && echo " "
12827                 echo "Your C pre-processor ${also}defines the following symbols:"
12828                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12829                 also='further '
12830                 cppsymbols=`$cat ccsym.cpp`
12831                 cppsymbols=`echo $cppsymbols`
12832                 $test "$silent" || sleep 1
12833         fi
12834         if $test -s ccsym.own; then
12835                 $test "$also" && echo " "
12836                 echo "Your C compiler ${also}defines the following cpp symbols:"
12837                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12838                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12839                 ccsymbols=`$cat ccsym.own`
12840                 ccsymbols=`echo $ccsymbols`
12841                 $test "$silent" || sleep 1
12842         fi
12843 fi
12844 $rm -f ccsym*
12845
12846 : see if this is a termio system
12847 val="$undef"
12848 val2="$undef"
12849 val3="$undef"
12850 if $test `./findhdr termios.h`; then
12851         set tcsetattr i_termios
12852         eval $inlibc
12853         val3="$i_termios"
12854 fi
12855 echo " "
12856 case "$val3" in
12857 "$define") echo "You have POSIX termios.h... good!" >&4;;
12858 *) if ./Cppsym pyr; then
12859                 case "`/bin/universe`" in
12860                 ucb) if $test `./findhdr sgtty.h`; then
12861                                 val2="$define"
12862                                 echo "<sgtty.h> found." >&4
12863                         else
12864                                 echo "System is pyramid with BSD universe."
12865                                 echo "<sgtty.h> not found--you could have problems." >&4
12866                         fi;;
12867                 *) if $test `./findhdr termio.h`; then
12868                                 val="$define"
12869                                 echo "<termio.h> found." >&4
12870                         else
12871                                 echo "System is pyramid with USG universe."
12872                                 echo "<termio.h> not found--you could have problems." >&4
12873                         fi;;
12874                 esac
12875         elif ./usg; then
12876                 if $test `./findhdr termio.h`; then
12877                         echo "<termio.h> found." >&4
12878                         val="$define"
12879                 elif $test `./findhdr sgtty.h`; then
12880                         echo "<sgtty.h> found." >&4
12881                         val2="$define"
12882                 else
12883 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12884                 fi
12885         else
12886                 if $test `./findhdr sgtty.h`; then
12887                         echo "<sgtty.h> found." >&4
12888                         val2="$define"
12889                 elif $test `./findhdr termio.h`; then
12890                         echo "<termio.h> found." >&4
12891                         val="$define"
12892                 else
12893 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12894                 fi
12895         fi;;
12896 esac
12897 set i_termio; eval $setvar
12898 val=$val2; set i_sgtty; eval $setvar
12899 val=$val3; set i_termios; eval $setvar
12900
12901 : see if this is a shadow.h system
12902 set shadow.h i_shadow
12903 eval $inhdr
12904
12905 : see if this is a socks.h system
12906 set socks.h i_socks
12907 eval $inhdr
12908
12909 : see if stdarg is available
12910 echo " "
12911 if $test `./findhdr stdarg.h`; then
12912         echo "<stdarg.h> found." >&4
12913         valstd="$define"
12914 else
12915         echo "<stdarg.h> NOT found." >&4
12916         valstd="$undef"
12917 fi
12918
12919 : see if varags is available
12920 echo " "
12921 if $test `./findhdr varargs.h`; then
12922         echo "<varargs.h> found." >&4
12923 else
12924         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12925 fi
12926
12927 : set up the varargs testing programs
12928 $cat > varargs.c <<EOP
12929 #ifdef I_STDARG
12930 #include <stdarg.h>
12931 #endif
12932 #ifdef I_VARARGS
12933 #include <varargs.h>
12934 #endif
12935
12936 #ifdef I_STDARG
12937 int f(char *p, ...)
12938 #else
12939 int f(va_alist)
12940 va_dcl
12941 #endif
12942 {
12943         va_list ap;
12944 #ifndef I_STDARG
12945         char *p;
12946 #endif
12947 #ifdef I_STDARG
12948         va_start(ap,p);
12949 #else
12950         va_start(ap);
12951         p = va_arg(ap, char *);
12952 #endif
12953         va_end(ap);
12954 }
12955 EOP
12956 $cat > varargs <<EOP
12957 $startsh
12958 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12959         echo "true"
12960 else
12961         echo "false"
12962 fi
12963 $rm -f varargs$_o
12964 EOP
12965 chmod +x varargs
12966
12967 : now check which varargs header should be included
12968 echo " "
12969 i_varhdr=''
12970 case "$valstd" in
12971 "$define")
12972         if `./varargs I_STDARG`; then
12973                 val='stdarg.h'
12974         elif `./varargs I_VARARGS`; then
12975                 val='varargs.h'
12976         fi
12977         ;;
12978 *)
12979         if `./varargs I_VARARGS`; then
12980                 val='varargs.h'
12981         fi
12982         ;;
12983 esac
12984 case "$val" in
12985 '')
12986 echo "I could not find the definition for va_dcl... You have problems..." >&4
12987         val="$undef"; set i_stdarg; eval $setvar
12988         val="$undef"; set i_varargs; eval $setvar
12989         ;;
12990 *) 
12991         set i_varhdr
12992         eval $setvar
12993         case "$i_varhdr" in
12994         stdarg.h)
12995                 val="$define"; set i_stdarg; eval $setvar
12996                 val="$undef"; set i_varargs; eval $setvar
12997                 ;;
12998         varargs.h)
12999                 val="$undef"; set i_stdarg; eval $setvar
13000                 val="$define"; set i_varargs; eval $setvar
13001                 ;;
13002         esac
13003         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13004 esac
13005 $rm -f varargs*
13006
13007 : see if stddef is available
13008 set stddef.h i_stddef
13009 eval $inhdr
13010
13011 : see if sys/access.h is available
13012 set sys/access.h i_sysaccess
13013 eval $inhdr
13014
13015 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13016 set sys/filio.h i_sysfilio
13017 eval $inhdr
13018 echo " "
13019 if $test `./findhdr sys/ioctl.h`; then
13020         val="$define"
13021         echo '<sys/ioctl.h> found.' >&4
13022 else
13023         val="$undef"
13024         if $test $i_sysfilio = "$define"; then
13025             echo '<sys/ioctl.h> NOT found.' >&4
13026         else
13027                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13028                 $test $i_termio = "$define" && xxx="termio.h"
13029                 $test $i_termios = "$define" && xxx="termios.h"
13030 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13031         fi
13032 fi
13033 set i_sysioctl
13034 eval $setvar
13035
13036 : see if sys/resource.h has to be included
13037 set sys/resource.h i_sysresrc
13038 eval $inhdr
13039
13040 : see if sys/security.h is available
13041 set sys/security.h i_syssecrt
13042 eval $inhdr
13043
13044 : see if this is a sys/statvfs.h system
13045 set sys/statvfs.h i_sysstatvfs
13046 eval $inhdr
13047
13048 : see if this is a sys/un.h system
13049 set sys/un.h i_sysun
13050 eval $inhdr
13051
13052 : see if this is a syswait system
13053 set sys/wait.h i_syswait
13054 eval $inhdr
13055
13056 : see if this is an utime system
13057 set utime.h i_utime
13058 eval $inhdr
13059
13060 : see if this is a values.h system
13061 set values.h i_values
13062 eval $inhdr
13063
13064 : see if this is a vfork system
13065 case "$d_vfork" in
13066 "$define")
13067         set vfork.h i_vfork
13068         eval $inhdr
13069         ;;
13070 *)
13071         i_vfork="$undef"
13072         ;;
13073 esac
13074
13075 : see if gdbm.h is available
13076 set gdbm.h t_gdbm
13077 eval $inhdr
13078 case "$t_gdbm" in
13079 $define)
13080         : see if gdbm_open exists
13081         set gdbm_open d_gdbm_open
13082         eval $inlibc
13083         case "$d_gdbm_open" in
13084         $undef)
13085                 t_gdbm="$undef"
13086                 echo "We won't be including <gdbm.h>"
13087                 ;;
13088         esac
13089         ;;
13090 esac
13091 val="$t_gdbm"
13092 set i_gdbm
13093 eval $setvar
13094
13095 echo " "
13096 echo "Looking for extensions..." >&4
13097 : If we are using the old config.sh, known_extensions may contain
13098 : old or inaccurate or duplicate values.
13099 known_extensions=''
13100 nonxs_extensions=''
13101 : We do not use find because it might not be available.
13102 : We do not just use MANIFEST because the user may have dropped
13103 : some additional extensions into the source tree and expect them
13104 : to be built.
13105
13106 : Function to recursively find available extensions, ignoring DynaLoader
13107 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13108 find_extensions='
13109     for xxx in *; do
13110        case "$xxx" in
13111            DynaLoader|dynaload) ;;
13112            *)
13113            if $test -f $xxx/$xxx.xs; then
13114                known_extensions="$known_extensions $1$xxx";
13115            elif $test -f $xxx/Makefile.PL; then
13116                nonxs_extensions="$nonxs_extensions $1$xxx";
13117            else
13118                if $test -d $xxx -a $# -lt 10; then
13119                    set $1$xxx/ $*;
13120                    cd $xxx;
13121                    eval $find_extensions;
13122                    cd ..;
13123                    shift;
13124                fi;
13125            fi
13126            ;;
13127        esac;
13128     done'
13129 tdir=`pwd`
13130 cd $rsrc/ext
13131 set X
13132 shift
13133 eval $find_extensions
13134 set X $nonxs_extensions
13135 shift
13136 nonxs_extensions="$*"
13137 set X $known_extensions
13138 shift
13139 known_extensions="$*"
13140 cd $tdir
13141
13142 : Now see which are supported on this system.
13143 avail_ext=''
13144 for xxx in $known_extensions ; do
13145         case "$xxx" in
13146         DB_File|db_file)
13147                 case "$i_db" in
13148                 $define) avail_ext="$avail_ext $xxx" ;;
13149                 esac
13150                 ;;
13151         GDBM_File|gdbm_fil)
13152                 case "$i_gdbm" in 
13153                 $define) avail_ext="$avail_ext $xxx" ;;
13154                 esac
13155                 ;;
13156         NDBM_File|ndbm_fil)
13157                 case "$i_ndbm" in
13158                 $define) avail_ext="$avail_ext $xxx" ;;
13159                 esac
13160                 ;;
13161         ODBM_File|odbm_fil) 
13162                 case "${i_dbm}${i_rpcsvcdbm}" in
13163                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13164                 esac
13165                 ;;
13166         POSIX|posix)
13167                 case "$useposix" in
13168                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13169                 esac
13170                 ;;
13171         Opcode|opcode)
13172                 case "$useopcode" in
13173                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13174                 esac
13175                 ;;
13176         Socket|socket)
13177                 case "$d_socket" in 
13178                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13179                 esac
13180                 ;;
13181         Thread|thread)
13182                 case "$usethreads" in 
13183                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13184                 esac
13185                 ;;
13186         IPC/SysV|ipc/sysv)
13187                 : XXX Do we need a useipcsysv variable here
13188                 case "${d_msg}${d_sem}${d_shm}" in 
13189                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13190                 esac
13191                 ;;
13192         *)      avail_ext="$avail_ext $xxx"
13193                 ;;
13194         esac
13195 done
13196
13197 set X $avail_ext
13198 shift
13199 avail_ext="$*"
13200
13201 : Now see which nonxs extensions are supported on this system.
13202 : For now assume all are.
13203 nonxs_ext=''
13204 for xxx in $nonxs_extensions ; do
13205         case "$xxx" in
13206         *)      nonxs_ext="$nonxs_ext $xxx"
13207                 ;;
13208         esac
13209 done
13210
13211 set X $nonxs_ext
13212 shift
13213 nonxs_ext="$*"
13214
13215 case $usedl in
13216 $define)
13217         $cat <<EOM
13218 A number of extensions are supplied with $package.  You may choose to
13219 compile these extensions for dynamic loading (the default), compile
13220 them into the $package executable (static loading), or not include
13221 them at all.  Answer "none" to include no extensions.
13222 Note that DynaLoader is always built and need not be mentioned here.
13223
13224 EOM
13225         case "$dynamic_ext" in
13226         '') dflt="$avail_ext" ;;
13227         *)      dflt="$dynamic_ext"
13228                 # Perhaps we are reusing an old out-of-date config.sh.
13229                 case "$hint" in
13230                 previous)
13231                         if test X"$dynamic_ext" != X"$avail_ext"; then
13232                                 $cat <<EOM
13233 NOTICE:  Your previous config.sh list may be incorrect. 
13234 The extensions now available to you are 
13235         ${avail_ext}
13236 but the default list from your previous config.sh is
13237         ${dynamic_ext} 
13238
13239 EOM
13240                         fi
13241                         ;;
13242                 esac
13243                 ;;
13244         esac
13245         case "$dflt" in
13246         '')     dflt=none;;
13247         esac
13248         rp="What extensions do you wish to load dynamically?"
13249         . ./myread
13250         case "$ans" in
13251         none) dynamic_ext=' ' ;;
13252         *) dynamic_ext="$ans" ;;
13253         esac
13254
13255         case "$static_ext" in
13256         '')
13257                 : Exclude those already listed in dynamic linking
13258                 dflt=''
13259                 for xxx in $avail_ext; do
13260                         case " $dynamic_ext " in
13261                         *" $xxx "*) ;;
13262                         *) dflt="$dflt $xxx" ;;
13263                         esac
13264                 done
13265                 set X $dflt
13266                 shift
13267                 dflt="$*"
13268                 ;;
13269         *)  dflt="$static_ext" 
13270                 ;;
13271         esac
13272
13273         case "$dflt" in
13274         '')     dflt=none;;
13275         esac
13276         rp="What extensions do you wish to load statically?"
13277         . ./myread
13278         case "$ans" in
13279         none) static_ext=' ' ;;
13280         *) static_ext="$ans" ;;
13281         esac
13282         ;;
13283 *)
13284         $cat <<EOM
13285 A number of extensions are supplied with $package.  Answer "none" 
13286 to include no extensions. 
13287 Note that DynaLoader is always built and need not be mentioned here.
13288
13289 EOM
13290         case "$static_ext" in
13291         '') dflt="$avail_ext" ;;
13292         *)      dflt="$static_ext"
13293                 # Perhaps we are reusing an old out-of-date config.sh.
13294                 case "$hint" in
13295                 previous)
13296                         if test X"$static_ext" != X"$avail_ext"; then
13297                                 $cat <<EOM
13298 NOTICE:  Your previous config.sh list may be incorrect. 
13299 The extensions now available to you are 
13300         ${avail_ext}
13301 but the default list from your previous config.sh is
13302         ${static_ext} 
13303
13304 EOM
13305                         fi
13306                         ;;
13307                 esac
13308                 ;;
13309         esac
13310         : Exclude those that are not xs extensions
13311         case "$dflt" in
13312         '')     dflt=none;;
13313         esac
13314         rp="What extensions do you wish to include?"
13315         . ./myread
13316         case "$ans" in
13317         none) static_ext=' ' ;;
13318         *) static_ext="$ans" ;;
13319         esac
13320         ;;
13321 esac
13322
13323 set X $dynamic_ext $static_ext $nonxs_ext
13324 shift
13325 extensions="$*"
13326
13327 : Remove build directory name from cppstdin so it can be used from
13328 : either the present location or the final installed location.
13329 echo " "
13330 : Get out of the UU directory to get correct path name.
13331 cd ..
13332 case "$cppstdin" in
13333 `pwd`/cppstdin)
13334         echo "Stripping down cppstdin path name"
13335         cppstdin=cppstdin
13336         ;;
13337 esac
13338 cd UU
13339
13340 : end of configuration questions
13341 echo " "
13342 echo "End of configuration questions."
13343 echo " "
13344
13345 : back to where it started
13346 if test -d ../UU; then
13347         cd ..
13348 fi
13349
13350 : configuration may be patched via a 'config.over' file
13351 if $test -f config.over; then
13352         echo " "
13353         dflt=y
13354         rp='I see a config.over file.  Do you wish to load it?'
13355         . UU/myread
13356         case "$ans" in
13357         n*) echo "OK, I'll ignore it.";;
13358         *)      . ./config.over
13359                 echo "Configuration override changes have been loaded."
13360                 ;;
13361         esac
13362 fi
13363
13364 : in case they want portability, strip down executable paths
13365 case "$d_portable" in
13366 "$define")
13367         echo " "
13368         echo "Stripping down executable paths..." >&4
13369         for file in $loclist $trylist; do
13370                 eval temp=\$$file
13371                 eval $file=`basename $temp`
13372         done
13373         ;;
13374 esac
13375
13376 : create config.sh file
13377 echo " "
13378 echo "Creating config.sh..." >&4
13379 $spitshell <<EOT >config.sh
13380 $startsh
13381 #
13382 # This file was produced by running the Configure script. It holds all the
13383 # definitions figured out by Configure. Should you modify one of these values,
13384 # do not forget to propagate your changes by running "Configure -der". You may
13385 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13386 #
13387
13388 # Package name      : $package
13389 # Source directory  : $src
13390 # Configuration time: $cf_time
13391 # Configured by     : $cf_by
13392 # Target system     : $myuname
13393
13394 Author='$Author'
13395 Date='$Date'
13396 Header='$Header'
13397 Id='$Id'
13398 Locker='$Locker'
13399 Log='$Log'
13400 Mcc='$Mcc'
13401 RCSfile='$RCSfile'
13402 Revision='$Revision'
13403 Source='$Source'
13404 State='$State'
13405 _a='$_a'
13406 _exe='$_exe'
13407 _o='$_o'
13408 afs='$afs'
13409 alignbytes='$alignbytes'
13410 ansi2knr='$ansi2knr'
13411 aphostname='$aphostname'
13412 apiversion='$apiversion'
13413 ar='$ar'
13414 archlib='$archlib'
13415 archlibexp='$archlibexp'
13416 archname64='$archname64'
13417 archname='$archname'
13418 archobjs='$archobjs'
13419 awk='$awk'
13420 baserev='$baserev'
13421 bash='$bash'
13422 bin='$bin'
13423 bincompat5005='$bincompat5005'
13424 binexp='$binexp'
13425 bison='$bison'
13426 byacc='$byacc'
13427 byteorder='$byteorder'
13428 c='$c'
13429 castflags='$castflags'
13430 cat='$cat'
13431 cc='$cc'
13432 cccdlflags='$cccdlflags'
13433 ccdlflags='$ccdlflags'
13434 ccflags='$ccflags'
13435 ccsymbols='$ccsymbols'
13436 cf_by='$cf_by'
13437 cf_email='$cf_email'
13438 cf_time='$cf_time'
13439 chgrp='$chgrp'
13440 chmod='$chmod'
13441 chown='$chown'
13442 clocktype='$clocktype'
13443 comm='$comm'
13444 compress='$compress'
13445 contains='$contains'
13446 cp='$cp'
13447 cpio='$cpio'
13448 cpp='$cpp'
13449 cpp_stuff='$cpp_stuff'
13450 cppccsymbols='$cppccsymbols'
13451 cppflags='$cppflags'
13452 cpplast='$cpplast'
13453 cppminus='$cppminus'
13454 cpprun='$cpprun'
13455 cppstdin='$cppstdin'
13456 cppsymbols='$cppsymbols'
13457 crosscompile='$crosscompile'
13458 cryptlib='$cryptlib'
13459 csh='$csh'
13460 d_Gconvert='$d_Gconvert'
13461 d_PRIEldbl='$d_PRIEldbl'
13462 d_PRIFldbl='$d_PRIFldbl'
13463 d_PRIGldbl='$d_PRIGldbl'
13464 d_PRIX64='$d_PRIX64'
13465 d_PRId64='$d_PRId64'
13466 d_PRIeldbl='$d_PRIeldbl'
13467 d_PRIfldbl='$d_PRIfldbl'
13468 d_PRIgldbl='$d_PRIgldbl'
13469 d_PRIi64='$d_PRIi64'
13470 d_PRIo64='$d_PRIo64'
13471 d_PRIu64='$d_PRIu64'
13472 d_PRIx64='$d_PRIx64'
13473 d_access='$d_access'
13474 d_accessx='$d_accessx'
13475 d_alarm='$d_alarm'
13476 d_archlib='$d_archlib'
13477 d_atolf='$d_atolf'
13478 d_atoll='$d_atoll'
13479 d_attribut='$d_attribut'
13480 d_bcmp='$d_bcmp'
13481 d_bcopy='$d_bcopy'
13482 d_bincompat5005='$d_bincompat5005'
13483 d_bsd='$d_bsd'
13484 d_bsdgetpgrp='$d_bsdgetpgrp'
13485 d_bsdsetpgrp='$d_bsdsetpgrp'
13486 d_bzero='$d_bzero'
13487 d_casti32='$d_casti32'
13488 d_castneg='$d_castneg'
13489 d_charvspr='$d_charvspr'
13490 d_chown='$d_chown'
13491 d_chroot='$d_chroot'
13492 d_chsize='$d_chsize'
13493 d_closedir='$d_closedir'
13494 d_cmsghdr_s='$d_cmsghdr_s'
13495 d_const='$d_const'
13496 d_crypt='$d_crypt'
13497 d_csh='$d_csh'
13498 d_cuserid='$d_cuserid'
13499 d_dbl_dig='$d_dbl_dig'
13500 d_dbmclose64='$d_dbmclose64'
13501 d_dbminit64='$d_dbminit64'
13502 d_delete64='$d_delete64'
13503 d_difftime='$d_difftime'
13504 d_dirent64_s='$d_dirent64_s'
13505 d_dirnamlen='$d_dirnamlen'
13506 d_dlerror='$d_dlerror'
13507 d_dlopen='$d_dlopen'
13508 d_dlsymun='$d_dlsymun'
13509 d_dosuid='$d_dosuid'
13510 d_drand48proto='$d_drand48proto'
13511 d_dup2='$d_dup2'
13512 d_eaccess='$d_eaccess'
13513 d_endgrent='$d_endgrent'
13514 d_endhent='$d_endhent'
13515 d_endnent='$d_endnent'
13516 d_endpent='$d_endpent'
13517 d_endpwent='$d_endpwent'
13518 d_endsent='$d_endsent'
13519 d_endspent='$d_endspent'
13520 d_eofnblk='$d_eofnblk'
13521 d_eunice='$d_eunice'
13522 d_fchmod='$d_fchmod'
13523 d_fchown='$d_fchown'
13524 d_fcntl='$d_fcntl'
13525 d_fd_macros='$d_fd_macros'
13526 d_fd_set='$d_fd_set'
13527 d_fds_bits='$d_fds_bits'
13528 d_fetch64='$d_fetch64'
13529 d_fgetpos64='$d_fgetpos64'
13530 d_fgetpos='$d_fgetpos'
13531 d_firstkey64='$d_firstkey64'
13532 d_flexfnam='$d_flexfnam'
13533 d_flock64_s='$d_flock64_s'
13534 d_flock='$d_flock'
13535 d_fopen64='$d_fopen64'
13536 d_fork='$d_fork'
13537 d_fpathconf='$d_fpathconf'
13538 d_freopen64='$d_freopen64'
13539 d_fseek64='$d_fseek64'
13540 d_fseeko64='$d_fseeko64'
13541 d_fseeko='$d_fseeko'
13542 d_fsetpos64='$d_fsetpos64'
13543 d_fsetpos='$d_fsetpos'
13544 d_fstat64='$d_fstat64'
13545 d_fstatfs='$d_fstatfs'
13546 d_fstatvfs='$d_fstatvfs'
13547 d_ftell64='$d_ftell64'
13548 d_ftello64='$d_ftello64'
13549 d_ftello='$d_ftello'
13550 d_ftime='$d_ftime'
13551 d_ftruncate64='$d_ftruncate64'
13552 d_getgrent='$d_getgrent'
13553 d_getgrps='$d_getgrps'
13554 d_gethbyaddr='$d_gethbyaddr'
13555 d_gethbyname='$d_gethbyname'
13556 d_gethent='$d_gethent'
13557 d_gethname='$d_gethname'
13558 d_gethostprotos='$d_gethostprotos'
13559 d_getlogin='$d_getlogin'
13560 d_getmntent='$d_getmntent'
13561 d_getnbyaddr='$d_getnbyaddr'
13562 d_getnbyname='$d_getnbyname'
13563 d_getnent='$d_getnent'
13564 d_getnetprotos='$d_getnetprotos'
13565 d_getpbyname='$d_getpbyname'
13566 d_getpbynumber='$d_getpbynumber'
13567 d_getpent='$d_getpent'
13568 d_getpgid='$d_getpgid'
13569 d_getpgrp2='$d_getpgrp2'
13570 d_getpgrp='$d_getpgrp'
13571 d_getppid='$d_getppid'
13572 d_getprior='$d_getprior'
13573 d_getprotoprotos='$d_getprotoprotos'
13574 d_getpwent='$d_getpwent'
13575 d_getsbyname='$d_getsbyname'
13576 d_getsbyport='$d_getsbyport'
13577 d_getsent='$d_getsent'
13578 d_getservprotos='$d_getservprotos'
13579 d_getspent='$d_getspent'
13580 d_getspnam='$d_getspnam'
13581 d_gettimeod='$d_gettimeod'
13582 d_gnulibc='$d_gnulibc'
13583 d_grpasswd='$d_grpasswd'
13584 d_hasmntopt='$d_hasmntopt'
13585 d_htonl='$d_htonl'
13586 d_index='$d_index'
13587 d_inetaton='$d_inetaton'
13588 d_ino64_t='$d_ino64_t'
13589 d_int64t='$d_int64t'
13590 d_iovec_s='$d_iovec_s'
13591 d_isascii='$d_isascii'
13592 d_killpg='$d_killpg'
13593 d_lchown='$d_lchown'
13594 d_link='$d_link'
13595 d_llseek='$d_llseek'
13596 d_locconv='$d_locconv'
13597 d_lockf64='$d_lockf64'
13598 d_lockf='$d_lockf'
13599 d_longdbl='$d_longdbl'
13600 d_longlong='$d_longlong'
13601 d_lseek64='$d_lseek64'
13602 d_lstat64='$d_lstat64'
13603 d_lstat='$d_lstat'
13604 d_madvise='$d_madvise'
13605 d_mblen='$d_mblen'
13606 d_mbstowcs='$d_mbstowcs'
13607 d_mbtowc='$d_mbtowc'
13608 d_memchr='$d_memchr'
13609 d_memcmp='$d_memcmp'
13610 d_memcpy='$d_memcpy'
13611 d_memmove='$d_memmove'
13612 d_memset='$d_memset'
13613 d_mkdir='$d_mkdir'
13614 d_mkfifo='$d_mkfifo'
13615 d_mktime='$d_mktime'
13616 d_mmap='$d_mmap'
13617 d_mprotect='$d_mprotect'
13618 d_msg='$d_msg'
13619 d_msg_ctrunc='$d_msg_ctrunc'
13620 d_msg_dontroute='$d_msg_dontroute'
13621 d_msg_oob='$d_msg_oob'
13622 d_msg_peek='$d_msg_peek'
13623 d_msg_proxy='$d_msg_proxy'
13624 d_msgctl='$d_msgctl'
13625 d_msgget='$d_msgget'
13626 d_msghdr_s='$d_msghdr_s'
13627 d_msgrcv='$d_msgrcv'
13628 d_msgsnd='$d_msgsnd'
13629 d_msync='$d_msync'
13630 d_munmap='$d_munmap'
13631 d_mymalloc='$d_mymalloc'
13632 d_nextkey64='$d_nextkey64'
13633 d_nice='$d_nice'
13634 d_off64_t='$d_off64_t'
13635 d_offset_t='$d_offset_t'
13636 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13637 d_oldpthreads='$d_oldpthreads'
13638 d_oldsock='$d_oldsock'
13639 d_open3='$d_open3'
13640 d_open64='$d_open64'
13641 d_opendir64='$d_opendir64'
13642 d_pathconf='$d_pathconf'
13643 d_pause='$d_pause'
13644 d_phostname='$d_phostname'
13645 d_pipe='$d_pipe'
13646 d_poll='$d_poll'
13647 d_portable='$d_portable'
13648 d_pthread_yield='$d_pthread_yield'
13649 d_pwage='$d_pwage'
13650 d_pwchange='$d_pwchange'
13651 d_pwclass='$d_pwclass'
13652 d_pwcomment='$d_pwcomment'
13653 d_pwexpire='$d_pwexpire'
13654 d_pwgecos='$d_pwgecos'
13655 d_pwpasswd='$d_pwpasswd'
13656 d_pwquota='$d_pwquota'
13657 d_readdir64='$d_readdir64'
13658 d_readdir='$d_readdir'
13659 d_readlink='$d_readlink'
13660 d_readv='$d_readv'
13661 d_recvmsg='$d_recvmsg'
13662 d_rename='$d_rename'
13663 d_rewinddir='$d_rewinddir'
13664 d_rmdir='$d_rmdir'
13665 d_safebcpy='$d_safebcpy'
13666 d_safemcpy='$d_safemcpy'
13667 d_sanemcmp='$d_sanemcmp'
13668 d_sched_yield='$d_sched_yield'
13669 d_scm_rights='$d_scm_rights'
13670 d_seekdir64='$d_seekdir64'
13671 d_seekdir='$d_seekdir'
13672 d_select='$d_select'
13673 d_sem='$d_sem'
13674 d_semctl='$d_semctl'
13675 d_semctl_semid_ds='$d_semctl_semid_ds'
13676 d_semctl_semun='$d_semctl_semun'
13677 d_semget='$d_semget'
13678 d_semop='$d_semop'
13679 d_sendmsg='$d_sendmsg'
13680 d_setegid='$d_setegid'
13681 d_seteuid='$d_seteuid'
13682 d_setgrent='$d_setgrent'
13683 d_setgrps='$d_setgrps'
13684 d_sethent='$d_sethent'
13685 d_setlinebuf='$d_setlinebuf'
13686 d_setlocale='$d_setlocale'
13687 d_setnent='$d_setnent'
13688 d_setpent='$d_setpent'
13689 d_setpgid='$d_setpgid'
13690 d_setpgrp2='$d_setpgrp2'
13691 d_setpgrp='$d_setpgrp'
13692 d_setprior='$d_setprior'
13693 d_setpwent='$d_setpwent'
13694 d_setregid='$d_setregid'
13695 d_setresgid='$d_setresgid'
13696 d_setresuid='$d_setresuid'
13697 d_setreuid='$d_setreuid'
13698 d_setrgid='$d_setrgid'
13699 d_setruid='$d_setruid'
13700 d_setsent='$d_setsent'
13701 d_setsid='$d_setsid'
13702 d_setspent='$d_setspent'
13703 d_setvbuf='$d_setvbuf'
13704 d_sfio='$d_sfio'
13705 d_shm='$d_shm'
13706 d_shmat='$d_shmat'
13707 d_shmatprototype='$d_shmatprototype'
13708 d_shmctl='$d_shmctl'
13709 d_shmdt='$d_shmdt'
13710 d_shmget='$d_shmget'
13711 d_sigaction='$d_sigaction'
13712 d_sigsetjmp='$d_sigsetjmp'
13713 d_socket='$d_socket'
13714 d_sockpair='$d_sockpair'
13715 d_stat64='$d_stat64'
13716 d_statblks='$d_statblks'
13717 d_statfs='$d_statfs'
13718 d_statfsflags='$d_statfsflags'
13719 d_statvfs='$d_statvfs'
13720 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13721 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13722 d_stdio_stream_array='$d_stdio_stream_array'
13723 d_stdiobase='$d_stdiobase'
13724 d_stdstdio='$d_stdstdio'
13725 d_store64='$d_store64'
13726 d_strchr='$d_strchr'
13727 d_strcoll='$d_strcoll'
13728 d_strctcpy='$d_strctcpy'
13729 d_strerrm='$d_strerrm'
13730 d_strerror='$d_strerror'
13731 d_strtod='$d_strtod'
13732 d_strtol='$d_strtol'
13733 d_strtoul='$d_strtoul'
13734 d_strtoull='$d_strtoull'
13735 d_strxfrm='$d_strxfrm'
13736 d_suidsafe='$d_suidsafe'
13737 d_symlink='$d_symlink'
13738 d_syscall='$d_syscall'
13739 d_sysconf='$d_sysconf'
13740 d_sysernlst='$d_sysernlst'
13741 d_syserrlst='$d_syserrlst'
13742 d_system='$d_system'
13743 d_tcgetpgrp='$d_tcgetpgrp'
13744 d_tcsetpgrp='$d_tcsetpgrp'
13745 d_telldir64='$d_telldir64'
13746 d_telldir='$d_telldir'
13747 d_telldirproto='$d_telldirproto'
13748 d_time='$d_time'
13749 d_times='$d_times'
13750 d_tmpfile64='$d_tmpfile64'
13751 d_truncate64='$d_truncate64'
13752 d_truncate='$d_truncate'
13753 d_tzname='$d_tzname'
13754 d_umask='$d_umask'
13755 d_uname='$d_uname'
13756 d_union_semun='$d_union_semun'
13757 d_vendorlib='$d_vendorlib'
13758 d_vfork='$d_vfork'
13759 d_void_closedir='$d_void_closedir'
13760 d_voidsig='$d_voidsig'
13761 d_voidtty='$d_voidtty'
13762 d_volatile='$d_volatile'
13763 d_vprintf='$d_vprintf'
13764 d_wait4='$d_wait4'
13765 d_waitpid='$d_waitpid'
13766 d_wcstombs='$d_wcstombs'
13767 d_wctomb='$d_wctomb'
13768 d_writev='$d_writev'
13769 d_xenix='$d_xenix'
13770 date='$date'
13771 db_hashtype='$db_hashtype'
13772 db_prefixtype='$db_prefixtype'
13773 defvoidused='$defvoidused'
13774 direntrytype='$direntrytype'
13775 dlext='$dlext'
13776 dlsrc='$dlsrc'
13777 doublesize='$doublesize'
13778 drand01='$drand01'
13779 dynamic_ext='$dynamic_ext'
13780 eagain='$eagain'
13781 ebcdic='$ebcdic'
13782 echo='$echo'
13783 egrep='$egrep'
13784 emacs='$emacs'
13785 eunicefix='$eunicefix'
13786 exe_ext='$exe_ext'
13787 expr='$expr'
13788 extensions='$extensions'
13789 fflushNULL='$fflushNULL'
13790 fflushall='$fflushall'
13791 find='$find'
13792 firstmakefile='$firstmakefile'
13793 flex='$flex'
13794 fpostype='$fpostype'
13795 freetype='$freetype'
13796 full_ar='$full_ar'
13797 full_csh='$full_csh'
13798 full_sed='$full_sed'
13799 gccversion='$gccversion'
13800 gidtype='$gidtype'
13801 glibpth='$glibpth'
13802 grep='$grep'
13803 groupcat='$groupcat'
13804 groupstype='$groupstype'
13805 gzip='$gzip'
13806 h_fcntl='$h_fcntl'
13807 h_sysfile='$h_sysfile'
13808 hint='$hint'
13809 hostcat='$hostcat'
13810 huge='$huge'
13811 i_arpainet='$i_arpainet'
13812 i_bsdioctl='$i_bsdioctl'
13813 i_db='$i_db'
13814 i_dbm='$i_dbm'
13815 i_dirent='$i_dirent'
13816 i_dld='$i_dld'
13817 i_dlfcn='$i_dlfcn'
13818 i_fcntl='$i_fcntl'
13819 i_float='$i_float'
13820 i_gdbm='$i_gdbm'
13821 i_grp='$i_grp'
13822 i_inttypes='$i_inttypes'
13823 i_limits='$i_limits'
13824 i_locale='$i_locale'
13825 i_machcthr='$i_machcthr'
13826 i_malloc='$i_malloc'
13827 i_math='$i_math'
13828 i_memory='$i_memory'
13829 i_mntent='$i_mntent'
13830 i_ndbm='$i_ndbm'
13831 i_netdb='$i_netdb'
13832 i_neterrno='$i_neterrno'
13833 i_netinettcp='$i_netinettcp'
13834 i_niin='$i_niin'
13835 i_poll='$i_poll'
13836 i_pthread='$i_pthread'
13837 i_pwd='$i_pwd'
13838 i_rpcsvcdbm='$i_rpcsvcdbm'
13839 i_sfio='$i_sfio'
13840 i_sgtty='$i_sgtty'
13841 i_shadow='$i_shadow'
13842 i_socks='$i_socks'
13843 i_stdarg='$i_stdarg'
13844 i_stddef='$i_stddef'
13845 i_stdlib='$i_stdlib'
13846 i_string='$i_string'
13847 i_sysaccess='$i_sysaccess'
13848 i_sysdir='$i_sysdir'
13849 i_sysfile='$i_sysfile'
13850 i_sysfilio='$i_sysfilio'
13851 i_sysin='$i_sysin'
13852 i_sysioctl='$i_sysioctl'
13853 i_sysmman='$i_sysmman'
13854 i_sysmount='$i_sysmount'
13855 i_sysndir='$i_sysndir'
13856 i_sysparam='$i_sysparam'
13857 i_sysresrc='$i_sysresrc'
13858 i_syssecrt='$i_syssecrt'
13859 i_sysselct='$i_sysselct'
13860 i_syssockio='$i_syssockio'
13861 i_sysstat='$i_sysstat'
13862 i_sysstatvfs='$i_sysstatvfs'
13863 i_systime='$i_systime'
13864 i_systimek='$i_systimek'
13865 i_systimes='$i_systimes'
13866 i_systypes='$i_systypes'
13867 i_sysuio='$i_sysuio'
13868 i_sysun='$i_sysun'
13869 i_syswait='$i_syswait'
13870 i_termio='$i_termio'
13871 i_termios='$i_termios'
13872 i_time='$i_time'
13873 i_unistd='$i_unistd'
13874 i_utime='$i_utime'
13875 i_values='$i_values'
13876 i_varargs='$i_varargs'
13877 i_varhdr='$i_varhdr'
13878 i_vfork='$i_vfork'
13879 ignore_versioned_solibs='$ignore_versioned_solibs'
13880 incpath='$incpath'
13881 inews='$inews'
13882 installarchlib='$installarchlib'
13883 installbin='$installbin'
13884 installman1dir='$installman1dir'
13885 installman3dir='$installman3dir'
13886 installprefix='$installprefix'
13887 installprefixexp='$installprefixexp'
13888 installprivlib='$installprivlib'
13889 installscript='$installscript'
13890 installsitearch='$installsitearch'
13891 installsitelib='$installsitelib'
13892 installstyle='$installstyle'
13893 installusrbinperl='$installusrbinperl'
13894 installvendorlib='$installvendorlib'
13895 intsize='$intsize'
13896 known_extensions='$known_extensions'
13897 ksh='$ksh'
13898 large='$large'
13899 ld='$ld'
13900 lddlflags='$lddlflags'
13901 ldflags='$ldflags'
13902 ldlibpthname='$ldlibpthname'
13903 less='$less'
13904 lib_ext='$lib_ext'
13905 libc='$libc'
13906 libperl='$libperl'
13907 libpth='$libpth'
13908 libs='$libs'
13909 libswanted='$libswanted'
13910 line='$line'
13911 lint='$lint'
13912 lkflags='$lkflags'
13913 ln='$ln'
13914 lns='$lns'
13915 locincpth='$locincpth'
13916 loclibpth='$loclibpth'
13917 longdblsize='$longdblsize'
13918 longlongsize='$longlongsize'
13919 longsize='$longsize'
13920 lp='$lp'
13921 lpr='$lpr'
13922 ls='$ls'
13923 lseeksize='$lseeksize'
13924 lseektype='$lseektype'
13925 mail='$mail'
13926 mailx='$mailx'
13927 make='$make'
13928 make_set_make='$make_set_make'
13929 mallocobj='$mallocobj'
13930 mallocsrc='$mallocsrc'
13931 malloctype='$malloctype'
13932 man1dir='$man1dir'
13933 man1direxp='$man1direxp'
13934 man1ext='$man1ext'
13935 man3dir='$man3dir'
13936 man3direxp='$man3direxp'
13937 man3ext='$man3ext'
13938 medium='$medium'
13939 mips='$mips'
13940 mips_type='$mips_type'
13941 mkdir='$mkdir'
13942 mmaptype='$mmaptype'
13943 models='$models'
13944 modetype='$modetype'
13945 more='$more'
13946 multiarch='$multiarch'
13947 mv='$mv'
13948 myarchname='$myarchname'
13949 mydomain='$mydomain'
13950 myhostname='$myhostname'
13951 myuname='$myuname'
13952 n='$n'
13953 netdb_hlen_type='$netdb_hlen_type'
13954 netdb_host_type='$netdb_host_type'
13955 netdb_name_type='$netdb_name_type'
13956 netdb_net_type='$netdb_net_type'
13957 nm='$nm'
13958 nm_opt='$nm_opt'
13959 nm_so_opt='$nm_so_opt'
13960 nonxs_ext='$nonxs_ext'
13961 nroff='$nroff'
13962 o_nonblock='$o_nonblock'
13963 obj_ext='$obj_ext'
13964 old_pthread_create_joinable='$old_pthread_create_joinable'
13965 optimize='$optimize'
13966 orderlib='$orderlib'
13967 osname='$osname'
13968 osvers='$osvers'
13969 package='$package'
13970 pager='$pager'
13971 passcat='$passcat'
13972 patchlevel='$patchlevel'
13973 path_sep='$path_sep'
13974 perl='$perl'
13975 perladmin='$perladmin'
13976 perlpath='$perlpath'
13977 pg='$pg'
13978 phostname='$phostname'
13979 pidtype='$pidtype'
13980 plibpth='$plibpth'
13981 pmake='$pmake'
13982 pr='$pr'
13983 prefix='$prefix'
13984 prefixexp='$prefixexp'
13985 privlib='$privlib'
13986 privlibexp='$privlibexp'
13987 prototype='$prototype'
13988 ptrsize='$ptrsize'
13989 randbits='$randbits'
13990 randfunc='$randfunc'
13991 randseedtype='$randseedtype'
13992 ranlib='$ranlib'
13993 rd_nodata='$rd_nodata'
13994 rm='$rm'
13995 rmail='$rmail'
13996 runnm='$runnm'
13997 sPRIEldbl='$sPRIEldbl'
13998 sPRIFldbl='$sPRIFldbl'
13999 sPRIGldbl='$sPRIGldbl'
14000 sPRIX64='$sPRIX64'
14001 sPRId64='$sPRId64'
14002 sPRIeldbl='$sPRIeldbl'
14003 sPRIfldbl='$sPRIfldbl'
14004 sPRIgldbl='$sPRIgldbl'
14005 sPRIi64='$sPRIi64'
14006 sPRIo64='$sPRIo64'
14007 sPRIu64='$sPRIu64'
14008 sPRIx64='$sPRIx64'
14009 sched_yield='$sched_yield'
14010 scriptdir='$scriptdir'
14011 scriptdirexp='$scriptdirexp'
14012 sed='$sed'
14013 seedfunc='$seedfunc'
14014 selectminbits='$selectminbits'
14015 selecttype='$selecttype'
14016 sendmail='$sendmail'
14017 sh='$sh'
14018 shar='$shar'
14019 sharpbang='$sharpbang'
14020 shmattype='$shmattype'
14021 shortsize='$shortsize'
14022 shrpenv='$shrpenv'
14023 shsharp='$shsharp'
14024 sig_count='$sig_count'
14025 sig_name='$sig_name'
14026 sig_name_init='$sig_name_init'
14027 sig_num='$sig_num'
14028 sig_num_init='$sig_num_init'
14029 signal_t='$signal_t'
14030 sitearch='$sitearch'
14031 sitearchexp='$sitearchexp'
14032 sitelib='$sitelib'
14033 sitelibexp='$sitelibexp'
14034 siteprefix='$siteprefix'
14035 siteprefixexp='$siteprefixexp'
14036 sizetype='$sizetype'
14037 sleep='$sleep'
14038 smail='$smail'
14039 small='$small'
14040 so='$so'
14041 sockethdr='$sockethdr'
14042 socketlib='$socketlib'
14043 sort='$sort'
14044 spackage='$spackage'
14045 spitshell='$spitshell'
14046 split='$split'
14047 src='$src'
14048 ssizetype='$ssizetype'
14049 startperl='$startperl'
14050 startsh='$startsh'
14051 static_ext='$static_ext'
14052 stdchar='$stdchar'
14053 stdio_base='$stdio_base'
14054 stdio_bufsiz='$stdio_bufsiz'
14055 stdio_cnt='$stdio_cnt'
14056 stdio_filbuf='$stdio_filbuf'
14057 stdio_ptr='$stdio_ptr'
14058 stdio_stream_array='$stdio_stream_array'
14059 strings='$strings'
14060 submit='$submit'
14061 subversion='$subversion'
14062 sysman='$sysman'
14063 tail='$tail'
14064 tar='$tar'
14065 tbl='$tbl'
14066 tee='$tee'
14067 test='$test'
14068 timeincl='$timeincl'
14069 timetype='$timetype'
14070 touch='$touch'
14071 tr='$tr'
14072 trnl='$trnl'
14073 troff='$troff'
14074 uidtype='$uidtype'
14075 uname='$uname'
14076 uniq='$uniq'
14077 use64bits='$use64bits'
14078 usedl='$usedl'
14079 usemultiplicity='$usemultiplicity'
14080 usemymalloc='$usemymalloc'
14081 usenm='$usenm'
14082 useopcode='$useopcode'
14083 useperlio='$useperlio'
14084 useposix='$useposix'
14085 usesfio='$usesfio'
14086 useshrplib='$useshrplib'
14087 usesocks='$usesocks'
14088 usethreads='$usethreads'
14089 usevendorprefix='$usevendorprefix'
14090 usevfork='$usevfork'
14091 usrinc='$usrinc'
14092 uuname='$uuname'
14093 vendorlib='$vendorlib'
14094 vendorlibexp='$vendorlibexp'
14095 vendorprefix='$vendorprefix'
14096 vendorprefixexp='$vendorprefixexp'
14097 version='$version'
14098 vi='$vi'
14099 voidflags='$voidflags'
14100 xlibpth='$xlibpth'
14101 zcat='$zcat'
14102 zip='$zip'
14103 EOT
14104
14105 : Add in command line options if available
14106 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14107
14108 : add special variables
14109 $test -f $src/patchlevel.h && \
14110 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14111 echo "CONFIGDOTSH=true" >>config.sh
14112
14113 : propagate old symbols
14114 if $test -f UU/config.sh; then
14115         <UU/config.sh sort | uniq >UU/oldconfig.sh
14116         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14117         sort | uniq -u >UU/oldsyms
14118         set X `cat UU/oldsyms`
14119         shift
14120         case $# in
14121         0) ;;
14122         *)
14123                 cat <<EOM
14124 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14125 EOM
14126                 echo "# Variables propagated from previous config.sh file." >>config.sh
14127                 for sym in `cat UU/oldsyms`; do
14128                         echo "    Propagating $hint variable "'$'"$sym..."
14129                         eval 'tmp="$'"${sym}"'"'
14130                         echo "$tmp" | \
14131                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14132                 done
14133                 ;;
14134         esac
14135 fi
14136
14137 : Finish up by extracting the .SH files
14138 case "$alldone" in
14139 exit)
14140         $rm -rf UU
14141         echo "Done."
14142         exit 0
14143         ;;
14144 cont)
14145         ;;
14146 '')
14147         dflt=''
14148         nostick=true
14149         $cat <<EOM
14150
14151 If you'd like to make any changes to the config.sh file before I begin
14152 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14153
14154 EOM
14155         rp="Press return or use a shell escape to edit config.sh:"
14156         . UU/myread
14157         nostick=''
14158         case "$ans" in
14159         '') ;;
14160         *) : in case they cannot read
14161                 sh 1>&4 -c "$ans";;
14162         esac
14163         ;;
14164 esac
14165
14166 : if this fails, just run all the .SH files by hand
14167 . ./config.sh
14168
14169 echo " "
14170 exec 1>&4
14171 . ./UU/extract
14172
14173 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14174         dflt=y
14175         case "$silent" in
14176         true) ;;
14177         *)
14178                 $cat <<EOM
14179
14180 Now you need to generate make dependencies by running "$make depend".
14181 You might prefer to run it in background: "$make depend > makedepend.out &"
14182 It can take a while, so you might not want to run it right now.
14183
14184 EOM
14185                 ;;
14186         esac
14187         rp="Run $make depend now?"
14188         . UU/myread
14189         case "$ans" in
14190         y*)
14191                 $make depend && echo "Now you must run a $make."
14192                 ;;
14193         *)
14194                 echo "You must run '$make depend' then '$make'."
14195                 ;;
14196         esac
14197 elif test -f [Mm]akefile; then
14198         echo " "
14199         echo "Now you must run a $make."
14200 else
14201         echo "Done."
14202 fi
14203
14204 if $test -f Policy.sh; then
14205     $cat <<EOM
14206
14207 If you compile $package on a different machine or from a different object
14208 directory, copy the Policy.sh file from this object directory to the
14209 new one before you run Configure -- this will help you with most of
14210 the policy defaults.
14211
14212 EOM
14213 fi
14214 if $test -f config.msg; then
14215     echo "Hmm.  I also noted the following information while running:"
14216     echo " "
14217     $cat config.msg >&4
14218     $rm -f config.msg
14219 fi
14220 $rm -f kit*isdone ark*isdone
14221 $rm -rf UU
14222
14223 : End of Configure
14224