Don't quit before printing out the message.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sat Aug 14 02:03:17 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 dlext=''
569 cccdlflags=''
570 ccdlflags=''
571 dlsrc=''
572 ld=''
573 lddlflags=''
574 usedl=''
575 doublesize=''
576 ebcdic=''
577 fflushNULL=''
578 fflushall=''
579 fpostype=''
580 gidtype=''
581 groupstype=''
582 h_fcntl=''
583 h_sysfile=''
584 i_arpainet=''
585 db_hashtype=''
586 db_prefixtype=''
587 i_db=''
588 i_dbm=''
589 i_rpcsvcdbm=''
590 d_dirnamlen=''
591 direntrytype=''
592 i_dirent=''
593 i_dld=''
594 i_dlfcn=''
595 i_fcntl=''
596 i_float=''
597 i_gdbm=''
598 d_grpasswd=''
599 i_grp=''
600 d_int64t=''
601 i_inttypes=''
602 i_limits=''
603 i_locale=''
604 i_machcthr=''
605 i_malloc=''
606 i_math=''
607 i_memory=''
608 i_mntent=''
609 i_ndbm=''
610 i_netdb=''
611 i_neterrno=''
612 i_netinettcp=''
613 i_niin=''
614 i_sysin=''
615 i_poll=''
616 i_pthread=''
617 d_pwage=''
618 d_pwchange=''
619 d_pwclass=''
620 d_pwcomment=''
621 d_pwexpire=''
622 d_pwgecos=''
623 d_pwpasswd=''
624 d_pwquota=''
625 i_pwd=''
626 i_sfio=''
627 i_shadow=''
628 i_socks=''
629 i_stddef=''
630 i_stdlib=''
631 i_string=''
632 strings=''
633 i_sysaccess=''
634 i_sysdir=''
635 i_sysfile=''
636 d_voidtty=''
637 i_bsdioctl=''
638 i_sysfilio=''
639 i_sysioctl=''
640 i_syssockio=''
641 i_sysmman=''
642 i_sysmount=''
643 i_sysndir=''
644 i_sysparam=''
645 i_sysresrc=''
646 i_syssecrt=''
647 i_sysselct=''
648 i_sysstat=''
649 i_sysstatvfs=''
650 i_systimes=''
651 i_systypes=''
652 d_iovec_s=''
653 i_sysuio=''
654 i_sysun=''
655 i_syswait=''
656 i_sgtty=''
657 i_termio=''
658 i_termios=''
659 i_systime=''
660 i_systimek=''
661 i_time=''
662 timeincl=''
663 i_unistd=''
664 i_utime=''
665 i_values=''
666 i_stdarg=''
667 i_varargs=''
668 i_varhdr=''
669 i_vfork=''
670 installprefix=''
671 installprefixexp=''
672 installstyle=''
673 installusrbinperl=''
674 intsize=''
675 longsize=''
676 shortsize=''
677 d_fpos64_t=''
678 d_llseek=''
679 d_off64_t=''
680 libc=''
681 ldlibpthname=''
682 libperl=''
683 shrpenv=''
684 useshrplib=''
685 glibpth=''
686 libpth=''
687 loclibpth=''
688 plibpth=''
689 xlibpth=''
690 ignore_versioned_solibs=''
691 libs=''
692 lns=''
693 d_PRIEldbl=''
694 d_PRIFldbl=''
695 d_PRIGldbl=''
696 d_PRIeldbl=''
697 d_PRIfldbl=''
698 d_PRIgldbl=''
699 sPRIEldbl=''
700 sPRIFldbl=''
701 sPRIGldbl=''
702 sPRIeldbl=''
703 sPRIfldbl=''
704 sPRIgldbl=''
705 lseeksize=''
706 lseektype=''
707 make_set_make=''
708 d_mymalloc=''
709 freetype=''
710 mallocobj=''
711 mallocsrc=''
712 malloctype=''
713 usemymalloc=''
714 installman1dir=''
715 man1dir=''
716 man1direxp=''
717 man1ext=''
718 installman3dir=''
719 man3dir=''
720 man3direxp=''
721 man3ext=''
722 huge=''
723 large=''
724 medium=''
725 models=''
726 small=''
727 split=''
728 modetype=''
729 multiarch=''
730 mydomain=''
731 myhostname=''
732 phostname=''
733 c=''
734 n=''
735 d_eofnblk=''
736 eagain=''
737 o_nonblock=''
738 rd_nodata=''
739 netdb_hlen_type=''
740 netdb_host_type=''
741 netdb_name_type=''
742 netdb_net_type=''
743 groupcat=''
744 hostcat=''
745 passcat=''
746 orderlib=''
747 ranlib=''
748 package=''
749 spackage=''
750 pager=''
751 apiversion=''
752 patchlevel=''
753 subversion=''
754 version=''
755 perladmin=''
756 perlpath=''
757 pidtype=''
758 prefix=''
759 prefixexp=''
760 installprivlib=''
761 privlib=''
762 privlibexp=''
763 prototype=''
764 ptrsize=''
765 d_PRIX64=''
766 d_PRId64=''
767 d_PRIi64=''
768 d_PRIo64=''
769 d_PRIu64=''
770 d_PRIx64=''
771 sPRIX64=''
772 sPRId64=''
773 sPRIi64=''
774 sPRIo64=''
775 sPRIu64=''
776 sPRIx64=''
777 drand01=''
778 randbits=''
779 randfunc=''
780 randseedtype=''
781 seedfunc=''
782 installscript=''
783 scriptdir=''
784 scriptdirexp=''
785 selectminbits=''
786 selecttype=''
787 sh=''
788 sig_count=''
789 sig_name=''
790 sig_name_init=''
791 sig_num=''
792 sig_num_init=''
793 installsitearch=''
794 sitearch=''
795 sitearchexp=''
796 installsitelib=''
797 sitelib=''
798 sitelibexp=''
799 siteprefix=''
800 siteprefixexp=''
801 sizetype=''
802 so=''
803 sharpbang=''
804 shsharp=''
805 spitshell=''
806 src=''
807 ssizetype=''
808 startperl=''
809 startsh=''
810 stdchar=''
811 d_fgetpos64=''
812 d_fopen64=''
813 d_freopen64=''
814 d_fseek64=''
815 d_fseeko64=''
816 d_fsetpos64=''
817 d_ftell64=''
818 d_ftello64=''
819 d_tmpfile64=''
820 d_stdio_stream_array=''
821 stdio_stream_array=''
822 d_strtoull=''
823 sysman=''
824 trnl=''
825 uidtype=''
826 archname64=''
827 use64bits=''
828 uselongdouble=''
829 usemultiplicity=''
830 nm_opt=''
831 nm_so_opt=''
832 runnm=''
833 usenm=''
834 useperlio=''
835 usesocks=''
836 d_oldpthreads=''
837 usethreads=''
838 incpath=''
839 mips=''
840 mips_type=''
841 usrinc=''
842 d_vendorlib=''
843 installvendorlib=''
844 vendorlib=''
845 vendorlibexp=''
846 usevendorprefix=''
847 vendorprefix=''
848 vendorprefixexp=''
849 defvoidused=''
850 voidflags=''
851 CONFIG=''
852
853 define='define'
854 undef='undef'
855 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
856 rmlist=''
857
858 : We must find out about Eunice early
859 eunicefix=':'
860 if test -f /etc/unixtovms; then
861         eunicefix=/etc/unixtovms
862 fi
863 if test -f /etc/unixtovms.exe; then
864         eunicefix=/etc/unixtovms.exe
865 fi
866
867 i_whoami=''
868 : Possible local include directories to search.
869 : Set locincpth to "" in a hint file to defeat local include searches.
870 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
871 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
872 :
873 : no include file wanted by default
874 inclwanted=''
875
876 : list of known cpp symbols, sorted alphabetically
877 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
878 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
879 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
880 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
881 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
882 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
883 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
884 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
885 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
886 al="$al VMS Xenix286"
887 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
888 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
889 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
890 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
891 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
892 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
893 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
894 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
895 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
896 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
897 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
898 al="$al __SVR4_2__ __UMAXV__"
899 al="$al ____386BSD____ __alpha __alpha__ __amiga"
900 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
901 al="$al __host_mips__"
902 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
903 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
904 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
905 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
906 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
907 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
908 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
909 al="$al __mc88100 __mc88100__ __mips __mips__"
910 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
911 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
912 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
913 al="$al _host_mips _mips _unix"
914 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
915 al="$al apollo ardent att386 att3b"
916 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
917 al="$al cadmus clipper concurrent convex cray ctix"
918 al="$al dmert encore gcos gcx gimpel gould"
919 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
920 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
921 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
922 al="$al i186 i286 i386 i486 i8086"
923 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
924 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
925 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
926 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
927 al="$al mc88000 mc88100 merlin mert mips mvs n16"
928 al="$al ncl_el ncl_mr"
929 al="$al news1500 news1700 news1800 news1900 news3700"
930 al="$al news700 news800 news900 ns16000 ns32000"
931 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
932 al="$al parisc pc532 pdp11 plexus posix pyr"
933 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
934 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
935 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
936 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
937 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
938 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
939 al="$al xenix z8000"
940
941 : Trailing extension.  Override this in a hint file, if needed.
942 _exe=''
943 : Extra object files, if any, needed on this platform.
944 archobjs=''
945 groupstype=''
946 : change the next line if compiling for Xenix/286 on Xenix/386
947 xlibpth='/usr/lib/386 /lib/386'
948
949 : Possible local library directories to search.
950 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
951 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
952
953 : general looking path for locating libraries
954 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
955 glibpth="$glibpth /lib /usr/lib $xlibpth"
956 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
957 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
958
959 : Private path used by Configure to find libraries.  Its value
960 : is prepended to libpth. This variable takes care of special
961 : machines, like the mips.  Usually, it should be empty.
962 plibpth=''
963
964 : default library list
965 libswanted=''
966 : some systems want to use only the non-versioned libso:s
967 ignore_versioned_solibs=''
968 : full support for void wanted by default
969 defvoidused=15
970
971 : set useposix=false in your hint file to disable the POSIX extension.
972 useposix=true
973 : set useopcode=false in your hint file to disable the Opcode extension.
974 useopcode=true
975 : set usemultiplicity on the Configure command line to enable multiplicity.
976 : set usesocks on the Configure command line to enable socks.
977 : set usethreads on the Configure command line to enable threads.
978 : List of libraries we want.
979 : If anyone needs -lnet, put it in a hint file.
980 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
981 libswanted="$libswanted dld ld sun m c cposix posix"
982 libswanted="$libswanted ndir dir crypt sec"
983 libswanted="$libswanted ucb bsd BSD PW x"
984 : We probably want to search /usr/shlib before most other libraries.
985 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
986 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
987 glibpth="/usr/shlib $glibpth"
988 : Do not use vfork unless overridden by a hint file.
989 usevfork=false
990
991 : Find the basic shell for Bourne shell scripts
992 case "$sh" in
993 '')
994         case "$SYSTYPE" in
995         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
996         *) xxx='/bin/sh';;
997         esac
998         if test -f "$xxx"; then
999                 sh="$xxx"
1000         else
1001                 : Build up a list and do a single loop so we can 'break' out.
1002                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1003                 for xxx in sh bash ksh pdksh ash; do
1004                         for p in $pth; do
1005                                 try="$try ${p}/${xxx}"
1006                         done
1007                 done
1008                 for xxx in $try; do
1009                         if test -f "$xxx"; then
1010                                 sh="$xxx";
1011                                 break
1012                         elif test -f "$xxx.exe"; then
1013                                 sh="$xxx";
1014                                 break
1015                         fi
1016                 done
1017         fi
1018         ;;
1019 esac
1020
1021 case "$sh" in
1022 '')     cat <<EOM >&2
1023 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1024
1025 Usually it's in /bin/sh.  How did you even get this far?
1026 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1027 we'll try to straighten this all out.
1028 EOM
1029         exit 1
1030         ;;
1031 esac
1032
1033 : see if sh knows # comments
1034 if `$sh -c '#' >/dev/null 2>&1`; then
1035         shsharp=true
1036         spitshell=cat
1037         xcat=/bin/cat
1038         test -f $xcat || xcat=/usr/bin/cat
1039         echo "#!$xcat" >try
1040         $eunicefix try
1041         chmod +x try
1042         ./try > today
1043         if test -s today; then
1044                 sharpbang='#!'
1045         else
1046                 echo "#! $xcat" > try
1047                 $eunicefix try
1048                 chmod +x try
1049                 ./try > today
1050                 if test -s today; then
1051                         sharpbang='#! '
1052                 else
1053                         sharpbang=': use '
1054                 fi
1055         fi
1056 else
1057         echo " "
1058         echo "Your $sh doesn't grok # comments--I will strip them later on."
1059         shsharp=false
1060         cd ..
1061         echo "exec grep -v '^[  ]*#'" >spitshell
1062         chmod +x spitshell
1063         $eunicefix spitshell
1064         spitshell=`pwd`/spitshell
1065         cd UU
1066         echo "I presume that if # doesn't work, #! won't work either!"
1067         sharpbang=': use '
1068 fi
1069 rm -f try today
1070
1071 : figure out how to guarantee sh startup
1072 case "$startsh" in
1073 '') startsh=${sharpbang}${sh} ;;
1074 *)
1075 esac
1076 cat >try <<EOSS
1077 $startsh
1078 set abc
1079 test "$?abc" != 1
1080 EOSS
1081
1082 chmod +x try
1083 $eunicefix try
1084 if ./try; then
1085         : echo "Yup, it does."
1086 else
1087         echo "Hmm... '$startsh' does not guarantee sh startup..."
1088         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1089 fi
1090 rm -f try
1091
1092
1093 : Save command line options in file UU/cmdline.opt for later use in
1094 : generating config.sh.
1095 cat > cmdline.opt <<EOSH
1096 # Configure command line arguments.
1097 config_arg0='$0'
1098 config_args='$*'
1099 config_argc=$#
1100 EOSH
1101 argn=1
1102 for arg in "$@"; do
1103         cat >>cmdline.opt <<EOSH
1104 config_arg$argn='$arg'
1105 EOSH
1106         argn=`expr $argn + 1`
1107 done
1108
1109 : produce awk script to parse command line options
1110 cat >options.awk <<'EOF'
1111 BEGIN {
1112         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
1113
1114         len = length(optstr);
1115         for (i = 1; i <= len; i++) {
1116                 c = substr(optstr, i, 1);
1117                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1118                 if (a == ":") {
1119                         arg[c] = 1;
1120                         i++;
1121                 }
1122                 opt[c] = 1;
1123         }
1124 }
1125 {
1126         expect = 0;
1127         str = $0;
1128         if (substr(str, 1, 1) != "-") {
1129                 printf("'%s'\n", str);
1130                 next;
1131         }
1132         len = length($0);
1133         for (i = 2; i <= len; i++) {
1134                 c = substr(str, i, 1);
1135                 if (!opt[c]) {
1136                         printf("-%s\n", substr(str, i));
1137                         next;
1138                 }
1139                 printf("-%s\n", c);
1140                 if (arg[c]) {
1141                         if (i < len)
1142                                 printf("'%s'\n", substr(str, i + 1));
1143                         else
1144                                 expect = 1;
1145                         next;
1146                 }
1147         }
1148 }
1149 END {
1150         if (expect)
1151                 print "?";
1152 }
1153 EOF
1154
1155 : process the command line options
1156 set X `for arg in "$@"; do echo "X$arg"; done |
1157         sed -e s/X// | awk -f options.awk`
1158 eval "set $*"
1159 shift
1160 rm -f options.awk
1161
1162 : set up default values
1163 fastread=''
1164 reuseval=false
1165 config_sh=''
1166 alldone=''
1167 error=''
1168 silent=''
1169 extractsh=''
1170 override=''
1171 knowitall=''
1172 rm -f optdef.sh
1173 cat >optdef.sh <<EOS
1174 $startsh
1175 EOS
1176
1177
1178 : option parsing
1179 while test $# -gt 0; do
1180         case "$1" in
1181         -d) shift; fastread=yes;;
1182         -e) shift; alldone=cont;;
1183         -f)
1184                 shift
1185                 cd ..
1186                 if test -r "$1"; then
1187                         config_sh="$1"
1188                 else
1189                         echo "$me: cannot read config file $1." >&2
1190                         error=true
1191                 fi
1192                 cd UU
1193                 shift;;
1194         -h) shift; error=true;;
1195         -r) shift; reuseval=true;;
1196         -s) shift; silent=true; realsilent=true;;
1197         -E) shift; alldone=exit;;
1198         -K) shift; knowitall=true;;
1199         -O) shift; override=true;;
1200         -S) shift; silent=true; extractsh=true;;
1201         -D)
1202                 shift
1203                 case "$1" in
1204                 *=)
1205                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1206                         echo "$me: ignoring -D $1" >&2
1207                         ;;
1208                 *=*) echo "$1" | \
1209                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1210                 *) echo "$1='define'" >> optdef.sh;;
1211                 esac
1212                 shift
1213                 ;;
1214         -U)
1215                 shift
1216                 case "$1" in
1217                 *=) echo "$1" >> optdef.sh;;
1218                 *=*)
1219                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1220                         echo "$me: ignoring -U $1" >&2
1221                         ;;
1222                 *) echo "$1='undef'" >> optdef.sh;;
1223                 esac
1224                 shift
1225                 ;;
1226         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1227                 exit 0;;
1228         --) break;;
1229         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1230         *) break;;
1231         esac
1232 done
1233
1234 case "$error" in
1235 true)
1236         cat >&2 <<EOM
1237 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1238                  [-U symbol] [-U symbol=]
1239   -d : use defaults for all answers.
1240   -e : go on without questioning past the production of config.sh.
1241   -f : specify an alternate default configuration file.
1242   -h : print this help message and exit (with an error status).
1243   -r : reuse C symbols value if possible (skips costly nm extraction).
1244   -s : silent mode, only echoes questions and essential information.
1245   -D : define symbol to have some value:
1246          -D symbol         symbol gets the value 'define'
1247          -D symbol=value   symbol gets the value 'value'
1248   -E : stop at the end of questions, after having produced config.sh.
1249   -K : do not use unless you know what you are doing.
1250   -O : let -D and -U override definitions from loaded configuration file.
1251   -S : perform variable substitutions on all .SH files (can mix with -f)
1252   -U : undefine symbol:
1253          -U symbol    symbol gets the value 'undef'
1254          -U symbol=   symbol gets completely empty
1255   -V : print version number and exit (with a zero status).
1256 EOM
1257         exit 1
1258         ;;
1259 esac
1260
1261 : Sanity checks
1262 case "$fastread$alldone" in
1263 yescont|yesexit) ;;
1264 *)
1265         if test ! -t 0; then
1266                 echo "Say 'sh Configure', not 'sh <Configure'"
1267                 exit 1
1268         fi
1269         ;;
1270 esac
1271
1272 exec 4>&1
1273 case "$silent" in
1274 true) exec 1>/dev/null;;
1275 esac
1276
1277 : run the defines and the undefines, if any, but leave the file out there...
1278 touch optdef.sh
1279 . ./optdef.sh
1280
1281 : set package name
1282 package=perl5
1283 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1284 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1285 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1286 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1287 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1288 esac
1289
1290 : Some greps do not return status, grrr.
1291 echo "grimblepritz" >grimble
1292 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1293         contains=contains
1294 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1295         contains=grep
1296 else
1297         contains=contains
1298 fi
1299 rm -f grimble
1300 : the following should work in any shell
1301 case "$contains" in
1302 contains*)
1303         echo " "
1304         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1305         cat >contains <<'EOSS'
1306 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1307 EOSS
1308 chmod +x contains
1309 esac
1310
1311 : Find the path to the source tree
1312 case "$src" in
1313 '') case "$0" in
1314     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1315          case "$src" in
1316          /*)    ;;
1317          *)     src=`cd ../$src && pwd` ;;
1318          esac
1319          ;;
1320     *)   src='.';;
1321     esac;;
1322 esac
1323 case "$src" in
1324 '')     src=/
1325         rsrc=/
1326         ;;
1327 /*) rsrc="$src";;
1328 *) rsrc="../$src";;
1329 esac
1330 if test -f $rsrc/Configure && \
1331         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1332 then
1333    : found it, so we are ok.
1334 else
1335         rsrc=''
1336         for src in . .. ../.. ../../.. ../../../..; do
1337                 if test -f ../$src/Configure && \
1338                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1339                 then
1340                         rsrc=../$src
1341                         break
1342                 fi
1343         done
1344 fi
1345 case "$rsrc" in
1346 '')
1347         cat <<EOM >&4
1348
1349 Sorry, I can't seem to locate the source dir for $package.  Please start
1350 Configure with an explicit path -- i.e. /some/path/Configure.
1351
1352 EOM
1353         exit 1
1354         ;;
1355 ../.)   rsrc='..';;
1356 *)
1357         echo " "
1358         echo "Sources for $package found in \"$src\"." >&4
1359         ;;
1360 esac
1361
1362 : script used to extract .SH files with variable substitutions
1363 cat >extract <<'EOS'
1364 CONFIGDOTSH=true
1365 echo "Doing variable substitutions on .SH files..."
1366 if test -f $src/MANIFEST; then
1367         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1368 else
1369         echo "(Looking for .SH files under the source directory.)"
1370         set x `(cd $src; find . -name "*.SH" -print)`
1371 fi
1372 shift
1373 case $# in
1374 0) set x `(cd $src; echo *.SH)`; shift;;
1375 esac
1376 if test ! -f $src/$1; then
1377         shift
1378 fi
1379 mkdir_p='
1380 name=$1;
1381 create="";
1382 while test $name; do
1383         if test ! -d "$name"; then
1384                 create="$name $create";
1385                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1386                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1387         else
1388                 name="";
1389         fi;
1390 done;
1391 for file in $create; do
1392         mkdir $file;
1393 done
1394 '
1395 for file in $*; do
1396         case "$src" in
1397         ".")
1398                 case "$file" in
1399                 */*)
1400                         dir=`expr X$file : 'X\(.*\)/'`
1401                         file=`expr X$file : 'X.*/\(.*\)'`
1402                         (cd $dir && . ./$file)
1403                         ;;
1404                 *)
1405                         . ./$file
1406                         ;;
1407                 esac
1408                 ;;
1409         *)
1410                 case "$file" in
1411                 */*)
1412                         dir=`expr X$file : 'X\(.*\)/'`
1413                         file=`expr X$file : 'X.*/\(.*\)'`
1414                         (set x $dir; shift; eval $mkdir_p)
1415                         sh <$src/$dir/$file
1416                         ;;
1417                 *)
1418                         sh <$src/$file
1419                         ;;
1420                 esac
1421                 ;;
1422         esac
1423 done
1424 if test -f $src/config_h.SH; then
1425         if test ! -f config.h; then
1426         : oops, they left it out of MANIFEST, probably, so do it anyway.
1427         . $src/config_h.SH
1428         fi
1429 fi
1430 EOS
1431
1432 : extract files and exit if asked to do so
1433 case "$extractsh" in
1434 true)
1435         case "$realsilent" in
1436         true) ;;
1437         *) exec 1>&4;;
1438         esac
1439         case "$config_sh" in
1440         '') config_sh='config.sh';;
1441         esac
1442         echo " "
1443         echo "Fetching answers from $config_sh..."
1444         cd ..
1445         . $config_sh
1446         test "$override" && . ./optdef.sh
1447         echo " "
1448         . UU/extract
1449         rm -rf UU
1450         echo "Done."
1451         exit 0
1452         ;;
1453 esac
1454
1455 : Eunice requires " " instead of "", can you believe it
1456 echo " "
1457 : Here we go...
1458 echo "Beginning of configuration questions for $package."
1459
1460 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1461
1462 : first determine how to suppress newline on echo command
1463 echo " "
1464 echo "Checking echo to see how to suppress newlines..."
1465 (echo "hi there\c" ; echo " ") >.echotmp
1466 if $contains c .echotmp >/dev/null 2>&1 ; then
1467         echo "...using -n."
1468         n='-n'
1469         c=''
1470 else
1471         cat <<'EOM'
1472 ...using \c
1473 EOM
1474         n=''
1475         c='\c'
1476 fi
1477 echo $n "The star should be here-->$c"
1478 echo '*'
1479 rm -f .echotmp
1480
1481 : Now test for existence of everything in MANIFEST
1482 echo " "
1483 if test -f $rsrc/MANIFEST; then
1484         echo "First let's make sure your kit is complete.  Checking..." >&4
1485         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1486         rm -f missing
1487         tmppwd=`pwd`
1488         for filelist in x??; do
1489                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1490         done
1491         if test -s missing; then
1492                 cat missing >&4
1493                 cat >&4 <<'EOM'
1494
1495 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1496
1497 You have the option of continuing the configuration process, despite the
1498 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1499 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1500 and contact the author (perlbug@perl.com).
1501
1502 EOM
1503                 echo $n "Continue? [n] $c" >&4
1504                 read ans
1505                 case "$ans" in
1506                 y*)
1507                         echo "Continuing..." >&4
1508                         rm -f missing
1509                         ;;
1510                 *)
1511                         echo "ABORTING..." >&4
1512                         kill $$
1513                         ;;
1514                 esac
1515         else
1516                 echo "Looks good..."
1517         fi
1518 else
1519         echo "There is no MANIFEST file.  I hope your kit is complete !"
1520 fi
1521 rm -f missing x??
1522
1523 echo " "
1524 : Find the appropriate value for a newline for tr
1525 if test -n "$DJGPP"; then
1526        trnl='\012'
1527 fi
1528 if test X"$trnl" = X; then
1529         case "`echo foo|tr '\n' x 2>/dev/null`" in
1530         foox) trnl='\n' ;;
1531         esac
1532 fi
1533 if test X"$trnl" = X; then
1534         case "`echo foo|tr '\012' x 2>/dev/null`" in
1535         foox) trnl='\012' ;;
1536         esac
1537 fi
1538 if test X"$trnl" = X; then
1539         cat <<EOM >&2
1540
1541 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1542
1543 EOM
1544         exit 1
1545 fi
1546
1547 : compute the number of columns on the terminal for proper question formatting
1548 case "$COLUMNS" in
1549 '') COLUMNS='80';;
1550 esac
1551
1552 : set up the echo used in my read
1553 myecho="case \"\$xxxm\" in
1554 '') echo $n \"\$rp $c\" >&4;;
1555 *) case \"\$rp\" in
1556         '') echo $n \"[\$xxxm] $c\";;
1557         *)
1558                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1559                         echo \"\$rp\" >&4
1560                         echo $n \"[\$xxxm] $c\" >&4
1561                 else
1562                         echo $n \"\$rp [\$xxxm] $c\" >&4
1563                 fi
1564                 ;;
1565         esac;;
1566 esac"
1567
1568 : now set up to do reads with possible shell escape and default assignment
1569 cat <<EOSC >myread
1570 $startsh
1571 xxxm=\$dflt
1572 $myecho
1573 ans='!'
1574 case "\$fastread" in
1575 yes) case "\$dflt" in
1576         '') ;;
1577         *) ans='';
1578                 case "\$silent-\$rp" in
1579                 true-) ;;
1580                 *) echo " " >&4;;
1581                 esac;;
1582         esac;;
1583 *) case "\$silent" in
1584         true) case "\$rp" in
1585                 '') ans='';;
1586                 esac;;
1587         esac;;
1588 esac
1589 while expr "X\$ans" : "X!" >/dev/null; do
1590         read answ
1591         set x \$xxxm
1592         shift
1593         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1594         case  "\$answ" in
1595         "!")
1596                 sh 1>&4
1597                 echo " "
1598                 $myecho
1599                 ;;
1600         !*)
1601                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1602                 shift
1603                 sh 1>&4 -c "\$*"
1604                 echo " "
1605                 $myecho
1606                 ;;
1607         "\$ans")
1608                 case "\$ans" in
1609                 \\&*)
1610                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1611                         shift
1612                         case "\$1" in
1613                         -d)
1614                                 fastread=yes
1615                                 echo "(OK, I'll run with -d after this question.)" >&4
1616                                 ;;
1617                         -*)
1618                                 echo "*** Sorry, \$1 not supported yet." >&4
1619                                 ;;
1620                         esac
1621                         $myecho
1622                         ans=!
1623                         ;;
1624                 esac;;
1625         *)
1626                 case "\$aok" in
1627                 y)
1628                         echo "*** Substitution done -- please confirm."
1629                         xxxm="\$ans"
1630                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1631                         xxxm="\$ans"
1632                         ans=!
1633                         ;;
1634                 *)
1635                         echo "*** Error -- try again."
1636                         ans=!
1637                         ;;
1638                 esac
1639                 $myecho
1640                 ;;
1641         esac
1642         case "\$ans\$xxxm\$nostick" in
1643         '')
1644                 ans=!
1645                 $myecho
1646                 ;;
1647         esac
1648 done
1649 case "\$ans" in
1650 '') ans="\$xxxm";;
1651 esac
1652 EOSC
1653
1654 : create .config dir to save info across Configure sessions
1655 test -d ../.config || mkdir ../.config
1656 cat >../.config/README <<EOF
1657 This directory created by Configure to save information that should
1658 persist across sessions for $package.
1659
1660 You may safely delete it if you wish.
1661 EOF
1662
1663 : general instructions
1664 needman=true
1665 firsttime=true
1666 user=`(logname) 2>/dev/null`
1667 case "$user" in
1668 '') user=`whoami 2>&1`;;
1669 esac
1670 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1671         firsttime=false
1672         echo " "
1673         rp='Would you like to see the instructions?'
1674         dflt=n
1675         . ./myread
1676         case "$ans" in
1677         [yY]*) ;;
1678         *) needman=false;;
1679         esac
1680 fi
1681 if $needman; then
1682         cat <<EOH
1683
1684 This installation shell script will examine your system and ask you questions
1685 to determine how the perl5 package should be installed. If you get
1686 stuck on a question, you may use a ! shell escape to start a subshell or
1687 execute a command.  Many of the questions will have default answers in square
1688 brackets; typing carriage return will give you the default.
1689
1690 On some of the questions which ask for file or directory names you are allowed
1691 to use the ~name construct to specify the login directory belonging to "name",
1692 even if you don't have a shell which knows about that.  Questions where this is
1693 allowed will be marked "(~name ok)".
1694
1695 EOH
1696         rp=''
1697         dflt='Type carriage return to continue'
1698         . ./myread
1699         cat <<'EOH'
1700
1701 The prompter used in this script allows you to use shell variables and
1702 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1703 in the default answer, as if the default line was a set of arguments given to a
1704 script shell.  This means you may also use $* to repeat the whole default line,
1705 so you do not have to re-type everything to add something to the default.
1706
1707 Everytime there is a substitution, you will have to confirm.  If there is an
1708 error (e.g. an unmatched backtick), the default answer will remain unchanged
1709 and you will be prompted again.
1710
1711 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1712 the questions and use the computed defaults (or the previous answers if there
1713 was already a config.sh file). Type 'Configure -h' for a list of options.
1714 You may also start interactively and then answer '& -d' at any prompt to turn
1715 on the non-interactive behaviour for the remainder of the execution.
1716
1717 EOH
1718         . ./myread
1719         cat <<EOH
1720
1721 Much effort has been expended to ensure that this shell script will run on any
1722 Unix system.  If despite that it blows up on yours, your best bet is to edit
1723 Configure and run it again.  If you can't run Configure for some reason,
1724 you'll have to generate a config.sh file by hand.  Whatever problems you
1725 have, let me (perlbug@perl.com) know how I blew it.
1726
1727 This installation script affects things in two ways:
1728
1729 1) it may do direct variable substitutions on some of the files included
1730    in this kit.
1731 2) it builds a config.h file for inclusion in C programs.  You may edit
1732    any of these files as the need arises after running this script.
1733
1734 If you make a mistake on a question, there is no easy way to back up to it
1735 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1736 files.  Configure will offer to let you do this before it runs the SH files.
1737
1738 EOH
1739         dflt='Type carriage return to continue'
1740         . ./myread
1741         case "$firsttime" in
1742         true) echo $user >>../.config/instruct;;
1743         esac
1744 fi
1745
1746 : find out where common programs are
1747 echo " "
1748 echo "Locating common programs..." >&4
1749 cat <<EOSC >loc
1750 $startsh
1751 case \$# in
1752 0) exit 1;;
1753 esac
1754 thing=\$1
1755 shift
1756 dflt=\$1
1757 shift
1758 for dir in \$*; do
1759         case "\$thing" in
1760         .)
1761         if test -d \$dir/\$thing; then
1762                 echo \$dir
1763                 exit 0
1764         fi
1765         ;;
1766         *)
1767         for thisthing in \$dir/\$thing; do
1768                 : just loop through to pick last item
1769         done
1770         if test -f \$thisthing; then
1771                 echo \$thisthing
1772                 exit 0
1773         elif test -f \$dir/\$thing.exe; then
1774                 if test -n "$DJGPP"; then
1775                         echo \$dir/\$thing.exe
1776                 else
1777                         : on Eunice apparently
1778                         echo \$dir/\$thing
1779                 fi
1780                 exit 0
1781         fi
1782         ;;
1783         esac
1784 done
1785 echo \$dflt
1786 exit 1
1787 EOSC
1788 chmod +x loc
1789 $eunicefix loc
1790 loclist="
1791 awk
1792 cat
1793 comm
1794 cp
1795 echo
1796 expr
1797 grep
1798 ls
1799 make
1800 mkdir
1801 rm
1802 sed
1803 sort
1804 touch
1805 tr
1806 uniq
1807 "
1808 trylist="
1809 Mcc
1810 ar
1811 byacc
1812 cpp
1813 csh
1814 date
1815 egrep
1816 gzip
1817 less
1818 ln
1819 more
1820 nm
1821 nroff
1822 pg
1823 test
1824 uname
1825 zip
1826 "
1827 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1828 pth="$pth /lib /usr/lib"
1829 for file in $loclist; do
1830         eval xxx=\$$file
1831         case "$xxx" in
1832         /*|?:[\\/]*)
1833                 if test -f "$xxx"; then
1834                         : ok
1835                 else
1836                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1837                         xxx=`./loc $file $file $pth`
1838                 fi
1839                 ;;
1840         '') xxx=`./loc $file $file $pth`;;
1841         *) xxx=`./loc $xxx $xxx $pth`;;
1842         esac
1843         eval $file=$xxx
1844         eval _$file=$xxx
1845         case "$xxx" in
1846         /*)
1847                 echo $file is in $xxx.
1848                 ;;
1849         ?:[\\/]*)
1850                 echo $file is in $xxx.
1851                 ;;
1852         *)
1853                 echo "I don't know where '$file' is, and my life depends on it." >&4
1854                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1855                 exit 1
1856                 ;;
1857         esac
1858 done
1859 echo " "
1860 echo "Don't worry if any of the following aren't found..."
1861 say=offhand
1862 for file in $trylist; do
1863         eval xxx=\$$file
1864         case "$xxx" in
1865         /*|?:[\\/]*)
1866                 if test -f "$xxx"; then
1867                         : ok
1868                 else
1869                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1870                         xxx=`./loc $file $file $pth`
1871                 fi
1872                 ;;
1873         '') xxx=`./loc $file $file $pth`;;
1874         *) xxx=`./loc $xxx $xxx $pth`;;
1875         esac
1876         eval $file=$xxx
1877         eval _$file=$xxx
1878         case "$xxx" in
1879         /*)
1880                 echo $file is in $xxx.
1881                 ;;
1882         ?:[\\/]*)
1883                 echo $file is in $xxx.
1884                 ;;
1885         *)
1886                 echo "I don't see $file out there, $say."
1887                 say=either
1888                 ;;
1889         esac
1890 done
1891 case "$egrep" in
1892 egrep)
1893         echo "Substituting grep for egrep."
1894         egrep=$grep
1895         ;;
1896 esac
1897 case "$ln" in
1898 ln)
1899         echo "Substituting cp for ln."
1900         ln=$cp
1901         ;;
1902 esac
1903 case "$test" in
1904 test)
1905         echo "Hopefully test is built into your sh."
1906         ;;
1907 *)
1908         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1909                 echo "Using the test built into your sh."
1910                 test=test
1911                 _test=test
1912         fi
1913         ;;
1914 esac
1915 case "$echo" in
1916 echo)
1917         echo "Hopefully echo is built into your sh."
1918         ;;
1919 '') ;;
1920 *)
1921         echo " "
1922 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1923         $echo $n "hi there$c" >foo1
1924         echo $n "hi there$c" >foo2
1925         if cmp foo1 foo2 >/dev/null 2>&1; then
1926                 echo "They are compatible.  In fact, they may be identical."
1927         else
1928                 case "$n" in
1929                 '-n') n='' c='\c';;
1930                 *) n='-n' c='';;
1931                 esac
1932                 cat <<FOO
1933 They are not compatible!  You are probably running ksh on a non-USG system.
1934 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1935 have echo built in and we may have to run some Bourne shell scripts.  That
1936 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1937
1938 FOO
1939                 $echo $n "The star should be here-->$c"
1940                 $echo "*"
1941         fi
1942         $rm -f foo1 foo2
1943         ;;
1944 esac
1945
1946 : determine whether symbolic links are supported
1947 echo " "
1948 $touch blurfl
1949 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1950         echo "Symbolic links are supported." >&4
1951         lns="$ln -s"
1952 else
1953         echo "Symbolic links are NOT supported." >&4
1954         lns="$ln"
1955 fi
1956 $rm -f blurfl sym
1957
1958 : see whether [:lower:] and [:upper:] are supported character classes
1959 echo " "
1960 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1961 ABYZ)
1962         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1963         up='[:upper:]'
1964         low='[:lower:]'
1965         ;;
1966 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
1967         # (0xc9 and 0xd1), therefore that is a nice testing point.
1968         if test "X$up" = X -o "X$low" = X; then
1969             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1970             ij) up='[A-Z]'
1971                 low='[a-z]'
1972                 ;;
1973             esac
1974         fi
1975         if test "X$up" = X -o "X$low" = X; then
1976             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1977             ij) up='A-Z'
1978                 low='a-z'
1979                 ;;
1980             esac
1981         fi
1982         if test "X$up" = X -o "X$low" = X; then
1983             case "`echo IJ | od -x 2>/dev/null`" in
1984             *C9D1*|*c9d1*)
1985                 echo "Hey, this might be EBCDIC." >&4
1986                 if test "X$up" = X -o "X$low" = X; then
1987                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1988                     ij) up='[A-IJ-RS-Z]'
1989                         low='[a-ij-rs-z]'
1990                         ;;
1991                     esac
1992                 fi
1993                 if test "X$up" = X -o "X$low" = X; then
1994                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1995                     ij) up='A-IJ-RS-Z'
1996                         low='a-ij-rs-z'
1997                         ;;
1998                     esac
1999                 fi
2000                 ;;
2001             esac
2002         fi
2003 esac
2004 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2005 ij)
2006     echo "Using $up and $low to convert case." >&4
2007     ;;
2008 *)
2009     echo "I don't know how to translate letters from upper to lower case." >&4
2010     echo "Your tr is not acting any way I know of." >&4
2011     exit 1
2012     ;;
2013 esac
2014 : set up the translation script tr, must be called with ./tr of course
2015 cat >tr <<EOSC
2016 $startsh
2017 case "\$1\$2" in
2018 '[A-Z][a-z]') exec $tr '$up' '$low';;
2019 '[a-z][A-Z]') exec $tr '$low' '$up';;
2020 esac
2021 exec $tr "\$@"
2022 EOSC
2023 chmod +x tr
2024 $eunicefix tr
2025
2026 : Try to determine whether config.sh was made on this system
2027 case "$config_sh" in
2028 '')
2029 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2030 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2031 # because the A-Z/a-z are not consecutive.
2032 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2033         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2034 newmyuname="$myuname"
2035 dflt=n
2036 case "$knowitall" in
2037 '')
2038         if test -f ../config.sh; then
2039                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2040                         eval "`grep myuname= ../config.sh`"
2041                 fi
2042                 if test "X$myuname" = "X$newmyuname"; then
2043                         dflt=y
2044                 fi
2045         fi
2046         ;;
2047 *) dflt=y;;
2048 esac
2049
2050 : Get old answers from old config file if Configure was run on the
2051 : same system, otherwise use the hints.
2052 hint=default
2053 cd ..
2054 if test -f config.sh; then
2055         echo " "
2056         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2057         . UU/myread
2058         case "$ans" in
2059         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2060         *)  echo "Fetching default answers from your old config.sh file..." >&4
2061                 tmp_n="$n"
2062                 tmp_c="$c"
2063                 tmp_sh="$sh"
2064                 . ./config.sh
2065                 cp config.sh UU
2066                 n="$tmp_n"
2067                 c="$tmp_c"
2068                 : Older versions did not always set $sh.  Catch re-use of such
2069                 : an old config.sh.
2070                 case "$sh" in
2071                 '') sh="$tmp_sh" ;;
2072                 esac
2073                 hint=previous
2074                 ;;
2075         esac
2076 fi
2077 if test ! -f config.sh; then
2078         $cat <<EOM
2079
2080 First time through, eh?  I have some defaults handy for some systems
2081 that need some extra help getting the Configure answers right:
2082
2083 EOM
2084         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2085         dflt=''
2086         : Half the following guesses are probably wrong... If you have better
2087         : tests or hints, please send them to perlbug@perl.com
2088         : The metaconfig authors would also appreciate a copy...
2089         $test -f /irix && osname=irix
2090         $test -f /xenix && osname=sco_xenix
2091         $test -f /dynix && osname=dynix
2092         $test -f /dnix && osname=dnix
2093         $test -f /lynx.os && osname=lynxos
2094         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2095         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2096         $test -f /bin/mips && /bin/mips && osname=mips
2097         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2098                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2099         $test -d /usr/apollo/bin && osname=apollo
2100         $test -f /etc/saf/_sactab && osname=svr4
2101         $test -d /usr/include/minix && osname=minix
2102         if $test -d /MachTen -o -d /MachTen_Folder; then
2103                 osname=machten
2104                 if $test -x /sbin/version; then
2105                         osvers=`/sbin/version | $awk '{print $2}' |
2106                         $sed -e 's/[A-Za-z]$//'`
2107                 elif $test -x /usr/etc/version; then
2108                         osvers=`/usr/etc/version | $awk '{print $2}' |
2109                         $sed -e 's/[A-Za-z]$//'`
2110                 else
2111                         osvers="$2.$3"
2112                 fi
2113         fi
2114        $test -f /sys/posix.dll &&
2115                $test -f /usr/bin/what &&
2116                set X `/usr/bin/what /sys/posix.dll` &&
2117                $test "$3" = UWIN &&
2118                osname=uwin &&
2119                osvers="$5"
2120         if $test -f $uname; then
2121                 set X $myuname
2122                 shift
2123
2124                 case "$5" in
2125                 fps*) osname=fps ;;
2126                 mips*)
2127                         case "$4" in
2128                         umips) osname=umips ;;
2129                         *) osname=mips ;;
2130                         esac;;
2131                 [23]100) osname=mips ;;
2132                 next*) osname=next ;;
2133                 i386*)
2134                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2135                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2136                                 osname='sco'
2137                                 osvers=$tmp
2138                         elif $test -f /etc/kconfig; then
2139                                 osname=isc
2140                                 if test "$lns" = "$ln -s"; then
2141                                         osvers=4
2142                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2143                                         osvers=3
2144                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2145                                         osvers=2
2146                                 fi
2147                         fi
2148                         tmp=''
2149                         ;;
2150                 pc*)
2151                         if test -n "$DJGPP"; then
2152                                 osname=dos
2153                                 osvers=djgpp
2154                         fi
2155                         ;;
2156                 esac
2157
2158                 case "$1" in
2159                 aix) osname=aix
2160                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2161                         case "$tmp" in
2162                         'not found') osvers="$4"."$3" ;;
2163                         '<3240'|'<>3240') osvers=3.2.0 ;;
2164                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2165                         '=3250'|'>3250') osvers=3.2.5 ;;
2166                         *) osvers=$tmp;;
2167                         esac
2168                         ;;
2169                 *dc.osx) osname=dcosx
2170                         osvers="$3"
2171                         ;;
2172                 dnix) osname=dnix
2173                         osvers="$3"
2174                         ;;
2175                 domainos) osname=apollo
2176                         osvers="$3"
2177                         ;;
2178                 dgux) osname=dgux 
2179                         osvers="$3"
2180                         ;;
2181                 dynixptx*) osname=dynixptx
2182                         osvers=`echo "$4"|sed 's/^v//'`
2183                         ;;
2184                 freebsd) osname=freebsd 
2185                         osvers="$3" ;;
2186                 genix) osname=genix ;;
2187                 hp*) osname=hpux 
2188                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2189                         ;;
2190                 irix*) osname=irix
2191                         case "$3" in
2192                         4*) osvers=4 ;;
2193                         5*) osvers=5 ;;
2194                         *)      osvers="$3" ;;
2195                         esac
2196                         ;;
2197                 linux) osname=linux
2198                         case "$3" in
2199                         *)      osvers="$3" ;;
2200                         esac
2201                         ;;
2202                 MiNT) osname=mint
2203                         ;;
2204                 netbsd*) osname=netbsd
2205                         osvers="$3"
2206                         ;;
2207                 news-os) osvers="$3"
2208                         case "$3" in
2209                         4*) osname=newsos4 ;;
2210                         *) osname=newsos ;;
2211                         esac
2212                         ;;
2213                 bsd386) osname=bsd386
2214                         osvers=`$uname -r`
2215                         ;;
2216                 POSIX-BC | posix-bc ) osname=posix-bc
2217                         osvers="$3"
2218                         ;;
2219                 powerux | power_ux | powermax_os | powermaxos | \
2220                 powerunix | power_unix) osname=powerux
2221                         osvers="$3"
2222                         ;;
2223                 next*) osname=next ;;
2224                 solaris) osname=solaris
2225                         case "$3" in
2226                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2227                         *)      osvers="$3" ;;
2228                         esac
2229                         ;;
2230                 sunos) osname=sunos
2231                         case "$3" in
2232                         5*) osname=solaris
2233                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2234                         *)      osvers="$3" ;;
2235                         esac
2236                         ;;
2237                 titanos) osname=titanos
2238                         case "$3" in
2239                         1*) osvers=1 ;;
2240                         2*) osvers=2 ;;
2241                         3*) osvers=3 ;;
2242                         4*) osvers=4 ;;
2243                         *)      osvers="$3" ;;
2244                         esac
2245                         ;;
2246                 ultrix) osname=ultrix
2247                         osvers="$3"
2248                         ;;
2249                 osf1|mls+)      case "$5" in
2250                                 alpha)
2251                                         osname=dec_osf
2252                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2253                                         ;;
2254                         hp*)    osname=hp_osf1  ;;
2255                         mips)   osname=mips_osf1 ;;
2256                         esac
2257                         ;;
2258                 uts) osname=uts 
2259                         osvers="$3"
2260                         ;;
2261                 qnx) osname=qnx
2262                         osvers="$4"
2263                         ;;
2264                 $2) case "$osname" in
2265                         *isc*) ;;
2266                         *freebsd*) ;;
2267                         svr*)
2268                                 : svr4.x or possibly later
2269                                 case "svr$3" in 
2270                                 ${osname}*)
2271                                         osname=svr$3
2272                                         osvers=$4
2273                                         ;;
2274                                 esac
2275                                 case "$osname" in
2276                                 svr4.0)
2277                                         : Check for ESIX
2278                                         if test -f /stand/boot ; then
2279                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2280                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2281                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2282                                                         if test -n "$isesix"; then
2283                                                                 osname=esix4
2284                                                         fi
2285                                                 fi
2286                                         fi
2287                                         ;;
2288                                 esac
2289                                 ;;
2290                         *)      if test -f /etc/systemid; then
2291                                         osname=sco
2292                                         set `echo $3 | $sed 's/\./ /g'` $4
2293                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2294                                                 osvers=$1.$2.$3
2295                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2296                                                 osvers=$1.$2
2297                                         elif $test -f $src/hints/sco_$1.sh; then
2298                                                 osvers=$1
2299                                         fi
2300                                 else
2301                                         case "$osname" in
2302                                         '') : Still unknown.  Probably a generic Sys V.
2303                                                 osname="sysv"
2304                                                 osvers="$3"
2305                                                 ;;
2306                                         esac
2307                                 fi
2308                                 ;;
2309                         esac
2310                         ;;
2311                 *)      case "$osname" in
2312                         '') : Still unknown.  Probably a generic BSD.
2313                                 osname="$1"
2314                                 osvers="$3"
2315                                 ;;
2316                         esac
2317                         ;;
2318                 esac
2319         else
2320                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2321                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2322                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2323                                 osname=news_os
2324                         fi
2325                         $rm -f UU/kernel.what
2326                 elif test -d c:/.; then
2327                         set X $myuname
2328                         osname=os2
2329                         osvers="$5"
2330                 fi
2331         fi
2332         
2333         : Now look for a hint file osname_osvers, unless one has been
2334         : specified already.
2335         case "$hintfile" in
2336         ''|' ')
2337                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2338                 : Also try without trailing minor version numbers.
2339                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2340                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2341                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2342                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2343                 case "$file" in
2344                 '') dflt=none ;;
2345                 *)  case "$osvers" in
2346                         '') dflt=$file
2347                                 ;;
2348                         *)  if $test -f $src/hints/$file.sh ; then
2349                                         dflt=$file
2350                                 elif $test -f $src/hints/$xfile.sh ; then
2351                                         dflt=$xfile
2352                                 elif $test -f $src/hints/$xxfile.sh ; then
2353                                         dflt=$xxfile
2354                                 elif $test -f $src/hints/$xxxfile.sh ; then
2355                                         dflt=$xxxfile
2356                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2357                                         dflt=$xxxxfile
2358                                 elif $test -f "$src/hints/${osname}.sh" ; then
2359                                         dflt="${osname}"
2360                                 else
2361                                         dflt=none
2362                                 fi
2363                                 ;;
2364                         esac
2365                         ;;
2366                 esac
2367                 if $test -f Policy.sh ; then
2368                         case "$dflt" in
2369                         *Policy*) ;;
2370                         none) dflt="Policy" ;;
2371                         *) dflt="Policy $dflt" ;;
2372                         esac
2373                 fi
2374                 ;;
2375         *)
2376                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2377                 ;;
2378         esac
2379
2380         if $test -f Policy.sh ; then
2381                 $cat <<EOM
2382
2383 There's also a Policy hint file available, which should make the
2384 site-specific (policy) questions easier to answer.
2385 EOM
2386
2387         fi
2388
2389         $cat <<EOM
2390
2391 You may give one or more space-separated answers, or "none" if appropriate.
2392 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2393 is a good thing.  DO NOT give a wrong version or a wrong OS.
2394
2395 EOM
2396
2397         rp="Which of these apply, if any?"
2398         . UU/myread
2399         tans=$ans
2400         for file in $tans; do
2401                 if $test X$file = XPolicy -a -f Policy.sh; then
2402                         . Policy.sh
2403                         $cat Policy.sh >> UU/config.sh
2404                 elif $test -f $src/hints/$file.sh; then
2405                         . $src/hints/$file.sh
2406                         $cat $src/hints/$file.sh >> UU/config.sh
2407                 elif $test X$tans = X -o X$tans = Xnone ; then
2408                         : nothing
2409                 else
2410                         : Give one chance to correct a possible typo.
2411                         echo "$file.sh does not exist"
2412                         dflt=$file
2413                         rp="hint to use instead?"
2414                         . UU/myread
2415                         for file in $ans; do
2416                                 if $test -f "$src/hints/$file.sh"; then
2417                                         . $src/hints/$file.sh
2418                                         $cat $src/hints/$file.sh >> UU/config.sh
2419                                 elif $test X$ans = X -o X$ans = Xnone ; then
2420                                         : nothing
2421                                 else
2422                                         echo "$file.sh does not exist -- ignored."
2423                                 fi
2424                         done
2425                 fi
2426         done
2427
2428         hint=recommended
2429         : Remember our hint file for later.
2430         if $test -f "$src/hints/$file.sh" ; then
2431                 hintfile="$file"
2432         else
2433                 hintfile=''
2434         fi
2435 fi
2436 cd UU
2437 ;;
2438 *)
2439         echo " "
2440         echo "Fetching default answers from $config_sh..." >&4
2441         tmp_n="$n"
2442         tmp_c="$c"
2443         cd ..
2444         cp $config_sh config.sh 2>/dev/null
2445         chmod +w config.sh
2446         . ./config.sh
2447         cd UU
2448         cp ../config.sh .
2449         n="$tmp_n"
2450         c="$tmp_c"
2451         hint=previous
2452         ;;
2453 esac
2454 test "$override" && . ./optdef.sh
2455 myuname="$newmyuname"
2456
2457 : Restore computed paths
2458 for file in $loclist $trylist; do
2459         eval $file="\$_$file"
2460 done
2461
2462 cat << EOM
2463
2464 Configure uses the operating system name and version to set some defaults.
2465 The default value is probably right if the name rings a bell. Otherwise,
2466 since spelling matters for me, either accept the default or answer "none"
2467 to leave it blank.
2468
2469 EOM
2470 case "$osname" in
2471         ''|' ')
2472                 case "$hintfile" in
2473                 ''|' '|none) dflt=none ;;
2474                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2475                 esac
2476                 ;;
2477         *) dflt="$osname" ;;
2478 esac
2479 rp="Operating system name?"
2480 . ./myread
2481 case "$ans" in
2482 none)  osname='' ;;
2483 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2484 esac
2485 echo " "
2486 case "$osvers" in
2487         ''|' ')
2488                 case "$hintfile" in
2489                 ''|' '|none) dflt=none ;;
2490                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2491                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2492                         case "$dflt" in
2493                         ''|' ') dflt=none ;;
2494                         esac
2495                         ;;
2496                 esac
2497                 ;;
2498         *) dflt="$osvers" ;;
2499 esac
2500 rp="Operating system version?"
2501 . ./myread
2502 case "$ans" in
2503 none)  osvers='' ;;
2504 *) osvers="$ans" ;;
2505 esac
2506
2507 : who configured the system
2508 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2509 cf_by=`(logname) 2>/dev/null`
2510 case "$cf_by" in
2511 "")
2512         cf_by=`(whoami) 2>/dev/null`
2513         case "$cf_by" in
2514         "") cf_by=unknown ;;
2515         esac ;;
2516 esac
2517
2518 : set up the script used to warn in case of inconsistency
2519 cat <<EOS >whoa
2520 $startsh
2521 EOS
2522 cat <<'EOSC' >>whoa
2523 dflt=y
2524 echo " "
2525 echo "*** WHOA THERE!!! ***" >&4
2526 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2527 rp="    Keep the $hint value?"
2528 . ./myread
2529 case "$ans" in
2530 y) td=$was; tu=$was;;
2531 esac
2532 EOSC
2533
2534 : function used to set $1 to $val
2535 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2536 case "$val$was" in
2537 $define$undef) . ./whoa; eval "$var=\$td";;
2538 $undef$define) . ./whoa; eval "$var=\$tu";;
2539 *) eval "$var=$val";;
2540 esac'
2541
2542 cat <<EOM
2543
2544 Perl can be built to take advantage of threads, on some systems.
2545 To do so, Configure must be run with -Dusethreads.
2546
2547 Note that threading is a highly experimental feature, and
2548 some known race conditions still remain.  If you choose to try
2549 it, be very sure to not actually deploy it for production
2550 purposes.  README.threads has more details, and is required
2551 reading if you enable threads.
2552 EOM
2553 case "$usethreads" in
2554 $define|true|[yY]*)     dflt='y';;
2555 *) dflt='n';;
2556 esac
2557 rp='Build a threading Perl?'
2558 . ./myread
2559 case "$ans" in
2560 y|Y)    val="$define" ;;     
2561 *)      val="$undef" ;;
2562 esac
2563 set usethreads
2564 eval $setvar 
2565
2566 case "$d_oldpthreads" in
2567 '')     : Configure tests would be welcome here.  For now, assume undef.
2568         val="$undef" ;;
2569 *)      val="$d_oldpthreads" ;;
2570 esac
2571 set d_oldpthreads
2572 eval $setvar
2573
2574
2575 case "$usethreads" in
2576 "$define"|true|[yY]*)
2577 : Look for a hint-file generated 'call-back-unit'.  If the
2578 : user has specified that a threading perl is to be built,
2579 : we may need to set or change some other defaults.
2580         if $test -f usethreads.cbu; then
2581                 echo "Your platform has some specific hints for threaded builds, using them..."
2582                 . ./usethreads.cbu
2583         else
2584                 $cat <<EOM
2585 (Your platform doesn't have any specific hints for threaded builds.
2586  Assuming POSIX threads, then.)
2587 EOM
2588         fi
2589     ;;
2590 esac
2591
2592 cat <<EOM
2593
2594 Perl can be built so that multiple Perl interpreters can coexist
2595 within the same Perl executable.  To do so, Configure must be run with
2596 -Dusemultiplicity.
2597
2598 Normally you do not need this and you should answer no.
2599
2600 EOM
2601 case "$usemultiplicity" in
2602 $define|true|[yY]*)     dflt='y';;
2603 *) dflt='n';;
2604 esac
2605 rp='Build Perl for multiplicity?'
2606 . ./myread
2607 case "$ans" in
2608 y|Y)    val="$define" ;;     
2609 *)      val="$undef" ;;
2610 esac
2611 set usemultiplicity
2612 eval $setvar 
2613
2614 : determine where manual pages are on this system
2615 echo " "
2616 case "$sysman" in
2617 '') 
2618         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2619         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2620         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2621         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2622         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2623         sysman=`./loc . /usr/man/man1 $syspath`
2624         ;;
2625 esac
2626 if $test -d "$sysman"; then
2627         echo "System manual is in $sysman." >&4
2628 else
2629         echo "Could not find manual pages in source form." >&4
2630 fi
2631
2632 : see what memory models we can support
2633 case "$models" in
2634 '')
2635         $cat >pdp11.c <<'EOP'
2636 int main() {
2637 #ifdef pdp11
2638         exit(0);
2639 #else
2640         exit(1);
2641 #endif
2642 }
2643 EOP
2644         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2645         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2646                 dflt='unsplit split'
2647         else
2648                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2649                 case "$tans" in
2650                 X) dflt='none';;
2651                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2652                                 dflt='small'
2653                         else
2654                                 dflt=''
2655                         fi
2656                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2657                                 dflt="$dflt medium"
2658                         fi
2659                         if $test -d /lib/large || $test -d /usr/lib/large; then
2660                                 dflt="$dflt large"
2661                         fi
2662                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2663                                 dflt="$dflt huge"
2664                         fi
2665                 esac
2666         fi;;
2667 *) dflt="$models";;
2668 esac
2669 $cat <<EOM
2670  
2671 Some systems have different model sizes.  On most systems they are called
2672 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2673 split.  If your system doesn't support different memory models, say "none".
2674 If you wish to force everything to one memory model, say "none" here and
2675 put the appropriate flags later when it asks you for other cc and ld flags.
2676 Venix systems may wish to put "none" and let the compiler figure things out.
2677 (In the following question multiple model names should be space separated.)
2678
2679 The default for most systems is "none".
2680
2681 EOM
2682 rp="Which memory models are supported?"
2683 . ./myread
2684 models="$ans"
2685
2686 case "$models" in
2687 none)
2688         small=''
2689         medium=''
2690         large=''
2691         huge=''
2692         unsplit=''
2693         split=''
2694         ;;
2695 *split)
2696         case "$split" in
2697         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2698                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2699                         dflt='-i'
2700                 else
2701                         dflt='none'
2702                 fi;;
2703         *) dflt="$split";;
2704         esac
2705         rp="What flag indicates separate I and D space?"
2706         . ./myread
2707         tans="$ans"
2708         case "$tans" in
2709         none) tans='';;
2710         esac
2711         split="$tans"
2712         unsplit='';;
2713 *large*|*small*|*medium*|*huge*)
2714         case "$models" in
2715         *large*)
2716                 case "$large" in
2717                 '') dflt='-Ml';;
2718                 *) dflt="$large";;
2719                 esac
2720         rp="What flag indicates large model?"
2721         . ./myread
2722         tans="$ans"
2723         case "$tans" in
2724         none) tans='';
2725         esac
2726         large="$tans";;
2727         *) large='';;
2728         esac
2729         case "$models" in
2730         *huge*) case "$huge" in
2731                 '') dflt='-Mh';;
2732                 *) dflt="$huge";;
2733                 esac
2734                 rp="What flag indicates huge model?"
2735                 . ./myread
2736                 tans="$ans"
2737                 case "$tans" in
2738                 none) tans='';
2739                 esac
2740                 huge="$tans";;
2741         *) huge="$large";;
2742         esac
2743         case "$models" in
2744         *medium*) case "$medium" in
2745                 '') dflt='-Mm';;
2746                 *) dflt="$medium";;
2747                 esac
2748                 rp="What flag indicates medium model?"
2749                 . ./myread
2750                 tans="$ans"
2751                 case "$tans" in
2752                 none) tans='';
2753                 esac
2754                 medium="$tans";;
2755         *) medium="$large";;
2756         esac
2757         case "$models" in
2758         *small*) case "$small" in
2759                 '') dflt='none';;
2760                 *) dflt="$small";;
2761                 esac
2762                 rp="What flag indicates small model?"
2763                 . ./myread
2764                 tans="$ans"
2765                 case "$tans" in
2766                 none) tans='';
2767                 esac
2768                 small="$tans";;
2769         *) small='';;
2770         esac
2771         ;;
2772 *)
2773         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2774         ;;
2775 esac
2776 $rm -f pdp11.* pdp11
2777
2778 : make some quick guesses about what we are up against
2779 echo " "
2780 $echo $n "Hmm...  $c"
2781 echo exit 1 >bsd
2782 echo exit 1 >usg
2783 echo exit 1 >v7
2784 echo exit 1 >osf1
2785 echo exit 1 >eunice
2786 echo exit 1 >xenix
2787 echo exit 1 >venix
2788 echo exit 1 >os2
2789 d_bsd="$undef"
2790 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2791 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2792 then
2793         echo "Looks kind of like an OSF/1 system, but we'll see..."
2794         echo exit 0 >osf1
2795 elif test `echo abc | tr a-z A-Z` = Abc ; then
2796         xxx=`./loc addbib blurfl $pth`
2797         if $test -f $xxx; then
2798         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2799                 echo exit 0 >bsd
2800                 echo exit 0 >usg
2801         else
2802                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2803                         echo "Looks kind of like an extended USG system, but we'll see..."
2804                 else
2805                         echo "Looks kind of like a USG system, but we'll see..."
2806                 fi
2807                 echo exit 0 >usg
2808         fi
2809 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2810         echo "Looks kind of like a BSD system, but we'll see..."
2811         d_bsd="$define"
2812         echo exit 0 >bsd
2813 else
2814         echo "Looks kind of like a Version 7 system, but we'll see..."
2815         echo exit 0 >v7
2816 fi
2817 case "$eunicefix" in
2818 *unixtovms*)
2819         $cat <<'EOI'
2820 There is, however, a strange, musty smell in the air that reminds me of
2821 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2822 EOI
2823         echo exit 0 >eunice
2824         d_eunice="$define"
2825 : it so happens the Eunice I know will not run shell scripts in Unix format
2826         ;;
2827 *)
2828         echo " "
2829         echo "Congratulations.  You aren't running Eunice."
2830         d_eunice="$undef"
2831         ;;
2832 esac
2833 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2834 case "$p_" in
2835 :) ;;
2836 *)
2837         $cat <<'EOI'
2838 I have the feeling something is not exactly right, however...don't tell me...
2839 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2840 EOI
2841         echo exit 0 >os2
2842         ;;
2843 esac
2844 if test -f /xenix; then
2845         echo "Actually, this looks more like a XENIX system..."
2846         echo exit 0 >xenix
2847         d_xenix="$define"
2848 else
2849         echo " "
2850         echo "It's not Xenix..."
2851         d_xenix="$undef"
2852 fi
2853 chmod +x xenix
2854 $eunicefix xenix
2855 if test -f /venix; then
2856         echo "Actually, this looks more like a VENIX system..."
2857         echo exit 0 >venix
2858 else
2859         echo " "
2860         if ./xenix; then
2861                 : null
2862         else
2863                 echo "Nor is it Venix..."
2864         fi
2865 fi
2866 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2867 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2868 $rm -f foo
2869
2870 : see if we need a special compiler
2871 echo " "
2872 if ./usg; then
2873         case "$cc" in
2874         '') case "$Mcc" in
2875                 /*) dflt='Mcc';;
2876                 *) case "$large" in
2877                         -M*) dflt='cc';;
2878                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2879                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2880                                                 dflt='cc'
2881                                         else
2882                                                 dflt='cc -M'
2883                                         fi
2884                                 else
2885                                         dflt='cc'
2886                                 fi;;
2887                         esac;;
2888                 esac;;
2889         *)  dflt="$cc";;
2890         esac
2891         case "$dflt" in
2892         *M*)    $cat <<'EOM'
2893 On some older systems the default C compiler will not resolve multiple global
2894 references that happen to have the same name.  On some such systems the "Mcc"
2895 command may be used to force these to be resolved.  On other systems a "cc -M"
2896 command is required.  (Note that the -M flag on other systems indicates a
2897 memory model to use!) If you have the Gnu C compiler, you might wish to use
2898 that instead.
2899
2900 EOM
2901         ;;
2902         esac
2903         rp="Use which C compiler?"
2904         . ./myread
2905         cc="$ans"
2906 else
2907         case "$cc" in
2908         '') dflt=cc;;
2909         *) dflt="$cc";;
2910         esac
2911         rp="Use which C compiler?"
2912         . ./myread
2913         cc="$ans"
2914 fi
2915 : Look for a hint-file generated 'call-back-unit'.  Now that the
2916 : user has specified the compiler, we may need to set or change some
2917 : other defaults.
2918 if $test -f cc.cbu; then
2919     . ./cc.cbu
2920 fi
2921 echo " "
2922 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2923 $cat >gccvers.c <<EOM
2924 #include <stdio.h>
2925 int main() {
2926 #ifdef __GNUC__
2927 #ifdef __VERSION__
2928         printf("%s\n", __VERSION__);
2929 #else
2930         printf("%s\n", "1");
2931 #endif
2932 #endif
2933         exit(0);
2934 }
2935 EOM
2936 if $cc -o gccvers gccvers.c; then
2937         gccversion=`./gccvers`
2938         case "$gccversion" in
2939         '') echo "You are not using GNU cc." ;;
2940         *)  echo "You are using GNU cc $gccversion." ;;
2941         esac
2942 else
2943         echo " "
2944         echo "*** WHOA THERE!!! ***" >&4
2945         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
2946         case "$knowitall" in
2947         '')
2948         echo "    You'd better start hunting for one and let me know about it." >&4
2949                 exit 1
2950                 ;;
2951         esac
2952 fi
2953 $rm -f gccvers*
2954 case "$gccversion" in
2955 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2956 esac
2957
2958 cat <<EOM
2959
2960 Perl can be built to take advantage of explicit 64-bit interfaces,
2961 on some systems.  To do so, Configure must be run with -Duse64bits.
2962
2963 If this doesn't make any sense to you, just accept the default 'n'.
2964 EOM
2965 case "$use64bits" in
2966 $define|true|[yY]*)     dflt='y';;
2967 *) dflt='n';;
2968 esac
2969 rp='Try to use explicit 64-bit interfaces, if available?'
2970 . ./myread
2971 case "$ans" in
2972 y|Y) 
2973         val="$define"
2974         ;;     
2975 *)      
2976         val="$undef"
2977         ;;
2978 esac
2979 set use64bits
2980 eval $setvar
2981
2982 case "$archname64" in
2983 '') archname64='' ;;    # not a typo
2984 esac
2985
2986 case "$use64bits" in
2987 "$define"|true|[yY]*)
2988 : Look for a hint-file generated 'call-back-unit'.  If the
2989 : user has specified that a 64 bit perl is to be built,
2990 : we may need to set or change some other defaults.
2991         if $test -f use64bits.cbu; then
2992                 echo "Your platform has some specific hints for 64-bit builds, using them..."
2993                 . ./use64bits.cbu
2994         else
2995                 $cat <<EOM
2996 (Your platform doesn't have any specific hints for 64-bit builds.
2997  This is probably okay, especially if your system is a true 64-bit system.)
2998 EOM
2999                 case "$gccversion" in
3000                 '')     ;;
3001                 *)      $cat <<EOM
3002 But since you seem to be using gcc,
3003 I will now add -DUSE_LONG_LONG to the compilation flags.
3004 EOM
3005                         ccflags="$ccflags -DUSE_LONG_LONG"
3006                         ;;
3007                 esac
3008         fi
3009         ;;
3010 esac
3011
3012 : determine the architecture name
3013 echo " "
3014 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3015         tarch=`arch`"-$osname"
3016 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3017         if uname -m > tmparch 2>&1 ; then
3018                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3019                         -e 's/$/'"-$osname/" tmparch`
3020         else
3021                 tarch="$osname"
3022         fi
3023         $rm -f tmparch
3024 else
3025         tarch="$osname"
3026 fi
3027 case "$myarchname" in
3028 ''|"$tarch") ;;
3029 *)
3030         echo "(Your architecture name used to be $myarchname.)"
3031         archname=''
3032         ;;
3033 esac
3034 myarchname="$tarch"
3035 case "$archname" in
3036 '') dflt="$tarch";;
3037 *) dflt="$archname";;
3038 esac
3039 rp='What is your architecture name'
3040 . ./myread
3041 archname="$ans"
3042 case "$usethreads" in
3043 $define)
3044         echo "Threads selected." >&4
3045         case "$archname" in
3046         *-thread*) echo "...and architecture name already has -thread." >&4
3047                 ;;
3048         *)      archname="$archname-thread"
3049                 echo "...setting architecture name to $archname." >&4
3050                 ;;
3051         esac
3052         ;;
3053 esac
3054 case "$usemultiplicity" in
3055 $define)
3056         echo "Multiplicity selected." >&4
3057         case "$archname" in
3058         *-multi*) echo "...and architecture name already has -multi." >&4
3059                 ;;
3060         *)      archname="$archname-multi"
3061                 echo "...setting architecture name to $archname." >&4
3062                 ;;
3063         esac
3064         ;;
3065 esac
3066 case "$use64bits" in
3067 $define)
3068         echo "Explicit 64-bitness selected." >&4
3069         case "$archname64" in
3070         '')
3071                 ;;
3072         *)
3073                 case "$archname" in
3074                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3075                         ;;
3076                 *)      archname="$archname-$archname64"
3077                         echo "...setting architecture name to $archname." >&4
3078                         ;;
3079                 esac
3080                 ;;
3081         esac
3082 esac
3083
3084 : decide how portable to be.  Allow command line overrides.
3085 case "$d_portable" in
3086 "$undef") ;;
3087 *)      d_portable="$define" ;;
3088 esac
3089
3090 : set up shell script to do ~ expansion
3091 cat >filexp <<EOSS
3092 $startsh
3093 : expand filename
3094 case "\$1" in
3095  ~/*|~)
3096         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3097         ;;
3098  ~*)
3099         if $test -f /bin/csh; then
3100                 /bin/csh -f -c "glob \$1"
3101                 failed=\$?
3102                 echo ""
3103                 exit \$failed
3104         else
3105                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3106                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3107                 if $test ! -d "\$dir"; then
3108                         me=\`basename \$0\`
3109                         echo "\$me: can't locate home directory for: \$name" >&2
3110                         exit 1
3111                 fi
3112                 case "\$1" in
3113                 */*)
3114                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3115                         ;;
3116                 *)
3117                         echo \$dir
3118                         ;;
3119                 esac
3120         fi
3121         ;;
3122 *)
3123         echo \$1
3124         ;;
3125 esac
3126 EOSS
3127 chmod +x filexp
3128 $eunicefix filexp
3129
3130 : now set up to get a file name
3131 cat <<EOS >getfile
3132 $startsh
3133 EOS
3134 cat <<'EOSC' >>getfile
3135 tilde=''
3136 fullpath=''
3137 already=''
3138 skip=''
3139 none_ok=''
3140 exp_file=''
3141 nopath_ok=''
3142 orig_rp="$rp"
3143 orig_dflt="$dflt"
3144 case "$gfpth" in
3145 '') gfpth='.' ;;
3146 esac
3147
3148 case "$fn" in
3149 *\(*)
3150         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3151         fn=`echo $fn | sed 's/(.*)//'`
3152         ;;
3153 esac
3154
3155 case "$fn" in
3156 *:*)
3157         loc_file=`expr $fn : '.*:\(.*\)'`
3158         fn=`expr $fn : '\(.*\):.*'`
3159         ;;
3160 esac
3161
3162 case "$fn" in
3163 *~*) tilde=true;;
3164 esac
3165 case "$fn" in
3166 */*) fullpath=true;;
3167 esac
3168 case "$fn" in
3169 *+*) skip=true;;
3170 esac
3171 case "$fn" in
3172 *n*) none_ok=true;;
3173 esac
3174 case "$fn" in
3175 *e*) exp_file=true;;
3176 esac
3177 case "$fn" in
3178 *p*) nopath_ok=true;;
3179 esac
3180
3181 case "$fn" in
3182 *f*) type='File';;
3183 *d*) type='Directory';;
3184 *l*) type='Locate';;
3185 esac
3186
3187 what="$type"
3188 case "$what" in
3189 Locate) what='File';;
3190 esac
3191
3192 case "$exp_file" in
3193 '')
3194         case "$d_portable" in
3195         "$define") ;;
3196         *) exp_file=true;;
3197         esac
3198         ;;
3199 esac
3200
3201 cd ..
3202 while test "$type"; do
3203         redo=''
3204         rp="$orig_rp"
3205         dflt="$orig_dflt"
3206         case "$tilde" in
3207         true) rp="$rp (~name ok)";;
3208         esac
3209         . UU/myread
3210         if test -f UU/getfile.ok && \
3211                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3212         then
3213                 value="$ans"
3214                 ansexp="$ans"
3215                 break
3216         fi
3217         case "$ans" in
3218         none)
3219                 value=''
3220                 ansexp=''
3221                 case "$none_ok" in
3222                 true) type='';;
3223                 esac
3224                 ;;
3225         *)
3226                 case "$tilde" in
3227                 '') value="$ans"
3228                         ansexp="$ans";;
3229                 *)
3230                         value=`UU/filexp $ans`
3231                         case $? in
3232                         0)
3233                                 if test "$ans" != "$value"; then
3234                                         echo "(That expands to $value on this system.)"
3235                                 fi
3236                                 ;;
3237                         *) value="$ans";;
3238                         esac
3239                         ansexp="$value"
3240                         case "$exp_file" in
3241                         '') value="$ans";;
3242                         esac
3243                         ;;
3244                 esac
3245                 case "$fullpath" in
3246                 true)
3247                         case "$ansexp" in
3248                         /*) value="$ansexp" ;;
3249                         *)
3250                                 redo=true
3251                                 case "$already" in
3252                                 true)
3253                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3254                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3255                                         ;;
3256                                 *)
3257                                 echo "Please give a full path name, starting with slash." >&4
3258                                         case "$tilde" in
3259                                         true)
3260                                 echo "Note that using ~name is ok provided it expands well." >&4
3261                                                 already=true
3262                                                 ;;
3263                                         esac
3264                                 esac
3265                                 ;;
3266                         esac
3267                         ;;
3268                 esac
3269                 case "$redo" in
3270                 '')
3271                         case "$type" in
3272                         File)
3273                                 for fp in $gfpth; do
3274                                         if test "X$fp" = X.; then
3275                                             pf="$ansexp"
3276                                         else    
3277                                             pf="$fp/$ansexp"
3278                                         fi
3279                                         if test -f "$pf"; then
3280                                                 type=''
3281                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3282                                         then
3283                                                 echo "($value is not a plain file, but that's ok.)"
3284                                                 type=''
3285                                         fi
3286                                         if test X"$type" = X; then
3287                                             value="$pf"
3288                                             break
3289                                         fi
3290                                 done
3291                                 ;;
3292                         Directory)
3293                                 for fp in $gfpth; do
3294                                         if test "X$fp" = X.; then
3295                                             pf="$ansexp"
3296                                         else    
3297                                             pf="$fp/$ansexp"
3298                                         fi
3299                                         if test -d "$pf"; then
3300                                                 type=''
3301                                                 value="$pf"
3302                                                 break
3303                                         fi
3304                                 done
3305                                 ;;
3306                         Locate)
3307                                 if test -d "$ansexp"; then
3308                                         echo "(Looking for $loc_file in directory $value.)"
3309                                         value="$value/$loc_file"
3310                                         ansexp="$ansexp/$loc_file"
3311                                 fi
3312                                 if test -f "$ansexp"; then
3313                                         type=''
3314                                 fi
3315                                 case "$nopath_ok" in
3316                                 true)   case "$value" in
3317                                         */*) ;;
3318                                         *)      echo "Assuming $value will be in people's path."
3319                                                 type=''
3320                                                 ;;
3321                                         esac
3322                                         ;;
3323                                 esac
3324                                 ;;
3325                         esac
3326
3327                         case "$skip" in
3328                         true) type='';
3329                         esac
3330
3331                         case "$type" in
3332                         '') ;;
3333                         *)
3334                                 if test "$fastread" = yes; then
3335                                         dflt=y
3336                                 else
3337                                         dflt=n
3338                                 fi
3339                                 rp="$what $value doesn't exist.  Use that name anyway?"
3340                                 . UU/myread
3341                                 dflt=''
3342                                 case "$ans" in
3343                                 y*) type='';;
3344                                 *) echo " ";;
3345                                 esac
3346                                 ;;
3347                         esac
3348                         ;;
3349                 esac
3350                 ;;
3351         esac
3352 done
3353 cd UU
3354 ans="$value"
3355 rp="$orig_rp"
3356 dflt="$orig_dflt"
3357 rm -f getfile.ok
3358 test "X$gfpthkeep" != Xy && gfpth=""
3359 EOSC
3360
3361 : determine root of directory hierarchy where package will be installed.
3362 case "$prefix" in
3363 '')
3364         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3365         ;;
3366 *)
3367         dflt="$prefix"
3368         ;;
3369 esac
3370 $cat <<EOM
3371
3372 By default, $package will be installed in $dflt/bin, manual pages
3373 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3374 installation directories. Typically this is something like /usr/local.
3375 If you wish to have binaries under /usr/bin but other parts of the
3376 installation under /usr/local, that's ok: you will be prompted
3377 separately for each of the installation directories, the prefix being
3378 only used to set the defaults.
3379
3380 EOM
3381 fn=d~
3382 rp='Installation prefix to use?'
3383 . ./getfile
3384 oldprefix=''
3385 case "$prefix" in
3386 '') ;;
3387 *)
3388         case "$ans" in
3389         "$prefix") ;;
3390         *) oldprefix="$prefix";;
3391         esac
3392         ;;
3393 esac
3394 prefix="$ans"
3395 prefixexp="$ansexp"
3396
3397 : is AFS running?
3398 echo " "
3399 case "$afs" in
3400 $define|true)   afs=true ;;
3401 $undef|false)   afs=false ;;
3402 *)      if test -d /afs; then
3403                 afs=true
3404         else
3405                 afs=false
3406         fi
3407         ;;
3408 esac
3409 if $afs; then
3410         echo "AFS may be running... I'll be extra cautious then..." >&4
3411 else
3412         echo "AFS does not seem to be running..." >&4
3413 fi
3414
3415 : determine installation prefix for where package is to be installed.
3416 if $afs; then 
3417 $cat <<EOM
3418
3419 Since you are running AFS, I need to distinguish the directory in which
3420 files will reside from the directory in which they are installed (and from
3421 which they are presumably copied to the former directory by occult means).
3422
3423 EOM
3424         case "$installprefix" in
3425         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3426         *) dflt="$installprefix";;
3427         esac
3428 else
3429 $cat <<EOM
3430
3431 In some special cases, particularly when building $package for distribution,
3432 it is convenient to distinguish between the directory in which files should 
3433 be installed from the directory ($prefix) in which they 
3434 will eventually reside.  For most users, these two directories are the same.
3435
3436 EOM
3437         case "$installprefix" in
3438         '') dflt=$prefix ;;
3439         *) dflt=$installprefix;;
3440         esac
3441 fi
3442 fn=d~
3443 rp='What installation prefix should I use for installing files?'
3444 . ./getfile
3445 installprefix="$ans"
3446 installprefixexp="$ansexp"
3447
3448 : set the prefixit variable, to compute a suitable default value
3449 prefixit='case "$3" in
3450 ""|none)
3451         case "$oldprefix" in
3452         "") eval "$1=\"\$$2\"";;
3453         *)
3454                 case "$3" in
3455                 "") eval "$1=";;
3456                 none)
3457                         eval "tp=\"\$$2\"";
3458                         case "$tp" in
3459                         ""|" ") eval "$1=\"\$$2\"";;
3460                         *) eval "$1=";;
3461                         esac;;
3462                 esac;;
3463         esac;;
3464 *)
3465         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3466         case "$tp" in
3467         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3468         /*-$oldprefix/*|\~*-$oldprefix/*)
3469                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3470         *) eval "$1=\"\$$2\"";;
3471         esac;;
3472 esac'
3473
3474 : set the base revision
3475 baserev=5.0
3476
3477 : get the patchlevel
3478 echo " "
3479 echo "Getting the current patchlevel..." >&4
3480 if $test -r $rsrc/patchlevel.h;then
3481         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3482         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3483 else
3484         patchlevel=0
3485         subversion=0
3486 fi
3487 $echo $n "(You have $package" $c
3488 case "$package" in
3489 "*$baserev")    ;;
3490 *)              $echo $n " $baserev" $c ;;
3491 esac
3492 $echo $n " patchlevel $patchlevel" $c
3493 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3494 echo ".)"
3495
3496 if test 0 -eq "$subversion"; then
3497         version=`LC_ALL=C; export LC_ALL; \
3498                  echo $baserev $patchlevel | \
3499                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3500 else
3501         version=`LC_ALL=C; export LC_ALL; \
3502                  echo $baserev $patchlevel $subversion | \
3503                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3504 fi
3505 : Figure out perl API version.  Perhaps this should be in patchlevel.h
3506 if test "$subversion" -lt 50; then
3507         apiversion=`LC_ALL=C; export LC_ALL; \
3508                  LANGUAGE=C; export LANGUAGE; \
3509                  echo $baserev $patchlevel | \
3510                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3511 else
3512         apiversion="$version"
3513 fi
3514
3515 : determine installation style
3516 : For now, try to deduce it from prefix unless it is already set.
3517 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3518 case "$installstyle" in
3519 '')     case "$prefix" in
3520                 *perl*) dflt='lib';;
3521                 *) dflt='lib/perl5' ;;
3522         esac
3523         ;;
3524 *)      dflt='lib/perl5' ;;
3525 esac
3526 : Probably not worth prompting for this since we prompt for all
3527 : the directories individually, and the prompt would be too long and
3528 : confusing anyway.
3529 installstyle=$dflt
3530
3531 : determine where private library files go
3532 : Usual default is /usr/local/lib/perl5/$version.
3533 : Also allow things like /opt/perl/lib/$version, since 
3534 : /opt/perl/lib/perl5... would be redundant.
3535 : The default "style" setting is made in installstyle.U
3536 case "$installstyle" in
3537 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3538 *)       set dflt privlib lib/$version ;;
3539 esac
3540 eval $prefixit
3541 $cat <<EOM
3542
3543 There are some auxiliary files for $package that need to be put into a
3544 private library directory that is accessible by everyone.
3545
3546 EOM
3547 fn=d~+
3548 rp='Pathname where the private library files will reside?'
3549 . ./getfile
3550 privlib="$ans"
3551 privlibexp="$ansexp"
3552 : Change installation prefix, if necessary.
3553 if $test X"$prefix" != X"$installprefix"; then
3554         installprivlib=`echo $privlibexp | sed 's#^$prefix#$installprefix#'`
3555 else
3556         installprivlib="$privlibexp"
3557 fi
3558
3559 : set the prefixup variable, to restore leading tilda escape
3560 prefixup='case "$prefixexp" in
3561 "$prefix") ;;
3562 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3563 esac'
3564
3565 : determine where public architecture dependent libraries go
3566 set archlib archlib
3567 eval $prefixit
3568 : privlib default is /usr/local/lib/$package/$version
3569 : archlib default is /usr/local/lib/$package/$version/$archname
3570 : privlib may have an optional trailing /share.
3571 tdflt=`echo $privlib | $sed 's,/share$,,'`
3572 tdflt=$tdflt/$archname
3573 case "$archlib" in
3574 '')     dflt=$tdflt
3575         ;;
3576 *)      dflt="$archlib"
3577     ;;
3578 esac
3579 $cat <<EOM
3580
3581 $spackage contains architecture-dependent library files.  If you are
3582 sharing libraries in a heterogeneous environment, you might store
3583 these files in a separate location.  Otherwise, you can just include
3584 them with the rest of the public library files.
3585
3586 EOM
3587 fn=d+~
3588 rp='Where do you want to put the public architecture-dependent libraries?'
3589 . ./getfile
3590 archlib="$ans"
3591 archlibexp="$ansexp"
3592 if $test X"$archlib" = X"$privlib"; then
3593         d_archlib="$undef"
3594 else
3595         d_archlib="$define"
3596 fi
3597 : Change installation prefix, if necessary.
3598 if $test X"$prefix" != X"$installprefix"; then
3599         installarchlib=`echo $archlibexp | sed 's#^$prefix#$installprefix#'`
3600 else
3601         installarchlib="$archlibexp"
3602 fi
3603
3604
3605 : Binary compatibility with 5.005 is not possible for builds
3606 : with advanced features
3607 case "$usethreads$usemultiplicity" in
3608 *define*)
3609         bincompat5005="$undef"
3610         d_bincompat5005="$undef"
3611         ;;
3612 *)      $cat <<EOM
3613
3614 Perl 5.006 can be compiled for binary compatibility with 5.005.
3615 If you decide to do so, you will be able to continue using most
3616 of the extensions that were compiled for Perl 5.005.
3617
3618 EOM
3619         case "$bincompat5005$d_bincompat5005" in
3620         *"$undef"*) dflt=n ;;
3621         *) dflt=y ;;
3622         esac
3623         rp='Binary compatibility with Perl 5.005?'
3624         . ./myread
3625         case "$ans" in
3626         y*) val="$define" ;;
3627         *)  val="$undef" ;;
3628         esac
3629         set d_bincompat5005
3630         eval $setvar
3631         case "$d_bincompat5005" in
3632         "$define")
3633                 bincompat5005="$define"
3634                 ;;
3635         *)      bincompat5005="$undef"
3636                 d_bincompat5005="$undef"
3637                 ;;
3638         esac
3639         ;;
3640 esac
3641
3642
3643 : see if setuid scripts can be secure
3644 $cat <<EOM
3645
3646 Some kernels have a bug that prevents setuid #! scripts from being
3647 secure.  Some sites have disabled setuid #! scripts because of this.
3648
3649 First let's decide if your kernel supports secure setuid #! scripts.
3650 (If setuid #! scripts would be secure but have been disabled anyway,
3651 don't say that they are secure if asked.)
3652
3653 EOM
3654
3655 val="$undef"
3656 if $test -d /dev/fd; then
3657         echo "#!$ls" >reflect
3658         chmod +x,u+s reflect
3659         ./reflect >flect 2>&1
3660         if $contains "/dev/fd" flect >/dev/null; then
3661                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3662                 val="$define"
3663         else
3664                 $cat <<EOM
3665 If you are not sure if they are secure, I can check but I'll need a
3666 username and password different from the one you are using right now.
3667 If you don't have such a username or don't want me to test, simply
3668 enter 'none'.
3669
3670 EOM
3671                 rp='Other username to test security of setuid scripts with?'
3672                 dflt='none'
3673                 . ./myread
3674                 case "$ans" in
3675                 n|none)
3676                         case "$d_suidsafe" in
3677                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3678                                 dflt=n;;
3679                         "$undef")
3680                                 echo "Well, the $hint value is *not* secure." >&4
3681                                 dflt=n;;
3682                         *)      echo "Well, the $hint value *is* secure." >&4
3683                                 dflt=y;;
3684                         esac
3685                         ;;
3686                 *)
3687                         $rm -f reflect flect
3688                         echo "#!$ls" >reflect
3689                         chmod +x,u+s reflect
3690                         echo >flect
3691                         chmod a+w flect
3692                         echo '"su" will (probably) prompt you for '"$ans's password."
3693                         su $ans -c './reflect >flect'
3694                         if $contains "/dev/fd" flect >/dev/null; then
3695                                 echo "Okay, it looks like setuid scripts are secure." >&4
3696                                 dflt=y
3697                         else
3698                                 echo "I don't think setuid scripts are secure." >&4
3699                                 dflt=n
3700                         fi
3701                         ;;
3702                 esac
3703                 rp='Does your kernel have *secure* setuid scripts?'
3704                 . ./myread
3705                 case "$ans" in
3706                 [yY]*)  val="$define";;
3707                 *)      val="$undef";;
3708                 esac
3709         fi
3710 else
3711         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3712         echo "(That's for file descriptors, not floppy disks.)"
3713         val="$undef"
3714 fi
3715 set d_suidsafe
3716 eval $setvar
3717
3718 $rm -f reflect flect
3719
3720 : now see if they want to do setuid emulation
3721 echo " "
3722 val="$undef"
3723 case "$d_suidsafe" in
3724 "$define")
3725         val="$undef"
3726         echo "No need to emulate SUID scripts since they are secure here." >& 4
3727         ;;
3728 *)
3729         $cat <<EOM
3730 Some systems have disabled setuid scripts, especially systems where
3731 setuid scripts cannot be secure.  On systems where setuid scripts have
3732 been disabled, the setuid/setgid bits on scripts are currently
3733 useless.  It is possible for $package to detect those bits and emulate
3734 setuid/setgid in a secure fashion.  This emulation will only work if
3735 setuid scripts have been disabled in your kernel.
3736
3737 EOM
3738         case "$d_dosuid" in
3739         "$define") dflt=y ;;
3740         *) dflt=n ;;
3741         esac
3742         rp="Do you want to do setuid/setgid emulation?"
3743         . ./myread
3744         case "$ans" in
3745         [yY]*)  val="$define";;
3746         *)      val="$undef";;
3747         esac
3748         ;;
3749 esac
3750 set d_dosuid
3751 eval $setvar
3752
3753 : What should the include directory be ?
3754 echo " "
3755 $echo $n "Hmm...  $c"
3756 dflt='/usr/include'
3757 incpath=''
3758 mips_type=''
3759 if $test -f /bin/mips && /bin/mips; then
3760         echo "Looks like a MIPS system..."
3761         $cat >usr.c <<'EOCP'
3762 #ifdef SYSTYPE_BSD43
3763 /bsd43
3764 #endif
3765 EOCP
3766         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3767                 dflt='/bsd43/usr/include'
3768                 incpath='/bsd43'
3769                 mips_type='BSD 4.3'
3770         else
3771                 mips_type='System V'
3772         fi
3773         $rm -f usr.c usr.out
3774         echo "and you're compiling with the $mips_type compiler and libraries."
3775         xxx_prompt=y
3776         echo "exit 0" >mips
3777 else
3778         echo "Doesn't look like a MIPS system."
3779         xxx_prompt=n
3780         echo "exit 1" >mips
3781 fi
3782 chmod +x mips
3783 $eunicefix mips
3784 case "$usrinc" in
3785 '') ;;
3786 *) dflt="$usrinc";;
3787 esac
3788 case "$xxx_prompt" in
3789 y)      fn=d/
3790         echo " "
3791         rp='Where are the include files you want to use?'
3792         . ./getfile
3793         usrinc="$ans"
3794         ;;
3795 *)      usrinc="$dflt"
3796         ;;
3797 esac
3798
3799 : see how we invoke the C preprocessor
3800 echo " "
3801 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3802 cat <<'EOT' >testcpp.c
3803 #define ABC abc
3804 #define XYZ xyz
3805 ABC.XYZ
3806 EOT
3807 cd ..
3808 if test ! -f cppstdin; then
3809         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3810                 # AIX cc -E doesn't show the absolute headerfile
3811                 # locations but we'll cheat by using the -M flag.
3812                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
3813         else
3814                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3815         fi
3816 else
3817         echo "Keeping your $hint cppstdin wrapper."
3818 fi
3819 chmod 755 cppstdin
3820 wrapper=`pwd`/cppstdin
3821 ok='false'
3822 cd UU
3823
3824 if $test "X$cppstdin" != "X" && \
3825         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3826         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3827 then
3828         echo "You used to use $cppstdin $cppminus so we'll use that again."
3829         case "$cpprun" in
3830         '') echo "But let's see if we can live without a wrapper..." ;;
3831         *)
3832                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3833                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3834                 then
3835                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3836                         ok='true'
3837                 else
3838                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3839                 fi
3840                 ;;
3841         esac
3842 else
3843         case "$cppstdin" in
3844         '') ;;
3845         *)
3846                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3847                 ;;
3848         esac
3849 fi
3850
3851 if $ok; then
3852         : nothing
3853 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3854         $cc -E <testcpp.c >testcpp.out 2>&1; \
3855         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3856         echo "Yup, it does."
3857         x_cpp="$cc -E"
3858         x_minus='';
3859 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3860         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3861         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3862         echo "Yup, it does."
3863         x_cpp="$cc -E"
3864         x_minus='-';
3865 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3866         $cc -P <testcpp.c >testcpp.out 2>&1; \
3867         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3868         echo "Yipee, that works!"
3869         x_cpp="$cc -P"
3870         x_minus='';
3871 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3872         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3873         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3874         echo "At long last!"
3875         x_cpp="$cc -P"
3876         x_minus='-';
3877 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3878         $cpp <testcpp.c >testcpp.out 2>&1; \
3879         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3880         echo "It works!"
3881         x_cpp="$cpp"
3882         x_minus='';
3883 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3884         $cpp - <testcpp.c >testcpp.out 2>&1; \
3885         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3886         echo "Hooray, it works!  I was beginning to wonder."
3887         x_cpp="$cpp"
3888         x_minus='-';
3889 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3890         $wrapper <testcpp.c >testcpp.out 2>&1; \
3891         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3892         x_cpp="$wrapper"
3893         x_minus=''
3894         echo "Eureka!"
3895 else
3896         dflt=''
3897         rp="No dice.  I can't find a C preprocessor.  Name one:"
3898         . ./myread
3899         x_cpp="$ans"
3900         x_minus=''
3901         $x_cpp <testcpp.c >testcpp.out 2>&1
3902         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3903                 echo "OK, that will do." >&4
3904         else
3905 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3906                 exit 1
3907         fi
3908 fi
3909
3910 case "$ok" in
3911 false)
3912         cppstdin="$x_cpp"
3913         cppminus="$x_minus"
3914         cpprun="$x_cpp"
3915         cpplast="$x_minus"
3916         set X $x_cpp
3917         shift
3918         case "$1" in
3919         "$cpp")
3920                 echo "Perhaps can we force $cc -E using a wrapper..."
3921                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3922                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3923                 then
3924                         echo "Yup, we can."
3925                         cppstdin="$wrapper"
3926                         cppminus='';
3927                 else
3928                         echo "Nope, we'll have to live without it..."
3929                 fi
3930                 ;;
3931         esac
3932         case "$cpprun" in
3933         "$wrapper")
3934                 cpprun=''
3935                 cpplast=''
3936                 ;;
3937         esac
3938         ;;
3939 esac
3940
3941 case "$cppstdin" in
3942 "$wrapper"|'cppstdin') ;;
3943 *) $rm -f $wrapper;;
3944 esac
3945 $rm -f testcpp.c testcpp.out
3946
3947 : Set private lib path
3948 case "$plibpth" in
3949 '') if ./mips; then
3950                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3951         fi;;
3952 esac
3953 case "$libpth" in
3954 ' ') dlist='';;
3955 '') dlist="$loclibpth $plibpth $glibpth";;
3956 *) dlist="$libpth";;
3957 esac
3958
3959 : Now check and see which directories actually exist, avoiding duplicates
3960 libpth=''
3961 for xxx in $dlist
3962 do
3963     if $test -d $xxx; then
3964                 case " $libpth " in
3965                 *" $xxx "*) ;;
3966                 *) libpth="$libpth $xxx";;
3967                 esac
3968     fi
3969 done
3970 $cat <<'EOM'
3971
3972 Some systems have incompatible or broken versions of libraries.  Among
3973 the directories listed in the question below, please remove any you
3974 know not to be holding relevant libraries, and add any that are needed.
3975 Say "none" for none.
3976
3977 EOM
3978 case "$libpth" in
3979 '') dflt='none';;
3980 *)
3981         set X $libpth
3982         shift
3983         dflt=${1+"$@"}
3984         ;;
3985 esac
3986 rp="Directories to use for library searches?"
3987 . ./myread
3988 case "$ans" in
3989 none) libpth=' ';;
3990 *) libpth="$ans";;
3991 esac
3992
3993 : compute shared library extension
3994 case "$so" in
3995 '')
3996         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3997                 dflt='sl'
3998         else
3999                 dflt='so'
4000         fi
4001         ;;
4002 *) dflt="$so";;
4003 esac
4004 $cat <<EOM
4005
4006 On some systems, shared libraries may be available.  Answer 'none' if
4007 you want to suppress searching of shared libraries for the remaining
4008 of this configuration.
4009
4010 EOM
4011 rp='What is the file extension used for shared libraries?'
4012 . ./myread
4013 so="$ans"
4014
4015 : Define several unixisms.
4016 : Hints files or command line option can be used to override them.
4017 : The convoluted testing is in case hints files set either the old
4018 : or the new name.
4019 case "$_exe" in
4020 '')     case "$exe_ext" in
4021     '') ;;
4022         *)      _exe="$exe_ext" ;;
4023         esac
4024         ;;
4025 esac
4026 case "$_a" in
4027 '')     case "$lib_ext" in
4028     '') _a='.a';;
4029         *)      _a="$lib_ext" ;;
4030         esac
4031         ;;
4032 esac
4033 case "$_o" in
4034 '') case "$obj_ext" in
4035         '')     _o='.o';;
4036         *)      _o="$obj_ext";;
4037         esac
4038         ;;
4039 esac
4040 case "$p_" in
4041 '') case "$path_sep" in
4042         '')     p_=':';;
4043         *)      p_="$path_sep";;
4044         esac
4045         ;;
4046 esac
4047 exe_ext=$_exe
4048 lib_ext=$_a
4049 obj_ext=$_o
4050 path_sep=$p_
4051
4052 : Which makefile gets called first.  This is used by make depend.
4053 case "$firstmakefile" in
4054 '') firstmakefile='makefile';;
4055 esac
4056
4057 cat <<EOM
4058
4059 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4060 Configure must be run with -Dusesocks.
4061
4062 Normally you do not need this and you should answer no.
4063
4064 EOM
4065 case "$usesocks" in
4066 $define|true|[yY]*)     dflt='y';;
4067 *) dflt='n';;
4068 esac
4069 rp='Build Perl for SOCKS?'
4070 . ./myread
4071 case "$ans" in
4072 y|Y)    val="$define" ;;     
4073 *)      val="$undef" ;;
4074 esac
4075 set usesocks
4076 eval $setvar
4077
4078 : Looking for optional libraries
4079 echo " "
4080 echo "Checking for optional libraries..." >&4
4081 case "$libs" in
4082 ' '|'') dflt='';;
4083 *) dflt="$libs";;
4084 esac
4085 case "$libswanted" in
4086 '') libswanted='c_s';;
4087 esac
4088 case "$usesocks" in
4089 $define)
4090         libswanted="$libswanted socks5 socks5_sh"
4091         ;;
4092 esac
4093 for thislib in $libswanted; do
4094         
4095         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4096                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4097                 echo "Found -l$thislib (shared)."
4098                 case " $dflt " in
4099                 *"-l$thislib "*);;
4100                 *) dflt="$dflt -l$thislib";;
4101                 esac
4102         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4103                 echo "Found -l$thislib (shared)."
4104                 case " $dflt " in
4105                 *"-l$thislib "*);;
4106                 *) dflt="$dflt -l$thislib";;
4107                 esac
4108         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4109                 echo "Found -l$thislib."
4110                 case " $dflt " in
4111                 *"-l$thislib "*);;
4112                 *) dflt="$dflt -l$thislib";;
4113                 esac
4114         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4115                 echo "Found -l$thislib."
4116                 case " $dflt " in
4117                 *"-l$thislib "*);;
4118                 *) dflt="$dflt -l$thislib";;
4119                 esac
4120         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4121                 echo "Found -l${thislib}_s."
4122                 case " $dflt " in
4123                 *"-l$thislib "*);;
4124                 *) dflt="$dflt -l${thislib}_s";;
4125                 esac
4126         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4127                 echo "Found -l$thislib."
4128                 case " $dflt " in
4129                 *"-l$thislib "*);;
4130                 *) dflt="$dflt -l$thislib";;
4131                 esac
4132         else
4133                 echo "No -l$thislib."
4134         fi
4135 done
4136 set X $dflt
4137 shift
4138 dflt="$*"
4139 case "$libs" in
4140 '') dflt="$dflt";;
4141 *) dflt="$libs";;
4142 esac
4143 case "$dflt" in
4144 ' '|'') dflt='none';;
4145 esac
4146
4147 $cat <<EOM
4148
4149 In order to compile $package on your machine, a number of libraries
4150 are usually needed.  Include any other special libraries here as well.
4151 Say "none" for none.  The default list is almost always right.
4152 EOM
4153
4154 echo " "
4155 rp="What libraries to use?"
4156 . ./myread
4157 case "$ans" in
4158 none) libs=' ';;
4159 *) libs="$ans";;
4160 esac
4161
4162 : determine optimize, if desired, or use for debug flag also
4163 case "$optimize" in
4164 ' '|$undef) dflt='none';;
4165 '') dflt='-O';;
4166 *) dflt="$optimize";;
4167 esac
4168 $cat <<EOH
4169
4170 Some C compilers have problems with their optimizers.  By default, $package
4171 compiles with the -O flag to use the optimizer.  Alternately, you might want
4172 to use the symbolic debugger, which uses the -g flag (on traditional Unix
4173 systems).  Either flag can be specified here.  To use neither flag, specify
4174 the word "none".
4175
4176 EOH
4177 rp="What optimizer/debugger flag should be used?"
4178 . ./myread
4179 optimize="$ans"
4180 case "$optimize" in
4181 'none') optimize=" ";;
4182 esac
4183
4184 dflt=''
4185 : We will not override a previous value, but we might want to
4186 : augment a hint file
4187 case "$hint" in
4188 none|recommended)
4189         case "$gccversion" in
4190         1*) dflt='-fpcc-struct-return' ;;
4191         esac
4192         case "$optimize" in
4193         *-g*) dflt="$dflt -DDEBUGGING";;
4194         esac
4195         case "$gccversion" in
4196         2*) if test -d /etc/conf/kconfig.d &&
4197                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4198                 then
4199                         dflt="$dflt -posix"
4200                 fi
4201                 ;;
4202         esac
4203         ;;
4204 esac
4205
4206 case "$mips_type" in
4207 *BSD*|'') inclwanted="$locincpth $usrinc";;
4208 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4209 esac
4210 for thisincl in $inclwanted; do
4211         if $test -d $thisincl; then
4212                 if $test x$thisincl != x$usrinc; then
4213                         case "$dflt" in
4214                         *$thisincl*);;
4215                         *) dflt="$dflt -I$thisincl";;
4216                         esac
4217                 fi
4218         fi
4219 done
4220
4221 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4222         xxx=true;
4223 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4224         xxx=true;
4225 else
4226         xxx=false;
4227 fi;
4228 if $xxx; then
4229         case "$dflt" in
4230         *$2*);;
4231         *) dflt="$dflt -D$2";;
4232         esac;
4233 fi'
4234
4235 set signal.h LANGUAGE_C; eval $inctest
4236
4237 case "$usesocks" in
4238 $define)
4239         ccflags="$ccflags -DSOCKS"
4240         ;;
4241 esac
4242
4243 case "$hint" in
4244 none|recommended) dflt="$ccflags $dflt" ;;
4245 *) dflt="$ccflags";;
4246 esac
4247
4248 case "$dflt" in
4249 ''|' ') dflt=none;;
4250 esac
4251 $cat <<EOH
4252
4253 Your C compiler may want other flags.  For this question you should include
4254 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4255 but you should NOT include libraries or ld flags like -lwhatever.  If you
4256 want $package to honor its debug switch, you should include -DDEBUGGING here.
4257 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4258
4259 To use no flags, specify the word "none".
4260
4261 EOH
4262 set X $dflt
4263 shift
4264 dflt=${1+"$@"}
4265 rp="Any additional cc flags?"
4266 . ./myread
4267 case "$ans" in
4268 none) ccflags='';;
4269 *) ccflags="$ans";;
4270 esac
4271
4272 : the following weeds options from ccflags that are of no interest to cpp
4273 cppflags="$ccflags"
4274 case "$gccversion" in
4275 1*) cppflags="$cppflags -D__GNUC__"
4276 esac
4277 case "$mips_type" in
4278 '');;
4279 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4280 esac
4281 case "$cppflags" in
4282 '');;
4283 *)
4284         echo " "
4285         echo "Let me guess what the preprocessor flags are..." >&4
4286         set X $cppflags
4287         shift
4288         cppflags=''
4289         $cat >cpp.c <<'EOM'
4290 #define BLURFL foo
4291
4292 BLURFL xx LFRULB
4293 EOM
4294         previous=''
4295         for flag in $*
4296         do
4297                 case "$flag" in
4298                 -*) ftry="$flag";;
4299                 *) ftry="$previous $flag";;
4300                 esac
4301                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4302                         >cpp1.out 2>/dev/null && \
4303                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4304                         >cpp2.out 2>/dev/null && \
4305                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4306                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4307                 then
4308                         cppflags="$cppflags $ftry"
4309                         previous=''
4310                 else
4311                         previous="$flag"
4312                 fi
4313         done
4314         set X $cppflags
4315         shift
4316         cppflags=${1+"$@"}
4317         case "$cppflags" in
4318         *-*)  echo "They appear to be: $cppflags";;
4319         esac
4320         $rm -f cpp.c cpp?.out
4321         ;;
4322 esac
4323
4324 : flags used in final linking phase
4325 case "$ldflags" in
4326 '') if ./venix; then
4327                 dflt='-i -z'
4328         else
4329                 dflt=''
4330         fi
4331         case "$ccflags" in
4332         *-posix*) dflt="$dflt -posix" ;;
4333         esac
4334         ;;
4335 *) dflt="$ldflags";;
4336 esac
4337
4338 : Try to guess additional flags to pick up local libraries.
4339 for thislibdir in $libpth; do
4340         case " $loclibpth " in
4341         *" $thislibdir "*)
4342                 case "$dflt " in 
4343                 *"-L$thislibdir "*) ;;
4344                 *)  dflt="$dflt -L$thislibdir" ;;
4345                 esac
4346                 ;;
4347         esac
4348 done
4349
4350 case "$dflt" in
4351 '') dflt='none' ;;
4352 esac
4353
4354 $cat <<EOH
4355
4356 Your C linker may need flags.  For this question you should
4357 include -L/whatever and any other flags used by the C linker, but you
4358 should NOT include libraries like -lwhatever.
4359
4360 Make sure you include the appropriate -L/path flags if your C linker
4361 does not normally search all of the directories you specified above,
4362 namely
4363         $libpth
4364 To use no flags, specify the word "none".
4365
4366 EOH
4367
4368 rp="Any additional ld flags (NOT including libraries)?"
4369 . ./myread
4370 case "$ans" in
4371 none) ldflags='';;
4372 *) ldflags="$ans";;
4373 esac
4374 rmlist="$rmlist pdp11"
4375
4376 : coherency check
4377 echo " "
4378 echo "Checking your choice of C compiler and flags for coherency..." >&4
4379 $cat > try.c <<'EOF'
4380 #include <stdio.h>
4381 int main() { printf("Ok\n"); exit(0); }
4382 EOF
4383 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4384 shift
4385 $cat >try.msg <<'EOM'
4386 I've tried to compile and run the following simple program:
4387
4388 EOM
4389 $cat try.c >> try.msg
4390
4391 $cat >> try.msg <<EOM
4392
4393 I used the command:
4394
4395         $*
4396         ./try
4397
4398 and I got the following output:
4399
4400 EOM
4401 dflt=y
4402 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4403         if sh -c './try' >>try.msg 2>&1; then
4404                 xxx=`./try`
4405                 case "$xxx" in
4406                 "Ok") dflt=n ;;
4407                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4408                         case " $libs " in
4409                         *" -lsfio "*)
4410                                 cat >> try.msg <<'EOQS'
4411 If $libs contains -lsfio, and sfio is mis-configured, then it
4412 sometimes (apparently) runs and exits with a 0 status, but with no
4413 output!  It may have to do with sfio's use of _exit vs. exit.
4414
4415 EOQS
4416                                 rp="You have a big problem.  Shall I abort Configure"
4417                                 dflt=y
4418                                 ;;
4419                         esac
4420                         ;;
4421                 esac
4422         else
4423                 echo "The program compiled OK, but exited with status $?." >>try.msg
4424                 rp="You have a problem.  Shall I abort Configure"
4425                 dflt=y
4426         fi
4427 else
4428         echo "I can't compile the test program." >>try.msg
4429         rp="You have a BIG problem.  Shall I abort Configure"
4430         dflt=y
4431 fi
4432 case "$dflt" in
4433 y)
4434         $cat try.msg >&4
4435         case "$knowitall" in
4436         '')
4437                 echo "(The supplied flags or libraries might be incorrect.)"
4438                 ;;
4439         *) dflt=n;;
4440         esac
4441         echo " "
4442         . ./myread
4443         case "$ans" in
4444         n*|N*) ;;
4445         *)      echo "Ok.  Stopping Configure." >&4
4446                 exit 1
4447                 ;;
4448         esac
4449         ;;
4450 n) echo "OK, that should do.";;
4451 esac
4452 $rm -f try try.* core
4453
4454 : determine filename position in cpp output
4455 echo " "
4456 echo "Computing filename position in cpp output for #include directives..." >&4
4457 echo '#include <stdio.h>' > foo.c
4458 $cat >fieldn <<EOF
4459 $startsh
4460 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4461 $grep '^[       ]*#.*stdio\.h' | \
4462 while read cline; do
4463         pos=1
4464         set \$cline
4465         while $test \$# -gt 0; do
4466                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4467                         echo "\$pos"
4468                         exit 0
4469                 fi
4470                 shift
4471                 pos=\`expr \$pos + 1\`
4472         done
4473 done
4474 EOF
4475 chmod +x fieldn
4476 fieldn=`./fieldn`
4477 $rm -f foo.c fieldn
4478 case $fieldn in
4479 '') pos='???';;
4480 1) pos=first;;
4481 2) pos=second;;
4482 3) pos=third;;
4483 *) pos="${fieldn}th";;
4484 esac
4485 echo "Your cpp writes the filename in the $pos field of the line."
4486
4487 : locate header file
4488 $cat >findhdr <<EOF
4489 $startsh
4490 wanted=\$1
4491 name=''
4492 for usrincdir in $usrinc
4493 do
4494         if test -f \$usrincdir/\$wanted; then
4495                 echo "\$usrincdir/\$wanted"
4496                 exit 0
4497         fi
4498 done
4499 awkprg='{ print \$$fieldn }'
4500 echo "#include <\$wanted>" > foo\$\$.c
4501 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4502 $grep "^[       ]*#.*\$wanted" | \
4503 while read cline; do
4504         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4505         case "\$name" in
4506         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4507         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4508         *) exit 2;;
4509         esac;
4510 done;
4511 #
4512 # status = 0: grep returned 0 lines, case statement not executed
4513 # status = 1: headerfile found
4514 # status = 2: while loop executed, no headerfile found
4515 #
4516 status=\$?
4517 $rm -f foo\$\$.c;
4518 if test \$status -eq 1; then
4519         exit 0;
4520 fi
4521 exit 1
4522 EOF
4523 chmod +x findhdr
4524
4525 : define an alternate in-header-list? function
4526 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4527 cont=true; xxf="echo \"<\$1> found.\" >&4";
4528 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4529 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4530 esac;
4531 case $# in 4) instead=instead;; *) instead="at last";; esac;
4532 while $test "$cont"; do
4533         xxx=`./findhdr $1`
4534         var=$2; eval "was=\$$2";
4535         if $test "$xxx" && $test -r "$xxx";
4536         then eval $xxf;
4537         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4538                 cont="";
4539         else eval $xxnf;
4540         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4541         set $yyy; shift; shift; yyy=$@;
4542         case $# in 0) cont="";;
4543         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4544                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4545         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4546                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4547         esac;
4548 done;
4549 while $test "$yyy";
4550 do set $yyy; var=$2; eval "was=\$$2";
4551         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4552         set $yyy; shift; shift; yyy=$@;
4553 done'
4554
4555 : see if this is a malloc.h system
4556 set malloc.h i_malloc
4557 eval $inhdr
4558
4559 : see if stdlib is available
4560 set stdlib.h i_stdlib
4561 eval $inhdr
4562
4563 : determine which malloc to compile in
4564 echo " "
4565 case "$usemymalloc" in
4566 ''|[yY]*|true|$define)  dflt='y' ;;
4567 *)      dflt='n' ;;
4568 esac
4569 rp="Do you wish to attempt to use the malloc that comes with $package?"
4570 . ./myread
4571 usemymalloc="$ans"
4572 case "$ans" in
4573 y*|true)
4574         usemymalloc='y'
4575         mallocsrc='malloc.c'
4576         mallocobj="malloc$_o"
4577         d_mymalloc="$define"
4578         case "$libs" in
4579         *-lmalloc*)
4580                 : Remove malloc from list of libraries to use
4581                 echo "Removing unneeded -lmalloc from library list" >&4
4582                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4583                 shift
4584                 libs="$*"
4585                 echo "libs = $libs" >&4
4586                 ;;
4587         esac
4588         ;;
4589 *)
4590         usemymalloc='n'
4591         mallocsrc=''
4592         mallocobj=''
4593         d_mymalloc="$undef"
4594         ;;
4595 esac
4596
4597 : compute the return types of malloc and free
4598 echo " "
4599 $cat >malloc.c <<END
4600 #$i_malloc I_MALLOC
4601 #$i_stdlib I_STDLIB
4602 #include <stdio.h>
4603 #include <sys/types.h>
4604 #ifdef I_MALLOC
4605 #include <malloc.h>
4606 #endif
4607 #ifdef I_STDLIB
4608 #include <stdlib.h>
4609 #endif
4610 #ifdef TRY_MALLOC
4611 void *malloc();
4612 #endif
4613 #ifdef TRY_FREE
4614 void free();
4615 #endif
4616 END
4617 case "$malloctype" in
4618 '')
4619         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4620                 malloctype='void *'
4621         else
4622                 malloctype='char *'
4623         fi
4624         ;;
4625 esac
4626 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4627
4628 case "$freetype" in
4629 '')
4630         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4631                 freetype='void'
4632         else
4633                 freetype='int'
4634         fi
4635         ;;
4636 esac
4637 echo "Your system uses $freetype free(), it would seem." >&4
4638 $rm -f malloc.[co]
4639 $cat <<EOM
4640
4641 The installation process will also create a directory for
4642 vendor-supplied add-ons.  Vendors who supply perl with their system
4643 may find it convenient to place all vendor-supplied files in this
4644 directory rather than in the main distribution directory.  This will
4645 ease upgrades between binary-compatible maintenance versions of perl.
4646
4647 Of course you may also use these directories in whatever way you see
4648 fit.  For example, you might use them to access modules shared over a
4649 company-wide network.
4650
4651 The default answer should be fine for most people.
4652 This causes further questions about vendor add-ons to be skipped
4653 and no vendor-specific directories will be configured for perl.
4654
4655 EOM
4656 rp='Do you want to configure vendor-specific add-on directories?'
4657 case "$usevendorprefix" in
4658 define|true|[yY]*) dflt=y ;;
4659 *) dflt=n ;;
4660 esac
4661 . ./myread
4662 case "$ans" in
4663 [yY]*)  fn=d~+
4664         rp='Installation prefix to use for vendor-supplied add-ons?'
4665         case "$vendorprefix" in
4666         '') dflt='' ;;
4667         *)  dflt=$vendorprefix ;;
4668         esac
4669         . ./getfile
4670         oldvendorprefix=''
4671         case "$vendorprefix" in
4672         '') ;;
4673         *)      case "$ans" in
4674                 "$prefix") ;;
4675                 *) oldvendorprefix="$prefix";;
4676                 esac
4677                 ;;
4678         esac
4679         usevendorprefix="$define"
4680         vendorprefix="$ans"
4681         vendorprefixexp="$ansexp"
4682         ;;
4683 *)      usevendorprefix="$undef"
4684         vendorprefix=''
4685         vendorprefixexp=''
4686         ;;
4687 esac
4688
4689 case "$vendorprefix" in
4690 '')     d_vendorlib="$undef"
4691         vendorlib=''
4692         vendorlibexp=''
4693         ;;
4694 *)      d_vendorlib="$define"
4695         : determine where vendor-supplied modules go.
4696         : Usual default is /usr/local/lib/perl5/vendor_perl
4697         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4698         case "$installstyle" in
4699         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4700         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4701         esac
4702         fn=d~+
4703         rp='Pathname for the vendor-supplied library files?'
4704         . ./getfile
4705         vendorlib="$ans"
4706         vendorlibexp="$ansexp"
4707         : Change installation prefix, if necessary.
4708         if $test X"$prefix" != X"$installprefix"; then
4709                 installvendorlib=`echo $vendorlibexp | $sed 's#^$prefix#$installprefix#'`
4710         else
4711                 installvendorlib="$vendorlibexp"
4712         fi
4713         ;;
4714 esac
4715
4716 : Cruising for prototypes
4717 echo " "
4718 echo "Checking out function prototypes..." >&4
4719 $cat >prototype.c <<'EOCP'
4720 int main(int argc, char *argv[]) {
4721         exit(0);}
4722 EOCP
4723 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4724         echo "Your C compiler appears to support function prototypes."
4725         val="$define"
4726 else
4727         echo "Your C compiler doesn't seem to understand function prototypes."
4728         val="$undef"
4729 fi
4730 set prototype
4731 eval $setvar
4732 $rm -f prototype*
4733
4734 case "$prototype" in
4735 "$define") ;;
4736 *)      ansi2knr='ansi2knr'
4737         echo " "
4738         cat <<EOM >&4
4739
4740 $me:  FATAL ERROR:
4741 This version of $package can only be compiled by a compiler that 
4742 understands function prototypes.  Unfortunately, your C compiler 
4743         $cc $ccflags
4744 doesn't seem to understand them.  Sorry about that.
4745
4746 If GNU cc is available for your system, perhaps you could try that instead.  
4747
4748 Eventually, we hope to support building Perl with pre-ANSI compilers.
4749 If you would like to help in that effort, please contact <perlbug@perl.org>.
4750
4751 Aborting Configure now.
4752 EOM
4753         exit 2
4754         ;;
4755 esac
4756
4757 : determine where public executables go
4758 echo " "
4759 set dflt bin bin
4760 eval $prefixit
4761 fn=d~
4762 rp='Pathname where the public executables will reside?'
4763 . ./getfile
4764 if $test "X$ansexp" != "X$binexp"; then
4765         installbin=''
4766 fi
4767 bin="$ans"
4768 binexp="$ansexp"
4769 : Change installation prefix, if necessary.
4770 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4771 if $test X"$prefix" != X"$installprefix"; then
4772         installbin=`echo $binexp | sed 's#^$prefix#$installprefix#'`
4773 else
4774         installbin="$binexp"
4775 fi
4776
4777 : determine whether to install perl also as /usr/bin/perl
4778
4779 echo " "
4780 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4781         $cat <<EOM
4782 Many scripts expect to perl to be installed as /usr/bin/perl.
4783 I can install the perl you are about to compile also as /usr/bin/perl
4784 (in addition to $installbin/perl).
4785 EOM
4786         case "$installusrbinperl" in
4787         "$undef"|[nN]*) dflt='n';;
4788         *)              dflt='y';;
4789         esac
4790         rp="Do you want to install perl as /usr/bin/perl?"
4791         . ./myread
4792         case "$ans" in
4793         [yY]*)  val="$define";;
4794         *)      val="$undef" ;;
4795         esac
4796 else
4797         val="$undef"
4798 fi
4799 set installusrbinperl
4800 eval $setvar
4801
4802 : define a shorthand compile call
4803 compile='
4804 mc_file=$1;
4805 shift;
4806 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4807 : define a shorthand compile call for compilations that should be ok.
4808 compile_ok='
4809 mc_file=$1;
4810 shift;
4811 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4812
4813 echo " "
4814 echo "Checking for GNU C Library..." >&4
4815 cat >gnulibc.c <<EOM
4816 #include <stdio.h>
4817 int main()
4818 {
4819 #ifdef __GLIBC__
4820     exit(0);
4821 #else
4822     exit(1);
4823 #endif
4824 }
4825 EOM
4826 set gnulibc
4827 if eval $compile_ok && ./gnulibc; then
4828         val="$define"
4829         echo "You are using the GNU C Library"
4830 else
4831         val="$undef"
4832         echo "You are not using the GNU C Library"
4833 fi
4834 $rm -f gnulibc*
4835 set d_gnulibc
4836 eval $setvar
4837
4838 : see if nm is to be used to determine whether a symbol is defined or not
4839 case "$usenm" in
4840 '')
4841         dflt=''
4842         case "$d_gnulibc" in
4843         "$define")
4844                 echo " "
4845                 echo "nm probably won't work on the GNU C Library." >&4
4846                 dflt=n
4847                 ;;
4848         esac
4849         case "$dflt" in
4850         '') 
4851                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4852                         echo " "
4853                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4854                         echo "'nm' won't be sufficient on this sytem." >&4
4855                         dflt=n
4856                 fi
4857                 ;;
4858         esac
4859         case "$dflt" in
4860         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4861                 if $test $dflt -gt 20; then
4862                         dflt=y
4863                 else
4864                         dflt=n
4865                 fi
4866                 ;;
4867         esac
4868         ;;
4869 *)
4870         case "$usenm" in
4871         true|$define) dflt=y;;
4872         *) dflt=n;;
4873         esac
4874         ;;
4875 esac
4876 $cat <<EOM
4877
4878 I can use $nm to extract the symbols from your C libraries. This
4879 is a time consuming task which may generate huge output on the disk (up
4880 to 3 megabytes) but that should make the symbols extraction faster. The
4881 alternative is to skip the 'nm' extraction part and to compile a small
4882 test program instead to determine whether each symbol is present. If
4883 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4884 this may be the best solution.
4885
4886 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4887
4888 EOM
4889 rp="Shall I use $nm to extract C symbols from the libraries?"
4890 . ./myread
4891 case "$ans" in
4892 [Nn]*) usenm=false;;
4893 *) usenm=true;;
4894 esac
4895
4896 runnm=$usenm
4897 case "$reuseval" in
4898 true) runnm=false;;
4899 esac
4900
4901 : nm options which may be necessary
4902 case "$nm_opt" in
4903 '') if $test -f /mach_boot; then
4904                 nm_opt=''       # Mach
4905         elif $test -d /usr/ccs/lib; then
4906                 nm_opt='-p'     # Solaris (and SunOS?)
4907         elif $test -f /dgux; then
4908                 nm_opt='-p'     # DG-UX
4909         elif $test -f /lib64/rld; then
4910                 nm_opt='-p'     # 64-bit Irix
4911         else
4912                 nm_opt=''
4913         fi;;
4914 esac
4915
4916 : nm options which may be necessary for shared libraries but illegal
4917 : for archive libraries.  Thank you, Linux.
4918 case "$nm_so_opt" in
4919 '')     case "$myuname" in
4920         *linux*)
4921                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4922                         nm_so_opt='--dynamic'
4923                 fi
4924                 ;;
4925         esac
4926         ;;
4927 esac
4928
4929 case "$runnm" in
4930 true)
4931 : get list of predefined functions in a handy place
4932 echo " "
4933 case "$libc" in
4934 '') libc=unknown
4935         case "$libs" in
4936         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4937         esac
4938         ;;
4939 esac
4940 libnames='';
4941 case "$libs" in
4942 '') ;;
4943 *)  for thislib in $libs; do
4944         case "$thislib" in
4945         -lc|-lc_s)
4946                 : Handle C library specially below.
4947                 ;;
4948         -l*)
4949                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4950                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4951                         :
4952                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4953                         :
4954                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4955                         :
4956                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4957                         :
4958                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4959                         :
4960                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4961                         :
4962                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4963                         :
4964                 else
4965                         try=''
4966                 fi
4967                 libnames="$libnames $try"
4968                 ;;
4969         *) libnames="$libnames $thislib" ;;
4970         esac
4971         done
4972         ;;
4973 esac
4974 xxx=normal
4975 case "$libc" in
4976 unknown)
4977         set /lib/libc.$so
4978         for xxx in $libpth; do
4979                 $test -r $1 || set $xxx/libc.$so
4980                 : The messy sed command sorts on library version numbers.
4981                 $test -r $1 || \
4982                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4983                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4984                                 h
4985                                 s/[0-9][0-9]*/0000&/g
4986                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4987                                 G
4988                                 s/\n/ /' | \
4989                          sort | $sed -e 's/^.* //'`
4990                 eval set \$$#
4991         done
4992         $test -r $1 || set /usr/ccs/lib/libc.$so
4993         $test -r $1 || set /lib/libsys_s$_a
4994         ;;
4995 *)
4996         set blurfl
4997         ;;
4998 esac
4999 if $test -r "$1"; then
5000         echo "Your (shared) C library seems to be in $1."
5001         libc="$1"
5002 elif $test -r /lib/libc && $test -r /lib/clib; then
5003         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5004         xxx=apollo
5005         libc='/lib/clib /lib/libc'
5006         if $test -r /lib/syslib; then
5007                 echo "(Your math library is in /lib/syslib.)"
5008                 libc="$libc /lib/syslib"
5009         fi
5010 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5011         echo "Your C library seems to be in $libc, as you said before."
5012 elif $test -r $incpath/usr/lib/libc$_a; then
5013         libc=$incpath/usr/lib/libc$_a;
5014         echo "Your C library seems to be in $libc.  That's fine."
5015 elif $test -r /lib/libc$_a; then
5016         libc=/lib/libc$_a;
5017         echo "Your C library seems to be in $libc.  You're normal."
5018 else
5019         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5020                 :
5021         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5022                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5023         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5024                 :
5025         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5026                 :
5027         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5028                 :
5029         else
5030                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5031         fi
5032         if $test -r "$tans"; then
5033                 echo "Your C library seems to be in $tans, of all places."
5034                 libc=$tans
5035         else
5036                 libc='blurfl'
5037         fi
5038 fi
5039 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5040         dflt="$libc"
5041         cat <<EOM
5042
5043 If the guess above is wrong (which it might be if you're using a strange
5044 compiler, or your machine supports multiple models), you can override it here.
5045
5046 EOM
5047 else
5048         dflt=''
5049         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5050         cat >&4 <<EOM
5051 I can't seem to find your C library.  I've looked in the following places:
5052
5053 EOM
5054         $sed 's/^/      /' libpath
5055         cat <<EOM
5056
5057 None of these seems to contain your C library. I need to get its name...
5058
5059 EOM
5060 fi
5061 fn=f
5062 rp='Where is your C library?'
5063 . ./getfile
5064 libc="$ans"
5065
5066 echo " "
5067 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5068 set X `cat libnames`
5069 shift
5070 xxx=files
5071 case $# in 1) xxx=file; esac
5072 echo "Extracting names from the following $xxx for later perusal:" >&4
5073 echo " "
5074 $sed 's/^/      /' libnames >&4
5075 echo " "
5076 $echo $n "This may take a while...$c" >&4
5077
5078 for file in $*; do
5079         case $file in
5080         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5081         *) $nm $nm_opt $file 2>/dev/null;;
5082         esac
5083 done >libc.tmp
5084
5085 $echo $n ".$c"
5086 $grep fprintf libc.tmp > libc.ptf
5087 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5088 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5089 xxx='[ADTSIW]'
5090 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5091         eval $xscan;\
5092         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5093                 eval $xrun
5094 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5095         eval $xscan;\
5096         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5097                 eval $xrun
5098 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5099         eval $xscan;\
5100         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5101                 eval $xrun
5102 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5103         eval $xscan;\
5104         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5105                 eval $xrun
5106 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5107         eval $xscan;\
5108         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5109                 eval $xrun
5110 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5111         eval $xscan;\
5112         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5113                 eval $xrun
5114 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5115                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5116         eval $xscan;\
5117         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5118                 eval $xrun
5119 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5120         eval $xscan;\
5121         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5122                 eval $xrun
5123 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5124         eval $xscan;\
5125         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5126                 eval $xrun
5127 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5128         eval $xscan;\
5129         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5130                 eval $xrun
5131 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5132         eval $xscan;\
5133         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5134                 eval $xrun
5135 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5136         eval $xscan;\
5137         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5138                 eval $xrun
5139 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5140         eval $xscan;\
5141         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5142                 eval $xrun
5143 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5144         eval $xscan;\
5145         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5146                 eval $xrun
5147 else
5148         $nm -p $* 2>/dev/null >libc.tmp
5149         $grep fprintf libc.tmp > libc.ptf
5150         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5151                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5152         then
5153                 nm_opt='-p'
5154                 eval $xrun
5155         else
5156                 echo " "
5157                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5158                 com=''
5159                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5160                         for thisname in $libnames $libc; do
5161                                 $ar t $thisname >>libc.tmp
5162                         done
5163                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5164                         echo "Ok." >&4
5165                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5166                         # Repeat libc to extract forwarders to DLL entries too
5167                         for thisname in $libnames $libc; do
5168                                 $ar tv $thisname >>libc.tmp
5169                                 # Revision 50 of EMX has bug in $ar.
5170                                 # it will not extract forwarders to DLL entries
5171                                 # Use emximp which will extract exactly them.
5172                                 emximp -o tmp.imp $thisname \
5173                                     2>/dev/null && \
5174                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5175                                     < tmp.imp >>libc.tmp
5176                                 $rm tmp.imp
5177                         done
5178                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5179                         echo "Ok." >&4
5180                 else
5181                         echo "$ar didn't seem to work right." >&4
5182                         echo "Maybe this is a Cray...trying bld instead..." >&4
5183                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5184                         then
5185                                 for thisname in $libnames; do
5186                                         bld t $libnames | \
5187                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5188                                         $ar t $thisname >>libc.tmp
5189                                 done
5190                                 echo "Ok." >&4
5191                         else
5192                                 echo "That didn't work either.  Giving up." >&4
5193                                 exit 1
5194                         fi
5195                 fi
5196         fi
5197 fi
5198 nm_extract="$com"
5199 if $test -f /lib/syscalls.exp; then
5200         echo " "
5201         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5202         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5203 fi
5204 ;;
5205 esac
5206 $rm -f libnames libpath
5207
5208 : see if dld is available
5209 set dld.h i_dld
5210 eval $inhdr
5211
5212 : is a C symbol defined?
5213 csym='tlook=$1;
5214 case "$3" in
5215 -v) tf=libc.tmp; tc=""; tdc="";;
5216 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5217 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5218 esac;
5219 tx=yes;
5220 case "$reuseval-$4" in
5221 true-) ;;
5222 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5223 esac;
5224 case "$tx" in
5225 yes)
5226         case "$runnm" in
5227         true)
5228                 if $contains $tlook $tf >/dev/null 2>&1;
5229                 then tval=true;
5230                 else tval=false;
5231                 fi;;
5232         *)
5233                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5234                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5235                 then tval=true;
5236                 else tval=false;
5237                 fi;
5238                 $rm -f t t.c;;
5239         esac;;
5240 *)
5241         case "$tval" in
5242         $define) tval=true;;
5243         *) tval=false;;
5244         esac;;
5245 esac;
5246 eval "$2=$tval"'
5247
5248 : define an is-in-libc? function
5249 inlibc='echo " "; td=$define; tu=$undef;
5250 sym=$1; var=$2; eval "was=\$$2";
5251 tx=yes;
5252 case "$reuseval$was" in
5253 true) ;;
5254 true*) tx=no;;
5255 esac;
5256 case "$tx" in
5257 yes)
5258         set $sym tres -f;
5259         eval $csym;
5260         case "$tres" in
5261         true)
5262                 echo "$sym() found." >&4;
5263                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5264         *)
5265                 echo "$sym() NOT found." >&4;
5266                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5267         esac;;
5268 *)
5269         case "$was" in
5270         $define) echo "$sym() found." >&4;;
5271         *) echo "$sym() NOT found." >&4;;
5272         esac;;
5273 esac'
5274
5275 : see if dlopen exists
5276 xxx_runnm="$runnm"
5277 runnm=false
5278 set dlopen d_dlopen
5279 eval $inlibc
5280 runnm="$xxx_runnm"
5281
5282 : determine which dynamic loading, if any, to compile in
5283 echo " "
5284 dldir="ext/DynaLoader"
5285 case "$usedl" in
5286 $define|y|true)
5287         dflt='y'
5288         usedl="$define"
5289         ;;
5290 $undef|n|false)
5291         dflt='n'
5292         usedl="$undef"
5293         ;;
5294 *) 
5295         dflt='n'
5296         case "$d_dlopen" in
5297             $define) dflt='y' ;;
5298         esac
5299         case "$i_dld" in
5300             $define) dflt='y' ;;
5301         esac
5302         : Does a dl_xxx.xs file exist for this operating system
5303         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5304         ;;
5305 esac
5306 rp="Do you wish to use dynamic loading?"
5307 . ./myread
5308 usedl="$ans"
5309 case "$ans" in
5310 y*) usedl="$define"
5311         case "$dlsrc" in
5312         '')
5313                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5314                         dflt="$dldir/dl_${osname}.xs"
5315                 elif $test "$d_dlopen" = "$define" ; then
5316                         dflt="$dldir/dl_dlopen.xs"
5317                 elif $test "$i_dld" = "$define" ; then
5318                         dflt="$dldir/dl_dld.xs"
5319                 else
5320                         dflt=''
5321                 fi
5322                 ;;
5323         *)      dflt="$dldir/$dlsrc"
5324                 ;;
5325         esac
5326     echo "The following dynamic loading files are available:"
5327         : Can not go over to $dldir because getfile has path hard-coded in.
5328         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5329         rp="Source file to use for dynamic loading"
5330         fn="fne"
5331         gfpth="$src"
5332         . ./getfile
5333         usedl="$define"
5334         : emulate basename
5335         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5336
5337         $cat << EOM
5338
5339 Some systems may require passing special flags to $cc -c to
5340 compile modules that will be used to create a shared library.
5341 To use no flags, say "none".
5342
5343 EOM
5344     case "$cccdlflags" in
5345     '') case "$gccversion" in
5346                 '') case "$osname" in
5347                         hpux)   dflt='+z' ;;
5348                         next)   dflt='none' ;;
5349                         irix*)  dflt='-KPIC' ;;
5350                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5351                         sunos)  dflt='-pic' ;;
5352                         *)      dflt='none' ;;
5353                     esac
5354                         ;;
5355                 *)  case "$osname" in
5356                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5357                         *)      dflt='-fpic' ;;
5358                     esac ;;
5359             esac ;;
5360         ' ') dflt='none' ;;
5361     *)  dflt="$cccdlflags" ;;
5362     esac
5363     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5364     . ./myread
5365     case "$ans" in
5366     none) cccdlflags=' ' ;;
5367     *) cccdlflags="$ans" ;;
5368     esac
5369
5370     cat << EOM
5371
5372 Some systems use ld to create libraries that can be dynamically loaded,
5373 while other systems (such as those using ELF) use $cc.
5374
5375 EOM
5376         case "$ld" in
5377         '')     $cat >try.c <<'EOM'
5378 /* Test for whether ELF binaries are produced */
5379 #include <fcntl.h>
5380 #include <stdlib.h>
5381 int main() {
5382         char b[4];
5383         int i = open("a.out",O_RDONLY);
5384         if(i == -1) 
5385                 exit(1); /* fail */
5386         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5387                 exit(0); /* succeed (yes, it's ELF) */
5388         else
5389                 exit(1); /* fail */
5390 }
5391 EOM
5392                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5393                         cat <<EOM
5394 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5395 EOM
5396                         dflt="$cc"
5397                 else
5398                         echo "I'll use ld to build dynamic libraries."
5399                         dflt='ld'
5400                 fi
5401                 rm -f try.c a.out
5402                 ;;
5403         *)      dflt="$ld"
5404                 ;;
5405         esac
5406
5407     rp="What command should be used to create dynamic libraries?"
5408     . ./myread
5409         ld="$ans"
5410
5411     cat << EOM
5412
5413 Some systems may require passing special flags to $ld to create a
5414 library that can be dynamically loaded.  If your ld flags include
5415 -L/other/path options to locate libraries outside your loader's normal
5416 search path, you may need to specify those -L options here as well.  To
5417 use no flags, say "none".
5418
5419 EOM
5420     case "$lddlflags" in
5421     '') case "$osname" in
5422                         beos) dflt='-nostart' ;;
5423                         hpux)  dflt='-b' ;;
5424                         linux|irix*)    dflt='-shared' ;;
5425                         next)  dflt='none' ;;
5426                         solaris) dflt='-G' ;;
5427                         sunos) dflt='-assert nodefinitions' ;;
5428                         svr4*|esix*) dflt="-G $ldflags" ;;
5429                 *)     dflt='none' ;;
5430                         esac
5431                         ;;
5432     *) dflt="$lddlflags" ;;
5433     esac
5434
5435         : Try to guess additional flags to pick up local libraries.
5436         : Be careful not to append to a plain 'none'
5437         case "$dflt" in
5438         none) dflt='' ;;
5439         esac
5440         for thisflag in $ldflags; do
5441                 case "$thisflag" in
5442                 -L*)
5443                         case " $dflt " in
5444                         *" $thisflag "*) ;;
5445                         *) dflt="$dflt $thisflag" ;;
5446                         esac
5447                         ;;
5448                 esac
5449         done
5450
5451         case "$dflt" in
5452         ''|' ') dflt='none' ;;
5453         esac
5454
5455     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5456     . ./myread
5457     case "$ans" in
5458     none) lddlflags=' ' ;;
5459     *) lddlflags="$ans" ;;
5460     esac
5461
5462         cat <<EOM
5463
5464 Some systems may require passing special flags to $cc to indicate that
5465 the resulting executable will use dynamic linking.  To use no flags,
5466 say "none".
5467
5468 EOM
5469     case "$ccdlflags" in
5470     '') case "$osname" in
5471                 hpux)   dflt='-Wl,-E' ;;
5472                 linux)  dflt='-rdynamic' ;;
5473                 next)   dflt='none' ;;
5474                 sunos)  dflt='none' ;;
5475                 *)      dflt='none' ;;
5476             esac ;;
5477     ' ')  dflt='none' ;;
5478     *)  dflt="$ccdlflags" ;;
5479     esac
5480     rp="Any special flags to pass to $cc to use dynamic loading?"
5481     . ./myread
5482     case "$ans" in
5483     none) ccdlflags=' ' ;;
5484     *) ccdlflags="$ans" ;;
5485     esac
5486     ;;
5487 *)  usedl="$undef"
5488         ld='ld'
5489     dlsrc='dl_none.xs'
5490     lddlflags=''
5491     ccdlflags=''
5492     ;;
5493 esac
5494
5495 also=''
5496 case "$usedl" in
5497 $undef)
5498         # No dynamic loading being used, so don't bother even to prompt.
5499         useshrplib='false'
5500         ;;
5501 *)      case "$useshrplib" in
5502         '')     case "$osname" in
5503                 svr4*|dgux|dynixptx|esix|powerux|beos)
5504                         dflt=y
5505                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5506                         ;;
5507                 next*)
5508                         case "$osvers" in
5509                         4*)     dflt=y
5510                                 also='Building a shared libperl is needed for MAB support.'
5511                                 ;;
5512                         *)      dflt=n
5513                                 ;;
5514                         esac
5515                         ;;
5516                 *)      dflt=n
5517                         ;;
5518                 esac
5519                 ;;
5520         $define|true|[Yy]*)
5521                 dflt=y
5522                 ;;
5523         *)      dflt=n
5524                 ;;
5525         esac
5526         $cat << EOM
5527
5528 The perl executable is normally obtained by linking perlmain.c with
5529 libperl${_a}, any static extensions (usually just DynaLoader), and
5530 any other libraries needed on this system (such as -lm, etc.).  Since
5531 your system supports dynamic loading, it is probably possible to build
5532 a shared libperl.$so.  If you will have more than one executable linked
5533 to libperl.$so, this will significantly reduce the size of each
5534 executable, but it may have a noticeable affect on performance.  The
5535 default is probably sensible for your system.
5536 $also
5537
5538 EOM
5539         rp="Build a shared libperl.$so (y/n)"
5540         . ./myread
5541         case "$ans" in
5542         true|$define|[Yy]*)
5543                 useshrplib='true'  ;;
5544         *)      useshrplib='false' ;;
5545         esac
5546         ;;
5547 esac
5548
5549 case "$useshrplib" in
5550 true)
5551         case "$libperl" in
5552         '')
5553                 # Figure out a good name for libperl.so.  Since it gets stored in
5554                 # a version-specific architecture-dependent library, the version
5555                 # number isn't really that important, except for making cc/ld happy.
5556                 #
5557                 # A name such as libperl.so.3.1
5558                 majmin="libperl.$so.$patchlevel.$subversion"
5559                 # A name such as libperl.so.301
5560                 majonly=`echo $patchlevel $subversion |
5561                         $awk '{printf "%d%02d", $1, $2}'`
5562                 majonly=libperl.$so.$majonly
5563                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5564                 # rely on figuring it out from the naming of libc.
5565                 case "${osname}${osvers}" in
5566                 next4*)
5567                         dflt=libperl.5.$so
5568                         # XXX How handle the --version stuff for MAB?
5569                         ;;
5570                 linux*)  # ld won't link with a bare -lperl otherwise.
5571                         dflt=libperl.$so
5572                         ;;
5573                 *)      # Try to guess based on whether libc has major.minor.
5574                         case "$libc" in
5575                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5576                         *libc.$so.[0-9]*) dflt=$majonly ;;
5577                         *)      dflt=libperl.$so ;;
5578                         esac
5579                         ;;
5580                 esac
5581                 ;;
5582         *)      dflt=$libperl
5583                 ;;
5584         esac
5585         cat << EOM
5586
5587 I need to select a good name for the shared libperl.  If your system uses
5588 library names with major and minor numbers, then you might want something
5589 like $majmin.  Alternatively, if your system uses a single version
5590 number for shared libraries, then you might want to use $majonly.
5591 Or, your system might be quite happy with a simple libperl.$so.
5592
5593 Since the shared libperl will get installed into a version-specific
5594 architecture-dependent directory, the version number of the shared perl
5595 library probably isn't important, so the default should be o.k.
5596
5597 EOM
5598         rp='What name do you want to give to the shared libperl?'
5599         . ./myread
5600         libperl=$ans
5601         echo "Ok, I'll use $libperl"
5602         ;;
5603 *)
5604         libperl="libperl${_a}"
5605         ;;
5606 esac
5607
5608 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5609 case "$shrpdir" in
5610 '') ;;
5611 *)      $cat >&4 <<EOM
5612 WARNING:  Use of the shrpdir variable for the installation location of
5613 the shared $libperl is not supported.  It was never documented and
5614 will not work in this version.  Let me (perlbug@perl.com)
5615 know of any problems this may cause.
5616
5617 EOM
5618         case "$shrpdir" in
5619         "$archlibexp/CORE")
5620                 $cat >&4 <<EOM
5621 But your current setting of $shrpdir is
5622 the default anyway, so it's harmless.
5623 EOM
5624                 ;;
5625         *)
5626                 $cat >&4 <<EOM
5627 Further, your current attempted setting of $shrpdir
5628 conflicts with the value of $archlibexp/CORE
5629 that installperl will use.
5630 EOM
5631                 ;;
5632         esac
5633         ;;
5634 esac
5635
5636 # How will the perl executable find the installed shared $libperl?
5637 # Add $xxx to ccdlflags.
5638 # If we can't figure out a command-line option, use $shrpenv to
5639 # set env LD_RUN_PATH.  The main perl makefile uses this.
5640 shrpdir=$archlibexp/CORE
5641 xxx=''
5642 tmp_shrpenv=''
5643 if "$useshrplib"; then
5644     case "$osname" in 
5645         aix)
5646                 # We'll set it in Makefile.SH...
5647                 ;;
5648         solaris|netbsd)
5649                 xxx="-R $shrpdir"
5650                 ;;
5651         freebsd)
5652                 xxx="-Wl,-R$shrpdir"
5653                 ;;
5654         linux|irix*|dec_osf)
5655                 xxx="-Wl,-rpath,$shrpdir"
5656                 ;;
5657         next)
5658                 # next doesn't like the default...
5659                 ;;
5660         beos)
5661                 # beos doesn't like the default, either.
5662                 ;;
5663         hpux*)
5664                 # hpux doesn't like the default, either.
5665                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5666                 ;;
5667         *)
5668                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5669                 ;;
5670         esac
5671         case "$xxx" in
5672         '') ;;
5673         *)      
5674                 # Only add $xxx if it isn't already in ccdlflags.
5675                 case " $ccdlflags " in
5676                 *" $xxx "*)     ;;
5677                 *)      ccdlflags="$ccdlflags $xxx"
5678                         cat <<EOM >&4
5679
5680 Adding $xxx to the flags
5681 passed to $ld so that the perl executable will find the 
5682 installed shared $libperl.
5683
5684 EOM
5685                         ;;
5686                 esac
5687                 ;;
5688         esac
5689 fi
5690 # Fix ccdlflags in AIX for building external extensions.
5691 # (For building Perl itself bare -bE:perl.exp is needed,
5692 #  Makefile.SH takes care of this.)
5693 case "$osname" in
5694 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5695 esac
5696 # Respect a hint or command-line value.
5697 case "$shrpenv" in
5698 '') shrpenv="$tmp_shrpenv" ;;
5699 esac
5700 case "$ldlibpthname" in
5701 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5702 none)   ldlibpthname='' ;;
5703 esac
5704
5705 : determine where manual pages go
5706 set man1dir man1dir none
5707 eval $prefixit
5708 $cat <<EOM
5709
5710 $spackage has manual pages available in source form.
5711 EOM
5712 case "$nroff" in
5713 nroff)
5714         echo "However, you don't have nroff, so they're probably useless to you."
5715         case "$man1dir" in
5716         '') man1dir="none";;
5717         esac;;
5718 esac
5719 echo "If you don't want the manual sources installed, answer 'none'."
5720 case "$man1dir" in
5721 ' ') dflt=none
5722         ;;
5723 '')
5724         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5725         lookpath="$lookpath $prefixexp/man/p_man/man1"
5726         lookpath="$lookpath $prefixexp/man/u_man/man1"
5727         lookpath="$lookpath $prefixexp/man/man.1"
5728         case "$sysman" in
5729         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5730         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5731         esac
5732         set dflt
5733         eval $prefixup
5734         ;;
5735 *)  dflt="$man1dir"
5736         ;;
5737 esac
5738 echo " "
5739 fn=dn+~
5740 rp="Where do the main $spackage manual pages (source) go?"
5741 . ./getfile
5742 if $test "X$man1direxp" != "X$ansexp"; then
5743         installman1dir=''
5744 fi
5745 man1dir="$ans"
5746 man1direxp="$ansexp"
5747 case "$man1dir" in
5748 '')     man1dir=' '
5749         installman1dir='';;
5750 esac
5751
5752 : Change installation prefix, if necessary.
5753 if $test X"$prefix" != X"$installprefix"; then
5754         installman1dir=`echo $man1direxp | $sed 's#^$prefix#$installprefix#'`
5755 else
5756         installman1dir="$man1direxp"
5757 fi
5758
5759 : What suffix to use on installed man pages
5760
5761 case "$man1dir" in
5762 ' ')
5763         man1ext='0'
5764         ;;
5765 *)
5766         rp="What suffix should be used for the main $spackage man pages?"
5767         case "$man1ext" in
5768         '')     case "$man1dir" in
5769                 *1)  dflt=1 ;;
5770                 *1p) dflt=1p ;;
5771                 *1pm) dflt=1pm ;;
5772                 *l) dflt=l;;
5773                 *n) dflt=n;;
5774                 *o) dflt=o;;
5775                 *p) dflt=p;;
5776                 *C) dflt=C;;
5777                 *L) dflt=L;;
5778                 *L1) dflt=L1;;
5779                 *) dflt=1;;
5780                 esac
5781                 ;;
5782         *)      dflt="$man1ext";;
5783         esac
5784         . ./myread
5785         man1ext="$ans"
5786         ;;
5787 esac
5788
5789 : see if we can have long filenames
5790 echo " "
5791 rmlist="$rmlist /tmp/cf$$"
5792 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5793 first=123456789abcdef
5794 second=/tmp/cf$$/$first
5795 $rm -f $first $second
5796 if (echo hi >$first) 2>/dev/null; then
5797         if $test -f 123456789abcde; then
5798                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5799                 val="$undef"
5800         else
5801                 if (echo hi >$second) 2>/dev/null; then
5802                         if $test -f /tmp/cf$$/123456789abcde; then
5803                                 $cat <<'EOM'
5804 That's peculiar... You can have filenames longer than 14 characters, but only
5805 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5806 I shall consider your system cannot support long filenames at all.
5807 EOM
5808                                 val="$undef"
5809                         else
5810                                 echo 'You can have filenames longer than 14 characters.' >&4
5811                                 val="$define"
5812                         fi
5813                 else
5814                         $cat <<'EOM'
5815 How confusing! Some of your filesystems are sane enough to allow filenames
5816 longer than 14 characters but some others like /tmp can't even think about them.
5817 So, for now on, I shall assume your kernel does not allow them at all.
5818 EOM
5819                         val="$undef"
5820                 fi
5821         fi
5822 else
5823         $cat <<'EOM'
5824 You can't have filenames longer than 14 chars.  You can't even think about them!
5825 EOM
5826         val="$undef"
5827 fi 
5828 set d_flexfnam
5829 eval $setvar
5830 $rm -rf /tmp/cf$$ 123456789abcde*
5831
5832 : determine where library module manual pages go
5833 set man3dir man3dir none
5834 eval $prefixit
5835 $cat <<EOM
5836
5837 $spackage has manual pages for many of the library modules.
5838 EOM
5839
5840 case "$nroff" in
5841 nroff)
5842         $cat <<'EOM'
5843 However, you don't have nroff, so they're probably useless to you.
5844 EOM
5845         case "$man3dir" in
5846         '') man3dir="none";;
5847         esac;;
5848 esac
5849
5850 case "$d_flexfnam" in
5851 undef)
5852         $cat <<'EOM'
5853 However, your system can't handle the long file names like File::Basename.3. 
5854 EOM
5855         case "$man3dir" in
5856         '') man3dir="none";;
5857         esac;;
5858 esac
5859
5860 echo "If you don't want the manual sources installed, answer 'none'."
5861 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5862 case "$man3dir" in
5863 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5864         if $test -d "$privlib/man/man3"; then
5865                 cat <<EOM >&4
5866
5867 WARNING:  Previous versions of perl installed man3 pages into
5868 $privlib/man/man3.  This version will suggest a 
5869 new default of $dflt.  
5870 EOM
5871                 tdflt=$dflt
5872                 dflt='n'
5873                 rp='Do you wish to preserve the old behavior?(y/n)'
5874                 . ./myread
5875                 case "$ans" in
5876                 y*) dflt="$privlib/man/man3" ;;
5877                 *)  dflt=$tdflt ;;
5878                 esac
5879     fi
5880         ;;
5881 ' ') dflt=none;;
5882 *)      dflt="$man3dir" ;;
5883 esac
5884 echo " "
5885 fn=dn+~
5886 rp="Where do the $package library man pages (source) go?"
5887 . ./getfile
5888 man3dir="$ans"
5889 man3direxp="$ansexp"
5890 case "$man1dir" in
5891 '')     man3dir=' '
5892         installman3dir='';;
5893 esac
5894
5895 : Change installation prefix, if necessary.
5896 if $test X"$prefix" != X"$installprefix"; then
5897         installman3dir=`echo $man3direxp | $sed 's#^$prefix#$installprefix#'`
5898 else
5899         installman3dir="$man3direxp"
5900 fi
5901
5902 : What suffix to use on installed man pages
5903 case "$man3dir" in
5904 ' ')
5905         man3ext='0'
5906         ;;
5907 *)
5908         rp="What suffix should be used for the $package library man pages?"
5909         case "$man3ext" in
5910         '')     case "$man3dir" in
5911                 *3)  dflt=3 ;;
5912                 *3p) dflt=3p ;;
5913                 *3pm) dflt=3pm ;;
5914                 *l) dflt=l;;
5915                 *n) dflt=n;;
5916                 *o) dflt=o;;
5917                 *p) dflt=p;;
5918                 *C) dflt=C;;
5919                 *L) dflt=L;;
5920                 *L3) dflt=L3;;
5921                 *) dflt=3;;
5922                 esac
5923                 ;;
5924         *)      dflt="$man3ext";;
5925         esac
5926         . ./myread
5927         man3ext="$ans"
5928         ;;
5929 esac
5930
5931 : see if we have to deal with yellow pages, now NIS.
5932 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5933         if $test -f /usr/etc/nibindd; then
5934                 echo " "
5935                 echo "I'm fairly confident you're on a NeXT."
5936                 echo " "
5937                 rp='Do you get the hosts file via NetInfo?'
5938                 dflt=y
5939                 case "$hostcat" in
5940                 nidump*) ;;
5941                 '') ;;
5942                 *) dflt=n;;
5943                 esac
5944                 . ./myread
5945                 case "$ans" in
5946                 y*) hostcat='nidump hosts .';;
5947                 *)      case "$hostcat" in
5948                         nidump*) hostcat='';;
5949                         esac
5950                         ;;
5951                 esac
5952         fi
5953         case "$hostcat" in
5954         nidump*) ;;
5955         *)
5956                 case "$hostcat" in
5957                 *ypcat*) dflt=y;;
5958                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5959                                 dflt=y
5960                         else
5961                                 dflt=n
5962                         fi;;
5963                 *) dflt=n;;
5964                 esac
5965                 echo " "
5966                 rp='Are you getting the hosts file via yellow pages?'
5967                 . ./myread
5968                 case "$ans" in
5969                 y*) hostcat='ypcat hosts';;
5970                 *) hostcat='cat /etc/hosts';;
5971                 esac
5972                 ;;
5973         esac
5974 fi
5975 case "$hostcat" in
5976 '') hostcat='cat /etc/hosts';;
5977 esac
5978 case "$groupcat" in
5979 '') groupcat='cat /etc/group';;
5980 esac
5981 case "$passcat" in
5982 '') passcat='cat /etc/passwd';;
5983 esac
5984
5985 : now get the host name
5986 echo " "
5987 echo "Figuring out host name..." >&4
5988 case "$myhostname" in
5989 '') cont=true
5990         echo 'Maybe "hostname" will work...'
5991         if tans=`sh -c hostname 2>&1` ; then
5992                 myhostname=$tans
5993                 phostname=hostname
5994                 cont=''
5995         fi
5996         ;;
5997 *) cont='';;
5998 esac
5999 if $test "$cont"; then
6000         if ./xenix; then
6001                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6002                 if tans=`cat /etc/systemid 2>&1` ; then
6003                         myhostname=$tans
6004                         phostname='cat /etc/systemid'
6005                         echo "Whadyaknow.  Xenix always was a bit strange..."
6006                         cont=''
6007                 fi
6008         elif $test -r /etc/systemid; then
6009                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6010         fi
6011 fi
6012 if $test "$cont"; then
6013         echo 'No, maybe "uuname -l" will work...'
6014         if tans=`sh -c 'uuname -l' 2>&1` ; then
6015                 myhostname=$tans
6016                 phostname='uuname -l'
6017         else
6018                 echo 'Strange.  Maybe "uname -n" will work...'
6019                 if tans=`sh -c 'uname -n' 2>&1` ; then
6020                         myhostname=$tans
6021                         phostname='uname -n'
6022                 else
6023                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6024                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6025                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6026                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6027                         else
6028                                 case "$myhostname" in
6029                                 '') echo "Does this machine have an identity crisis or something?"
6030                                         phostname='';;
6031                                 *)
6032                                         echo "Well, you said $myhostname before..."
6033                                         phostname='echo $myhostname';;
6034                                 esac
6035                         fi
6036                 fi
6037         fi
6038 fi
6039 : you do not want to know about this
6040 set $myhostname
6041 myhostname=$1
6042
6043 : verify guess
6044 if $test "$myhostname" ; then
6045         dflt=y
6046         rp='Your host name appears to be "'$myhostname'".'" Right?"
6047         . ./myread
6048         case "$ans" in
6049         y*) ;;
6050         *) myhostname='';;
6051         esac
6052 fi
6053
6054 : bad guess or no guess
6055 while $test "X$myhostname" = X ; do
6056         dflt=''
6057         rp="Please type the (one word) name of your host:"
6058         . ./myread
6059         myhostname="$ans"
6060 done
6061
6062 : translate upper to lower if necessary
6063 case "$myhostname" in
6064 *[A-Z]*)
6065         echo "(Normalizing case in your host name)"
6066         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6067         ;;
6068 esac
6069
6070 case "$myhostname" in
6071 *.*)
6072         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6073         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6074         echo "(Trimming domain name from host name--host name is now $myhostname)"
6075         ;;
6076 *) case "$mydomain" in
6077         '')
6078                 {
6079                         test "X$hostcat" = "Xypcat hosts" &&
6080                         ypmatch "$myhostname" hosts 2>/dev/null |\
6081                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6082                         $test -s hosts
6083                 } || {
6084                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6085                                         /[       ]$myhostname[  . ]/p" > hosts
6086                 }
6087                 tmp_re="[       . ]"
6088                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6089                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6090                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6091                         hosts | $sort | $uniq | \
6092                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6093                 case `$echo X$dflt` in
6094                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6095                         dflt=.
6096                         ;;
6097                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6098                         ;;
6099                 esac
6100                 case "$dflt" in
6101                 .)
6102                         tans=`./loc resolv.conf X /etc /usr/etc`
6103                         if $test -f "$tans"; then
6104                                 echo "(Attempting domain name extraction from $tans)"
6105                                 dflt=.`$sed -n -e 's/   / /g' \
6106                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6107                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6108                                 case "$dflt" in
6109                                 .) dflt=.`$sed -n -e 's/        / /g' \
6110                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6111                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6112                                         ;;
6113                                 esac
6114                         fi
6115                         ;;
6116                 esac
6117                 case "$dflt" in
6118                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6119                         dflt=.`sh -c domainname 2>/dev/null`
6120                         case "$dflt" in
6121                         '') dflt='.';;
6122                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6123                         esac
6124                         ;;
6125                 esac
6126                 case "$dflt" in
6127                 .) echo "(Lost all hope -- silly guess then)"
6128                         dflt='.uucp'
6129                         ;;
6130                 esac
6131                 $rm -f hosts
6132                 ;;
6133         *) dflt="$mydomain";;
6134         esac;;
6135 esac
6136 echo " "
6137 rp="What is your domain name?"
6138 . ./myread
6139 tans="$ans"
6140 case "$ans" in
6141 '') ;;
6142 .*) ;;
6143 *) tans=".$tans";;
6144 esac
6145 mydomain="$tans"
6146
6147 : translate upper to lower if necessary
6148 case "$mydomain" in
6149 *[A-Z]*)
6150         echo "(Normalizing case in your domain name)"
6151         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6152         ;;
6153 esac
6154
6155 : a little sanity check here
6156 case "$phostname" in
6157 '') ;;
6158 *)
6159         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6160         $myhostname$mydomain|$myhostname) ;;
6161         *)
6162                 case "$phostname" in
6163                 sed*)
6164                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6165                         ;;
6166                 *)
6167                         echo "(That doesn't agree with your $phostname command, by the way.)"
6168                         ;;
6169                 esac
6170         ;;
6171         esac
6172         ;;
6173 esac
6174
6175 $cat <<EOM
6176
6177 I need to get your e-mail address in Internet format if possible, i.e.
6178 something like user@host.domain. Please answer accurately since I have
6179 no easy means to double check it. The default value provided below
6180 is most probably close to the reality but may not be valid from outside
6181 your organization...
6182
6183 EOM
6184 cont=x
6185 while test "$cont"; do
6186         case "$cf_email" in
6187         '') dflt="$cf_by@$myhostname$mydomain";;
6188         *) dflt="$cf_email";;
6189         esac
6190         rp='What is your e-mail address?'
6191         . ./myread
6192         cf_email="$ans"
6193         case "$cf_email" in
6194         *@*.*) cont='' ;;
6195         *)
6196                 rp='Address does not look like an Internet one.  Use it anyway?'
6197                 case "$fastread" in
6198                 yes) dflt=y ;;
6199                 *) dflt=n ;;
6200                 esac
6201                 . ./myread
6202                 case "$ans" in
6203                 y*) cont='' ;;
6204                 *) echo " " ;;
6205                 esac
6206                 ;;
6207         esac
6208 done
6209
6210 $cat <<EOM
6211
6212 If you or somebody else will be maintaining perl at your site, please
6213 fill in the correct e-mail address here so that they may be contacted
6214 if necessary. Currently, the "perlbug" program included with perl
6215 will send mail to this address in addition to perlbug@perl.com. You may
6216 enter "none" for no administrator.
6217
6218 EOM
6219 case "$perladmin" in
6220 '') dflt="$cf_email";;
6221 *) dflt="$perladmin";;
6222 esac
6223 rp='Perl administrator e-mail address'
6224 . ./myread
6225 perladmin="$ans"
6226
6227 : figure out how to guarantee perl startup
6228 case "$startperl" in
6229 '')
6230         case "$sharpbang" in
6231         *!)
6232                 $cat <<EOH
6233
6234 I can use the #! construct to start perl on your system. This will
6235 make startup of perl scripts faster, but may cause problems if you
6236 want to share those scripts and perl is not in a standard place
6237 ($binexp/perl) on all your platforms. The alternative is to force
6238 a shell by starting the script with a single ':' character.
6239
6240 EOH
6241                 dflt="$binexp/perl"
6242                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6243                 . ./myread
6244                 case "$ans" in
6245                 none)   startperl=": # use perl";;
6246                 *)      startperl="#!$ans"
6247                         if $test 30 -lt `echo "$ans" | wc -c`; then
6248                                 $cat >&4 <<EOM
6249
6250 WARNING:  Some systems limit the #! command to 32 characters.
6251 If you experience difficulty running Perl scripts with #!, try
6252 installing Perl in a directory with a shorter pathname.
6253
6254 EOM
6255                         fi ;;
6256                 esac
6257                 ;;
6258         *) startperl=": # use perl"
6259                 ;;
6260         esac
6261         ;;
6262 esac
6263 echo "I'll use $startperl to start perl scripts."
6264
6265 : figure best path for perl in scripts
6266 case "$perlpath" in
6267 '')
6268         perlpath="$binexp/perl"
6269         case "$startperl" in
6270         *!*) ;;
6271         *)
6272                 $cat <<EOH
6273
6274 I will use the "eval 'exec'" idiom to start Perl on your system.
6275 I can use the full path of your Perl binary for this purpose, but
6276 doing so may cause problems if you want to share those scripts and
6277 Perl is not always in a standard place ($binexp/perl).
6278
6279 EOH
6280                 dflt="$binexp/perl"
6281                 rp="What path shall I use in \"eval 'exec'\"?"
6282                 . ./myread
6283                 perlpath="$ans"
6284                 ;;
6285         esac
6286         ;;
6287 esac
6288 case "$startperl" in
6289 *!*)    ;;
6290 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6291 esac
6292
6293 : determine where public executable scripts go
6294 set scriptdir scriptdir
6295 eval $prefixit
6296 case "$scriptdir" in
6297 '')
6298         dflt="$bin"
6299         : guess some guesses
6300         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6301         $test -d /usr/share/bin     && dflt=/usr/share/bin
6302         $test -d /usr/local/script  && dflt=/usr/local/script
6303         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6304         $test -d $prefixexp/script  && dflt=$prefixexp/script
6305         set dflt
6306         eval $prefixup
6307         ;;
6308 *)  dflt="$scriptdir"
6309         ;;
6310 esac
6311 $cat <<EOM
6312  
6313 Some installations have a separate directory just for executable scripts so
6314 that they can mount it across multiple architectures but keep the scripts in
6315 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6316 Or you might just lump your scripts in with all your other executables.
6317  
6318 EOM
6319 fn=d~
6320 rp='Where do you keep publicly executable scripts?'
6321 . ./getfile
6322 if $test "X$ansexp" != "X$scriptdirexp"; then
6323         installscript=''
6324 fi
6325 scriptdir="$ans"
6326 scriptdirexp="$ansexp"
6327 : Change installation prefix, if necessary.
6328 if $test X"$prefix" != X"$installprefix"; then
6329         installscript=`echo $scriptdirexp | sed 's#^$prefix#$installprefix#'`
6330 else
6331         installscript="$scriptdirexp"
6332 fi
6333
6334 $cat <<EOM
6335
6336 After $package is installed, you may wish to install various
6337 add-on modules and utilities.  Typically, these add-ons will
6338 be installed under $prefix with the rest
6339 of this package.  However, you may wish to install such add-ons
6340 elsewhere under a different prefix.
6341
6342 If you do not wish to put everything under a single prefix, that's
6343 ok.  You will be prompted for the individual locations; this siteprefix
6344 is only used to suggest the defaults.
6345
6346 The default should be fine for most people.
6347
6348 EOM
6349 fn=d~+
6350 rp='Installation prefix to use for add-on modules and utilities?'
6351 : XXX Here might be another good place for an installstyle setting.
6352 case "$siteprefix" in
6353 '') dflt=$prefix ;;
6354 *)  dflt=$siteprefix ;;
6355 esac
6356 . ./getfile
6357 oldsiteprefix=''
6358 case "$siteprefix" in
6359 '') ;;
6360 *)
6361         case "$ans" in
6362         "$prefix") ;;
6363         *) oldsiteprefix="$prefix";;
6364         esac
6365         ;;
6366 esac
6367 siteprefix="$ans"
6368 siteprefixexp="$ansexp"
6369
6370 : determine where site specific libraries go.
6371 : Usual default is /usr/local/lib/perl5/site_perl
6372 : The default "style" setting is made in installstyle.U
6373 : XXX No longer works with Prefixit stuff.
6374 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6375 case "$installstyle" in
6376 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6377 *)       dflt=$siteprefix/lib/site_$prog ;;
6378 esac
6379 $cat <<EOM
6380
6381 The installation process will create a directory for
6382 site-specific extensions and modules.  Most users find it convenient
6383 to place all site-specific files in this directory rather than in the
6384 main distribution directory.
6385
6386 EOM
6387 fn=d~+
6388 rp='Pathname for the site-specific library files?'
6389 . ./getfile
6390 sitelib="$ans"
6391 sitelibexp="$ansexp"
6392 : Change installation prefix, if necessary.
6393 if $test X"$prefix" != X"$installprefix"; then
6394         installsitelib=`echo $sitelibexp | sed 's#^$prefix#$installprefix#'`
6395 else
6396         installsitelib="$sitelibexp"
6397 fi
6398
6399 : determine where site specific architecture-dependent libraries go.
6400 : sitelib  default is /usr/local/lib/perl5/site_perl/
6401 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6402 : sitelib may have an optional trailing /share.
6403 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6404 tdflt="$tdflt/$apiversion/$archname"
6405 set sitearch sitearch none
6406 eval $prefixit
6407 case "$sitearch" in
6408 '')     dflt="$tdflt" ;;
6409 *)      dflt="$sitearch" ;;
6410 esac
6411 $cat <<EOM
6412
6413 The installation process will also create a directory for
6414 architecture-dependent site-specific extensions and modules.
6415
6416 EOM
6417 fn=nd~+
6418 rp='Pathname for the site-specific architecture-dependent library files?'
6419 . ./getfile
6420 sitearch="$ans"
6421 sitearchexp="$ansexp"
6422 : Change installation prefix, if necessary.
6423 if $test X"$prefix" != X"$installprefix"; then
6424         installsitearch=`echo $sitearchexp | sed 's#^$prefix#$installprefix#'`
6425 else
6426         installsitearch="$sitearchexp"
6427 fi
6428
6429 cat <<EOM
6430
6431 Perl can be built to take advantage of long doubles which
6432 (if available) may give more accuracy and range for floating point
6433 numbers.  To do so, Configure must be run with -Duselongdouble.
6434
6435 If this doesn't make any sense to you, just accept the default 'n'.
6436 EOM
6437 case "$uselongdouble" in
6438 $define|true|[yY]*)     dflt='y';;
6439 *) dflt='n';;
6440 esac
6441 rp='Try to use long doubles if available?'
6442 . ./myread
6443 case "$ans" in
6444 y|Y)    val="$define"   ;;
6445 *)      val="$undef"    ;;
6446 esac
6447 set uselongdouble
6448 eval $setvar
6449
6450 case "$uselongdouble" in
6451 "$define"|true|[yY]*)
6452 : Look for a hint-file generated 'call-back-unit'.  If the
6453 : user has specified that long doubles should be used,
6454 : we may need to set or change some other defaults.
6455         if $test -f uselongdouble.cbu; then
6456                 echo "Your platform has some specific hints for long doubles, using them..."
6457                 . ./uselongdouble.cbu
6458         else
6459                 $cat <<EOM
6460 (Your platform doesn't have any specific hints for long doubles.)
6461 EOM
6462         fi
6463         ;;
6464 esac
6465
6466 cat <<EOM
6467
6468 Previous version of $package used the standard IO mechanisms as defined
6469 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6470 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6471 the default.  This abstraction layer can use AT&T's sfio (if you already
6472 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6473 problems with some extension modules.  Using PerlIO with stdio is safe,
6474 but it is slower than plain stdio and therefore is not the default.
6475
6476 If this doesn't make any sense to you, just accept the default 'n'.
6477 EOM
6478 case "$useperlio" in
6479 $define|true|[yY]*)     dflt='y';;
6480 *) dflt='n';;
6481 esac
6482 rp='Use the experimental PerlIO abstraction layer?'
6483 . ./myread
6484 case "$ans" in
6485 y|Y) 
6486         val="$define"
6487         ;;     
6488 *)      
6489         echo "Ok, doing things the stdio way"
6490         val="$undef"
6491         ;;
6492 esac
6493 set useperlio
6494 eval $setvar 
6495
6496 : Check how to convert floats to strings.
6497 if test "X$d_Gconvert" = X; then
6498         echo " "
6499         echo "Checking for an efficient way to convert floats to strings."
6500         $cat >try.c <<'EOP'
6501 #ifdef TRY_gconvert
6502 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6503 char *myname = "gconvert";
6504 #endif
6505 #ifdef TRY_gcvt
6506 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6507 char *myname = "gcvt";
6508 #endif
6509 #ifdef TRY_sprintf
6510 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6511 char *myname = "sprintf";
6512 #endif
6513
6514 #include <stdio.h>
6515
6516 int
6517 checkit(expect, got)
6518 char *expect;
6519 char *got;
6520 {
6521     if (strcmp(expect, got)) {
6522                 printf("%s oddity:  Expected %s, got %s\n",
6523                         myname, expect, got);
6524                 exit(1);
6525         }
6526 }
6527
6528 int main()
6529
6530         char buf[64]; 
6531         buf[63] = '\0';
6532
6533         /* This must be 1st test on (which?) platform */
6534         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6535         Gconvert(0.1, 8, 0, buf);
6536         checkit("0.1", buf);
6537
6538         Gconvert(1.0, 8, 0, buf); 
6539         checkit("1", buf);
6540
6541         Gconvert(0.0, 8, 0, buf); 
6542         checkit("0", buf);
6543
6544         Gconvert(-1.0, 8, 0, buf); 
6545         checkit("-1", buf);
6546
6547         /* Some Linux gcvt's give 1.e+5 here. */
6548         Gconvert(100000.0, 8, 0, buf); 
6549         checkit("100000", buf);
6550         
6551         /* Some Linux gcvt's give -1.e+5 here. */
6552         Gconvert(-100000.0, 8, 0, buf); 
6553         checkit("-100000", buf);
6554
6555         exit(0);
6556 }
6557 EOP
6558         case "$d_Gconvert" in
6559         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6560         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6561         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6562         *) xxx_list='gconvert gcvt sprintf' ;;
6563         esac
6564
6565         for xxx_convert in $xxx_list; do
6566                 echo "Trying $xxx_convert"
6567                 $rm -f try try$_o
6568                 set try -DTRY_$xxx_convert
6569                 if eval $compile; then
6570                         echo "$xxx_convert" found. >&4
6571                         if ./try; then
6572                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6573                                 break;
6574                         else
6575                                 echo "...But $xxx_convert didn't work as I expected."
6576                         fi
6577                 else
6578                         echo "$xxx_convert NOT found." >&4
6579                 fi
6580         done
6581                 
6582         case "$xxx_convert" in
6583         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6584         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6585         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6586         esac
6587 fi
6588
6589 : see if inttypes.h is available
6590 : we want a real compile instead of Inhdr because some systems
6591 : have an inttypes.h which includes non-existent headers
6592 echo " "
6593 $cat >try.c <<EOCP
6594 #include <inttypes.h>
6595 int main() {
6596         static int32_t foo32 = 0x12345678;
6597 }
6598 EOCP
6599 set try
6600 if eval $compile; then
6601         echo "<inttypes.h> found." >&4
6602         val="$define"
6603 else
6604         echo "<inttypes.h> NOT found." >&4
6605         val="$undef"
6606 fi
6607 $rm -f try.c try
6608 set i_inttypes
6609 eval $setvar
6610
6611 : check for int64_t
6612 case "$use64bits" in
6613 "$define" )
6614         echo " "
6615         echo $n "Checking to see if your system supports int64_t...$c" >&4
6616         $cat >try.c <<EOCP
6617 #include <sys/types.h>
6618 #$i_inttypes I_INTTYPES
6619 #ifdef I_INTTYPES
6620 #include <inttypes.h>
6621 #endif
6622 int64_t foo() { int64_t x; x = 7; return x; }
6623 EOCP
6624         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6625                 val="$define"
6626                 echo " Yup, it does." >&4
6627         else
6628                 val="$undef"
6629                 echo " Nope, it doesn't." >&4
6630         fi
6631         $rm -f try.*
6632         ;;
6633 *)      val="$undef"
6634         ;;
6635 esac
6636 set d_int64t
6637 eval $setvar
6638
6639
6640 : check for lengths of integral types
6641 echo " "
6642 case "$intsize" in
6643 '')
6644         echo "Checking to see how big your integers are..." >&4
6645         $cat >intsize.c <<'EOCP'
6646 #include <stdio.h>
6647 int main()
6648 {
6649         printf("intsize=%d;\n", sizeof(int));
6650         printf("longsize=%d;\n", sizeof(long));
6651         printf("shortsize=%d;\n", sizeof(short));
6652         exit(0);
6653 }
6654 EOCP
6655         set intsize
6656         if eval $compile_ok && ./intsize > /dev/null; then
6657                 eval `./intsize`
6658                 echo "Your integers are $intsize bytes long."
6659                 echo "Your long integers are $longsize bytes long."
6660                 echo "Your short integers are $shortsize bytes long."
6661         else
6662                 $cat >&4 <<EOM
6663 !
6664 Help! I can't compile and run the intsize test program: please enlighten me!
6665 (This is probably a misconfiguration in your system or libraries, and
6666 you really ought to fix it.  Still, I'll try anyway.)
6667 !
6668 EOM
6669                 dflt=4
6670                 rp="What is the size of an integer (in bytes)?"
6671                 . ./myread
6672                 intsize="$ans"
6673                 dflt=$intsize
6674                 rp="What is the size of a long integer (in bytes)?"
6675                 . ./myread
6676                 longsize="$ans"
6677                 dflt=2
6678                 rp="What is the size of a short integer (in bytes)?"
6679                 . ./myread
6680                 shortsize="$ans"
6681         fi
6682         ;;
6683 esac
6684 $rm -f intsize intsize.*
6685
6686 : check for long long
6687 echo " "
6688 echo $n "Checking to see if your system supports long long...$c" >&4
6689 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6690 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6691         val="$define"
6692         echo " Yup, it does." >&4
6693 else
6694         val="$undef"
6695         echo " Nope, it doesn't." >&4
6696 fi
6697 $rm try.*
6698 set d_longlong
6699 eval $setvar
6700
6701 : check for length of long long
6702 case "${d_longlong}${longlongsize}" in
6703 $define)
6704         echo " "
6705         $echo $n "Checking to see how big your long longs are...$c" >&4
6706         $cat >try.c <<'EOCP'
6707 #include <stdio.h>
6708 int main()
6709 {
6710         printf("%d\n", sizeof(long long));
6711 }
6712 EOCP
6713         set try
6714         if eval $compile_ok; then
6715                 longlongsize=`./try`
6716                 $echo " $longlongsize bytes." >&4
6717         else
6718                 dflt='8'
6719                 echo " "
6720                 echo "(I can't seem to compile the test program.  Guessing...)"
6721                 rp="What is the size of a long long (in bytes)?"
6722                 . ./myread
6723                 longlongsize="$ans"
6724         fi
6725         if $test "X$longsize" = "X$longlongsize"; then
6726                 echo "(That isn't any different from an ordinary long.)"
6727         fi      
6728         ;;
6729 esac
6730 $rm -f try.c try
6731
6732 echo " "
6733
6734 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6735
6736 echo "Checking how to print 64-bit integers..." >&4
6737
6738 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6739         quad=int
6740         $cat >try.c <<'EOCP'
6741 #include <sys/types.h>
6742 #include <stdio.h>
6743 int main() {
6744   int q = 12345678901;
6745   printf("%ld\n", q);
6746 }
6747 EOCP
6748         set try
6749         if eval $compile; then
6750                 yyy=`./try$exe_ext`
6751                 case "$yyy" in
6752                 12345678901)
6753                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6754                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6755                         echo "We will use %d."
6756                         ;;
6757                 esac
6758         fi
6759 fi
6760
6761 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6762         quad=long
6763         $cat >try.c <<'EOCP'
6764 #include <sys/types.h>
6765 #include <stdio.h>
6766 int main() {
6767   long q = 12345678901;
6768   printf("%ld\n", q);
6769 }
6770 EOCP
6771         set try
6772         if eval $compile; then
6773                 yyy=`./try$exe_ext`
6774                 case "$yyy" in
6775                 12345678901)
6776                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6777                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6778                         echo "We will use %ld."
6779                         ;;
6780                 esac
6781         fi
6782 fi
6783
6784 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6785         quad=int64_t
6786         $cat >try.c <<'EOCP'
6787 #include <sys/types.h>
6788 #include <inttypes.h>
6789 #include <stdio.h>
6790 int main() {
6791   int64_t q = 12345678901;
6792   printf("%" PRId64 "\n", q);
6793 }
6794 EOCP
6795         set try
6796         if eval $compile; then
6797                 yyy=`./try$exe_ext`
6798                 case "$yyy" in
6799                 12345678901)
6800                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6801                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6802                         echo "We will use the C9X style."
6803                         ;;
6804                 esac
6805         fi
6806 fi
6807
6808 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6809         quad="long long"
6810         $cat >try.c <<'EOCP'
6811 #include <sys/types.h>
6812 #include <stdio.h>
6813 int main() {
6814   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6815   printf("%lld\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='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6824                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6825                         echo "We will use the %lld style."
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("%Ld\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='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6846                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6847                         echo "We will use %lld."
6848                         ;;
6849                 esac
6850         fi
6851 fi
6852
6853 if $test X"$sPRId64" = X -a X"$quad" != X; then
6854         $cat >try.c <<EOCP
6855 #include <sys/types.h>
6856 #include <stdio.h>
6857 int main() {
6858   $quad q = 12345678901;
6859   printf("%qd\n", q);
6860 }
6861 EOCP
6862         set try
6863         if eval $compile; then
6864                 yyy=`./try$exe_ext`
6865                 case "$yyy" in
6866                 12345678901)
6867                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6868                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6869                         echo "We will use %qd."
6870                         ;;
6871                 esac
6872         fi
6873 fi
6874
6875 if $test X"$sPRId64" = X; then
6876         echo "Cannot figure out how to print 64-bit integers." >&4
6877 fi
6878
6879 $rm -f try try.*
6880
6881 fi # intsize -o longsize -o d_int64t -o d_longlong
6882
6883 case "$sPRId64" in
6884 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
6885         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
6886         ;;
6887 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
6888         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
6889         ;;
6890 esac
6891
6892 : check for length of double
6893 echo " "
6894 case "$doublesize" in
6895 '')
6896         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
6897         $cat >try.c <<'EOCP'
6898 #include <stdio.h>
6899 int main()
6900 {
6901         printf("%d\n", sizeof(double));
6902 }
6903 EOCP
6904         set try
6905         if eval $compile_ok; then
6906                 doublesize=`./try`
6907                 $echo " $doublesize bytes." >&4
6908         else
6909                 dflt='8'
6910                 echo "(I can't seem to compile the test program.  Guessing...)"
6911                 rp="What is the size of a double precision number (in bytes)?"
6912                 . ./myread
6913                 doublesize="$ans"
6914         fi
6915         ;;
6916 esac
6917 $rm -f try.c try
6918
6919 : check for long doubles
6920 echo " "
6921 echo $n "Checking to see if your system supports long doubles...$c" >&4
6922 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
6923 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6924         val="$define"
6925         echo " Yup, it does." >&4
6926 else
6927         val="$undef"
6928         echo " Nope, it doesn't." >&4
6929 fi
6930 $rm try.*
6931 set d_longdbl
6932 eval $setvar
6933
6934 : check for length of long double
6935 case "${d_longdbl}${longdblsize}" in
6936 $define)
6937         echo " "
6938         $echo $n "Checking to see how big your long doubles are...$c" >&4
6939         $cat >try.c <<'EOCP'
6940 #include <stdio.h>
6941 int main()
6942 {
6943         printf("%d\n", sizeof(long double));
6944 }
6945 EOCP
6946         set try
6947         if eval $compile; then
6948                 longdblsize=`./try`
6949                 $echo " $longdblsize bytes." >&4
6950         else
6951                 dflt='8'
6952                 echo " "
6953                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6954                 rp="What is the size of a long double (in bytes)?"
6955                 . ./myread
6956                 longdblsize="$ans"
6957         fi
6958         if $test "X$doublesize" = "X$longdblsize"; then
6959                 echo "(That isn't any different from an ordinary double.)"
6960         fi      
6961         ;;
6962 esac
6963 $rm -f try.c try
6964
6965 echo " "
6966
6967 if $test X"$d_longdbl" = X"$define"; then
6968
6969 echo "Checking how to print long doubles..." >&4
6970
6971 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6972         $cat >try.c <<'EOCP'
6973 #include <sys/types.h>
6974 #include <stdio.h>
6975 int main() {
6976   double d = 123.456;
6977   printf("%.3f\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='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6986                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
6987                         echo "We will use %f."
6988                         ;;
6989                 esac
6990         fi
6991 fi
6992
6993 if $test X"$sPRIfldbl" = X; then
6994         $cat >try.c <<'EOCP'
6995 #include <sys/types.h>
6996 #include <stdio.h>
6997 int main() {
6998   long double d = 123.456;
6999   printf("%.3llf\n", d);
7000 }
7001 EOCP
7002         set try
7003         if eval $compile; then
7004                 yyy=`./try$exe_ext`
7005                 case "$yyy" in
7006                 123.456)
7007                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7008                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7009                         echo "We will use %llf."
7010                         ;;
7011                 esac
7012         fi
7013 fi
7014
7015 if $test X"$sPRIfldbl" = X; then
7016         $cat >try.c <<'EOCP'
7017 #include <sys/types.h>
7018 #include <stdio.h>
7019 int main() {
7020   long double d = 123.456;
7021   printf("%.3Lf\n", d);
7022 }
7023 EOCP
7024         set try
7025         if eval $compile; then
7026                 yyy=`./try$exe_ext`
7027                 case "$yyy" in
7028                 123.456)
7029                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7030                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7031                         echo "We will use %Lf."
7032                         ;;
7033                 esac
7034         fi
7035 fi
7036
7037 if $test X"$sPRIfldbl" = X; then
7038         $cat >try.c <<'EOCP'
7039 #include <sys/types.h>
7040 #include <stdio.h>
7041 int main() {
7042   long double d = 123.456;
7043   printf("%.3lf\n", d);
7044 }
7045 EOCP
7046         set try
7047         if eval $compile; then
7048                 yyy=`./try$exe_ext`
7049                 case "$yyy" in
7050                 123.456)
7051                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7052                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7053                         echo "We will use %lf."
7054                         ;;
7055                 esac
7056         fi
7057 fi
7058
7059 if $test X"$sPRIfldbl" = X; then
7060         echo "Cannot figure out how to print long doubles." >&4
7061 fi
7062
7063 $rm -f try try.*
7064
7065 fi # d_longdbl
7066
7067 case "$sPRIfldbl" in
7068 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7069         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7070         ;;
7071 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7072         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7073         ;;
7074 esac
7075
7076 : Initialize h_fcntl
7077 h_fcntl=false
7078
7079 : Initialize h_sysfile
7080 h_sysfile=false
7081
7082 : access call always available on UNIX
7083 set access d_access
7084 eval $inlibc
7085
7086 : locate the flags for 'access()'
7087 case "$d_access" in
7088 "$define")
7089         echo " "
7090         $cat >access.c <<'EOCP'
7091 #include <sys/types.h>
7092 #ifdef I_FCNTL
7093 #include <fcntl.h>
7094 #endif
7095 #ifdef I_SYS_FILE
7096 #include <sys/file.h>
7097 #endif
7098 #ifdef I_UNISTD
7099 #include <unistd.h>
7100 #endif
7101 int main() {
7102         exit(R_OK);
7103 }
7104 EOCP
7105         : check sys/file.h first, no particular reason here
7106         if $test `./findhdr sys/file.h` && \
7107                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7108                 h_sysfile=true;
7109                 echo "<sys/file.h> defines the *_OK access constants." >&4
7110         elif $test `./findhdr fcntl.h` && \
7111                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7112                 h_fcntl=true;
7113                 echo "<fcntl.h> defines the *_OK access constants." >&4
7114         elif $test `./findhdr unistd.h` && \
7115                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7116                 echo "<unistd.h> defines the *_OK access constants." >&4
7117         else
7118                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7119         fi
7120         ;;
7121 esac
7122 $rm -f access*
7123
7124 : see if accessx exists
7125 set accessx d_accessx
7126 eval $inlibc
7127
7128 : see if alarm exists
7129 set alarm d_alarm
7130 eval $inlibc
7131
7132 : see if atolf exists
7133 set atolf d_atolf
7134 eval $inlibc
7135
7136 : see if atoll exists
7137 set atoll d_atoll
7138 eval $inlibc
7139
7140 : Look for GNU-cc style attribute checking
7141 echo " "
7142 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7143 $cat >attrib.c <<'EOCP'
7144 #include <stdio.h>
7145 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7146 EOCP
7147 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7148         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7149                 echo "Your C compiler doesn't fully support __attribute__."
7150                 val="$undef"
7151         else
7152                 echo "Your C compiler supports __attribute__."
7153                 val="$define"
7154         fi
7155 else
7156         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7157         val="$undef"
7158 fi
7159 set d_attribut
7160 eval $setvar
7161 $rm -f attrib*
7162
7163 : see if bcmp exists
7164 set bcmp d_bcmp
7165 eval $inlibc
7166
7167 : see if bcopy exists
7168 set bcopy d_bcopy
7169 eval $inlibc
7170
7171 : see if this is a unistd.h system
7172 set unistd.h i_unistd
7173 eval $inhdr
7174
7175 : see if getpgrp exists
7176 set getpgrp d_getpgrp
7177 eval $inlibc
7178
7179 case "$d_getpgrp" in
7180 "$define")
7181         echo " "
7182         echo "Checking to see which flavor of getpgrp is in use..."
7183         $cat >set.c <<EOP
7184 #$i_unistd I_UNISTD
7185 #include <sys/types.h>
7186 #ifdef I_UNISTD
7187 #  include <unistd.h>
7188 #endif
7189 int main()
7190 {
7191         if (getuid() == 0) {
7192                 printf("(I see you are running Configure as super-user...)\n");
7193                 setuid(1);
7194         }
7195 #ifdef TRY_BSD_PGRP
7196         if (getpgrp(1) == 0)
7197                 exit(0);
7198 #else
7199         if (getpgrp() > 0)
7200                 exit(0);
7201 #endif
7202         exit(1);
7203 }
7204 EOP
7205         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7206                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7207                 val="$define"
7208         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7209                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7210                 val="$undef"
7211         else
7212                 echo "I can't seem to compile and run the test program."
7213                 if ./usg; then
7214                         xxx="a USG one, i.e. you use getpgrp()."
7215                 else
7216                         # SVR4 systems can appear rather BSD-ish.
7217                         case "$i_unistd" in
7218                         $undef)
7219                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7220                                 val="$define"
7221                                 ;;
7222                         $define)
7223                                 xxx="probably a USG one, i.e. you use getpgrp()."
7224                                 val="$undef"
7225                                 ;;
7226                         esac
7227                 fi
7228                 echo "Assuming your getpgrp is $xxx" >&4
7229         fi
7230         ;;
7231 *) val="$undef";;
7232 esac
7233 set d_bsdgetpgrp
7234 eval $setvar
7235 $rm -f set set.c
7236
7237 : see if setpgrp exists
7238 set setpgrp d_setpgrp
7239 eval $inlibc
7240
7241 case "$d_setpgrp" in
7242 "$define")
7243         echo " "
7244         echo "Checking to see which flavor of setpgrp is in use..."
7245         $cat >set.c <<EOP
7246 #$i_unistd I_UNISTD
7247 #include <sys/types.h>
7248 #ifdef I_UNISTD
7249 #  include <unistd.h>
7250 #endif
7251 int main()
7252 {
7253         if (getuid() == 0) {
7254                 printf("(I see you are running Configure as super-user...)\n");
7255                 setuid(1);
7256         }
7257 #ifdef TRY_BSD_PGRP
7258         if (-1 == setpgrp(1, 1))
7259                 exit(0);
7260 #else
7261         if (setpgrp() != -1)
7262                 exit(0);
7263 #endif
7264         exit(1);
7265 }
7266 EOP
7267         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7268                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7269                 val="$define"
7270         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7271                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7272                 val="$undef"
7273         else
7274                 echo "(I can't seem to compile and run the test program.)"
7275                 if ./usg; then
7276                         xxx="a USG one, i.e. you use setpgrp()."
7277                 else
7278                         # SVR4 systems can appear rather BSD-ish.
7279                         case "$i_unistd" in
7280                         $undef)
7281                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7282                                 val="$define"
7283                                 ;;
7284                         $define)
7285                                 xxx="probably a USG one, i.e. you use setpgrp()."
7286                                 val="$undef"
7287                                 ;;
7288                         esac
7289                 fi
7290                 echo "Assuming your setpgrp is $xxx" >&4
7291         fi
7292         ;;
7293 *) val="$undef";;
7294 esac
7295 set d_bsdsetpgrp
7296 eval $setvar
7297 $rm -f set set.c
7298 : see if bzero exists
7299 set bzero d_bzero
7300 eval $inlibc
7301
7302 : see if signal is declared as pointer to function returning int or void
7303 echo " "
7304 xxx=`./findhdr signal.h`
7305 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7306 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7307         echo "You have int (*signal())() instead of void." >&4
7308         val="$undef"
7309 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7310         echo "You have void (*signal())()." >&4
7311         val="$define"
7312 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7313         echo "You have int (*signal())() instead of void." >&4
7314         val="$undef"
7315 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7316         echo "You have void (*signal())()." >&4
7317         val="$define"
7318 else
7319         case "$d_voidsig" in
7320         '')
7321         echo "I can't determine whether signal handler returns void or int..." >&4
7322                 dflt=void
7323                 rp="What type does your signal handler return?"
7324                 . ./myread
7325                 case "$ans" in
7326                 v*) val="$define";;
7327                 *) val="$undef";;
7328                 esac;;
7329         "$define")
7330                 echo "As you already told me, signal handler returns void." >&4
7331                 val="$define"
7332                 ;;
7333         *)      echo "As you already told me, signal handler returns int." >&4
7334                 val="$undef"
7335                 ;;
7336         esac
7337 fi
7338 set d_voidsig
7339 eval $setvar
7340 case "$d_voidsig" in
7341 "$define") signal_t="void";;
7342 *) signal_t="int";;
7343 esac
7344 $rm -f $$.tmp
7345
7346 : check for ability to cast large floats to 32-bit ints.
7347 echo " "
7348 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7349 if $test "$intsize" -ge 4; then
7350         xxx=int
7351 else
7352         xxx=long
7353 fi
7354 $cat >try.c <<EOCP
7355 #include <stdio.h>
7356 #include <sys/types.h>
7357 #include <signal.h>
7358 $signal_t blech(s) int s; { exit(3); }
7359 int main()
7360 {
7361         $xxx i32;
7362         double f, g;
7363         int result = 0;
7364         char str[16];
7365         signal(SIGFPE, blech);
7366
7367         /* Don't let compiler optimize the test away.  Store the number 
7368            in a writable string for gcc to pass to sscanf under HP/UX.
7369         */
7370         sprintf(str, "2147483647");
7371         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7372         g = 10 * f;
7373         i32  = ($xxx) g;
7374
7375         /* x86 processors will probably give 0x8000 0000, which is a
7376        sign change.  We don't want that.  We want to mimic SPARC
7377            behavior here, which is to preserve the sign and give
7378            back 0x7fff ffff.
7379         */
7380         if (i32 != ($xxx) f)
7381                 result |= 1;
7382         exit(result);
7383 }
7384 EOCP
7385 set try
7386 if eval $compile_ok; then
7387         ./try
7388         yyy=$?
7389 else
7390         echo "(I can't seem to compile the test program--assuming it can't)"
7391         yyy=1
7392 fi
7393 case "$yyy" in
7394 0)      val="$define"
7395         echo "Yup, it can."
7396         ;;
7397 *)      val="$undef"
7398         echo "Nope, it can't."
7399         ;;
7400 esac
7401 set d_casti32
7402 eval $setvar
7403 $rm -f try try.*
7404
7405 : check for ability to cast negative floats to unsigned
7406 echo " "
7407 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7408 $cat >try.c <<EOCP
7409 #include <stdio.h>
7410 #include <sys/types.h>
7411 #include <signal.h>
7412 $signal_t blech(s) int s; { exit(7); }
7413 $signal_t blech_in_list(s) int s; { exit(4); }
7414 unsigned long dummy_long(p) unsigned long p; { return p; }
7415 unsigned int dummy_int(p) unsigned int p; { return p; }
7416 unsigned short dummy_short(p) unsigned short p; { return p; }
7417 int main()
7418 {
7419         double f;
7420         unsigned long along;
7421         unsigned int aint;
7422         unsigned short ashort;
7423         int result = 0;
7424         char str[16];
7425         
7426         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7427            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7428            optimized the whole file away
7429         */
7430         /* Store the number in a writable string for gcc to pass to 
7431            sscanf under HP/UX.
7432         */
7433         sprintf(str, "-123");
7434         sscanf(str, "%lf", &f);  /* f = -123.; */
7435
7436         signal(SIGFPE, blech);
7437         along = (unsigned long)f;
7438         aint = (unsigned int)f;
7439         ashort = (unsigned short)f;
7440         if (along != (unsigned long)-123)
7441                 result |= 1;
7442         if (aint != (unsigned int)-123)
7443                 result |= 1;
7444         if (ashort != (unsigned short)-123)
7445                 result |= 1;
7446         sprintf(str, "1073741824.");
7447         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7448         f = f + f;
7449         along = 0;
7450         along = (unsigned long)f;
7451         if (along != 0x80000000)
7452                 result |= 2;
7453         f -= 1.;
7454         along = 0;
7455         along = (unsigned long)f;
7456         if (along != 0x7fffffff)
7457                 result |= 1;
7458         f += 2.;
7459         along = 0;
7460         along = (unsigned long)f;
7461         if (along != 0x80000001)
7462                 result |= 2;
7463         if (result)
7464                 exit(result);
7465         signal(SIGFPE, blech_in_list);
7466         sprintf(str, "123.");
7467         sscanf(str, "%lf", &f);  /* f = 123.; */
7468         along = dummy_long((unsigned long)f);
7469         aint = dummy_int((unsigned int)f);
7470         ashort = dummy_short((unsigned short)f);
7471         if (along != (unsigned long)123)
7472                 result |= 4;
7473         if (aint != (unsigned int)123)
7474                 result |= 4;
7475         if (ashort != (unsigned short)123)
7476                 result |= 4;
7477         exit(result);
7478
7479 }
7480 EOCP
7481 set try
7482 if eval $compile_ok; then
7483         ./try
7484         castflags=$?
7485 else
7486         echo "(I can't seem to compile the test program--assuming it can't)"
7487         castflags=7
7488 fi
7489 case "$castflags" in
7490 0)      val="$define"
7491         echo "Yup, it can."
7492         ;;
7493 *)      val="$undef"
7494         echo "Nope, it can't."
7495         ;;
7496 esac
7497 set d_castneg
7498 eval $setvar
7499 $rm -f try.*
7500
7501 : see if vprintf exists
7502 echo " "
7503 if set vprintf val -f d_vprintf; eval $csym; $val; then
7504         echo 'vprintf() found.' >&4
7505         val="$define"
7506         $cat >vprintf.c <<'EOF'
7507 #include <varargs.h>
7508
7509 int main() { xxx("foo"); }
7510
7511 xxx(va_alist)
7512 va_dcl
7513 {
7514         va_list args;
7515         char buf[10];
7516
7517         va_start(args);
7518         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7519 }
7520 EOF
7521         set vprintf
7522         if eval $compile && ./vprintf; then
7523                 echo "Your vsprintf() returns (int)." >&4
7524                 val2="$undef"
7525         else
7526                 echo "Your vsprintf() returns (char*)." >&4
7527                 val2="$define"
7528         fi
7529 else
7530         echo 'vprintf() NOT found.' >&4
7531                 val="$undef"
7532                 val2="$undef"
7533 fi
7534 set d_vprintf
7535 eval $setvar
7536 val=$val2
7537 set d_charvspr
7538 eval $setvar
7539
7540 : see if chown exists
7541 set chown d_chown
7542 eval $inlibc
7543
7544 : see if chroot exists
7545 set chroot d_chroot
7546 eval $inlibc
7547
7548 : see if chsize exists
7549 set chsize d_chsize
7550 eval $inlibc
7551
7552 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7553 while $test $# -ge 2; do
7554         case "$1" in
7555         $define) echo "#include <$2>";;
7556         esac ;
7557     shift 2;
7558 done > try.c;
7559 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7560 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7561         val="$define";
7562 else
7563         val="$undef";
7564 fi;
7565 set $varname;
7566 eval $setvar;
7567 $rm -f try.c try.o'
7568
7569 : see if this is a sys/uio.h system
7570 set sys/uio.h i_sysuio
7571 eval $inhdr
7572
7573 echo "Checking to see if your system supports struct iovec..." >&4
7574 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7575 eval $hasfield
7576 case "$d_iovec_s" in
7577 "$define")      echo "Yup, it does." >&4
7578                 ;;
7579 *)              echo "Nope, it doesn't." >&4
7580                 ;;
7581 esac
7582
7583 socketlib=''
7584 sockethdr=''
7585 : see whether socket exists
7586 echo " "
7587 $echo $n "Hmm... $c" >&4
7588 if set socket val -f d_socket; eval $csym; $val; then
7589         echo "Looks like you have Berkeley networking support." >&4
7590         d_socket="$define"
7591         if set setsockopt val -f; eval $csym; $val; then
7592                 d_oldsock="$undef"
7593         else
7594                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7595                 d_oldsock="$define"
7596         fi
7597 else
7598         if $contains socklib libc.list >/dev/null 2>&1; then
7599                 echo "Looks like you have Berkeley networking support." >&4
7600                 d_socket="$define"
7601                 : we will have to assume that it supports the 4.2 BSD interface
7602                 d_oldsock="$undef"
7603         else
7604                 echo "You don't have Berkeley networking in libc$_a..." >&4
7605                 if test "X$d_socket" = "X$define"; then
7606                    echo "...but you seem to believe that you have sockets." >&4
7607                 else
7608                         for net in net socket
7609                         do
7610                                 if test -f /usr/lib/lib$net$_a; then
7611                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7612                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7613                                         if $contains socket libc.list >/dev/null 2>&1; then
7614                                                 d_socket="$define"
7615                                                 socketlib="-l$net"
7616                                                 case "$net" in
7617                                                 net)
7618                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7619                                                         sockethdr="-I/usr/netinclude"
7620                                                         ;;
7621                                                 esac
7622                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7623                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7624                                                         d_oldsock="$undef"
7625                                                 else
7626                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7627                                                         d_oldsock="$define"
7628                                                 fi
7629                                                 break
7630                                         fi
7631                                 fi
7632                         done
7633                         if test "X$d_socket" != "X$define"; then
7634                            echo "or anywhere else I see." >&4
7635                            d_socket="$undef"
7636                            d_oldsock="$undef"
7637                         fi
7638                 fi
7639         fi
7640 fi
7641
7642 : see if socketpair exists
7643 set socketpair d_sockpair
7644 eval $inlibc
7645
7646
7647 echo " "
7648 echo "Checking the availability of certain socket constants..." >& 4
7649 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7650         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7651         $cat >try.c <<EOF
7652 #include <sys/types.h>
7653 #include <sys/socket.h>
7654 int main() {
7655     int i = $ENUM;
7656 }
7657 EOF
7658         val="$undef"
7659         set try; if eval $compile; then
7660                 val="$define"
7661         fi
7662         set d_${enum}; eval $setvar
7663         $rm -f try.c try
7664 done
7665
7666 set sendmsg d_sendmsg
7667 eval $inlibc
7668
7669 set recvmsg d_recvmsg
7670 eval $inlibc
7671
7672 echo " "
7673 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7674 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7675 eval $hasfield
7676 case "$d_msghdr_s" in
7677 "$define")      echo "Yup, it does." >&4
7678                 ;;
7679 *)              echo "Nope, it doesn't." >&4
7680                 ;;
7681 esac
7682
7683 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7684 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7685 eval $hasfield
7686 case "$d_cmsghdr_s" in
7687 "$define")      echo "Yup, it does." >&4
7688                 ;;
7689 *)              echo "Nope, it doesn't." >&4
7690                 ;;
7691 esac
7692
7693 : check for const keyword
7694 echo " "
7695 echo 'Checking to see if your C compiler knows about "const"...' >&4
7696 $cat >const.c <<'EOCP'
7697 typedef struct spug { int drokk; } spug;
7698 int main()
7699 {
7700         const char *foo;
7701         const spug y;
7702 }
7703 EOCP
7704 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7705         val="$define"
7706         echo "Yup, it does."
7707 else
7708         val="$undef"
7709         echo "Nope, it doesn't."
7710 fi
7711 set d_const
7712 eval $setvar
7713
7714 : see if crypt exists
7715 echo " "
7716 if set crypt val -f d_crypt; eval $csym; $val; then
7717         echo 'crypt() found.' >&4
7718         val="$define"
7719         cryptlib=''
7720 else
7721         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7722         if $test -z "$cryptlib"; then
7723                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7724         else
7725                 cryptlib=-lcrypt
7726         fi
7727         if $test -z "$cryptlib"; then
7728                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7729         else
7730                 cryptlib=-lcrypt
7731         fi
7732         if $test -z "$cryptlib"; then
7733                 cryptlib=`./loc libcrypt$_a "" $libpth`
7734         else
7735                 cryptlib=-lcrypt
7736         fi
7737         if $test -z "$cryptlib"; then
7738                 echo 'crypt() NOT found.' >&4
7739                 val="$undef"
7740         else
7741                 val="$define"
7742         fi
7743 fi
7744 set d_crypt
7745 eval $setvar
7746
7747 : get csh whereabouts
7748 case "$csh" in
7749 'csh') val="$undef" ;;
7750 *) val="$define" ;;
7751 esac
7752 set d_csh
7753 eval $setvar
7754 : Respect a hint or command line value for full_csh.
7755 case "$full_csh" in
7756 '') full_csh=$csh ;;
7757 esac
7758
7759 : see if cuserid exists
7760 set cuserid d_cuserid
7761 eval $inlibc
7762
7763 : see if this is a limits.h system
7764 set limits.h i_limits
7765 eval $inhdr
7766
7767 : see if this is a float.h system
7768 set float.h i_float
7769 eval $inhdr
7770
7771 : See if number of significant digits in a double precision number is known
7772 echo " "
7773 $cat >dbl_dig.c <<EOM
7774 #$i_limits I_LIMITS
7775 #$i_float I_FLOAT
7776 #ifdef I_LIMITS
7777 #include <limits.h>
7778 #endif
7779 #ifdef I_FLOAT
7780 #include <float.h>
7781 #endif
7782 #ifdef DBL_DIG
7783 printf("Contains DBL_DIG");
7784 #endif
7785 EOM
7786 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7787 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7788         echo "DBL_DIG found." >&4
7789         val="$define"
7790 else
7791         echo "DBL_DIG NOT found." >&4
7792         val="$undef"
7793 fi
7794 $rm -f dbl_dig.?
7795 set d_dbl_dig
7796 eval $setvar
7797
7798 : see if difftime exists
7799 set difftime d_difftime
7800 eval $inlibc
7801
7802 : see if this is a dirent system
7803 echo " "
7804 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7805         val="$define"
7806         echo "<dirent.h> found." >&4
7807 else
7808         val="$undef"
7809         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7810                 echo "<sys/dir.h> found." >&4
7811                 echo " "
7812         else
7813                 xinc=`./findhdr sys/ndir.h`
7814         fi
7815         echo "<dirent.h> NOT found." >&4
7816 fi
7817 set i_dirent
7818 eval $setvar
7819
7820 : Look for type of directory structure.
7821 echo " "
7822 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7823
7824 case "$direntrytype" in
7825 ''|' ')
7826         case "$i_dirent" in
7827         $define) guess1='struct dirent' ;;
7828         *) guess1='struct direct'  ;;
7829         esac
7830         ;;
7831 *)      guess1="$direntrytype"
7832         ;;
7833 esac
7834
7835 case "$guess1" in
7836 'struct dirent') guess2='struct direct' ;;
7837 *) guess2='struct dirent' ;;
7838 esac
7839                 
7840 if $contains "$guess1" try.c >/dev/null 2>&1; then
7841         direntrytype="$guess1"
7842         echo "Your directory entries are $direntrytype." >&4
7843 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7844         direntrytype="$guess2"
7845         echo "Your directory entries seem to be $direntrytype." >&4
7846 else
7847         echo "I don't recognize your system's directory entries." >&4
7848         rp="What type is used for directory entries on this system?"
7849         dflt="$guess1"
7850         . ./myread
7851         direntrytype="$ans"
7852 fi
7853 $rm -f try.c
7854
7855
7856 : see if the directory entry stores field length
7857 echo " "
7858 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7859 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7860         echo "Good, your directory entry keeps length information in d_namlen." >&4
7861         val="$define"
7862 else
7863         echo "Your directory entry does not know about the d_namlen field." >&4
7864         val="$undef"
7865 fi
7866 set d_dirnamlen
7867 eval $setvar
7868 $rm -f try.c
7869
7870 : see if dlerror exists
7871 xxx_runnm="$runnm"
7872 runnm=false
7873 set dlerror d_dlerror
7874 eval $inlibc
7875 runnm="$xxx_runnm"
7876
7877 : see if dlfcn is available
7878 set dlfcn.h i_dlfcn
7879 eval $inhdr
7880
7881 case "$usedl" in
7882 $define|y|true)
7883         $cat << EOM
7884
7885 On a few systems, the dynamically loaded modules that perl generates and uses
7886 will need a different extension than shared libs. The default will probably
7887 be appropriate.
7888
7889 EOM
7890         case "$dlext" in
7891         '')     dflt="$so" ;;
7892         *)      dflt="$dlext" ;;
7893         esac
7894         rp='What is the extension of dynamically loaded modules'
7895         . ./myread
7896         dlext="$ans"
7897         ;;
7898 *)
7899         dlext="none"
7900         ;;
7901 esac
7902
7903 : Check if dlsym need a leading underscore
7904 echo " "
7905 val="$undef"
7906
7907 case "$dlsrc" in
7908 dl_dlopen.xs)
7909         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7910         $cat >dyna.c <<'EOM'
7911 fred () { }
7912 EOM
7913
7914 $cat >fred.c<<EOM
7915
7916 #include <stdio.h>
7917 #$i_dlfcn I_DLFCN
7918 #ifdef I_DLFCN
7919 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7920 #else
7921 #include <sys/types.h>
7922 #include <nlist.h>
7923 #include <link.h>
7924 #endif
7925
7926 extern int fred() ;
7927
7928 int main()
7929 {
7930     void * handle ;
7931     void * symbol ;
7932 #ifndef RTLD_LAZY
7933     int mode = 1 ;
7934 #else
7935     int mode = RTLD_LAZY ;
7936 #endif
7937     handle = dlopen("./dyna.$dlext", mode) ;
7938     if (handle == NULL) {
7939         printf ("1\n") ;
7940         fflush (stdout) ;
7941         exit(0);
7942     }
7943     symbol = dlsym(handle, "fred") ;
7944     if (symbol == NULL) {
7945         /* try putting a leading underscore */
7946         symbol = dlsym(handle, "_fred") ;
7947         if (symbol == NULL) {
7948             printf ("2\n") ;
7949             fflush (stdout) ;
7950             exit(0);
7951         }
7952         printf ("3\n") ;
7953     }
7954     else
7955         printf ("4\n") ;
7956     fflush (stdout) ;
7957     exit(0);
7958 }
7959 EOM
7960         : Call the object file tmp-dyna.o in case dlext=o.
7961         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
7962                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
7963                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
7964                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
7965                 xxx=`./fred`
7966                 case $xxx in
7967                 1)      echo "Test program failed using dlopen." >&4
7968                         echo "Perhaps you should not use dynamic loading." >&4;;
7969                 2)      echo "Test program failed using dlsym." >&4
7970                         echo "Perhaps you should not use dynamic loading." >&4;;
7971                 3)      echo "dlsym needs a leading underscore" >&4
7972                         val="$define" ;;
7973                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
7974                 esac
7975         else
7976                 echo "I can't compile and run the test program." >&4
7977                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
7978         fi
7979         ;;
7980 esac
7981                 
7982 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
7983
7984 set d_dlsymun
7985 eval $setvar
7986
7987 hasproto='varname=$1; func=$2; shift; shift;
7988 while $test $# -ge 2; do
7989         case "$1" in
7990         $define) echo "#include <$2>";;
7991         esac ;
7992     shift 2;
7993 done > try.c;
7994 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
7995 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
7996         echo "$func() prototype found.";
7997         val="$define";
7998 else
7999         echo "$func() prototype NOT found.";
8000         val="$undef";
8001 fi;
8002 set $varname;
8003 eval $setvar;
8004 $rm -f try.c tryout.c'
8005
8006 : see if prototype for drand48 is available
8007 echo " "
8008 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8009 eval $hasproto
8010
8011 : see if dup2 exists
8012 set dup2 d_dup2
8013 eval $inlibc
8014
8015 : see if eaccess exists
8016 set eaccess d_eaccess
8017 eval $inlibc
8018
8019 : see if endgrent exists
8020 set endgrent d_endgrent
8021 eval $inlibc
8022
8023 : see if endhostent exists
8024 set endhostent d_endhent
8025 eval $inlibc
8026
8027 : see if endnetent exists
8028 set endnetent d_endnent
8029 eval $inlibc
8030
8031 : see if endprotoent exists
8032 set endprotoent d_endpent
8033 eval $inlibc
8034
8035 : see if endpwent exists
8036 set endpwent d_endpwent
8037 eval $inlibc
8038
8039 : see if endservent exists
8040 set endservent d_endsent
8041 eval $inlibc
8042
8043 : see if endspent exists
8044 set endspent d_endspent
8045 eval $inlibc
8046
8047 : Locate the flags for 'open()'
8048 echo " "
8049 $cat >open3.c <<'EOCP'
8050 #include <sys/types.h>
8051 #ifdef I_FCNTL
8052 #include <fcntl.h>
8053 #endif
8054 #ifdef I_SYS_FILE
8055 #include <sys/file.h>
8056 #endif
8057 int main() {
8058         if(O_RDONLY);
8059 #ifdef O_TRUNC
8060         exit(0);
8061 #else
8062         exit(1);
8063 #endif
8064 }
8065 EOCP
8066 : check sys/file.h first to get FREAD on Sun
8067 if $test `./findhdr sys/file.h` && \
8068                 set open3 -DI_SYS_FILE && eval $compile; then
8069         h_sysfile=true;
8070         echo "<sys/file.h> defines the O_* constants..." >&4
8071         if ./open3; then
8072                 echo "and you have the 3 argument form of open()." >&4
8073                 val="$define"
8074         else
8075                 echo "but not the 3 argument form of open().  Oh, well." >&4
8076                 val="$undef"
8077         fi
8078 elif $test `./findhdr fcntl.h` && \
8079                 set open3 -DI_FCNTL && eval $compile; then
8080         h_fcntl=true;
8081         echo "<fcntl.h> defines the O_* constants..." >&4
8082         if ./open3; then
8083                 echo "and you have the 3 argument form of open()." >&4
8084                 val="$define"
8085         else
8086                 echo "but not the 3 argument form of open().  Oh, well." >&4
8087                 val="$undef"
8088         fi
8089 else
8090         val="$undef"
8091         echo "I can't find the O_* constant definitions!  You got problems." >&4
8092 fi
8093 set d_open3
8094 eval $setvar
8095 $rm -f open3*
8096
8097 : check for non-blocking I/O stuff
8098 case "$h_sysfile" in
8099 true) echo "#include <sys/file.h>" > head.c;;
8100 *)
8101         case "$h_fcntl" in
8102         true) echo "#include <fcntl.h>" > head.c;;
8103         *) echo "#include <sys/fcntl.h>" > head.c;;
8104         esac
8105         ;;
8106 esac
8107 echo " "
8108 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8109 case "$o_nonblock" in
8110 '')
8111         $cat head.c > try.c
8112         $cat >>try.c <<'EOCP'
8113 int main() {
8114 #ifdef O_NONBLOCK
8115         printf("O_NONBLOCK\n");
8116         exit(0);
8117 #endif
8118 #ifdef O_NDELAY
8119         printf("O_NDELAY\n");
8120         exit(0);
8121 #endif
8122 #ifdef FNDELAY
8123         printf("FNDELAY\n");
8124         exit(0);
8125 #endif
8126         exit(0);
8127 }
8128 EOCP
8129         set try
8130         if eval $compile_ok; then
8131                 o_nonblock=`./try`
8132                 case "$o_nonblock" in
8133                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8134                 *) echo "Seems like we can use $o_nonblock.";;
8135                 esac
8136         else
8137                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8138         fi
8139         ;;
8140 *) echo "Using $hint value $o_nonblock.";;
8141 esac
8142 $rm -f try try.* .out core
8143
8144 echo " "
8145 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8146 case "$eagain" in
8147 '')
8148         $cat head.c > try.c
8149         $cat >>try.c <<EOCP
8150 #include <errno.h>
8151 #include <sys/types.h>
8152 #include <signal.h>
8153 #define MY_O_NONBLOCK $o_nonblock
8154 #ifndef errno  /* XXX need better Configure test */
8155 extern int errno;
8156 #endif
8157 $signal_t blech(x) int x; { exit(3); }
8158 EOCP
8159         $cat >> try.c <<'EOCP'
8160 int main()
8161 {
8162         int pd[2];
8163         int pu[2];
8164         char buf[1];
8165         char string[100];
8166
8167         pipe(pd);       /* Down: child -> parent */
8168         pipe(pu);       /* Up: parent -> child */
8169         if (0 != fork()) {
8170                 int ret;
8171                 close(pd[1]);   /* Parent reads from pd[0] */
8172                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8173                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8174                         exit(1);
8175                 signal(SIGALRM, blech);
8176                 alarm(5);
8177                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8178                         exit(2);
8179                 sprintf(string, "%d\n", ret);
8180                 write(2, string, strlen(string));
8181                 alarm(0);
8182 #ifdef EAGAIN
8183                 if (errno == EAGAIN) {
8184                         printf("EAGAIN\n");
8185                         goto ok;
8186                 }
8187 #endif
8188 #ifdef EWOULDBLOCK
8189                 if (errno == EWOULDBLOCK)
8190                         printf("EWOULDBLOCK\n");
8191 #endif
8192         ok:
8193                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8194                 sleep(2);                               /* Give it time to close our pipe */
8195                 alarm(5);
8196                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8197                 alarm(0);
8198                 sprintf(string, "%d\n", ret);
8199                 write(3, string, strlen(string));
8200                 exit(0);
8201         }
8202
8203         close(pd[0]);                   /* We write to pd[1] */
8204         close(pu[1]);                   /* We read from pu[0] */
8205         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8206         close(pd[1]);                   /* Pipe pd is now fully closed! */
8207         exit(0);                                /* Bye bye, thank you for playing! */
8208 }
8209 EOCP
8210         set try
8211         if eval $compile_ok; then
8212                 echo "$startsh" >mtry
8213                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8214                 chmod +x mtry
8215                 ./mtry >/dev/null 2>&1
8216                 case $? in
8217                 0) eagain=`$cat try.out`;;
8218                 1) echo "Could not perform non-blocking setting!";;
8219                 2) echo "I did a successful read() for something that was not there!";;
8220                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8221                 *) echo "Something terribly wrong happened during testing.";;
8222                 esac
8223                 rd_nodata=`$cat try.ret`
8224                 echo "A read() system call with no data present returns $rd_nodata."
8225                 case "$rd_nodata" in
8226                 0|-1) ;;
8227                 *)
8228                         echo "(That's peculiar, fixing that to be -1.)"
8229                         rd_nodata=-1
8230                         ;;
8231                 esac
8232                 case "$eagain" in
8233                 '')
8234                         echo "Forcing errno EAGAIN on read() with no data available."
8235                         eagain=EAGAIN
8236                         ;;
8237                 *)
8238                         echo "Your read() sets errno to $eagain when no data is available."
8239                         ;;
8240                 esac
8241                 status=`$cat try.err`
8242                 case "$status" in
8243                 0) echo "And it correctly returns 0 to signal EOF.";;
8244                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8245                 *) echo "However, your read() returns '$status' on EOF??";;
8246                 esac
8247                 val="$define"
8248                 if test "$status" = "$rd_nodata"; then
8249                         echo "WARNING: you can't distinguish between EOF and no data!"
8250                         val="$undef"
8251                 fi
8252         else
8253                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8254                 eagain=EAGAIN
8255         fi
8256         set d_eofnblk
8257         eval $setvar
8258         ;;
8259 *)
8260         echo "Using $hint value $eagain."
8261         echo "Your read() returns $rd_nodata when no data is present."
8262         case "$d_eofnblk" in
8263         "$define") echo "And you can see EOF because read() returns 0.";;
8264         "$undef") echo "But you can't see EOF status from read() returned value.";;
8265         *)
8266                 echo "(Assuming you can't see EOF status from read anyway.)"
8267                 d_eofnblk=$undef
8268                 ;;
8269         esac
8270         ;;
8271 esac
8272 $rm -f try try.* .out core head.c mtry
8273
8274 : see if fchmod exists
8275 set fchmod d_fchmod
8276 eval $inlibc
8277
8278 : see if fchown exists
8279 set fchown d_fchown
8280 eval $inlibc
8281
8282 : see if this is an fcntl system
8283 set fcntl d_fcntl
8284 eval $inlibc
8285
8286 : see if sys/select.h has to be included
8287 set sys/select.h i_sysselct
8288 eval $inhdr
8289
8290 : see if we should include time.h, sys/time.h, or both
8291 echo " "
8292 if test "X$timeincl" = X; then
8293         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8294         $echo $n "I'm now running the test program...$c"
8295         $cat >try.c <<'EOCP'
8296 #include <sys/types.h>
8297 #ifdef I_TIME
8298 #include <time.h>
8299 #endif
8300 #ifdef I_SYSTIME
8301 #ifdef SYSTIMEKERNEL
8302 #define KERNEL
8303 #endif
8304 #include <sys/time.h>
8305 #endif
8306 #ifdef I_SYSSELECT
8307 #include <sys/select.h>
8308 #endif
8309 int main()
8310 {
8311         struct tm foo;
8312 #ifdef S_TIMEVAL
8313         struct timeval bar;
8314 #endif
8315 #ifdef S_TIMEZONE
8316         struct timezone tzp;
8317 #endif
8318         if (foo.tm_sec == foo.tm_sec)
8319                 exit(0);
8320 #ifdef S_TIMEVAL
8321         if (bar.tv_sec == bar.tv_sec)
8322                 exit(0);
8323 #endif
8324         exit(1);
8325 }
8326 EOCP
8327         flags=''
8328         for s_timezone in '-DS_TIMEZONE' ''; do
8329         sysselect=''
8330         for s_timeval in '-DS_TIMEVAL' ''; do
8331         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8332         for i_time in '' '-DI_TIME'; do
8333         for i_systime in '-DI_SYSTIME' ''; do
8334                 case "$flags" in
8335                 '') $echo $n ".$c"
8336                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8337                         if eval $compile; then
8338                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8339                                 shift
8340                                 flags="$*"
8341                                 echo " "
8342                                 $echo $n "Succeeded with $flags$c"
8343                         fi
8344                         ;;
8345                 esac
8346         done
8347         done
8348         done
8349         done
8350         done
8351         timeincl=''
8352         echo " "
8353         case "$flags" in
8354         *SYSTIMEKERNEL*) i_systimek="$define"
8355                 timeincl=`./findhdr sys/time.h`
8356                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8357         *) i_systimek="$undef";;
8358         esac
8359         case "$flags" in
8360         *I_TIME*) i_time="$define"
8361                 timeincl=`./findhdr time.h`" $timeincl"
8362                 echo "We'll include <time.h>." >&4;;
8363         *) i_time="$undef";;
8364         esac
8365         case "$flags" in
8366         *I_SYSTIME*) i_systime="$define"
8367                 timeincl=`./findhdr sys/time.h`" $timeincl"
8368                 echo "We'll include <sys/time.h>." >&4;;
8369         *) i_systime="$undef";;
8370         esac
8371         $rm -f try.c try
8372 fi
8373
8374 : check for fd_set items
8375 $cat <<EOM
8376
8377 Checking to see how well your C compiler handles fd_set and friends ...
8378 EOM
8379 $cat >fd_set.c <<EOCP
8380 #$i_systime I_SYS_TIME
8381 #$i_sysselct I_SYS_SELECT
8382 #$d_socket HAS_SOCKET
8383 #include <sys/types.h>
8384 #ifdef HAS_SOCKET
8385 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8386 #endif
8387 #ifdef I_SYS_TIME
8388 #include <sys/time.h>
8389 #endif
8390 #ifdef I_SYS_SELECT
8391 #include <sys/select.h>
8392 #endif
8393 int main() {
8394         fd_set fds;
8395
8396 #ifdef TRYBITS
8397         if(fds.fds_bits);
8398 #endif
8399
8400 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8401         exit(0);
8402 #else
8403         exit(1);
8404 #endif
8405 }
8406 EOCP
8407 set fd_set -DTRYBITS
8408 if eval $compile; then
8409         d_fds_bits="$define"
8410         d_fd_set="$define"
8411         echo "Well, your system knows about the normal fd_set typedef..." >&4
8412         if ./fd_set; then
8413                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8414                 d_fd_macros="$define"
8415         else
8416                 $cat >&4 <<'EOM'
8417 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8418 EOM
8419                 d_fd_macros="$undef"
8420         fi
8421 else
8422         $cat <<'EOM'
8423 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8424 EOM
8425         set fd_set
8426         if eval $compile; then
8427                 d_fds_bits="$undef"
8428                 d_fd_set="$define"
8429                 echo "Well, your system has some sort of fd_set available..." >&4
8430                 if ./fd_set; then
8431                         echo "and you have the normal fd_set macros." >&4
8432                         d_fd_macros="$define"
8433                 else
8434                         $cat <<'EOM'
8435 but not the normal fd_set macros!  Gross!  More work for me...
8436 EOM
8437                         d_fd_macros="$undef"
8438                 fi
8439         else
8440         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8441                 d_fd_set="$undef"
8442                 d_fds_bits="$undef"
8443                 d_fd_macros="$undef"
8444         fi
8445 fi
8446 $rm -f fd_set*
8447
8448 : see if fgetpos exists
8449 set fgetpos d_fgetpos
8450 eval $inlibc
8451
8452 : see if flock exists
8453 set flock d_flock
8454 eval $inlibc
8455
8456 : see if fork exists
8457 set fork d_fork
8458 eval $inlibc
8459
8460 : see if pathconf exists
8461 set pathconf d_pathconf
8462 eval $inlibc
8463
8464 : see if fpathconf exists
8465 set fpathconf d_fpathconf
8466 eval $inlibc
8467
8468
8469 : see if llseek exists
8470 set llseek d_llseek
8471 eval $inlibc
8472
8473 : check for off64_t
8474 echo " "
8475 echo $n "Checking to see if your system supports off64_t...$c" >&4
8476 $cat >try.c <<EOCP
8477 #include <sys/types.h>
8478 #include <unistd.h>
8479 off64_t foo() { off64_t x; x = 7; return x; }'
8480 EOCP
8481 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8482         val="$define"
8483         echo " Yup, it does." >&4
8484 else
8485         val="$undef"
8486         echo " Nope, it doesn't." >&4
8487 fi
8488 $rm -f try.*
8489 set d_off64_t
8490 eval $setvar
8491
8492 : check for fpos64_t
8493 echo " "
8494 echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8495 $cat >try.c <<EOCP
8496 #include <sys/stdio.h>
8497 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8498 EOCP
8499 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8500         val="$define"
8501         echo " Yup, it does." >&4
8502 else
8503         val="$undef"
8504         echo " Nope, it doesn't." >&4
8505 fi
8506 $rm -f try.*
8507 set d_fpos64_t
8508 eval $setvar
8509
8510 : see if fseeko exists
8511 set fseeko d_fseeko
8512 eval $inlibc
8513
8514 : see if fsetpos exists
8515 set fsetpos d_fsetpos
8516 eval $inlibc
8517
8518
8519 if $test X"$use64bits" = X"$define"; then
8520         : see if fgetpos64 exists
8521         set fgetpos64 d_fgetpos64
8522         eval $inlibc
8523
8524         : see if fopen64 exists
8525         set freopen64 d_fopen64
8526         eval $inlibc
8527
8528         : see if freopen64 exists
8529         set freopen64 d_freopen64
8530         eval $inlibc
8531
8532         : see if fseek64 exists
8533         set fseek64 d_fseek64
8534         eval $inlibc
8535
8536         : see if fseeko64 exists
8537         set fseeko64 d_fseeko64
8538         eval $inlibc
8539
8540         : see if fsetpos64 exists
8541         set fsetpos64 d_fsetpos64
8542         eval $inlibc
8543
8544         : see if ftell64 exists
8545         set ftell64 d_ftell64
8546         eval $inlibc
8547
8548         : see if ftello64 exists
8549         set ftello64 d_ftello64
8550         eval $inlibc
8551
8552         : see if tmpfile64 exists
8553         set tmpfile64 d_tmpfile64
8554         eval $inlibc
8555 else
8556         val="$undef"
8557         for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
8558         do
8559                 set $xxx
8560                 eval $setvar
8561         done
8562 fi
8563
8564 : see if this is a sys/param system
8565 set sys/param.h i_sysparam
8566 eval $inhdr
8567
8568 : see if this is a sys/mount.h system
8569 set sys/mount.h i_sysmount
8570 eval $inhdr
8571
8572
8573 : see if statfs exists
8574 set statfs d_statfs
8575 eval $inlibc
8576
8577 : see if fstatfs exists
8578 set fstatfs d_fstatfs
8579 eval $inlibc
8580
8581 : see if statfs knows about mount flags
8582 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8583 eval $hasfield
8584
8585
8586 : see if statvfs exists
8587 set statvfs d_statvfs
8588 eval $inlibc
8589
8590 : see if fstatvfs exists
8591 set fstatvfs d_fstatvfs
8592 eval $inlibc
8593
8594
8595 : see if ftello exists
8596 set ftello d_ftello
8597 eval $inlibc
8598
8599 : see if getgrent exists
8600 set getgrent d_getgrent
8601 eval $inlibc
8602
8603 : see if gethostbyaddr exists
8604 set gethostbyaddr d_gethbyaddr
8605 eval $inlibc
8606
8607 : see if gethostbyname exists
8608 set gethostbyname d_gethbyname
8609 eval $inlibc
8610
8611 : see if gethostent exists
8612 set gethostent d_gethent
8613 eval $inlibc
8614
8615 : see how we will look up host name
8616 echo " "
8617 call=''
8618 if set gethostname val -f d_gethname; eval $csym; $val; then
8619         echo 'gethostname() found.' >&4
8620         d_gethname="$define"
8621         call=gethostname
8622 fi
8623 if set uname val -f d_uname; eval $csym; $val; then
8624         if ./xenix; then
8625                 $cat <<'EOM'
8626 uname() was found, but you're running xenix, and older versions of xenix
8627 have a broken uname(). If you don't really know whether your xenix is old
8628 enough to have a broken system call, use the default answer.
8629
8630 EOM
8631                 dflt=y
8632                 case "$d_uname" in
8633                 "$define") dflt=n;;
8634                 esac
8635                 rp='Is your uname() broken?'
8636                 . ./myread
8637                 case "$ans" in
8638                 n*) d_uname="$define"; call=uname;;
8639                 esac
8640         else
8641                 echo 'uname() found.' >&4
8642                 d_uname="$define"
8643                 case "$call" in
8644                 '') call=uname ;;
8645                 esac
8646         fi
8647 fi
8648 case "$d_gethname" in
8649 '') d_gethname="$undef";;
8650 esac
8651 case "$d_uname" in
8652 '') d_uname="$undef";;
8653 esac
8654 case "$d_uname$d_gethname" in
8655 *define*)
8656         dflt=n
8657         cat <<EOM
8658  
8659 Every now and then someone has a $call() that lies about the hostname
8660 but can't be fixed for political or economic reasons.  If you wish, I can
8661 pretend $call() isn't there and maybe compute hostname at run-time
8662 thanks to the '$phostname' command.
8663
8664 EOM
8665         rp="Shall I ignore $call() from now on?"
8666         . ./myread
8667         case "$ans" in
8668         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8669         esac;;
8670 esac
8671 case "$phostname" in
8672 '') aphostname='';;
8673 *) case "$aphostname" in
8674         /*) ;;
8675         *) set X $phostname
8676                 shift
8677                 file=$1
8678                 shift
8679                 file=`./loc $file $file $pth`
8680                 aphostname=`echo $file $*`
8681                 ;;
8682         esac
8683         ;;
8684 esac
8685 case "$d_uname$d_gethname" in
8686 *define*) ;;
8687 *)
8688         case "$phostname" in
8689         '')
8690                 echo "There will be no way for $package to get your hostname." >&4;;
8691         *)
8692         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8693                 ;;
8694         esac;;
8695 esac
8696 case "$d_phostname" in
8697 '') d_phostname="$undef";;
8698 esac
8699
8700 : see if this is a netdb.h system
8701 set netdb.h i_netdb
8702 eval $inhdr
8703
8704 : see if prototypes for various gethostxxx netdb.h functions are available
8705 echo " "
8706 set d_gethostprotos gethostent $i_netdb netdb.h
8707 eval $hasproto
8708
8709 : see if getlogin exists
8710 set getlogin d_getlogin
8711 eval $inlibc
8712
8713 : see if getmntent exists
8714 set getmntent d_getmntent
8715 eval $inlibc
8716
8717 : see if getnetbyaddr exists
8718 set getnetbyaddr d_getnbyaddr
8719 eval $inlibc
8720
8721 : see if getnetbyname exists
8722 set getnetbyname d_getnbyname
8723 eval $inlibc
8724
8725 : see if getnetent exists
8726 set getnetent d_getnent
8727 eval $inlibc
8728
8729 : see if prototypes for various getnetxxx netdb.h functions are available
8730 echo " "
8731 set d_getnetprotos getnetent $i_netdb netdb.h
8732 eval $hasproto
8733
8734
8735 : see if getprotobyname exists
8736 set getprotobyname d_getpbyname
8737 eval $inlibc
8738
8739 : see if getprotobynumber exists
8740 set getprotobynumber d_getpbynumber
8741 eval $inlibc
8742
8743 : see if getprotoent exists
8744 set getprotoent d_getpent
8745 eval $inlibc
8746
8747 : see if getpgid exists
8748 set getpgid d_getpgid
8749 eval $inlibc
8750
8751 : see if getpgrp2 exists
8752 set getpgrp2 d_getpgrp2
8753 eval $inlibc
8754
8755 : see if getppid exists
8756 set getppid d_getppid
8757 eval $inlibc
8758
8759 : see if getpriority exists
8760 set getpriority d_getprior
8761 eval $inlibc
8762
8763 : see if prototypes for various getprotoxxx netdb.h functions are available
8764 echo " "
8765 set d_getprotoprotos getprotoent $i_netdb netdb.h
8766 eval $hasproto
8767
8768 : see if getpwent exists
8769 set getpwent d_getpwent
8770 eval $inlibc
8771
8772
8773 : see if getservbyname exists
8774 set getservbyname d_getsbyname
8775 eval $inlibc
8776
8777 : see if getservbyport exists
8778 set getservbyport d_getsbyport
8779 eval $inlibc
8780
8781 : see if getservent exists
8782 set getservent d_getsent
8783 eval $inlibc
8784
8785 : see if prototypes for various getservxxx netdb.h functions are available
8786 echo " "
8787 set d_getservprotos getservent $i_netdb netdb.h
8788 eval $hasproto
8789
8790 : see if getspent exists
8791 set getspent d_getspent
8792 eval $inlibc
8793
8794 : see if getspnam exists
8795 set getspnam d_getspnam
8796 eval $inlibc
8797
8798 : see if gettimeofday or ftime exists
8799 set gettimeofday d_gettimeod
8800 eval $inlibc
8801 case "$d_gettimeod" in
8802 "$undef")
8803         set ftime d_ftime 
8804         eval $inlibc
8805         ;;
8806 *)
8807         val="$undef"; set d_ftime; eval $setvar
8808         ;;
8809 esac
8810 case "$d_gettimeod$d_ftime" in
8811 "$undef$undef")
8812         echo " "
8813         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8814         ;;
8815 esac
8816
8817 : see if this is an grp system
8818 set grp.h i_grp
8819 eval $inhdr
8820
8821 case "$i_grp" in
8822 $define)
8823         xxx=`./findhdr grp.h`
8824         $cppstdin $cppflags $cppminus < $xxx >$$.h
8825
8826         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8827                 val="$define"
8828         else
8829                 val="$undef"
8830         fi
8831         set d_grpasswd
8832         eval $setvar
8833
8834         $rm -f $$.h
8835         ;;
8836 *)
8837         val="$undef";
8838         set d_grpasswd; eval $setvar
8839         ;;
8840 esac
8841
8842 : see if hasmntopt exists
8843 set hasmntopt d_hasmntopt
8844 eval $inlibc
8845
8846 : see if this is a netinet/in.h or sys/in.h system
8847 set netinet/in.h i_niin sys/in.h i_sysin
8848 eval $inhdr
8849
8850 : see if arpa/inet.h has to be included
8851 set arpa/inet.h i_arpainet
8852 eval $inhdr
8853
8854 : see if htonl --and friends-- exists
8855 val=''
8856 set htonl val
8857 eval $inlibc
8858
8859 : Maybe they are macros.
8860 case "$val" in
8861 $undef)
8862         $cat >htonl.c <<EOM
8863 #include <stdio.h>
8864 #include <sys/types.h>
8865 #$i_niin I_NETINET_IN
8866 #$i_sysin I_SYS_IN
8867 #$i_arpainet I_ARPA_INET
8868 #ifdef I_NETINET_IN
8869 #include <netinet/in.h>
8870 #endif
8871 #ifdef I_SYS_IN
8872 #include <sys/in.h>
8873 #endif
8874 #ifdef I_ARPA_INET
8875 #include <arpa/inet.h>
8876 #endif
8877 #ifdef htonl
8878 printf("Defined as a macro.");
8879 #endif
8880 EOM
8881         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8882         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8883                 val="$define"
8884                 echo "But it seems to be defined as a macro." >&4
8885         fi
8886         $rm -f htonl.?
8887         ;;
8888 esac
8889 set d_htonl
8890 eval $setvar
8891
8892 : see which of string.h or strings.h is needed
8893 echo " "
8894 strings=`./findhdr string.h`
8895 if $test "$strings" && $test -r "$strings"; then
8896         echo "Using <string.h> instead of <strings.h>." >&4
8897         val="$define"
8898 else
8899         val="$undef"
8900         strings=`./findhdr strings.h`
8901         if $test "$strings" && $test -r "$strings"; then
8902                 echo "Using <strings.h> instead of <string.h>." >&4
8903         else
8904                 echo "No string header found -- You'll surely have problems." >&4
8905         fi
8906 fi
8907 set i_string
8908 eval $setvar
8909 case "$i_string" in
8910 "$undef") strings=`./findhdr strings.h`;;
8911 *)        strings=`./findhdr string.h`;;
8912 esac
8913
8914 : index or strchr
8915 echo " "
8916 if set index val -f; eval $csym; $val; then
8917         if set strchr val -f d_strchr; eval $csym; $val; then
8918                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8919                         val="$define"
8920                         vali="$undef"
8921                         echo "strchr() found." >&4
8922                 else
8923                         val="$undef"
8924                         vali="$define"
8925                         echo "index() found." >&4
8926                 fi
8927         else
8928                 val="$undef"
8929                 vali="$define"
8930                 echo "index() found." >&4
8931         fi
8932 else
8933         if set strchr val -f d_strchr; eval $csym; $val; then
8934                 val="$define"
8935                 vali="$undef"
8936                 echo "strchr() found." >&4
8937         else
8938                 echo "No index() or strchr() found!" >&4
8939                 val="$undef"
8940                 vali="$undef"
8941         fi
8942 fi
8943 set d_strchr; eval $setvar
8944 val="$vali"
8945 set d_index; eval $setvar
8946
8947 : check whether inet_aton exists
8948 set inet_aton d_inetaton
8949 eval $inlibc
8950
8951 : Look for isascii
8952 echo " "
8953 $cat >isascii.c <<'EOCP'
8954 #include <stdio.h>
8955 #include <ctype.h>
8956 int main() {
8957         int c = 'A';
8958         if (isascii(c))
8959                 exit(0);
8960         else
8961                 exit(1);
8962 }
8963 EOCP
8964 set isascii
8965 if eval $compile; then
8966         echo "isascii() found." >&4
8967         val="$define"
8968 else
8969         echo "isascii() NOT found." >&4
8970         val="$undef"
8971 fi
8972 set d_isascii
8973 eval $setvar
8974 $rm -f isascii*
8975
8976 : see if killpg exists
8977 set killpg d_killpg
8978 eval $inlibc
8979
8980 : see if lchown exists
8981 echo " "
8982 $cat > try.c <<'EOCP'
8983 /* System header to define __stub macros and hopefully few prototypes,
8984     which can conflict with char lchown(); below.  */
8985 #include <assert.h>
8986 /* Override any gcc2 internal prototype to avoid an error.  */
8987 /* We use char because int might match the return type of a gcc2
8988    builtin and then its argument prototype would still apply.  */
8989 char lchown();
8990 int main() {
8991     /*  The GNU C library defines this for functions which it implements
8992         to always fail with ENOSYS.  Some functions are actually named
8993         something starting with __ and the normal name is an alias.  */
8994 #if defined (__stub_lchown) || defined (__stub___lchown)
8995 choke me
8996 #else
8997 lchown();
8998 #endif
8999 ; return 0; }
9000 EOCP
9001 set try
9002 if eval $compile; then
9003     $echo "lchown() found." >&4
9004     val="$define"
9005 else
9006     $echo "lchown() NOT found." >&4
9007     val="$undef"
9008 fi
9009 set d_lchown
9010 eval $setvar
9011
9012 : see if link exists
9013 set link d_link
9014 eval $inlibc
9015
9016 : see if localeconv exists
9017 set localeconv d_locconv
9018 eval $inlibc
9019
9020 : see if lockf exists
9021 set lockf d_lockf
9022 eval $inlibc
9023
9024 : see if lstat exists
9025 set lstat d_lstat
9026 eval $inlibc
9027
9028 : see if madvise exists
9029 set madvise d_madvise
9030 eval $inlibc
9031
9032 : see if mblen exists
9033 set mblen d_mblen
9034 eval $inlibc
9035
9036 : see if mbstowcs exists
9037 set mbstowcs d_mbstowcs
9038 eval $inlibc
9039
9040 : see if mbtowc exists
9041 set mbtowc d_mbtowc
9042 eval $inlibc
9043
9044 : see if memchr exists
9045 set memchr d_memchr
9046 eval $inlibc
9047
9048 : see if memcmp exists
9049 set memcmp d_memcmp
9050 eval $inlibc
9051
9052 : see if memcpy exists
9053 set memcpy d_memcpy
9054 eval $inlibc
9055
9056 : see if memmove exists
9057 set memmove d_memmove
9058 eval $inlibc
9059
9060 : see if memset exists
9061 set memset d_memset
9062 eval $inlibc
9063
9064 : see if mkdir exists
9065 set mkdir d_mkdir
9066 eval $inlibc
9067
9068 : see if mkfifo exists
9069 set mkfifo d_mkfifo
9070 eval $inlibc
9071
9072 : see if mktime exists
9073 set mktime d_mktime
9074 eval $inlibc
9075
9076 : see if this is a sys/mman.h system
9077 set sys/mman.h i_sysmman
9078 eval $inhdr
9079
9080 : see if mmap exists
9081 set mmap d_mmap
9082 eval $inlibc
9083 : see what shmat returns
9084 : default to something harmless
9085 mmaptype='void *'
9086 case "$i_sysmman$d_mmap" in
9087 "$define$define")
9088         $cat >mmap.c <<'END'
9089 #include <sys/mman.h>
9090 void *mmap();
9091 END
9092         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9093                 mmaptype='void *'
9094         else
9095                 mmaptype='caddr_t'
9096         fi
9097         echo "and it returns ($mmaptype)." >&4
9098         ;;
9099 esac
9100
9101
9102
9103 : see if mprotect exists
9104 set mprotect d_mprotect
9105 eval $inlibc
9106
9107 : see if msgctl exists
9108 set msgctl d_msgctl
9109 eval $inlibc
9110
9111 : see if msgget exists
9112 set msgget d_msgget
9113 eval $inlibc
9114
9115 : see if msgsnd exists
9116 set msgsnd d_msgsnd
9117 eval $inlibc
9118
9119 : see if msgrcv exists
9120 set msgrcv d_msgrcv
9121 eval $inlibc
9122
9123 : see how much of the 'msg*(2)' library is present.
9124 h_msg=true
9125 echo " "
9126 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9127 *"$undef"*) h_msg=false;;
9128 esac
9129 case "$osname" in
9130 freebsd)
9131     case "`ipcs 2>&1`" in
9132     "SVID messages"*"not configured"*)
9133         echo "Your $osname does not have the msg*(2) configured." >&4
9134         h_msg=false
9135         val="$undef"
9136         set msgctl d_msgctl
9137         eval $setvar
9138         set msgget d_msgget
9139         eval $setvar
9140         set msgsnd d_msgsnd
9141         eval $setvar
9142         set msgrcv d_msgrcv
9143         eval $setvar
9144         ;;
9145     esac
9146     ;;
9147 esac
9148 : we could also check for sys/ipc.h ...
9149 if $h_msg && $test `./findhdr sys/msg.h`; then
9150         echo "You have the full msg*(2) library." >&4
9151         val="$define"
9152 else
9153         echo "You don't have the full msg*(2) library." >&4
9154         val="$undef"
9155 fi
9156 set d_msg
9157 eval $setvar
9158
9159 : see if msync exists
9160 set msync d_msync
9161 eval $inlibc
9162
9163 : see if munmap exists
9164 set munmap d_munmap
9165 eval $inlibc
9166
9167 : see if nice exists
9168 set nice d_nice
9169 eval $inlibc
9170
9171 : see if POSIX threads are available
9172 if test "X$usethreads" = "X$define"; then
9173         set pthread.h i_pthread
9174         eval $inhdr
9175 else
9176         i_pthread="$undef"
9177 fi
9178
9179
9180
9181 : how to create joinable pthreads
9182 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9183         echo " "
9184         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9185         $cat >try.c <<'EOCP'
9186 #include <pthread.h>
9187 int main() {
9188     int detachstate = JOINABLE;
9189 }
9190 EOCP
9191         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9192         if eval $compile; then
9193                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9194                 val="$undef" # Yes, undef.
9195                 set d_old_pthread_create_joinable
9196                 eval $setvar
9197                 val=""
9198                 set old_pthread_create_joinable
9199                 eval $setvar
9200         else
9201                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9202                 if eval $compile; then
9203                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9204                         val="$define"
9205                         set d_old_pthread_create_joinable
9206                         eval $setvar
9207                         val=PTHREAD_CREATE_UNDETACHED
9208                         set old_pthread_create_joinable
9209                         eval $setvar
9210                 else            
9211                         set try -DJOINABLE=__UNDETACHED
9212                         if eval $compile; then
9213                                 echo "You seem to use __UNDETACHED." >&4
9214                                 val="$define"
9215                                 set d_old_pthread_create_joinable
9216                                 eval $setvar
9217                                 val=__UNDETACHED
9218                                 set old_pthread_create_joinable
9219                                 eval $setvar
9220                         else
9221                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9222                                 val="$define"
9223                                 set d_old_pthread_create_joinable
9224                                 eval $setvar
9225                                 val=0
9226                                 set old_pthread_create_joinable
9227                                 eval $setvar
9228                         fi
9229                 fi
9230         fi
9231         $rm -f try try.*
9232 else
9233     d_old_pthread_create_joinable="$undef"
9234     old_pthread_create_joinable=""
9235 fi
9236
9237 : see if pause exists
9238 set pause d_pause
9239 eval $inlibc
9240
9241 : see if pipe exists
9242 set pipe d_pipe
9243 eval $inlibc
9244
9245 : see if poll exists
9246 set poll d_poll
9247 eval $inlibc
9248
9249
9250 : see whether the various POSIXish _yields exist
9251 $cat >try.c <<EOP
9252 #include <pthread.h>
9253 #include <stdio.h>
9254 int main() {
9255 #ifdef SCHED_YIELD
9256         sched_yield();
9257 #else
9258 #ifdef PTHREAD_YIELD
9259         pthread_yield();
9260 #else
9261 #ifdef PTHREAD_YIELD_NULL
9262         pthread_yield(NULL);
9263 #endif
9264 #endif
9265 #endif
9266 }
9267 EOP
9268 : see if sched_yield exists
9269 set try -DSCHED_YIELD
9270 if eval $compile; then
9271     val="$define"
9272     sched_yield='sched_yield()'
9273 else
9274     val="$undef"
9275 fi
9276 case "$usethreads" in
9277 $define)
9278         case "$val" in
9279         $define) echo 'sched_yield() found.' >&4        ;;
9280         *)       echo 'sched_yield() NOT found.' >&4    ;;
9281         esac
9282 esac
9283 set d_sched_yield
9284 eval $setvar
9285
9286 : see if pthread_yield exists
9287 set try -DPTHREAD_YIELD
9288 if eval $compile; then
9289     val="$define"
9290     case "$sched_yield" in
9291     '') sched_yield='pthread_yield()' ;;
9292     esac
9293 else
9294     set try -DPTHREAD_YIELD_NULL
9295     if eval $compile; then
9296         val="$define"
9297         case "$sched_yield" in
9298         '') sched_yield='pthread_yield(NULL)' ;;
9299         esac
9300     else
9301         val="$undef"
9302     fi
9303 fi
9304 case "$usethreads" in
9305 $define)
9306         case "$val" in
9307         $define) echo 'pthread_yield() found.' >&4      ;;
9308         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9309         esac
9310         ;;
9311 esac
9312 set d_pthread_yield
9313 eval $setvar
9314
9315 case "$sched_yield" in
9316 '') sched_yield=undef ;;
9317 esac
9318
9319 $rm -f try try.*
9320
9321 : see if this is a pwd.h system
9322 set pwd.h i_pwd
9323 eval $inhdr
9324
9325 case "$i_pwd" in
9326 $define)
9327         xxx=`./findhdr pwd.h`
9328         $cppstdin $cppflags $cppminus < $xxx >$$.h
9329
9330         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9331                 val="$define"
9332         else
9333                 val="$undef"
9334         fi
9335         set d_pwquota
9336         eval $setvar
9337
9338         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9339                 val="$define"
9340         else
9341                 val="$undef"
9342         fi
9343         set d_pwage
9344         eval $setvar
9345
9346         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9347                 val="$define"
9348         else
9349                 val="$undef"
9350         fi
9351         set d_pwchange
9352         eval $setvar
9353
9354         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9355                 val="$define"
9356         else
9357                 val="$undef"
9358         fi
9359         set d_pwclass
9360         eval $setvar
9361
9362         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9363                 val="$define"
9364         else
9365                 val="$undef"
9366         fi
9367         set d_pwexpire
9368         eval $setvar
9369
9370         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9371                 val="$define"
9372         else
9373                 val="$undef"
9374         fi
9375         set d_pwcomment
9376         eval $setvar
9377
9378         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9379                 val="$define"
9380         else
9381                 val="$undef"
9382         fi
9383         set d_pwgecos
9384         eval $setvar
9385
9386         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9387                 val="$define"
9388         else
9389                 val="$undef"
9390         fi
9391         set d_pwpasswd
9392         eval $setvar
9393
9394         $rm -f $$.h
9395         ;;
9396 *)
9397         val="$undef"; 
9398         set d_pwquota; eval $setvar
9399         set d_pwage; eval $setvar
9400         set d_pwchange; eval $setvar
9401         set d_pwclass; eval $setvar
9402         set d_pwexpire; eval $setvar
9403         set d_pwcomment; eval $setvar
9404         set d_pwgecos; eval $setvar
9405         set d_pwpasswd; eval $setvar
9406         ;;
9407 esac
9408
9409 : see if readdir and friends exist
9410 set readdir d_readdir
9411 eval $inlibc
9412 set seekdir d_seekdir
9413 eval $inlibc
9414 set telldir d_telldir
9415 eval $inlibc
9416 set rewinddir d_rewinddir
9417 eval $inlibc
9418
9419 : see if readlink exists
9420 set readlink d_readlink
9421 eval $inlibc
9422
9423 : see if readv exists
9424 set readv d_readv
9425 eval $inlibc
9426
9427 : see if rename exists
9428 set rename d_rename
9429 eval $inlibc
9430
9431 : see if rmdir exists
9432 set rmdir d_rmdir
9433 eval $inlibc
9434
9435 : see if memory.h is available.
9436 val=''
9437 set memory.h val
9438 eval $inhdr
9439
9440 : See if it conflicts with string.h
9441 case "$val" in
9442 $define)
9443         case "$strings" in
9444         '') ;;
9445         *)
9446                 $cppstdin $cppflags $cppminus < $strings > mem.h
9447                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9448                         echo " "
9449                         echo "We won't be including <memory.h>."
9450                         val="$undef"
9451                 fi
9452                 $rm -f mem.h
9453                 ;;
9454         esac
9455 esac
9456 set i_memory
9457 eval $setvar
9458
9459 : can bcopy handle overlapping blocks?
9460 val="$undef"
9461 case "$d_bcopy" in
9462 "$define")
9463         echo " "
9464         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9465         $cat >try.c <<EOCP
9466 #$i_memory I_MEMORY
9467 #$i_stdlib I_STDLIB
9468 #$i_string I_STRING
9469 #$i_unistd I_UNISTD
9470 EOCP
9471         $cat >>try.c <<'EOCP'
9472 #include <stdio.h>
9473 #ifdef I_MEMORY
9474 #  include <memory.h>
9475 #endif
9476 #ifdef I_STDLIB
9477 #  include <stdlib.h>
9478 #endif
9479 #ifdef I_STRING
9480 #  include <string.h>
9481 #else
9482 #  include <strings.h>
9483 #endif
9484 #ifdef I_UNISTD
9485 #  include <unistd.h>  /* Needed for NetBSD */
9486 #endif
9487 int main()
9488 {
9489 char buf[128], abc[128];
9490 char *b;
9491 int len;
9492 int off;
9493 int align;
9494
9495 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9496
9497 for (align = 7; align >= 0; align--) {
9498         for (len = 36; len; len--) {
9499                 b = buf+align;
9500                 bcopy(abc, b, len);
9501                 for (off = 1; off <= len; off++) {
9502                         bcopy(b, b+off, len);
9503                         bcopy(b+off, b, len);
9504                         if (bcmp(b, abc, len))
9505                                 exit(1);
9506                 }
9507         }
9508 }
9509 exit(0);
9510 }
9511 EOCP
9512         set try
9513         if eval $compile_ok; then
9514                 if ./try 2>/dev/null; then
9515                         echo "Yes, it can."
9516                         val="$define"
9517                 else
9518                         echo "It can't, sorry."
9519                         case "$d_memmove" in
9520                         "$define") echo "But that's Ok since you have memmove()." ;;
9521                         esac
9522                 fi
9523         else
9524                 echo "(I can't compile the test program, so we'll assume not...)"
9525                 case "$d_memmove" in
9526                 "$define") echo "But that's Ok since you have memmove()." ;;
9527                 esac
9528         fi
9529         ;;
9530 esac
9531 $rm -f try.* try core
9532 set d_safebcpy
9533 eval $setvar
9534
9535 : can memcpy handle overlapping blocks?
9536 val="$undef"
9537 case "$d_memcpy" in
9538 "$define")
9539         echo " "
9540         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9541         $cat >try.c <<EOCP
9542 #$i_memory I_MEMORY
9543 #$i_stdlib I_STDLIB
9544 #$i_string I_STRING
9545 #$i_unistd I_UNISTD
9546 EOCP
9547         $cat >>try.c <<'EOCP'
9548 #include <stdio.h>
9549 #ifdef I_MEMORY
9550 #  include <memory.h>
9551 #endif
9552 #ifdef I_STDLIB
9553 #  include <stdlib.h>
9554 #endif
9555 #ifdef I_STRING
9556 #  include <string.h>
9557 #else
9558 #  include <strings.h>
9559 #endif
9560 #ifdef I_UNISTD
9561 #  include <unistd.h>  /* Needed for NetBSD */
9562 #endif
9563 int main()
9564 {
9565 char buf[128], abc[128];
9566 char *b;
9567 int len;
9568 int off;
9569 int align;
9570
9571 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9572    try to store the string in read-only memory. */
9573 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9574
9575 for (align = 7; align >= 0; align--) {
9576         for (len = 36; len; len--) {
9577                 b = buf+align;
9578                 memcpy(b, abc, len);
9579                 for (off = 1; off <= len; off++) {
9580                         memcpy(b+off, b, len);
9581                         memcpy(b, b+off, len);
9582                         if (memcmp(b, abc, len))
9583                                 exit(1);
9584                 }
9585         }
9586 }
9587 exit(0);
9588 }
9589 EOCP
9590         set try
9591         if eval $compile_ok; then
9592                 if ./try 2>/dev/null; then
9593                         echo "Yes, it can."
9594                         val="$define"
9595                 else
9596                         echo "It can't, sorry."
9597                         case "$d_memmove" in
9598                         "$define") echo "But that's Ok since you have memmove()." ;;
9599                         esac
9600                 fi
9601         else
9602                 echo "(I can't compile the test program, so we'll assume not...)"
9603                 case "$d_memmove" in
9604                 "$define") echo "But that's Ok since you have memmove()." ;;
9605                 esac
9606         fi
9607         ;;
9608 esac
9609 $rm -f try.* try core
9610 set d_safemcpy
9611 eval $setvar
9612
9613 : can memcmp be trusted to compare relative magnitude?
9614 val="$undef"
9615 case "$d_memcmp" in
9616 "$define")
9617         echo " "
9618         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9619         $cat >try.c <<EOCP
9620 #$i_memory I_MEMORY
9621 #$i_stdlib I_STDLIB
9622 #$i_string I_STRING
9623 #$i_unistd I_UNISTD
9624 EOCP
9625         $cat >>try.c <<'EOCP'
9626 #include <stdio.h>
9627 #ifdef I_MEMORY
9628 #  include <memory.h>
9629 #endif
9630 #ifdef I_STDLIB
9631 #  include <stdlib.h>
9632 #endif
9633 #ifdef I_STRING
9634 #  include <string.h>
9635 #else
9636 #  include <strings.h>
9637 #endif
9638 #ifdef I_UNISTD
9639 #  include <unistd.h>  /* Needed for NetBSD */
9640 #endif
9641 int main()
9642 {
9643 char a = -1;
9644 char b = 0;
9645 if ((a < b) && memcmp(&a, &b, 1) < 0)
9646         exit(1);
9647 exit(0);
9648 }
9649 EOCP
9650         set try
9651         if eval $compile_ok; then
9652                 if ./try 2>/dev/null; then
9653                         echo "Yes, it can."
9654                         val="$define"
9655                 else
9656                         echo "No, it can't (it uses signed chars)."
9657                 fi
9658         else
9659                 echo "(I can't compile the test program, so we'll assume not...)"
9660         fi
9661         ;;
9662 esac
9663 $rm -f try.* try core
9664 set d_sanemcmp
9665 eval $setvar
9666
9667 : see if select exists
9668 set select d_select
9669 eval $inlibc
9670
9671 : see if semctl exists
9672 set semctl d_semctl
9673 eval $inlibc
9674
9675 : see if semget exists
9676 set semget d_semget
9677 eval $inlibc
9678
9679 : see if semop exists
9680 set semop d_semop
9681 eval $inlibc
9682
9683 : see how much of the 'sem*(2)' library is present.
9684 h_sem=true
9685 echo " "
9686 case "$d_semctl$d_semget$d_semop" in
9687 *"$undef"*) h_sem=false;;
9688 esac
9689 case "$osname" in
9690 freebsd)
9691     case "`ipcs 2>&1`" in
9692     "SVID messages"*"not configured"*)
9693         echo "Your $osname does not have the sem*(2) configured." >&4
9694         h_sem=false
9695         val="$undef"
9696         set semctl d_semctl
9697         eval $setvar
9698         set semget d_semget
9699         eval $setvar
9700         set semop d_semop
9701         eval $setvar
9702         ;;
9703     esac
9704     ;;
9705 esac
9706 : we could also check for sys/ipc.h ...
9707 if $h_sem && $test `./findhdr sys/sem.h`; then
9708         echo "You have the full sem*(2) library." >&4
9709         val="$define"
9710 else
9711         echo "You don't have the full sem*(2) library." >&4
9712         val="$undef"
9713 fi
9714 set d_sem
9715 eval $setvar
9716
9717 : see whether sys/sem.h defines union semun
9718 echo " "
9719 $cat > try.c <<'END'
9720 #include <sys/types.h>
9721 #include <sys/ipc.h>
9722 #include <sys/sem.h>
9723 int main () { union semun semun; semun.buf = 0; }
9724 END
9725 set try
9726 if eval $compile; then
9727     echo "You have union semun in <sys/sem.h>." >&4
9728     val="$define"
9729 else
9730     echo "You do not have union semun in <sys/sem.h>." >&4
9731     val="$undef"
9732 fi
9733 $rm -f try try.c try.h
9734 set d_union_semun
9735 eval $setvar
9736
9737 : see how to do semctl IPC_STAT
9738 case "$d_sem" in
9739 $define)
9740     : see whether semctl IPC_STAT can use union semun
9741     echo " "
9742     $cat > try.h <<END
9743 #ifndef S_IRUSR
9744 #   ifdef S_IREAD
9745 #       define S_IRUSR S_IREAD
9746 #       define S_IWUSR S_IWRITE
9747 #       define S_IXUSR S_IEXEC
9748 #   else
9749 #       define S_IRUSR 0400
9750 #       define S_IWUSR 0200
9751 #       define S_IXUSR 0100
9752 #   endif
9753 #   define S_IRGRP (S_IRUSR>>3)
9754 #   define S_IWGRP (S_IWUSR>>3)
9755 #   define S_IXGRP (S_IXUSR>>3)
9756 #   define S_IROTH (S_IRUSR>>6)
9757 #   define S_IWOTH (S_IWUSR>>6)
9758 #   define S_IXOTH (S_IXUSR>>6)
9759 #endif
9760 #ifndef S_IRWXU
9761 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9762 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9763 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9764 #endif
9765 END
9766
9767     $cat > try.c <<END
9768 #include <sys/types.h>
9769 #include <sys/ipc.h>
9770 #include <sys/sem.h>
9771 #include <sys/stat.h>
9772 #include <stdio.h>
9773 #include <errno.h>
9774 #include "try.h"
9775 #ifndef errno
9776 extern int errno;
9777 #endif
9778 #$d_union_semun HAS_UNION_SEMUN
9779 int main() {
9780     union semun
9781 #ifndef HAS_UNION_SEMUN
9782     {
9783         int val;
9784         struct semid_ds *buf;
9785         unsigned short *array;
9786     }
9787 #endif
9788     arg;
9789     int sem, st;
9790
9791 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9792     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9793     if (sem > -1) {
9794         struct semid_ds argbuf;
9795         arg.buf = &argbuf;
9796 #       ifdef IPC_STAT
9797         st = semctl(sem, 0, IPC_STAT, arg);
9798         if (st == 0)
9799             printf("semun\n");
9800         else
9801 #       endif /* IPC_STAT */
9802             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9803 #       ifdef IPC_RMID
9804         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9805 #       endif /* IPC_RMID */
9806             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9807     } else
9808 #endif /* IPC_PRIVATE && ... */
9809         printf("semget failed: errno = %d\n", errno);
9810   return 0;
9811 }
9812 END
9813     val="$undef"
9814     set try
9815     if eval $compile; then
9816         xxx=`./try`
9817         case "$xxx" in
9818         semun) val="$define" ;;
9819         esac
9820     fi
9821     $rm -f try try.c
9822     set d_semctl_semun
9823     eval $setvar
9824     case "$d_semctl_semun" in
9825     $define)
9826         echo "You can use union semun for semctl IPC_STAT." >&4
9827         also='also'
9828         ;;
9829     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9830         also=''
9831         ;;
9832     esac
9833
9834     : see whether semctl IPC_STAT can use struct semid_ds pointer
9835     $cat > try.c <<'END'
9836 #include <sys/types.h>
9837 #include <sys/ipc.h>
9838 #include <sys/sem.h>
9839 #include <sys/stat.h>
9840 #include "try.h"
9841 #include <stdio.h>
9842 #include <errno.h>
9843 #ifndef errno
9844 extern int errno;
9845 #endif
9846 int main() {
9847     struct semid_ds arg;
9848     int sem, st;
9849
9850 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9851     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9852     if (sem > -1) {
9853 #       ifdef IPC_STAT
9854         st = semctl(sem, 0, IPC_STAT, &arg);
9855         if (st == 0)
9856             printf("semid_ds\n");
9857         else
9858 #       endif /* IPC_STAT */
9859             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9860 #       ifdef IPC_RMID
9861         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9862 #       endif /* IPC_RMID */
9863             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9864     } else
9865 #endif /* IPC_PRIVATE && ... */
9866         printf("semget failed: errno = %d\n", errno);
9867
9868     return 0;
9869 }
9870 END
9871     val="$undef"
9872     set try
9873     if eval $compile; then
9874         xxx=`./try`
9875         case "$xxx" in
9876         semid_ds) val="$define" ;;
9877         esac
9878     fi
9879     $rm -f try try.c
9880     set d_semctl_semid_ds
9881     eval $setvar
9882     case "$d_semctl_semid_ds" in
9883     $define)
9884         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9885         ;;
9886     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9887         ;;
9888     esac
9889     $rm -f try.h
9890     ;;
9891 *)  val="$undef"
9892
9893     # We do not have the full sem*(2) library, so assume we can not
9894     # use either.
9895
9896     set d_semctl_semun
9897     eval $setvar
9898
9899     set d_semctl_semid_ds
9900     eval $setvar
9901     ;;
9902 esac
9903
9904 : see if setegid exists
9905 set setegid d_setegid
9906 eval $inlibc
9907
9908 : see if seteuid exists
9909 set seteuid d_seteuid
9910 eval $inlibc
9911
9912 : see if setgrent exists
9913 set setgrent d_setgrent
9914 eval $inlibc
9915
9916 : see if sethostent exists
9917 set sethostent d_sethent
9918 eval $inlibc
9919
9920 : see if setlinebuf exists
9921 set setlinebuf d_setlinebuf
9922 eval $inlibc
9923
9924 : see if setlocale exists
9925 set setlocale d_setlocale
9926 eval $inlibc
9927
9928 : see if setnetent exists
9929 set setnetent d_setnent
9930 eval $inlibc
9931
9932 : see if setprotoent exists
9933 set setprotoent d_setpent
9934 eval $inlibc
9935
9936 : see if setpgid exists
9937 set setpgid d_setpgid
9938 eval $inlibc
9939
9940 : see if setpgrp2 exists
9941 set setpgrp2 d_setpgrp2
9942 eval $inlibc
9943
9944 : see if setpriority exists
9945 set setpriority d_setprior
9946 eval $inlibc
9947
9948 : see if setpwent exists
9949 set setpwent d_setpwent
9950 eval $inlibc
9951
9952 : see if setregid exists
9953 set setregid d_setregid
9954 eval $inlibc
9955 set setresgid d_setresgid
9956 eval $inlibc
9957
9958 : see if setreuid exists
9959 set setreuid d_setreuid
9960 eval $inlibc
9961 set setresuid d_setresuid
9962 eval $inlibc
9963
9964 : see if setrgid exists
9965 set setrgid d_setrgid
9966 eval $inlibc
9967
9968 : see if setruid exists
9969 set setruid d_setruid
9970 eval $inlibc
9971
9972 : see if setservent exists
9973 set setservent d_setsent
9974 eval $inlibc
9975
9976 : see if setsid exists
9977 set setsid d_setsid
9978 eval $inlibc
9979
9980 : see if setspent exists
9981 set setspent d_setspent
9982 eval $inlibc
9983
9984 : see if setvbuf exists
9985 set setvbuf d_setvbuf
9986 eval $inlibc
9987
9988 : see if sfio.h is available
9989 set sfio.h i_sfio
9990 eval $inhdr
9991
9992
9993 : see if sfio library is available
9994 case "$i_sfio" in
9995 $define)
9996         val=''
9997         set sfreserve val
9998         eval $inlibc
9999         ;;
10000 *)
10001         val="$undef"
10002         ;;
10003 esac
10004 : Ok, but do we want to use it.
10005 case "$val" in
10006 $define)
10007         case "$usesfio" in
10008         true|$define|[yY]*) dflt='y';;
10009         *) dflt='n';;
10010         esac
10011         echo "$package can use the sfio library, but it is experimental."
10012         rp="You seem to have sfio available, do you want to try using it?"
10013         . ./myread
10014         case "$ans" in
10015         y|Y) ;;
10016         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10017                 val="$undef"
10018                 : Remove sfio from list of libraries to use
10019                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10020                 shift
10021                 libs="$*"
10022                 echo "libs = $libs" >&4
10023                 ;;
10024         esac
10025         ;;
10026 *)      case "$usesfio" in
10027         true|$define|[yY]*)
10028                 echo "Sorry, cannot find sfio on this machine" >&4
10029                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10030                 ;;
10031         esac
10032         ;;
10033 esac
10034 set d_sfio
10035 eval $setvar
10036 case "$d_sfio" in
10037 $define) usesfio='true';;
10038 *) usesfio='false';;
10039 esac
10040
10041 : see if shmctl exists
10042 set shmctl d_shmctl
10043 eval $inlibc
10044
10045 : see if shmget exists
10046 set shmget d_shmget
10047 eval $inlibc
10048
10049 : see if shmat exists
10050 set shmat d_shmat
10051 eval $inlibc
10052 : see what shmat returns
10053 case "$d_shmat" in
10054 "$define")
10055         $cat >shmat.c <<'END'
10056 #include <sys/shm.h>
10057 void *shmat();
10058 END
10059         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10060                 shmattype='void *'
10061         else
10062                 shmattype='char *'
10063         fi
10064         echo "and it returns ($shmattype)." >&4
10065         : see if a prototype for shmat is available
10066         xxx=`./findhdr sys/shm.h`
10067         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10068         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10069                 val="$define"
10070         else
10071                 val="$undef"
10072         fi
10073         $rm -f shmat.[co]
10074         ;;
10075 *)
10076         val="$undef"
10077         ;;
10078 esac
10079 set d_shmatprototype
10080 eval $setvar
10081
10082 : see if shmdt exists
10083 set shmdt d_shmdt
10084 eval $inlibc
10085
10086 : see how much of the 'shm*(2)' library is present.
10087 h_shm=true
10088 echo " "
10089 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10090 *"$undef"*) h_shm=false;;
10091 esac
10092 case "$osname" in
10093 freebsd)
10094     case "`ipcs 2>&1`" in
10095     "SVID shared memory"*"not configured"*)
10096         echo "Your $osname does not have the shm*(2) configured." >&4
10097         h_shm=false
10098         val="$undef"
10099         set shmctl d_shmctl
10100         evat $setvar
10101         set shmget d_shmget
10102         evat $setvar
10103         set shmat d_shmat
10104         evat $setvar
10105         set shmdt d_shmdt
10106         evat $setvar
10107         ;;
10108     esac
10109     ;;
10110 esac
10111 : we could also check for sys/ipc.h ...
10112 if $h_shm && $test `./findhdr sys/shm.h`; then
10113         echo "You have the full shm*(2) library." >&4
10114         val="$define"
10115 else
10116         echo "You don't have the full shm*(2) library." >&4
10117         val="$undef"
10118 fi
10119 set d_shm
10120 eval $setvar
10121
10122 echo " "
10123 : see if we have sigaction
10124 if set sigaction val -f d_sigaction; eval $csym; $val; then
10125         echo 'sigaction() found.' >&4
10126         $cat > try.c <<'EOP'
10127 #include <stdio.h>
10128 #include <sys/types.h>
10129 #include <signal.h>
10130 int main()
10131 {
10132     struct sigaction act, oact;
10133 }
10134 EOP
10135         set try
10136         if eval $compile_ok; then
10137                 val="$define"
10138         else
10139                 echo "But you don't seem to have a useable struct sigaction." >&4
10140                 val="$undef"
10141         fi
10142 else
10143         echo 'sigaction NOT found.' >&4
10144         val="$undef"
10145 fi
10146 set d_sigaction; eval $setvar
10147 $rm -f try try$_o try.c
10148
10149 : see if sigsetjmp exists
10150 echo " "
10151 case "$d_sigsetjmp" in
10152 '')
10153         $cat >try.c <<'EOP'
10154 #include <setjmp.h>
10155 sigjmp_buf env;
10156 int set = 1;
10157 int main()
10158 {
10159         if (sigsetjmp(env,1))
10160                 exit(set);
10161         set = 0;
10162         siglongjmp(env, 1);
10163         exit(1);
10164 }
10165 EOP
10166         set try
10167         if eval $compile; then
10168                 if ./try >/dev/null 2>&1; then
10169                         echo "POSIX sigsetjmp found." >&4
10170                         val="$define"
10171                 else
10172                         $cat >&4 <<EOM
10173 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10174 I'll ignore them.
10175 EOM
10176                         val="$undef"
10177                 fi
10178         else
10179                 echo "sigsetjmp not found." >&4
10180                 val="$undef"
10181         fi
10182         ;;
10183 *) val="$d_sigsetjmp"
10184         case "$d_sigsetjmp" in
10185         $define) echo "POSIX sigsetjmp found." >&4;;
10186         $undef) echo "sigsetjmp not found." >&4;;
10187         esac
10188         ;;
10189 esac
10190 set d_sigsetjmp
10191 eval $setvar
10192 $rm -f try.c try
10193
10194 : see if sys/stat.h is available
10195 set sys/stat.h i_sysstat
10196 eval $inhdr
10197
10198 : see if stat knows about block sizes
10199 echo " "
10200 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10201 eval $hasfield
10202
10203 : see if _ptr and _cnt from stdio act std
10204 echo " "
10205 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10206         echo "(Looks like you have stdio.h from Linux.)"
10207         case "$stdio_ptr" in
10208         '') stdio_ptr='((fp)->_IO_read_ptr)'
10209                 ptr_lval=$define
10210                 ;;
10211         *)      ptr_lval=$d_stdio_ptr_lval;;
10212         esac
10213         case "$stdio_cnt" in
10214         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10215                 cnt_lval=$undef
10216                 ;;
10217         *)      cnt_lval=$d_stdio_cnt_lval;;
10218         esac
10219         case "$stdio_base" in
10220         '') stdio_base='((fp)->_IO_read_base)';;
10221         esac
10222         case "$stdio_bufsiz" in
10223         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10224         esac
10225 else
10226         case "$stdio_ptr" in
10227         '') stdio_ptr='((fp)->_ptr)'
10228                 ptr_lval=$define
10229                 ;;
10230         *)      ptr_lval=$d_stdio_ptr_lval;;
10231         esac
10232         case "$stdio_cnt" in
10233         '') stdio_cnt='((fp)->_cnt)'
10234                 cnt_lval=$define
10235                 ;;
10236         *)      cnt_lval=$d_stdio_cnt_lval;;
10237         esac
10238         case "$stdio_base" in
10239         '') stdio_base='((fp)->_base)';;
10240         esac
10241         case "$stdio_bufsiz" in
10242         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10243         esac
10244 fi
10245 : test whether _ptr and _cnt really work
10246 echo "Checking how std your stdio is..." >&4
10247 $cat >try.c <<EOP
10248 #include <stdio.h>
10249 #define FILE_ptr(fp)    $stdio_ptr
10250 #define FILE_cnt(fp)    $stdio_cnt
10251 int main() {
10252         FILE *fp = fopen("try.c", "r");
10253         char c = getc(fp);
10254         if (
10255                 18 <= FILE_cnt(fp) &&
10256                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10257         )
10258                 exit(0);
10259         exit(1);
10260 }
10261 EOP
10262 val="$undef"
10263 set try
10264 if eval $compile; then
10265         if ./try; then
10266                 echo "Your stdio acts pretty std."
10267                 val="$define"
10268         else
10269                 echo "Your stdio isn't very std."
10270         fi
10271 else
10272         echo "Your stdio doesn't appear very std."
10273 fi
10274 $rm -f try.c try
10275 set d_stdstdio
10276 eval $setvar
10277
10278 : Can _ptr be used as an lvalue?
10279 case "$d_stdstdio$ptr_lval" in
10280 $define$define) val=$define ;;
10281 *) val=$undef ;;
10282 esac
10283 set d_stdio_ptr_lval
10284 eval $setvar
10285
10286 : Can _cnt be used as an lvalue?
10287 case "$d_stdstdio$cnt_lval" in
10288 $define$define) val=$define ;;
10289 *) val=$undef ;;
10290 esac
10291 set d_stdio_cnt_lval
10292 eval $setvar
10293
10294 : see if _base is also standard
10295 val="$undef"
10296 case "$d_stdstdio" in
10297 $define)
10298         $cat >try.c <<EOP
10299 #include <stdio.h>
10300 #define FILE_base(fp)   $stdio_base
10301 #define FILE_bufsiz(fp) $stdio_bufsiz
10302 int main() {
10303         FILE *fp = fopen("try.c", "r");
10304         char c = getc(fp);
10305         if (
10306                 19 <= FILE_bufsiz(fp) &&
10307                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10308         )
10309                 exit(0);
10310         exit(1);
10311 }
10312 EOP
10313         set try
10314         if eval $compile; then
10315                 if ./try; then
10316                         echo "And its _base field acts std."
10317                         val="$define"
10318                 else
10319                         echo "But its _base field isn't std."
10320                 fi
10321         else
10322                 echo "However, it seems to be lacking the _base field."
10323         fi
10324         $rm -f try.c try
10325         ;;
10326 esac
10327 set d_stdiobase
10328 eval $setvar
10329
10330 $cat >&4 <<EOM
10331 Checking how to access stdio streams by file descriptor number...
10332 EOM
10333 case "$stdio_stream_array" in
10334 '')     $cat >try.c <<EOCP
10335 #include <stdio.h>
10336 int main() {
10337   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10338     printf("yes\n");
10339 }
10340 EOCP
10341         for s in _iob __iob __sF
10342         do
10343                 set try -DSTDIO_STREAM_ARRAY=$s
10344                 if eval $compile; then
10345                         case "`./try$exe_ext`" in
10346                         yes)    stdio_stream_array=$s; break ;;
10347                         esac
10348                 fi
10349         done
10350         $rm -f try.* try$exe_ext
10351 esac
10352 case "$stdio_stream_array" in
10353 '')     $cat >&4 <<EOM
10354 I can't figure out how to access stdio streams by file descriptor number.
10355 EOM
10356         d_stdio_stream_array="$undef"
10357         ;;
10358 *)      $cat >&4 <<EOM
10359 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10360 EOM
10361         d_stdio_stream_array="$define"
10362         ;;
10363 esac
10364
10365 : see if strcoll exists
10366 set strcoll d_strcoll
10367 eval $inlibc
10368
10369 : check for structure copying
10370 echo " "
10371 echo "Checking to see if your C compiler can copy structs..." >&4
10372 $cat >try.c <<'EOCP'
10373 int main()
10374 {
10375         struct blurfl {
10376                 int dyick;
10377         } foo, bar;
10378
10379         foo = bar;
10380 }
10381 EOCP
10382 if $cc -c try.c >/dev/null 2>&1 ; then
10383         val="$define"
10384         echo "Yup, it can."
10385 else
10386         val="$undef"
10387         echo "Nope, it can't."
10388 fi
10389 set d_strctcpy
10390 eval $setvar
10391 $rm -f try.*
10392
10393 : see if strerror and/or sys_errlist[] exist
10394 echo " "
10395 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10396     if set strerror val -f d_strerror; eval $csym; $val; then
10397                 echo 'strerror() found.' >&4
10398                 d_strerror="$define"
10399                 d_strerrm='strerror(e)'
10400                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10401                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10402                         d_syserrlst="$define"
10403                 else
10404                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10405                         d_syserrlst="$undef"
10406                 fi
10407     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10408                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10409                 echo 'strerror() found in string header.' >&4
10410                 d_strerror="$define"
10411                 d_strerrm='strerror(e)'
10412                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10413                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10414                                 d_syserrlst="$define"
10415                 else
10416                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10417                         d_syserrlst="$undef"
10418                 fi
10419     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10420                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10421                 d_strerror="$undef"
10422                 d_syserrlst="$define"
10423                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10424     else
10425                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10426                 d_strerror="$undef"
10427                 d_syserrlst="$undef"
10428                 d_strerrm='"unknown"'
10429     fi
10430 fi
10431
10432 : see if strtod exists
10433 set strtod d_strtod
10434 eval $inlibc
10435
10436 : see if strtol exists
10437 set strtol d_strtol
10438 eval $inlibc
10439
10440 : see if strtoul exists
10441 set strtoul d_strtoul
10442 eval $inlibc
10443
10444 : see if strtoull exists
10445 set strtoull d_strtoull
10446 eval $inlibc
10447
10448 : see if strxfrm exists
10449 set strxfrm d_strxfrm
10450 eval $inlibc
10451
10452 : see if symlink exists
10453 set symlink d_symlink
10454 eval $inlibc
10455
10456 : see if syscall exists
10457 set syscall d_syscall
10458 eval $inlibc
10459
10460 : see if sysconf exists
10461 set sysconf d_sysconf
10462 eval $inlibc
10463
10464 : see if system exists
10465 set system d_system
10466 eval $inlibc
10467
10468 : see if tcgetpgrp exists
10469 set tcgetpgrp d_tcgetpgrp
10470 eval $inlibc
10471
10472 : see if tcsetpgrp exists
10473 set tcsetpgrp d_tcsetpgrp
10474 eval $inlibc
10475
10476 : see if sys/types.h has to be included
10477 set sys/types.h i_systypes
10478 eval $inhdr
10479
10480 : see if prototype for telldir is available
10481 echo " "
10482 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10483 eval $hasproto
10484
10485 : define an is-a-typedef? function
10486 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10487 case "$inclist" in
10488 "") inclist="sys/types.h";;
10489 esac;
10490 eval "varval=\$$var";
10491 case "$varval" in
10492 "")
10493         $rm -f temp.c;
10494         for inc in $inclist; do
10495                 echo "#include <$inc>" >>temp.c;
10496         done;
10497         echo "#ifdef $type" >> temp.c;
10498         echo "printf(\"We have $type\");" >> temp.c;
10499         echo "#endif" >> temp.c;
10500         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10501         if $contains $type temp.E >/dev/null 2>&1; then
10502                 eval "$var=\$type";
10503         else
10504                 eval "$var=\$def";
10505         fi;
10506         $rm -f temp.?;;
10507 *) eval "$var=\$varval";;
10508 esac'
10509
10510 : define an is-a-typedef? function that prompts if the type is not available.
10511 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10512 case "$inclist" in
10513 "") inclist="sys/types.h";;
10514 esac;
10515 eval "varval=\$$var";
10516 case "$varval" in
10517 "")
10518         $rm -f temp.c;
10519         for inc in $inclist; do
10520                 echo "#include <$inc>" >>temp.c;
10521         done;
10522         echo "#ifdef $type" >> temp.c;
10523         echo "printf(\"We have $type\");" >> temp.c;
10524         echo "#endif" >> temp.c;
10525         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10526         echo " " ;
10527         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10528         if $contains $type temp.E >/dev/null 2>&1; then
10529                 echo "$type found." >&4;
10530                 eval "$var=\$type";
10531         else
10532                 echo "$type NOT found." >&4;
10533                 dflt="$def";
10534                 . ./myread ;
10535                 eval "$var=\$ans";
10536         fi;
10537         $rm -f temp.?;;
10538 *) eval "$var=\$varval";;
10539 esac'
10540
10541 : see if this is a sys/times.h system
10542 set sys/times.h i_systimes
10543 eval $inhdr
10544
10545 : see if times exists
10546 echo " "
10547 if set times val -f d_times; eval $csym; $val; then
10548         echo 'times() found.' >&4
10549         d_times="$define"
10550         inc=''
10551         case "$i_systimes" in
10552         "$define") inc='sys/times.h';;
10553         esac
10554         rp="What is the type returned by times() on this system?"
10555         set clock_t clocktype long stdio.h sys/types.h $inc
10556         eval $typedef_ask
10557 else
10558         echo 'times() NOT found, hope that will do.' >&4
10559         d_times="$undef"
10560         clocktype='int'
10561 fi
10562
10563 : see if truncate exists
10564 set truncate d_truncate
10565 eval $inlibc
10566
10567 : see if tzname[] exists
10568 echo " "
10569 if set tzname val -a d_tzname; eval $csym; $val; then
10570         val="$define"
10571         echo 'tzname[] found.' >&4
10572 else
10573         val="$undef"
10574         echo 'tzname[] NOT found.' >&4
10575 fi
10576 set d_tzname
10577 eval $setvar
10578
10579 : see if umask exists
10580 set umask d_umask
10581 eval $inlibc
10582
10583 : backward compatibility for d_hvfork
10584 if test X$d_hvfork != X; then
10585         d_vfork="$d_hvfork"
10586         d_hvfork=''
10587 fi
10588 : see if there is a vfork
10589 val=''
10590 set vfork val
10591 eval $inlibc
10592
10593 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10594 : perl on Solaris 2.x, and probably elsewhere.
10595 case "$val" in
10596 $define)
10597         echo " "
10598         case "$usevfork" in
10599         false) dflt='n';;
10600         *) dflt='y';;
10601         esac
10602         cat <<'EOM'
10603  
10604 Perl can only use a vfork() that doesn't suffer from strict
10605 restrictions on calling functions or modifying global data in
10606 the child.  For example, glibc-2.1 contains such a vfork()
10607 that is unsuitable.  If your system provides a proper fork()
10608 call, chances are that you do NOT want perl to use vfork().
10609
10610 EOM
10611         rp="Do you still want to use vfork()?"
10612         . ./myread
10613         case "$ans" in
10614         y|Y) ;;
10615         *)
10616                 echo "Ok, we won't use vfork()."
10617                 val="$undef"
10618                 ;;
10619         esac
10620         ;;
10621 esac
10622 set d_vfork
10623 eval $setvar
10624 case "$d_vfork" in
10625 $define) usevfork='true';;
10626 *) usevfork='false';;
10627 esac
10628
10629 : see if this is an sysdir system
10630 set sys/dir.h i_sysdir
10631 eval $inhdr
10632
10633 : see if this is an sysndir system
10634 set sys/ndir.h i_sysndir
10635 eval $inhdr
10636
10637 : see if closedir exists
10638 set closedir d_closedir
10639 eval $inlibc
10640
10641 case "$d_closedir" in
10642 "$define")
10643         echo " "
10644         echo "Checking whether closedir() returns a status..." >&4
10645         cat > closedir.c <<EOM
10646 #$i_dirent I_DIRENT             /**/
10647 #$i_sysdir I_SYS_DIR            /**/
10648 #$i_sysndir I_SYS_NDIR          /**/
10649 #$i_systypes I_SYS_TYPES        /**/
10650
10651 #if defined(I_SYS_TYPES)
10652 #include <sys/types.h>
10653 #endif
10654 #if defined(I_DIRENT)
10655 #include <dirent.h>
10656 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10657 #include <sys/dir.h>
10658 #endif
10659 #else
10660 #ifdef I_SYS_NDIR
10661 #include <sys/ndir.h>
10662 #else
10663 #ifdef I_SYS_DIR
10664 #ifdef hp9000s500
10665 #include <ndir.h>       /* may be wrong in the future */
10666 #else
10667 #include <sys/dir.h>
10668 #endif
10669 #endif
10670 #endif
10671 #endif 
10672 int main() { return closedir(opendir(".")); }
10673 EOM
10674         set closedir
10675         if eval $compile_ok; then
10676                 if ./closedir > /dev/null 2>&1 ; then
10677                         echo "Yes, it does."
10678                         val="$undef"
10679                 else
10680                         echo "No, it doesn't."
10681                         val="$define"
10682                 fi
10683         else
10684                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10685                 val="$define"
10686         fi
10687         ;;
10688 *)
10689         val="$undef";
10690         ;;
10691 esac
10692 set d_void_closedir
10693 eval $setvar
10694 $rm -f closedir*
10695 : check for volatile keyword
10696 echo " "
10697 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10698 $cat >try.c <<'EOCP'
10699 int main()
10700 {
10701         typedef struct _goo_struct goo_struct;
10702         goo_struct * volatile goo = ((goo_struct *)0);
10703         struct _goo_struct {
10704                 long long_int;
10705                 int reg_int;
10706                 char char_var;
10707         };
10708         typedef unsigned short foo_t;
10709         char *volatile foo;
10710         volatile int bar;
10711         volatile foo_t blech;
10712         foo = foo;
10713 }
10714 EOCP
10715 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10716         val="$define"
10717         echo "Yup, it does."
10718 else
10719         val="$undef"
10720         echo "Nope, it doesn't."
10721 fi
10722 set d_volatile
10723 eval $setvar
10724 $rm -f try.*
10725
10726 : see if there is a wait4
10727 set wait4 d_wait4
10728 eval $inlibc
10729
10730 : see if waitpid exists
10731 set waitpid d_waitpid
10732 eval $inlibc
10733
10734 : see if wcstombs exists
10735 set wcstombs d_wcstombs
10736 eval $inlibc
10737
10738 : see if wctomb exists
10739 set wctomb d_wctomb
10740 eval $inlibc
10741
10742 : see if writev exists
10743 set writev d_writev
10744 eval $inlibc
10745
10746 : preserve RCS keywords in files with variable substitution, grrr
10747 Date='$Date'
10748 Id='$Id'
10749 Log='$Log'
10750 RCSfile='$RCSfile'
10751 Revision='$Revision'
10752
10753 case "$crosscompile" in
10754 ''|[nN]*) crosscompile="$undef" ;;
10755 esac
10756
10757 case "$osname" in
10758 next|rhapsody) multiarch="$define" ;;
10759 esac
10760 case "$multiarch" in
10761 ''|[nN]*) multiarch="$undef" ;;
10762 esac
10763
10764 : check for alignment requirements
10765 echo " "
10766 case "$crosscompile$multiarch" in
10767 *$define*)
10768         $cat <<EOM
10769 You seem to be either cross-compiling or doing a multiarchitecture build,
10770 skipping the memory alignment check.
10771
10772 EOM
10773         case "$alignbytes" in
10774         '') alignbytes=8 ;;
10775         esac
10776         ;;
10777 *)
10778         case "$alignbytes" in
10779         '') echo "Checking alignment constraints..." >&4
10780                 $cat >try.c <<'EOCP'
10781 struct foobar {
10782         char foo;
10783         double bar;
10784 } try_algn;
10785 int main()
10786 {
10787         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10788 }
10789 EOCP
10790                 set try
10791                 if eval $compile_ok; then
10792                         dflt=`./try`
10793                 else
10794                         dflt='8'
10795                         echo "(I can't seem to compile the test program...)"
10796                 fi
10797                 ;;
10798         *) dflt="$alignbytes"
10799                 ;;
10800         esac
10801         rp="Doubles must be aligned on a how-many-byte boundary?"
10802         . ./myread
10803         alignbytes="$ans"
10804         $rm -f try.c try
10805         ;;
10806 esac
10807
10808
10809 : check for ordering of bytes in a long
10810 echo " "
10811 case "$crosscompile$multiarch" in
10812 *$define*)
10813         $cat <<EOM
10814 You seem to be either cross-compiling or doing a multiarchitecture build,
10815 skipping the byteorder check.
10816
10817 EOM
10818         byteorder='0xffff'
10819         ;;
10820 *)
10821         case "$byteorder" in
10822         '')
10823                 $cat <<'EOM'
10824 In the following, larger digits indicate more significance.  A big-endian
10825 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10826 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10827 machines may have weird orders like 3412.  A Cray will report 87654321,
10828 an Alpha will report 12345678. If the test program works the default is
10829 probably right.
10830 I'm now running the test program...
10831 EOM
10832                 $cat >try.c <<'EOCP'
10833 #include <stdio.h>
10834 int main()
10835 {
10836         int i;
10837         union {
10838                 unsigned long l;
10839                 char c[sizeof(long)];
10840         } u;
10841
10842         if (sizeof(long) > 4)
10843                 u.l = (0x08070605L << 32) | 0x04030201L;
10844         else
10845                 u.l = 0x04030201L;
10846         for (i = 0; i < sizeof(long); i++)
10847                 printf("%c", u.c[i]+'0');
10848         printf("\n");
10849         exit(0);
10850 }
10851 EOCP
10852                 xxx_prompt=y
10853                 set try
10854                 if eval $compile && ./try > /dev/null; then
10855                         dflt=`./try`
10856                         case "$dflt" in
10857                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10858                                 echo "(The test program ran ok.)"
10859                                 echo "byteorder=$dflt"
10860                                 xxx_prompt=n
10861                         ;;
10862                         ????|????????) echo "(The test program ran ok.)" ;;
10863                         *) echo "(The test program didn't run right for some reason.)" ;;
10864                         esac
10865                 else
10866                         dflt='4321'
10867                         cat <<'EOM'
10868 (I can't seem to compile the test program.  Guessing big-endian...)
10869 EOM
10870                 fi
10871                 case "$xxx_prompt" in
10872                 y)
10873                         rp="What is the order of bytes in a long?"
10874                         . ./myread
10875                         byteorder="$ans"
10876                         ;;
10877                 *)      byteorder=$dflt
10878                         ;;
10879                 esac
10880                 ;;
10881         esac
10882         $rm -f try.c try
10883         ;;
10884 esac
10885
10886
10887 : how do we catenate cpp tokens here?
10888 echo " "
10889 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10890 $cat >cpp_stuff.c <<'EOCP'
10891 #define RCAT(a,b)a/**/b
10892 #define ACAT(a,b)a ## b
10893 RCAT(Rei,ser)
10894 ACAT(Cir,cus)
10895 EOCP
10896 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10897 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10898         echo "Oh!  Smells like ANSI's been here." >&4
10899         echo "We can catify or stringify, separately or together!"
10900         cpp_stuff=42
10901 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10902         echo "Ah, yes!  The good old days!" >&4
10903         echo "However, in the good old days we don't know how to stringify and"
10904         echo "catify at the same time."
10905         cpp_stuff=1
10906 else
10907         $cat >&4 <<EOM
10908 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10909 to have to edit the values of CAT[2-5] in config.h...
10910 EOM
10911         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10912 fi
10913 $rm -f cpp_stuff.*
10914
10915 : see if this is a db.h system
10916 set db.h i_db
10917 eval $inhdr
10918
10919 case "$i_db" in
10920 $define)
10921         : Check db version.
10922         echo " "
10923         echo "Checking Berkeley DB version ..." >&4
10924         $cat >try.c <<EOCP
10925 #$d_const HASCONST
10926 #ifndef HASCONST
10927 #define const
10928 #endif
10929 #include <sys/types.h>
10930 #include <stdio.h>
10931 #include <db.h>
10932 int main()
10933 {
10934 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10935     int Major, Minor, Patch ;
10936     unsigned long Version ;
10937     (void)db_version(&Major, &Minor, &Patch) ;
10938     printf("You have Berkeley DB Version 2 or greater\n");
10939
10940     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10941                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10942     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
10943                 Major, Minor, Patch) ;
10944
10945     /* check that db.h & libdb are compatible */
10946     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
10947         printf("db.h and libdb are incompatible\n") ;
10948         exit(3);        
10949     }
10950
10951     printf("db.h and libdb are compatible\n") ;
10952
10953     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
10954                 + DB_VERSION_PATCH ;
10955
10956     /* needs to be >= 2.3.4 */
10957     if (Version < 2003004) {
10958     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
10959         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
10960         exit(2);        
10961     }
10962
10963     exit(0);
10964 #else
10965 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
10966     printf("You have Berkeley DB Version 1\n");
10967     exit(0);    /* DB version < 2: the coast is clear. */
10968 #else
10969     exit(1);    /* <db.h> not Berkeley DB? */
10970 #endif
10971 #endif
10972 }
10973 EOCP
10974         set try
10975         if eval $compile && ./try; then
10976                 echo 'Looks OK.' >&4
10977         else
10978                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
10979                 i_db=$undef
10980                 case " $libs " in
10981                 *"-ldb "*)
10982                         : Remove db from list of libraries to use
10983                         echo "Removing unusable -ldb from library list" >&4
10984                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
10985                         shift
10986                         libs="$*"
10987                         echo "libs = $libs" >&4
10988                         ;;
10989                 esac
10990         fi
10991         $rm -f try.*
10992         ;;
10993 esac
10994
10995 case "$i_db" in
10996 define)
10997         : Check the return type needed for hash 
10998         echo " "
10999         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11000         $cat >try.c <<EOCP
11001 #$d_const HASCONST
11002 #ifndef HASCONST
11003 #define const
11004 #endif
11005 #include <sys/types.h>
11006 #include <db.h>
11007
11008 #ifndef DB_VERSION_MAJOR
11009 u_int32_t hash_cb (ptr, size)
11010 const void *ptr;
11011 size_t size;
11012 {
11013 }
11014 HASHINFO info;
11015 int main()
11016 {
11017         info.hash = hash_cb;
11018 }
11019 #endif
11020 EOCP
11021         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11022                 if $contains warning try.out >>/dev/null 2>&1 ; then
11023                         db_hashtype='int'
11024                 else
11025                         db_hashtype='u_int32_t'
11026                 fi
11027         else
11028                 : XXX Maybe we should just give up here.
11029                 db_hashtype=u_int32_t
11030                 $cat try.out >&4
11031                 echo "Help:  I can't seem to compile the db test program." >&4
11032                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11033         fi
11034         $rm -f try.*
11035         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11036         ;;
11037 *)      db_hashtype=u_int32_t
11038         ;;
11039 esac
11040 case "$i_db" in
11041 define)
11042         : Check the return type needed for prefix 
11043         echo " "
11044         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11045         cat >try.c <<EOCP
11046 #$d_const HASCONST
11047 #ifndef HASCONST
11048 #define const
11049 #endif
11050 #include <sys/types.h>
11051 #include <db.h>
11052
11053 #ifndef DB_VERSION_MAJOR
11054 size_t prefix_cb (key1, key2)
11055 const DBT *key1;
11056 const DBT *key2;
11057 {
11058 }
11059 BTREEINFO info;
11060 int main()
11061 {
11062         info.prefix = prefix_cb;
11063 }
11064 #endif
11065 EOCP
11066         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11067                 if $contains warning try.out >>/dev/null 2>&1 ; then
11068                         db_prefixtype='int'
11069                 else
11070                         db_prefixtype='size_t'
11071                 fi
11072         else
11073                 db_prefixtype='size_t'
11074                 : XXX Maybe we should just give up here.
11075                 $cat try.out >&4
11076                 echo "Help:  I can't seem to compile the db test program." >&4
11077                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11078         fi
11079         $rm -f try.*
11080         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11081         ;;
11082 *)      db_prefixtype='size_t'
11083         ;;
11084 esac
11085
11086 : check for void type
11087 echo " "
11088 echo "Checking to see how well your C compiler groks the void type..." >&4
11089 case "$voidflags" in
11090 '')
11091         $cat >try.c <<'EOCP'
11092 #if TRY & 1
11093 void sub() {
11094 #else
11095 sub() {
11096 #endif
11097         extern void moo();      /* function returning void */
11098         void (*goo)();          /* ptr to func returning void */
11099 #if TRY & 8
11100         void *hue;              /* generic ptr */
11101 #endif
11102 #if TRY & 2
11103         void (*foo[10])();
11104 #endif
11105
11106 #if TRY & 4
11107         if(goo == moo) {
11108                 exit(0);
11109         }
11110 #endif
11111         exit(0);
11112 }
11113 int main() { sub(); }
11114 EOCP
11115         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11116                 voidflags=$defvoidused
11117         echo "Good.  It appears to support void to the level $package wants.">&4
11118                 if $contains warning .out >/dev/null 2>&1; then
11119                         echo "However, you might get some warnings that look like this:"
11120                         $cat .out
11121                 fi
11122         else
11123 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11124                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11125                         echo "It supports 1..."
11126                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11127                                 echo "It also supports 2..."
11128                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11129                                         voidflags=7
11130                                         echo "And it supports 4 but not 8 definitely."
11131                                 else
11132                                         echo "It doesn't support 4..."
11133                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11134                                                 voidflags=11
11135                                                 echo "But it supports 8."
11136                                         else
11137                                                 voidflags=3
11138                                                 echo "Neither does it support 8."
11139                                         fi
11140                                 fi
11141                         else
11142                                 echo "It does not support 2..."
11143                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11144                                         voidflags=13
11145                                         echo "But it supports 4 and 8."
11146                                 else
11147                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11148                                                 voidflags=5
11149                                                 echo "And it supports 4 but has not heard about 8."
11150                                         else
11151                                                 echo "However it supports 8 but not 4."
11152                                         fi
11153                                 fi
11154                         fi
11155                 else
11156                         echo "There is no support at all for void."
11157                         voidflags=0
11158                 fi
11159         fi
11160 esac
11161 case "$voidflags" in
11162 "$defvoidused") ;;
11163 *)      $cat >&4 <<'EOM'
11164   Support flag bits are:
11165     1: basic void declarations.
11166     2: arrays of pointers to functions returning void.
11167     4: operations between pointers to and addresses of void functions.
11168     8: generic void pointers.
11169 EOM
11170         dflt="$voidflags";
11171         rp="Your void support flags add up to what?"
11172         . ./myread
11173         voidflags="$ans"
11174         ;;
11175 esac
11176 $rm -f try.* .out
11177
11178
11179 : How can we generate normalized random numbers ?
11180 echo " "
11181 echo "Looking for a random number function..." >&4
11182 case "$randfunc" in
11183 '')
11184         if set drand48 val -f; eval $csym; $val; then
11185                 dflt="drand48"
11186                 echo "Good, found drand48()." >&4
11187         elif set random val -f; eval $csym; $val; then
11188                 dflt="random"
11189                 echo "OK, found random()." >&4
11190         else
11191                 dflt="rand"
11192                 echo "Yick, looks like I have to use rand()." >&4
11193         fi
11194         echo " "
11195         ;;
11196 *)
11197         dflt="$randfunc"
11198         ;;
11199 esac
11200 cont=true
11201
11202 case "$ccflags" in
11203 *-Dmy_rand=*|*-Dmy_srand=*)
11204         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11205         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11206         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11207         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11208         ;;
11209 esac
11210
11211 while $test "$cont"; do
11212         rp="Use which function to generate random numbers?"
11213         . ./myread
11214         if $test "$ans" = "$dflt"; then
11215                 : null
11216         else
11217                 randbits=''
11218         fi
11219         randfunc="$ans"
11220         if set $ans val -f; eval $csym; $val; then
11221                 cont=''
11222         else
11223                 dflt=y
11224                 rp="I cannot find function $ans. Use that name anyway?"
11225                 . ./myread
11226                 dflt=rand
11227                 case "$ans" in
11228                         [yY]*) cont='';;
11229                 esac
11230         fi
11231         case "$cont" in
11232         '')
11233                 case "$randfunc" in
11234                 drand48)
11235                         drand01="drand48()"
11236                         seedfunc="srand48"
11237                         randbits=48
11238                         randseedtype=long
11239                         ;;
11240                 rand|random)
11241                         case "$randbits" in
11242                         '')
11243 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11244                                 $cat >try.c <<EOCP
11245 #$i_unistd I_UNISTD
11246 #$i_stdlib I_STDLIB
11247 #include <stdio.h>
11248 #ifdef I_UNISTD
11249 #  include <unistd.h>
11250 #endif
11251 #ifdef I_STDLIB
11252 #  include <stdlib.h>
11253 #endif
11254 int main()
11255 {
11256         register int i;
11257         register unsigned long tmp;
11258         register unsigned long max = 0L;
11259
11260         for (i = 1000; i; i--) {
11261                 tmp = (unsigned long) $randfunc();
11262                 if (tmp > max) max = tmp;
11263         }
11264         for (i = 0; max; i++)
11265                 max /= 2;
11266         printf("%d\n",i);
11267 }
11268 EOCP
11269                                 set try
11270                                 if eval $compile_ok; then
11271                                         dflt=`try`
11272                                 else
11273                                         dflt='?'
11274                                         echo "(I can't seem to compile the test program...)"
11275                                 fi
11276                                 ;;
11277                         *)
11278                                 dflt="$randbits"
11279                                 ;;
11280                         esac
11281                         rp="How many bits does your $randfunc() function produce?"
11282                         . ./myread
11283                         randbits="$ans"
11284                         $rm -f try.c try
11285                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11286                         seedfunc="s$randfunc"
11287                         randseedtype=unsigned
11288                         ;;
11289                 *)
11290                         dflt="31"
11291                         rp="How many bits does your $randfunc() function produce?"
11292                         . ./myread
11293                         randbits="$ans"
11294                         seedfunc="s$randfunc"
11295                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11296                         if set $seedfunc val -f; eval $csym; $val; then
11297                                 echo "(Using $seedfunc() to seed random generator)"
11298                         else
11299                                 echo "(Warning: no $seedfunc() to seed random generator)"
11300                                 seedfunc=rand
11301                         fi
11302                         randseedtype=unsigned
11303                         ;;
11304                 esac
11305                 ;;
11306         esac
11307 done
11308
11309 echo " "
11310 echo "Determining whether or not we are on an EBCDIC system..." >&4
11311 $cat >tebcdic.c <<'EOM'
11312 int main()
11313 {
11314   if ('M'==0xd4) return 0;
11315   return 1;
11316 }
11317 EOM
11318
11319 val=$undef
11320 set tebcdic
11321 if eval $compile_ok; then
11322         if ./tebcdic; then
11323                 echo "You have EBCDIC." >&4
11324                 val="$define"
11325         else
11326                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
11327         fi
11328 else
11329         echo "I'm unable to compile the test program." >&4
11330         echo "I'll assume ASCII or some ISO Latin." >&4
11331 fi
11332 $rm -f tebcdic.c tebcdic
11333 set ebcdic
11334 eval $setvar
11335
11336 echo " "
11337 $cat >&4 <<EOM
11338 Checking how to flush all pending stdio output...
11339 EOM
11340 # I only know how to find the first 32 possibly open files on SunOS.
11341 # See also hints/sunos_4_1.sh and util.c  --AD
11342 case "$osname" in
11343 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11344 esac
11345 $cat >>try.c <<EOCP
11346 #include <stdio.h>
11347 #$i_unistd I_UNISTD
11348 #ifdef I_UNISTD
11349 # include <unistd.h>
11350 #endif
11351 #$d_sysconf HAS_SYSCONF
11352 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11353 #ifdef HAS_STDIO_STREAM_ARRAY
11354 # define STDIO_STREAM_ARRAY $stdio_stream_array
11355 #endif
11356 int main() {
11357   FILE* p = fopen("try.out", "w");
11358 #ifdef TRY_FPUTC
11359   fputc('x', p);
11360 #else
11361 # ifdef TRY_FPRINTF
11362   fprintf(p, "x");
11363 # endif
11364 #endif
11365 #ifdef TRY_FFLUSH_NULL
11366   fflush(NULL);
11367 #endif
11368 #ifdef TRY_FFLUSH_ALL
11369   {
11370     long open_max = -1;
11371 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11372     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11373 # else
11374 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11375     open_max = sysconf(_SC_OPEN_MAX);
11376 #  else
11377 #   ifdef FOPEN_MAX
11378     open_max = FOPEN_MAX;
11379 #   else
11380 #    ifdef OPEN_MAX
11381     open_max = OPEN_MAX;
11382 #    else
11383 #     ifdef _NFILE
11384     open_max = _NFILE;
11385 #     endif
11386 #    endif
11387 #   endif
11388 #  endif
11389 # endif 
11390 # ifdef HAS_STDIO_STREAM_ARRAY
11391     if (open_max > 0) {
11392       long i;
11393       for (i = 0; i < open_max; i++)
11394             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11395                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11396                 STDIO_STREAM_ARRAY[i]._flag)
11397                 fflush(&STDIO_STREAM_ARRAY[i]);
11398     }   
11399   }
11400 # endif
11401 #endif
11402   _exit(42);
11403 }
11404 EOCP
11405 : first we have to find out how _not_ to flush
11406 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11407     output=''
11408     set try -DTRY_FPUTC
11409     if eval $compile; then
11410             $rm -f try.out
11411             ./try$exe_ext 2>/dev/null
11412             if $test ! -s try.out -a "X$?" = X42; then
11413                 output=-DTRY_FPUTC
11414             fi
11415     fi
11416     case "$output" in
11417     '')
11418             set try -DTRY_FPRINTF
11419             $rm -f try.out
11420             if eval $compile; then
11421                     $rm -f try.out
11422                     ./try$exe_ext 2>/dev/null
11423                     if $test ! -s try.out -a "X$?" = X42; then
11424                         output=-DTRY_FPRINTF
11425                     fi
11426             fi
11427         ;;
11428     esac
11429 fi
11430 : check for fflush NULL behaviour
11431 case "$fflushNULL" in
11432 '')     set try -DTRY_FFLUSH_NULL $output
11433         if eval $compile; then
11434                 $rm -f try.out
11435                 ./try$exe_ext 2>/dev/null
11436                 code="$?"
11437                 if $test -s try.out -a "X$code" = X42; then
11438                         fflushNULL="`$cat try.out`"
11439                 else
11440                         if $test "X$code" != X42; then
11441                                 $cat >&4 <<EOM
11442 (If this test failed, don't worry, we'll try another method shortly.)
11443 EOM
11444                         fi
11445                 fi
11446         fi
11447         $rm -f core try.core core.try.*
11448         case "$fflushNULL" in
11449         x)      $cat >&4 <<EOM
11450 Your fflush(NULL) works okay.
11451 EOM
11452                 fflushNULL="$define"
11453                 ;;
11454         '')     $cat >&4 <<EOM
11455 Your fflush(NULL) isn't working (contrary to ANSI C).
11456 EOM
11457                 fflushNULL="$undef"
11458                 ;;
11459         *)      $cat >&4 <<EOM
11460 Cannot figure out whether your fflush(NULL) works or not.
11461 I'm assuming it doesn't (contrary to ANSI C).
11462 EOM
11463                 fflushNULL="$undef"
11464                 ;;
11465         esac
11466         ;;
11467 $define|true|[yY]*)
11468         fflushNULL="$define"
11469         ;;
11470 *)
11471         fflushNULL="$undef"
11472         ;;
11473 esac
11474 : check explicit looping only if NULL did not work
11475 case "$fflushNULL" in
11476 "$undef")
11477         : check for fflush all behaviour
11478         case "$fflushall" in
11479         '')     set try -DTRY_FFLUSH_ALL $output
11480                 if eval $compile; then
11481                         $cat >&4 <<EOM
11482 (Now testing the other method--but note that also this may fail.)
11483 EOM
11484                         $rm -f try.out
11485                         ./try$exe_ext 2>/dev/null
11486                         if $test -s try.out -a "X$?" = X42; then
11487                                 fflushall="`$cat try.out`"
11488                         fi
11489                 fi
11490                 $rm -f core try.core core.try.*
11491                 case "$fflushall" in
11492                 x)      $cat >&4 <<EOM
11493 Whew. Flushing explicitly all the stdio streams works.
11494 EOM
11495                         fflushall="$define"
11496                         ;;
11497                 '')     $cat >&4 <<EOM
11498 Sigh. Flushing explicitly all the stdio streams doesn't work.
11499 EOM
11500                         fflushall="$undef"
11501                         ;;
11502                 *)      $cat >&4 <<EOM
11503 Cannot figure out whether flushing stdio streams explicitly works or not.
11504 I'm assuming it doesn't.
11505 EOM
11506                         fflushall="$undef"
11507                         ;;
11508                 esac
11509                 ;;
11510         "$define"|true|[yY]*)
11511                 fflushall="$define"
11512                 ;;
11513         *)
11514                 fflushall="$undef"
11515                 ;;
11516         esac
11517         ;;
11518 *)      fflushall="$undef"      
11519         ;;
11520 esac
11521 case "$fflushNULL$fflushall" in
11522 undefundef)
11523         $cat <<EOM
11524 I cannot figure out how to flush pending stdio output.
11525 EOM
11526         ;;
11527 esac
11528 $rm -f try.* try$exe_ext
11529
11530 : see what type file positions are declared as in the library
11531 rp="What is the type for file position used by fsetpos()?"
11532 set fpos_t fpostype long stdio.h sys/types.h
11533 eval $typedef_ask
11534
11535 : Store the full pathname to the ar program for use in the C program
11536 : Respect a hint or command line value for full_ar.
11537 case "$full_ar" in
11538 '') full_ar=$ar ;;
11539 esac
11540
11541 : Store the full pathname to the sed program for use in the C program
11542 full_sed=$sed
11543
11544 : see what type gids are declared as in the kernel
11545 echo " "
11546 echo "Looking for the type for group ids returned by getgid()."
11547 set gid_t gidtype xxx stdio.h sys/types.h
11548 eval $typedef
11549 case "$gidtype" in
11550 xxx)
11551         xxx=`./findhdr sys/user.h`
11552         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11553         case $1 in
11554         unsigned) dflt="$1 $2" ;;
11555         *) dflt="$1" ;;
11556         esac
11557         ;;
11558 *) dflt="$gidtype";;
11559 esac
11560 case "$gidtype" in
11561 gid_t) echo "gid_t found." ;;
11562 *)      rp="What is the type for group ids returned by getgid()?"
11563         . ./myread
11564         gidtype="$ans"
11565         ;;
11566 esac
11567
11568 : see if getgroups exists
11569 set getgroups d_getgrps
11570 eval $inlibc
11571
11572 : see if setgroups exists
11573 set setgroups d_setgrps
11574 eval $inlibc
11575
11576
11577 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11578 echo " "
11579 case "$d_getgrps$d_setgrps" in
11580 *define*)
11581         case "$groupstype" in
11582         '') dflt="$gidtype" ;;
11583         *)  dflt="$groupstype" ;;
11584         esac
11585         $cat <<EOM
11586 What type of pointer is the second argument to getgroups() and setgroups()?
11587 Usually this is the same as group ids, $gidtype, but not always.
11588
11589 EOM
11590         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11591         . ./myread
11592         groupstype="$ans"
11593         ;;
11594 *)  groupstype="$gidtype";;
11595 esac
11596
11597 : see what type lseek is declared as in the kernel
11598 rp="What is the type used for lseek's offset on this system?"
11599 set off_t lseektype long stdio.h sys/types.h
11600 eval $typedef_ask
11601
11602 echo " "
11603 $echo $n "Checking to see how big your file offsets are...$c" >&4
11604 $cat >try.c <<EOCP
11605 #include <sys/types.h>
11606 #include <stdio.h>
11607 int main()
11608 {
11609         printf("%d\n", sizeof($lseektype));
11610 }
11611 EOCP
11612 set try
11613 if eval $compile_ok; then
11614         lseeksize=`./try`
11615         $echo " $lseeksize bytes." >&4
11616 else
11617         dflt='4'
11618         echo " "
11619         echo "(I can't seem to compile the test program.  Guessing...)"
11620         rp="What is the size of your file offsets (in bytes)?"
11621         . ./myread
11622         lseeksize="$ans"
11623 fi
11624 $rm -f try.c try
11625
11626 echo " "
11627 echo "Checking if your $make program sets \$(MAKE)..." >&4
11628 case "$make_set_make" in
11629 '')
11630         $sed 's/^X //' > testmake.mak << 'EOF'
11631 Xall:
11632 X       @echo 'maketemp="$(MAKE)"'
11633 EOF
11634         case "`$make -f testmake.mak 2>/dev/null`" in
11635         *maketemp=*) make_set_make='#' ;;
11636         *)      make_set_make="MAKE=$make" ;;
11637         esac
11638         $rm -f testmake.mak
11639         ;;
11640 esac
11641 case "$make_set_make" in
11642 '#') echo "Yup, it does.";;
11643 *) echo "Nope, it doesn't.";;
11644 esac
11645
11646 : see what type is used for mode_t
11647 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11648 set mode_t modetype int stdio.h sys/types.h
11649 eval $typedef_ask
11650
11651 : define a fucntion to check prototypes
11652 $cat > protochk <<EOSH
11653 $startsh
11654 cc="$cc"
11655 optimize="$optimize"
11656 ccflags="$ccflags"
11657 prototype="$prototype"
11658 define="$define"
11659 rm=$rm
11660 EOSH
11661
11662 $cat >> protochk <<'EOSH'
11663
11664 $rm -f try.c
11665 foo="$1"
11666 shift
11667 while test $# -ge 2; do
11668         case "$1" in
11669                 $define) echo "#include <$2>" >> try.c ;;
11670                 literal) echo "$2" >> try.c ;;
11671         esac
11672     shift 2
11673 done
11674 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11675 cat >> try.c <<'EOCP'
11676 #ifdef CAN_PROTOTYPE
11677 #define _(args) args
11678 #else
11679 #define _(args) ()
11680 #endif
11681 EOCP
11682 echo "$foo" >> try.c
11683 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11684 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11685 status=$?
11686 $rm -f try.[co]
11687 exit $status
11688 EOSH
11689 chmod +x protochk
11690 $eunicefix protochk
11691
11692 : see what type is used for size_t
11693 rp="What is the type used for the length parameter for string functions?"
11694 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11695 eval $typedef_ask
11696
11697 : check for type of arguments to gethostbyaddr. 
11698 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11699         case "$d_gethbyaddr" in
11700         $define)
11701                 $cat <<EOM
11702
11703 Checking to see what type of arguments are accepted by gethostbyaddr().
11704 EOM
11705                 hdrs="$define sys/types.h
11706                         $d_socket sys/socket.h 
11707                         $i_niin netinet/in.h 
11708                         $i_netdb netdb.h
11709                         $i_unistd unistd.h"
11710                 : The first arg can 'char *' or 'void *'
11711                 : The second arg is some of integral type
11712                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11713                         for yyy in size_t long int; do
11714                                 case "$netdb_host_type" in
11715                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11716                                         if ./protochk "$try" $hdrs; then
11717                                                 echo "Your system accepts $xxx for the first arg."
11718                                                 echo "...and $yyy for the second arg."
11719                                                 netdb_host_type="$xxx"
11720                                                 netdb_hlen_type="$yyy"
11721                                         fi
11722                                         ;;
11723                                 esac
11724                         done
11725                 done
11726                 : In case none of those worked, prompt the user.
11727                 case "$netdb_host_type" in
11728                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11729                         dflt='char *'
11730                         . ./myread
11731                         netdb_host_type=$ans
11732                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11733                         dflt="$sizetype"
11734                         . ./myread
11735                         netdb_hlen_type=$ans
11736                         ;;
11737                 esac
11738                 ;;
11739         *)      : no gethostbyaddr, so pick harmless defaults
11740                 netdb_host_type='char *'
11741                 netdb_hlen_type="$sizetype"
11742                 ;;
11743         esac
11744         # Remove the "const" if needed. -- but then we'll have a 
11745         # prototype clash!
11746         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11747 fi
11748
11749 : check for type of argument to gethostbyname. 
11750 if test "X$netdb_name_type" = X ; then
11751         case "$d_gethbyname" in
11752         $define)
11753                 $cat <<EOM
11754
11755 Checking to see what type of argument is accepted by gethostbyname().
11756 EOM
11757                 hdrs="$define sys/types.h
11758                         $d_socket sys/socket.h 
11759                         $i_niin netinet/in.h 
11760                         $i_netdb netdb.h
11761                         $i_unistd unistd.h"
11762                 for xxx in "const char *" "char *"; do
11763                         case "$netdb_name_type" in
11764                         '')     try="extern struct hostent *gethostbyname($xxx);"
11765                                 if ./protochk "$try" $hdrs; then
11766                                         echo "Your system accepts $xxx."
11767                                         netdb_name_type="$xxx"
11768                                 fi
11769                                 ;;
11770                         esac
11771                 done
11772                 : In case none of those worked, prompt the user.
11773                 case "$netdb_name_type" in
11774                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11775                         dflt='char *'
11776                         . ./myread
11777                         netdb_name_type=$ans
11778                         ;;
11779                 esac
11780                 ;;
11781         *)      : no gethostbyname, so pick harmless default
11782                 netdb_name_type='char *'
11783                 ;;
11784         esac
11785 fi
11786
11787 : check for type of 1st argument to getnetbyaddr. 
11788 if test "X$netdb_net_type" = X ; then
11789         case "$d_getnbyaddr" in
11790         $define)
11791                 $cat <<EOM
11792
11793 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11794 EOM
11795                 hdrs="$define sys/types.h
11796                         $d_socket sys/socket.h 
11797                         $i_niin netinet/in.h 
11798                         $i_netdb netdb.h
11799                         $i_unistd unistd.h"
11800                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11801                         case "$netdb_net_type" in
11802                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11803                                 if ./protochk "$try" $hdrs; then
11804                                         echo "Your system accepts $xxx."
11805                                         netdb_net_type="$xxx"
11806                                 fi
11807                                 ;;
11808                         esac
11809                 done
11810                 : In case none of those worked, prompt the user.
11811                 case "$netdb_net_type" in
11812                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11813                         dflt='long'
11814                         . ./myread
11815                         netdb_net_type=$ans
11816                         ;;
11817                 esac
11818                 ;;
11819         *)      : no getnetbyaddr, so pick harmless default
11820                 netdb_net_type='long'
11821                 ;;
11822         esac
11823 fi
11824 : locate the preferred pager for this system
11825 case "$pager" in
11826 '')
11827         dflt=''
11828         case "$pg" in
11829         /*) dflt=$pg;;
11830         esac
11831         case "$more" in
11832         /*) dflt=$more;;
11833         esac
11834         case "$less" in
11835         /*) dflt=$less;;
11836         esac
11837         case "$dflt" in
11838         '') dflt=/usr/ucb/more;;
11839         esac
11840         ;;
11841 *) dflt="$pager";;
11842 esac
11843 echo " "
11844 fn=f/
11845 rp='What pager is used on your system?'
11846 . ./getfile
11847 pager="$ans"
11848
11849 : see what type pids are declared as in the kernel
11850 rp="What is the type of process ids on this system?"
11851 set pid_t pidtype int stdio.h sys/types.h
11852 eval $typedef_ask
11853
11854 : check for length of pointer
11855 echo " "
11856 case "$ptrsize" in
11857 '')
11858         $echo $n "Checking to see how big your pointers are...$c" >&4
11859         if test "$voidflags" -gt 7; then
11860                 echo '#define VOID_PTR char *' > try.c
11861         else
11862                 echo '#define VOID_PTR void *' > try.c
11863         fi
11864         $cat >>try.c <<'EOCP'
11865 #include <stdio.h>
11866 int main()
11867 {
11868         printf("%d\n", sizeof(VOID_PTR));
11869         exit(0);
11870 }
11871 EOCP
11872         set try
11873         if eval $compile_ok; then
11874                 ptrsize=`./try`
11875                 $echo " $ptrsize bytes." >&4
11876         else
11877                 dflt='4'
11878                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11879                 rp="What is the size of a pointer (in bytes)?"
11880                 . ./myread
11881                 ptrsize="$ans"
11882         fi
11883         ;;
11884 esac
11885 $rm -f try.c try
11886
11887 : see if ar generates random libraries by itself
11888 echo " "
11889 echo "Checking how to generate random libraries on your machine..." >&4
11890 echo 'int bar1() { return bar2(); }' > bar1.c
11891 echo 'int bar2() { return 2; }' > bar2.c
11892 $cat > foo.c <<'EOP'
11893 int main() { printf("%d\n", bar1()); exit(0); }
11894 EOP
11895 $cc $ccflags -c bar1.c >/dev/null 2>&1
11896 $cc $ccflags -c bar2.c >/dev/null 2>&1
11897 $cc $ccflags -c foo.c >/dev/null 2>&1
11898 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11899 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11900         ./foobar >/dev/null 2>&1; then
11901         echo "$ar appears to generate random libraries itself."
11902         orderlib=false
11903         ranlib=":"
11904 elif $ar ts bar$_a >/dev/null 2>&1 &&
11905         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11906         ./foobar >/dev/null 2>&1; then
11907                 echo "a table of contents needs to be added with '$ar ts'."
11908                 orderlib=false
11909                 ranlib="$ar ts"
11910 else
11911         case "$ranlib" in
11912         :) ranlib='';;
11913         '')
11914                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11915                 $test -f $ranlib || ranlib=''
11916                 ;;
11917         esac
11918         if $test -n "$ranlib"; then
11919                 echo "your system has '$ranlib'; we'll use that."
11920                 orderlib=false
11921         else
11922                 echo "your system doesn't seem to support random libraries"
11923                 echo "so we'll use lorder and tsort to order the libraries."
11924                 orderlib=true
11925                 ranlib=":"
11926         fi
11927 fi
11928 $rm -f foo* bar* 
11929
11930 : check for type of arguments to select. 
11931 case "$selecttype" in
11932 '') case "$d_select" in
11933         $define)
11934                 $cat <<EOM
11935 Checking to see what type of arguments are accepted by select().
11936 EOM
11937                 hdrs="$define sys/types.h
11938                         $i_systime sys/time.h 
11939                         $i_sysselct sys/select.h
11940                         $d_socket sys/socket.h"
11941                 : The first arg can be int, unsigned, or size_t
11942                 : The last arg may or may not be 'const'
11943                 val=''
11944                 : void pointer has been seen but using that
11945                 : breaks the selectminbits test
11946                 for xxx in 'fd_set *' 'int *'; do
11947                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
11948                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
11949                                         case "$val" in
11950                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
11951                                                 if ./protochk "$try" $hdrs; then
11952                                                         echo "Your system accepts $xxx."
11953                                                         val="$xxx"
11954                                                 fi
11955                                                 ;;
11956                                         esac
11957                                 done
11958                         done
11959                 done
11960                 case "$val" in
11961                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
11962                         case "$d_fd_set" in
11963                                 $define) dflt="fd_set *" ;;
11964                                 *)              dflt="int *" ;;
11965                         esac
11966                         . ./myread
11967                         val=$ans
11968                         ;;
11969                 esac
11970                 selecttype="$val"
11971                 ;;
11972         *)      : no select, so pick a harmless default
11973                 selecttype='int *'
11974                 ;;
11975         esac
11976         ;;
11977 esac
11978
11979 : check for the select 'width'
11980 case "$selectminbits" in
11981 '') case "$d_select" in
11982         $define)
11983                 $cat <<EOM
11984
11985 Checking to see on how many bits at a time your select() operates...
11986 EOM
11987                 $cat >try.c <<EOCP
11988 #include <sys/types.h>
11989 #$i_time I_TIME
11990 #$i_systime I_SYS_TIME
11991 #$i_systimek I_SYS_TIME_KERNEL
11992 #ifdef I_TIME
11993 #   include <time.h>
11994 #endif
11995 #ifdef I_SYS_TIME
11996 #   ifdef I_SYS_TIME_KERNEL
11997 #       define KERNEL
11998 #   endif
11999 #   include <sys/time.h>
12000 #   ifdef I_SYS_TIME_KERNEL
12001 #       undef KERNEL
12002 #   endif
12003 #endif
12004 #$i_sysselct I_SYS_SELECT
12005 #ifdef I_SYS_SELECT
12006 #include <sys/select.h>
12007 #endif
12008 #$d_socket HAS_SOCKET
12009 #ifdef HAS_SOCKET
12010 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12011 #endif
12012 #include <stdio.h>
12013 $selecttype b;
12014 #define S sizeof(*(b))
12015 #define MINBITS 64
12016 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12017 #define NBITS  (NBYTES * 8)
12018 int main() {
12019     char s[NBYTES];
12020     struct timeval t;
12021     int i;
12022     FILE* fp;
12023     int fd;
12024
12025     fclose(stdin);
12026     fp = fopen("try.c", "r");
12027     if (fp == 0)
12028       exit(1);
12029     fd = fileno(fp);
12030     if (fd < 0)
12031       exit(2);
12032     b = ($selecttype)s;
12033     for (i = 0; i < NBITS; i++)
12034         FD_SET(i, b);
12035     t.tv_sec  = 0;
12036     t.tv_usec = 0;
12037     select(fd + 1, b, 0, 0, &t);
12038     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12039     printf("%d\n", i + 1);
12040     return 0;
12041 }
12042 EOCP
12043                 set try
12044                 if eval $compile_ok; then
12045                         selectminbits=`./try`
12046                         case "$selectminbits" in
12047                         '')     cat >&4 <<EOM
12048 Cannot figure out on how many bits at a time your select() operates.
12049 I'll play safe and guess it is 32 bits.
12050 EOM
12051                                 selectminbits=32
12052                                 bits="32 bits"
12053                                 ;;
12054                         1)      bits="1 bit" ;;
12055                         *)      bits="$selectminbits bits" ;;
12056                         esac
12057                         echo "Your select() operates on $bits at a time." >&4
12058                 else
12059                         rp='What is the minimum number of bits your select() operates on?'
12060                         case "$byteorder" in
12061                         1234|12345678)  dflt=32 ;;
12062                         *)              dflt=1  ;;
12063                         esac
12064                         . ./myread
12065                         val=$ans
12066                         selectminbits="$val"
12067                 fi
12068                 $rm -f try.* try
12069                 ;;
12070         *)      : no select, so pick a harmless default
12071                 selectminbits='32'
12072                 ;;
12073         esac
12074         ;;
12075 esac
12076
12077 : Trace out the files included by signal.h, then look for SIGxxx names.
12078 : Remove SIGARRAYSIZE used by HPUX.
12079 : Remove SIGSTKSIZE used by Linux.
12080 : Remove SIGSTKSZ used by Posix.
12081 : Remove SIGTYP void lines used by OS2.
12082 xxx=`echo '#include <signal.h>' |
12083         $cppstdin $cppminus $cppflags 2>/dev/null |
12084         $grep '^[       ]*#.*include' | 
12085         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12086 : Check this list of files to be sure we have parsed the cpp output ok.
12087 : This will also avoid potentially non-existent files, such 
12088 : as ../foo/bar.h
12089 xxxfiles=''
12090 for xx in $xxx /dev/null ; do
12091         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12092 done
12093 : If we have found no files, at least try signal.h
12094 case "$xxxfiles" in
12095 '')     xxxfiles=`./findhdr signal.h` ;;
12096 esac
12097 xxx=`awk '
12098 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12099         print substr($2, 4, 20)
12100 }
12101 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12102         print substr($3, 4, 20)
12103 }' $xxxfiles`
12104 : Append some common names just in case the awk scan failed.
12105 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12106 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12107 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12108 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12109 : generate a few handy files for later
12110 $cat > signal.c <<'EOCP'
12111 #include <sys/types.h>
12112 #include <signal.h>
12113 #include <stdio.h>
12114 int main() {
12115
12116 /* Strange style to avoid deeply-nested #if/#else/#endif */
12117 #ifndef NSIG
12118 #  ifdef _NSIG
12119 #    define NSIG (_NSIG)
12120 #  endif
12121 #endif
12122
12123 #ifndef NSIG
12124 #  ifdef SIGMAX
12125 #    define NSIG (SIGMAX+1)
12126 #  endif
12127 #endif
12128
12129 #ifndef NSIG
12130 #  ifdef SIG_MAX
12131 #    define NSIG (SIG_MAX+1)
12132 #  endif
12133 #endif
12134
12135 #ifndef NSIG
12136 #  ifdef MAXSIG
12137 #    define NSIG (MAXSIG+1)
12138 #  endif
12139 #endif
12140
12141 #ifndef NSIG
12142 #  ifdef MAX_SIG
12143 #    define NSIG (MAX_SIG+1)
12144 #  endif
12145 #endif
12146
12147 #ifndef NSIG
12148 #  ifdef SIGARRAYSIZE
12149 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12150 #  endif
12151 #endif
12152
12153 #ifndef NSIG
12154 #  ifdef _sys_nsig
12155 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12156 #  endif
12157 #endif
12158
12159 /* Default to some arbitrary number that's big enough to get most
12160    of the common signals.
12161 */
12162 #ifndef NSIG
12163 #    define NSIG 50
12164 #endif
12165
12166 printf("NSIG %d\n", NSIG);
12167
12168 #ifndef JUST_NSIG
12169
12170 EOCP
12171
12172 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12173 {
12174         printf "#ifdef SIG"; printf $1; printf "\n"
12175         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12176         printf $1; printf ");\n"
12177         printf "#endif\n"
12178 }
12179 END {
12180         printf "#endif /* JUST_NSIG */\n";
12181         printf "}\n";
12182 }
12183 ' >>signal.c
12184 $cat >signal.awk <<'EOP'
12185 BEGIN { ndups = 0 }
12186 $1 ~ /^NSIG$/ { nsig = $2 }
12187 ($1 !~ /^NSIG$/) && (NF == 2) {
12188     if ($2 > maxsig) { maxsig = $2 }
12189     if (sig_name[$2]) {
12190         dup_name[ndups] = $1
12191         dup_num[ndups] = $2
12192         ndups++ 
12193     }
12194     else {
12195         sig_name[$2] = $1
12196         sig_num[$2] = $2
12197     }
12198 }
12199 END { 
12200     if (nsig == 0) {
12201         nsig = maxsig + 1
12202     }
12203     printf("NSIG %d\n", nsig);
12204     for (n = 1; n < nsig; n++) {
12205         if (sig_name[n]) {
12206             printf("%s %d\n", sig_name[n], sig_num[n])
12207         }
12208         else {
12209             printf("NUM%d %d\n", n, n) 
12210         }
12211     }
12212     for (n = 0; n < ndups; n++) {
12213         printf("%s %d\n", dup_name[n], dup_num[n])
12214     }
12215 }
12216 EOP
12217 $cat >signal_cmd <<EOS
12218 $startsh
12219 if $test -s signal.lst; then
12220     echo "Using your existing signal.lst file"
12221         exit 0
12222 fi
12223 xxx="$xxx"
12224 EOS
12225 $cat >>signal_cmd <<'EOS'
12226
12227 set signal
12228 if eval $compile_ok; then
12229         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12230 else
12231         echo "(I can't seem be able to compile the whole test program)" >&4
12232         echo "(I'll try it in little pieces.)" >&4
12233         set signal -DJUST_NSIG
12234         if eval $compile_ok; then
12235                 ./signal$_exe > signal.nsg
12236                 $cat signal.nsg
12237         else
12238                 echo "I can't seem to figure out how many signals you have." >&4
12239                 echo "Guessing 50." >&4
12240                 echo 'NSIG 50' > signal.nsg
12241         fi
12242         : Now look at all the signal names, one at a time.
12243         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12244                 $cat > signal.c <<EOCP
12245 #include <sys/types.h>
12246 #include <signal.h>
12247 #include <stdio.h>
12248 int main() {
12249 printf("$xx %d\n", SIG${xx});
12250 return 0;
12251 }
12252 EOCP
12253                 set signal
12254                 if eval $compile; then
12255                         echo "SIG${xx} found."
12256                         ./signal$_exe  >> signal.ls1
12257                 else
12258                         echo "SIG${xx} NOT found."
12259                 fi
12260         done
12261         if $test -s signal.ls1; then
12262                 $cat signal.nsg signal.ls1 |
12263                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12264         fi
12265
12266 fi
12267 if $test -s signal.lst; then
12268         :
12269 else
12270         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12271         echo 'kill -l' >signal
12272         set X `csh -f <signal`
12273         $rm -f signal
12274         shift
12275         case $# in
12276         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12277         esac
12278         echo $@ | $tr ' ' $trnl | \
12279             $awk '{ printf "%s %d\n", $1, ++s; }
12280                   END { printf "NSIG %d\n", ++s }' >signal.lst
12281 fi
12282 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12283 EOS
12284 chmod a+x signal_cmd
12285 $eunicefix signal_cmd
12286
12287 : generate list of signal names
12288 echo " "
12289 case "$sig_name_init" in
12290 '') doinit=yes ;;
12291 *)  case "$sig_num_init" in
12292     ''|*,*) doinit=yes ;;
12293     esac ;;
12294 esac
12295 case "$doinit" in
12296 yes)
12297         echo "Generating a list of signal names and numbers..." >&4
12298         . ./signal_cmd
12299         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12300         sig_name=`$awk 'BEGIN { printf "ZERO " }
12301                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12302         sig_num=`$awk  'BEGIN { printf "0 " }
12303                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12304         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12305                              !/^NSIG/   { printf "\"%s\", ", $1 }
12306                              END        { printf "0\n" }' signal.lst`
12307         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12308                              !/^NSIG/   { printf "%d, ", $2}
12309                              END        { printf "0\n"}' signal.lst`
12310         ;;
12311 esac
12312 echo "The following $sig_count signals are available:"
12313 echo " "
12314 echo $sig_name | $awk \
12315 'BEGIN { linelen = 0 }
12316 {
12317         for (i = 1; i <= NF; i++) {
12318                 name = "SIG" $i " "
12319                 linelen = linelen + length(name)
12320                 if (linelen > 70) {
12321                         printf "\n"
12322                         linelen = length(name)
12323                 }
12324                 printf "%s", name
12325         }
12326         printf "\n"
12327 }'
12328 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12329
12330 : see what type is used for signed size_t
12331 set ssize_t ssizetype int stdio.h sys/types.h
12332 eval $typedef
12333 dflt="$ssizetype"
12334 $cat > ssize.c <<EOM
12335 #include <stdio.h>
12336 #include <sys/types.h>
12337 #define Size_t $sizetype
12338 #define SSize_t $dflt
12339 int main()
12340 {
12341         if (sizeof(Size_t) == sizeof(SSize_t))
12342                 printf("$dflt\n");
12343         else if (sizeof(Size_t) == sizeof(int))
12344                 printf("int\n");
12345         else 
12346                 printf("long\n");
12347         exit(0);
12348 }
12349 EOM
12350 echo " "
12351 set ssize
12352 if eval $compile_ok && ./ssize > /dev/null; then
12353         ssizetype=`./ssize`
12354         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12355 else
12356         $cat >&4 <<EOM
12357 Help! I can't compile and run the ssize_t test program: please enlighten me!
12358 (This is probably a misconfiguration in your system or libraries, and
12359 you really ought to fix it.  Still, I'll try anyway.)
12360
12361 I need a type that is the same size as $sizetype, but is guaranteed to
12362 be signed.  Common values are ssize_t, int and long.
12363
12364 EOM
12365         rp="What signed type is the same size as $sizetype?"
12366         . ./myread
12367         ssizetype="$ans"
12368 fi
12369 $rm -f ssize ssize.*
12370
12371 : see what type of char stdio uses.
12372 echo " "
12373 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12374         echo "Your stdio uses unsigned chars." >&4
12375         stdchar="unsigned char"
12376 else
12377         echo "Your stdio uses signed chars." >&4
12378         stdchar="char"
12379 fi
12380
12381 : see if time exists
12382 echo " "
12383 if test "X$d_time" = X -o X"$timetype" = X; then
12384     if set time val -f d_time; eval $csym; $val; then
12385                 echo 'time() found.' >&4
12386                 val="$define"
12387                 rp="What is the type returned by time() on this system?"
12388                 set time_t timetype long stdio.h sys/types.h
12389                 eval $typedef_ask
12390     else
12391                 echo 'time() not found, hope that will do.' >&4
12392                 val="$undef"
12393                 timetype='int';
12394     fi
12395     set d_time
12396     eval $setvar
12397 fi
12398
12399 : see what type uids are declared as in the kernel
12400 echo " "
12401 echo "Looking for the type for user ids returned by getuid()."
12402 set uid_t uidtype xxx stdio.h sys/types.h
12403 eval $typedef
12404 case "$uidtype" in
12405 xxx)
12406         xxx=`./findhdr sys/user.h`
12407         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12408         case $1 in
12409         unsigned) dflt="$1 $2" ;;
12410         *) dflt="$1" ;;
12411         esac
12412         ;;
12413 *) dflt="$uidtype";;
12414 esac
12415 case "$uidtype" in
12416 uid_t)  echo "uid_t found." ;;
12417 *)      rp="What is the type for user ids returned by getuid()?"
12418         . ./myread
12419         uidtype="$ans"
12420         ;;
12421 esac
12422
12423 : see if dbm.h is available
12424 : see if dbmclose exists
12425 set dbmclose d_dbmclose
12426 eval $inlibc
12427
12428 case "$d_dbmclose" in
12429 $define)
12430         set dbm.h i_dbm
12431         eval $inhdr
12432         case "$i_dbm" in
12433         $define)
12434                 val="$undef"
12435                 set i_rpcsvcdbm
12436                 eval $setvar
12437                 ;;
12438         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12439                 eval $inhdr
12440                 ;;
12441         esac
12442         ;;
12443 *)      echo "We won't be including <dbm.h>"
12444         val="$undef"
12445         set i_dbm
12446         eval $setvar
12447         val="$undef"
12448         set i_rpcsvcdbm
12449         eval $setvar
12450         ;;
12451 esac
12452
12453 : see if this is a sys/file.h system
12454 val=''
12455 set sys/file.h val
12456 eval $inhdr
12457
12458 : do we need to include sys/file.h ?
12459 case "$val" in
12460 "$define")
12461         echo " "
12462         if $h_sysfile; then
12463                 val="$define"
12464                 echo "We'll be including <sys/file.h>." >&4
12465         else
12466                 val="$undef"
12467                 echo "We won't be including <sys/file.h>." >&4
12468         fi
12469         ;;
12470 *)
12471         h_sysfile=false
12472         ;;
12473 esac
12474 set i_sysfile
12475 eval $setvar
12476
12477 : see if fcntl.h is there
12478 val=''
12479 set fcntl.h val
12480 eval $inhdr
12481
12482 : see if we can include fcntl.h
12483 case "$val" in
12484 "$define")
12485         echo " "
12486         if $h_fcntl; then
12487                 val="$define"
12488                 echo "We'll be including <fcntl.h>." >&4
12489         else
12490                 val="$undef"
12491                 if $h_sysfile; then
12492         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12493                 else
12494                         echo "We won't be including <fcntl.h>." >&4
12495                 fi
12496         fi
12497         ;;
12498 *)
12499         h_fcntl=false
12500         val="$undef"
12501         ;;
12502 esac
12503 set i_fcntl
12504 eval $setvar
12505
12506 : see if locale.h is available
12507 set locale.h i_locale
12508 eval $inhdr
12509
12510 : see if mach cthreads are available
12511 if test "X$usethreads" = "X$define"; then
12512         set mach/cthreads.h i_machcthr
12513         eval $inhdr
12514 else
12515         i_machcthr="$undef"
12516 fi
12517
12518
12519
12520 : see if this is a math.h system
12521 set math.h i_math
12522 eval $inhdr
12523
12524 : see if this is a mntent.h system
12525 set mntent.h i_mntent
12526 eval $inhdr
12527
12528 : see if ndbm.h is available
12529 set ndbm.h t_ndbm
12530 eval $inhdr
12531 case "$t_ndbm" in
12532 $define)
12533         : see if dbm_open exists
12534         set dbm_open d_dbm_open
12535         eval $inlibc
12536         case "$d_dbm_open" in
12537         $undef)
12538                 t_ndbm="$undef"
12539                 echo "We won't be including <ndbm.h>"
12540                 ;;
12541         esac
12542         ;;
12543 esac
12544 val="$t_ndbm"
12545 set i_ndbm
12546 eval $setvar
12547
12548 : see if net/errno.h is available
12549 val=''
12550 set net/errno.h val
12551 eval $inhdr
12552
12553 : Unfortunately, it causes problems on some systems.  Arrgh.
12554 case "$val" in
12555 $define)
12556         cat > try.c <<'EOM'
12557 #include <stdio.h>
12558 #include <errno.h>
12559 #include <net/errno.h>
12560 int func()
12561 {
12562         return ENOTSOCK;
12563 }
12564 EOM
12565         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12566                 echo "We'll be including <net/errno.h>." >&4
12567         else
12568                 echo "We won't be including <net/errno.h>." >&4
12569                 val="$undef"
12570         fi
12571         $rm -f try.* try
12572         ;;
12573 esac
12574 set i_neterrno
12575 eval $setvar
12576
12577 : see if netinet/tcp.h is available
12578 set netinet/tcp.h i_netinettcp
12579 eval $inhdr
12580
12581 : see if this is a poll.h system
12582 set poll.h i_poll
12583 eval $inhdr
12584
12585 : get C preprocessor symbols handy
12586 echo " "
12587 $echo $n "Hmm... $c"
12588 echo $al | $tr ' ' $trnl >Cppsym.know
12589 $cat <<EOSS >Cppsym
12590 $startsh
12591 case "\$1" in
12592 -l) list=true
12593         shift
12594         ;;
12595 esac
12596 unknown=''
12597 case "\$list\$#" in
12598 1|2)
12599         for sym do
12600                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12601                         exit 0
12602                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12603                         :
12604                 else
12605                         unknown="\$unknown \$sym"
12606                 fi
12607         done
12608         set X \$unknown
12609         shift
12610         ;;
12611 esac
12612 case \$# in
12613 0) exit 1;;
12614 esac
12615 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12616 #ifdef \1\\
12617 exit 0; _ _ _ _\1\\      \1\\
12618 #endif\\
12619 /' >Cppsym\$\$
12620 echo "exit 1; _ _ _" >>Cppsym\$\$
12621 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12622 case "\$list" in
12623 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12624 *)
12625         sh Cppsym2\$\$
12626         status=\$?
12627         ;;
12628 esac
12629 $rm -f Cppsym\$\$ Cppsym2\$\$
12630 exit \$status
12631 EOSS
12632 chmod +x Cppsym
12633 $eunicefix Cppsym
12634 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12635
12636 : now check the C compiler for additional symbols
12637 postprocess_cc_v=''
12638 case "$osname" in
12639 aix) postprocess_cc_v="|$tr , ' '" ;;
12640 esac
12641 $cat >ccsym <<EOS
12642 $startsh
12643 $cat >tmp.c <<EOF
12644 extern int foo;
12645 EOF
12646 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12647 do
12648         case "\$i" in
12649         -D*) echo "\$i" | $sed 's/^-D//';;
12650         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12651         esac
12652 done
12653 $rm -f try.c
12654 EOS
12655 postprocess_cc_v=''
12656 chmod +x ccsym
12657 $eunicefix ccsym
12658 ./ccsym > ccsym1.raw
12659 if $test -s ccsym1.raw; then
12660        $sort ccsym1.raw | $uniq >ccsym.raw
12661 else
12662        mv ccsym1.raw ccsym.raw
12663 fi
12664
12665 $awk '/\=/ { print $0; next }
12666         { print $0"=1" }' ccsym.raw >ccsym.list
12667 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12668 $comm -13 ccsym.true ccsym.list >ccsym.own
12669 $comm -12 ccsym.true ccsym.list >ccsym.com
12670 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12671 also=''
12672 if $test -z ccsym.raw; then
12673         echo "Your C compiler doesn't seem to define any symbols!" >&4
12674         echo " "
12675         echo "However, your C preprocessor defines the following symbols:"
12676         $cat Cppsym.true
12677         ccsymbols=''
12678         cppsymbols=`$cat Cppsym.true`
12679         cppsymbols=`echo $cppsymbols`
12680         cppccsymbols="$cppsymbols"
12681 else
12682         if $test -s ccsym.com; then
12683                 echo "Your C compiler and pre-processor define these symbols:"
12684                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12685                 also='also '
12686                 symbols='ones'
12687                 cppccsymbols=`$cat ccsym.com`
12688                 cppccsymbols=`echo $cppccsymbols`
12689                 $test "$silent" || sleep 1
12690         fi
12691         if $test -s ccsym.cpp; then
12692                 $test "$also" && echo " "
12693                 echo "Your C pre-processor ${also}defines the following symbols:"
12694                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12695                 also='further '
12696                 cppsymbols=`$cat ccsym.cpp`
12697                 cppsymbols=`echo $cppsymbols`
12698                 $test "$silent" || sleep 1
12699         fi
12700         if $test -s ccsym.own; then
12701                 $test "$also" && echo " "
12702                 echo "Your C compiler ${also}defines the following cpp symbols:"
12703                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12704                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12705                 ccsymbols=`$cat ccsym.own`
12706                 ccsymbols=`echo $ccsymbols`
12707                 $test "$silent" || sleep 1
12708         fi
12709 fi
12710 $rm -f ccsym*
12711
12712 : see if this is a termio system
12713 val="$undef"
12714 val2="$undef"
12715 val3="$undef"
12716 if $test `./findhdr termios.h`; then
12717         set tcsetattr i_termios
12718         eval $inlibc
12719         val3="$i_termios"
12720 fi
12721 echo " "
12722 case "$val3" in
12723 "$define") echo "You have POSIX termios.h... good!" >&4;;
12724 *) if ./Cppsym pyr; then
12725                 case "`/bin/universe`" in
12726                 ucb) if $test `./findhdr sgtty.h`; then
12727                                 val2="$define"
12728                                 echo "<sgtty.h> found." >&4
12729                         else
12730                                 echo "System is pyramid with BSD universe."
12731                                 echo "<sgtty.h> not found--you could have problems." >&4
12732                         fi;;
12733                 *) if $test `./findhdr termio.h`; then
12734                                 val="$define"
12735                                 echo "<termio.h> found." >&4
12736                         else
12737                                 echo "System is pyramid with USG universe."
12738                                 echo "<termio.h> not found--you could have problems." >&4
12739                         fi;;
12740                 esac
12741         elif ./usg; then
12742                 if $test `./findhdr termio.h`; then
12743                         echo "<termio.h> found." >&4
12744                         val="$define"
12745                 elif $test `./findhdr sgtty.h`; then
12746                         echo "<sgtty.h> found." >&4
12747                         val2="$define"
12748                 else
12749 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12750                 fi
12751         else
12752                 if $test `./findhdr sgtty.h`; then
12753                         echo "<sgtty.h> found." >&4
12754                         val2="$define"
12755                 elif $test `./findhdr termio.h`; then
12756                         echo "<termio.h> found." >&4
12757                         val="$define"
12758                 else
12759 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12760                 fi
12761         fi;;
12762 esac
12763 set i_termio; eval $setvar
12764 val=$val2; set i_sgtty; eval $setvar
12765 val=$val3; set i_termios; eval $setvar
12766
12767 : see if this is a shadow.h system
12768 set shadow.h i_shadow
12769 eval $inhdr
12770
12771 : see if this is a socks.h system
12772 set socks.h i_socks
12773 eval $inhdr
12774
12775 : see if stdarg is available
12776 echo " "
12777 if $test `./findhdr stdarg.h`; then
12778         echo "<stdarg.h> found." >&4
12779         valstd="$define"
12780 else
12781         echo "<stdarg.h> NOT found." >&4
12782         valstd="$undef"
12783 fi
12784
12785 : see if varags is available
12786 echo " "
12787 if $test `./findhdr varargs.h`; then
12788         echo "<varargs.h> found." >&4
12789 else
12790         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12791 fi
12792
12793 : set up the varargs testing programs
12794 $cat > varargs.c <<EOP
12795 #ifdef I_STDARG
12796 #include <stdarg.h>
12797 #endif
12798 #ifdef I_VARARGS
12799 #include <varargs.h>
12800 #endif
12801
12802 #ifdef I_STDARG
12803 int f(char *p, ...)
12804 #else
12805 int f(va_alist)
12806 va_dcl
12807 #endif
12808 {
12809         va_list ap;
12810 #ifndef I_STDARG
12811         char *p;
12812 #endif
12813 #ifdef I_STDARG
12814         va_start(ap,p);
12815 #else
12816         va_start(ap);
12817         p = va_arg(ap, char *);
12818 #endif
12819         va_end(ap);
12820 }
12821 EOP
12822 $cat > varargs <<EOP
12823 $startsh
12824 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12825         echo "true"
12826 else
12827         echo "false"
12828 fi
12829 $rm -f varargs$_o
12830 EOP
12831 chmod +x varargs
12832
12833 : now check which varargs header should be included
12834 echo " "
12835 i_varhdr=''
12836 case "$valstd" in
12837 "$define")
12838         if `./varargs I_STDARG`; then
12839                 val='stdarg.h'
12840         elif `./varargs I_VARARGS`; then
12841                 val='varargs.h'
12842         fi
12843         ;;
12844 *)
12845         if `./varargs I_VARARGS`; then
12846                 val='varargs.h'
12847         fi
12848         ;;
12849 esac
12850 case "$val" in
12851 '')
12852 echo "I could not find the definition for va_dcl... You have problems..." >&4
12853         val="$undef"; set i_stdarg; eval $setvar
12854         val="$undef"; set i_varargs; eval $setvar
12855         ;;
12856 *) 
12857         set i_varhdr
12858         eval $setvar
12859         case "$i_varhdr" in
12860         stdarg.h)
12861                 val="$define"; set i_stdarg; eval $setvar
12862                 val="$undef"; set i_varargs; eval $setvar
12863                 ;;
12864         varargs.h)
12865                 val="$undef"; set i_stdarg; eval $setvar
12866                 val="$define"; set i_varargs; eval $setvar
12867                 ;;
12868         esac
12869         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12870 esac
12871 $rm -f varargs*
12872
12873 : see if stddef is available
12874 set stddef.h i_stddef
12875 eval $inhdr
12876
12877 : see if sys/access.h is available
12878 set sys/access.h i_sysaccess
12879 eval $inhdr
12880
12881 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12882 set sys/filio.h i_sysfilio
12883 eval $inhdr
12884 echo " "
12885 if $test `./findhdr sys/ioctl.h`; then
12886         val="$define"
12887         echo '<sys/ioctl.h> found.' >&4
12888 else
12889         val="$undef"
12890         if $test $i_sysfilio = "$define"; then
12891             echo '<sys/ioctl.h> NOT found.' >&4
12892         else
12893                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12894                 $test $i_termio = "$define" && xxx="termio.h"
12895                 $test $i_termios = "$define" && xxx="termios.h"
12896 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12897         fi
12898 fi
12899 set i_sysioctl
12900 eval $setvar
12901
12902 : see if sys/resource.h has to be included
12903 set sys/resource.h i_sysresrc
12904 eval $inhdr
12905
12906 : see if sys/security.h is available
12907 set sys/security.h i_syssecrt
12908 eval $inhdr
12909
12910 : see if this is a sys/statvfs.h system
12911 set sys/statvfs.h i_sysstatvfs
12912 eval $inhdr
12913
12914 : see if this is a sys/un.h system
12915 set sys/un.h i_sysun
12916 eval $inhdr
12917
12918 : see if this is a syswait system
12919 set sys/wait.h i_syswait
12920 eval $inhdr
12921
12922 : see if this is an utime system
12923 set utime.h i_utime
12924 eval $inhdr
12925
12926 : see if this is a values.h system
12927 set values.h i_values
12928 eval $inhdr
12929
12930 : see if this is a vfork system
12931 case "$d_vfork" in
12932 "$define")
12933         set vfork.h i_vfork
12934         eval $inhdr
12935         ;;
12936 *)
12937         i_vfork="$undef"
12938         ;;
12939 esac
12940
12941 : see if gdbm.h is available
12942 set gdbm.h t_gdbm
12943 eval $inhdr
12944 case "$t_gdbm" in
12945 $define)
12946         : see if gdbm_open exists
12947         set gdbm_open d_gdbm_open
12948         eval $inlibc
12949         case "$d_gdbm_open" in
12950         $undef)
12951                 t_gdbm="$undef"
12952                 echo "We won't be including <gdbm.h>"
12953                 ;;
12954         esac
12955         ;;
12956 esac
12957 val="$t_gdbm"
12958 set i_gdbm
12959 eval $setvar
12960
12961 echo " "
12962 echo "Looking for extensions..." >&4
12963 : If we are using the old config.sh, known_extensions may contain
12964 : old or inaccurate or duplicate values.
12965 known_extensions=''
12966 nonxs_extensions=''
12967 : We do not use find because it might not be available.
12968 : We do not just use MANIFEST because the user may have dropped
12969 : some additional extensions into the source tree and expect them
12970 : to be built.
12971
12972 : Function to recursively find available extensions, ignoring DynaLoader
12973 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
12974 find_extensions='
12975     for xxx in *; do
12976        case "$xxx" in
12977            DynaLoader|dynaload) ;;
12978            *)
12979            if $test -f $xxx/$xxx.xs; then
12980                known_extensions="$known_extensions $1$xxx";
12981            elif $test -f $xxx/Makefile.PL; then
12982                nonxs_extensions="$nonxs_extensions $1$xxx";
12983            else
12984                if $test -d $xxx -a $# -lt 10; then
12985                    set $1$xxx/ $*;
12986                    cd $xxx;
12987                    eval $find_extensions;
12988                    cd ..;
12989                    shift;
12990                fi;
12991            fi
12992            ;;
12993        esac;
12994     done'
12995 tdir=`pwd`
12996 cd $rsrc/ext
12997 set X
12998 shift
12999 eval $find_extensions
13000 set X $nonxs_extensions
13001 shift
13002 nonxs_extensions="$*"
13003 set X $known_extensions
13004 shift
13005 known_extensions="$*"
13006 cd $tdir
13007
13008 : Now see which are supported on this system.
13009 avail_ext=''
13010 for xxx in $known_extensions ; do
13011         case "$xxx" in
13012         DB_File|db_file)
13013                 case "$i_db" in
13014                 $define) avail_ext="$avail_ext $xxx" ;;
13015                 esac
13016                 ;;
13017         GDBM_File|gdbm_fil)
13018                 case "$i_gdbm" in 
13019                 $define) avail_ext="$avail_ext $xxx" ;;
13020                 esac
13021                 ;;
13022         NDBM_File|ndbm_fil)
13023                 case "$i_ndbm" in
13024                 $define) avail_ext="$avail_ext $xxx" ;;
13025                 esac
13026                 ;;
13027         ODBM_File|odbm_fil) 
13028                 case "${i_dbm}${i_rpcsvcdbm}" in
13029                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13030                 esac
13031                 ;;
13032         POSIX|posix)
13033                 case "$useposix" in
13034                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13035                 esac
13036                 ;;
13037         Opcode|opcode)
13038                 case "$useopcode" in
13039                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13040                 esac
13041                 ;;
13042         Socket|socket)
13043                 case "$d_socket" in 
13044                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13045                 esac
13046                 ;;
13047         Thread|thread)
13048                 case "$usethreads" in 
13049                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13050                 esac
13051                 ;;
13052         IPC/SysV|ipc/sysv)
13053                 : XXX Do we need a useipcsysv variable here
13054                 case "${d_msg}${d_sem}${d_shm}" in 
13055                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13056                 esac
13057                 ;;
13058         *)      avail_ext="$avail_ext $xxx"
13059                 ;;
13060         esac
13061 done
13062
13063 set X $avail_ext
13064 shift
13065 avail_ext="$*"
13066
13067 : Now see which nonxs extensions are supported on this system.
13068 : For now assume all are.
13069 nonxs_ext=''
13070 for xxx in $nonxs_extensions ; do
13071         case "$xxx" in
13072         *)      nonxs_ext="$nonxs_ext $xxx"
13073                 ;;
13074         esac
13075 done
13076
13077 set X $nonxs_ext
13078 shift
13079 nonxs_ext="$*"
13080
13081 case $usedl in
13082 $define)
13083         $cat <<EOM
13084 A number of extensions are supplied with $package.  You may choose to
13085 compile these extensions for dynamic loading (the default), compile
13086 them into the $package executable (static loading), or not include
13087 them at all.  Answer "none" to include no extensions.
13088 Note that DynaLoader is always built and need not be mentioned here.
13089
13090 EOM
13091         case "$dynamic_ext" in
13092         '') dflt="$avail_ext" ;;
13093         *)      dflt="$dynamic_ext"
13094                 # Perhaps we are reusing an old out-of-date config.sh.
13095                 case "$hint" in
13096                 previous)
13097                         if test X"$dynamic_ext" != X"$avail_ext"; then
13098                                 $cat <<EOM
13099 NOTICE:  Your previous config.sh list may be incorrect. 
13100 The extensions now available to you are 
13101         ${avail_ext}
13102 but the default list from your previous config.sh is
13103         ${dynamic_ext} 
13104
13105 EOM
13106                         fi
13107                         ;;
13108                 esac
13109                 ;;
13110         esac
13111         case "$dflt" in
13112         '')     dflt=none;;
13113         esac
13114         rp="What extensions do you wish to load dynamically?"
13115         . ./myread
13116         case "$ans" in
13117         none) dynamic_ext=' ' ;;
13118         *) dynamic_ext="$ans" ;;
13119         esac
13120
13121         case "$static_ext" in
13122         '')
13123                 : Exclude those already listed in dynamic linking
13124                 dflt=''
13125                 for xxx in $avail_ext; do
13126                         case " $dynamic_ext " in
13127                         *" $xxx "*) ;;
13128                         *) dflt="$dflt $xxx" ;;
13129                         esac
13130                 done
13131                 set X $dflt
13132                 shift
13133                 dflt="$*"
13134                 ;;
13135         *)  dflt="$static_ext" 
13136                 ;;
13137         esac
13138
13139         case "$dflt" in
13140         '')     dflt=none;;
13141         esac
13142         rp="What extensions do you wish to load statically?"
13143         . ./myread
13144         case "$ans" in
13145         none) static_ext=' ' ;;
13146         *) static_ext="$ans" ;;
13147         esac
13148         ;;
13149 *)
13150         $cat <<EOM
13151 A number of extensions are supplied with $package.  Answer "none" 
13152 to include no extensions. 
13153 Note that DynaLoader is always built and need not be mentioned here.
13154
13155 EOM
13156         case "$static_ext" in
13157         '') dflt="$avail_ext" ;;
13158         *)      dflt="$static_ext"
13159                 # Perhaps we are reusing an old out-of-date config.sh.
13160                 case "$hint" in
13161                 previous)
13162                         if test X"$static_ext" != X"$avail_ext"; then
13163                                 $cat <<EOM
13164 NOTICE:  Your previous config.sh list may be incorrect. 
13165 The extensions now available to you are 
13166         ${avail_ext}
13167 but the default list from your previous config.sh is
13168         ${static_ext} 
13169
13170 EOM
13171                         fi
13172                         ;;
13173                 esac
13174                 ;;
13175         esac
13176         : Exclude those that are not xs extensions
13177         case "$dflt" in
13178         '')     dflt=none;;
13179         esac
13180         rp="What extensions do you wish to include?"
13181         . ./myread
13182         case "$ans" in
13183         none) static_ext=' ' ;;
13184         *) static_ext="$ans" ;;
13185         esac
13186         ;;
13187 esac
13188
13189 set X $dynamic_ext $static_ext $nonxs_ext
13190 shift
13191 extensions="$*"
13192
13193 : Remove build directory name from cppstdin so it can be used from
13194 : either the present location or the final installed location.
13195 echo " "
13196 : Get out of the UU directory to get correct path name.
13197 cd ..
13198 case "$cppstdin" in
13199 `pwd`/cppstdin)
13200         echo "Stripping down cppstdin path name"
13201         cppstdin=cppstdin
13202         ;;
13203 esac
13204 cd UU
13205
13206 : end of configuration questions
13207 echo " "
13208 echo "End of configuration questions."
13209 echo " "
13210
13211 : back to where it started
13212 if test -d ../UU; then
13213         cd ..
13214 fi
13215
13216 : configuration may be patched via a 'config.over' file
13217 if $test -f config.over; then
13218         echo " "
13219         dflt=y
13220         rp='I see a config.over file.  Do you wish to load it?'
13221         . UU/myread
13222         case "$ans" in
13223         n*) echo "OK, I'll ignore it.";;
13224         *)      . ./config.over
13225                 echo "Configuration override changes have been loaded."
13226                 ;;
13227         esac
13228 fi
13229
13230 : in case they want portability, strip down executable paths
13231 case "$d_portable" in
13232 "$define")
13233         echo " "
13234         echo "Stripping down executable paths..." >&4
13235         for file in $loclist $trylist; do
13236                 eval temp=\$$file
13237                 eval $file=`basename $temp`
13238         done
13239         ;;
13240 esac
13241
13242 : create config.sh file
13243 echo " "
13244 echo "Creating config.sh..." >&4
13245 $spitshell <<EOT >config.sh
13246 $startsh
13247 #
13248 # This file was produced by running the Configure script. It holds all the
13249 # definitions figured out by Configure. Should you modify one of these values,
13250 # do not forget to propagate your changes by running "Configure -der". You may
13251 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13252 #
13253
13254 # Package name      : $package
13255 # Source directory  : $src
13256 # Configuration time: $cf_time
13257 # Configured by     : $cf_by
13258 # Target system     : $myuname
13259
13260 Author='$Author'
13261 Date='$Date'
13262 Header='$Header'
13263 Id='$Id'
13264 Locker='$Locker'
13265 Log='$Log'
13266 Mcc='$Mcc'
13267 RCSfile='$RCSfile'
13268 Revision='$Revision'
13269 Source='$Source'
13270 State='$State'
13271 _a='$_a'
13272 _exe='$_exe'
13273 _o='$_o'
13274 afs='$afs'
13275 alignbytes='$alignbytes'
13276 ansi2knr='$ansi2knr'
13277 aphostname='$aphostname'
13278 apiversion='$apiversion'
13279 ar='$ar'
13280 archlib='$archlib'
13281 archlibexp='$archlibexp'
13282 archname64='$archname64'
13283 archname='$archname'
13284 archobjs='$archobjs'
13285 awk='$awk'
13286 baserev='$baserev'
13287 bash='$bash'
13288 bin='$bin'
13289 bincompat5005='$bincompat5005'
13290 binexp='$binexp'
13291 bison='$bison'
13292 byacc='$byacc'
13293 byteorder='$byteorder'
13294 c='$c'
13295 castflags='$castflags'
13296 cat='$cat'
13297 cc='$cc'
13298 cccdlflags='$cccdlflags'
13299 ccdlflags='$ccdlflags'
13300 ccflags='$ccflags'
13301 ccsymbols='$ccsymbols'
13302 cf_by='$cf_by'
13303 cf_email='$cf_email'
13304 cf_time='$cf_time'
13305 chgrp='$chgrp'
13306 chmod='$chmod'
13307 chown='$chown'
13308 clocktype='$clocktype'
13309 comm='$comm'
13310 compress='$compress'
13311 contains='$contains'
13312 cp='$cp'
13313 cpio='$cpio'
13314 cpp='$cpp'
13315 cpp_stuff='$cpp_stuff'
13316 cppccsymbols='$cppccsymbols'
13317 cppflags='$cppflags'
13318 cpplast='$cpplast'
13319 cppminus='$cppminus'
13320 cpprun='$cpprun'
13321 cppstdin='$cppstdin'
13322 cppsymbols='$cppsymbols'
13323 crosscompile='$crosscompile'
13324 cryptlib='$cryptlib'
13325 csh='$csh'
13326 d_Gconvert='$d_Gconvert'
13327 d_PRIEldbl='$d_PRIEldbl'
13328 d_PRIFldbl='$d_PRIFldbl'
13329 d_PRIGldbl='$d_PRIGldbl'
13330 d_PRIX64='$d_PRIX64'
13331 d_PRId64='$d_PRId64'
13332 d_PRIeldbl='$d_PRIeldbl'
13333 d_PRIfldbl='$d_PRIfldbl'
13334 d_PRIgldbl='$d_PRIgldbl'
13335 d_PRIi64='$d_PRIi64'
13336 d_PRIo64='$d_PRIo64'
13337 d_PRIu64='$d_PRIu64'
13338 d_PRIx64='$d_PRIx64'
13339 d_access='$d_access'
13340 d_accessx='$d_accessx'
13341 d_alarm='$d_alarm'
13342 d_archlib='$d_archlib'
13343 d_atolf='$d_atolf'
13344 d_atoll='$d_atoll'
13345 d_attribut='$d_attribut'
13346 d_bcmp='$d_bcmp'
13347 d_bcopy='$d_bcopy'
13348 d_bincompat5005='$d_bincompat5005'
13349 d_bsd='$d_bsd'
13350 d_bsdgetpgrp='$d_bsdgetpgrp'
13351 d_bsdsetpgrp='$d_bsdsetpgrp'
13352 d_bzero='$d_bzero'
13353 d_casti32='$d_casti32'
13354 d_castneg='$d_castneg'
13355 d_charvspr='$d_charvspr'
13356 d_chown='$d_chown'
13357 d_chroot='$d_chroot'
13358 d_chsize='$d_chsize'
13359 d_closedir='$d_closedir'
13360 d_cmsghdr_s='$d_cmsghdr_s'
13361 d_const='$d_const'
13362 d_crypt='$d_crypt'
13363 d_csh='$d_csh'
13364 d_cuserid='$d_cuserid'
13365 d_dbl_dig='$d_dbl_dig'
13366 d_difftime='$d_difftime'
13367 d_dirnamlen='$d_dirnamlen'
13368 d_dlerror='$d_dlerror'
13369 d_dlopen='$d_dlopen'
13370 d_dlsymun='$d_dlsymun'
13371 d_dosuid='$d_dosuid'
13372 d_drand48proto='$d_drand48proto'
13373 d_dup2='$d_dup2'
13374 d_eaccess='$d_eaccess'
13375 d_endgrent='$d_endgrent'
13376 d_endhent='$d_endhent'
13377 d_endnent='$d_endnent'
13378 d_endpent='$d_endpent'
13379 d_endpwent='$d_endpwent'
13380 d_endsent='$d_endsent'
13381 d_endspent='$d_endspent'
13382 d_eofnblk='$d_eofnblk'
13383 d_eunice='$d_eunice'
13384 d_fchmod='$d_fchmod'
13385 d_fchown='$d_fchown'
13386 d_fcntl='$d_fcntl'
13387 d_fd_macros='$d_fd_macros'
13388 d_fd_set='$d_fd_set'
13389 d_fds_bits='$d_fds_bits'
13390 d_fgetpos64='$d_fgetpos64'
13391 d_fgetpos='$d_fgetpos'
13392 d_flexfnam='$d_flexfnam'
13393 d_flock='$d_flock'
13394 d_fopen64='$d_fopen64'
13395 d_fork='$d_fork'
13396 d_fpathconf='$d_fpathconf'
13397 d_fpos64_t='$d_fpos64_t'
13398 d_freopen64='$d_freopen64'
13399 d_fseek64='$d_fseek64'
13400 d_fseeko64='$d_fseeko64'
13401 d_fseeko='$d_fseeko'
13402 d_fsetpos64='$d_fsetpos64'
13403 d_fsetpos='$d_fsetpos'
13404 d_fstatfs='$d_fstatfs'
13405 d_fstatvfs='$d_fstatvfs'
13406 d_ftell64='$d_ftell64'
13407 d_ftello64='$d_ftello64'
13408 d_ftello='$d_ftello'
13409 d_ftime='$d_ftime'
13410 d_getgrent='$d_getgrent'
13411 d_getgrps='$d_getgrps'
13412 d_gethbyaddr='$d_gethbyaddr'
13413 d_gethbyname='$d_gethbyname'
13414 d_gethent='$d_gethent'
13415 d_gethname='$d_gethname'
13416 d_gethostprotos='$d_gethostprotos'
13417 d_getlogin='$d_getlogin'
13418 d_getmntent='$d_getmntent'
13419 d_getnbyaddr='$d_getnbyaddr'
13420 d_getnbyname='$d_getnbyname'
13421 d_getnent='$d_getnent'
13422 d_getnetprotos='$d_getnetprotos'
13423 d_getpbyname='$d_getpbyname'
13424 d_getpbynumber='$d_getpbynumber'
13425 d_getpent='$d_getpent'
13426 d_getpgid='$d_getpgid'
13427 d_getpgrp2='$d_getpgrp2'
13428 d_getpgrp='$d_getpgrp'
13429 d_getppid='$d_getppid'
13430 d_getprior='$d_getprior'
13431 d_getprotoprotos='$d_getprotoprotos'
13432 d_getpwent='$d_getpwent'
13433 d_getsbyname='$d_getsbyname'
13434 d_getsbyport='$d_getsbyport'
13435 d_getsent='$d_getsent'
13436 d_getservprotos='$d_getservprotos'
13437 d_getspent='$d_getspent'
13438 d_getspnam='$d_getspnam'
13439 d_gettimeod='$d_gettimeod'
13440 d_gnulibc='$d_gnulibc'
13441 d_grpasswd='$d_grpasswd'
13442 d_hasmntopt='$d_hasmntopt'
13443 d_htonl='$d_htonl'
13444 d_index='$d_index'
13445 d_inetaton='$d_inetaton'
13446 d_int64t='$d_int64t'
13447 d_iovec_s='$d_iovec_s'
13448 d_isascii='$d_isascii'
13449 d_killpg='$d_killpg'
13450 d_lchown='$d_lchown'
13451 d_link='$d_link'
13452 d_llseek='$d_llseek'
13453 d_locconv='$d_locconv'
13454 d_lockf='$d_lockf'
13455 d_longdbl='$d_longdbl'
13456 d_longlong='$d_longlong'
13457 d_lstat='$d_lstat'
13458 d_madvise='$d_madvise'
13459 d_mblen='$d_mblen'
13460 d_mbstowcs='$d_mbstowcs'
13461 d_mbtowc='$d_mbtowc'
13462 d_memchr='$d_memchr'
13463 d_memcmp='$d_memcmp'
13464 d_memcpy='$d_memcpy'
13465 d_memmove='$d_memmove'
13466 d_memset='$d_memset'
13467 d_mkdir='$d_mkdir'
13468 d_mkfifo='$d_mkfifo'
13469 d_mktime='$d_mktime'
13470 d_mmap='$d_mmap'
13471 d_mprotect='$d_mprotect'
13472 d_msg='$d_msg'
13473 d_msg_ctrunc='$d_msg_ctrunc'
13474 d_msg_dontroute='$d_msg_dontroute'
13475 d_msg_oob='$d_msg_oob'
13476 d_msg_peek='$d_msg_peek'
13477 d_msg_proxy='$d_msg_proxy'
13478 d_msgctl='$d_msgctl'
13479 d_msgget='$d_msgget'
13480 d_msghdr_s='$d_msghdr_s'
13481 d_msgrcv='$d_msgrcv'
13482 d_msgsnd='$d_msgsnd'
13483 d_msync='$d_msync'
13484 d_munmap='$d_munmap'
13485 d_mymalloc='$d_mymalloc'
13486 d_nice='$d_nice'
13487 d_off64_t='$d_off64_t'
13488 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13489 d_oldpthreads='$d_oldpthreads'
13490 d_oldsock='$d_oldsock'
13491 d_open3='$d_open3'
13492 d_pathconf='$d_pathconf'
13493 d_pause='$d_pause'
13494 d_phostname='$d_phostname'
13495 d_pipe='$d_pipe'
13496 d_poll='$d_poll'
13497 d_portable='$d_portable'
13498 d_pthread_yield='$d_pthread_yield'
13499 d_pwage='$d_pwage'
13500 d_pwchange='$d_pwchange'
13501 d_pwclass='$d_pwclass'
13502 d_pwcomment='$d_pwcomment'
13503 d_pwexpire='$d_pwexpire'
13504 d_pwgecos='$d_pwgecos'
13505 d_pwpasswd='$d_pwpasswd'
13506 d_pwquota='$d_pwquota'
13507 d_readdir='$d_readdir'
13508 d_readlink='$d_readlink'
13509 d_readv='$d_readv'
13510 d_recvmsg='$d_recvmsg'
13511 d_rename='$d_rename'
13512 d_rewinddir='$d_rewinddir'
13513 d_rmdir='$d_rmdir'
13514 d_safebcpy='$d_safebcpy'
13515 d_safemcpy='$d_safemcpy'
13516 d_sanemcmp='$d_sanemcmp'
13517 d_sched_yield='$d_sched_yield'
13518 d_scm_rights='$d_scm_rights'
13519 d_seekdir='$d_seekdir'
13520 d_select='$d_select'
13521 d_sem='$d_sem'
13522 d_semctl='$d_semctl'
13523 d_semctl_semid_ds='$d_semctl_semid_ds'
13524 d_semctl_semun='$d_semctl_semun'
13525 d_semget='$d_semget'
13526 d_semop='$d_semop'
13527 d_sendmsg='$d_sendmsg'
13528 d_setegid='$d_setegid'
13529 d_seteuid='$d_seteuid'
13530 d_setgrent='$d_setgrent'
13531 d_setgrps='$d_setgrps'
13532 d_sethent='$d_sethent'
13533 d_setlinebuf='$d_setlinebuf'
13534 d_setlocale='$d_setlocale'
13535 d_setnent='$d_setnent'
13536 d_setpent='$d_setpent'
13537 d_setpgid='$d_setpgid'
13538 d_setpgrp2='$d_setpgrp2'
13539 d_setpgrp='$d_setpgrp'
13540 d_setprior='$d_setprior'
13541 d_setpwent='$d_setpwent'
13542 d_setregid='$d_setregid'
13543 d_setresgid='$d_setresgid'
13544 d_setresuid='$d_setresuid'
13545 d_setreuid='$d_setreuid'
13546 d_setrgid='$d_setrgid'
13547 d_setruid='$d_setruid'
13548 d_setsent='$d_setsent'
13549 d_setsid='$d_setsid'
13550 d_setspent='$d_setspent'
13551 d_setvbuf='$d_setvbuf'
13552 d_sfio='$d_sfio'
13553 d_shm='$d_shm'
13554 d_shmat='$d_shmat'
13555 d_shmatprototype='$d_shmatprototype'
13556 d_shmctl='$d_shmctl'
13557 d_shmdt='$d_shmdt'
13558 d_shmget='$d_shmget'
13559 d_sigaction='$d_sigaction'
13560 d_sigsetjmp='$d_sigsetjmp'
13561 d_socket='$d_socket'
13562 d_sockpair='$d_sockpair'
13563 d_statblks='$d_statblks'
13564 d_statfs='$d_statfs'
13565 d_statfsflags='$d_statfsflags'
13566 d_statvfs='$d_statvfs'
13567 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13568 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13569 d_stdio_stream_array='$d_stdio_stream_array'
13570 d_stdiobase='$d_stdiobase'
13571 d_stdstdio='$d_stdstdio'
13572 d_strchr='$d_strchr'
13573 d_strcoll='$d_strcoll'
13574 d_strctcpy='$d_strctcpy'
13575 d_strerrm='$d_strerrm'
13576 d_strerror='$d_strerror'
13577 d_strtod='$d_strtod'
13578 d_strtol='$d_strtol'
13579 d_strtoul='$d_strtoul'
13580 d_strtoull='$d_strtoull'
13581 d_strxfrm='$d_strxfrm'
13582 d_suidsafe='$d_suidsafe'
13583 d_symlink='$d_symlink'
13584 d_syscall='$d_syscall'
13585 d_sysconf='$d_sysconf'
13586 d_sysernlst='$d_sysernlst'
13587 d_syserrlst='$d_syserrlst'
13588 d_system='$d_system'
13589 d_tcgetpgrp='$d_tcgetpgrp'
13590 d_tcsetpgrp='$d_tcsetpgrp'
13591 d_telldir='$d_telldir'
13592 d_telldirproto='$d_telldirproto'
13593 d_time='$d_time'
13594 d_times='$d_times'
13595 d_tmpfile64='$d_tmpfile64'
13596 d_truncate='$d_truncate'
13597 d_tzname='$d_tzname'
13598 d_umask='$d_umask'
13599 d_uname='$d_uname'
13600 d_union_semun='$d_union_semun'
13601 d_vendorlib='$d_vendorlib'
13602 d_vfork='$d_vfork'
13603 d_void_closedir='$d_void_closedir'
13604 d_voidsig='$d_voidsig'
13605 d_voidtty='$d_voidtty'
13606 d_volatile='$d_volatile'
13607 d_vprintf='$d_vprintf'
13608 d_wait4='$d_wait4'
13609 d_waitpid='$d_waitpid'
13610 d_wcstombs='$d_wcstombs'
13611 d_wctomb='$d_wctomb'
13612 d_writev='$d_writev'
13613 d_xenix='$d_xenix'
13614 date='$date'
13615 db_hashtype='$db_hashtype'
13616 db_prefixtype='$db_prefixtype'
13617 defvoidused='$defvoidused'
13618 direntrytype='$direntrytype'
13619 dlext='$dlext'
13620 dlsrc='$dlsrc'
13621 doublesize='$doublesize'
13622 drand01='$drand01'
13623 dynamic_ext='$dynamic_ext'
13624 eagain='$eagain'
13625 ebcdic='$ebcdic'
13626 echo='$echo'
13627 egrep='$egrep'
13628 emacs='$emacs'
13629 eunicefix='$eunicefix'
13630 exe_ext='$exe_ext'
13631 expr='$expr'
13632 extensions='$extensions'
13633 fflushNULL='$fflushNULL'
13634 fflushall='$fflushall'
13635 find='$find'
13636 firstmakefile='$firstmakefile'
13637 flex='$flex'
13638 fpostype='$fpostype'
13639 freetype='$freetype'
13640 full_ar='$full_ar'
13641 full_csh='$full_csh'
13642 full_sed='$full_sed'
13643 gccversion='$gccversion'
13644 gidtype='$gidtype'
13645 glibpth='$glibpth'
13646 grep='$grep'
13647 groupcat='$groupcat'
13648 groupstype='$groupstype'
13649 gzip='$gzip'
13650 h_fcntl='$h_fcntl'
13651 h_sysfile='$h_sysfile'
13652 hint='$hint'
13653 hostcat='$hostcat'
13654 huge='$huge'
13655 i_arpainet='$i_arpainet'
13656 i_bsdioctl='$i_bsdioctl'
13657 i_db='$i_db'
13658 i_dbm='$i_dbm'
13659 i_dirent='$i_dirent'
13660 i_dld='$i_dld'
13661 i_dlfcn='$i_dlfcn'
13662 i_fcntl='$i_fcntl'
13663 i_float='$i_float'
13664 i_gdbm='$i_gdbm'
13665 i_grp='$i_grp'
13666 i_inttypes='$i_inttypes'
13667 i_limits='$i_limits'
13668 i_locale='$i_locale'
13669 i_machcthr='$i_machcthr'
13670 i_malloc='$i_malloc'
13671 i_math='$i_math'
13672 i_memory='$i_memory'
13673 i_mntent='$i_mntent'
13674 i_ndbm='$i_ndbm'
13675 i_netdb='$i_netdb'
13676 i_neterrno='$i_neterrno'
13677 i_netinettcp='$i_netinettcp'
13678 i_niin='$i_niin'
13679 i_poll='$i_poll'
13680 i_pthread='$i_pthread'
13681 i_pwd='$i_pwd'
13682 i_rpcsvcdbm='$i_rpcsvcdbm'
13683 i_sfio='$i_sfio'
13684 i_sgtty='$i_sgtty'
13685 i_shadow='$i_shadow'
13686 i_socks='$i_socks'
13687 i_stdarg='$i_stdarg'
13688 i_stddef='$i_stddef'
13689 i_stdlib='$i_stdlib'
13690 i_string='$i_string'
13691 i_sysaccess='$i_sysaccess'
13692 i_sysdir='$i_sysdir'
13693 i_sysfile='$i_sysfile'
13694 i_sysfilio='$i_sysfilio'
13695 i_sysin='$i_sysin'
13696 i_sysioctl='$i_sysioctl'
13697 i_sysmman='$i_sysmman'
13698 i_sysmount='$i_sysmount'
13699 i_sysndir='$i_sysndir'
13700 i_sysparam='$i_sysparam'
13701 i_sysresrc='$i_sysresrc'
13702 i_syssecrt='$i_syssecrt'
13703 i_sysselct='$i_sysselct'
13704 i_syssockio='$i_syssockio'
13705 i_sysstat='$i_sysstat'
13706 i_sysstatvfs='$i_sysstatvfs'
13707 i_systime='$i_systime'
13708 i_systimek='$i_systimek'
13709 i_systimes='$i_systimes'
13710 i_systypes='$i_systypes'
13711 i_sysuio='$i_sysuio'
13712 i_sysun='$i_sysun'
13713 i_syswait='$i_syswait'
13714 i_termio='$i_termio'
13715 i_termios='$i_termios'
13716 i_time='$i_time'
13717 i_unistd='$i_unistd'
13718 i_utime='$i_utime'
13719 i_values='$i_values'
13720 i_varargs='$i_varargs'
13721 i_varhdr='$i_varhdr'
13722 i_vfork='$i_vfork'
13723 ignore_versioned_solibs='$ignore_versioned_solibs'
13724 incpath='$incpath'
13725 inews='$inews'
13726 installarchlib='$installarchlib'
13727 installbin='$installbin'
13728 installman1dir='$installman1dir'
13729 installman3dir='$installman3dir'
13730 installprefix='$installprefix'
13731 installprefixexp='$installprefixexp'
13732 installprivlib='$installprivlib'
13733 installscript='$installscript'
13734 installsitearch='$installsitearch'
13735 installsitelib='$installsitelib'
13736 installstyle='$installstyle'
13737 installusrbinperl='$installusrbinperl'
13738 installvendorlib='$installvendorlib'
13739 intsize='$intsize'
13740 known_extensions='$known_extensions'
13741 ksh='$ksh'
13742 large='$large'
13743 ld='$ld'
13744 lddlflags='$lddlflags'
13745 ldflags='$ldflags'
13746 ldlibpthname='$ldlibpthname'
13747 less='$less'
13748 lib_ext='$lib_ext'
13749 libc='$libc'
13750 libperl='$libperl'
13751 libpth='$libpth'
13752 libs='$libs'
13753 libswanted='$libswanted'
13754 line='$line'
13755 lint='$lint'
13756 lkflags='$lkflags'
13757 ln='$ln'
13758 lns='$lns'
13759 locincpth='$locincpth'
13760 loclibpth='$loclibpth'
13761 longdblsize='$longdblsize'
13762 longlongsize='$longlongsize'
13763 longsize='$longsize'
13764 lp='$lp'
13765 lpr='$lpr'
13766 ls='$ls'
13767 lseeksize='$lseeksize'
13768 lseektype='$lseektype'
13769 mail='$mail'
13770 mailx='$mailx'
13771 make='$make'
13772 make_set_make='$make_set_make'
13773 mallocobj='$mallocobj'
13774 mallocsrc='$mallocsrc'
13775 malloctype='$malloctype'
13776 man1dir='$man1dir'
13777 man1direxp='$man1direxp'
13778 man1ext='$man1ext'
13779 man3dir='$man3dir'
13780 man3direxp='$man3direxp'
13781 man3ext='$man3ext'
13782 medium='$medium'
13783 mips='$mips'
13784 mips_type='$mips_type'
13785 mkdir='$mkdir'
13786 mmaptype='$mmaptype'
13787 models='$models'
13788 modetype='$modetype'
13789 more='$more'
13790 multiarch='$multiarch'
13791 mv='$mv'
13792 myarchname='$myarchname'
13793 mydomain='$mydomain'
13794 myhostname='$myhostname'
13795 myuname='$myuname'
13796 n='$n'
13797 netdb_hlen_type='$netdb_hlen_type'
13798 netdb_host_type='$netdb_host_type'
13799 netdb_name_type='$netdb_name_type'
13800 netdb_net_type='$netdb_net_type'
13801 nm='$nm'
13802 nm_opt='$nm_opt'
13803 nm_so_opt='$nm_so_opt'
13804 nonxs_ext='$nonxs_ext'
13805 nroff='$nroff'
13806 o_nonblock='$o_nonblock'
13807 obj_ext='$obj_ext'
13808 old_pthread_create_joinable='$old_pthread_create_joinable'
13809 optimize='$optimize'
13810 orderlib='$orderlib'
13811 osname='$osname'
13812 osvers='$osvers'
13813 package='$package'
13814 pager='$pager'
13815 passcat='$passcat'
13816 patchlevel='$patchlevel'
13817 path_sep='$path_sep'
13818 perl='$perl'
13819 perladmin='$perladmin'
13820 perlpath='$perlpath'
13821 pg='$pg'
13822 phostname='$phostname'
13823 pidtype='$pidtype'
13824 plibpth='$plibpth'
13825 pmake='$pmake'
13826 pr='$pr'
13827 prefix='$prefix'
13828 prefixexp='$prefixexp'
13829 privlib='$privlib'
13830 privlibexp='$privlibexp'
13831 prototype='$prototype'
13832 ptrsize='$ptrsize'
13833 randbits='$randbits'
13834 randfunc='$randfunc'
13835 randseedtype='$randseedtype'
13836 ranlib='$ranlib'
13837 rd_nodata='$rd_nodata'
13838 rm='$rm'
13839 rmail='$rmail'
13840 runnm='$runnm'
13841 sPRIEldbl='$sPRIEldbl'
13842 sPRIFldbl='$sPRIFldbl'
13843 sPRIGldbl='$sPRIGldbl'
13844 sPRIX64='$sPRIX64'
13845 sPRId64='$sPRId64'
13846 sPRIeldbl='$sPRIeldbl'
13847 sPRIfldbl='$sPRIfldbl'
13848 sPRIgldbl='$sPRIgldbl'
13849 sPRIi64='$sPRIi64'
13850 sPRIo64='$sPRIo64'
13851 sPRIu64='$sPRIu64'
13852 sPRIx64='$sPRIx64'
13853 sched_yield='$sched_yield'
13854 scriptdir='$scriptdir'
13855 scriptdirexp='$scriptdirexp'
13856 sed='$sed'
13857 seedfunc='$seedfunc'
13858 selectminbits='$selectminbits'
13859 selecttype='$selecttype'
13860 sendmail='$sendmail'
13861 sh='$sh'
13862 shar='$shar'
13863 sharpbang='$sharpbang'
13864 shmattype='$shmattype'
13865 shortsize='$shortsize'
13866 shrpenv='$shrpenv'
13867 shsharp='$shsharp'
13868 sig_count='$sig_count'
13869 sig_name='$sig_name'
13870 sig_name_init='$sig_name_init'
13871 sig_num='$sig_num'
13872 sig_num_init='$sig_num_init'
13873 signal_t='$signal_t'
13874 sitearch='$sitearch'
13875 sitearchexp='$sitearchexp'
13876 sitelib='$sitelib'
13877 sitelibexp='$sitelibexp'
13878 siteprefix='$siteprefix'
13879 siteprefixexp='$siteprefixexp'
13880 sizetype='$sizetype'
13881 sleep='$sleep'
13882 smail='$smail'
13883 small='$small'
13884 so='$so'
13885 sockethdr='$sockethdr'
13886 socketlib='$socketlib'
13887 sort='$sort'
13888 spackage='$spackage'
13889 spitshell='$spitshell'
13890 split='$split'
13891 src='$src'
13892 ssizetype='$ssizetype'
13893 startperl='$startperl'
13894 startsh='$startsh'
13895 static_ext='$static_ext'
13896 stdchar='$stdchar'
13897 stdio_base='$stdio_base'
13898 stdio_bufsiz='$stdio_bufsiz'
13899 stdio_cnt='$stdio_cnt'
13900 stdio_filbuf='$stdio_filbuf'
13901 stdio_ptr='$stdio_ptr'
13902 stdio_stream_array='$stdio_stream_array'
13903 strings='$strings'
13904 submit='$submit'
13905 subversion='$subversion'
13906 sysman='$sysman'
13907 tail='$tail'
13908 tar='$tar'
13909 tbl='$tbl'
13910 tee='$tee'
13911 test='$test'
13912 timeincl='$timeincl'
13913 timetype='$timetype'
13914 touch='$touch'
13915 tr='$tr'
13916 trnl='$trnl'
13917 troff='$troff'
13918 uidtype='$uidtype'
13919 uname='$uname'
13920 uniq='$uniq'
13921 use64bits='$use64bits'
13922 usedl='$usedl'
13923 uselongdouble='$uselongdouble'
13924 usemultiplicity='$usemultiplicity'
13925 usemymalloc='$usemymalloc'
13926 usenm='$usenm'
13927 useopcode='$useopcode'
13928 useperlio='$useperlio'
13929 useposix='$useposix'
13930 usesfio='$usesfio'
13931 useshrplib='$useshrplib'
13932 usesocks='$usesocks'
13933 usethreads='$usethreads'
13934 usevendorprefix='$usevendorprefix'
13935 usevfork='$usevfork'
13936 usrinc='$usrinc'
13937 uuname='$uuname'
13938 vendorlib='$vendorlib'
13939 vendorlibexp='$vendorlibexp'
13940 vendorprefix='$vendorprefix'
13941 vendorprefixexp='$vendorprefixexp'
13942 version='$version'
13943 vi='$vi'
13944 voidflags='$voidflags'
13945 xlibpth='$xlibpth'
13946 zcat='$zcat'
13947 zip='$zip'
13948 EOT
13949
13950 : Add in command line options if available
13951 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
13952
13953 : add special variables
13954 $test -f $src/patchlevel.h && \
13955 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
13956 echo "CONFIGDOTSH=true" >>config.sh
13957
13958 : propagate old symbols
13959 if $test -f UU/config.sh; then
13960         <UU/config.sh sort | uniq >UU/oldconfig.sh
13961         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
13962         sort | uniq -u >UU/oldsyms
13963         set X `cat UU/oldsyms`
13964         shift
13965         case $# in
13966         0) ;;
13967         *)
13968                 cat <<EOM
13969 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
13970 EOM
13971                 echo "# Variables propagated from previous config.sh file." >>config.sh
13972                 for sym in `cat UU/oldsyms`; do
13973                         echo "    Propagating $hint variable "'$'"$sym..."
13974                         eval 'tmp="$'"${sym}"'"'
13975                         echo "$tmp" | \
13976                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
13977                 done
13978                 ;;
13979         esac
13980 fi
13981
13982 : Finish up by extracting the .SH files
13983 case "$alldone" in
13984 exit)
13985         $rm -rf UU
13986         echo "Done."
13987         exit 0
13988         ;;
13989 cont)
13990         ;;
13991 '')
13992         dflt=''
13993         nostick=true
13994         $cat <<EOM
13995
13996 If you'd like to make any changes to the config.sh file before I begin
13997 to configure things, do it as a shell escape now (e.g. !vi config.sh).
13998
13999 EOM
14000         rp="Press return or use a shell escape to edit config.sh:"
14001         . UU/myread
14002         nostick=''
14003         case "$ans" in
14004         '') ;;
14005         *) : in case they cannot read
14006                 sh 1>&4 -c "$ans";;
14007         esac
14008         ;;
14009 esac
14010
14011 : if this fails, just run all the .SH files by hand
14012 . ./config.sh
14013
14014 echo " "
14015 exec 1>&4
14016 . ./UU/extract
14017
14018 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14019         dflt=y
14020         case "$silent" in
14021         true) ;;
14022         *)
14023                 $cat <<EOM
14024
14025 Now you need to generate make dependencies by running "$make depend".
14026 You might prefer to run it in background: "$make depend > makedepend.out &"
14027 It can take a while, so you might not want to run it right now.
14028
14029 EOM
14030                 ;;
14031         esac
14032         rp="Run $make depend now?"
14033         . UU/myread
14034         case "$ans" in
14035         y*)
14036                 $make depend && echo "Now you must run a $make."
14037                 ;;
14038         *)
14039                 echo "You must run '$make depend' then '$make'."
14040                 ;;
14041         esac
14042 elif test -f [Mm]akefile; then
14043         echo " "
14044         echo "Now you must run a $make."
14045 else
14046         echo "Done."
14047 fi
14048
14049 if $test -f Policy.sh; then
14050     $cat <<EOM
14051
14052 If you compile $package on a different machine or from a different object
14053 directory, copy the Policy.sh file from this object directory to the
14054 new one before you run Configure -- this will help you with most of
14055 the policy defaults.
14056
14057 EOM
14058 fi
14059 if $test -f config.msg; then
14060     echo "Hmm.  I also noted the following information while running:"
14061     echo " "
14062     $cat config.msg >&4
14063     $rm -f config.msg
14064 fi
14065 $rm -f kit*isdone ark*isdone
14066 $rm -rf UU
14067
14068 : End of Configure
14069