BYTEORDER fix.
[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:00:00 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) 
6445         val="$define"
6446         ccflags="$ccflags -DUSE_LONG_DOUBLE"
6447         ;;     
6448 *)      
6449         val="$undef"
6450         ;;
6451 esac
6452 set uselongdouble
6453 eval $setvar
6454
6455 case "$uselongdouble" in
6456 "$define"|true|[yY]*)
6457 : Look for a hint-file generated 'call-back-unit'.  If the
6458 : user has specified that long doubles should be used,
6459 : we may need to set or change some other defaults.
6460         if $test -f uselongdouble.cbu; then
6461                 echo "Your platform has some specific hints for long doubles, using them..."
6462                 . ./uselongdouble.cbu
6463         else
6464                 $cat <<EOM
6465 (Your platform doesn't have any specific hints for long doubles.)
6466 EOM
6467         fi
6468         ;;
6469 esac
6470
6471 cat <<EOM
6472
6473 Previous version of $package used the standard IO mechanisms as defined
6474 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6475 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6476 the default.  This abstraction layer can use AT&T's sfio (if you already
6477 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6478 problems with some extension modules.  Using PerlIO with stdio is safe,
6479 but it is slower than plain stdio and therefore is not the default.
6480
6481 If this doesn't make any sense to you, just accept the default 'n'.
6482 EOM
6483 case "$useperlio" in
6484 $define|true|[yY]*)     dflt='y';;
6485 *) dflt='n';;
6486 esac
6487 rp='Use the experimental PerlIO abstraction layer?'
6488 . ./myread
6489 case "$ans" in
6490 y|Y) 
6491         val="$define"
6492         ;;     
6493 *)      
6494         echo "Ok, doing things the stdio way"
6495         val="$undef"
6496         ;;
6497 esac
6498 set useperlio
6499 eval $setvar 
6500
6501 : Check how to convert floats to strings.
6502 if test "X$d_Gconvert" = X; then
6503         echo " "
6504         echo "Checking for an efficient way to convert floats to strings."
6505         $cat >try.c <<'EOP'
6506 #ifdef TRY_gconvert
6507 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6508 char *myname = "gconvert";
6509 #endif
6510 #ifdef TRY_gcvt
6511 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6512 char *myname = "gcvt";
6513 #endif
6514 #ifdef TRY_sprintf
6515 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6516 char *myname = "sprintf";
6517 #endif
6518
6519 #include <stdio.h>
6520
6521 int
6522 checkit(expect, got)
6523 char *expect;
6524 char *got;
6525 {
6526     if (strcmp(expect, got)) {
6527                 printf("%s oddity:  Expected %s, got %s\n",
6528                         myname, expect, got);
6529                 exit(1);
6530         }
6531 }
6532
6533 int main()
6534
6535         char buf[64]; 
6536         buf[63] = '\0';
6537
6538         /* This must be 1st test on (which?) platform */
6539         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6540         Gconvert(0.1, 8, 0, buf);
6541         checkit("0.1", buf);
6542
6543         Gconvert(1.0, 8, 0, buf); 
6544         checkit("1", buf);
6545
6546         Gconvert(0.0, 8, 0, buf); 
6547         checkit("0", buf);
6548
6549         Gconvert(-1.0, 8, 0, buf); 
6550         checkit("-1", buf);
6551
6552         /* Some Linux gcvt's give 1.e+5 here. */
6553         Gconvert(100000.0, 8, 0, buf); 
6554         checkit("100000", buf);
6555         
6556         /* Some Linux gcvt's give -1.e+5 here. */
6557         Gconvert(-100000.0, 8, 0, buf); 
6558         checkit("-100000", buf);
6559
6560         exit(0);
6561 }
6562 EOP
6563         case "$d_Gconvert" in
6564         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6565         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6566         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6567         *) xxx_list='gconvert gcvt sprintf' ;;
6568         esac
6569
6570         for xxx_convert in $xxx_list; do
6571                 echo "Trying $xxx_convert"
6572                 $rm -f try try$_o
6573                 set try -DTRY_$xxx_convert
6574                 if eval $compile; then
6575                         echo "$xxx_convert" found. >&4
6576                         if ./try; then
6577                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6578                                 break;
6579                         else
6580                                 echo "...But $xxx_convert didn't work as I expected."
6581                         fi
6582                 else
6583                         echo "$xxx_convert NOT found." >&4
6584                 fi
6585         done
6586                 
6587         case "$xxx_convert" in
6588         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6589         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6590         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6591         esac
6592 fi
6593
6594 : see if inttypes.h is available
6595 : we want a real compile instead of Inhdr because some systems
6596 : have an inttypes.h which includes non-existent headers
6597 echo " "
6598 $cat >try.c <<EOCP
6599 #include <inttypes.h>
6600 int main() {
6601         static int32_t foo32 = 0x12345678;
6602 }
6603 EOCP
6604 set try
6605 if eval $compile; then
6606         echo "<inttypes.h> found." >&4
6607         val="$define"
6608 else
6609         echo "<inttypes.h> NOT found." >&4
6610         val="$undef"
6611 fi
6612 $rm -f try.c try
6613 set i_inttypes
6614 eval $setvar
6615
6616 : check for int64_t
6617 case "$use64bits" in
6618 "$define" )
6619         echo " "
6620         echo $n "Checking to see if your system supports int64_t...$c" >&4
6621         $cat >try.c <<EOCP
6622 #include <sys/types.h>
6623 #$i_inttypes I_INTTYPES
6624 #ifdef I_INTTYPES
6625 #include <inttypes.h>
6626 #endif
6627 int64_t foo() { int64_t x; x = 7; return x; }
6628 EOCP
6629         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6630                 val="$define"
6631                 echo " Yup, it does." >&4
6632         else
6633                 val="$undef"
6634                 echo " Nope, it doesn't." >&4
6635         fi
6636         $rm -f try.*
6637         ;;
6638 *)      val="$undef"
6639         ;;
6640 esac
6641 set d_int64t
6642 eval $setvar
6643
6644
6645 : check for lengths of integral types
6646 echo " "
6647 case "$intsize" in
6648 '')
6649         echo "Checking to see how big your integers are..." >&4
6650         $cat >intsize.c <<'EOCP'
6651 #include <stdio.h>
6652 int main()
6653 {
6654         printf("intsize=%d;\n", sizeof(int));
6655         printf("longsize=%d;\n", sizeof(long));
6656         printf("shortsize=%d;\n", sizeof(short));
6657         exit(0);
6658 }
6659 EOCP
6660         set intsize
6661         if eval $compile_ok && ./intsize > /dev/null; then
6662                 eval `./intsize`
6663                 echo "Your integers are $intsize bytes long."
6664                 echo "Your long integers are $longsize bytes long."
6665                 echo "Your short integers are $shortsize bytes long."
6666         else
6667                 $cat >&4 <<EOM
6668 !
6669 Help! I can't compile and run the intsize test program: please enlighten me!
6670 (This is probably a misconfiguration in your system or libraries, and
6671 you really ought to fix it.  Still, I'll try anyway.)
6672 !
6673 EOM
6674                 dflt=4
6675                 rp="What is the size of an integer (in bytes)?"
6676                 . ./myread
6677                 intsize="$ans"
6678                 dflt=$intsize
6679                 rp="What is the size of a long integer (in bytes)?"
6680                 . ./myread
6681                 longsize="$ans"
6682                 dflt=2
6683                 rp="What is the size of a short integer (in bytes)?"
6684                 . ./myread
6685                 shortsize="$ans"
6686         fi
6687         ;;
6688 esac
6689 $rm -f intsize intsize.*
6690
6691 : check for long long
6692 echo " "
6693 echo $n "Checking to see if your system supports long long...$c" >&4
6694 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6695 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6696         val="$define"
6697         echo " Yup, it does." >&4
6698 else
6699         val="$undef"
6700         echo " Nope, it doesn't." >&4
6701 fi
6702 $rm try.*
6703 set d_longlong
6704 eval $setvar
6705
6706 : check for length of long long
6707 case "${d_longlong}${longlongsize}" in
6708 $define)
6709         echo " "
6710         $echo $n "Checking to see how big your long longs are...$c" >&4
6711         $cat >try.c <<'EOCP'
6712 #include <stdio.h>
6713 int main()
6714 {
6715         printf("%d\n", sizeof(long long));
6716 }
6717 EOCP
6718         set try
6719         if eval $compile_ok; then
6720                 longlongsize=`./try`
6721                 $echo " $longlongsize bytes." >&4
6722         else
6723                 dflt='8'
6724                 echo " "
6725                 echo "(I can't seem to compile the test program.  Guessing...)"
6726                 rp="What is the size of a long long (in bytes)?"
6727                 . ./myread
6728                 longlongsize="$ans"
6729         fi
6730         if $test "X$longsize" = "X$longlongsize"; then
6731                 echo "(That isn't any different from an ordinary long.)"
6732         fi      
6733         ;;
6734 esac
6735 $rm -f try.c try
6736
6737 echo " "
6738
6739 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6740
6741 echo "Checking how to print 64-bit integers..." >&4
6742
6743 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6744         quad=int
6745         $cat >try.c <<'EOCP'
6746 #include <sys/types.h>
6747 #include <stdio.h>
6748 int main() {
6749   int q = 12345678901;
6750   printf("%ld\n", q);
6751 }
6752 EOCP
6753         set try
6754         if eval $compile; then
6755                 yyy=`./try$exe_ext`
6756                 case "$yyy" in
6757                 12345678901)
6758                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6759                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6760                         echo "We will use %d."
6761                         ;;
6762                 esac
6763         fi
6764 fi
6765
6766 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6767         quad=long
6768         $cat >try.c <<'EOCP'
6769 #include <sys/types.h>
6770 #include <stdio.h>
6771 int main() {
6772   long q = 12345678901;
6773   printf("%ld\n", q);
6774 }
6775 EOCP
6776         set try
6777         if eval $compile; then
6778                 yyy=`./try$exe_ext`
6779                 case "$yyy" in
6780                 12345678901)
6781                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6782                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6783                         echo "We will use %ld."
6784                         ;;
6785                 esac
6786         fi
6787 fi
6788
6789 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6790         quad=int64_t
6791         $cat >try.c <<'EOCP'
6792 #include <sys/types.h>
6793 #include <inttypes.h>
6794 #include <stdio.h>
6795 int main() {
6796   int64_t q = 12345678901;
6797   printf("%" PRId64 "\n", q);
6798 }
6799 EOCP
6800         set try
6801         if eval $compile; then
6802                 yyy=`./try$exe_ext`
6803                 case "$yyy" in
6804                 12345678901)
6805                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6806                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6807                         echo "We will use the C9X style."
6808                         ;;
6809                 esac
6810         fi
6811 fi
6812
6813 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6814         quad="long long"
6815         $cat >try.c <<'EOCP'
6816 #include <sys/types.h>
6817 #include <stdio.h>
6818 int main() {
6819   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6820   printf("%lld\n", q);
6821 }
6822 EOCP
6823         set try
6824         if eval $compile; then
6825                 yyy=`./try$exe_ext`
6826                 case "$yyy" in
6827                 12345678901)
6828                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6829                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6830                         echo "We will use the %lld style."
6831                         ;;
6832                 esac
6833         fi
6834 fi
6835
6836 if $test X"$sPRId64" = X -a X"$quad" != X; then
6837         $cat >try.c <<EOCP
6838 #include <sys/types.h>
6839 #include <stdio.h>
6840 int main() {
6841   $quad q = 12345678901;
6842   printf("%Ld\n", q);
6843 }
6844 EOCP
6845         set try
6846         if eval $compile; then
6847                 yyy=`./try$exe_ext`
6848                 case "$yyy" in
6849                 12345678901)
6850                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6851                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6852                         echo "We will use %lld."
6853                         ;;
6854                 esac
6855         fi
6856 fi
6857
6858 if $test X"$sPRId64" = X -a X"$quad" != X; then
6859         $cat >try.c <<EOCP
6860 #include <sys/types.h>
6861 #include <stdio.h>
6862 int main() {
6863   $quad q = 12345678901;
6864   printf("%qd\n", q);
6865 }
6866 EOCP
6867         set try
6868         if eval $compile; then
6869                 yyy=`./try$exe_ext`
6870                 case "$yyy" in
6871                 12345678901)
6872                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6873                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6874                         echo "We will use %qd."
6875                         ;;
6876                 esac
6877         fi
6878 fi
6879
6880 if $test X"$sPRId64" = X; then
6881         echo "Cannot figure out how to print 64-bit integers." >&4
6882 fi
6883
6884 $rm -f try try.*
6885
6886 fi # intsize -o longsize -o d_int64t -o d_longlong
6887
6888 case "$sPRId64" in
6889 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
6890         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
6891         ;;
6892 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
6893         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
6894         ;;
6895 esac
6896
6897 : check for length of double
6898 echo " "
6899 case "$doublesize" in
6900 '')
6901         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
6902         $cat >try.c <<'EOCP'
6903 #include <stdio.h>
6904 int main()
6905 {
6906         printf("%d\n", sizeof(double));
6907 }
6908 EOCP
6909         set try
6910         if eval $compile_ok; then
6911                 doublesize=`./try`
6912                 $echo " $doublesize bytes." >&4
6913         else
6914                 dflt='8'
6915                 echo "(I can't seem to compile the test program.  Guessing...)"
6916                 rp="What is the size of a double precision number (in bytes)?"
6917                 . ./myread
6918                 doublesize="$ans"
6919         fi
6920         ;;
6921 esac
6922 $rm -f try.c try
6923
6924 : check for long doubles
6925 echo " "
6926 echo $n "Checking to see if your system supports long doubles...$c" >&4
6927 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
6928 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6929         val="$define"
6930         echo " Yup, it does." >&4
6931 else
6932         val="$undef"
6933         echo " Nope, it doesn't." >&4
6934 fi
6935 $rm try.*
6936 set d_longdbl
6937 eval $setvar
6938
6939 : check for length of long double
6940 case "${d_longdbl}${longdblsize}" in
6941 $define)
6942         echo " "
6943         $echo $n "Checking to see how big your long doubles are...$c" >&4
6944         $cat >try.c <<'EOCP'
6945 #include <stdio.h>
6946 int main()
6947 {
6948         printf("%d\n", sizeof(long double));
6949 }
6950 EOCP
6951         set try
6952         if eval $compile; then
6953                 longdblsize=`./try`
6954                 $echo " $longdblsize bytes." >&4
6955         else
6956                 dflt='8'
6957                 echo " "
6958                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6959                 rp="What is the size of a long double (in bytes)?"
6960                 . ./myread
6961                 longdblsize="$ans"
6962         fi
6963         if $test "X$doublesize" = "X$longdblsize"; then
6964                 echo "(That isn't any different from an ordinary double.)"
6965         fi      
6966         ;;
6967 esac
6968 $rm -f try.c try
6969
6970 echo " "
6971
6972 if $test X"$d_longdbl" = X"$define"; then
6973
6974 echo "Checking how to print long doubles..." >&4
6975
6976 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6977         $cat >try.c <<'EOCP'
6978 #include <sys/types.h>
6979 #include <stdio.h>
6980 int main() {
6981   double d = 123.456;
6982   printf("%.3f\n", d);
6983 }
6984 EOCP
6985         set try
6986         if eval $compile; then
6987                 yyy=`./try$exe_ext`
6988                 case "$yyy" in
6989                 123.456)
6990                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6991                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
6992                         echo "We will use %f."
6993                         ;;
6994                 esac
6995         fi
6996 fi
6997
6998 if $test X"$sPRIfldbl" = X; then
6999         $cat >try.c <<'EOCP'
7000 #include <sys/types.h>
7001 #include <stdio.h>
7002 int main() {
7003   long double d = 123.456;
7004   printf("%.3llf\n", d);
7005 }
7006 EOCP
7007         set try
7008         if eval $compile; then
7009                 yyy=`./try$exe_ext`
7010                 case "$yyy" in
7011                 123.456)
7012                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7013                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7014                         echo "We will use %llf."
7015                         ;;
7016                 esac
7017         fi
7018 fi
7019
7020 if $test X"$sPRIfldbl" = X; then
7021         $cat >try.c <<'EOCP'
7022 #include <sys/types.h>
7023 #include <stdio.h>
7024 int main() {
7025   long double d = 123.456;
7026   printf("%.3Lf\n", d);
7027 }
7028 EOCP
7029         set try
7030         if eval $compile; then
7031                 yyy=`./try$exe_ext`
7032                 case "$yyy" in
7033                 123.456)
7034                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7035                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7036                         echo "We will use %Lf."
7037                         ;;
7038                 esac
7039         fi
7040 fi
7041
7042 if $test X"$sPRIfldbl" = X; then
7043         $cat >try.c <<'EOCP'
7044 #include <sys/types.h>
7045 #include <stdio.h>
7046 int main() {
7047   long double d = 123.456;
7048   printf("%.3lf\n", d);
7049 }
7050 EOCP
7051         set try
7052         if eval $compile; then
7053                 yyy=`./try$exe_ext`
7054                 case "$yyy" in
7055                 123.456)
7056                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7057                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7058                         echo "We will use %lf."
7059                         ;;
7060                 esac
7061         fi
7062 fi
7063
7064 if $test X"$sPRIfldbl" = X; then
7065         echo "Cannot figure out how to print long doubles." >&4
7066 fi
7067
7068 $rm -f try try.*
7069
7070 fi # d_longdbl
7071
7072 case "$sPRIfldbl" in
7073 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7074         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7075         ;;
7076 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7077         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7078         ;;
7079 esac
7080
7081 : Initialize h_fcntl
7082 h_fcntl=false
7083
7084 : Initialize h_sysfile
7085 h_sysfile=false
7086
7087 : access call always available on UNIX
7088 set access d_access
7089 eval $inlibc
7090
7091 : locate the flags for 'access()'
7092 case "$d_access" in
7093 "$define")
7094         echo " "
7095         $cat >access.c <<'EOCP'
7096 #include <sys/types.h>
7097 #ifdef I_FCNTL
7098 #include <fcntl.h>
7099 #endif
7100 #ifdef I_SYS_FILE
7101 #include <sys/file.h>
7102 #endif
7103 #ifdef I_UNISTD
7104 #include <unistd.h>
7105 #endif
7106 int main() {
7107         exit(R_OK);
7108 }
7109 EOCP
7110         : check sys/file.h first, no particular reason here
7111         if $test `./findhdr sys/file.h` && \
7112                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7113                 h_sysfile=true;
7114                 echo "<sys/file.h> defines the *_OK access constants." >&4
7115         elif $test `./findhdr fcntl.h` && \
7116                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7117                 h_fcntl=true;
7118                 echo "<fcntl.h> defines the *_OK access constants." >&4
7119         elif $test `./findhdr unistd.h` && \
7120                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7121                 echo "<unistd.h> defines the *_OK access constants." >&4
7122         else
7123                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7124         fi
7125         ;;
7126 esac
7127 $rm -f access*
7128
7129 : see if accessx exists
7130 set accessx d_accessx
7131 eval $inlibc
7132
7133 : see if alarm exists
7134 set alarm d_alarm
7135 eval $inlibc
7136
7137 : see if atolf exists
7138 set atolf d_atolf
7139 eval $inlibc
7140
7141 : see if atoll exists
7142 set atoll d_atoll
7143 eval $inlibc
7144
7145 : Look for GNU-cc style attribute checking
7146 echo " "
7147 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7148 $cat >attrib.c <<'EOCP'
7149 #include <stdio.h>
7150 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7151 EOCP
7152 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7153         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7154                 echo "Your C compiler doesn't fully support __attribute__."
7155                 val="$undef"
7156         else
7157                 echo "Your C compiler supports __attribute__."
7158                 val="$define"
7159         fi
7160 else
7161         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7162         val="$undef"
7163 fi
7164 set d_attribut
7165 eval $setvar
7166 $rm -f attrib*
7167
7168 : see if bcmp exists
7169 set bcmp d_bcmp
7170 eval $inlibc
7171
7172 : see if bcopy exists
7173 set bcopy d_bcopy
7174 eval $inlibc
7175
7176 : see if this is a unistd.h system
7177 set unistd.h i_unistd
7178 eval $inhdr
7179
7180 : see if getpgrp exists
7181 set getpgrp d_getpgrp
7182 eval $inlibc
7183
7184 case "$d_getpgrp" in
7185 "$define")
7186         echo " "
7187         echo "Checking to see which flavor of getpgrp is in use..."
7188         $cat >set.c <<EOP
7189 #$i_unistd I_UNISTD
7190 #include <sys/types.h>
7191 #ifdef I_UNISTD
7192 #  include <unistd.h>
7193 #endif
7194 int main()
7195 {
7196         if (getuid() == 0) {
7197                 printf("(I see you are running Configure as super-user...)\n");
7198                 setuid(1);
7199         }
7200 #ifdef TRY_BSD_PGRP
7201         if (getpgrp(1) == 0)
7202                 exit(0);
7203 #else
7204         if (getpgrp() > 0)
7205                 exit(0);
7206 #endif
7207         exit(1);
7208 }
7209 EOP
7210         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7211                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7212                 val="$define"
7213         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7214                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7215                 val="$undef"
7216         else
7217                 echo "I can't seem to compile and run the test program."
7218                 if ./usg; then
7219                         xxx="a USG one, i.e. you use getpgrp()."
7220                 else
7221                         # SVR4 systems can appear rather BSD-ish.
7222                         case "$i_unistd" in
7223                         $undef)
7224                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7225                                 val="$define"
7226                                 ;;
7227                         $define)
7228                                 xxx="probably a USG one, i.e. you use getpgrp()."
7229                                 val="$undef"
7230                                 ;;
7231                         esac
7232                 fi
7233                 echo "Assuming your getpgrp is $xxx" >&4
7234         fi
7235         ;;
7236 *) val="$undef";;
7237 esac
7238 set d_bsdgetpgrp
7239 eval $setvar
7240 $rm -f set set.c
7241
7242 : see if setpgrp exists
7243 set setpgrp d_setpgrp
7244 eval $inlibc
7245
7246 case "$d_setpgrp" in
7247 "$define")
7248         echo " "
7249         echo "Checking to see which flavor of setpgrp is in use..."
7250         $cat >set.c <<EOP
7251 #$i_unistd I_UNISTD
7252 #include <sys/types.h>
7253 #ifdef I_UNISTD
7254 #  include <unistd.h>
7255 #endif
7256 int main()
7257 {
7258         if (getuid() == 0) {
7259                 printf("(I see you are running Configure as super-user...)\n");
7260                 setuid(1);
7261         }
7262 #ifdef TRY_BSD_PGRP
7263         if (-1 == setpgrp(1, 1))
7264                 exit(0);
7265 #else
7266         if (setpgrp() != -1)
7267                 exit(0);
7268 #endif
7269         exit(1);
7270 }
7271 EOP
7272         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7273                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7274                 val="$define"
7275         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7276                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7277                 val="$undef"
7278         else
7279                 echo "(I can't seem to compile and run the test program.)"
7280                 if ./usg; then
7281                         xxx="a USG one, i.e. you use setpgrp()."
7282                 else
7283                         # SVR4 systems can appear rather BSD-ish.
7284                         case "$i_unistd" in
7285                         $undef)
7286                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7287                                 val="$define"
7288                                 ;;
7289                         $define)
7290                                 xxx="probably a USG one, i.e. you use setpgrp()."
7291                                 val="$undef"
7292                                 ;;
7293                         esac
7294                 fi
7295                 echo "Assuming your setpgrp is $xxx" >&4
7296         fi
7297         ;;
7298 *) val="$undef";;
7299 esac
7300 set d_bsdsetpgrp
7301 eval $setvar
7302 $rm -f set set.c
7303 : see if bzero exists
7304 set bzero d_bzero
7305 eval $inlibc
7306
7307 : see if signal is declared as pointer to function returning int or void
7308 echo " "
7309 xxx=`./findhdr signal.h`
7310 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7311 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7312         echo "You have int (*signal())() instead of void." >&4
7313         val="$undef"
7314 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7315         echo "You have void (*signal())()." >&4
7316         val="$define"
7317 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7318         echo "You have int (*signal())() instead of void." >&4
7319         val="$undef"
7320 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7321         echo "You have void (*signal())()." >&4
7322         val="$define"
7323 else
7324         case "$d_voidsig" in
7325         '')
7326         echo "I can't determine whether signal handler returns void or int..." >&4
7327                 dflt=void
7328                 rp="What type does your signal handler return?"
7329                 . ./myread
7330                 case "$ans" in
7331                 v*) val="$define";;
7332                 *) val="$undef";;
7333                 esac;;
7334         "$define")
7335                 echo "As you already told me, signal handler returns void." >&4
7336                 val="$define"
7337                 ;;
7338         *)      echo "As you already told me, signal handler returns int." >&4
7339                 val="$undef"
7340                 ;;
7341         esac
7342 fi
7343 set d_voidsig
7344 eval $setvar
7345 case "$d_voidsig" in
7346 "$define") signal_t="void";;
7347 *) signal_t="int";;
7348 esac
7349 $rm -f $$.tmp
7350
7351 : check for ability to cast large floats to 32-bit ints.
7352 echo " "
7353 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7354 if $test "$intsize" -ge 4; then
7355         xxx=int
7356 else
7357         xxx=long
7358 fi
7359 $cat >try.c <<EOCP
7360 #include <stdio.h>
7361 #include <sys/types.h>
7362 #include <signal.h>
7363 $signal_t blech(s) int s; { exit(3); }
7364 int main()
7365 {
7366         $xxx i32;
7367         double f, g;
7368         int result = 0;
7369         char str[16];
7370         signal(SIGFPE, blech);
7371
7372         /* Don't let compiler optimize the test away.  Store the number 
7373            in a writable string for gcc to pass to sscanf under HP/UX.
7374         */
7375         sprintf(str, "2147483647");
7376         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7377         g = 10 * f;
7378         i32  = ($xxx) g;
7379
7380         /* x86 processors will probably give 0x8000 0000, which is a
7381        sign change.  We don't want that.  We want to mimic SPARC
7382            behavior here, which is to preserve the sign and give
7383            back 0x7fff ffff.
7384         */
7385         if (i32 != ($xxx) f)
7386                 result |= 1;
7387         exit(result);
7388 }
7389 EOCP
7390 set try
7391 if eval $compile_ok; then
7392         ./try
7393         yyy=$?
7394 else
7395         echo "(I can't seem to compile the test program--assuming it can't)"
7396         yyy=1
7397 fi
7398 case "$yyy" in
7399 0)      val="$define"
7400         echo "Yup, it can."
7401         ;;
7402 *)      val="$undef"
7403         echo "Nope, it can't."
7404         ;;
7405 esac
7406 set d_casti32
7407 eval $setvar
7408 $rm -f try try.*
7409
7410 : check for ability to cast negative floats to unsigned
7411 echo " "
7412 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7413 $cat >try.c <<EOCP
7414 #include <stdio.h>
7415 #include <sys/types.h>
7416 #include <signal.h>
7417 $signal_t blech(s) int s; { exit(7); }
7418 $signal_t blech_in_list(s) int s; { exit(4); }
7419 unsigned long dummy_long(p) unsigned long p; { return p; }
7420 unsigned int dummy_int(p) unsigned int p; { return p; }
7421 unsigned short dummy_short(p) unsigned short p; { return p; }
7422 int main()
7423 {
7424         double f;
7425         unsigned long along;
7426         unsigned int aint;
7427         unsigned short ashort;
7428         int result = 0;
7429         char str[16];
7430         
7431         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7432            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7433            optimized the whole file away
7434         */
7435         /* Store the number in a writable string for gcc to pass to 
7436            sscanf under HP/UX.
7437         */
7438         sprintf(str, "-123");
7439         sscanf(str, "%lf", &f);  /* f = -123.; */
7440
7441         signal(SIGFPE, blech);
7442         along = (unsigned long)f;
7443         aint = (unsigned int)f;
7444         ashort = (unsigned short)f;
7445         if (along != (unsigned long)-123)
7446                 result |= 1;
7447         if (aint != (unsigned int)-123)
7448                 result |= 1;
7449         if (ashort != (unsigned short)-123)
7450                 result |= 1;
7451         sprintf(str, "1073741824.");
7452         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7453         f = f + f;
7454         along = 0;
7455         along = (unsigned long)f;
7456         if (along != 0x80000000)
7457                 result |= 2;
7458         f -= 1.;
7459         along = 0;
7460         along = (unsigned long)f;
7461         if (along != 0x7fffffff)
7462                 result |= 1;
7463         f += 2.;
7464         along = 0;
7465         along = (unsigned long)f;
7466         if (along != 0x80000001)
7467                 result |= 2;
7468         if (result)
7469                 exit(result);
7470         signal(SIGFPE, blech_in_list);
7471         sprintf(str, "123.");
7472         sscanf(str, "%lf", &f);  /* f = 123.; */
7473         along = dummy_long((unsigned long)f);
7474         aint = dummy_int((unsigned int)f);
7475         ashort = dummy_short((unsigned short)f);
7476         if (along != (unsigned long)123)
7477                 result |= 4;
7478         if (aint != (unsigned int)123)
7479                 result |= 4;
7480         if (ashort != (unsigned short)123)
7481                 result |= 4;
7482         exit(result);
7483
7484 }
7485 EOCP
7486 set try
7487 if eval $compile_ok; then
7488         ./try
7489         castflags=$?
7490 else
7491         echo "(I can't seem to compile the test program--assuming it can't)"
7492         castflags=7
7493 fi
7494 case "$castflags" in
7495 0)      val="$define"
7496         echo "Yup, it can."
7497         ;;
7498 *)      val="$undef"
7499         echo "Nope, it can't."
7500         ;;
7501 esac
7502 set d_castneg
7503 eval $setvar
7504 $rm -f try.*
7505
7506 : see if vprintf exists
7507 echo " "
7508 if set vprintf val -f d_vprintf; eval $csym; $val; then
7509         echo 'vprintf() found.' >&4
7510         val="$define"
7511         $cat >vprintf.c <<'EOF'
7512 #include <varargs.h>
7513
7514 int main() { xxx("foo"); }
7515
7516 xxx(va_alist)
7517 va_dcl
7518 {
7519         va_list args;
7520         char buf[10];
7521
7522         va_start(args);
7523         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7524 }
7525 EOF
7526         set vprintf
7527         if eval $compile && ./vprintf; then
7528                 echo "Your vsprintf() returns (int)." >&4
7529                 val2="$undef"
7530         else
7531                 echo "Your vsprintf() returns (char*)." >&4
7532                 val2="$define"
7533         fi
7534 else
7535         echo 'vprintf() NOT found.' >&4
7536                 val="$undef"
7537                 val2="$undef"
7538 fi
7539 set d_vprintf
7540 eval $setvar
7541 val=$val2
7542 set d_charvspr
7543 eval $setvar
7544
7545 : see if chown exists
7546 set chown d_chown
7547 eval $inlibc
7548
7549 : see if chroot exists
7550 set chroot d_chroot
7551 eval $inlibc
7552
7553 : see if chsize exists
7554 set chsize d_chsize
7555 eval $inlibc
7556
7557 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7558 while $test $# -ge 2; do
7559         case "$1" in
7560         $define) echo "#include <$2>";;
7561         esac ;
7562     shift 2;
7563 done > try.c;
7564 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7565 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7566         val="$define";
7567 else
7568         val="$undef";
7569 fi;
7570 set $varname;
7571 eval $setvar;
7572 $rm -f try.c try.o'
7573
7574 : see if this is a sys/uio.h system
7575 set sys/uio.h i_sysuio
7576 eval $inhdr
7577
7578 echo "Checking to see if your system supports struct iovec..." >&4
7579 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7580 eval $hasfield
7581 case "$d_iovec_s" in
7582 "$define")      echo "Yup, it does." >&4
7583                 ;;
7584 *)              echo "Nope, it doesn't." >&4
7585                 ;;
7586 esac
7587
7588 socketlib=''
7589 sockethdr=''
7590 : see whether socket exists
7591 echo " "
7592 $echo $n "Hmm... $c" >&4
7593 if set socket val -f d_socket; eval $csym; $val; then
7594         echo "Looks like you have Berkeley networking support." >&4
7595         d_socket="$define"
7596         if set setsockopt val -f; eval $csym; $val; then
7597                 d_oldsock="$undef"
7598         else
7599                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7600                 d_oldsock="$define"
7601         fi
7602 else
7603         if $contains socklib libc.list >/dev/null 2>&1; then
7604                 echo "Looks like you have Berkeley networking support." >&4
7605                 d_socket="$define"
7606                 : we will have to assume that it supports the 4.2 BSD interface
7607                 d_oldsock="$undef"
7608         else
7609                 echo "You don't have Berkeley networking in libc$_a..." >&4
7610                 if test "X$d_socket" = "X$define"; then
7611                    echo "...but you seem to believe that you have sockets." >&4
7612                 else
7613                         for net in net socket
7614                         do
7615                                 if test -f /usr/lib/lib$net$_a; then
7616                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7617                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7618                                         if $contains socket libc.list >/dev/null 2>&1; then
7619                                                 d_socket="$define"
7620                                                 socketlib="-l$net"
7621                                                 case "$net" in
7622                                                 net)
7623                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7624                                                         sockethdr="-I/usr/netinclude"
7625                                                         ;;
7626                                                 esac
7627                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7628                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7629                                                         d_oldsock="$undef"
7630                                                 else
7631                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7632                                                         d_oldsock="$define"
7633                                                 fi
7634                                                 break
7635                                         fi
7636                                 fi
7637                         done
7638                         if test "X$d_socket" != "X$define"; then
7639                            echo "or anywhere else I see." >&4
7640                            d_socket="$undef"
7641                            d_oldsock="$undef"
7642                         fi
7643                 fi
7644         fi
7645 fi
7646
7647 : see if socketpair exists
7648 set socketpair d_sockpair
7649 eval $inlibc
7650
7651
7652 echo " "
7653 echo "Checking the availability of certain socket constants..." >& 4
7654 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7655         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7656         $cat >try.c <<EOF
7657 #include <sys/types.h>
7658 #include <sys/socket.h>
7659 int main() {
7660     int i = $ENUM;
7661 }
7662 EOF
7663         val="$undef"
7664         set try; if eval $compile; then
7665                 val="$define"
7666         fi
7667         set d_${enum}; eval $setvar
7668         $rm -f try.c try
7669 done
7670
7671 set sendmsg d_sendmsg
7672 eval $inlibc
7673
7674 set recvmsg d_recvmsg
7675 eval $inlibc
7676
7677 echo " "
7678 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7679 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7680 eval $hasfield
7681 case "$d_msghdr_s" in
7682 "$define")      echo "Yup, it does." >&4
7683                 ;;
7684 *)              echo "Nope, it doesn't." >&4
7685                 ;;
7686 esac
7687
7688 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7689 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7690 eval $hasfield
7691 case "$d_cmsghdr_s" in
7692 "$define")      echo "Yup, it does." >&4
7693                 ;;
7694 *)              echo "Nope, it doesn't." >&4
7695                 ;;
7696 esac
7697
7698 : check for const keyword
7699 echo " "
7700 echo 'Checking to see if your C compiler knows about "const"...' >&4
7701 $cat >const.c <<'EOCP'
7702 typedef struct spug { int drokk; } spug;
7703 int main()
7704 {
7705         const char *foo;
7706         const spug y;
7707 }
7708 EOCP
7709 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7710         val="$define"
7711         echo "Yup, it does."
7712 else
7713         val="$undef"
7714         echo "Nope, it doesn't."
7715 fi
7716 set d_const
7717 eval $setvar
7718
7719 : see if crypt exists
7720 echo " "
7721 if set crypt val -f d_crypt; eval $csym; $val; then
7722         echo 'crypt() found.' >&4
7723         val="$define"
7724         cryptlib=''
7725 else
7726         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7727         if $test -z "$cryptlib"; then
7728                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7729         else
7730                 cryptlib=-lcrypt
7731         fi
7732         if $test -z "$cryptlib"; then
7733                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7734         else
7735                 cryptlib=-lcrypt
7736         fi
7737         if $test -z "$cryptlib"; then
7738                 cryptlib=`./loc libcrypt$_a "" $libpth`
7739         else
7740                 cryptlib=-lcrypt
7741         fi
7742         if $test -z "$cryptlib"; then
7743                 echo 'crypt() NOT found.' >&4
7744                 val="$undef"
7745         else
7746                 val="$define"
7747         fi
7748 fi
7749 set d_crypt
7750 eval $setvar
7751
7752 : get csh whereabouts
7753 case "$csh" in
7754 'csh') val="$undef" ;;
7755 *) val="$define" ;;
7756 esac
7757 set d_csh
7758 eval $setvar
7759 : Respect a hint or command line value for full_csh.
7760 case "$full_csh" in
7761 '') full_csh=$csh ;;
7762 esac
7763
7764 : see if cuserid exists
7765 set cuserid d_cuserid
7766 eval $inlibc
7767
7768 : see if this is a limits.h system
7769 set limits.h i_limits
7770 eval $inhdr
7771
7772 : see if this is a float.h system
7773 set float.h i_float
7774 eval $inhdr
7775
7776 : See if number of significant digits in a double precision number is known
7777 echo " "
7778 $cat >dbl_dig.c <<EOM
7779 #$i_limits I_LIMITS
7780 #$i_float I_FLOAT
7781 #ifdef I_LIMITS
7782 #include <limits.h>
7783 #endif
7784 #ifdef I_FLOAT
7785 #include <float.h>
7786 #endif
7787 #ifdef DBL_DIG
7788 printf("Contains DBL_DIG");
7789 #endif
7790 EOM
7791 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7792 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7793         echo "DBL_DIG found." >&4
7794         val="$define"
7795 else
7796         echo "DBL_DIG NOT found." >&4
7797         val="$undef"
7798 fi
7799 $rm -f dbl_dig.?
7800 set d_dbl_dig
7801 eval $setvar
7802
7803 : see if difftime exists
7804 set difftime d_difftime
7805 eval $inlibc
7806
7807 : see if this is a dirent system
7808 echo " "
7809 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7810         val="$define"
7811         echo "<dirent.h> found." >&4
7812 else
7813         val="$undef"
7814         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7815                 echo "<sys/dir.h> found." >&4
7816                 echo " "
7817         else
7818                 xinc=`./findhdr sys/ndir.h`
7819         fi
7820         echo "<dirent.h> NOT found." >&4
7821 fi
7822 set i_dirent
7823 eval $setvar
7824
7825 : Look for type of directory structure.
7826 echo " "
7827 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7828
7829 case "$direntrytype" in
7830 ''|' ')
7831         case "$i_dirent" in
7832         $define) guess1='struct dirent' ;;
7833         *) guess1='struct direct'  ;;
7834         esac
7835         ;;
7836 *)      guess1="$direntrytype"
7837         ;;
7838 esac
7839
7840 case "$guess1" in
7841 'struct dirent') guess2='struct direct' ;;
7842 *) guess2='struct dirent' ;;
7843 esac
7844                 
7845 if $contains "$guess1" try.c >/dev/null 2>&1; then
7846         direntrytype="$guess1"
7847         echo "Your directory entries are $direntrytype." >&4
7848 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7849         direntrytype="$guess2"
7850         echo "Your directory entries seem to be $direntrytype." >&4
7851 else
7852         echo "I don't recognize your system's directory entries." >&4
7853         rp="What type is used for directory entries on this system?"
7854         dflt="$guess1"
7855         . ./myread
7856         direntrytype="$ans"
7857 fi
7858 $rm -f try.c
7859
7860
7861 : see if the directory entry stores field length
7862 echo " "
7863 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7864 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7865         echo "Good, your directory entry keeps length information in d_namlen." >&4
7866         val="$define"
7867 else
7868         echo "Your directory entry does not know about the d_namlen field." >&4
7869         val="$undef"
7870 fi
7871 set d_dirnamlen
7872 eval $setvar
7873 $rm -f try.c
7874
7875 : see if dlerror exists
7876 xxx_runnm="$runnm"
7877 runnm=false
7878 set dlerror d_dlerror
7879 eval $inlibc
7880 runnm="$xxx_runnm"
7881
7882 : see if dlfcn is available
7883 set dlfcn.h i_dlfcn
7884 eval $inhdr
7885
7886 case "$usedl" in
7887 $define|y|true)
7888         $cat << EOM
7889
7890 On a few systems, the dynamically loaded modules that perl generates and uses
7891 will need a different extension than shared libs. The default will probably
7892 be appropriate.
7893
7894 EOM
7895         case "$dlext" in
7896         '')     dflt="$so" ;;
7897         *)      dflt="$dlext" ;;
7898         esac
7899         rp='What is the extension of dynamically loaded modules'
7900         . ./myread
7901         dlext="$ans"
7902         ;;
7903 *)
7904         dlext="none"
7905         ;;
7906 esac
7907
7908 : Check if dlsym need a leading underscore
7909 echo " "
7910 val="$undef"
7911
7912 case "$dlsrc" in
7913 dl_dlopen.xs)
7914         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7915         $cat >dyna.c <<'EOM'
7916 fred () { }
7917 EOM
7918
7919 $cat >fred.c<<EOM
7920
7921 #include <stdio.h>
7922 #$i_dlfcn I_DLFCN
7923 #ifdef I_DLFCN
7924 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7925 #else
7926 #include <sys/types.h>
7927 #include <nlist.h>
7928 #include <link.h>
7929 #endif
7930
7931 extern int fred() ;
7932
7933 int main()
7934 {
7935     void * handle ;
7936     void * symbol ;
7937 #ifndef RTLD_LAZY
7938     int mode = 1 ;
7939 #else
7940     int mode = RTLD_LAZY ;
7941 #endif
7942     handle = dlopen("./dyna.$dlext", mode) ;
7943     if (handle == NULL) {
7944         printf ("1\n") ;
7945         fflush (stdout) ;
7946         exit(0);
7947     }
7948     symbol = dlsym(handle, "fred") ;
7949     if (symbol == NULL) {
7950         /* try putting a leading underscore */
7951         symbol = dlsym(handle, "_fred") ;
7952         if (symbol == NULL) {
7953             printf ("2\n") ;
7954             fflush (stdout) ;
7955             exit(0);
7956         }
7957         printf ("3\n") ;
7958     }
7959     else
7960         printf ("4\n") ;
7961     fflush (stdout) ;
7962     exit(0);
7963 }
7964 EOM
7965         : Call the object file tmp-dyna.o in case dlext=o.
7966         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
7967                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
7968                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
7969                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
7970                 xxx=`./fred`
7971                 case $xxx in
7972                 1)      echo "Test program failed using dlopen." >&4
7973                         echo "Perhaps you should not use dynamic loading." >&4;;
7974                 2)      echo "Test program failed using dlsym." >&4
7975                         echo "Perhaps you should not use dynamic loading." >&4;;
7976                 3)      echo "dlsym needs a leading underscore" >&4
7977                         val="$define" ;;
7978                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
7979                 esac
7980         else
7981                 echo "I can't compile and run the test program." >&4
7982                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
7983         fi
7984         ;;
7985 esac
7986                 
7987 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
7988
7989 set d_dlsymun
7990 eval $setvar
7991
7992 hasproto='varname=$1; func=$2; shift; shift;
7993 while $test $# -ge 2; do
7994         case "$1" in
7995         $define) echo "#include <$2>";;
7996         esac ;
7997     shift 2;
7998 done > try.c;
7999 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8000 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8001         echo "$func() prototype found.";
8002         val="$define";
8003 else
8004         echo "$func() prototype NOT found.";
8005         val="$undef";
8006 fi;
8007 set $varname;
8008 eval $setvar;
8009 $rm -f try.c tryout.c'
8010
8011 : see if prototype for drand48 is available
8012 echo " "
8013 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8014 eval $hasproto
8015
8016 : see if dup2 exists
8017 set dup2 d_dup2
8018 eval $inlibc
8019
8020 : see if eaccess exists
8021 set eaccess d_eaccess
8022 eval $inlibc
8023
8024 : see if endgrent exists
8025 set endgrent d_endgrent
8026 eval $inlibc
8027
8028 : see if endhostent exists
8029 set endhostent d_endhent
8030 eval $inlibc
8031
8032 : see if endnetent exists
8033 set endnetent d_endnent
8034 eval $inlibc
8035
8036 : see if endprotoent exists
8037 set endprotoent d_endpent
8038 eval $inlibc
8039
8040 : see if endpwent exists
8041 set endpwent d_endpwent
8042 eval $inlibc
8043
8044 : see if endservent exists
8045 set endservent d_endsent
8046 eval $inlibc
8047
8048 : see if endspent exists
8049 set endspent d_endspent
8050 eval $inlibc
8051
8052 : Locate the flags for 'open()'
8053 echo " "
8054 $cat >open3.c <<'EOCP'
8055 #include <sys/types.h>
8056 #ifdef I_FCNTL
8057 #include <fcntl.h>
8058 #endif
8059 #ifdef I_SYS_FILE
8060 #include <sys/file.h>
8061 #endif
8062 int main() {
8063         if(O_RDONLY);
8064 #ifdef O_TRUNC
8065         exit(0);
8066 #else
8067         exit(1);
8068 #endif
8069 }
8070 EOCP
8071 : check sys/file.h first to get FREAD on Sun
8072 if $test `./findhdr sys/file.h` && \
8073                 set open3 -DI_SYS_FILE && eval $compile; then
8074         h_sysfile=true;
8075         echo "<sys/file.h> defines the O_* constants..." >&4
8076         if ./open3; then
8077                 echo "and you have the 3 argument form of open()." >&4
8078                 val="$define"
8079         else
8080                 echo "but not the 3 argument form of open().  Oh, well." >&4
8081                 val="$undef"
8082         fi
8083 elif $test `./findhdr fcntl.h` && \
8084                 set open3 -DI_FCNTL && eval $compile; then
8085         h_fcntl=true;
8086         echo "<fcntl.h> defines the O_* constants..." >&4
8087         if ./open3; then
8088                 echo "and you have the 3 argument form of open()." >&4
8089                 val="$define"
8090         else
8091                 echo "but not the 3 argument form of open().  Oh, well." >&4
8092                 val="$undef"
8093         fi
8094 else
8095         val="$undef"
8096         echo "I can't find the O_* constant definitions!  You got problems." >&4
8097 fi
8098 set d_open3
8099 eval $setvar
8100 $rm -f open3*
8101
8102 : check for non-blocking I/O stuff
8103 case "$h_sysfile" in
8104 true) echo "#include <sys/file.h>" > head.c;;
8105 *)
8106         case "$h_fcntl" in
8107         true) echo "#include <fcntl.h>" > head.c;;
8108         *) echo "#include <sys/fcntl.h>" > head.c;;
8109         esac
8110         ;;
8111 esac
8112 echo " "
8113 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8114 case "$o_nonblock" in
8115 '')
8116         $cat head.c > try.c
8117         $cat >>try.c <<'EOCP'
8118 int main() {
8119 #ifdef O_NONBLOCK
8120         printf("O_NONBLOCK\n");
8121         exit(0);
8122 #endif
8123 #ifdef O_NDELAY
8124         printf("O_NDELAY\n");
8125         exit(0);
8126 #endif
8127 #ifdef FNDELAY
8128         printf("FNDELAY\n");
8129         exit(0);
8130 #endif
8131         exit(0);
8132 }
8133 EOCP
8134         set try
8135         if eval $compile_ok; then
8136                 o_nonblock=`./try`
8137                 case "$o_nonblock" in
8138                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8139                 *) echo "Seems like we can use $o_nonblock.";;
8140                 esac
8141         else
8142                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8143         fi
8144         ;;
8145 *) echo "Using $hint value $o_nonblock.";;
8146 esac
8147 $rm -f try try.* .out core
8148
8149 echo " "
8150 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8151 case "$eagain" in
8152 '')
8153         $cat head.c > try.c
8154         $cat >>try.c <<EOCP
8155 #include <errno.h>
8156 #include <sys/types.h>
8157 #include <signal.h>
8158 #define MY_O_NONBLOCK $o_nonblock
8159 #ifndef errno  /* XXX need better Configure test */
8160 extern int errno;
8161 #endif
8162 $signal_t blech(x) int x; { exit(3); }
8163 EOCP
8164         $cat >> try.c <<'EOCP'
8165 int main()
8166 {
8167         int pd[2];
8168         int pu[2];
8169         char buf[1];
8170         char string[100];
8171
8172         pipe(pd);       /* Down: child -> parent */
8173         pipe(pu);       /* Up: parent -> child */
8174         if (0 != fork()) {
8175                 int ret;
8176                 close(pd[1]);   /* Parent reads from pd[0] */
8177                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8178                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8179                         exit(1);
8180                 signal(SIGALRM, blech);
8181                 alarm(5);
8182                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8183                         exit(2);
8184                 sprintf(string, "%d\n", ret);
8185                 write(2, string, strlen(string));
8186                 alarm(0);
8187 #ifdef EAGAIN
8188                 if (errno == EAGAIN) {
8189                         printf("EAGAIN\n");
8190                         goto ok;
8191                 }
8192 #endif
8193 #ifdef EWOULDBLOCK
8194                 if (errno == EWOULDBLOCK)
8195                         printf("EWOULDBLOCK\n");
8196 #endif
8197         ok:
8198                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8199                 sleep(2);                               /* Give it time to close our pipe */
8200                 alarm(5);
8201                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8202                 alarm(0);
8203                 sprintf(string, "%d\n", ret);
8204                 write(3, string, strlen(string));
8205                 exit(0);
8206         }
8207
8208         close(pd[0]);                   /* We write to pd[1] */
8209         close(pu[1]);                   /* We read from pu[0] */
8210         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8211         close(pd[1]);                   /* Pipe pd is now fully closed! */
8212         exit(0);                                /* Bye bye, thank you for playing! */
8213 }
8214 EOCP
8215         set try
8216         if eval $compile_ok; then
8217                 echo "$startsh" >mtry
8218                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8219                 chmod +x mtry
8220                 ./mtry >/dev/null 2>&1
8221                 case $? in
8222                 0) eagain=`$cat try.out`;;
8223                 1) echo "Could not perform non-blocking setting!";;
8224                 2) echo "I did a successful read() for something that was not there!";;
8225                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8226                 *) echo "Something terribly wrong happened during testing.";;
8227                 esac
8228                 rd_nodata=`$cat try.ret`
8229                 echo "A read() system call with no data present returns $rd_nodata."
8230                 case "$rd_nodata" in
8231                 0|-1) ;;
8232                 *)
8233                         echo "(That's peculiar, fixing that to be -1.)"
8234                         rd_nodata=-1
8235                         ;;
8236                 esac
8237                 case "$eagain" in
8238                 '')
8239                         echo "Forcing errno EAGAIN on read() with no data available."
8240                         eagain=EAGAIN
8241                         ;;
8242                 *)
8243                         echo "Your read() sets errno to $eagain when no data is available."
8244                         ;;
8245                 esac
8246                 status=`$cat try.err`
8247                 case "$status" in
8248                 0) echo "And it correctly returns 0 to signal EOF.";;
8249                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8250                 *) echo "However, your read() returns '$status' on EOF??";;
8251                 esac
8252                 val="$define"
8253                 if test "$status" = "$rd_nodata"; then
8254                         echo "WARNING: you can't distinguish between EOF and no data!"
8255                         val="$undef"
8256                 fi
8257         else
8258                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8259                 eagain=EAGAIN
8260         fi
8261         set d_eofnblk
8262         eval $setvar
8263         ;;
8264 *)
8265         echo "Using $hint value $eagain."
8266         echo "Your read() returns $rd_nodata when no data is present."
8267         case "$d_eofnblk" in
8268         "$define") echo "And you can see EOF because read() returns 0.";;
8269         "$undef") echo "But you can't see EOF status from read() returned value.";;
8270         *)
8271                 echo "(Assuming you can't see EOF status from read anyway.)"
8272                 d_eofnblk=$undef
8273                 ;;
8274         esac
8275         ;;
8276 esac
8277 $rm -f try try.* .out core head.c mtry
8278
8279 : see if fchmod exists
8280 set fchmod d_fchmod
8281 eval $inlibc
8282
8283 : see if fchown exists
8284 set fchown d_fchown
8285 eval $inlibc
8286
8287 : see if this is an fcntl system
8288 set fcntl d_fcntl
8289 eval $inlibc
8290
8291 : see if sys/select.h has to be included
8292 set sys/select.h i_sysselct
8293 eval $inhdr
8294
8295 : see if we should include time.h, sys/time.h, or both
8296 echo " "
8297 if test "X$timeincl" = X; then
8298         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8299         $echo $n "I'm now running the test program...$c"
8300         $cat >try.c <<'EOCP'
8301 #include <sys/types.h>
8302 #ifdef I_TIME
8303 #include <time.h>
8304 #endif
8305 #ifdef I_SYSTIME
8306 #ifdef SYSTIMEKERNEL
8307 #define KERNEL
8308 #endif
8309 #include <sys/time.h>
8310 #endif
8311 #ifdef I_SYSSELECT
8312 #include <sys/select.h>
8313 #endif
8314 int main()
8315 {
8316         struct tm foo;
8317 #ifdef S_TIMEVAL
8318         struct timeval bar;
8319 #endif
8320 #ifdef S_TIMEZONE
8321         struct timezone tzp;
8322 #endif
8323         if (foo.tm_sec == foo.tm_sec)
8324                 exit(0);
8325 #ifdef S_TIMEVAL
8326         if (bar.tv_sec == bar.tv_sec)
8327                 exit(0);
8328 #endif
8329         exit(1);
8330 }
8331 EOCP
8332         flags=''
8333         for s_timezone in '-DS_TIMEZONE' ''; do
8334         sysselect=''
8335         for s_timeval in '-DS_TIMEVAL' ''; do
8336         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8337         for i_time in '' '-DI_TIME'; do
8338         for i_systime in '-DI_SYSTIME' ''; do
8339                 case "$flags" in
8340                 '') $echo $n ".$c"
8341                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8342                         if eval $compile; then
8343                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8344                                 shift
8345                                 flags="$*"
8346                                 echo " "
8347                                 $echo $n "Succeeded with $flags$c"
8348                         fi
8349                         ;;
8350                 esac
8351         done
8352         done
8353         done
8354         done
8355         done
8356         timeincl=''
8357         echo " "
8358         case "$flags" in
8359         *SYSTIMEKERNEL*) i_systimek="$define"
8360                 timeincl=`./findhdr sys/time.h`
8361                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8362         *) i_systimek="$undef";;
8363         esac
8364         case "$flags" in
8365         *I_TIME*) i_time="$define"
8366                 timeincl=`./findhdr time.h`" $timeincl"
8367                 echo "We'll include <time.h>." >&4;;
8368         *) i_time="$undef";;
8369         esac
8370         case "$flags" in
8371         *I_SYSTIME*) i_systime="$define"
8372                 timeincl=`./findhdr sys/time.h`" $timeincl"
8373                 echo "We'll include <sys/time.h>." >&4;;
8374         *) i_systime="$undef";;
8375         esac
8376         $rm -f try.c try
8377 fi
8378
8379 : check for fd_set items
8380 $cat <<EOM
8381
8382 Checking to see how well your C compiler handles fd_set and friends ...
8383 EOM
8384 $cat >fd_set.c <<EOCP
8385 #$i_systime I_SYS_TIME
8386 #$i_sysselct I_SYS_SELECT
8387 #$d_socket HAS_SOCKET
8388 #include <sys/types.h>
8389 #ifdef HAS_SOCKET
8390 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8391 #endif
8392 #ifdef I_SYS_TIME
8393 #include <sys/time.h>
8394 #endif
8395 #ifdef I_SYS_SELECT
8396 #include <sys/select.h>
8397 #endif
8398 int main() {
8399         fd_set fds;
8400
8401 #ifdef TRYBITS
8402         if(fds.fds_bits);
8403 #endif
8404
8405 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8406         exit(0);
8407 #else
8408         exit(1);
8409 #endif
8410 }
8411 EOCP
8412 set fd_set -DTRYBITS
8413 if eval $compile; then
8414         d_fds_bits="$define"
8415         d_fd_set="$define"
8416         echo "Well, your system knows about the normal fd_set typedef..." >&4
8417         if ./fd_set; then
8418                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8419                 d_fd_macros="$define"
8420         else
8421                 $cat >&4 <<'EOM'
8422 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8423 EOM
8424                 d_fd_macros="$undef"
8425         fi
8426 else
8427         $cat <<'EOM'
8428 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8429 EOM
8430         set fd_set
8431         if eval $compile; then
8432                 d_fds_bits="$undef"
8433                 d_fd_set="$define"
8434                 echo "Well, your system has some sort of fd_set available..." >&4
8435                 if ./fd_set; then
8436                         echo "and you have the normal fd_set macros." >&4
8437                         d_fd_macros="$define"
8438                 else
8439                         $cat <<'EOM'
8440 but not the normal fd_set macros!  Gross!  More work for me...
8441 EOM
8442                         d_fd_macros="$undef"
8443                 fi
8444         else
8445         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8446                 d_fd_set="$undef"
8447                 d_fds_bits="$undef"
8448                 d_fd_macros="$undef"
8449         fi
8450 fi
8451 $rm -f fd_set*
8452
8453 : see if fgetpos exists
8454 set fgetpos d_fgetpos
8455 eval $inlibc
8456
8457 : see if flock exists
8458 set flock d_flock
8459 eval $inlibc
8460
8461 : see if fork exists
8462 set fork d_fork
8463 eval $inlibc
8464
8465 : see if pathconf exists
8466 set pathconf d_pathconf
8467 eval $inlibc
8468
8469 : see if fpathconf exists
8470 set fpathconf d_fpathconf
8471 eval $inlibc
8472
8473
8474 : see if llseek exists
8475 set llseek d_llseek
8476 eval $inlibc
8477
8478 : check for off64_t
8479 echo " "
8480 echo $n "Checking to see if your system supports off64_t...$c" >&4
8481 $cat >try.c <<EOCP
8482 #include <sys/types.h>
8483 #include <unistd.h>
8484 off64_t foo() { off64_t x; x = 7; return x; }'
8485 EOCP
8486 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8487         val="$define"
8488         echo " Yup, it does." >&4
8489 else
8490         val="$undef"
8491         echo " Nope, it doesn't." >&4
8492 fi
8493 $rm -f try.*
8494 set d_off64_t
8495 eval $setvar
8496
8497 : check for fpos64_t
8498 echo " "
8499 echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8500 $cat >try.c <<EOCP
8501 #include <sys/stdio.h>
8502 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8503 EOCP
8504 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8505         val="$define"
8506         echo " Yup, it does." >&4
8507 else
8508         val="$undef"
8509         echo " Nope, it doesn't." >&4
8510 fi
8511 $rm -f try.*
8512 set d_fpos64_t
8513 eval $setvar
8514
8515 : see if fseeko exists
8516 set fseeko d_fseeko
8517 eval $inlibc
8518
8519 : see if fsetpos exists
8520 set fsetpos d_fsetpos
8521 eval $inlibc
8522
8523
8524 if $test X"$use64bits" = X"$define"; then
8525         : see if fgetpos64 exists
8526         set fgetpos64 d_fgetpos64
8527         eval $inlibc
8528
8529         : see if fopen64 exists
8530         set freopen64 d_fopen64
8531         eval $inlibc
8532
8533         : see if freopen64 exists
8534         set freopen64 d_freopen64
8535         eval $inlibc
8536
8537         : see if fseek64 exists
8538         set fseek64 d_fseek64
8539         eval $inlibc
8540
8541         : see if fseeko64 exists
8542         set fseeko64 d_fseeko64
8543         eval $inlibc
8544
8545         : see if fsetpos64 exists
8546         set fsetpos64 d_fsetpos64
8547         eval $inlibc
8548
8549         : see if ftell64 exists
8550         set ftell64 d_ftell64
8551         eval $inlibc
8552
8553         : see if ftello64 exists
8554         set ftello64 d_ftello64
8555         eval $inlibc
8556
8557         : see if tmpfile64 exists
8558         set tmpfile64 d_tmpfile64
8559         eval $inlibc
8560 else
8561         val="$undef"
8562         for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
8563         do
8564                 set $xxx
8565                 eval $setvar
8566         done
8567 fi
8568
8569 : see if this is a sys/param system
8570 set sys/param.h i_sysparam
8571 eval $inhdr
8572
8573 : see if this is a sys/mount.h system
8574 set sys/mount.h i_sysmount
8575 eval $inhdr
8576
8577
8578 : see if statfs exists
8579 set statfs d_statfs
8580 eval $inlibc
8581
8582 : see if fstatfs exists
8583 set fstatfs d_fstatfs
8584 eval $inlibc
8585
8586 : see if statfs knows about mount flags
8587 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8588 eval $hasfield
8589
8590
8591 : see if statvfs exists
8592 set statvfs d_statvfs
8593 eval $inlibc
8594
8595 : see if fstatvfs exists
8596 set fstatvfs d_fstatvfs
8597 eval $inlibc
8598
8599
8600 : see if ftello exists
8601 set ftello d_ftello
8602 eval $inlibc
8603
8604 : see if getgrent exists
8605 set getgrent d_getgrent
8606 eval $inlibc
8607
8608 : see if gethostbyaddr exists
8609 set gethostbyaddr d_gethbyaddr
8610 eval $inlibc
8611
8612 : see if gethostbyname exists
8613 set gethostbyname d_gethbyname
8614 eval $inlibc
8615
8616 : see if gethostent exists
8617 set gethostent d_gethent
8618 eval $inlibc
8619
8620 : see how we will look up host name
8621 echo " "
8622 call=''
8623 if set gethostname val -f d_gethname; eval $csym; $val; then
8624         echo 'gethostname() found.' >&4
8625         d_gethname="$define"
8626         call=gethostname
8627 fi
8628 if set uname val -f d_uname; eval $csym; $val; then
8629         if ./xenix; then
8630                 $cat <<'EOM'
8631 uname() was found, but you're running xenix, and older versions of xenix
8632 have a broken uname(). If you don't really know whether your xenix is old
8633 enough to have a broken system call, use the default answer.
8634
8635 EOM
8636                 dflt=y
8637                 case "$d_uname" in
8638                 "$define") dflt=n;;
8639                 esac
8640                 rp='Is your uname() broken?'
8641                 . ./myread
8642                 case "$ans" in
8643                 n*) d_uname="$define"; call=uname;;
8644                 esac
8645         else
8646                 echo 'uname() found.' >&4
8647                 d_uname="$define"
8648                 case "$call" in
8649                 '') call=uname ;;
8650                 esac
8651         fi
8652 fi
8653 case "$d_gethname" in
8654 '') d_gethname="$undef";;
8655 esac
8656 case "$d_uname" in
8657 '') d_uname="$undef";;
8658 esac
8659 case "$d_uname$d_gethname" in
8660 *define*)
8661         dflt=n
8662         cat <<EOM
8663  
8664 Every now and then someone has a $call() that lies about the hostname
8665 but can't be fixed for political or economic reasons.  If you wish, I can
8666 pretend $call() isn't there and maybe compute hostname at run-time
8667 thanks to the '$phostname' command.
8668
8669 EOM
8670         rp="Shall I ignore $call() from now on?"
8671         . ./myread
8672         case "$ans" in
8673         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8674         esac;;
8675 esac
8676 case "$phostname" in
8677 '') aphostname='';;
8678 *) case "$aphostname" in
8679         /*) ;;
8680         *) set X $phostname
8681                 shift
8682                 file=$1
8683                 shift
8684                 file=`./loc $file $file $pth`
8685                 aphostname=`echo $file $*`
8686                 ;;
8687         esac
8688         ;;
8689 esac
8690 case "$d_uname$d_gethname" in
8691 *define*) ;;
8692 *)
8693         case "$phostname" in
8694         '')
8695                 echo "There will be no way for $package to get your hostname." >&4;;
8696         *)
8697         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8698                 ;;
8699         esac;;
8700 esac
8701 case "$d_phostname" in
8702 '') d_phostname="$undef";;
8703 esac
8704
8705 : see if this is a netdb.h system
8706 set netdb.h i_netdb
8707 eval $inhdr
8708
8709 : see if prototypes for various gethostxxx netdb.h functions are available
8710 echo " "
8711 set d_gethostprotos gethostent $i_netdb netdb.h
8712 eval $hasproto
8713
8714 : see if getlogin exists
8715 set getlogin d_getlogin
8716 eval $inlibc
8717
8718 : see if getmntent exists
8719 set getmntent d_getmntent
8720 eval $inlibc
8721
8722 : see if getnetbyaddr exists
8723 set getnetbyaddr d_getnbyaddr
8724 eval $inlibc
8725
8726 : see if getnetbyname exists
8727 set getnetbyname d_getnbyname
8728 eval $inlibc
8729
8730 : see if getnetent exists
8731 set getnetent d_getnent
8732 eval $inlibc
8733
8734 : see if prototypes for various getnetxxx netdb.h functions are available
8735 echo " "
8736 set d_getnetprotos getnetent $i_netdb netdb.h
8737 eval $hasproto
8738
8739
8740 : see if getprotobyname exists
8741 set getprotobyname d_getpbyname
8742 eval $inlibc
8743
8744 : see if getprotobynumber exists
8745 set getprotobynumber d_getpbynumber
8746 eval $inlibc
8747
8748 : see if getprotoent exists
8749 set getprotoent d_getpent
8750 eval $inlibc
8751
8752 : see if getpgid exists
8753 set getpgid d_getpgid
8754 eval $inlibc
8755
8756 : see if getpgrp2 exists
8757 set getpgrp2 d_getpgrp2
8758 eval $inlibc
8759
8760 : see if getppid exists
8761 set getppid d_getppid
8762 eval $inlibc
8763
8764 : see if getpriority exists
8765 set getpriority d_getprior
8766 eval $inlibc
8767
8768 : see if prototypes for various getprotoxxx netdb.h functions are available
8769 echo " "
8770 set d_getprotoprotos getprotoent $i_netdb netdb.h
8771 eval $hasproto
8772
8773 : see if getpwent exists
8774 set getpwent d_getpwent
8775 eval $inlibc
8776
8777
8778 : see if getservbyname exists
8779 set getservbyname d_getsbyname
8780 eval $inlibc
8781
8782 : see if getservbyport exists
8783 set getservbyport d_getsbyport
8784 eval $inlibc
8785
8786 : see if getservent exists
8787 set getservent d_getsent
8788 eval $inlibc
8789
8790 : see if prototypes for various getservxxx netdb.h functions are available
8791 echo " "
8792 set d_getservprotos getservent $i_netdb netdb.h
8793 eval $hasproto
8794
8795 : see if getspent exists
8796 set getspent d_getspent
8797 eval $inlibc
8798
8799 : see if getspnam exists
8800 set getspnam d_getspnam
8801 eval $inlibc
8802
8803 : see if gettimeofday or ftime exists
8804 set gettimeofday d_gettimeod
8805 eval $inlibc
8806 case "$d_gettimeod" in
8807 "$undef")
8808         set ftime d_ftime 
8809         eval $inlibc
8810         ;;
8811 *)
8812         val="$undef"; set d_ftime; eval $setvar
8813         ;;
8814 esac
8815 case "$d_gettimeod$d_ftime" in
8816 "$undef$undef")
8817         echo " "
8818         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8819         ;;
8820 esac
8821
8822 : see if this is an grp system
8823 set grp.h i_grp
8824 eval $inhdr
8825
8826 case "$i_grp" in
8827 $define)
8828         xxx=`./findhdr grp.h`
8829         $cppstdin $cppflags $cppminus < $xxx >$$.h
8830
8831         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8832                 val="$define"
8833         else
8834                 val="$undef"
8835         fi
8836         set d_grpasswd
8837         eval $setvar
8838
8839         $rm -f $$.h
8840         ;;
8841 *)
8842         val="$undef";
8843         set d_grpasswd; eval $setvar
8844         ;;
8845 esac
8846
8847 : see if hasmntopt exists
8848 set hasmntopt d_hasmntopt
8849 eval $inlibc
8850
8851 : see if this is a netinet/in.h or sys/in.h system
8852 set netinet/in.h i_niin sys/in.h i_sysin
8853 eval $inhdr
8854
8855 : see if arpa/inet.h has to be included
8856 set arpa/inet.h i_arpainet
8857 eval $inhdr
8858
8859 : see if htonl --and friends-- exists
8860 val=''
8861 set htonl val
8862 eval $inlibc
8863
8864 : Maybe they are macros.
8865 case "$val" in
8866 $undef)
8867         $cat >htonl.c <<EOM
8868 #include <stdio.h>
8869 #include <sys/types.h>
8870 #$i_niin I_NETINET_IN
8871 #$i_sysin I_SYS_IN
8872 #$i_arpainet I_ARPA_INET
8873 #ifdef I_NETINET_IN
8874 #include <netinet/in.h>
8875 #endif
8876 #ifdef I_SYS_IN
8877 #include <sys/in.h>
8878 #endif
8879 #ifdef I_ARPA_INET
8880 #include <arpa/inet.h>
8881 #endif
8882 #ifdef htonl
8883 printf("Defined as a macro.");
8884 #endif
8885 EOM
8886         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8887         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8888                 val="$define"
8889                 echo "But it seems to be defined as a macro." >&4
8890         fi
8891         $rm -f htonl.?
8892         ;;
8893 esac
8894 set d_htonl
8895 eval $setvar
8896
8897 : see which of string.h or strings.h is needed
8898 echo " "
8899 strings=`./findhdr string.h`
8900 if $test "$strings" && $test -r "$strings"; then
8901         echo "Using <string.h> instead of <strings.h>." >&4
8902         val="$define"
8903 else
8904         val="$undef"
8905         strings=`./findhdr strings.h`
8906         if $test "$strings" && $test -r "$strings"; then
8907                 echo "Using <strings.h> instead of <string.h>." >&4
8908         else
8909                 echo "No string header found -- You'll surely have problems." >&4
8910         fi
8911 fi
8912 set i_string
8913 eval $setvar
8914 case "$i_string" in
8915 "$undef") strings=`./findhdr strings.h`;;
8916 *)        strings=`./findhdr string.h`;;
8917 esac
8918
8919 : index or strchr
8920 echo " "
8921 if set index val -f; eval $csym; $val; then
8922         if set strchr val -f d_strchr; eval $csym; $val; then
8923                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8924                         val="$define"
8925                         vali="$undef"
8926                         echo "strchr() found." >&4
8927                 else
8928                         val="$undef"
8929                         vali="$define"
8930                         echo "index() found." >&4
8931                 fi
8932         else
8933                 val="$undef"
8934                 vali="$define"
8935                 echo "index() found." >&4
8936         fi
8937 else
8938         if set strchr val -f d_strchr; eval $csym; $val; then
8939                 val="$define"
8940                 vali="$undef"
8941                 echo "strchr() found." >&4
8942         else
8943                 echo "No index() or strchr() found!" >&4
8944                 val="$undef"
8945                 vali="$undef"
8946         fi
8947 fi
8948 set d_strchr; eval $setvar
8949 val="$vali"
8950 set d_index; eval $setvar
8951
8952 : check whether inet_aton exists
8953 set inet_aton d_inetaton
8954 eval $inlibc
8955
8956 : Look for isascii
8957 echo " "
8958 $cat >isascii.c <<'EOCP'
8959 #include <stdio.h>
8960 #include <ctype.h>
8961 int main() {
8962         int c = 'A';
8963         if (isascii(c))
8964                 exit(0);
8965         else
8966                 exit(1);
8967 }
8968 EOCP
8969 set isascii
8970 if eval $compile; then
8971         echo "isascii() found." >&4
8972         val="$define"
8973 else
8974         echo "isascii() NOT found." >&4
8975         val="$undef"
8976 fi
8977 set d_isascii
8978 eval $setvar
8979 $rm -f isascii*
8980
8981 : see if killpg exists
8982 set killpg d_killpg
8983 eval $inlibc
8984
8985 : see if lchown exists
8986 echo " "
8987 $cat > try.c <<'EOCP'
8988 /* System header to define __stub macros and hopefully few prototypes,
8989     which can conflict with char lchown(); below.  */
8990 #include <assert.h>
8991 /* Override any gcc2 internal prototype to avoid an error.  */
8992 /* We use char because int might match the return type of a gcc2
8993    builtin and then its argument prototype would still apply.  */
8994 char lchown();
8995 int main() {
8996     /*  The GNU C library defines this for functions which it implements
8997         to always fail with ENOSYS.  Some functions are actually named
8998         something starting with __ and the normal name is an alias.  */
8999 #if defined (__stub_lchown) || defined (__stub___lchown)
9000 choke me
9001 #else
9002 lchown();
9003 #endif
9004 ; return 0; }
9005 EOCP
9006 set try
9007 if eval $compile; then
9008     $echo "lchown() found." >&4
9009     val="$define"
9010 else
9011     $echo "lchown() NOT found." >&4
9012     val="$undef"
9013 fi
9014 set d_lchown
9015 eval $setvar
9016
9017 : see if link exists
9018 set link d_link
9019 eval $inlibc
9020
9021 : see if localeconv exists
9022 set localeconv d_locconv
9023 eval $inlibc
9024
9025 : see if lockf exists
9026 set lockf d_lockf
9027 eval $inlibc
9028
9029 : see if lstat exists
9030 set lstat d_lstat
9031 eval $inlibc
9032
9033 : see if madvise exists
9034 set madvise d_madvise
9035 eval $inlibc
9036
9037 : see if mblen exists
9038 set mblen d_mblen
9039 eval $inlibc
9040
9041 : see if mbstowcs exists
9042 set mbstowcs d_mbstowcs
9043 eval $inlibc
9044
9045 : see if mbtowc exists
9046 set mbtowc d_mbtowc
9047 eval $inlibc
9048
9049 : see if memchr exists
9050 set memchr d_memchr
9051 eval $inlibc
9052
9053 : see if memcmp exists
9054 set memcmp d_memcmp
9055 eval $inlibc
9056
9057 : see if memcpy exists
9058 set memcpy d_memcpy
9059 eval $inlibc
9060
9061 : see if memmove exists
9062 set memmove d_memmove
9063 eval $inlibc
9064
9065 : see if memset exists
9066 set memset d_memset
9067 eval $inlibc
9068
9069 : see if mkdir exists
9070 set mkdir d_mkdir
9071 eval $inlibc
9072
9073 : see if mkfifo exists
9074 set mkfifo d_mkfifo
9075 eval $inlibc
9076
9077 : see if mktime exists
9078 set mktime d_mktime
9079 eval $inlibc
9080
9081 : see if this is a sys/mman.h system
9082 set sys/mman.h i_sysmman
9083 eval $inhdr
9084
9085 : see if mmap exists
9086 set mmap d_mmap
9087 eval $inlibc
9088 : see what shmat returns
9089 : default to something harmless
9090 mmaptype='void *'
9091 case "$i_sysmman$d_mmap" in
9092 "$define$define")
9093         $cat >mmap.c <<'END'
9094 #include <sys/mman.h>
9095 void *mmap();
9096 END
9097         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9098                 mmaptype='void *'
9099         else
9100                 mmaptype='caddr_t'
9101         fi
9102         echo "and it returns ($mmaptype)." >&4
9103         ;;
9104 esac
9105
9106
9107
9108 : see if mprotect exists
9109 set mprotect d_mprotect
9110 eval $inlibc
9111
9112 : see if msgctl exists
9113 set msgctl d_msgctl
9114 eval $inlibc
9115
9116 : see if msgget exists
9117 set msgget d_msgget
9118 eval $inlibc
9119
9120 : see if msgsnd exists
9121 set msgsnd d_msgsnd
9122 eval $inlibc
9123
9124 : see if msgrcv exists
9125 set msgrcv d_msgrcv
9126 eval $inlibc
9127
9128 : see how much of the 'msg*(2)' library is present.
9129 h_msg=true
9130 echo " "
9131 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9132 *"$undef"*) h_msg=false;;
9133 esac
9134 case "$osname" in
9135 freebsd)
9136     case "`ipcs 2>&1`" in
9137     "SVID messages"*"not configured"*)
9138         echo "Your $osname does not have the msg*(2) configured." >&4
9139         h_msg=false
9140         val="$undef"
9141         set msgctl d_msgctl
9142         eval $setvar
9143         set msgget d_msgget
9144         eval $setvar
9145         set msgsnd d_msgsnd
9146         eval $setvar
9147         set msgrcv d_msgrcv
9148         eval $setvar
9149         ;;
9150     esac
9151     ;;
9152 esac
9153 : we could also check for sys/ipc.h ...
9154 if $h_msg && $test `./findhdr sys/msg.h`; then
9155         echo "You have the full msg*(2) library." >&4
9156         val="$define"
9157 else
9158         echo "You don't have the full msg*(2) library." >&4
9159         val="$undef"
9160 fi
9161 set d_msg
9162 eval $setvar
9163
9164 : see if msync exists
9165 set msync d_msync
9166 eval $inlibc
9167
9168 : see if munmap exists
9169 set munmap d_munmap
9170 eval $inlibc
9171
9172 : see if nice exists
9173 set nice d_nice
9174 eval $inlibc
9175
9176 : see if POSIX threads are available
9177 if test "X$usethreads" = "X$define"; then
9178         set pthread.h i_pthread
9179         eval $inhdr
9180 else
9181         i_pthread="$undef"
9182 fi
9183
9184
9185
9186 : how to create joinable pthreads
9187 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9188         echo " "
9189         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9190         $cat >try.c <<'EOCP'
9191 #include <pthread.h>
9192 int main() {
9193     int detachstate = JOINABLE;
9194 }
9195 EOCP
9196         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9197         if eval $compile; then
9198                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9199                 val="$undef" # Yes, undef.
9200                 set d_old_pthread_create_joinable
9201                 eval $setvar
9202                 val=""
9203                 set old_pthread_create_joinable
9204                 eval $setvar
9205         else
9206                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9207                 if eval $compile; then
9208                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9209                         val="$define"
9210                         set d_old_pthread_create_joinable
9211                         eval $setvar
9212                         val=PTHREAD_CREATE_UNDETACHED
9213                         set old_pthread_create_joinable
9214                         eval $setvar
9215                 else            
9216                         set try -DJOINABLE=__UNDETACHED
9217                         if eval $compile; then
9218                                 echo "You seem to use __UNDETACHED." >&4
9219                                 val="$define"
9220                                 set d_old_pthread_create_joinable
9221                                 eval $setvar
9222                                 val=__UNDETACHED
9223                                 set old_pthread_create_joinable
9224                                 eval $setvar
9225                         else
9226                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9227                                 val="$define"
9228                                 set d_old_pthread_create_joinable
9229                                 eval $setvar
9230                                 val=0
9231                                 set old_pthread_create_joinable
9232                                 eval $setvar
9233                         fi
9234                 fi
9235         fi
9236         $rm -f try try.*
9237 else
9238     d_old_pthread_create_joinable="$undef"
9239     old_pthread_create_joinable=""
9240 fi
9241
9242 : see if pause exists
9243 set pause d_pause
9244 eval $inlibc
9245
9246 : see if pipe exists
9247 set pipe d_pipe
9248 eval $inlibc
9249
9250 : see if poll exists
9251 set poll d_poll
9252 eval $inlibc
9253
9254
9255 : see whether the various POSIXish _yields exist
9256 $cat >try.c <<EOP
9257 #include <pthread.h>
9258 #include <stdio.h>
9259 int main() {
9260 #ifdef SCHED_YIELD
9261         sched_yield();
9262 #else
9263 #ifdef PTHREAD_YIELD
9264         pthread_yield();
9265 #else
9266 #ifdef PTHREAD_YIELD_NULL
9267         pthread_yield(NULL);
9268 #endif
9269 #endif
9270 #endif
9271 }
9272 EOP
9273 : see if sched_yield exists
9274 set try -DSCHED_YIELD
9275 if eval $compile; then
9276     val="$define"
9277     sched_yield='sched_yield()'
9278 else
9279     val="$undef"
9280 fi
9281 case "$usethreads" in
9282 $define)
9283         case "$val" in
9284         $define) echo 'sched_yield() found.' >&4        ;;
9285         *)       echo 'sched_yield() NOT found.' >&4    ;;
9286         esac
9287 esac
9288 set d_sched_yield
9289 eval $setvar
9290
9291 : see if pthread_yield exists
9292 set try -DPTHREAD_YIELD
9293 if eval $compile; then
9294     val="$define"
9295     case "$sched_yield" in
9296     '') sched_yield='pthread_yield()' ;;
9297     esac
9298 else
9299     set try -DPTHREAD_YIELD_NULL
9300     if eval $compile; then
9301         val="$define"
9302         case "$sched_yield" in
9303         '') sched_yield='pthread_yield(NULL)' ;;
9304         esac
9305     else
9306         val="$undef"
9307     fi
9308 fi
9309 case "$usethreads" in
9310 $define)
9311         case "$val" in
9312         $define) echo 'pthread_yield() found.' >&4      ;;
9313         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9314         esac
9315         ;;
9316 esac
9317 set d_pthread_yield
9318 eval $setvar
9319
9320 case "$sched_yield" in
9321 '') sched_yield=undef ;;
9322 esac
9323
9324 $rm -f try try.*
9325
9326 : see if this is a pwd.h system
9327 set pwd.h i_pwd
9328 eval $inhdr
9329
9330 case "$i_pwd" in
9331 $define)
9332         xxx=`./findhdr pwd.h`
9333         $cppstdin $cppflags $cppminus < $xxx >$$.h
9334
9335         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9336                 val="$define"
9337         else
9338                 val="$undef"
9339         fi
9340         set d_pwquota
9341         eval $setvar
9342
9343         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9344                 val="$define"
9345         else
9346                 val="$undef"
9347         fi
9348         set d_pwage
9349         eval $setvar
9350
9351         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9352                 val="$define"
9353         else
9354                 val="$undef"
9355         fi
9356         set d_pwchange
9357         eval $setvar
9358
9359         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9360                 val="$define"
9361         else
9362                 val="$undef"
9363         fi
9364         set d_pwclass
9365         eval $setvar
9366
9367         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9368                 val="$define"
9369         else
9370                 val="$undef"
9371         fi
9372         set d_pwexpire
9373         eval $setvar
9374
9375         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9376                 val="$define"
9377         else
9378                 val="$undef"
9379         fi
9380         set d_pwcomment
9381         eval $setvar
9382
9383         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9384                 val="$define"
9385         else
9386                 val="$undef"
9387         fi
9388         set d_pwgecos
9389         eval $setvar
9390
9391         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9392                 val="$define"
9393         else
9394                 val="$undef"
9395         fi
9396         set d_pwpasswd
9397         eval $setvar
9398
9399         $rm -f $$.h
9400         ;;
9401 *)
9402         val="$undef"; 
9403         set d_pwquota; eval $setvar
9404         set d_pwage; eval $setvar
9405         set d_pwchange; eval $setvar
9406         set d_pwclass; eval $setvar
9407         set d_pwexpire; eval $setvar
9408         set d_pwcomment; eval $setvar
9409         set d_pwgecos; eval $setvar
9410         set d_pwpasswd; eval $setvar
9411         ;;
9412 esac
9413
9414 : see if readdir and friends exist
9415 set readdir d_readdir
9416 eval $inlibc
9417 set seekdir d_seekdir
9418 eval $inlibc
9419 set telldir d_telldir
9420 eval $inlibc
9421 set rewinddir d_rewinddir
9422 eval $inlibc
9423
9424 : see if readlink exists
9425 set readlink d_readlink
9426 eval $inlibc
9427
9428 : see if readv exists
9429 set readv d_readv
9430 eval $inlibc
9431
9432 : see if rename exists
9433 set rename d_rename
9434 eval $inlibc
9435
9436 : see if rmdir exists
9437 set rmdir d_rmdir
9438 eval $inlibc
9439
9440 : see if memory.h is available.
9441 val=''
9442 set memory.h val
9443 eval $inhdr
9444
9445 : See if it conflicts with string.h
9446 case "$val" in
9447 $define)
9448         case "$strings" in
9449         '') ;;
9450         *)
9451                 $cppstdin $cppflags $cppminus < $strings > mem.h
9452                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9453                         echo " "
9454                         echo "We won't be including <memory.h>."
9455                         val="$undef"
9456                 fi
9457                 $rm -f mem.h
9458                 ;;
9459         esac
9460 esac
9461 set i_memory
9462 eval $setvar
9463
9464 : can bcopy handle overlapping blocks?
9465 val="$undef"
9466 case "$d_bcopy" in
9467 "$define")
9468         echo " "
9469         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9470         $cat >try.c <<EOCP
9471 #$i_memory I_MEMORY
9472 #$i_stdlib I_STDLIB
9473 #$i_string I_STRING
9474 #$i_unistd I_UNISTD
9475 EOCP
9476         $cat >>try.c <<'EOCP'
9477 #include <stdio.h>
9478 #ifdef I_MEMORY
9479 #  include <memory.h>
9480 #endif
9481 #ifdef I_STDLIB
9482 #  include <stdlib.h>
9483 #endif
9484 #ifdef I_STRING
9485 #  include <string.h>
9486 #else
9487 #  include <strings.h>
9488 #endif
9489 #ifdef I_UNISTD
9490 #  include <unistd.h>  /* Needed for NetBSD */
9491 #endif
9492 int main()
9493 {
9494 char buf[128], abc[128];
9495 char *b;
9496 int len;
9497 int off;
9498 int align;
9499
9500 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9501
9502 for (align = 7; align >= 0; align--) {
9503         for (len = 36; len; len--) {
9504                 b = buf+align;
9505                 bcopy(abc, b, len);
9506                 for (off = 1; off <= len; off++) {
9507                         bcopy(b, b+off, len);
9508                         bcopy(b+off, b, len);
9509                         if (bcmp(b, abc, len))
9510                                 exit(1);
9511                 }
9512         }
9513 }
9514 exit(0);
9515 }
9516 EOCP
9517         set try
9518         if eval $compile_ok; then
9519                 if ./try 2>/dev/null; then
9520                         echo "Yes, it can."
9521                         val="$define"
9522                 else
9523                         echo "It can't, sorry."
9524                         case "$d_memmove" in
9525                         "$define") echo "But that's Ok since you have memmove()." ;;
9526                         esac
9527                 fi
9528         else
9529                 echo "(I can't compile the test program, so we'll assume not...)"
9530                 case "$d_memmove" in
9531                 "$define") echo "But that's Ok since you have memmove()." ;;
9532                 esac
9533         fi
9534         ;;
9535 esac
9536 $rm -f try.* try core
9537 set d_safebcpy
9538 eval $setvar
9539
9540 : can memcpy handle overlapping blocks?
9541 val="$undef"
9542 case "$d_memcpy" in
9543 "$define")
9544         echo " "
9545         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9546         $cat >try.c <<EOCP
9547 #$i_memory I_MEMORY
9548 #$i_stdlib I_STDLIB
9549 #$i_string I_STRING
9550 #$i_unistd I_UNISTD
9551 EOCP
9552         $cat >>try.c <<'EOCP'
9553 #include <stdio.h>
9554 #ifdef I_MEMORY
9555 #  include <memory.h>
9556 #endif
9557 #ifdef I_STDLIB
9558 #  include <stdlib.h>
9559 #endif
9560 #ifdef I_STRING
9561 #  include <string.h>
9562 #else
9563 #  include <strings.h>
9564 #endif
9565 #ifdef I_UNISTD
9566 #  include <unistd.h>  /* Needed for NetBSD */
9567 #endif
9568 int main()
9569 {
9570 char buf[128], abc[128];
9571 char *b;
9572 int len;
9573 int off;
9574 int align;
9575
9576 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9577    try to store the string in read-only memory. */
9578 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9579
9580 for (align = 7; align >= 0; align--) {
9581         for (len = 36; len; len--) {
9582                 b = buf+align;
9583                 memcpy(b, abc, len);
9584                 for (off = 1; off <= len; off++) {
9585                         memcpy(b+off, b, len);
9586                         memcpy(b, b+off, len);
9587                         if (memcmp(b, abc, len))
9588                                 exit(1);
9589                 }
9590         }
9591 }
9592 exit(0);
9593 }
9594 EOCP
9595         set try
9596         if eval $compile_ok; then
9597                 if ./try 2>/dev/null; then
9598                         echo "Yes, it can."
9599                         val="$define"
9600                 else
9601                         echo "It can't, sorry."
9602                         case "$d_memmove" in
9603                         "$define") echo "But that's Ok since you have memmove()." ;;
9604                         esac
9605                 fi
9606         else
9607                 echo "(I can't compile the test program, so we'll assume not...)"
9608                 case "$d_memmove" in
9609                 "$define") echo "But that's Ok since you have memmove()." ;;
9610                 esac
9611         fi
9612         ;;
9613 esac
9614 $rm -f try.* try core
9615 set d_safemcpy
9616 eval $setvar
9617
9618 : can memcmp be trusted to compare relative magnitude?
9619 val="$undef"
9620 case "$d_memcmp" in
9621 "$define")
9622         echo " "
9623         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9624         $cat >try.c <<EOCP
9625 #$i_memory I_MEMORY
9626 #$i_stdlib I_STDLIB
9627 #$i_string I_STRING
9628 #$i_unistd I_UNISTD
9629 EOCP
9630         $cat >>try.c <<'EOCP'
9631 #include <stdio.h>
9632 #ifdef I_MEMORY
9633 #  include <memory.h>
9634 #endif
9635 #ifdef I_STDLIB
9636 #  include <stdlib.h>
9637 #endif
9638 #ifdef I_STRING
9639 #  include <string.h>
9640 #else
9641 #  include <strings.h>
9642 #endif
9643 #ifdef I_UNISTD
9644 #  include <unistd.h>  /* Needed for NetBSD */
9645 #endif
9646 int main()
9647 {
9648 char a = -1;
9649 char b = 0;
9650 if ((a < b) && memcmp(&a, &b, 1) < 0)
9651         exit(1);
9652 exit(0);
9653 }
9654 EOCP
9655         set try
9656         if eval $compile_ok; then
9657                 if ./try 2>/dev/null; then
9658                         echo "Yes, it can."
9659                         val="$define"
9660                 else
9661                         echo "No, it can't (it uses signed chars)."
9662                 fi
9663         else
9664                 echo "(I can't compile the test program, so we'll assume not...)"
9665         fi
9666         ;;
9667 esac
9668 $rm -f try.* try core
9669 set d_sanemcmp
9670 eval $setvar
9671
9672 : see if select exists
9673 set select d_select
9674 eval $inlibc
9675
9676 : see if semctl exists
9677 set semctl d_semctl
9678 eval $inlibc
9679
9680 : see if semget exists
9681 set semget d_semget
9682 eval $inlibc
9683
9684 : see if semop exists
9685 set semop d_semop
9686 eval $inlibc
9687
9688 : see how much of the 'sem*(2)' library is present.
9689 h_sem=true
9690 echo " "
9691 case "$d_semctl$d_semget$d_semop" in
9692 *"$undef"*) h_sem=false;;
9693 esac
9694 case "$osname" in
9695 freebsd)
9696     case "`ipcs 2>&1`" in
9697     "SVID messages"*"not configured"*)
9698         echo "Your $osname does not have the sem*(2) configured." >&4
9699         h_sem=false
9700         val="$undef"
9701         set semctl d_semctl
9702         eval $setvar
9703         set semget d_semget
9704         eval $setvar
9705         set semop d_semop
9706         eval $setvar
9707         ;;
9708     esac
9709     ;;
9710 esac
9711 : we could also check for sys/ipc.h ...
9712 if $h_sem && $test `./findhdr sys/sem.h`; then
9713         echo "You have the full sem*(2) library." >&4
9714         val="$define"
9715 else
9716         echo "You don't have the full sem*(2) library." >&4
9717         val="$undef"
9718 fi
9719 set d_sem
9720 eval $setvar
9721
9722 : see whether sys/sem.h defines union semun
9723 echo " "
9724 $cat > try.c <<'END'
9725 #include <sys/types.h>
9726 #include <sys/ipc.h>
9727 #include <sys/sem.h>
9728 int main () { union semun semun; semun.buf = 0; }
9729 END
9730 set try
9731 if eval $compile; then
9732     echo "You have union semun in <sys/sem.h>." >&4
9733     val="$define"
9734 else
9735     echo "You do not have union semun in <sys/sem.h>." >&4
9736     val="$undef"
9737 fi
9738 $rm -f try try.c try.h
9739 set d_union_semun
9740 eval $setvar
9741
9742 : see how to do semctl IPC_STAT
9743 case "$d_sem" in
9744 $define)
9745     : see whether semctl IPC_STAT can use union semun
9746     echo " "
9747     $cat > try.h <<END
9748 #ifndef S_IRUSR
9749 #   ifdef S_IREAD
9750 #       define S_IRUSR S_IREAD
9751 #       define S_IWUSR S_IWRITE
9752 #       define S_IXUSR S_IEXEC
9753 #   else
9754 #       define S_IRUSR 0400
9755 #       define S_IWUSR 0200
9756 #       define S_IXUSR 0100
9757 #   endif
9758 #   define S_IRGRP (S_IRUSR>>3)
9759 #   define S_IWGRP (S_IWUSR>>3)
9760 #   define S_IXGRP (S_IXUSR>>3)
9761 #   define S_IROTH (S_IRUSR>>6)
9762 #   define S_IWOTH (S_IWUSR>>6)
9763 #   define S_IXOTH (S_IXUSR>>6)
9764 #endif
9765 #ifndef S_IRWXU
9766 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9767 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9768 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9769 #endif
9770 END
9771
9772     $cat > try.c <<END
9773 #include <sys/types.h>
9774 #include <sys/ipc.h>
9775 #include <sys/sem.h>
9776 #include <sys/stat.h>
9777 #include <stdio.h>
9778 #include <errno.h>
9779 #include "try.h"
9780 #ifndef errno
9781 extern int errno;
9782 #endif
9783 #$d_union_semun HAS_UNION_SEMUN
9784 int main() {
9785     union semun
9786 #ifndef HAS_UNION_SEMUN
9787     {
9788         int val;
9789         struct semid_ds *buf;
9790         unsigned short *array;
9791     }
9792 #endif
9793     arg;
9794     int sem, st;
9795
9796 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9797     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9798     if (sem > -1) {
9799         struct semid_ds argbuf;
9800         arg.buf = &argbuf;
9801 #       ifdef IPC_STAT
9802         st = semctl(sem, 0, IPC_STAT, arg);
9803         if (st == 0)
9804             printf("semun\n");
9805         else
9806 #       endif /* IPC_STAT */
9807             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9808 #       ifdef IPC_RMID
9809         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9810 #       endif /* IPC_RMID */
9811             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9812     } else
9813 #endif /* IPC_PRIVATE && ... */
9814         printf("semget failed: errno = %d\n", errno);
9815   return 0;
9816 }
9817 END
9818     val="$undef"
9819     set try
9820     if eval $compile; then
9821         xxx=`./try`
9822         case "$xxx" in
9823         semun) val="$define" ;;
9824         esac
9825     fi
9826     $rm -f try try.c
9827     set d_semctl_semun
9828     eval $setvar
9829     case "$d_semctl_semun" in
9830     $define)
9831         echo "You can use union semun for semctl IPC_STAT." >&4
9832         also='also'
9833         ;;
9834     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9835         also=''
9836         ;;
9837     esac
9838
9839     : see whether semctl IPC_STAT can use struct semid_ds pointer
9840     $cat > try.c <<'END'
9841 #include <sys/types.h>
9842 #include <sys/ipc.h>
9843 #include <sys/sem.h>
9844 #include <sys/stat.h>
9845 #include "try.h"
9846 #include <stdio.h>
9847 #include <errno.h>
9848 #ifndef errno
9849 extern int errno;
9850 #endif
9851 int main() {
9852     struct semid_ds arg;
9853     int sem, st;
9854
9855 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9856     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9857     if (sem > -1) {
9858 #       ifdef IPC_STAT
9859         st = semctl(sem, 0, IPC_STAT, &arg);
9860         if (st == 0)
9861             printf("semid_ds\n");
9862         else
9863 #       endif /* IPC_STAT */
9864             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9865 #       ifdef IPC_RMID
9866         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9867 #       endif /* IPC_RMID */
9868             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9869     } else
9870 #endif /* IPC_PRIVATE && ... */
9871         printf("semget failed: errno = %d\n", errno);
9872
9873     return 0;
9874 }
9875 END
9876     val="$undef"
9877     set try
9878     if eval $compile; then
9879         xxx=`./try`
9880         case "$xxx" in
9881         semid_ds) val="$define" ;;
9882         esac
9883     fi
9884     $rm -f try try.c
9885     set d_semctl_semid_ds
9886     eval $setvar
9887     case "$d_semctl_semid_ds" in
9888     $define)
9889         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9890         ;;
9891     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9892         ;;
9893     esac
9894     $rm -f try.h
9895     ;;
9896 *)  val="$undef"
9897
9898     # We do not have the full sem*(2) library, so assume we can not
9899     # use either.
9900
9901     set d_semctl_semun
9902     eval $setvar
9903
9904     set d_semctl_semid_ds
9905     eval $setvar
9906     ;;
9907 esac
9908
9909 : see if setegid exists
9910 set setegid d_setegid
9911 eval $inlibc
9912
9913 : see if seteuid exists
9914 set seteuid d_seteuid
9915 eval $inlibc
9916
9917 : see if setgrent exists
9918 set setgrent d_setgrent
9919 eval $inlibc
9920
9921 : see if sethostent exists
9922 set sethostent d_sethent
9923 eval $inlibc
9924
9925 : see if setlinebuf exists
9926 set setlinebuf d_setlinebuf
9927 eval $inlibc
9928
9929 : see if setlocale exists
9930 set setlocale d_setlocale
9931 eval $inlibc
9932
9933 : see if setnetent exists
9934 set setnetent d_setnent
9935 eval $inlibc
9936
9937 : see if setprotoent exists
9938 set setprotoent d_setpent
9939 eval $inlibc
9940
9941 : see if setpgid exists
9942 set setpgid d_setpgid
9943 eval $inlibc
9944
9945 : see if setpgrp2 exists
9946 set setpgrp2 d_setpgrp2
9947 eval $inlibc
9948
9949 : see if setpriority exists
9950 set setpriority d_setprior
9951 eval $inlibc
9952
9953 : see if setpwent exists
9954 set setpwent d_setpwent
9955 eval $inlibc
9956
9957 : see if setregid exists
9958 set setregid d_setregid
9959 eval $inlibc
9960 set setresgid d_setresgid
9961 eval $inlibc
9962
9963 : see if setreuid exists
9964 set setreuid d_setreuid
9965 eval $inlibc
9966 set setresuid d_setresuid
9967 eval $inlibc
9968
9969 : see if setrgid exists
9970 set setrgid d_setrgid
9971 eval $inlibc
9972
9973 : see if setruid exists
9974 set setruid d_setruid
9975 eval $inlibc
9976
9977 : see if setservent exists
9978 set setservent d_setsent
9979 eval $inlibc
9980
9981 : see if setsid exists
9982 set setsid d_setsid
9983 eval $inlibc
9984
9985 : see if setspent exists
9986 set setspent d_setspent
9987 eval $inlibc
9988
9989 : see if setvbuf exists
9990 set setvbuf d_setvbuf
9991 eval $inlibc
9992
9993 : see if sfio.h is available
9994 set sfio.h i_sfio
9995 eval $inhdr
9996
9997
9998 : see if sfio library is available
9999 case "$i_sfio" in
10000 $define)
10001         val=''
10002         set sfreserve val
10003         eval $inlibc
10004         ;;
10005 *)
10006         val="$undef"
10007         ;;
10008 esac
10009 : Ok, but do we want to use it.
10010 case "$val" in
10011 $define)
10012         case "$usesfio" in
10013         true|$define|[yY]*) dflt='y';;
10014         *) dflt='n';;
10015         esac
10016         echo "$package can use the sfio library, but it is experimental."
10017         rp="You seem to have sfio available, do you want to try using it?"
10018         . ./myread
10019         case "$ans" in
10020         y|Y) ;;
10021         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10022                 val="$undef"
10023                 : Remove sfio from list of libraries to use
10024                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10025                 shift
10026                 libs="$*"
10027                 echo "libs = $libs" >&4
10028                 ;;
10029         esac
10030         ;;
10031 *)      case "$usesfio" in
10032         true|$define|[yY]*)
10033                 echo "Sorry, cannot find sfio on this machine" >&4
10034                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10035                 ;;
10036         esac
10037         ;;
10038 esac
10039 set d_sfio
10040 eval $setvar
10041 case "$d_sfio" in
10042 $define) usesfio='true';;
10043 *) usesfio='false';;
10044 esac
10045
10046 : see if shmctl exists
10047 set shmctl d_shmctl
10048 eval $inlibc
10049
10050 : see if shmget exists
10051 set shmget d_shmget
10052 eval $inlibc
10053
10054 : see if shmat exists
10055 set shmat d_shmat
10056 eval $inlibc
10057 : see what shmat returns
10058 case "$d_shmat" in
10059 "$define")
10060         $cat >shmat.c <<'END'
10061 #include <sys/shm.h>
10062 void *shmat();
10063 END
10064         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10065                 shmattype='void *'
10066         else
10067                 shmattype='char *'
10068         fi
10069         echo "and it returns ($shmattype)." >&4
10070         : see if a prototype for shmat is available
10071         xxx=`./findhdr sys/shm.h`
10072         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10073         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10074                 val="$define"
10075         else
10076                 val="$undef"
10077         fi
10078         $rm -f shmat.[co]
10079         ;;
10080 *)
10081         val="$undef"
10082         ;;
10083 esac
10084 set d_shmatprototype
10085 eval $setvar
10086
10087 : see if shmdt exists
10088 set shmdt d_shmdt
10089 eval $inlibc
10090
10091 : see how much of the 'shm*(2)' library is present.
10092 h_shm=true
10093 echo " "
10094 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10095 *"$undef"*) h_shm=false;;
10096 esac
10097 case "$osname" in
10098 freebsd)
10099     case "`ipcs 2>&1`" in
10100     "SVID shared memory"*"not configured"*)
10101         echo "Your $osname does not have the shm*(2) configured." >&4
10102         h_shm=false
10103         val="$undef"
10104         set shmctl d_shmctl
10105         evat $setvar
10106         set shmget d_shmget
10107         evat $setvar
10108         set shmat d_shmat
10109         evat $setvar
10110         set shmdt d_shmdt
10111         evat $setvar
10112         ;;
10113     esac
10114     ;;
10115 esac
10116 : we could also check for sys/ipc.h ...
10117 if $h_shm && $test `./findhdr sys/shm.h`; then
10118         echo "You have the full shm*(2) library." >&4
10119         val="$define"
10120 else
10121         echo "You don't have the full shm*(2) library." >&4
10122         val="$undef"
10123 fi
10124 set d_shm
10125 eval $setvar
10126
10127 echo " "
10128 : see if we have sigaction
10129 if set sigaction val -f d_sigaction; eval $csym; $val; then
10130         echo 'sigaction() found.' >&4
10131         $cat > try.c <<'EOP'
10132 #include <stdio.h>
10133 #include <sys/types.h>
10134 #include <signal.h>
10135 int main()
10136 {
10137     struct sigaction act, oact;
10138 }
10139 EOP
10140         set try
10141         if eval $compile_ok; then
10142                 val="$define"
10143         else
10144                 echo "But you don't seem to have a useable struct sigaction." >&4
10145                 val="$undef"
10146         fi
10147 else
10148         echo 'sigaction NOT found.' >&4
10149         val="$undef"
10150 fi
10151 set d_sigaction; eval $setvar
10152 $rm -f try try$_o try.c
10153
10154 : see if sigsetjmp exists
10155 echo " "
10156 case "$d_sigsetjmp" in
10157 '')
10158         $cat >try.c <<'EOP'
10159 #include <setjmp.h>
10160 sigjmp_buf env;
10161 int set = 1;
10162 int main()
10163 {
10164         if (sigsetjmp(env,1))
10165                 exit(set);
10166         set = 0;
10167         siglongjmp(env, 1);
10168         exit(1);
10169 }
10170 EOP
10171         set try
10172         if eval $compile; then
10173                 if ./try >/dev/null 2>&1; then
10174                         echo "POSIX sigsetjmp found." >&4
10175                         val="$define"
10176                 else
10177                         $cat >&4 <<EOM
10178 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10179 I'll ignore them.
10180 EOM
10181                         val="$undef"
10182                 fi
10183         else
10184                 echo "sigsetjmp not found." >&4
10185                 val="$undef"
10186         fi
10187         ;;
10188 *) val="$d_sigsetjmp"
10189         case "$d_sigsetjmp" in
10190         $define) echo "POSIX sigsetjmp found." >&4;;
10191         $undef) echo "sigsetjmp not found." >&4;;
10192         esac
10193         ;;
10194 esac
10195 set d_sigsetjmp
10196 eval $setvar
10197 $rm -f try.c try
10198
10199 : see if sys/stat.h is available
10200 set sys/stat.h i_sysstat
10201 eval $inhdr
10202
10203 : see if stat knows about block sizes
10204 echo " "
10205 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10206 eval $hasfield
10207
10208 : see if _ptr and _cnt from stdio act std
10209 echo " "
10210 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10211         echo "(Looks like you have stdio.h from Linux.)"
10212         case "$stdio_ptr" in
10213         '') stdio_ptr='((fp)->_IO_read_ptr)'
10214                 ptr_lval=$define
10215                 ;;
10216         *)      ptr_lval=$d_stdio_ptr_lval;;
10217         esac
10218         case "$stdio_cnt" in
10219         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10220                 cnt_lval=$undef
10221                 ;;
10222         *)      cnt_lval=$d_stdio_cnt_lval;;
10223         esac
10224         case "$stdio_base" in
10225         '') stdio_base='((fp)->_IO_read_base)';;
10226         esac
10227         case "$stdio_bufsiz" in
10228         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10229         esac
10230 else
10231         case "$stdio_ptr" in
10232         '') stdio_ptr='((fp)->_ptr)'
10233                 ptr_lval=$define
10234                 ;;
10235         *)      ptr_lval=$d_stdio_ptr_lval;;
10236         esac
10237         case "$stdio_cnt" in
10238         '') stdio_cnt='((fp)->_cnt)'
10239                 cnt_lval=$define
10240                 ;;
10241         *)      cnt_lval=$d_stdio_cnt_lval;;
10242         esac
10243         case "$stdio_base" in
10244         '') stdio_base='((fp)->_base)';;
10245         esac
10246         case "$stdio_bufsiz" in
10247         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10248         esac
10249 fi
10250 : test whether _ptr and _cnt really work
10251 echo "Checking how std your stdio is..." >&4
10252 $cat >try.c <<EOP
10253 #include <stdio.h>
10254 #define FILE_ptr(fp)    $stdio_ptr
10255 #define FILE_cnt(fp)    $stdio_cnt
10256 int main() {
10257         FILE *fp = fopen("try.c", "r");
10258         char c = getc(fp);
10259         if (
10260                 18 <= FILE_cnt(fp) &&
10261                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10262         )
10263                 exit(0);
10264         exit(1);
10265 }
10266 EOP
10267 val="$undef"
10268 set try
10269 if eval $compile; then
10270         if ./try; then
10271                 echo "Your stdio acts pretty std."
10272                 val="$define"
10273         else
10274                 echo "Your stdio isn't very std."
10275         fi
10276 else
10277         echo "Your stdio doesn't appear very std."
10278 fi
10279 $rm -f try.c try
10280 set d_stdstdio
10281 eval $setvar
10282
10283 : Can _ptr be used as an lvalue?
10284 case "$d_stdstdio$ptr_lval" in
10285 $define$define) val=$define ;;
10286 *) val=$undef ;;
10287 esac
10288 set d_stdio_ptr_lval
10289 eval $setvar
10290
10291 : Can _cnt be used as an lvalue?
10292 case "$d_stdstdio$cnt_lval" in
10293 $define$define) val=$define ;;
10294 *) val=$undef ;;
10295 esac
10296 set d_stdio_cnt_lval
10297 eval $setvar
10298
10299 : see if _base is also standard
10300 val="$undef"
10301 case "$d_stdstdio" in
10302 $define)
10303         $cat >try.c <<EOP
10304 #include <stdio.h>
10305 #define FILE_base(fp)   $stdio_base
10306 #define FILE_bufsiz(fp) $stdio_bufsiz
10307 int main() {
10308         FILE *fp = fopen("try.c", "r");
10309         char c = getc(fp);
10310         if (
10311                 19 <= FILE_bufsiz(fp) &&
10312                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10313         )
10314                 exit(0);
10315         exit(1);
10316 }
10317 EOP
10318         set try
10319         if eval $compile; then
10320                 if ./try; then
10321                         echo "And its _base field acts std."
10322                         val="$define"
10323                 else
10324                         echo "But its _base field isn't std."
10325                 fi
10326         else
10327                 echo "However, it seems to be lacking the _base field."
10328         fi
10329         $rm -f try.c try
10330         ;;
10331 esac
10332 set d_stdiobase
10333 eval $setvar
10334
10335 $cat >&4 <<EOM
10336 Checking how to access stdio streams by file descriptor number...
10337 EOM
10338 case "$stdio_stream_array" in
10339 '')     $cat >try.c <<EOCP
10340 #include <stdio.h>
10341 int main() {
10342   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10343     printf("yes\n");
10344 }
10345 EOCP
10346         for s in _iob __iob __sF
10347         do
10348                 set try -DSTDIO_STREAM_ARRAY=$s
10349                 if eval $compile; then
10350                         case "`./try$exe_ext`" in
10351                         yes)    stdio_stream_array=$s; break ;;
10352                         esac
10353                 fi
10354         done
10355         $rm -f try.* try$exe_ext
10356 esac
10357 case "$stdio_stream_array" in
10358 '')     $cat >&4 <<EOM
10359 I can't figure out how to access stdio streams by file descriptor number.
10360 EOM
10361         d_stdio_stream_array="$undef"
10362         ;;
10363 *)      $cat >&4 <<EOM
10364 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10365 EOM
10366         d_stdio_stream_array="$define"
10367         ;;
10368 esac
10369
10370 : see if strcoll exists
10371 set strcoll d_strcoll
10372 eval $inlibc
10373
10374 : check for structure copying
10375 echo " "
10376 echo "Checking to see if your C compiler can copy structs..." >&4
10377 $cat >try.c <<'EOCP'
10378 int main()
10379 {
10380         struct blurfl {
10381                 int dyick;
10382         } foo, bar;
10383
10384         foo = bar;
10385 }
10386 EOCP
10387 if $cc -c try.c >/dev/null 2>&1 ; then
10388         val="$define"
10389         echo "Yup, it can."
10390 else
10391         val="$undef"
10392         echo "Nope, it can't."
10393 fi
10394 set d_strctcpy
10395 eval $setvar
10396 $rm -f try.*
10397
10398 : see if strerror and/or sys_errlist[] exist
10399 echo " "
10400 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10401     if set strerror val -f d_strerror; eval $csym; $val; then
10402                 echo 'strerror() found.' >&4
10403                 d_strerror="$define"
10404                 d_strerrm='strerror(e)'
10405                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10406                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10407                         d_syserrlst="$define"
10408                 else
10409                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10410                         d_syserrlst="$undef"
10411                 fi
10412     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10413                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10414                 echo 'strerror() found in string header.' >&4
10415                 d_strerror="$define"
10416                 d_strerrm='strerror(e)'
10417                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10418                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10419                                 d_syserrlst="$define"
10420                 else
10421                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10422                         d_syserrlst="$undef"
10423                 fi
10424     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10425                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10426                 d_strerror="$undef"
10427                 d_syserrlst="$define"
10428                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10429     else
10430                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10431                 d_strerror="$undef"
10432                 d_syserrlst="$undef"
10433                 d_strerrm='"unknown"'
10434     fi
10435 fi
10436
10437 : see if strtod exists
10438 set strtod d_strtod
10439 eval $inlibc
10440
10441 : see if strtol exists
10442 set strtol d_strtol
10443 eval $inlibc
10444
10445 : see if strtoul exists
10446 set strtoul d_strtoul
10447 eval $inlibc
10448
10449 : see if strtoull exists
10450 set strtoull d_strtoull
10451 eval $inlibc
10452
10453 : see if strxfrm exists
10454 set strxfrm d_strxfrm
10455 eval $inlibc
10456
10457 : see if symlink exists
10458 set symlink d_symlink
10459 eval $inlibc
10460
10461 : see if syscall exists
10462 set syscall d_syscall
10463 eval $inlibc
10464
10465 : see if sysconf exists
10466 set sysconf d_sysconf
10467 eval $inlibc
10468
10469 : see if system exists
10470 set system d_system
10471 eval $inlibc
10472
10473 : see if tcgetpgrp exists
10474 set tcgetpgrp d_tcgetpgrp
10475 eval $inlibc
10476
10477 : see if tcsetpgrp exists
10478 set tcsetpgrp d_tcsetpgrp
10479 eval $inlibc
10480
10481 : see if sys/types.h has to be included
10482 set sys/types.h i_systypes
10483 eval $inhdr
10484
10485 : see if prototype for telldir is available
10486 echo " "
10487 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10488 eval $hasproto
10489
10490 : define an is-a-typedef? function
10491 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10492 case "$inclist" in
10493 "") inclist="sys/types.h";;
10494 esac;
10495 eval "varval=\$$var";
10496 case "$varval" in
10497 "")
10498         $rm -f temp.c;
10499         for inc in $inclist; do
10500                 echo "#include <$inc>" >>temp.c;
10501         done;
10502         echo "#ifdef $type" >> temp.c;
10503         echo "printf(\"We have $type\");" >> temp.c;
10504         echo "#endif" >> temp.c;
10505         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10506         if $contains $type temp.E >/dev/null 2>&1; then
10507                 eval "$var=\$type";
10508         else
10509                 eval "$var=\$def";
10510         fi;
10511         $rm -f temp.?;;
10512 *) eval "$var=\$varval";;
10513 esac'
10514
10515 : define an is-a-typedef? function that prompts if the type is not available.
10516 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10517 case "$inclist" in
10518 "") inclist="sys/types.h";;
10519 esac;
10520 eval "varval=\$$var";
10521 case "$varval" in
10522 "")
10523         $rm -f temp.c;
10524         for inc in $inclist; do
10525                 echo "#include <$inc>" >>temp.c;
10526         done;
10527         echo "#ifdef $type" >> temp.c;
10528         echo "printf(\"We have $type\");" >> temp.c;
10529         echo "#endif" >> temp.c;
10530         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10531         echo " " ;
10532         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10533         if $contains $type temp.E >/dev/null 2>&1; then
10534                 echo "$type found." >&4;
10535                 eval "$var=\$type";
10536         else
10537                 echo "$type NOT found." >&4;
10538                 dflt="$def";
10539                 . ./myread ;
10540                 eval "$var=\$ans";
10541         fi;
10542         $rm -f temp.?;;
10543 *) eval "$var=\$varval";;
10544 esac'
10545
10546 : see if this is a sys/times.h system
10547 set sys/times.h i_systimes
10548 eval $inhdr
10549
10550 : see if times exists
10551 echo " "
10552 if set times val -f d_times; eval $csym; $val; then
10553         echo 'times() found.' >&4
10554         d_times="$define"
10555         inc=''
10556         case "$i_systimes" in
10557         "$define") inc='sys/times.h';;
10558         esac
10559         rp="What is the type returned by times() on this system?"
10560         set clock_t clocktype long stdio.h sys/types.h $inc
10561         eval $typedef_ask
10562 else
10563         echo 'times() NOT found, hope that will do.' >&4
10564         d_times="$undef"
10565         clocktype='int'
10566 fi
10567
10568 : see if truncate exists
10569 set truncate d_truncate
10570 eval $inlibc
10571
10572 : see if tzname[] exists
10573 echo " "
10574 if set tzname val -a d_tzname; eval $csym; $val; then
10575         val="$define"
10576         echo 'tzname[] found.' >&4
10577 else
10578         val="$undef"
10579         echo 'tzname[] NOT found.' >&4
10580 fi
10581 set d_tzname
10582 eval $setvar
10583
10584 : see if umask exists
10585 set umask d_umask
10586 eval $inlibc
10587
10588 : backward compatibility for d_hvfork
10589 if test X$d_hvfork != X; then
10590         d_vfork="$d_hvfork"
10591         d_hvfork=''
10592 fi
10593 : see if there is a vfork
10594 val=''
10595 set vfork val
10596 eval $inlibc
10597
10598 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10599 : perl on Solaris 2.x, and probably elsewhere.
10600 case "$val" in
10601 $define)
10602         echo " "
10603         case "$usevfork" in
10604         false) dflt='n';;
10605         *) dflt='y';;
10606         esac
10607         cat <<'EOM'
10608  
10609 Perl can only use a vfork() that doesn't suffer from strict
10610 restrictions on calling functions or modifying global data in
10611 the child.  For example, glibc-2.1 contains such a vfork()
10612 that is unsuitable.  If your system provides a proper fork()
10613 call, chances are that you do NOT want perl to use vfork().
10614
10615 EOM
10616         rp="Do you still want to use vfork()?"
10617         . ./myread
10618         case "$ans" in
10619         y|Y) ;;
10620         *)
10621                 echo "Ok, we won't use vfork()."
10622                 val="$undef"
10623                 ;;
10624         esac
10625         ;;
10626 esac
10627 set d_vfork
10628 eval $setvar
10629 case "$d_vfork" in
10630 $define) usevfork='true';;
10631 *) usevfork='false';;
10632 esac
10633
10634 : see if this is an sysdir system
10635 set sys/dir.h i_sysdir
10636 eval $inhdr
10637
10638 : see if this is an sysndir system
10639 set sys/ndir.h i_sysndir
10640 eval $inhdr
10641
10642 : see if closedir exists
10643 set closedir d_closedir
10644 eval $inlibc
10645
10646 case "$d_closedir" in
10647 "$define")
10648         echo " "
10649         echo "Checking whether closedir() returns a status..." >&4
10650         cat > closedir.c <<EOM
10651 #$i_dirent I_DIRENT             /**/
10652 #$i_sysdir I_SYS_DIR            /**/
10653 #$i_sysndir I_SYS_NDIR          /**/
10654 #$i_systypes I_SYS_TYPES        /**/
10655
10656 #if defined(I_SYS_TYPES)
10657 #include <sys/types.h>
10658 #endif
10659 #if defined(I_DIRENT)
10660 #include <dirent.h>
10661 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10662 #include <sys/dir.h>
10663 #endif
10664 #else
10665 #ifdef I_SYS_NDIR
10666 #include <sys/ndir.h>
10667 #else
10668 #ifdef I_SYS_DIR
10669 #ifdef hp9000s500
10670 #include <ndir.h>       /* may be wrong in the future */
10671 #else
10672 #include <sys/dir.h>
10673 #endif
10674 #endif
10675 #endif
10676 #endif 
10677 int main() { return closedir(opendir(".")); }
10678 EOM
10679         set closedir
10680         if eval $compile_ok; then
10681                 if ./closedir > /dev/null 2>&1 ; then
10682                         echo "Yes, it does."
10683                         val="$undef"
10684                 else
10685                         echo "No, it doesn't."
10686                         val="$define"
10687                 fi
10688         else
10689                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10690                 val="$define"
10691         fi
10692         ;;
10693 *)
10694         val="$undef";
10695         ;;
10696 esac
10697 set d_void_closedir
10698 eval $setvar
10699 $rm -f closedir*
10700 : check for volatile keyword
10701 echo " "
10702 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10703 $cat >try.c <<'EOCP'
10704 int main()
10705 {
10706         typedef struct _goo_struct goo_struct;
10707         goo_struct * volatile goo = ((goo_struct *)0);
10708         struct _goo_struct {
10709                 long long_int;
10710                 int reg_int;
10711                 char char_var;
10712         };
10713         typedef unsigned short foo_t;
10714         char *volatile foo;
10715         volatile int bar;
10716         volatile foo_t blech;
10717         foo = foo;
10718 }
10719 EOCP
10720 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10721         val="$define"
10722         echo "Yup, it does."
10723 else
10724         val="$undef"
10725         echo "Nope, it doesn't."
10726 fi
10727 set d_volatile
10728 eval $setvar
10729 $rm -f try.*
10730
10731 : see if there is a wait4
10732 set wait4 d_wait4
10733 eval $inlibc
10734
10735 : see if waitpid exists
10736 set waitpid d_waitpid
10737 eval $inlibc
10738
10739 : see if wcstombs exists
10740 set wcstombs d_wcstombs
10741 eval $inlibc
10742
10743 : see if wctomb exists
10744 set wctomb d_wctomb
10745 eval $inlibc
10746
10747 : see if writev exists
10748 set writev d_writev
10749 eval $inlibc
10750
10751 : preserve RCS keywords in files with variable substitution, grrr
10752 Date='$Date'
10753 Id='$Id'
10754 Log='$Log'
10755 RCSfile='$RCSfile'
10756 Revision='$Revision'
10757
10758 case "$crosscompile" in
10759 ''|[nN]*) crosscompile="$undef" ;;
10760 esac
10761
10762 case "$osname" in
10763 next|rhapsody) multiarch="$define" ;;
10764 esac
10765 case "$multiarch" in
10766 ''|[nN]*) multiarch="$undef" ;;
10767 esac
10768
10769 : check for alignment requirements
10770 echo " "
10771 case "$crosscompile$multiarch" in
10772 *$define*)
10773         $cat <<EOM
10774 You seem to be either cross-compiling or doing a multiarchitecture build,
10775 skipping the memory alignment check.
10776
10777 EOM
10778         case "$alignbytes" in
10779         '') alignbytes=8 ;;
10780         esac
10781         ;;
10782 *)
10783         case "$alignbytes" in
10784         '') echo "Checking alignment constraints..." >&4
10785                 $cat >try.c <<'EOCP'
10786 struct foobar {
10787         char foo;
10788         double bar;
10789 } try_algn;
10790 int main()
10791 {
10792         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10793 }
10794 EOCP
10795                 set try
10796                 if eval $compile_ok; then
10797                         dflt=`./try`
10798                 else
10799                         dflt='8'
10800                         echo "(I can't seem to compile the test program...)"
10801                 fi
10802                 ;;
10803         *) dflt="$alignbytes"
10804                 ;;
10805         esac
10806         rp="Doubles must be aligned on a how-many-byte boundary?"
10807         . ./myread
10808         alignbytes="$ans"
10809         $rm -f try.c try
10810         ;;
10811 esac
10812
10813
10814 : check for ordering of bytes in a long
10815 echo " "
10816 case "$crosscompile$multiarch" in
10817 *$define*)
10818         $cat <<EOM
10819 You seem to be either cross-compiling or doing a multiarchitecture build,
10820 skipping the byteorder check.
10821
10822 EOM
10823         byteorder='0xffff'
10824         ;;
10825 *)
10826         case "$byteorder" in
10827         '')
10828                 $cat <<'EOM'
10829 In the following, larger digits indicate more significance.  A big-endian
10830 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10831 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10832 machines may have weird orders like 3412.  A Cray will report 87654321,
10833 an Alpha will report 12345678. If the test program works the default is
10834 probably right.
10835 I'm now running the test program...
10836 EOM
10837                 $cat >try.c <<'EOCP'
10838 #include <stdio.h>
10839 int main()
10840 {
10841         int i;
10842         union {
10843                 unsigned long l;
10844                 char c[sizeof(long)];
10845         } u;
10846
10847         if (sizeof(long) > 4)
10848                 u.l = (0x08070605L << 32) | 0x04030201L;
10849         else
10850                 u.l = 0x04030201L;
10851         for (i = 0; i < sizeof(long); i++)
10852                 printf("%c", u.c[i]+'0');
10853         printf("\n");
10854         exit(0);
10855 }
10856 EOCP
10857                 xxx_prompt=y
10858                 set try
10859                 if eval $compile && ./try > /dev/null; then
10860                         dflt=`./try`
10861                         case "$dflt" in
10862                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10863                                 echo "(The test program ran ok.)"
10864                                 echo "byteorder=$dflt"
10865                                 xxx_prompt=n
10866                         ;;
10867                         ????|????????) echo "(The test program ran ok.)" ;;
10868                         *) echo "(The test program didn't run right for some reason.)" ;;
10869                         esac
10870                 else
10871                         dflt='4321'
10872                         cat <<'EOM'
10873 (I can't seem to compile the test program.  Guessing big-endian...)
10874 EOM
10875                 fi
10876                 case "$xxx_prompt" in
10877                 y)
10878                         rp="What is the order of bytes in a long?"
10879                         . ./myread
10880                         byteorder="$ans"
10881                         ;;
10882                 *)      byteorder=$dflt
10883                         ;;
10884                 esac
10885                 ;;
10886         esac
10887         $rm -f try.c try
10888         ;;
10889 esac
10890
10891
10892 : how do we catenate cpp tokens here?
10893 echo " "
10894 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10895 $cat >cpp_stuff.c <<'EOCP'
10896 #define RCAT(a,b)a/**/b
10897 #define ACAT(a,b)a ## b
10898 RCAT(Rei,ser)
10899 ACAT(Cir,cus)
10900 EOCP
10901 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10902 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10903         echo "Oh!  Smells like ANSI's been here." >&4
10904         echo "We can catify or stringify, separately or together!"
10905         cpp_stuff=42
10906 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10907         echo "Ah, yes!  The good old days!" >&4
10908         echo "However, in the good old days we don't know how to stringify and"
10909         echo "catify at the same time."
10910         cpp_stuff=1
10911 else
10912         $cat >&4 <<EOM
10913 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10914 to have to edit the values of CAT[2-5] in config.h...
10915 EOM
10916         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10917 fi
10918 $rm -f cpp_stuff.*
10919
10920 : see if this is a db.h system
10921 set db.h i_db
10922 eval $inhdr
10923
10924 case "$i_db" in
10925 $define)
10926         : Check db version.
10927         echo " "
10928         echo "Checking Berkeley DB version ..." >&4
10929         $cat >try.c <<EOCP
10930 #$d_const HASCONST
10931 #ifndef HASCONST
10932 #define const
10933 #endif
10934 #include <sys/types.h>
10935 #include <stdio.h>
10936 #include <db.h>
10937 int main()
10938 {
10939 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10940     int Major, Minor, Patch ;
10941     unsigned long Version ;
10942     (void)db_version(&Major, &Minor, &Patch) ;
10943     printf("You have Berkeley DB Version 2 or greater\n");
10944
10945     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10946                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10947     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
10948                 Major, Minor, Patch) ;
10949
10950     /* check that db.h & libdb are compatible */
10951     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
10952         printf("db.h and libdb are incompatible\n") ;
10953         exit(3);        
10954     }
10955
10956     printf("db.h and libdb are compatible\n") ;
10957
10958     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
10959                 + DB_VERSION_PATCH ;
10960
10961     /* needs to be >= 2.3.4 */
10962     if (Version < 2003004) {
10963     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
10964         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
10965         exit(2);        
10966     }
10967
10968     exit(0);
10969 #else
10970 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
10971     printf("You have Berkeley DB Version 1\n");
10972     exit(0);    /* DB version < 2: the coast is clear. */
10973 #else
10974     exit(1);    /* <db.h> not Berkeley DB? */
10975 #endif
10976 #endif
10977 }
10978 EOCP
10979         set try
10980         if eval $compile && ./try; then
10981                 echo 'Looks OK.' >&4
10982         else
10983                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
10984                 i_db=$undef
10985                 case " $libs " in
10986                 *"-ldb "*)
10987                         : Remove db from list of libraries to use
10988                         echo "Removing unusable -ldb from library list" >&4
10989                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
10990                         shift
10991                         libs="$*"
10992                         echo "libs = $libs" >&4
10993                         ;;
10994                 esac
10995         fi
10996         $rm -f try.*
10997         ;;
10998 esac
10999
11000 case "$i_db" in
11001 define)
11002         : Check the return type needed for hash 
11003         echo " "
11004         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11005         $cat >try.c <<EOCP
11006 #$d_const HASCONST
11007 #ifndef HASCONST
11008 #define const
11009 #endif
11010 #include <sys/types.h>
11011 #include <db.h>
11012
11013 #ifndef DB_VERSION_MAJOR
11014 u_int32_t hash_cb (ptr, size)
11015 const void *ptr;
11016 size_t size;
11017 {
11018 }
11019 HASHINFO info;
11020 int main()
11021 {
11022         info.hash = hash_cb;
11023 }
11024 #endif
11025 EOCP
11026         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11027                 if $contains warning try.out >>/dev/null 2>&1 ; then
11028                         db_hashtype='int'
11029                 else
11030                         db_hashtype='u_int32_t'
11031                 fi
11032         else
11033                 : XXX Maybe we should just give up here.
11034                 db_hashtype=u_int32_t
11035                 $cat try.out >&4
11036                 echo "Help:  I can't seem to compile the db test program." >&4
11037                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11038         fi
11039         $rm -f try.*
11040         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11041         ;;
11042 *)      db_hashtype=u_int32_t
11043         ;;
11044 esac
11045 case "$i_db" in
11046 define)
11047         : Check the return type needed for prefix 
11048         echo " "
11049         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11050         cat >try.c <<EOCP
11051 #$d_const HASCONST
11052 #ifndef HASCONST
11053 #define const
11054 #endif
11055 #include <sys/types.h>
11056 #include <db.h>
11057
11058 #ifndef DB_VERSION_MAJOR
11059 size_t prefix_cb (key1, key2)
11060 const DBT *key1;
11061 const DBT *key2;
11062 {
11063 }
11064 BTREEINFO info;
11065 int main()
11066 {
11067         info.prefix = prefix_cb;
11068 }
11069 #endif
11070 EOCP
11071         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11072                 if $contains warning try.out >>/dev/null 2>&1 ; then
11073                         db_prefixtype='int'
11074                 else
11075                         db_prefixtype='size_t'
11076                 fi
11077         else
11078                 db_prefixtype='size_t'
11079                 : XXX Maybe we should just give up here.
11080                 $cat try.out >&4
11081                 echo "Help:  I can't seem to compile the db test program." >&4
11082                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11083         fi
11084         $rm -f try.*
11085         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11086         ;;
11087 *)      db_prefixtype='size_t'
11088         ;;
11089 esac
11090
11091 : check for void type
11092 echo " "
11093 echo "Checking to see how well your C compiler groks the void type..." >&4
11094 case "$voidflags" in
11095 '')
11096         $cat >try.c <<'EOCP'
11097 #if TRY & 1
11098 void sub() {
11099 #else
11100 sub() {
11101 #endif
11102         extern void moo();      /* function returning void */
11103         void (*goo)();          /* ptr to func returning void */
11104 #if TRY & 8
11105         void *hue;              /* generic ptr */
11106 #endif
11107 #if TRY & 2
11108         void (*foo[10])();
11109 #endif
11110
11111 #if TRY & 4
11112         if(goo == moo) {
11113                 exit(0);
11114         }
11115 #endif
11116         exit(0);
11117 }
11118 int main() { sub(); }
11119 EOCP
11120         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11121                 voidflags=$defvoidused
11122         echo "Good.  It appears to support void to the level $package wants.">&4
11123                 if $contains warning .out >/dev/null 2>&1; then
11124                         echo "However, you might get some warnings that look like this:"
11125                         $cat .out
11126                 fi
11127         else
11128 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11129                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11130                         echo "It supports 1..."
11131                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11132                                 echo "It also supports 2..."
11133                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11134                                         voidflags=7
11135                                         echo "And it supports 4 but not 8 definitely."
11136                                 else
11137                                         echo "It doesn't support 4..."
11138                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11139                                                 voidflags=11
11140                                                 echo "But it supports 8."
11141                                         else
11142                                                 voidflags=3
11143                                                 echo "Neither does it support 8."
11144                                         fi
11145                                 fi
11146                         else
11147                                 echo "It does not support 2..."
11148                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11149                                         voidflags=13
11150                                         echo "But it supports 4 and 8."
11151                                 else
11152                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11153                                                 voidflags=5
11154                                                 echo "And it supports 4 but has not heard about 8."
11155                                         else
11156                                                 echo "However it supports 8 but not 4."
11157                                         fi
11158                                 fi
11159                         fi
11160                 else
11161                         echo "There is no support at all for void."
11162                         voidflags=0
11163                 fi
11164         fi
11165 esac
11166 case "$voidflags" in
11167 "$defvoidused") ;;
11168 *)      $cat >&4 <<'EOM'
11169   Support flag bits are:
11170     1: basic void declarations.
11171     2: arrays of pointers to functions returning void.
11172     4: operations between pointers to and addresses of void functions.
11173     8: generic void pointers.
11174 EOM
11175         dflt="$voidflags";
11176         rp="Your void support flags add up to what?"
11177         . ./myread
11178         voidflags="$ans"
11179         ;;
11180 esac
11181 $rm -f try.* .out
11182
11183
11184 : How can we generate normalized random numbers ?
11185 echo " "
11186 echo "Looking for a random number function..." >&4
11187 case "$randfunc" in
11188 '')
11189         if set drand48 val -f; eval $csym; $val; then
11190                 dflt="drand48"
11191                 echo "Good, found drand48()." >&4
11192         elif set random val -f; eval $csym; $val; then
11193                 dflt="random"
11194                 echo "OK, found random()." >&4
11195         else
11196                 dflt="rand"
11197                 echo "Yick, looks like I have to use rand()." >&4
11198         fi
11199         echo " "
11200         ;;
11201 *)
11202         dflt="$randfunc"
11203         ;;
11204 esac
11205 cont=true
11206
11207 case "$ccflags" in
11208 *-Dmy_rand=*|*-Dmy_srand=*)
11209         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11210         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11211         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11212         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11213         ;;
11214 esac
11215
11216 while $test "$cont"; do
11217         rp="Use which function to generate random numbers?"
11218         . ./myread
11219         if $test "$ans" = "$dflt"; then
11220                 : null
11221         else
11222                 randbits=''
11223         fi
11224         randfunc="$ans"
11225         if set $ans val -f; eval $csym; $val; then
11226                 cont=''
11227         else
11228                 dflt=y
11229                 rp="I cannot find function $ans. Use that name anyway?"
11230                 . ./myread
11231                 dflt=rand
11232                 case "$ans" in
11233                         [yY]*) cont='';;
11234                 esac
11235         fi
11236         case "$cont" in
11237         '')
11238                 case "$randfunc" in
11239                 drand48)
11240                         drand01="drand48()"
11241                         seedfunc="srand48"
11242                         randbits=48
11243                         randseedtype=long
11244                         ;;
11245                 rand|random)
11246                         case "$randbits" in
11247                         '')
11248 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11249                                 $cat >try.c <<EOCP
11250 #$i_unistd I_UNISTD
11251 #$i_stdlib I_STDLIB
11252 #include <stdio.h>
11253 #ifdef I_UNISTD
11254 #  include <unistd.h>
11255 #endif
11256 #ifdef I_STDLIB
11257 #  include <stdlib.h>
11258 #endif
11259 int main()
11260 {
11261         register int i;
11262         register unsigned long tmp;
11263         register unsigned long max = 0L;
11264
11265         for (i = 1000; i; i--) {
11266                 tmp = (unsigned long) $randfunc();
11267                 if (tmp > max) max = tmp;
11268         }
11269         for (i = 0; max; i++)
11270                 max /= 2;
11271         printf("%d\n",i);
11272 }
11273 EOCP
11274                                 set try
11275                                 if eval $compile_ok; then
11276                                         dflt=`try`
11277                                 else
11278                                         dflt='?'
11279                                         echo "(I can't seem to compile the test program...)"
11280                                 fi
11281                                 ;;
11282                         *)
11283                                 dflt="$randbits"
11284                                 ;;
11285                         esac
11286                         rp="How many bits does your $randfunc() function produce?"
11287                         . ./myread
11288                         randbits="$ans"
11289                         $rm -f try.c try
11290                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11291                         seedfunc="s$randfunc"
11292                         randseedtype=unsigned
11293                         ;;
11294                 *)
11295                         dflt="31"
11296                         rp="How many bits does your $randfunc() function produce?"
11297                         . ./myread
11298                         randbits="$ans"
11299                         seedfunc="s$randfunc"
11300                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11301                         if set $seedfunc val -f; eval $csym; $val; then
11302                                 echo "(Using $seedfunc() to seed random generator)"
11303                         else
11304                                 echo "(Warning: no $seedfunc() to seed random generator)"
11305                                 seedfunc=rand
11306                         fi
11307                         randseedtype=unsigned
11308                         ;;
11309                 esac
11310                 ;;
11311         esac
11312 done
11313
11314 echo " "
11315 echo "Determining whether or not we are on an EBCDIC system..." >&4
11316 $cat >tebcdic.c <<'EOM'
11317 int main()
11318 {
11319   if ('M'==0xd4) return 0;
11320   return 1;
11321 }
11322 EOM
11323
11324 val=$undef
11325 set tebcdic
11326 if eval $compile_ok; then
11327         if ./tebcdic; then
11328                 echo "You have EBCDIC." >&4
11329                 val="$define"
11330         else
11331                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
11332         fi
11333 else
11334         echo "I'm unable to compile the test program." >&4
11335         echo "I'll assume ASCII or some ISO Latin." >&4
11336 fi
11337 $rm -f tebcdic.c tebcdic
11338 set ebcdic
11339 eval $setvar
11340
11341 echo " "
11342 $cat >&4 <<EOM
11343 Checking how to flush all pending stdio output...
11344 EOM
11345 # I only know how to find the first 32 possibly open files on SunOS.
11346 # See also hints/sunos_4_1.sh and util.c  --AD
11347 case "$osname" in
11348 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11349 esac
11350 $cat >>try.c <<EOCP
11351 #include <stdio.h>
11352 #$i_unistd I_UNISTD
11353 #ifdef I_UNISTD
11354 # include <unistd.h>
11355 #endif
11356 #$d_sysconf HAS_SYSCONF
11357 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11358 #ifdef HAS_STDIO_STREAM_ARRAY
11359 # define STDIO_STREAM_ARRAY $stdio_stream_array
11360 #endif
11361 int main() {
11362   FILE* p = fopen("try.out", "w");
11363 #ifdef TRY_FPUTC
11364   fputc('x', p);
11365 #else
11366 # ifdef TRY_FPRINTF
11367   fprintf(p, "x");
11368 # endif
11369 #endif
11370 #ifdef TRY_FFLUSH_NULL
11371   fflush(NULL);
11372 #endif
11373 #ifdef TRY_FFLUSH_ALL
11374   {
11375     long open_max = -1;
11376 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11377     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11378 # else
11379 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11380     open_max = sysconf(_SC_OPEN_MAX);
11381 #  else
11382 #   ifdef FOPEN_MAX
11383     open_max = FOPEN_MAX;
11384 #   else
11385 #    ifdef OPEN_MAX
11386     open_max = OPEN_MAX;
11387 #    else
11388 #     ifdef _NFILE
11389     open_max = _NFILE;
11390 #     endif
11391 #    endif
11392 #   endif
11393 #  endif
11394 # endif 
11395 # ifdef HAS_STDIO_STREAM_ARRAY
11396     if (open_max > 0) {
11397       long i;
11398       for (i = 0; i < open_max; i++)
11399             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11400                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11401                 STDIO_STREAM_ARRAY[i]._flag)
11402                 fflush(&STDIO_STREAM_ARRAY[i]);
11403     }   
11404   }
11405 # endif
11406 #endif
11407   _exit(42);
11408 }
11409 EOCP
11410 : first we have to find out how _not_ to flush
11411 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11412     output=''
11413     set try -DTRY_FPUTC
11414     if eval $compile; then
11415             $rm -f try.out
11416             ./try$exe_ext 2>/dev/null
11417             if $test ! -s try.out -a "X$?" = X42; then
11418                 output=-DTRY_FPUTC
11419             fi
11420     fi
11421     case "$output" in
11422     '')
11423             set try -DTRY_FPRINTF
11424             $rm -f try.out
11425             if eval $compile; then
11426                     $rm -f try.out
11427                     ./try$exe_ext 2>/dev/null
11428                     if $test ! -s try.out -a "X$?" = X42; then
11429                         output=-DTRY_FPRINTF
11430                     fi
11431             fi
11432         ;;
11433     esac
11434 fi
11435 : check for fflush NULL behaviour
11436 case "$fflushNULL" in
11437 '')     set try -DTRY_FFLUSH_NULL $output
11438         if eval $compile; then
11439                 $rm -f try.out
11440                 ./try$exe_ext 2>/dev/null
11441                 code="$?"
11442                 if $test -s try.out -a "X$code" = X42; then
11443                         fflushNULL="`$cat try.out`"
11444                 else
11445                         if $test "X$code" != X42; then
11446                                 $cat >&4 <<EOM
11447 (If this test failed, don't worry, we'll try another method shortly.)
11448 EOM
11449                         fi
11450                 fi
11451         fi
11452         $rm -f core try.core core.try.*
11453         case "$fflushNULL" in
11454         x)      $cat >&4 <<EOM
11455 Your fflush(NULL) works okay.
11456 EOM
11457                 fflushNULL="$define"
11458                 ;;
11459         '')     $cat >&4 <<EOM
11460 Your fflush(NULL) isn't working (contrary to ANSI C).
11461 EOM
11462                 fflushNULL="$undef"
11463                 ;;
11464         *)      $cat >&4 <<EOM
11465 Cannot figure out whether your fflush(NULL) works or not.
11466 I'm assuming it doesn't (contrary to ANSI C).
11467 EOM
11468                 fflushNULL="$undef"
11469                 ;;
11470         esac
11471         ;;
11472 $define|true|[yY]*)
11473         fflushNULL="$define"
11474         ;;
11475 *)
11476         fflushNULL="$undef"
11477         ;;
11478 esac
11479 : check explicit looping only if NULL did not work
11480 case "$fflushNULL" in
11481 "$undef")
11482         : check for fflush all behaviour
11483         case "$fflushall" in
11484         '')     set try -DTRY_FFLUSH_ALL $output
11485                 if eval $compile; then
11486                         $cat >&4 <<EOM
11487 (Now testing the other method--but note that also this may fail.)
11488 EOM
11489                         $rm -f try.out
11490                         ./try$exe_ext 2>/dev/null
11491                         if $test -s try.out -a "X$?" = X42; then
11492                                 fflushall="`$cat try.out`"
11493                         fi
11494                 fi
11495                 $rm -f core try.core core.try.*
11496                 case "$fflushall" in
11497                 x)      $cat >&4 <<EOM
11498 Whew. Flushing explicitly all the stdio streams works.
11499 EOM
11500                         fflushall="$define"
11501                         ;;
11502                 '')     $cat >&4 <<EOM
11503 Sigh. Flushing explicitly all the stdio streams doesn't work.
11504 EOM
11505                         fflushall="$undef"
11506                         ;;
11507                 *)      $cat >&4 <<EOM
11508 Cannot figure out whether flushing stdio streams explicitly works or not.
11509 I'm assuming it doesn't.
11510 EOM
11511                         fflushall="$undef"
11512                         ;;
11513                 esac
11514                 ;;
11515         "$define"|true|[yY]*)
11516                 fflushall="$define"
11517                 ;;
11518         *)
11519                 fflushall="$undef"
11520                 ;;
11521         esac
11522         ;;
11523 *)      fflushall="$undef"      
11524         ;;
11525 esac
11526 case "$fflushNULL$fflushall" in
11527 undefundef)
11528         $cat <<EOM
11529 I cannot figure out how to flush pending stdio output.
11530 EOM
11531         ;;
11532 esac
11533 $rm -f try.* try$exe_ext
11534
11535 : see what type file positions are declared as in the library
11536 rp="What is the type for file position used by fsetpos()?"
11537 set fpos_t fpostype long stdio.h sys/types.h
11538 eval $typedef_ask
11539
11540 : Store the full pathname to the ar program for use in the C program
11541 : Respect a hint or command line value for full_ar.
11542 case "$full_ar" in
11543 '') full_ar=$ar ;;
11544 esac
11545
11546 : Store the full pathname to the sed program for use in the C program
11547 full_sed=$sed
11548
11549 : see what type gids are declared as in the kernel
11550 echo " "
11551 echo "Looking for the type for group ids returned by getgid()."
11552 set gid_t gidtype xxx stdio.h sys/types.h
11553 eval $typedef
11554 case "$gidtype" in
11555 xxx)
11556         xxx=`./findhdr sys/user.h`
11557         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11558         case $1 in
11559         unsigned) dflt="$1 $2" ;;
11560         *) dflt="$1" ;;
11561         esac
11562         ;;
11563 *) dflt="$gidtype";;
11564 esac
11565 case "$gidtype" in
11566 gid_t) echo "gid_t found." ;;
11567 *)      rp="What is the type for group ids returned by getgid()?"
11568         . ./myread
11569         gidtype="$ans"
11570         ;;
11571 esac
11572
11573 : see if getgroups exists
11574 set getgroups d_getgrps
11575 eval $inlibc
11576
11577 : see if setgroups exists
11578 set setgroups d_setgrps
11579 eval $inlibc
11580
11581
11582 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11583 echo " "
11584 case "$d_getgrps$d_setgrps" in
11585 *define*)
11586         case "$groupstype" in
11587         '') dflt="$gidtype" ;;
11588         *)  dflt="$groupstype" ;;
11589         esac
11590         $cat <<EOM
11591 What type of pointer is the second argument to getgroups() and setgroups()?
11592 Usually this is the same as group ids, $gidtype, but not always.
11593
11594 EOM
11595         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11596         . ./myread
11597         groupstype="$ans"
11598         ;;
11599 *)  groupstype="$gidtype";;
11600 esac
11601
11602 : see what type lseek is declared as in the kernel
11603 rp="What is the type used for lseek's offset on this system?"
11604 set off_t lseektype long stdio.h sys/types.h
11605 eval $typedef_ask
11606
11607 echo " "
11608 $echo $n "Checking to see how big your file offsets are...$c" >&4
11609 $cat >try.c <<EOCP
11610 #include <sys/types.h>
11611 #include <stdio.h>
11612 int main()
11613 {
11614         printf("%d\n", sizeof($lseektype));
11615 }
11616 EOCP
11617 set try
11618 if eval $compile_ok; then
11619         lseeksize=`./try`
11620         $echo " $lseeksize bytes." >&4
11621 else
11622         dflt='4'
11623         echo " "
11624         echo "(I can't seem to compile the test program.  Guessing...)"
11625         rp="What is the size of your file offsets (in bytes)?"
11626         . ./myread
11627         lseeksize="$ans"
11628 fi
11629 $rm -f try.c try
11630
11631 echo " "
11632 echo "Checking if your $make program sets \$(MAKE)..." >&4
11633 case "$make_set_make" in
11634 '')
11635         $sed 's/^X //' > testmake.mak << 'EOF'
11636 Xall:
11637 X       @echo 'maketemp="$(MAKE)"'
11638 EOF
11639         case "`$make -f testmake.mak 2>/dev/null`" in
11640         *maketemp=*) make_set_make='#' ;;
11641         *)      make_set_make="MAKE=$make" ;;
11642         esac
11643         $rm -f testmake.mak
11644         ;;
11645 esac
11646 case "$make_set_make" in
11647 '#') echo "Yup, it does.";;
11648 *) echo "Nope, it doesn't.";;
11649 esac
11650
11651 : see what type is used for mode_t
11652 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11653 set mode_t modetype int stdio.h sys/types.h
11654 eval $typedef_ask
11655
11656 : define a fucntion to check prototypes
11657 $cat > protochk <<EOSH
11658 $startsh
11659 cc="$cc"
11660 optimize="$optimize"
11661 ccflags="$ccflags"
11662 prototype="$prototype"
11663 define="$define"
11664 rm=$rm
11665 EOSH
11666
11667 $cat >> protochk <<'EOSH'
11668
11669 $rm -f try.c
11670 foo="$1"
11671 shift
11672 while test $# -ge 2; do
11673         case "$1" in
11674                 $define) echo "#include <$2>" >> try.c ;;
11675                 literal) echo "$2" >> try.c ;;
11676         esac
11677     shift 2
11678 done
11679 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11680 cat >> try.c <<'EOCP'
11681 #ifdef CAN_PROTOTYPE
11682 #define _(args) args
11683 #else
11684 #define _(args) ()
11685 #endif
11686 EOCP
11687 echo "$foo" >> try.c
11688 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11689 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11690 status=$?
11691 $rm -f try.[co]
11692 exit $status
11693 EOSH
11694 chmod +x protochk
11695 $eunicefix protochk
11696
11697 : see what type is used for size_t
11698 rp="What is the type used for the length parameter for string functions?"
11699 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11700 eval $typedef_ask
11701
11702 : check for type of arguments to gethostbyaddr. 
11703 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11704         case "$d_gethbyaddr" in
11705         $define)
11706                 $cat <<EOM
11707
11708 Checking to see what type of arguments are accepted by gethostbyaddr().
11709 EOM
11710                 hdrs="$define sys/types.h
11711                         $d_socket sys/socket.h 
11712                         $i_niin netinet/in.h 
11713                         $i_netdb netdb.h
11714                         $i_unistd unistd.h"
11715                 : The first arg can 'char *' or 'void *'
11716                 : The second arg is some of integral type
11717                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11718                         for yyy in size_t long int; do
11719                                 case "$netdb_host_type" in
11720                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11721                                         if ./protochk "$try" $hdrs; then
11722                                                 echo "Your system accepts $xxx for the first arg."
11723                                                 echo "...and $yyy for the second arg."
11724                                                 netdb_host_type="$xxx"
11725                                                 netdb_hlen_type="$yyy"
11726                                         fi
11727                                         ;;
11728                                 esac
11729                         done
11730                 done
11731                 : In case none of those worked, prompt the user.
11732                 case "$netdb_host_type" in
11733                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11734                         dflt='char *'
11735                         . ./myread
11736                         netdb_host_type=$ans
11737                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11738                         dflt="$sizetype"
11739                         . ./myread
11740                         netdb_hlen_type=$ans
11741                         ;;
11742                 esac
11743                 ;;
11744         *)      : no gethostbyaddr, so pick harmless defaults
11745                 netdb_host_type='char *'
11746                 netdb_hlen_type="$sizetype"
11747                 ;;
11748         esac
11749         # Remove the "const" if needed. -- but then we'll have a 
11750         # prototype clash!
11751         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11752 fi
11753
11754 : check for type of argument to gethostbyname. 
11755 if test "X$netdb_name_type" = X ; then
11756         case "$d_gethbyname" in
11757         $define)
11758                 $cat <<EOM
11759
11760 Checking to see what type of argument is accepted by gethostbyname().
11761 EOM
11762                 hdrs="$define sys/types.h
11763                         $d_socket sys/socket.h 
11764                         $i_niin netinet/in.h 
11765                         $i_netdb netdb.h
11766                         $i_unistd unistd.h"
11767                 for xxx in "const char *" "char *"; do
11768                         case "$netdb_name_type" in
11769                         '')     try="extern struct hostent *gethostbyname($xxx);"
11770                                 if ./protochk "$try" $hdrs; then
11771                                         echo "Your system accepts $xxx."
11772                                         netdb_name_type="$xxx"
11773                                 fi
11774                                 ;;
11775                         esac
11776                 done
11777                 : In case none of those worked, prompt the user.
11778                 case "$netdb_name_type" in
11779                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11780                         dflt='char *'
11781                         . ./myread
11782                         netdb_name_type=$ans
11783                         ;;
11784                 esac
11785                 ;;
11786         *)      : no gethostbyname, so pick harmless default
11787                 netdb_name_type='char *'
11788                 ;;
11789         esac
11790 fi
11791
11792 : check for type of 1st argument to getnetbyaddr. 
11793 if test "X$netdb_net_type" = X ; then
11794         case "$d_getnbyaddr" in
11795         $define)
11796                 $cat <<EOM
11797
11798 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11799 EOM
11800                 hdrs="$define sys/types.h
11801                         $d_socket sys/socket.h 
11802                         $i_niin netinet/in.h 
11803                         $i_netdb netdb.h
11804                         $i_unistd unistd.h"
11805                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11806                         case "$netdb_net_type" in
11807                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11808                                 if ./protochk "$try" $hdrs; then
11809                                         echo "Your system accepts $xxx."
11810                                         netdb_net_type="$xxx"
11811                                 fi
11812                                 ;;
11813                         esac
11814                 done
11815                 : In case none of those worked, prompt the user.
11816                 case "$netdb_net_type" in
11817                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11818                         dflt='long'
11819                         . ./myread
11820                         netdb_net_type=$ans
11821                         ;;
11822                 esac
11823                 ;;
11824         *)      : no getnetbyaddr, so pick harmless default
11825                 netdb_net_type='long'
11826                 ;;
11827         esac
11828 fi
11829 : locate the preferred pager for this system
11830 case "$pager" in
11831 '')
11832         dflt=''
11833         case "$pg" in
11834         /*) dflt=$pg;;
11835         esac
11836         case "$more" in
11837         /*) dflt=$more;;
11838         esac
11839         case "$less" in
11840         /*) dflt=$less;;
11841         esac
11842         case "$dflt" in
11843         '') dflt=/usr/ucb/more;;
11844         esac
11845         ;;
11846 *) dflt="$pager";;
11847 esac
11848 echo " "
11849 fn=f/
11850 rp='What pager is used on your system?'
11851 . ./getfile
11852 pager="$ans"
11853
11854 : see what type pids are declared as in the kernel
11855 rp="What is the type of process ids on this system?"
11856 set pid_t pidtype int stdio.h sys/types.h
11857 eval $typedef_ask
11858
11859 : check for length of pointer
11860 echo " "
11861 case "$ptrsize" in
11862 '')
11863         $echo $n "Checking to see how big your pointers are...$c" >&4
11864         if test "$voidflags" -gt 7; then
11865                 echo '#define VOID_PTR char *' > try.c
11866         else
11867                 echo '#define VOID_PTR void *' > try.c
11868         fi
11869         $cat >>try.c <<'EOCP'
11870 #include <stdio.h>
11871 int main()
11872 {
11873         printf("%d\n", sizeof(VOID_PTR));
11874         exit(0);
11875 }
11876 EOCP
11877         set try
11878         if eval $compile_ok; then
11879                 ptrsize=`./try`
11880                 $echo " $ptrsize bytes." >&4
11881         else
11882                 dflt='4'
11883                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11884                 rp="What is the size of a pointer (in bytes)?"
11885                 . ./myread
11886                 ptrsize="$ans"
11887         fi
11888         ;;
11889 esac
11890 $rm -f try.c try
11891
11892 : see if ar generates random libraries by itself
11893 echo " "
11894 echo "Checking how to generate random libraries on your machine..." >&4
11895 echo 'int bar1() { return bar2(); }' > bar1.c
11896 echo 'int bar2() { return 2; }' > bar2.c
11897 $cat > foo.c <<'EOP'
11898 int main() { printf("%d\n", bar1()); exit(0); }
11899 EOP
11900 $cc $ccflags -c bar1.c >/dev/null 2>&1
11901 $cc $ccflags -c bar2.c >/dev/null 2>&1
11902 $cc $ccflags -c foo.c >/dev/null 2>&1
11903 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11904 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11905         ./foobar >/dev/null 2>&1; then
11906         echo "$ar appears to generate random libraries itself."
11907         orderlib=false
11908         ranlib=":"
11909 elif $ar ts bar$_a >/dev/null 2>&1 &&
11910         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11911         ./foobar >/dev/null 2>&1; then
11912                 echo "a table of contents needs to be added with '$ar ts'."
11913                 orderlib=false
11914                 ranlib="$ar ts"
11915 else
11916         case "$ranlib" in
11917         :) ranlib='';;
11918         '')
11919                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11920                 $test -f $ranlib || ranlib=''
11921                 ;;
11922         esac
11923         if $test -n "$ranlib"; then
11924                 echo "your system has '$ranlib'; we'll use that."
11925                 orderlib=false
11926         else
11927                 echo "your system doesn't seem to support random libraries"
11928                 echo "so we'll use lorder and tsort to order the libraries."
11929                 orderlib=true
11930                 ranlib=":"
11931         fi
11932 fi
11933 $rm -f foo* bar* 
11934
11935 : check for type of arguments to select. 
11936 case "$selecttype" in
11937 '') case "$d_select" in
11938         $define)
11939                 $cat <<EOM
11940 Checking to see what type of arguments are accepted by select().
11941 EOM
11942                 hdrs="$define sys/types.h
11943                         $i_systime sys/time.h 
11944                         $i_sysselct sys/select.h
11945                         $d_socket sys/socket.h"
11946                 : The first arg can be int, unsigned, or size_t
11947                 : The last arg may or may not be 'const'
11948                 val=''
11949                 : void pointer has been seen but using that
11950                 : breaks the selectminbits test
11951                 for xxx in 'fd_set *' 'int *'; do
11952                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
11953                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
11954                                         case "$val" in
11955                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
11956                                                 if ./protochk "$try" $hdrs; then
11957                                                         echo "Your system accepts $xxx."
11958                                                         val="$xxx"
11959                                                 fi
11960                                                 ;;
11961                                         esac
11962                                 done
11963                         done
11964                 done
11965                 case "$val" in
11966                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
11967                         case "$d_fd_set" in
11968                                 $define) dflt="fd_set *" ;;
11969                                 *)              dflt="int *" ;;
11970                         esac
11971                         . ./myread
11972                         val=$ans
11973                         ;;
11974                 esac
11975                 selecttype="$val"
11976                 ;;
11977         *)      : no select, so pick a harmless default
11978                 selecttype='int *'
11979                 ;;
11980         esac
11981         ;;
11982 esac
11983
11984 : check for the select 'width'
11985 case "$selectminbits" in
11986 '') case "$d_select" in
11987         $define)
11988                 $cat <<EOM
11989
11990 Checking to see on how many bits at a time your select() operates...
11991 EOM
11992                 $cat >try.c <<EOCP
11993 #include <sys/types.h>
11994 #$i_time I_TIME
11995 #$i_systime I_SYS_TIME
11996 #$i_systimek I_SYS_TIME_KERNEL
11997 #ifdef I_TIME
11998 #   include <time.h>
11999 #endif
12000 #ifdef I_SYS_TIME
12001 #   ifdef I_SYS_TIME_KERNEL
12002 #       define KERNEL
12003 #   endif
12004 #   include <sys/time.h>
12005 #   ifdef I_SYS_TIME_KERNEL
12006 #       undef KERNEL
12007 #   endif
12008 #endif
12009 #$i_sysselct I_SYS_SELECT
12010 #ifdef I_SYS_SELECT
12011 #include <sys/select.h>
12012 #endif
12013 #$d_socket HAS_SOCKET
12014 #ifdef HAS_SOCKET
12015 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12016 #endif
12017 #include <stdio.h>
12018 $selecttype b;
12019 #define S sizeof(*(b))
12020 #define MINBITS 64
12021 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12022 #define NBITS  (NBYTES * 8)
12023 int main() {
12024     char s[NBYTES];
12025     struct timeval t;
12026     int i;
12027     FILE* fp;
12028     int fd;
12029
12030     fclose(stdin);
12031     fp = fopen("try.c", "r");
12032     if (fp == 0)
12033       exit(1);
12034     fd = fileno(fp);
12035     if (fd < 0)
12036       exit(2);
12037     b = ($selecttype)s;
12038     for (i = 0; i < NBITS; i++)
12039         FD_SET(i, b);
12040     t.tv_sec  = 0;
12041     t.tv_usec = 0;
12042     select(fd + 1, b, 0, 0, &t);
12043     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12044     printf("%d\n", i + 1);
12045     return 0;
12046 }
12047 EOCP
12048                 set try
12049                 if eval $compile_ok; then
12050                         selectminbits=`./try`
12051                         case "$selectminbits" in
12052                         '')     cat >&4 <<EOM
12053 Cannot figure out on how many bits at a time your select() operates.
12054 I'll play safe and guess it is 32 bits.
12055 EOM
12056                                 selectminbits=32
12057                                 bits="32 bits"
12058                                 ;;
12059                         1)      bits="1 bit" ;;
12060                         *)      bits="$selectminbits bits" ;;
12061                         esac
12062                         echo "Your select() operates on $bits at a time." >&4
12063                 else
12064                         rp='What is the minimum number of bits your select() operates on?'
12065                         case "$byteorder" in
12066                         1234|12345678)  dflt=32 ;;
12067                         *)              dflt=1  ;;
12068                         esac
12069                         . ./myread
12070                         val=$ans
12071                         selectminbits="$val"
12072                 fi
12073                 $rm -f try.* try
12074                 ;;
12075         *)      : no select, so pick a harmless default
12076                 selectminbits='32'
12077                 ;;
12078         esac
12079         ;;
12080 esac
12081
12082 : Trace out the files included by signal.h, then look for SIGxxx names.
12083 : Remove SIGARRAYSIZE used by HPUX.
12084 : Remove SIGSTKSIZE used by Linux.
12085 : Remove SIGSTKSZ used by Posix.
12086 : Remove SIGTYP void lines used by OS2.
12087 xxx=`echo '#include <signal.h>' |
12088         $cppstdin $cppminus $cppflags 2>/dev/null |
12089         $grep '^[       ]*#.*include' | 
12090         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12091 : Check this list of files to be sure we have parsed the cpp output ok.
12092 : This will also avoid potentially non-existent files, such 
12093 : as ../foo/bar.h
12094 xxxfiles=''
12095 for xx in $xxx /dev/null ; do
12096         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12097 done
12098 : If we have found no files, at least try signal.h
12099 case "$xxxfiles" in
12100 '')     xxxfiles=`./findhdr signal.h` ;;
12101 esac
12102 xxx=`awk '
12103 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12104         print substr($2, 4, 20)
12105 }
12106 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12107         print substr($3, 4, 20)
12108 }' $xxxfiles`
12109 : Append some common names just in case the awk scan failed.
12110 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12111 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12112 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12113 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12114 : generate a few handy files for later
12115 $cat > signal.c <<'EOCP'
12116 #include <sys/types.h>
12117 #include <signal.h>
12118 #include <stdio.h>
12119 int main() {
12120
12121 /* Strange style to avoid deeply-nested #if/#else/#endif */
12122 #ifndef NSIG
12123 #  ifdef _NSIG
12124 #    define NSIG (_NSIG)
12125 #  endif
12126 #endif
12127
12128 #ifndef NSIG
12129 #  ifdef SIGMAX
12130 #    define NSIG (SIGMAX+1)
12131 #  endif
12132 #endif
12133
12134 #ifndef NSIG
12135 #  ifdef SIG_MAX
12136 #    define NSIG (SIG_MAX+1)
12137 #  endif
12138 #endif
12139
12140 #ifndef NSIG
12141 #  ifdef MAXSIG
12142 #    define NSIG (MAXSIG+1)
12143 #  endif
12144 #endif
12145
12146 #ifndef NSIG
12147 #  ifdef MAX_SIG
12148 #    define NSIG (MAX_SIG+1)
12149 #  endif
12150 #endif
12151
12152 #ifndef NSIG
12153 #  ifdef SIGARRAYSIZE
12154 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12155 #  endif
12156 #endif
12157
12158 #ifndef NSIG
12159 #  ifdef _sys_nsig
12160 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12161 #  endif
12162 #endif
12163
12164 /* Default to some arbitrary number that's big enough to get most
12165    of the common signals.
12166 */
12167 #ifndef NSIG
12168 #    define NSIG 50
12169 #endif
12170
12171 printf("NSIG %d\n", NSIG);
12172
12173 #ifndef JUST_NSIG
12174
12175 EOCP
12176
12177 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12178 {
12179         printf "#ifdef SIG"; printf $1; printf "\n"
12180         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12181         printf $1; printf ");\n"
12182         printf "#endif\n"
12183 }
12184 END {
12185         printf "#endif /* JUST_NSIG */\n";
12186         printf "}\n";
12187 }
12188 ' >>signal.c
12189 $cat >signal.awk <<'EOP'
12190 BEGIN { ndups = 0 }
12191 $1 ~ /^NSIG$/ { nsig = $2 }
12192 ($1 !~ /^NSIG$/) && (NF == 2) {
12193     if ($2 > maxsig) { maxsig = $2 }
12194     if (sig_name[$2]) {
12195         dup_name[ndups] = $1
12196         dup_num[ndups] = $2
12197         ndups++ 
12198     }
12199     else {
12200         sig_name[$2] = $1
12201         sig_num[$2] = $2
12202     }
12203 }
12204 END { 
12205     if (nsig == 0) {
12206         nsig = maxsig + 1
12207     }
12208     printf("NSIG %d\n", nsig);
12209     for (n = 1; n < nsig; n++) {
12210         if (sig_name[n]) {
12211             printf("%s %d\n", sig_name[n], sig_num[n])
12212         }
12213         else {
12214             printf("NUM%d %d\n", n, n) 
12215         }
12216     }
12217     for (n = 0; n < ndups; n++) {
12218         printf("%s %d\n", dup_name[n], dup_num[n])
12219     }
12220 }
12221 EOP
12222 $cat >signal_cmd <<EOS
12223 $startsh
12224 if $test -s signal.lst; then
12225     echo "Using your existing signal.lst file"
12226         exit 0
12227 fi
12228 xxx="$xxx"
12229 EOS
12230 $cat >>signal_cmd <<'EOS'
12231
12232 set signal
12233 if eval $compile_ok; then
12234         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12235 else
12236         echo "(I can't seem be able to compile the whole test program)" >&4
12237         echo "(I'll try it in little pieces.)" >&4
12238         set signal -DJUST_NSIG
12239         if eval $compile_ok; then
12240                 ./signal$_exe > signal.nsg
12241                 $cat signal.nsg
12242         else
12243                 echo "I can't seem to figure out how many signals you have." >&4
12244                 echo "Guessing 50." >&4
12245                 echo 'NSIG 50' > signal.nsg
12246         fi
12247         : Now look at all the signal names, one at a time.
12248         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12249                 $cat > signal.c <<EOCP
12250 #include <sys/types.h>
12251 #include <signal.h>
12252 #include <stdio.h>
12253 int main() {
12254 printf("$xx %d\n", SIG${xx});
12255 return 0;
12256 }
12257 EOCP
12258                 set signal
12259                 if eval $compile; then
12260                         echo "SIG${xx} found."
12261                         ./signal$_exe  >> signal.ls1
12262                 else
12263                         echo "SIG${xx} NOT found."
12264                 fi
12265         done
12266         if $test -s signal.ls1; then
12267                 $cat signal.nsg signal.ls1 |
12268                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12269         fi
12270
12271 fi
12272 if $test -s signal.lst; then
12273         :
12274 else
12275         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12276         echo 'kill -l' >signal
12277         set X `csh -f <signal`
12278         $rm -f signal
12279         shift
12280         case $# in
12281         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12282         esac
12283         echo $@ | $tr ' ' $trnl | \
12284             $awk '{ printf "%s %d\n", $1, ++s; }
12285                   END { printf "NSIG %d\n", ++s }' >signal.lst
12286 fi
12287 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12288 EOS
12289 chmod a+x signal_cmd
12290 $eunicefix signal_cmd
12291
12292 : generate list of signal names
12293 echo " "
12294 case "$sig_name_init" in
12295 '') doinit=yes ;;
12296 *)  case "$sig_num_init" in
12297     ''|*,*) doinit=yes ;;
12298     esac ;;
12299 esac
12300 case "$doinit" in
12301 yes)
12302         echo "Generating a list of signal names and numbers..." >&4
12303         . ./signal_cmd
12304         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12305         sig_name=`$awk 'BEGIN { printf "ZERO " }
12306                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12307         sig_num=`$awk  'BEGIN { printf "0 " }
12308                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12309         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12310                              !/^NSIG/   { printf "\"%s\", ", $1 }
12311                              END        { printf "0\n" }' signal.lst`
12312         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12313                              !/^NSIG/   { printf "%d, ", $2}
12314                              END        { printf "0\n"}' signal.lst`
12315         ;;
12316 esac
12317 echo "The following $sig_count signals are available:"
12318 echo " "
12319 echo $sig_name | $awk \
12320 'BEGIN { linelen = 0 }
12321 {
12322         for (i = 1; i <= NF; i++) {
12323                 name = "SIG" $i " "
12324                 linelen = linelen + length(name)
12325                 if (linelen > 70) {
12326                         printf "\n"
12327                         linelen = length(name)
12328                 }
12329                 printf "%s", name
12330         }
12331         printf "\n"
12332 }'
12333 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12334
12335 : see what type is used for signed size_t
12336 set ssize_t ssizetype int stdio.h sys/types.h
12337 eval $typedef
12338 dflt="$ssizetype"
12339 $cat > ssize.c <<EOM
12340 #include <stdio.h>
12341 #include <sys/types.h>
12342 #define Size_t $sizetype
12343 #define SSize_t $dflt
12344 int main()
12345 {
12346         if (sizeof(Size_t) == sizeof(SSize_t))
12347                 printf("$dflt\n");
12348         else if (sizeof(Size_t) == sizeof(int))
12349                 printf("int\n");
12350         else 
12351                 printf("long\n");
12352         exit(0);
12353 }
12354 EOM
12355 echo " "
12356 set ssize
12357 if eval $compile_ok && ./ssize > /dev/null; then
12358         ssizetype=`./ssize`
12359         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12360 else
12361         $cat >&4 <<EOM
12362 Help! I can't compile and run the ssize_t test program: please enlighten me!
12363 (This is probably a misconfiguration in your system or libraries, and
12364 you really ought to fix it.  Still, I'll try anyway.)
12365
12366 I need a type that is the same size as $sizetype, but is guaranteed to
12367 be signed.  Common values are ssize_t, int and long.
12368
12369 EOM
12370         rp="What signed type is the same size as $sizetype?"
12371         . ./myread
12372         ssizetype="$ans"
12373 fi
12374 $rm -f ssize ssize.*
12375
12376 : see what type of char stdio uses.
12377 echo " "
12378 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12379         echo "Your stdio uses unsigned chars." >&4
12380         stdchar="unsigned char"
12381 else
12382         echo "Your stdio uses signed chars." >&4
12383         stdchar="char"
12384 fi
12385
12386 : see if time exists
12387 echo " "
12388 if test "X$d_time" = X -o X"$timetype" = X; then
12389     if set time val -f d_time; eval $csym; $val; then
12390                 echo 'time() found.' >&4
12391                 val="$define"
12392                 rp="What is the type returned by time() on this system?"
12393                 set time_t timetype long stdio.h sys/types.h
12394                 eval $typedef_ask
12395     else
12396                 echo 'time() not found, hope that will do.' >&4
12397                 val="$undef"
12398                 timetype='int';
12399     fi
12400     set d_time
12401     eval $setvar
12402 fi
12403
12404 : see what type uids are declared as in the kernel
12405 echo " "
12406 echo "Looking for the type for user ids returned by getuid()."
12407 set uid_t uidtype xxx stdio.h sys/types.h
12408 eval $typedef
12409 case "$uidtype" in
12410 xxx)
12411         xxx=`./findhdr sys/user.h`
12412         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12413         case $1 in
12414         unsigned) dflt="$1 $2" ;;
12415         *) dflt="$1" ;;
12416         esac
12417         ;;
12418 *) dflt="$uidtype";;
12419 esac
12420 case "$uidtype" in
12421 uid_t)  echo "uid_t found." ;;
12422 *)      rp="What is the type for user ids returned by getuid()?"
12423         . ./myread
12424         uidtype="$ans"
12425         ;;
12426 esac
12427
12428 : see if dbm.h is available
12429 : see if dbmclose exists
12430 set dbmclose d_dbmclose
12431 eval $inlibc
12432
12433 case "$d_dbmclose" in
12434 $define)
12435         set dbm.h i_dbm
12436         eval $inhdr
12437         case "$i_dbm" in
12438         $define)
12439                 val="$undef"
12440                 set i_rpcsvcdbm
12441                 eval $setvar
12442                 ;;
12443         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12444                 eval $inhdr
12445                 ;;
12446         esac
12447         ;;
12448 *)      echo "We won't be including <dbm.h>"
12449         val="$undef"
12450         set i_dbm
12451         eval $setvar
12452         val="$undef"
12453         set i_rpcsvcdbm
12454         eval $setvar
12455         ;;
12456 esac
12457
12458 : see if this is a sys/file.h system
12459 val=''
12460 set sys/file.h val
12461 eval $inhdr
12462
12463 : do we need to include sys/file.h ?
12464 case "$val" in
12465 "$define")
12466         echo " "
12467         if $h_sysfile; then
12468                 val="$define"
12469                 echo "We'll be including <sys/file.h>." >&4
12470         else
12471                 val="$undef"
12472                 echo "We won't be including <sys/file.h>." >&4
12473         fi
12474         ;;
12475 *)
12476         h_sysfile=false
12477         ;;
12478 esac
12479 set i_sysfile
12480 eval $setvar
12481
12482 : see if fcntl.h is there
12483 val=''
12484 set fcntl.h val
12485 eval $inhdr
12486
12487 : see if we can include fcntl.h
12488 case "$val" in
12489 "$define")
12490         echo " "
12491         if $h_fcntl; then
12492                 val="$define"
12493                 echo "We'll be including <fcntl.h>." >&4
12494         else
12495                 val="$undef"
12496                 if $h_sysfile; then
12497         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12498                 else
12499                         echo "We won't be including <fcntl.h>." >&4
12500                 fi
12501         fi
12502         ;;
12503 *)
12504         h_fcntl=false
12505         val="$undef"
12506         ;;
12507 esac
12508 set i_fcntl
12509 eval $setvar
12510
12511 : see if locale.h is available
12512 set locale.h i_locale
12513 eval $inhdr
12514
12515 : see if mach cthreads are available
12516 if test "X$usethreads" = "X$define"; then
12517         set mach/cthreads.h i_machcthr
12518         eval $inhdr
12519 else
12520         i_machcthr="$undef"
12521 fi
12522
12523
12524
12525 : see if this is a math.h system
12526 set math.h i_math
12527 eval $inhdr
12528
12529 : see if this is a mntent.h system
12530 set mntent.h i_mntent
12531 eval $inhdr
12532
12533 : see if ndbm.h is available
12534 set ndbm.h t_ndbm
12535 eval $inhdr
12536 case "$t_ndbm" in
12537 $define)
12538         : see if dbm_open exists
12539         set dbm_open d_dbm_open
12540         eval $inlibc
12541         case "$d_dbm_open" in
12542         $undef)
12543                 t_ndbm="$undef"
12544                 echo "We won't be including <ndbm.h>"
12545                 ;;
12546         esac
12547         ;;
12548 esac
12549 val="$t_ndbm"
12550 set i_ndbm
12551 eval $setvar
12552
12553 : see if net/errno.h is available
12554 val=''
12555 set net/errno.h val
12556 eval $inhdr
12557
12558 : Unfortunately, it causes problems on some systems.  Arrgh.
12559 case "$val" in
12560 $define)
12561         cat > try.c <<'EOM'
12562 #include <stdio.h>
12563 #include <errno.h>
12564 #include <net/errno.h>
12565 int func()
12566 {
12567         return ENOTSOCK;
12568 }
12569 EOM
12570         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12571                 echo "We'll be including <net/errno.h>." >&4
12572         else
12573                 echo "We won't be including <net/errno.h>." >&4
12574                 val="$undef"
12575         fi
12576         $rm -f try.* try
12577         ;;
12578 esac
12579 set i_neterrno
12580 eval $setvar
12581
12582 : see if netinet/tcp.h is available
12583 set netinet/tcp.h i_netinettcp
12584 eval $inhdr
12585
12586 : see if this is a poll.h system
12587 set poll.h i_poll
12588 eval $inhdr
12589
12590 : get C preprocessor symbols handy
12591 echo " "
12592 $echo $n "Hmm... $c"
12593 echo $al | $tr ' ' $trnl >Cppsym.know
12594 $cat <<EOSS >Cppsym
12595 $startsh
12596 case "\$1" in
12597 -l) list=true
12598         shift
12599         ;;
12600 esac
12601 unknown=''
12602 case "\$list\$#" in
12603 1|2)
12604         for sym do
12605                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12606                         exit 0
12607                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12608                         :
12609                 else
12610                         unknown="\$unknown \$sym"
12611                 fi
12612         done
12613         set X \$unknown
12614         shift
12615         ;;
12616 esac
12617 case \$# in
12618 0) exit 1;;
12619 esac
12620 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12621 #ifdef \1\\
12622 exit 0; _ _ _ _\1\\      \1\\
12623 #endif\\
12624 /' >Cppsym\$\$
12625 echo "exit 1; _ _ _" >>Cppsym\$\$
12626 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12627 case "\$list" in
12628 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12629 *)
12630         sh Cppsym2\$\$
12631         status=\$?
12632         ;;
12633 esac
12634 $rm -f Cppsym\$\$ Cppsym2\$\$
12635 exit \$status
12636 EOSS
12637 chmod +x Cppsym
12638 $eunicefix Cppsym
12639 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12640
12641 : now check the C compiler for additional symbols
12642 postprocess_cc_v=''
12643 case "$osname" in
12644 aix) postprocess_cc_v="|$tr , ' '" ;;
12645 esac
12646 $cat >ccsym <<EOS
12647 $startsh
12648 $cat >tmp.c <<EOF
12649 extern int foo;
12650 EOF
12651 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12652 do
12653         case "\$i" in
12654         -D*) echo "\$i" | $sed 's/^-D//';;
12655         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12656         esac
12657 done
12658 $rm -f try.c
12659 EOS
12660 postprocess_cc_v=''
12661 chmod +x ccsym
12662 $eunicefix ccsym
12663 ./ccsym > ccsym1.raw
12664 if $test -s ccsym1.raw; then
12665        $sort ccsym1.raw | $uniq >ccsym.raw
12666 else
12667        mv ccsym1.raw ccsym.raw
12668 fi
12669
12670 $awk '/\=/ { print $0; next }
12671         { print $0"=1" }' ccsym.raw >ccsym.list
12672 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12673 $comm -13 ccsym.true ccsym.list >ccsym.own
12674 $comm -12 ccsym.true ccsym.list >ccsym.com
12675 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12676 also=''
12677 if $test -z ccsym.raw; then
12678         echo "Your C compiler doesn't seem to define any symbols!" >&4
12679         echo " "
12680         echo "However, your C preprocessor defines the following symbols:"
12681         $cat Cppsym.true
12682         ccsymbols=''
12683         cppsymbols=`$cat Cppsym.true`
12684         cppsymbols=`echo $cppsymbols`
12685         cppccsymbols="$cppsymbols"
12686 else
12687         if $test -s ccsym.com; then
12688                 echo "Your C compiler and pre-processor define these symbols:"
12689                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12690                 also='also '
12691                 symbols='ones'
12692                 cppccsymbols=`$cat ccsym.com`
12693                 cppccsymbols=`echo $cppccsymbols`
12694                 $test "$silent" || sleep 1
12695         fi
12696         if $test -s ccsym.cpp; then
12697                 $test "$also" && echo " "
12698                 echo "Your C pre-processor ${also}defines the following symbols:"
12699                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12700                 also='further '
12701                 cppsymbols=`$cat ccsym.cpp`
12702                 cppsymbols=`echo $cppsymbols`
12703                 $test "$silent" || sleep 1
12704         fi
12705         if $test -s ccsym.own; then
12706                 $test "$also" && echo " "
12707                 echo "Your C compiler ${also}defines the following cpp symbols:"
12708                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12709                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12710                 ccsymbols=`$cat ccsym.own`
12711                 ccsymbols=`echo $ccsymbols`
12712                 $test "$silent" || sleep 1
12713         fi
12714 fi
12715 $rm -f ccsym*
12716
12717 : see if this is a termio system
12718 val="$undef"
12719 val2="$undef"
12720 val3="$undef"
12721 if $test `./findhdr termios.h`; then
12722         set tcsetattr i_termios
12723         eval $inlibc
12724         val3="$i_termios"
12725 fi
12726 echo " "
12727 case "$val3" in
12728 "$define") echo "You have POSIX termios.h... good!" >&4;;
12729 *) if ./Cppsym pyr; then
12730                 case "`/bin/universe`" in
12731                 ucb) if $test `./findhdr sgtty.h`; then
12732                                 val2="$define"
12733                                 echo "<sgtty.h> found." >&4
12734                         else
12735                                 echo "System is pyramid with BSD universe."
12736                                 echo "<sgtty.h> not found--you could have problems." >&4
12737                         fi;;
12738                 *) if $test `./findhdr termio.h`; then
12739                                 val="$define"
12740                                 echo "<termio.h> found." >&4
12741                         else
12742                                 echo "System is pyramid with USG universe."
12743                                 echo "<termio.h> not found--you could have problems." >&4
12744                         fi;;
12745                 esac
12746         elif ./usg; then
12747                 if $test `./findhdr termio.h`; then
12748                         echo "<termio.h> found." >&4
12749                         val="$define"
12750                 elif $test `./findhdr sgtty.h`; then
12751                         echo "<sgtty.h> found." >&4
12752                         val2="$define"
12753                 else
12754 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12755                 fi
12756         else
12757                 if $test `./findhdr sgtty.h`; then
12758                         echo "<sgtty.h> found." >&4
12759                         val2="$define"
12760                 elif $test `./findhdr termio.h`; then
12761                         echo "<termio.h> found." >&4
12762                         val="$define"
12763                 else
12764 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12765                 fi
12766         fi;;
12767 esac
12768 set i_termio; eval $setvar
12769 val=$val2; set i_sgtty; eval $setvar
12770 val=$val3; set i_termios; eval $setvar
12771
12772 : see if this is a shadow.h system
12773 set shadow.h i_shadow
12774 eval $inhdr
12775
12776 : see if this is a socks.h system
12777 set socks.h i_socks
12778 eval $inhdr
12779
12780 : see if stdarg is available
12781 echo " "
12782 if $test `./findhdr stdarg.h`; then
12783         echo "<stdarg.h> found." >&4
12784         valstd="$define"
12785 else
12786         echo "<stdarg.h> NOT found." >&4
12787         valstd="$undef"
12788 fi
12789
12790 : see if varags is available
12791 echo " "
12792 if $test `./findhdr varargs.h`; then
12793         echo "<varargs.h> found." >&4
12794 else
12795         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12796 fi
12797
12798 : set up the varargs testing programs
12799 $cat > varargs.c <<EOP
12800 #ifdef I_STDARG
12801 #include <stdarg.h>
12802 #endif
12803 #ifdef I_VARARGS
12804 #include <varargs.h>
12805 #endif
12806
12807 #ifdef I_STDARG
12808 int f(char *p, ...)
12809 #else
12810 int f(va_alist)
12811 va_dcl
12812 #endif
12813 {
12814         va_list ap;
12815 #ifndef I_STDARG
12816         char *p;
12817 #endif
12818 #ifdef I_STDARG
12819         va_start(ap,p);
12820 #else
12821         va_start(ap);
12822         p = va_arg(ap, char *);
12823 #endif
12824         va_end(ap);
12825 }
12826 EOP
12827 $cat > varargs <<EOP
12828 $startsh
12829 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12830         echo "true"
12831 else
12832         echo "false"
12833 fi
12834 $rm -f varargs$_o
12835 EOP
12836 chmod +x varargs
12837
12838 : now check which varargs header should be included
12839 echo " "
12840 i_varhdr=''
12841 case "$valstd" in
12842 "$define")
12843         if `./varargs I_STDARG`; then
12844                 val='stdarg.h'
12845         elif `./varargs I_VARARGS`; then
12846                 val='varargs.h'
12847         fi
12848         ;;
12849 *)
12850         if `./varargs I_VARARGS`; then
12851                 val='varargs.h'
12852         fi
12853         ;;
12854 esac
12855 case "$val" in
12856 '')
12857 echo "I could not find the definition for va_dcl... You have problems..." >&4
12858         val="$undef"; set i_stdarg; eval $setvar
12859         val="$undef"; set i_varargs; eval $setvar
12860         ;;
12861 *) 
12862         set i_varhdr
12863         eval $setvar
12864         case "$i_varhdr" in
12865         stdarg.h)
12866                 val="$define"; set i_stdarg; eval $setvar
12867                 val="$undef"; set i_varargs; eval $setvar
12868                 ;;
12869         varargs.h)
12870                 val="$undef"; set i_stdarg; eval $setvar
12871                 val="$define"; set i_varargs; eval $setvar
12872                 ;;
12873         esac
12874         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12875 esac
12876 $rm -f varargs*
12877
12878 : see if stddef is available
12879 set stddef.h i_stddef
12880 eval $inhdr
12881
12882 : see if sys/access.h is available
12883 set sys/access.h i_sysaccess
12884 eval $inhdr
12885
12886 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12887 set sys/filio.h i_sysfilio
12888 eval $inhdr
12889 echo " "
12890 if $test `./findhdr sys/ioctl.h`; then
12891         val="$define"
12892         echo '<sys/ioctl.h> found.' >&4
12893 else
12894         val="$undef"
12895         if $test $i_sysfilio = "$define"; then
12896             echo '<sys/ioctl.h> NOT found.' >&4
12897         else
12898                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12899                 $test $i_termio = "$define" && xxx="termio.h"
12900                 $test $i_termios = "$define" && xxx="termios.h"
12901 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12902         fi
12903 fi
12904 set i_sysioctl
12905 eval $setvar
12906
12907 : see if sys/resource.h has to be included
12908 set sys/resource.h i_sysresrc
12909 eval $inhdr
12910
12911 : see if sys/security.h is available
12912 set sys/security.h i_syssecrt
12913 eval $inhdr
12914
12915 : see if this is a sys/statvfs.h system
12916 set sys/statvfs.h i_sysstatvfs
12917 eval $inhdr
12918
12919 : see if this is a sys/un.h system
12920 set sys/un.h i_sysun
12921 eval $inhdr
12922
12923 : see if this is a syswait system
12924 set sys/wait.h i_syswait
12925 eval $inhdr
12926
12927 : see if this is an utime system
12928 set utime.h i_utime
12929 eval $inhdr
12930
12931 : see if this is a values.h system
12932 set values.h i_values
12933 eval $inhdr
12934
12935 : see if this is a vfork system
12936 case "$d_vfork" in
12937 "$define")
12938         set vfork.h i_vfork
12939         eval $inhdr
12940         ;;
12941 *)
12942         i_vfork="$undef"
12943         ;;
12944 esac
12945
12946 : see if gdbm.h is available
12947 set gdbm.h t_gdbm
12948 eval $inhdr
12949 case "$t_gdbm" in
12950 $define)
12951         : see if gdbm_open exists
12952         set gdbm_open d_gdbm_open
12953         eval $inlibc
12954         case "$d_gdbm_open" in
12955         $undef)
12956                 t_gdbm="$undef"
12957                 echo "We won't be including <gdbm.h>"
12958                 ;;
12959         esac
12960         ;;
12961 esac
12962 val="$t_gdbm"
12963 set i_gdbm
12964 eval $setvar
12965
12966 echo " "
12967 echo "Looking for extensions..." >&4
12968 : If we are using the old config.sh, known_extensions may contain
12969 : old or inaccurate or duplicate values.
12970 known_extensions=''
12971 nonxs_extensions=''
12972 : We do not use find because it might not be available.
12973 : We do not just use MANIFEST because the user may have dropped
12974 : some additional extensions into the source tree and expect them
12975 : to be built.
12976
12977 : Function to recursively find available extensions, ignoring DynaLoader
12978 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
12979 find_extensions='
12980     for xxx in *; do
12981        case "$xxx" in
12982            DynaLoader|dynaload) ;;
12983            *)
12984            if $test -f $xxx/$xxx.xs; then
12985                known_extensions="$known_extensions $1$xxx";
12986            elif $test -f $xxx/Makefile.PL; then
12987                nonxs_extensions="$nonxs_extensions $1$xxx";
12988            else
12989                if $test -d $xxx -a $# -lt 10; then
12990                    set $1$xxx/ $*;
12991                    cd $xxx;
12992                    eval $find_extensions;
12993                    cd ..;
12994                    shift;
12995                fi;
12996            fi
12997            ;;
12998        esac;
12999     done'
13000 tdir=`pwd`
13001 cd $rsrc/ext
13002 set X
13003 shift
13004 eval $find_extensions
13005 set X $nonxs_extensions
13006 shift
13007 nonxs_extensions="$*"
13008 set X $known_extensions
13009 shift
13010 known_extensions="$*"
13011 cd $tdir
13012
13013 : Now see which are supported on this system.
13014 avail_ext=''
13015 for xxx in $known_extensions ; do
13016         case "$xxx" in
13017         DB_File|db_file)
13018                 case "$i_db" in
13019                 $define) avail_ext="$avail_ext $xxx" ;;
13020                 esac
13021                 ;;
13022         GDBM_File|gdbm_fil)
13023                 case "$i_gdbm" in 
13024                 $define) avail_ext="$avail_ext $xxx" ;;
13025                 esac
13026                 ;;
13027         NDBM_File|ndbm_fil)
13028                 case "$i_ndbm" in
13029                 $define) avail_ext="$avail_ext $xxx" ;;
13030                 esac
13031                 ;;
13032         ODBM_File|odbm_fil) 
13033                 case "${i_dbm}${i_rpcsvcdbm}" in
13034                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13035                 esac
13036                 ;;
13037         POSIX|posix)
13038                 case "$useposix" in
13039                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13040                 esac
13041                 ;;
13042         Opcode|opcode)
13043                 case "$useopcode" in
13044                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13045                 esac
13046                 ;;
13047         Socket|socket)
13048                 case "$d_socket" in 
13049                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13050                 esac
13051                 ;;
13052         Thread|thread)
13053                 case "$usethreads" in 
13054                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13055                 esac
13056                 ;;
13057         IPC/SysV|ipc/sysv)
13058                 : XXX Do we need a useipcsysv variable here
13059                 case "${d_msg}${d_sem}${d_shm}" in 
13060                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13061                 esac
13062                 ;;
13063         *)      avail_ext="$avail_ext $xxx"
13064                 ;;
13065         esac
13066 done
13067
13068 set X $avail_ext
13069 shift
13070 avail_ext="$*"
13071
13072 : Now see which nonxs extensions are supported on this system.
13073 : For now assume all are.
13074 nonxs_ext=''
13075 for xxx in $nonxs_extensions ; do
13076         case "$xxx" in
13077         *)      nonxs_ext="$nonxs_ext $xxx"
13078                 ;;
13079         esac
13080 done
13081
13082 set X $nonxs_ext
13083 shift
13084 nonxs_ext="$*"
13085
13086 case $usedl in
13087 $define)
13088         $cat <<EOM
13089 A number of extensions are supplied with $package.  You may choose to
13090 compile these extensions for dynamic loading (the default), compile
13091 them into the $package executable (static loading), or not include
13092 them at all.  Answer "none" to include no extensions.
13093 Note that DynaLoader is always built and need not be mentioned here.
13094
13095 EOM
13096         case "$dynamic_ext" in
13097         '') dflt="$avail_ext" ;;
13098         *)      dflt="$dynamic_ext"
13099                 # Perhaps we are reusing an old out-of-date config.sh.
13100                 case "$hint" in
13101                 previous)
13102                         if test X"$dynamic_ext" != X"$avail_ext"; then
13103                                 $cat <<EOM
13104 NOTICE:  Your previous config.sh list may be incorrect. 
13105 The extensions now available to you are 
13106         ${avail_ext}
13107 but the default list from your previous config.sh is
13108         ${dynamic_ext} 
13109
13110 EOM
13111                         fi
13112                         ;;
13113                 esac
13114                 ;;
13115         esac
13116         case "$dflt" in
13117         '')     dflt=none;;
13118         esac
13119         rp="What extensions do you wish to load dynamically?"
13120         . ./myread
13121         case "$ans" in
13122         none) dynamic_ext=' ' ;;
13123         *) dynamic_ext="$ans" ;;
13124         esac
13125
13126         case "$static_ext" in
13127         '')
13128                 : Exclude those already listed in dynamic linking
13129                 dflt=''
13130                 for xxx in $avail_ext; do
13131                         case " $dynamic_ext " in
13132                         *" $xxx "*) ;;
13133                         *) dflt="$dflt $xxx" ;;
13134                         esac
13135                 done
13136                 set X $dflt
13137                 shift
13138                 dflt="$*"
13139                 ;;
13140         *)  dflt="$static_ext" 
13141                 ;;
13142         esac
13143
13144         case "$dflt" in
13145         '')     dflt=none;;
13146         esac
13147         rp="What extensions do you wish to load statically?"
13148         . ./myread
13149         case "$ans" in
13150         none) static_ext=' ' ;;
13151         *) static_ext="$ans" ;;
13152         esac
13153         ;;
13154 *)
13155         $cat <<EOM
13156 A number of extensions are supplied with $package.  Answer "none" 
13157 to include no extensions. 
13158 Note that DynaLoader is always built and need not be mentioned here.
13159
13160 EOM
13161         case "$static_ext" in
13162         '') dflt="$avail_ext" ;;
13163         *)      dflt="$static_ext"
13164                 # Perhaps we are reusing an old out-of-date config.sh.
13165                 case "$hint" in
13166                 previous)
13167                         if test X"$static_ext" != X"$avail_ext"; then
13168                                 $cat <<EOM
13169 NOTICE:  Your previous config.sh list may be incorrect. 
13170 The extensions now available to you are 
13171         ${avail_ext}
13172 but the default list from your previous config.sh is
13173         ${static_ext} 
13174
13175 EOM
13176                         fi
13177                         ;;
13178                 esac
13179                 ;;
13180         esac
13181         : Exclude those that are not xs extensions
13182         case "$dflt" in
13183         '')     dflt=none;;
13184         esac
13185         rp="What extensions do you wish to include?"
13186         . ./myread
13187         case "$ans" in
13188         none) static_ext=' ' ;;
13189         *) static_ext="$ans" ;;
13190         esac
13191         ;;
13192 esac
13193
13194 set X $dynamic_ext $static_ext $nonxs_ext
13195 shift
13196 extensions="$*"
13197
13198 : Remove build directory name from cppstdin so it can be used from
13199 : either the present location or the final installed location.
13200 echo " "
13201 : Get out of the UU directory to get correct path name.
13202 cd ..
13203 case "$cppstdin" in
13204 `pwd`/cppstdin)
13205         echo "Stripping down cppstdin path name"
13206         cppstdin=cppstdin
13207         ;;
13208 esac
13209 cd UU
13210
13211 : end of configuration questions
13212 echo " "
13213 echo "End of configuration questions."
13214 echo " "
13215
13216 : back to where it started
13217 if test -d ../UU; then
13218         cd ..
13219 fi
13220
13221 : configuration may be patched via a 'config.over' file
13222 if $test -f config.over; then
13223         echo " "
13224         dflt=y
13225         rp='I see a config.over file.  Do you wish to load it?'
13226         . UU/myread
13227         case "$ans" in
13228         n*) echo "OK, I'll ignore it.";;
13229         *)      . ./config.over
13230                 echo "Configuration override changes have been loaded."
13231                 ;;
13232         esac
13233 fi
13234
13235 : in case they want portability, strip down executable paths
13236 case "$d_portable" in
13237 "$define")
13238         echo " "
13239         echo "Stripping down executable paths..." >&4
13240         for file in $loclist $trylist; do
13241                 eval temp=\$$file
13242                 eval $file=`basename $temp`
13243         done
13244         ;;
13245 esac
13246
13247 : create config.sh file
13248 echo " "
13249 echo "Creating config.sh..." >&4
13250 $spitshell <<EOT >config.sh
13251 $startsh
13252 #
13253 # This file was produced by running the Configure script. It holds all the
13254 # definitions figured out by Configure. Should you modify one of these values,
13255 # do not forget to propagate your changes by running "Configure -der". You may
13256 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13257 #
13258
13259 # Package name      : $package
13260 # Source directory  : $src
13261 # Configuration time: $cf_time
13262 # Configured by     : $cf_by
13263 # Target system     : $myuname
13264
13265 Author='$Author'
13266 Date='$Date'
13267 Header='$Header'
13268 Id='$Id'
13269 Locker='$Locker'
13270 Log='$Log'
13271 Mcc='$Mcc'
13272 RCSfile='$RCSfile'
13273 Revision='$Revision'
13274 Source='$Source'
13275 State='$State'
13276 _a='$_a'
13277 _exe='$_exe'
13278 _o='$_o'
13279 afs='$afs'
13280 alignbytes='$alignbytes'
13281 ansi2knr='$ansi2knr'
13282 aphostname='$aphostname'
13283 apiversion='$apiversion'
13284 ar='$ar'
13285 archlib='$archlib'
13286 archlibexp='$archlibexp'
13287 archname64='$archname64'
13288 archname='$archname'
13289 archobjs='$archobjs'
13290 awk='$awk'
13291 baserev='$baserev'
13292 bash='$bash'
13293 bin='$bin'
13294 bincompat5005='$bincompat5005'
13295 binexp='$binexp'
13296 bison='$bison'
13297 byacc='$byacc'
13298 byteorder='$byteorder'
13299 c='$c'
13300 castflags='$castflags'
13301 cat='$cat'
13302 cc='$cc'
13303 cccdlflags='$cccdlflags'
13304 ccdlflags='$ccdlflags'
13305 ccflags='$ccflags'
13306 ccsymbols='$ccsymbols'
13307 cf_by='$cf_by'
13308 cf_email='$cf_email'
13309 cf_time='$cf_time'
13310 chgrp='$chgrp'
13311 chmod='$chmod'
13312 chown='$chown'
13313 clocktype='$clocktype'
13314 comm='$comm'
13315 compress='$compress'
13316 contains='$contains'
13317 cp='$cp'
13318 cpio='$cpio'
13319 cpp='$cpp'
13320 cpp_stuff='$cpp_stuff'
13321 cppccsymbols='$cppccsymbols'
13322 cppflags='$cppflags'
13323 cpplast='$cpplast'
13324 cppminus='$cppminus'
13325 cpprun='$cpprun'
13326 cppstdin='$cppstdin'
13327 cppsymbols='$cppsymbols'
13328 crosscompile='$crosscompile'
13329 cryptlib='$cryptlib'
13330 csh='$csh'
13331 d_Gconvert='$d_Gconvert'
13332 d_PRIEldbl='$d_PRIEldbl'
13333 d_PRIFldbl='$d_PRIFldbl'
13334 d_PRIGldbl='$d_PRIGldbl'
13335 d_PRIX64='$d_PRIX64'
13336 d_PRId64='$d_PRId64'
13337 d_PRIeldbl='$d_PRIeldbl'
13338 d_PRIfldbl='$d_PRIfldbl'
13339 d_PRIgldbl='$d_PRIgldbl'
13340 d_PRIi64='$d_PRIi64'
13341 d_PRIo64='$d_PRIo64'
13342 d_PRIu64='$d_PRIu64'
13343 d_PRIx64='$d_PRIx64'
13344 d_access='$d_access'
13345 d_accessx='$d_accessx'
13346 d_alarm='$d_alarm'
13347 d_archlib='$d_archlib'
13348 d_atolf='$d_atolf'
13349 d_atoll='$d_atoll'
13350 d_attribut='$d_attribut'
13351 d_bcmp='$d_bcmp'
13352 d_bcopy='$d_bcopy'
13353 d_bincompat5005='$d_bincompat5005'
13354 d_bsd='$d_bsd'
13355 d_bsdgetpgrp='$d_bsdgetpgrp'
13356 d_bsdsetpgrp='$d_bsdsetpgrp'
13357 d_bzero='$d_bzero'
13358 d_casti32='$d_casti32'
13359 d_castneg='$d_castneg'
13360 d_charvspr='$d_charvspr'
13361 d_chown='$d_chown'
13362 d_chroot='$d_chroot'
13363 d_chsize='$d_chsize'
13364 d_closedir='$d_closedir'
13365 d_cmsghdr_s='$d_cmsghdr_s'
13366 d_const='$d_const'
13367 d_crypt='$d_crypt'
13368 d_csh='$d_csh'
13369 d_cuserid='$d_cuserid'
13370 d_dbl_dig='$d_dbl_dig'
13371 d_difftime='$d_difftime'
13372 d_dirnamlen='$d_dirnamlen'
13373 d_dlerror='$d_dlerror'
13374 d_dlopen='$d_dlopen'
13375 d_dlsymun='$d_dlsymun'
13376 d_dosuid='$d_dosuid'
13377 d_drand48proto='$d_drand48proto'
13378 d_dup2='$d_dup2'
13379 d_eaccess='$d_eaccess'
13380 d_endgrent='$d_endgrent'
13381 d_endhent='$d_endhent'
13382 d_endnent='$d_endnent'
13383 d_endpent='$d_endpent'
13384 d_endpwent='$d_endpwent'
13385 d_endsent='$d_endsent'
13386 d_endspent='$d_endspent'
13387 d_eofnblk='$d_eofnblk'
13388 d_eunice='$d_eunice'
13389 d_fchmod='$d_fchmod'
13390 d_fchown='$d_fchown'
13391 d_fcntl='$d_fcntl'
13392 d_fd_macros='$d_fd_macros'
13393 d_fd_set='$d_fd_set'
13394 d_fds_bits='$d_fds_bits'
13395 d_fgetpos64='$d_fgetpos64'
13396 d_fgetpos='$d_fgetpos'
13397 d_flexfnam='$d_flexfnam'
13398 d_flock='$d_flock'
13399 d_fopen64='$d_fopen64'
13400 d_fork='$d_fork'
13401 d_fpathconf='$d_fpathconf'
13402 d_fpos64_t='$d_fpos64_t'
13403 d_freopen64='$d_freopen64'
13404 d_fseek64='$d_fseek64'
13405 d_fseeko64='$d_fseeko64'
13406 d_fseeko='$d_fseeko'
13407 d_fsetpos64='$d_fsetpos64'
13408 d_fsetpos='$d_fsetpos'
13409 d_fstatfs='$d_fstatfs'
13410 d_fstatvfs='$d_fstatvfs'
13411 d_ftell64='$d_ftell64'
13412 d_ftello64='$d_ftello64'
13413 d_ftello='$d_ftello'
13414 d_ftime='$d_ftime'
13415 d_getgrent='$d_getgrent'
13416 d_getgrps='$d_getgrps'
13417 d_gethbyaddr='$d_gethbyaddr'
13418 d_gethbyname='$d_gethbyname'
13419 d_gethent='$d_gethent'
13420 d_gethname='$d_gethname'
13421 d_gethostprotos='$d_gethostprotos'
13422 d_getlogin='$d_getlogin'
13423 d_getmntent='$d_getmntent'
13424 d_getnbyaddr='$d_getnbyaddr'
13425 d_getnbyname='$d_getnbyname'
13426 d_getnent='$d_getnent'
13427 d_getnetprotos='$d_getnetprotos'
13428 d_getpbyname='$d_getpbyname'
13429 d_getpbynumber='$d_getpbynumber'
13430 d_getpent='$d_getpent'
13431 d_getpgid='$d_getpgid'
13432 d_getpgrp2='$d_getpgrp2'
13433 d_getpgrp='$d_getpgrp'
13434 d_getppid='$d_getppid'
13435 d_getprior='$d_getprior'
13436 d_getprotoprotos='$d_getprotoprotos'
13437 d_getpwent='$d_getpwent'
13438 d_getsbyname='$d_getsbyname'
13439 d_getsbyport='$d_getsbyport'
13440 d_getsent='$d_getsent'
13441 d_getservprotos='$d_getservprotos'
13442 d_getspent='$d_getspent'
13443 d_getspnam='$d_getspnam'
13444 d_gettimeod='$d_gettimeod'
13445 d_gnulibc='$d_gnulibc'
13446 d_grpasswd='$d_grpasswd'
13447 d_hasmntopt='$d_hasmntopt'
13448 d_htonl='$d_htonl'
13449 d_index='$d_index'
13450 d_inetaton='$d_inetaton'
13451 d_int64t='$d_int64t'
13452 d_iovec_s='$d_iovec_s'
13453 d_isascii='$d_isascii'
13454 d_killpg='$d_killpg'
13455 d_lchown='$d_lchown'
13456 d_link='$d_link'
13457 d_llseek='$d_llseek'
13458 d_locconv='$d_locconv'
13459 d_lockf='$d_lockf'
13460 d_longdbl='$d_longdbl'
13461 d_longlong='$d_longlong'
13462 d_lstat='$d_lstat'
13463 d_madvise='$d_madvise'
13464 d_mblen='$d_mblen'
13465 d_mbstowcs='$d_mbstowcs'
13466 d_mbtowc='$d_mbtowc'
13467 d_memchr='$d_memchr'
13468 d_memcmp='$d_memcmp'
13469 d_memcpy='$d_memcpy'
13470 d_memmove='$d_memmove'
13471 d_memset='$d_memset'
13472 d_mkdir='$d_mkdir'
13473 d_mkfifo='$d_mkfifo'
13474 d_mktime='$d_mktime'
13475 d_mmap='$d_mmap'
13476 d_mprotect='$d_mprotect'
13477 d_msg='$d_msg'
13478 d_msg_ctrunc='$d_msg_ctrunc'
13479 d_msg_dontroute='$d_msg_dontroute'
13480 d_msg_oob='$d_msg_oob'
13481 d_msg_peek='$d_msg_peek'
13482 d_msg_proxy='$d_msg_proxy'
13483 d_msgctl='$d_msgctl'
13484 d_msgget='$d_msgget'
13485 d_msghdr_s='$d_msghdr_s'
13486 d_msgrcv='$d_msgrcv'
13487 d_msgsnd='$d_msgsnd'
13488 d_msync='$d_msync'
13489 d_munmap='$d_munmap'
13490 d_mymalloc='$d_mymalloc'
13491 d_nice='$d_nice'
13492 d_off64_t='$d_off64_t'
13493 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13494 d_oldpthreads='$d_oldpthreads'
13495 d_oldsock='$d_oldsock'
13496 d_open3='$d_open3'
13497 d_pathconf='$d_pathconf'
13498 d_pause='$d_pause'
13499 d_phostname='$d_phostname'
13500 d_pipe='$d_pipe'
13501 d_poll='$d_poll'
13502 d_portable='$d_portable'
13503 d_pthread_yield='$d_pthread_yield'
13504 d_pwage='$d_pwage'
13505 d_pwchange='$d_pwchange'
13506 d_pwclass='$d_pwclass'
13507 d_pwcomment='$d_pwcomment'
13508 d_pwexpire='$d_pwexpire'
13509 d_pwgecos='$d_pwgecos'
13510 d_pwpasswd='$d_pwpasswd'
13511 d_pwquota='$d_pwquota'
13512 d_readdir='$d_readdir'
13513 d_readlink='$d_readlink'
13514 d_readv='$d_readv'
13515 d_recvmsg='$d_recvmsg'
13516 d_rename='$d_rename'
13517 d_rewinddir='$d_rewinddir'
13518 d_rmdir='$d_rmdir'
13519 d_safebcpy='$d_safebcpy'
13520 d_safemcpy='$d_safemcpy'
13521 d_sanemcmp='$d_sanemcmp'
13522 d_sched_yield='$d_sched_yield'
13523 d_scm_rights='$d_scm_rights'
13524 d_seekdir='$d_seekdir'
13525 d_select='$d_select'
13526 d_sem='$d_sem'
13527 d_semctl='$d_semctl'
13528 d_semctl_semid_ds='$d_semctl_semid_ds'
13529 d_semctl_semun='$d_semctl_semun'
13530 d_semget='$d_semget'
13531 d_semop='$d_semop'
13532 d_sendmsg='$d_sendmsg'
13533 d_setegid='$d_setegid'
13534 d_seteuid='$d_seteuid'
13535 d_setgrent='$d_setgrent'
13536 d_setgrps='$d_setgrps'
13537 d_sethent='$d_sethent'
13538 d_setlinebuf='$d_setlinebuf'
13539 d_setlocale='$d_setlocale'
13540 d_setnent='$d_setnent'
13541 d_setpent='$d_setpent'
13542 d_setpgid='$d_setpgid'
13543 d_setpgrp2='$d_setpgrp2'
13544 d_setpgrp='$d_setpgrp'
13545 d_setprior='$d_setprior'
13546 d_setpwent='$d_setpwent'
13547 d_setregid='$d_setregid'
13548 d_setresgid='$d_setresgid'
13549 d_setresuid='$d_setresuid'
13550 d_setreuid='$d_setreuid'
13551 d_setrgid='$d_setrgid'
13552 d_setruid='$d_setruid'
13553 d_setsent='$d_setsent'
13554 d_setsid='$d_setsid'
13555 d_setspent='$d_setspent'
13556 d_setvbuf='$d_setvbuf'
13557 d_sfio='$d_sfio'
13558 d_shm='$d_shm'
13559 d_shmat='$d_shmat'
13560 d_shmatprototype='$d_shmatprototype'
13561 d_shmctl='$d_shmctl'
13562 d_shmdt='$d_shmdt'
13563 d_shmget='$d_shmget'
13564 d_sigaction='$d_sigaction'
13565 d_sigsetjmp='$d_sigsetjmp'
13566 d_socket='$d_socket'
13567 d_sockpair='$d_sockpair'
13568 d_statblks='$d_statblks'
13569 d_statfs='$d_statfs'
13570 d_statfsflags='$d_statfsflags'
13571 d_statvfs='$d_statvfs'
13572 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13573 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13574 d_stdio_stream_array='$d_stdio_stream_array'
13575 d_stdiobase='$d_stdiobase'
13576 d_stdstdio='$d_stdstdio'
13577 d_strchr='$d_strchr'
13578 d_strcoll='$d_strcoll'
13579 d_strctcpy='$d_strctcpy'
13580 d_strerrm='$d_strerrm'
13581 d_strerror='$d_strerror'
13582 d_strtod='$d_strtod'
13583 d_strtol='$d_strtol'
13584 d_strtoul='$d_strtoul'
13585 d_strtoull='$d_strtoull'
13586 d_strxfrm='$d_strxfrm'
13587 d_suidsafe='$d_suidsafe'
13588 d_symlink='$d_symlink'
13589 d_syscall='$d_syscall'
13590 d_sysconf='$d_sysconf'
13591 d_sysernlst='$d_sysernlst'
13592 d_syserrlst='$d_syserrlst'
13593 d_system='$d_system'
13594 d_tcgetpgrp='$d_tcgetpgrp'
13595 d_tcsetpgrp='$d_tcsetpgrp'
13596 d_telldir='$d_telldir'
13597 d_telldirproto='$d_telldirproto'
13598 d_time='$d_time'
13599 d_times='$d_times'
13600 d_tmpfile64='$d_tmpfile64'
13601 d_truncate='$d_truncate'
13602 d_tzname='$d_tzname'
13603 d_umask='$d_umask'
13604 d_uname='$d_uname'
13605 d_union_semun='$d_union_semun'
13606 d_vendorlib='$d_vendorlib'
13607 d_vfork='$d_vfork'
13608 d_void_closedir='$d_void_closedir'
13609 d_voidsig='$d_voidsig'
13610 d_voidtty='$d_voidtty'
13611 d_volatile='$d_volatile'
13612 d_vprintf='$d_vprintf'
13613 d_wait4='$d_wait4'
13614 d_waitpid='$d_waitpid'
13615 d_wcstombs='$d_wcstombs'
13616 d_wctomb='$d_wctomb'
13617 d_writev='$d_writev'
13618 d_xenix='$d_xenix'
13619 date='$date'
13620 db_hashtype='$db_hashtype'
13621 db_prefixtype='$db_prefixtype'
13622 defvoidused='$defvoidused'
13623 direntrytype='$direntrytype'
13624 dlext='$dlext'
13625 dlsrc='$dlsrc'
13626 doublesize='$doublesize'
13627 drand01='$drand01'
13628 dynamic_ext='$dynamic_ext'
13629 eagain='$eagain'
13630 ebcdic='$ebcdic'
13631 echo='$echo'
13632 egrep='$egrep'
13633 emacs='$emacs'
13634 eunicefix='$eunicefix'
13635 exe_ext='$exe_ext'
13636 expr='$expr'
13637 extensions='$extensions'
13638 fflushNULL='$fflushNULL'
13639 fflushall='$fflushall'
13640 find='$find'
13641 firstmakefile='$firstmakefile'
13642 flex='$flex'
13643 fpostype='$fpostype'
13644 freetype='$freetype'
13645 full_ar='$full_ar'
13646 full_csh='$full_csh'
13647 full_sed='$full_sed'
13648 gccversion='$gccversion'
13649 gidtype='$gidtype'
13650 glibpth='$glibpth'
13651 grep='$grep'
13652 groupcat='$groupcat'
13653 groupstype='$groupstype'
13654 gzip='$gzip'
13655 h_fcntl='$h_fcntl'
13656 h_sysfile='$h_sysfile'
13657 hint='$hint'
13658 hostcat='$hostcat'
13659 huge='$huge'
13660 i_arpainet='$i_arpainet'
13661 i_bsdioctl='$i_bsdioctl'
13662 i_db='$i_db'
13663 i_dbm='$i_dbm'
13664 i_dirent='$i_dirent'
13665 i_dld='$i_dld'
13666 i_dlfcn='$i_dlfcn'
13667 i_fcntl='$i_fcntl'
13668 i_float='$i_float'
13669 i_gdbm='$i_gdbm'
13670 i_grp='$i_grp'
13671 i_inttypes='$i_inttypes'
13672 i_limits='$i_limits'
13673 i_locale='$i_locale'
13674 i_machcthr='$i_machcthr'
13675 i_malloc='$i_malloc'
13676 i_math='$i_math'
13677 i_memory='$i_memory'
13678 i_mntent='$i_mntent'
13679 i_ndbm='$i_ndbm'
13680 i_netdb='$i_netdb'
13681 i_neterrno='$i_neterrno'
13682 i_netinettcp='$i_netinettcp'
13683 i_niin='$i_niin'
13684 i_poll='$i_poll'
13685 i_pthread='$i_pthread'
13686 i_pwd='$i_pwd'
13687 i_rpcsvcdbm='$i_rpcsvcdbm'
13688 i_sfio='$i_sfio'
13689 i_sgtty='$i_sgtty'
13690 i_shadow='$i_shadow'
13691 i_socks='$i_socks'
13692 i_stdarg='$i_stdarg'
13693 i_stddef='$i_stddef'
13694 i_stdlib='$i_stdlib'
13695 i_string='$i_string'
13696 i_sysaccess='$i_sysaccess'
13697 i_sysdir='$i_sysdir'
13698 i_sysfile='$i_sysfile'
13699 i_sysfilio='$i_sysfilio'
13700 i_sysin='$i_sysin'
13701 i_sysioctl='$i_sysioctl'
13702 i_sysmman='$i_sysmman'
13703 i_sysmount='$i_sysmount'
13704 i_sysndir='$i_sysndir'
13705 i_sysparam='$i_sysparam'
13706 i_sysresrc='$i_sysresrc'
13707 i_syssecrt='$i_syssecrt'
13708 i_sysselct='$i_sysselct'
13709 i_syssockio='$i_syssockio'
13710 i_sysstat='$i_sysstat'
13711 i_sysstatvfs='$i_sysstatvfs'
13712 i_systime='$i_systime'
13713 i_systimek='$i_systimek'
13714 i_systimes='$i_systimes'
13715 i_systypes='$i_systypes'
13716 i_sysuio='$i_sysuio'
13717 i_sysun='$i_sysun'
13718 i_syswait='$i_syswait'
13719 i_termio='$i_termio'
13720 i_termios='$i_termios'
13721 i_time='$i_time'
13722 i_unistd='$i_unistd'
13723 i_utime='$i_utime'
13724 i_values='$i_values'
13725 i_varargs='$i_varargs'
13726 i_varhdr='$i_varhdr'
13727 i_vfork='$i_vfork'
13728 ignore_versioned_solibs='$ignore_versioned_solibs'
13729 incpath='$incpath'
13730 inews='$inews'
13731 installarchlib='$installarchlib'
13732 installbin='$installbin'
13733 installman1dir='$installman1dir'
13734 installman3dir='$installman3dir'
13735 installprefix='$installprefix'
13736 installprefixexp='$installprefixexp'
13737 installprivlib='$installprivlib'
13738 installscript='$installscript'
13739 installsitearch='$installsitearch'
13740 installsitelib='$installsitelib'
13741 installstyle='$installstyle'
13742 installusrbinperl='$installusrbinperl'
13743 installvendorlib='$installvendorlib'
13744 intsize='$intsize'
13745 known_extensions='$known_extensions'
13746 ksh='$ksh'
13747 large='$large'
13748 ld='$ld'
13749 lddlflags='$lddlflags'
13750 ldflags='$ldflags'
13751 ldlibpthname='$ldlibpthname'
13752 less='$less'
13753 lib_ext='$lib_ext'
13754 libc='$libc'
13755 libperl='$libperl'
13756 libpth='$libpth'
13757 libs='$libs'
13758 libswanted='$libswanted'
13759 line='$line'
13760 lint='$lint'
13761 lkflags='$lkflags'
13762 ln='$ln'
13763 lns='$lns'
13764 locincpth='$locincpth'
13765 loclibpth='$loclibpth'
13766 longdblsize='$longdblsize'
13767 longlongsize='$longlongsize'
13768 longsize='$longsize'
13769 lp='$lp'
13770 lpr='$lpr'
13771 ls='$ls'
13772 lseeksize='$lseeksize'
13773 lseektype='$lseektype'
13774 mail='$mail'
13775 mailx='$mailx'
13776 make='$make'
13777 make_set_make='$make_set_make'
13778 mallocobj='$mallocobj'
13779 mallocsrc='$mallocsrc'
13780 malloctype='$malloctype'
13781 man1dir='$man1dir'
13782 man1direxp='$man1direxp'
13783 man1ext='$man1ext'
13784 man3dir='$man3dir'
13785 man3direxp='$man3direxp'
13786 man3ext='$man3ext'
13787 medium='$medium'
13788 mips='$mips'
13789 mips_type='$mips_type'
13790 mkdir='$mkdir'
13791 mmaptype='$mmaptype'
13792 models='$models'
13793 modetype='$modetype'
13794 more='$more'
13795 multiarch='$multiarch'
13796 mv='$mv'
13797 myarchname='$myarchname'
13798 mydomain='$mydomain'
13799 myhostname='$myhostname'
13800 myuname='$myuname'
13801 n='$n'
13802 netdb_hlen_type='$netdb_hlen_type'
13803 netdb_host_type='$netdb_host_type'
13804 netdb_name_type='$netdb_name_type'
13805 netdb_net_type='$netdb_net_type'
13806 nm='$nm'
13807 nm_opt='$nm_opt'
13808 nm_so_opt='$nm_so_opt'
13809 nonxs_ext='$nonxs_ext'
13810 nroff='$nroff'
13811 o_nonblock='$o_nonblock'
13812 obj_ext='$obj_ext'
13813 old_pthread_create_joinable='$old_pthread_create_joinable'
13814 optimize='$optimize'
13815 orderlib='$orderlib'
13816 osname='$osname'
13817 osvers='$osvers'
13818 package='$package'
13819 pager='$pager'
13820 passcat='$passcat'
13821 patchlevel='$patchlevel'
13822 path_sep='$path_sep'
13823 perl='$perl'
13824 perladmin='$perladmin'
13825 perlpath='$perlpath'
13826 pg='$pg'
13827 phostname='$phostname'
13828 pidtype='$pidtype'
13829 plibpth='$plibpth'
13830 pmake='$pmake'
13831 pr='$pr'
13832 prefix='$prefix'
13833 prefixexp='$prefixexp'
13834 privlib='$privlib'
13835 privlibexp='$privlibexp'
13836 prototype='$prototype'
13837 ptrsize='$ptrsize'
13838 randbits='$randbits'
13839 randfunc='$randfunc'
13840 randseedtype='$randseedtype'
13841 ranlib='$ranlib'
13842 rd_nodata='$rd_nodata'
13843 rm='$rm'
13844 rmail='$rmail'
13845 runnm='$runnm'
13846 sPRIEldbl='$sPRIEldbl'
13847 sPRIFldbl='$sPRIFldbl'
13848 sPRIGldbl='$sPRIGldbl'
13849 sPRIX64='$sPRIX64'
13850 sPRId64='$sPRId64'
13851 sPRIeldbl='$sPRIeldbl'
13852 sPRIfldbl='$sPRIfldbl'
13853 sPRIgldbl='$sPRIgldbl'
13854 sPRIi64='$sPRIi64'
13855 sPRIo64='$sPRIo64'
13856 sPRIu64='$sPRIu64'
13857 sPRIx64='$sPRIx64'
13858 sched_yield='$sched_yield'
13859 scriptdir='$scriptdir'
13860 scriptdirexp='$scriptdirexp'
13861 sed='$sed'
13862 seedfunc='$seedfunc'
13863 selectminbits='$selectminbits'
13864 selecttype='$selecttype'
13865 sendmail='$sendmail'
13866 sh='$sh'
13867 shar='$shar'
13868 sharpbang='$sharpbang'
13869 shmattype='$shmattype'
13870 shortsize='$shortsize'
13871 shrpenv='$shrpenv'
13872 shsharp='$shsharp'
13873 sig_count='$sig_count'
13874 sig_name='$sig_name'
13875 sig_name_init='$sig_name_init'
13876 sig_num='$sig_num'
13877 sig_num_init='$sig_num_init'
13878 signal_t='$signal_t'
13879 sitearch='$sitearch'
13880 sitearchexp='$sitearchexp'
13881 sitelib='$sitelib'
13882 sitelibexp='$sitelibexp'
13883 siteprefix='$siteprefix'
13884 siteprefixexp='$siteprefixexp'
13885 sizetype='$sizetype'
13886 sleep='$sleep'
13887 smail='$smail'
13888 small='$small'
13889 so='$so'
13890 sockethdr='$sockethdr'
13891 socketlib='$socketlib'
13892 sort='$sort'
13893 spackage='$spackage'
13894 spitshell='$spitshell'
13895 split='$split'
13896 src='$src'
13897 ssizetype='$ssizetype'
13898 startperl='$startperl'
13899 startsh='$startsh'
13900 static_ext='$static_ext'
13901 stdchar='$stdchar'
13902 stdio_base='$stdio_base'
13903 stdio_bufsiz='$stdio_bufsiz'
13904 stdio_cnt='$stdio_cnt'
13905 stdio_filbuf='$stdio_filbuf'
13906 stdio_ptr='$stdio_ptr'
13907 stdio_stream_array='$stdio_stream_array'
13908 strings='$strings'
13909 submit='$submit'
13910 subversion='$subversion'
13911 sysman='$sysman'
13912 tail='$tail'
13913 tar='$tar'
13914 tbl='$tbl'
13915 tee='$tee'
13916 test='$test'
13917 timeincl='$timeincl'
13918 timetype='$timetype'
13919 touch='$touch'
13920 tr='$tr'
13921 trnl='$trnl'
13922 troff='$troff'
13923 uidtype='$uidtype'
13924 uname='$uname'
13925 uniq='$uniq'
13926 use64bits='$use64bits'
13927 usedl='$usedl'
13928 uselongdouble='$uselongdouble'
13929 usemultiplicity='$usemultiplicity'
13930 usemymalloc='$usemymalloc'
13931 usenm='$usenm'
13932 useopcode='$useopcode'
13933 useperlio='$useperlio'
13934 useposix='$useposix'
13935 usesfio='$usesfio'
13936 useshrplib='$useshrplib'
13937 usesocks='$usesocks'
13938 usethreads='$usethreads'
13939 usevendorprefix='$usevendorprefix'
13940 usevfork='$usevfork'
13941 usrinc='$usrinc'
13942 uuname='$uuname'
13943 vendorlib='$vendorlib'
13944 vendorlibexp='$vendorlibexp'
13945 vendorprefix='$vendorprefix'
13946 vendorprefixexp='$vendorprefixexp'
13947 version='$version'
13948 vi='$vi'
13949 voidflags='$voidflags'
13950 xlibpth='$xlibpth'
13951 zcat='$zcat'
13952 zip='$zip'
13953 EOT
13954
13955 : Add in command line options if available
13956 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
13957
13958 : add special variables
13959 $test -f $src/patchlevel.h && \
13960 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
13961 echo "CONFIGDOTSH=true" >>config.sh
13962
13963 : propagate old symbols
13964 if $test -f UU/config.sh; then
13965         <UU/config.sh sort | uniq >UU/oldconfig.sh
13966         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
13967         sort | uniq -u >UU/oldsyms
13968         set X `cat UU/oldsyms`
13969         shift
13970         case $# in
13971         0) ;;
13972         *)
13973                 cat <<EOM
13974 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
13975 EOM
13976                 echo "# Variables propagated from previous config.sh file." >>config.sh
13977                 for sym in `cat UU/oldsyms`; do
13978                         echo "    Propagating $hint variable "'$'"$sym..."
13979                         eval 'tmp="$'"${sym}"'"'
13980                         echo "$tmp" | \
13981                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
13982                 done
13983                 ;;
13984         esac
13985 fi
13986
13987 : Finish up by extracting the .SH files
13988 case "$alldone" in
13989 exit)
13990         $rm -rf UU
13991         echo "Done."
13992         exit 0
13993         ;;
13994 cont)
13995         ;;
13996 '')
13997         dflt=''
13998         nostick=true
13999         $cat <<EOM
14000
14001 If you'd like to make any changes to the config.sh file before I begin
14002 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14003
14004 EOM
14005         rp="Press return or use a shell escape to edit config.sh:"
14006         . UU/myread
14007         nostick=''
14008         case "$ans" in
14009         '') ;;
14010         *) : in case they cannot read
14011                 sh 1>&4 -c "$ans";;
14012         esac
14013         ;;
14014 esac
14015
14016 : if this fails, just run all the .SH files by hand
14017 . ./config.sh
14018
14019 echo " "
14020 exec 1>&4
14021 . ./UU/extract
14022
14023 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14024         dflt=y
14025         case "$silent" in
14026         true) ;;
14027         *)
14028                 $cat <<EOM
14029
14030 Now you need to generate make dependencies by running "$make depend".
14031 You might prefer to run it in background: "$make depend > makedepend.out &"
14032 It can take a while, so you might not want to run it right now.
14033
14034 EOM
14035                 ;;
14036         esac
14037         rp="Run $make depend now?"
14038         . UU/myread
14039         case "$ans" in
14040         y*)
14041                 $make depend && echo "Now you must run a $make."
14042                 ;;
14043         *)
14044                 echo "You must run '$make depend' then '$make'."
14045                 ;;
14046         esac
14047 elif test -f [Mm]akefile; then
14048         echo " "
14049         echo "Now you must run a $make."
14050 else
14051         echo "Done."
14052 fi
14053
14054 if $test -f Policy.sh; then
14055     $cat <<EOM
14056
14057 If you compile $package on a different machine or from a different object
14058 directory, copy the Policy.sh file from this object directory to the
14059 new one before you run Configure -- this will help you with most of
14060 the policy defaults.
14061
14062 EOM
14063 fi
14064 if $test -f config.msg; then
14065     echo "Hmm.  I also noted the following information while running:"
14066     echo " "
14067     $cat config.msg >&4
14068     $rm -f config.msg
14069 fi
14070 $rm -f kit*isdone ark*isdone
14071 $rm -rf UU
14072
14073 : End of Configure
14074