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