4fe41b2b33c1246256ce97e757a6cca18d27faf8
[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 Wed Dec 22 14:18:58 EST 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 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_inetaton=''
403 d_int64t=''
404 d_isascii=''
405 d_killpg=''
406 d_lchown=''
407 d_ldbl_dig=''
408 d_link=''
409 d_locconv=''
410 d_lockf=''
411 d_longdbl=''
412 longdblsize=''
413 d_longlong=''
414 longlongsize=''
415 d_lstat=''
416 d_mblen=''
417 d_mbstowcs=''
418 d_mbtowc=''
419 d_memchr=''
420 d_memcmp=''
421 d_memcpy=''
422 d_memmove=''
423 d_memset=''
424 d_mkdir=''
425 d_mkfifo=''
426 d_mktime=''
427 d_msg=''
428 d_msgctl=''
429 d_msgget=''
430 d_msgrcv=''
431 d_msgsnd=''
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_rename=''
451 d_rmdir=''
452 d_safebcpy=''
453 d_safemcpy=''
454 d_sanemcmp=''
455 d_select=''
456 d_sem=''
457 d_semctl=''
458 d_semget=''
459 d_semop=''
460 d_setegid=''
461 d_seteuid=''
462 d_setgrent=''
463 d_setgrps=''
464 d_sethent=''
465 d_setlinebuf=''
466 d_setlocale=''
467 d_setnent=''
468 d_setpent=''
469 d_setpgid=''
470 d_setpgrp2=''
471 d_bsdsetpgrp=''
472 d_setpgrp=''
473 d_setprior=''
474 d_setpwent=''
475 d_setregid=''
476 d_setresgid=''
477 d_setresuid=''
478 d_setreuid=''
479 d_setrgid=''
480 d_setruid=''
481 d_setsent=''
482 d_setsid=''
483 d_setspent=''
484 d_setvbuf=''
485 d_sfio=''
486 usesfio=''
487 d_shm=''
488 d_shmat=''
489 d_shmatprototype=''
490 shmattype=''
491 d_shmctl=''
492 d_shmdt=''
493 d_shmget=''
494 d_sigaction=''
495 d_sigsetjmp=''
496 d_msg_ctrunc=''
497 d_msg_dontroute=''
498 d_msg_oob=''
499 d_msg_peek=''
500 d_msg_proxy=''
501 d_oldsock=''
502 d_scm_rights=''
503 d_socket=''
504 d_sockpair=''
505 sockethdr=''
506 socketlib=''
507 d_sqrtl=''
508 d_statblks=''
509 d_statfs_f_flags=''
510 d_statfs_s=''
511 d_fstatvfs=''
512 d_statvfs=''
513 d_stdio_cnt_lval=''
514 d_stdio_ptr_lval=''
515 d_stdiobase=''
516 d_stdstdio=''
517 stdio_base=''
518 stdio_bufsiz=''
519 stdio_cnt=''
520 stdio_filbuf=''
521 stdio_ptr=''
522 d_index=''
523 d_strchr=''
524 d_strcoll=''
525 d_strctcpy=''
526 d_strerrm=''
527 d_strerror=''
528 d_sysernlst=''
529 d_syserrlst=''
530 d_strtod=''
531 d_strtol=''
532 d_strtoul=''
533 d_strxfrm=''
534 d_symlink=''
535 d_syscall=''
536 d_sysconf=''
537 d_system=''
538 d_tcgetpgrp=''
539 d_tcsetpgrp=''
540 d_telldirproto=''
541 d_time=''
542 timetype=''
543 clocktype=''
544 d_times=''
545 d_truncate=''
546 d_tzname=''
547 d_umask=''
548 d_semctl_semid_ds=''
549 d_semctl_semun=''
550 d_union_semun=''
551 d_ustat=''
552 d_vfork=''
553 usevfork=''
554 d_voidsig=''
555 signal_t=''
556 d_volatile=''
557 d_charvspr=''
558 d_vprintf=''
559 d_wait4=''
560 d_waitpid=''
561 d_wcstombs=''
562 d_wctomb=''
563 dlext=''
564 cccdlflags=''
565 ccdlflags=''
566 dlsrc=''
567 ld=''
568 lddlflags=''
569 usedl=''
570 doublesize=''
571 ebcdic=''
572 fflushNULL=''
573 fflushall=''
574 fpossize=''
575 fpostype=''
576 gidformat=''
577 gidsign=''
578 gidsize=''
579 gidtype=''
580 groupstype=''
581 h_fcntl=''
582 h_sysfile=''
583 i_arpainet=''
584 db_hashtype=''
585 db_prefixtype=''
586 i_db=''
587 i_dbm=''
588 i_rpcsvcdbm=''
589 d_dirnamlen=''
590 direntrytype=''
591 i_dirent=''
592 i_dld=''
593 i_dlfcn=''
594 i_fcntl=''
595 i_float=''
596 i_gdbm=''
597 d_grpasswd=''
598 i_grp=''
599 i_inttypes=''
600 i_limits=''
601 i_locale=''
602 i_machcthr=''
603 i_malloc=''
604 i_math=''
605 i_memory=''
606 i_mntent=''
607 i_ndbm=''
608 i_netdb=''
609 i_neterrno=''
610 i_netinettcp=''
611 i_niin=''
612 i_sysin=''
613 i_poll=''
614 i_pthread=''
615 d_pwage=''
616 d_pwchange=''
617 d_pwclass=''
618 d_pwcomment=''
619 d_pwexpire=''
620 d_pwgecos=''
621 d_pwpasswd=''
622 d_pwquota=''
623 i_pwd=''
624 i_sfio=''
625 i_shadow=''
626 i_socks=''
627 i_stddef=''
628 i_stdlib=''
629 i_string=''
630 strings=''
631 i_sysaccess=''
632 i_sysdir=''
633 i_sysfile=''
634 d_voidtty=''
635 i_bsdioctl=''
636 i_sysfilio=''
637 i_sysioctl=''
638 i_syssockio=''
639 i_sysmount=''
640 i_sysndir=''
641 i_sysparam=''
642 i_sysresrc=''
643 i_syssecrt=''
644 i_sysselct=''
645 i_sysstat=''
646 i_sysstatfs=''
647 i_sysstatvfs=''
648 i_systimes=''
649 i_systypes=''
650 i_sysuio=''
651 i_sysun=''
652 i_sysvfs=''
653 i_syswait=''
654 i_sgtty=''
655 i_termio=''
656 i_termios=''
657 i_systime=''
658 i_systimek=''
659 i_time=''
660 timeincl=''
661 i_unistd=''
662 i_ustat=''
663 i_utime=''
664 i_values=''
665 i_stdarg=''
666 i_varargs=''
667 i_varhdr=''
668 i_vfork=''
669 installprefix=''
670 installprefixexp=''
671 installstyle=''
672 installusrbinperl=''
673 intsize=''
674 longsize=''
675 shortsize=''
676 d_fpos64_t=''
677 d_off64_t=''
678 libc=''
679 ldlibpthname=''
680 libperl=''
681 shrpenv=''
682 useshrplib=''
683 glibpth=''
684 libpth=''
685 loclibpth=''
686 plibpth=''
687 xlibpth=''
688 ignore_versioned_solibs=''
689 libs=''
690 lns=''
691 d_PRIEldbl=''
692 d_PRIFldbl=''
693 d_PRIGldbl=''
694 d_PRIeldbl=''
695 d_PRIfldbl=''
696 d_PRIgldbl=''
697 sPRIEldbl=''
698 sPRIFldbl=''
699 sPRIGldbl=''
700 sPRIeldbl=''
701 sPRIfldbl=''
702 sPRIgldbl=''
703 lseeksize=''
704 lseektype=''
705 make_set_make=''
706 d_mymalloc=''
707 freetype=''
708 mallocobj=''
709 mallocsrc=''
710 malloctype=''
711 usemymalloc=''
712 installman1dir=''
713 man1dir=''
714 man1direxp=''
715 man1ext=''
716 installman3dir=''
717 man3dir=''
718 man3direxp=''
719 man3ext=''
720 huge=''
721 large=''
722 medium=''
723 models=''
724 small=''
725 split=''
726 modetype=''
727 multiarch=''
728 mydomain=''
729 myhostname=''
730 phostname=''
731 c=''
732 n=''
733 d_eofnblk=''
734 eagain=''
735 o_nonblock=''
736 rd_nodata=''
737 netdb_hlen_type=''
738 netdb_host_type=''
739 netdb_name_type=''
740 netdb_net_type=''
741 groupcat=''
742 hostcat=''
743 passcat=''
744 orderlib=''
745 ranlib=''
746 package=''
747 spackage=''
748 pager=''
749 apiversion=''
750 patchlevel=''
751 subversion=''
752 version=''
753 perladmin=''
754 perlpath=''
755 i16size=''
756 i16type=''
757 i32size=''
758 i32type=''
759 i64size=''
760 i64type=''
761 i8size=''
762 i8type=''
763 ivsize=''
764 ivtype=''
765 nvsize=''
766 nvtype=''
767 u16size=''
768 u16type=''
769 u32size=''
770 u32type=''
771 u64size=''
772 u64type=''
773 u8size=''
774 u8type=''
775 uvsize=''
776 uvtype=''
777 ivdformat=''
778 uvoformat=''
779 uvuformat=''
780 uvxformat=''
781 pidtype=''
782 prefix=''
783 prefixexp=''
784 installprivlib=''
785 privlib=''
786 privlibexp=''
787 prototype=''
788 ptrsize=''
789 d_PRIX64=''
790 d_PRId64=''
791 d_PRIi64=''
792 d_PRIo64=''
793 d_PRIu64=''
794 d_PRIx64=''
795 sPRIX64=''
796 sPRId64=''
797 sPRIi64=''
798 sPRIo64=''
799 sPRIu64=''
800 sPRIx64=''
801 d_quad=''
802 quadkind=''
803 quadtype=''
804 uquadtype=''
805 drand01=''
806 randbits=''
807 randfunc=''
808 randseedtype=''
809 seedfunc=''
810 installscript=''
811 scriptdir=''
812 scriptdirexp=''
813 selectminbits=''
814 selecttype=''
815 sh=''
816 sig_count=''
817 sig_name=''
818 sig_name_init=''
819 sig_num=''
820 sig_num_init=''
821 installsitearch=''
822 sitearch=''
823 sitearchexp=''
824 installsitebin=''
825 sitebin=''
826 sitebinexp=''
827 installsitelib=''
828 sitelib=''
829 sitelibexp=''
830 siteprefix=''
831 siteprefixexp=''
832 sizetype=''
833 so=''
834 sharpbang=''
835 shsharp=''
836 spitshell=''
837 src=''
838 ssizetype=''
839 startperl=''
840 startsh=''
841 stdchar=''
842 d_stdio_stream_array=''
843 stdio_stream_array=''
844 d_strtoull=''
845 sysman=''
846 trnl=''
847 uidformat=''
848 uidsign=''
849 uidsize=''
850 uidtype=''
851 archname64=''
852 use64bits=''
853 uselargefiles=''
854 uselongdouble=''
855 uselonglong=''
856 usemorebits=''
857 usemultiplicity=''
858 nm_opt=''
859 nm_so_opt=''
860 runnm=''
861 usenm=''
862 useperlio=''
863 usesocks=''
864 d_oldpthreads=''
865 usethreads=''
866 incpath=''
867 mips_type=''
868 usrinc=''
869 d_vendorbin=''
870 installvendorbin=''
871 vendorbin=''
872 vendorbinexp=''
873 d_vendorlib=''
874 installvendorlib=''
875 vendorlib=''
876 vendorlibexp=''
877 usevendorprefix=''
878 vendorprefix=''
879 vendorprefixexp=''
880 defvoidused=''
881 voidflags=''
882 pm_apiversion=''
883 xs_apiversion=''
884 CONFIG=''
885
886 define='define'
887 undef='undef'
888 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
889 rmlist=''
890
891 : We must find out about Eunice early
892 eunicefix=':'
893 if test -f /etc/unixtovms; then
894         eunicefix=/etc/unixtovms
895 fi
896 if test -f /etc/unixtovms.exe; then
897         eunicefix=/etc/unixtovms.exe
898 fi
899
900 i_whoami=''
901 : Possible local include directories to search.
902 : Set locincpth to "" in a hint file to defeat local include searches.
903 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
904 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
905 :
906 : no include file wanted by default
907 inclwanted=''
908
909 : list of known cpp symbols, sorted alphabetically
910 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
911 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
912 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
913 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
914 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
915 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
916 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
917 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
918 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
919 al="$al VMS Xenix286"
920 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
921 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
922 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
923 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
924 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
925 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
926 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
927 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
928 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
929 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
930 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
931 al="$al __SVR4_2__ __UMAXV__"
932 al="$al ____386BSD____ __alpha __alpha__ __amiga"
933 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
934 al="$al __host_mips__"
935 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
936 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
937 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
938 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
939 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
940 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
941 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
942 al="$al __mc88100 __mc88100__ __mips __mips__"
943 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
944 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
945 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
946 al="$al _host_mips _mips _unix"
947 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
948 al="$al apollo ardent att386 att3b"
949 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
950 al="$al cadmus clipper concurrent convex cray ctix"
951 al="$al dmert encore gcos gcx gimpel gould"
952 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
953 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
954 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
955 al="$al i186 i286 i386 i486 i8086"
956 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
957 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
958 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
959 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
960 al="$al mc88000 mc88100 merlin mert mips mvs n16"
961 al="$al ncl_el ncl_mr"
962 al="$al news1500 news1700 news1800 news1900 news3700"
963 al="$al news700 news800 news900 ns16000 ns32000"
964 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
965 al="$al parisc pc532 pdp11 plexus posix pyr"
966 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
967 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
968 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
969 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
970 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
971 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
972 al="$al xenix z8000"
973
974 : Trailing extension.  Override this in a hint file, if needed.
975 _exe=''
976 : Extra object files, if any, needed on this platform.
977 archobjs=''
978 groupstype=''
979 : change the next line if compiling for Xenix/286 on Xenix/386
980 xlibpth='/usr/lib/386 /lib/386'
981
982 : Possible local library directories to search.
983 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
984 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
985
986 : general looking path for locating libraries
987 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
988 glibpth="$glibpth /lib /usr/lib $xlibpth"
989 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
990 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
991
992 : Private path used by Configure to find libraries.  Its value
993 : is prepended to libpth. This variable takes care of special
994 : machines, like the mips.  Usually, it should be empty.
995 plibpth=''
996
997 : default library list
998 libswanted=''
999 : some systems want to use only the non-versioned libso:s
1000 ignore_versioned_solibs=''
1001 : full support for void wanted by default
1002 defvoidused=15
1003
1004 : set useposix=false in your hint file to disable the POSIX extension.
1005 useposix=true
1006 : set useopcode=false in your hint file to disable the Opcode extension.
1007 useopcode=true
1008 : set usemultiplicity on the Configure command line to enable multiplicity.
1009 : set usesocks on the Configure command line to enable socks.
1010 : set usethreads on the Configure command line to enable threads.
1011 : List of libraries we want.
1012 : If anyone needs -lnet, put it in a hint file.
1013 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1014 libswanted="$libswanted dld ld sun m c cposix posix"
1015 libswanted="$libswanted ndir dir crypt sec"
1016 libswanted="$libswanted ucb bsd BSD PW x"
1017 : We probably want to search /usr/shlib before most other libraries.
1018 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1019 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1020 glibpth="/usr/shlib $glibpth"
1021 : Do not use vfork unless overridden by a hint file.
1022 usevfork=false
1023
1024 : Find the basic shell for Bourne shell scripts
1025 case "$sh" in
1026 '')
1027         case "$SYSTYPE" in
1028         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1029         *) xxx='/bin/sh';;
1030         esac
1031         if test -f "$xxx"; then
1032                 sh="$xxx"
1033         else
1034                 : Build up a list and do a single loop so we can 'break' out.
1035                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1036                 for xxx in sh bash ksh pdksh ash; do
1037                         for p in $pth; do
1038                                 try="$try ${p}/${xxx}"
1039                         done
1040                 done
1041                 for xxx in $try; do
1042                         if test -f "$xxx"; then
1043                                 sh="$xxx";
1044                                 break
1045                         elif test -f "$xxx.exe"; then
1046                                 sh="$xxx";
1047                                 break
1048                         fi
1049                 done
1050         fi
1051         ;;
1052 esac
1053
1054 case "$sh" in
1055 '')     cat <<EOM >&2
1056 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1057
1058 Usually it's in /bin/sh.  How did you even get this far?
1059 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1060 we'll try to straighten this all out.
1061 EOM
1062         exit 1
1063         ;;
1064 esac
1065
1066 : see if sh knows # comments
1067 if `$sh -c '#' >/dev/null 2>&1`; then
1068         shsharp=true
1069         spitshell=cat
1070         xcat=/bin/cat
1071         test -f $xcat || xcat=/usr/bin/cat
1072         echo "#!$xcat" >try
1073         $eunicefix try
1074         chmod +x try
1075         ./try > today
1076         if test -s today; then
1077                 sharpbang='#!'
1078         else
1079                 echo "#! $xcat" > try
1080                 $eunicefix try
1081                 chmod +x try
1082                 ./try > today
1083                 if test -s today; then
1084                         sharpbang='#! '
1085                 else
1086                         sharpbang=': use '
1087                 fi
1088         fi
1089 else
1090         echo " "
1091         echo "Your $sh doesn't grok # comments--I will strip them later on."
1092         shsharp=false
1093         cd ..
1094         echo "exec grep -v '^[  ]*#'" >spitshell
1095         chmod +x spitshell
1096         $eunicefix spitshell
1097         spitshell=`pwd`/spitshell
1098         cd UU
1099         echo "I presume that if # doesn't work, #! won't work either!"
1100         sharpbang=': use '
1101 fi
1102 rm -f try today
1103
1104 : figure out how to guarantee sh startup
1105 case "$startsh" in
1106 '') startsh=${sharpbang}${sh} ;;
1107 *)
1108 esac
1109 cat >try <<EOSS
1110 $startsh
1111 set abc
1112 test "$?abc" != 1
1113 EOSS
1114
1115 chmod +x try
1116 $eunicefix try
1117 if ./try; then
1118         : echo "Yup, it does."
1119 else
1120         echo "Hmm... '$startsh' does not guarantee sh startup..."
1121         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1122 fi
1123 rm -f try
1124
1125
1126 : Save command line options in file UU/cmdline.opt for later use in
1127 : generating config.sh.
1128 cat > cmdline.opt <<EOSH
1129 # Configure command line arguments.
1130 config_arg0='$0'
1131 config_args='$*'
1132 config_argc=$#
1133 EOSH
1134 argn=1
1135 for arg in "$@"; do
1136         cat >>cmdline.opt <<EOSH
1137 config_arg$argn='$arg'
1138 EOSH
1139         argn=`expr $argn + 1`
1140 done
1141
1142 : produce awk script to parse command line options
1143 cat >options.awk <<'EOF'
1144 BEGIN {
1145         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1146
1147         len = length(optstr);
1148         for (i = 1; i <= len; i++) {
1149                 c = substr(optstr, i, 1);
1150                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1151                 if (a == ":") {
1152                         arg[c] = 1;
1153                         i++;
1154                 }
1155                 opt[c] = 1;
1156         }
1157 }
1158 {
1159         expect = 0;
1160         str = $0;
1161         if (substr(str, 1, 1) != "-") {
1162                 printf("'%s'\n", str);
1163                 next;
1164         }
1165         len = length($0);
1166         for (i = 2; i <= len; i++) {
1167                 c = substr(str, i, 1);
1168                 if (!opt[c]) {
1169                         printf("-%s\n", substr(str, i));
1170                         next;
1171                 }
1172                 printf("-%s\n", c);
1173                 if (arg[c]) {
1174                         if (i < len)
1175                                 printf("'%s'\n", substr(str, i + 1));
1176                         else
1177                                 expect = 1;
1178                         next;
1179                 }
1180         }
1181 }
1182 END {
1183         if (expect)
1184                 print "?";
1185 }
1186 EOF
1187
1188 : process the command line options
1189 set X `for arg in "$@"; do echo "X$arg"; done |
1190         sed -e s/X// | awk -f options.awk`
1191 eval "set $*"
1192 shift
1193 rm -f options.awk
1194
1195 : set up default values
1196 fastread=''
1197 reuseval=false
1198 config_sh=''
1199 alldone=''
1200 error=''
1201 silent=''
1202 extractsh=''
1203 override=''
1204 knowitall=''
1205 rm -f optdef.sh posthint.sh
1206 cat >optdef.sh <<EOS
1207 $startsh
1208 EOS
1209
1210
1211 : option parsing
1212 while test $# -gt 0; do
1213         case "$1" in
1214         -d) shift; fastread=yes;;
1215         -e) shift; alldone=cont;;
1216         -f)
1217                 shift
1218                 cd ..
1219                 if test -r "$1"; then
1220                         config_sh="$1"
1221                 else
1222                         echo "$me: cannot read config file $1." >&2
1223                         error=true
1224                 fi
1225                 cd UU
1226                 shift;;
1227         -h) shift; error=true;;
1228         -r) shift; reuseval=true;;
1229         -s) shift; silent=true; realsilent=true;;
1230         -E) shift; alldone=exit;;
1231         -K) shift; knowitall=true;;
1232         -O) shift; override=true;;
1233         -S) shift; silent=true; extractsh=true;;
1234         -D)
1235                 shift
1236                 case "$1" in
1237                 *=)
1238                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1239                         echo "$me: ignoring -D $1" >&2
1240                         ;;
1241                 *=*) echo "$1" | \
1242                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1243                 *) echo "$1='define'" >> optdef.sh;;
1244                 esac
1245                 shift
1246                 ;;
1247         -U)
1248                 shift
1249                 case "$1" in
1250                 *=) echo "$1" >> optdef.sh;;
1251                 *=*)
1252                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1253                         echo "$me: ignoring -U $1" >&2
1254                         ;;
1255                 *) echo "$1='undef'" >> optdef.sh;;
1256                 esac
1257                 shift
1258                 ;;
1259         -A)
1260             shift
1261             xxx=''
1262             yyy="$1"
1263             zzz=''
1264             uuu=undef
1265             case "$yyy" in
1266             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1267                  case "$zzz" in
1268                  *:*) zzz='' ;;
1269                  *)   xxx=append
1270                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1271                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1272                  esac
1273                  ;;
1274             esac
1275             case "$xxx" in
1276             '')  case "$yyy" in
1277                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1278                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1279                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1280                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1281                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1282                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1283                  esac
1284                  ;;       
1285             esac
1286             case "$xxx" in
1287             append)
1288                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1289             clear)
1290                 echo "$yyy=''"                  >> posthint.sh ;;
1291             define)
1292                 case "$zzz" in
1293                 '') zzz=define ;;
1294                 esac
1295                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1296             eval)
1297                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1298             prepend)
1299                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1300             undef)
1301                 case "$zzz" in
1302                 '') zzz="$uuu" ;;
1303                 esac
1304                 echo "$yyy=$zzz"                >> posthint.sh ;;
1305             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1306             esac
1307             ;;
1308         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1309             exit 0;;
1310         --) break;;
1311         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1312         *) break;;
1313         esac
1314 done
1315
1316 case "$error" in
1317 true)
1318         cat >&2 <<EOM
1319 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1320                  [-U symbol] [-U symbol=] [-A command:symbol...]
1321   -d : use defaults for all answers.
1322   -e : go on without questioning past the production of config.sh.
1323   -f : specify an alternate default configuration file.
1324   -h : print this help message and exit (with an error status).
1325   -r : reuse C symbols value if possible (skips costly nm extraction).
1326   -s : silent mode, only echoes questions and essential information.
1327   -D : define symbol to have some value:
1328          -D symbol         symbol gets the value 'define'
1329          -D symbol=value   symbol gets the value 'value'
1330   -E : stop at the end of questions, after having produced config.sh.
1331   -K : do not use unless you know what you are doing.
1332   -O : let -D and -U override definitions from loaded configuration file.
1333   -S : perform variable substitutions on all .SH files (can mix with -f)
1334   -U : undefine symbol:
1335          -U symbol    symbol gets the value 'undef'
1336          -U symbol=   symbol gets completely empty
1337   -A : manipulate symbol after the platform specific hints have been applied:
1338          -A symbol=value                append " "value to symbol
1339          -A append:symbol=value         append value to symbol
1340          -A define:symbol=value         define symbol to have value
1341          -A clear:symbol                define symbol to be ''
1342          -A define:symbol               define symbol to be 'define'
1343          -A eval:symbol=value           define symbol to be eval of value
1344          -A prepend:symbol=value        prepend value to symbol
1345          -A undef:symbol                define symbol to be 'undef'
1346          -A undef:symbol=               define symbol to be ''
1347   -V : print version number and exit (with a zero status).
1348 EOM
1349         exit 1
1350         ;;
1351 esac
1352
1353 : Sanity checks
1354 case "$fastread$alldone" in
1355 yescont|yesexit) ;;
1356 *)
1357         if test ! -t 0; then
1358                 echo "Say 'sh Configure', not 'sh <Configure'"
1359                 exit 1
1360         fi
1361         ;;
1362 esac
1363
1364 exec 4>&1
1365 case "$silent" in
1366 true) exec 1>/dev/null;;
1367 esac
1368
1369 : run the defines and the undefines, if any, but leave the file out there...
1370 touch optdef.sh
1371 . ./optdef.sh
1372 : create the posthint manipulation script and leave the file out there...
1373 touch posthint.sh
1374
1375 : set package name
1376 package=perl5
1377 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1378 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1379 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1380 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1381 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1382 esac
1383
1384 : Some greps do not return status, grrr.
1385 echo "grimblepritz" >grimble
1386 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1387         contains=contains
1388 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1389         contains=grep
1390 else
1391         contains=contains
1392 fi
1393 rm -f grimble
1394 : the following should work in any shell
1395 case "$contains" in
1396 contains*)
1397         echo " "
1398         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1399         cat >contains <<'EOSS'
1400 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1401 EOSS
1402 chmod +x contains
1403 esac
1404
1405 : Find the path to the source tree
1406 case "$src" in
1407 '') case "$0" in
1408     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1409          case "$src" in
1410          /*)    ;;
1411          *)     src=`cd ../$src && pwd` ;;
1412          esac
1413          ;;
1414     *)   src='.';;
1415     esac;;
1416 esac
1417 case "$src" in
1418 '')     src=/
1419         rsrc=/
1420         ;;
1421 /*) rsrc="$src";;
1422 *) rsrc="../$src";;
1423 esac
1424 if test -f $rsrc/Configure && \
1425         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1426 then
1427    : found it, so we are ok.
1428 else
1429         rsrc=''
1430         for src in . .. ../.. ../../.. ../../../..; do
1431                 if test -f ../$src/Configure && \
1432                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1433                 then
1434                         rsrc=../$src
1435                         break
1436                 fi
1437         done
1438 fi
1439 case "$rsrc" in
1440 '')
1441         cat <<EOM >&4
1442
1443 Sorry, I can't seem to locate the source dir for $package.  Please start
1444 Configure with an explicit path -- i.e. /some/path/Configure.
1445
1446 EOM
1447         exit 1
1448         ;;
1449 ../.)   rsrc='..';;
1450 *)
1451         echo " "
1452         echo "Sources for $package found in \"$src\"." >&4
1453         ;;
1454 esac
1455
1456 : script used to extract .SH files with variable substitutions
1457 cat >extract <<'EOS'
1458 CONFIGDOTSH=true
1459 echo "Doing variable substitutions on .SH files..."
1460 if test -f $src/MANIFEST; then
1461         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1462 else
1463         echo "(Looking for .SH files under the source directory.)"
1464         set x `(cd $src; find . -name "*.SH" -print)`
1465 fi
1466 shift
1467 case $# in
1468 0) set x `(cd $src; echo *.SH)`; shift;;
1469 esac
1470 if test ! -f $src/$1; then
1471         shift
1472 fi
1473 mkdir_p='
1474 name=$1;
1475 create="";
1476 while test $name; do
1477         if test ! -d "$name"; then
1478                 create="$name $create";
1479                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1480                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1481         else
1482                 name="";
1483         fi;
1484 done;
1485 for file in $create; do
1486         mkdir $file;
1487 done
1488 '
1489 for file in $*; do
1490         case "$src" in
1491         ".")
1492                 case "$file" in
1493                 */*)
1494                         dir=`expr X$file : 'X\(.*\)/'`
1495                         file=`expr X$file : 'X.*/\(.*\)'`
1496                         (cd $dir && . ./$file)
1497                         ;;
1498                 *)
1499                         . ./$file
1500                         ;;
1501                 esac
1502                 ;;
1503         *)
1504                 case "$file" in
1505                 */*)
1506                         dir=`expr X$file : 'X\(.*\)/'`
1507                         file=`expr X$file : 'X.*/\(.*\)'`
1508                         (set x $dir; shift; eval $mkdir_p)
1509                         sh <$src/$dir/$file
1510                         ;;
1511                 *)
1512                         sh <$src/$file
1513                         ;;
1514                 esac
1515                 ;;
1516         esac
1517 done
1518 if test -f $src/config_h.SH; then
1519         if test ! -f config.h; then
1520         : oops, they left it out of MANIFEST, probably, so do it anyway.
1521         . $src/config_h.SH
1522         fi
1523 fi
1524 EOS
1525
1526 : extract files and exit if asked to do so
1527 case "$extractsh" in
1528 true)
1529         case "$realsilent" in
1530         true) ;;
1531         *) exec 1>&4;;
1532         esac
1533         case "$config_sh" in
1534         '') config_sh='config.sh';;
1535         esac
1536         echo " "
1537         echo "Fetching answers from $config_sh..."
1538         cd ..
1539         . $config_sh
1540         test "$override" && . ./optdef.sh
1541         echo " "
1542         . UU/extract
1543         rm -rf UU
1544         echo "Done."
1545         exit 0
1546         ;;
1547 esac
1548
1549 : Eunice requires " " instead of "", can you believe it
1550 echo " "
1551 : Here we go...
1552 echo "Beginning of configuration questions for $package."
1553
1554 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1555
1556 : first determine how to suppress newline on echo command
1557 echo " "
1558 echo "Checking echo to see how to suppress newlines..."
1559 (echo "hi there\c" ; echo " ") >.echotmp
1560 if $contains c .echotmp >/dev/null 2>&1 ; then
1561         echo "...using -n."
1562         n='-n'
1563         c=''
1564 else
1565         cat <<'EOM'
1566 ...using \c
1567 EOM
1568         n=''
1569         c='\c'
1570 fi
1571 echo $n "The star should be here-->$c"
1572 echo '*'
1573 rm -f .echotmp
1574
1575 : Now test for existence of everything in MANIFEST
1576 echo " "
1577 if test -f $rsrc/MANIFEST; then
1578         echo "First let's make sure your kit is complete.  Checking..." >&4
1579         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1580         rm -f missing
1581         tmppwd=`pwd`
1582         for filelist in x??; do
1583                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1584         done
1585         if test -s missing; then
1586                 cat missing >&4
1587                 cat >&4 <<'EOM'
1588
1589 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1590
1591 You have the option of continuing the configuration process, despite the
1592 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1593 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1594 and contact the author (perlbug@perl.com).
1595
1596 EOM
1597                 echo $n "Continue? [n] $c" >&4
1598                 read ans
1599                 case "$ans" in
1600                 y*)
1601                         echo "Continuing..." >&4
1602                         rm -f missing
1603                         ;;
1604                 *)
1605                         echo "ABORTING..." >&4
1606                         kill $$
1607                         ;;
1608                 esac
1609         else
1610                 echo "Looks good..."
1611         fi
1612 else
1613         echo "There is no MANIFEST file.  I hope your kit is complete !"
1614 fi
1615 rm -f missing x??
1616
1617 echo " "
1618 : Find the appropriate value for a newline for tr
1619 if test -n "$DJGPP"; then
1620        trnl='\012'
1621 fi
1622 if test X"$trnl" = X; then
1623         case "`echo foo|tr '\n' x 2>/dev/null`" in
1624         foox) trnl='\n' ;;
1625         esac
1626 fi
1627 if test X"$trnl" = X; then
1628         case "`echo foo|tr '\012' x 2>/dev/null`" in
1629         foox) trnl='\012' ;;
1630         esac
1631 fi
1632 if test X"$trnl" = X; then
1633         cat <<EOM >&2
1634
1635 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1636
1637 EOM
1638         exit 1
1639 fi
1640
1641 : compute the number of columns on the terminal for proper question formatting
1642 case "$COLUMNS" in
1643 '') COLUMNS='80';;
1644 esac
1645
1646 : set up the echo used in my read
1647 myecho="case \"\$xxxm\" in
1648 '') echo $n \"\$rp $c\" >&4;;
1649 *) case \"\$rp\" in
1650         '') echo $n \"[\$xxxm] $c\";;
1651         *)
1652                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1653                         echo \"\$rp\" >&4
1654                         echo $n \"[\$xxxm] $c\" >&4
1655                 else
1656                         echo $n \"\$rp [\$xxxm] $c\" >&4
1657                 fi
1658                 ;;
1659         esac;;
1660 esac"
1661
1662 : now set up to do reads with possible shell escape and default assignment
1663 cat <<EOSC >myread
1664 $startsh
1665 xxxm=\$dflt
1666 $myecho
1667 ans='!'
1668 case "\$fastread" in
1669 yes) case "\$dflt" in
1670         '') ;;
1671         *) ans='';
1672                 case "\$silent-\$rp" in
1673                 true-) ;;
1674                 *) echo " " >&4;;
1675                 esac;;
1676         esac;;
1677 *) case "\$silent" in
1678         true) case "\$rp" in
1679                 '') ans='';;
1680                 esac;;
1681         esac;;
1682 esac
1683 while expr "X\$ans" : "X!" >/dev/null; do
1684         read answ
1685         set x \$xxxm
1686         shift
1687         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1688         case  "\$answ" in
1689         "!")
1690                 sh 1>&4
1691                 echo " "
1692                 $myecho
1693                 ;;
1694         !*)
1695                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1696                 shift
1697                 sh 1>&4 -c "\$*"
1698                 echo " "
1699                 $myecho
1700                 ;;
1701         "\$ans")
1702                 case "\$ans" in
1703                 \\&*)
1704                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1705                         shift
1706                         case "\$1" in
1707                         -d)
1708                                 fastread=yes
1709                                 echo "(OK, I'll run with -d after this question.)" >&4
1710                                 ;;
1711                         -*)
1712                                 echo "*** Sorry, \$1 not supported yet." >&4
1713                                 ;;
1714                         esac
1715                         $myecho
1716                         ans=!
1717                         ;;
1718                 esac;;
1719         *)
1720                 case "\$aok" in
1721                 y)
1722                         echo "*** Substitution done -- please confirm."
1723                         xxxm="\$ans"
1724                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1725                         xxxm="\$ans"
1726                         ans=!
1727                         ;;
1728                 *)
1729                         echo "*** Error -- try again."
1730                         ans=!
1731                         ;;
1732                 esac
1733                 $myecho
1734                 ;;
1735         esac
1736         case "\$ans\$xxxm\$nostick" in
1737         '')
1738                 ans=!
1739                 $myecho
1740                 ;;
1741         esac
1742 done
1743 case "\$ans" in
1744 '') ans="\$xxxm";;
1745 esac
1746 EOSC
1747
1748 : create .config dir to save info across Configure sessions
1749 test -d ../.config || mkdir ../.config
1750 cat >../.config/README <<EOF
1751 This directory created by Configure to save information that should
1752 persist across sessions for $package.
1753
1754 You may safely delete it if you wish.
1755 EOF
1756
1757 : general instructions
1758 needman=true
1759 firsttime=true
1760 user=`(logname) 2>/dev/null`
1761 case "$user" in
1762 '') user=`whoami 2>&1`;;
1763 esac
1764 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1765         firsttime=false
1766         echo " "
1767         rp='Would you like to see the instructions?'
1768         dflt=n
1769         . ./myread
1770         case "$ans" in
1771         [yY]*) ;;
1772         *) needman=false;;
1773         esac
1774 fi
1775 if $needman; then
1776         cat <<EOH
1777
1778 This installation shell script will examine your system and ask you questions
1779 to determine how the perl5 package should be installed. If you get
1780 stuck on a question, you may use a ! shell escape to start a subshell or
1781 execute a command.  Many of the questions will have default answers in square
1782 brackets; typing carriage return will give you the default.
1783
1784 On some of the questions which ask for file or directory names you are allowed
1785 to use the ~name construct to specify the login directory belonging to "name",
1786 even if you don't have a shell which knows about that.  Questions where this is
1787 allowed will be marked "(~name ok)".
1788
1789 EOH
1790         rp=''
1791         dflt='Type carriage return to continue'
1792         . ./myread
1793         cat <<'EOH'
1794
1795 The prompter used in this script allows you to use shell variables and
1796 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1797 in the default answer, as if the default line was a set of arguments given to a
1798 script shell.  This means you may also use $* to repeat the whole default line,
1799 so you do not have to re-type everything to add something to the default.
1800
1801 Everytime there is a substitution, you will have to confirm.  If there is an
1802 error (e.g. an unmatched backtick), the default answer will remain unchanged
1803 and you will be prompted again.
1804
1805 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1806 the questions and use the computed defaults (or the previous answers if there
1807 was already a config.sh file). Type 'Configure -h' for a list of options.
1808 You may also start interactively and then answer '& -d' at any prompt to turn
1809 on the non-interactive behaviour for the remainder of the execution.
1810
1811 EOH
1812         . ./myread
1813         cat <<EOH
1814
1815 Much effort has been expended to ensure that this shell script will run on any
1816 Unix system.  If despite that it blows up on yours, your best bet is to edit
1817 Configure and run it again.  If you can't run Configure for some reason,
1818 you'll have to generate a config.sh file by hand.  Whatever problems you
1819 have, let me (perlbug@perl.com) know how I blew it.
1820
1821 This installation script affects things in two ways:
1822
1823 1) it may do direct variable substitutions on some of the files included
1824    in this kit.
1825 2) it builds a config.h file for inclusion in C programs.  You may edit
1826    any of these files as the need arises after running this script.
1827
1828 If you make a mistake on a question, there is no easy way to back up to it
1829 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1830 files.  Configure will offer to let you do this before it runs the SH files.
1831
1832 EOH
1833         dflt='Type carriage return to continue'
1834         . ./myread
1835         case "$firsttime" in
1836         true) echo $user >>../.config/instruct;;
1837         esac
1838 fi
1839
1840 : find out where common programs are
1841 echo " "
1842 echo "Locating common programs..." >&4
1843 cat <<EOSC >loc
1844 $startsh
1845 case \$# in
1846 0) exit 1;;
1847 esac
1848 thing=\$1
1849 shift
1850 dflt=\$1
1851 shift
1852 for dir in \$*; do
1853         case "\$thing" in
1854         .)
1855         if test -d \$dir/\$thing; then
1856                 echo \$dir
1857                 exit 0
1858         fi
1859         ;;
1860         *)
1861         for thisthing in \$dir/\$thing; do
1862                 : just loop through to pick last item
1863         done
1864         if test -f \$thisthing; then
1865                 echo \$thisthing
1866                 exit 0
1867         elif test -f \$dir/\$thing.exe; then
1868                 if test -n "$DJGPP"; then
1869                         echo \$dir/\$thing.exe
1870                 else
1871                         : on Eunice apparently
1872                         echo \$dir/\$thing
1873                 fi
1874                 exit 0
1875         fi
1876         ;;
1877         esac
1878 done
1879 echo \$dflt
1880 exit 1
1881 EOSC
1882 chmod +x loc
1883 $eunicefix loc
1884 loclist="
1885 awk
1886 cat
1887 comm
1888 cp
1889 echo
1890 expr
1891 grep
1892 ls
1893 make
1894 mkdir
1895 rm
1896 sed
1897 sort
1898 touch
1899 tr
1900 uniq
1901 "
1902 trylist="
1903 Mcc
1904 ar
1905 byacc
1906 cpp
1907 csh
1908 date
1909 egrep
1910 gzip
1911 less
1912 ln
1913 more
1914 nm
1915 nroff
1916 pg
1917 test
1918 uname
1919 zip
1920 "
1921 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1922 pth="$pth /lib /usr/lib"
1923 for file in $loclist; do
1924         eval xxx=\$$file
1925         case "$xxx" in
1926         /*|?:[\\/]*)
1927                 if test -f "$xxx"; then
1928                         : ok
1929                 else
1930                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1931                         xxx=`./loc $file $file $pth`
1932                 fi
1933                 ;;
1934         '') xxx=`./loc $file $file $pth`;;
1935         *) xxx=`./loc $xxx $xxx $pth`;;
1936         esac
1937         eval $file=$xxx
1938         eval _$file=$xxx
1939         case "$xxx" in
1940         /*)
1941                 echo $file is in $xxx.
1942                 ;;
1943         ?:[\\/]*)
1944                 echo $file is in $xxx.
1945                 ;;
1946         *)
1947                 echo "I don't know where '$file' is, and my life depends on it." >&4
1948                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1949                 exit 1
1950                 ;;
1951         esac
1952 done
1953 echo " "
1954 echo "Don't worry if any of the following aren't found..."
1955 say=offhand
1956 for file in $trylist; do
1957         eval xxx=\$$file
1958         case "$xxx" in
1959         /*|?:[\\/]*)
1960                 if test -f "$xxx"; then
1961                         : ok
1962                 else
1963                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1964                         xxx=`./loc $file $file $pth`
1965                 fi
1966                 ;;
1967         '') xxx=`./loc $file $file $pth`;;
1968         *) xxx=`./loc $xxx $xxx $pth`;;
1969         esac
1970         eval $file=$xxx
1971         eval _$file=$xxx
1972         case "$xxx" in
1973         /*)
1974                 echo $file is in $xxx.
1975                 ;;
1976         ?:[\\/]*)
1977                 echo $file is in $xxx.
1978                 ;;
1979         *)
1980                 echo "I don't see $file out there, $say."
1981                 say=either
1982                 ;;
1983         esac
1984 done
1985 case "$egrep" in
1986 egrep)
1987         echo "Substituting grep for egrep."
1988         egrep=$grep
1989         ;;
1990 esac
1991 case "$ln" in
1992 ln)
1993         echo "Substituting cp for ln."
1994         ln=$cp
1995         ;;
1996 esac
1997 case "$test" in
1998 test)
1999         echo "Hopefully test is built into your sh."
2000         ;;
2001 *)
2002         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2003                 echo "Using the test built into your sh."
2004                 test=test
2005                 _test=test
2006         fi
2007         ;;
2008 esac
2009 case "$echo" in
2010 echo)
2011         echo "Hopefully echo is built into your sh."
2012         ;;
2013 '') ;;
2014 *)
2015         echo " "
2016 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2017         $echo $n "hi there$c" >foo1
2018         echo $n "hi there$c" >foo2
2019         if cmp foo1 foo2 >/dev/null 2>&1; then
2020                 echo "They are compatible.  In fact, they may be identical."
2021         else
2022                 case "$n" in
2023                 '-n') n='' c='\c';;
2024                 *) n='-n' c='';;
2025                 esac
2026                 cat <<FOO
2027 They are not compatible!  You are probably running ksh on a non-USG system.
2028 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2029 have echo built in and we may have to run some Bourne shell scripts.  That
2030 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2031
2032 FOO
2033                 $echo $n "The star should be here-->$c"
2034                 $echo "*"
2035         fi
2036         $rm -f foo1 foo2
2037         ;;
2038 esac
2039
2040 : determine whether symbolic links are supported
2041 echo " "
2042 $touch blurfl
2043 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2044         echo "Symbolic links are supported." >&4
2045         lns="$ln -s"
2046 else
2047         echo "Symbolic links are NOT supported." >&4
2048         lns="$ln"
2049 fi
2050 $rm -f blurfl sym
2051
2052 : see whether [:lower:] and [:upper:] are supported character classes
2053 echo " "
2054 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2055 ABYZ)
2056         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2057         up='[:upper:]'
2058         low='[:lower:]'
2059         ;;
2060 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2061         # (0xc9 and 0xd1), therefore that is a nice testing point.
2062         if test "X$up" = X -o "X$low" = X; then
2063             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2064             ij) up='[A-Z]'
2065                 low='[a-z]'
2066                 ;;
2067             esac
2068         fi
2069         if test "X$up" = X -o "X$low" = X; then
2070             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2071             ij) up='A-Z'
2072                 low='a-z'
2073                 ;;
2074             esac
2075         fi
2076         if test "X$up" = X -o "X$low" = X; then
2077             case "`echo IJ | od -x 2>/dev/null`" in
2078             *C9D1*|*c9d1*)
2079                 echo "Hey, this might be EBCDIC." >&4
2080                 if test "X$up" = X -o "X$low" = X; then
2081                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2082                     ij) up='[A-IJ-RS-Z]'
2083                         low='[a-ij-rs-z]'
2084                         ;;
2085                     esac
2086                 fi
2087                 if test "X$up" = X -o "X$low" = X; then
2088                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2089                     ij) up='A-IJ-RS-Z'
2090                         low='a-ij-rs-z'
2091                         ;;
2092                     esac
2093                 fi
2094                 ;;
2095             esac
2096         fi
2097 esac
2098 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2099 ij)
2100     echo "Using $up and $low to convert case." >&4
2101     ;;
2102 *)
2103     echo "I don't know how to translate letters from upper to lower case." >&4
2104     echo "Your tr is not acting any way I know of." >&4
2105     exit 1
2106     ;;
2107 esac
2108 : set up the translation script tr, must be called with ./tr of course
2109 cat >tr <<EOSC
2110 $startsh
2111 case "\$1\$2" in
2112 '[A-Z][a-z]') exec $tr '$up' '$low';;
2113 '[a-z][A-Z]') exec $tr '$low' '$up';;
2114 esac
2115 exec $tr "\$@"
2116 EOSC
2117 chmod +x tr
2118 $eunicefix tr
2119
2120 : Try to determine whether config.sh was made on this system
2121 case "$config_sh" in
2122 '')
2123 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2124 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2125 # because the A-Z/a-z are not consecutive.
2126 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2127         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2128 newmyuname="$myuname"
2129 dflt=n
2130 case "$knowitall" in
2131 '')
2132         if test -f ../config.sh; then
2133                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2134                         eval "`grep myuname= ../config.sh`"
2135                 fi
2136                 if test "X$myuname" = "X$newmyuname"; then
2137                         dflt=y
2138                 fi
2139         fi
2140         ;;
2141 *) dflt=y;;
2142 esac
2143
2144 : Get old answers from old config file if Configure was run on the
2145 : same system, otherwise use the hints.
2146 hint=default
2147 cd ..
2148 if test -f config.sh; then
2149         echo " "
2150         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2151         . UU/myread
2152         case "$ans" in
2153         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2154         *)  echo "Fetching default answers from your old config.sh file..." >&4
2155                 tmp_n="$n"
2156                 tmp_c="$c"
2157                 tmp_sh="$sh"
2158                 . ./config.sh
2159                 cp config.sh UU
2160                 n="$tmp_n"
2161                 c="$tmp_c"
2162                 : Older versions did not always set $sh.  Catch re-use of such
2163                 : an old config.sh.
2164                 case "$sh" in
2165                 '') sh="$tmp_sh" ;;
2166                 esac
2167                 hint=previous
2168                 ;;
2169         esac
2170 fi
2171 if test ! -f config.sh; then
2172         $cat <<EOM
2173
2174 First time through, eh?  I have some defaults handy for some systems
2175 that need some extra help getting the Configure answers right:
2176
2177 EOM
2178         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2179         dflt=''
2180         : Half the following guesses are probably wrong... If you have better
2181         : tests or hints, please send them to perlbug@perl.com
2182         : The metaconfig authors would also appreciate a copy...
2183         $test -f /irix && osname=irix
2184         $test -f /xenix && osname=sco_xenix
2185         $test -f /dynix && osname=dynix
2186         $test -f /dnix && osname=dnix
2187         $test -f /lynx.os && osname=lynxos
2188         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2189         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2190         $test -f /bin/mips && /bin/mips && osname=mips
2191         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2192                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2193         $test -d /usr/apollo/bin && osname=apollo
2194         $test -f /etc/saf/_sactab && osname=svr4
2195         $test -d /usr/include/minix && osname=minix
2196         if $test -d /MachTen -o -d /MachTen_Folder; then
2197                 osname=machten
2198                 if $test -x /sbin/version; then
2199                         osvers=`/sbin/version | $awk '{print $2}' |
2200                         $sed -e 's/[A-Za-z]$//'`
2201                 elif $test -x /usr/etc/version; then
2202                         osvers=`/usr/etc/version | $awk '{print $2}' |
2203                         $sed -e 's/[A-Za-z]$//'`
2204                 else
2205                         osvers="$2.$3"
2206                 fi
2207         fi
2208        $test -f /sys/posix.dll &&
2209                $test -f /usr/bin/what &&
2210                set X `/usr/bin/what /sys/posix.dll` &&
2211                $test "$3" = UWIN &&
2212                osname=uwin &&
2213                osvers="$5"
2214         if $test -f $uname; then
2215                 set X $myuname
2216                 shift
2217
2218                 case "$5" in
2219                 fps*) osname=fps ;;
2220                 mips*)
2221                         case "$4" in
2222                         umips) osname=umips ;;
2223                         *) osname=mips ;;
2224                         esac;;
2225                 [23]100) osname=mips ;;
2226                 next*) osname=next ;;
2227                 i386*)
2228                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2229                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2230                                 osname='sco'
2231                                 osvers=$tmp
2232                         elif $test -f /etc/kconfig; then
2233                                 osname=isc
2234                                 if test "$lns" = "$ln -s"; then
2235                                         osvers=4
2236                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2237                                         osvers=3
2238                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2239                                         osvers=2
2240                                 fi
2241                         fi
2242                         tmp=''
2243                         ;;
2244                 pc*)
2245                         if test -n "$DJGPP"; then
2246                                 osname=dos
2247                                 osvers=djgpp
2248                         fi
2249                         ;;
2250                 esac
2251
2252                 case "$1" in
2253                 aix) osname=aix
2254                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2255                         case "$tmp" in
2256                         'not found') osvers="$4"."$3" ;;
2257                         '<3240'|'<>3240') osvers=3.2.0 ;;
2258                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2259                         '=3250'|'>3250') osvers=3.2.5 ;;
2260                         *) osvers=$tmp;;
2261                         esac
2262                         ;;
2263                 *dc.osx) osname=dcosx
2264                         osvers="$3"
2265                         ;;
2266                 dnix) osname=dnix
2267                         osvers="$3"
2268                         ;;
2269                 domainos) osname=apollo
2270                         osvers="$3"
2271                         ;;
2272                 dgux) osname=dgux 
2273                         osvers="$3"
2274                         ;;
2275                 dynixptx*) osname=dynixptx
2276                         osvers=`echo "$4"|sed 's/^v//'`
2277                         ;;
2278                 freebsd) osname=freebsd 
2279                         osvers="$3" ;;
2280                 genix) osname=genix ;;
2281                 hp*) osname=hpux 
2282                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2283                         ;;
2284                 irix*) osname=irix
2285                         case "$3" in
2286                         4*) osvers=4 ;;
2287                         5*) osvers=5 ;;
2288                         *)      osvers="$3" ;;
2289                         esac
2290                         ;;
2291                 linux) osname=linux
2292                         case "$3" in
2293                         *)      osvers="$3" ;;
2294                         esac
2295                         ;;
2296                 MiNT) osname=mint
2297                         ;;
2298                 netbsd*) osname=netbsd
2299                         osvers="$3"
2300                         ;;
2301                 news-os) osvers="$3"
2302                         case "$3" in
2303                         4*) osname=newsos4 ;;
2304                         *) osname=newsos ;;
2305                         esac
2306                         ;;
2307                 bsd386) osname=bsd386
2308                         osvers=`$uname -r`
2309                         ;;
2310                 POSIX-BC | posix-bc ) osname=posix-bc
2311                         osvers="$3"
2312                         ;;
2313                 powerux | power_ux | powermax_os | powermaxos | \
2314                 powerunix | power_unix) osname=powerux
2315                         osvers="$3"
2316                         ;;
2317                 next*) osname=next ;;
2318                 solaris) osname=solaris
2319                         case "$3" in
2320                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2321                         *)      osvers="$3" ;;
2322                         esac
2323                         ;;
2324                 sunos) osname=sunos
2325                         case "$3" in
2326                         5*) osname=solaris
2327                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2328                         *)      osvers="$3" ;;
2329                         esac
2330                         ;;
2331                 titanos) osname=titanos
2332                         case "$3" in
2333                         1*) osvers=1 ;;
2334                         2*) osvers=2 ;;
2335                         3*) osvers=3 ;;
2336                         4*) osvers=4 ;;
2337                         *)      osvers="$3" ;;
2338                         esac
2339                         ;;
2340                 ultrix) osname=ultrix
2341                         osvers="$3"
2342                         ;;
2343                 osf1|mls+)      case "$5" in
2344                                 alpha)
2345                                         osname=dec_osf
2346                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2347                                         ;;
2348                         hp*)    osname=hp_osf1  ;;
2349                         mips)   osname=mips_osf1 ;;
2350                         esac
2351                         ;;
2352                 unixware) osname=svr5
2353                         osvers="$4"
2354                         ;;
2355                 uts) osname=uts
2356                         osvers="$3"
2357                         ;;
2358                 qnx) osname=qnx
2359                         osvers="$4"
2360                         ;;
2361                 cygwin*) osname=cygwin
2362                         osvers="$3"
2363                         ;;
2364                 $2) case "$osname" in
2365                         *isc*) ;;
2366                         *freebsd*) ;;
2367                         svr*)
2368                                 : svr4.x or possibly later
2369                                 case "svr$3" in 
2370                                 ${osname}*)
2371                                         osname=svr$3
2372                                         osvers=$4
2373                                         ;;
2374                                 esac
2375                                 case "$osname" in
2376                                 svr4.0)
2377                                         : Check for ESIX
2378                                         if test -f /stand/boot ; then
2379                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2380                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2381                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2382                                                         if test -n "$isesix"; then
2383                                                                 osname=esix4
2384                                                         fi
2385                                                 fi
2386                                         fi
2387                                         ;;
2388                                 esac
2389                                 ;;
2390                         *)      if test -f /etc/systemid; then
2391                                         osname=sco
2392                                         set `echo $3 | $sed 's/\./ /g'` $4
2393                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2394                                                 osvers=$1.$2.$3
2395                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2396                                                 osvers=$1.$2
2397                                         elif $test -f $src/hints/sco_$1.sh; then
2398                                                 osvers=$1
2399                                         fi
2400                                 else
2401                                         case "$osname" in
2402                                         '') : Still unknown.  Probably a generic Sys V.
2403                                                 osname="sysv"
2404                                                 osvers="$3"
2405                                                 ;;
2406                                         esac
2407                                 fi
2408                                 ;;
2409                         esac
2410                         ;;
2411                 *)      case "$osname" in
2412                         '') : Still unknown.  Probably a generic BSD.
2413                                 osname="$1"
2414                                 osvers="$3"
2415                                 ;;
2416                         esac
2417                         ;;
2418                 esac
2419         else
2420                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2421                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2422                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2423                                 osname=news_os
2424                         fi
2425                         $rm -f UU/kernel.what
2426                 elif test -d c:/.; then
2427                         set X $myuname
2428                         osname=os2
2429                         osvers="$5"
2430                 fi
2431         fi
2432         
2433         : Now look for a hint file osname_osvers, unless one has been
2434         : specified already.
2435         case "$hintfile" in
2436         ''|' ')
2437                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2438                 : Also try without trailing minor version numbers.
2439                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2440                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2441                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2442                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2443                 case "$file" in
2444                 '') dflt=none ;;
2445                 *)  case "$osvers" in
2446                         '') dflt=$file
2447                                 ;;
2448                         *)  if $test -f $src/hints/$file.sh ; then
2449                                         dflt=$file
2450                                 elif $test -f $src/hints/$xfile.sh ; then
2451                                         dflt=$xfile
2452                                 elif $test -f $src/hints/$xxfile.sh ; then
2453                                         dflt=$xxfile
2454                                 elif $test -f $src/hints/$xxxfile.sh ; then
2455                                         dflt=$xxxfile
2456                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2457                                         dflt=$xxxxfile
2458                                 elif $test -f "$src/hints/${osname}.sh" ; then
2459                                         dflt="${osname}"
2460                                 else
2461                                         dflt=none
2462                                 fi
2463                                 ;;
2464                         esac
2465                         ;;
2466                 esac
2467                 if $test -f Policy.sh ; then
2468                         case "$dflt" in
2469                         *Policy*) ;;
2470                         none) dflt="Policy" ;;
2471                         *) dflt="Policy $dflt" ;;
2472                         esac
2473                 fi
2474                 ;;
2475         *)
2476                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2477                 ;;
2478         esac
2479
2480         if $test -f Policy.sh ; then
2481                 $cat <<EOM
2482
2483 There's also a Policy hint file available, which should make the
2484 site-specific (policy) questions easier to answer.
2485 EOM
2486
2487         fi
2488
2489         $cat <<EOM
2490
2491 You may give one or more space-separated answers, or "none" if appropriate.
2492 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2493 is a good thing.  DO NOT give a wrong version or a wrong OS.
2494
2495 EOM
2496
2497         rp="Which of these apply, if any?"
2498         . UU/myread
2499         tans=$ans
2500         for file in $tans; do
2501                 if $test X$file = XPolicy -a -f Policy.sh; then
2502                         . Policy.sh
2503                         $cat Policy.sh >> UU/config.sh
2504                 elif $test -f $src/hints/$file.sh; then
2505                         . $src/hints/$file.sh
2506                         $cat $src/hints/$file.sh >> UU/config.sh
2507                 elif $test X$tans = X -o X$tans = Xnone ; then
2508                         : nothing
2509                 else
2510                         : Give one chance to correct a possible typo.
2511                         echo "$file.sh does not exist"
2512                         dflt=$file
2513                         rp="hint to use instead?"
2514                         . UU/myread
2515                         for file in $ans; do
2516                                 if $test -f "$src/hints/$file.sh"; then
2517                                         . $src/hints/$file.sh
2518                                         $cat $src/hints/$file.sh >> UU/config.sh
2519                                 elif $test X$ans = X -o X$ans = Xnone ; then
2520                                         : nothing
2521                                 else
2522                                         echo "$file.sh does not exist -- ignored."
2523                                 fi
2524                         done
2525                 fi
2526         done
2527
2528         hint=recommended
2529         : Remember our hint file for later.
2530         if $test -f "$src/hints/$file.sh" ; then
2531                 hintfile="$file"
2532         else
2533                 hintfile=''
2534         fi
2535 fi
2536 cd UU
2537 ;;
2538 *)
2539         echo " "
2540         echo "Fetching default answers from $config_sh..." >&4
2541         tmp_n="$n"
2542         tmp_c="$c"
2543         cd ..
2544         cp $config_sh config.sh 2>/dev/null
2545         chmod +w config.sh
2546         . ./config.sh
2547         cd UU
2548         cp ../config.sh .
2549         n="$tmp_n"
2550         c="$tmp_c"
2551         hint=previous
2552         ;;
2553 esac
2554 test "$override" && . ./optdef.sh
2555 myuname="$newmyuname"
2556
2557 : Restore computed paths
2558 for file in $loclist $trylist; do
2559         eval $file="\$_$file"
2560 done
2561
2562 cat << EOM
2563
2564 Configure uses the operating system name and version to set some defaults.
2565 The default value is probably right if the name rings a bell. Otherwise,
2566 since spelling matters for me, either accept the default or answer "none"
2567 to leave it blank.
2568
2569 EOM
2570 case "$osname" in
2571         ''|' ')
2572                 case "$hintfile" in
2573                 ''|' '|none) dflt=none ;;
2574                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2575                 esac
2576                 ;;
2577         *) dflt="$osname" ;;
2578 esac
2579 rp="Operating system name?"
2580 . ./myread
2581 case "$ans" in
2582 none)  osname='' ;;
2583 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2584 esac
2585 echo " "
2586 case "$osvers" in
2587         ''|' ')
2588                 case "$hintfile" in
2589                 ''|' '|none) dflt=none ;;
2590                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2591                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2592                         case "$dflt" in
2593                         ''|' ') dflt=none ;;
2594                         esac
2595                         ;;
2596                 esac
2597                 ;;
2598         *) dflt="$osvers" ;;
2599 esac
2600 rp="Operating system version?"
2601 . ./myread
2602 case "$ans" in
2603 none)  osvers='' ;;
2604 *) osvers="$ans" ;;
2605 esac
2606
2607
2608 . ./posthint.sh
2609
2610 : who configured the system
2611 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2612 cf_by=`(logname) 2>/dev/null`
2613 case "$cf_by" in
2614 "")
2615         cf_by=`(whoami) 2>/dev/null`
2616         case "$cf_by" in
2617         "") cf_by=unknown ;;
2618         esac ;;
2619 esac
2620
2621 : set up the script used to warn in case of inconsistency
2622 cat <<EOS >whoa
2623 $startsh
2624 EOS
2625 cat <<'EOSC' >>whoa
2626 dflt=y
2627 echo " "
2628 echo "*** WHOA THERE!!! ***" >&4
2629 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2630 rp="    Keep the $hint value?"
2631 . ./myread
2632 case "$ans" in
2633 y) td=$was; tu=$was;;
2634 esac
2635 EOSC
2636
2637 : function used to set $1 to $val
2638 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2639 case "$val$was" in
2640 $define$undef) . ./whoa; eval "$var=\$td";;
2641 $undef$define) . ./whoa; eval "$var=\$tu";;
2642 *) eval "$var=$val";;
2643 esac'
2644
2645 cat <<EOM
2646
2647 Perl can be built to take advantage of threads, on some systems.
2648 To do so, Configure must be run with -Dusethreads.
2649
2650 Note that threading is a highly experimental feature, and
2651 some known race conditions still remain.  If you choose to try
2652 it, be very sure to not actually deploy it for production
2653 purposes.  README.threads has more details, and is required
2654 reading if you enable threads.
2655 EOM
2656 case "$usethreads" in
2657 $define|true|[yY]*)     dflt='y';;
2658 *) dflt='n';;
2659 esac
2660 rp='Build a threading Perl?'
2661 . ./myread
2662 case "$ans" in
2663 y|Y)    val="$define" ;;     
2664 *)      val="$undef" ;;
2665 esac
2666 set usethreads
2667 eval $setvar 
2668
2669 case "$d_oldpthreads" in
2670 '')     : Configure tests would be welcome here.  For now, assume undef.
2671         val="$undef" ;;
2672 *)      val="$d_oldpthreads" ;;
2673 esac
2674 set d_oldpthreads
2675 eval $setvar
2676
2677
2678 case "$usethreads" in
2679 "$define"|true|[yY]*)
2680 : Look for a hint-file generated 'call-back-unit'.  If the
2681 : user has specified that a threading perl is to be built,
2682 : we may need to set or change some other defaults.
2683         if $test -f usethreads.cbu; then
2684                 echo "Your platform has some specific hints for threaded builds, using them..."
2685                 . ./usethreads.cbu
2686         else
2687                 $cat <<EOM
2688 (Your platform doesn't have any specific hints for threaded builds.
2689  Assuming POSIX threads, then.)
2690 EOM
2691         fi
2692     ;;
2693 esac
2694
2695 cat <<EOM
2696
2697 Perl can be built so that multiple Perl interpreters can coexist
2698 within the same Perl executable.  To do so, Configure must be run with
2699 -Dusemultiplicity.
2700
2701 Normally you do not need this and you should answer no.
2702
2703 EOM
2704 case "$usemultiplicity" in
2705 $define|true|[yY]*)     dflt='y';;
2706 *) dflt='n';;
2707 esac
2708 rp='Build Perl for multiplicity?'
2709 . ./myread
2710 case "$ans" in
2711 y|Y)    val="$define" ;;     
2712 *)      val="$undef" ;;
2713 esac
2714 set usemultiplicity
2715 eval $setvar 
2716
2717 : determine where manual pages are on this system
2718 echo " "
2719 case "$sysman" in
2720 '') 
2721         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2722         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2723         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2724         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2725         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2726         sysman=`./loc . /usr/man/man1 $syspath`
2727         ;;
2728 esac
2729 if $test -d "$sysman"; then
2730         echo "System manual is in $sysman." >&4
2731 else
2732         echo "Could not find manual pages in source form." >&4
2733 fi
2734
2735 : see what memory models we can support
2736 case "$models" in
2737 '')
2738         $cat >pdp11.c <<'EOP'
2739 int main() {
2740 #ifdef pdp11
2741         exit(0);
2742 #else
2743         exit(1);
2744 #endif
2745 }
2746 EOP
2747         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2748         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2749                 dflt='unsplit split'
2750         else
2751                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2752                 case "$tans" in
2753                 X) dflt='none';;
2754                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2755                                 dflt='small'
2756                         else
2757                                 dflt=''
2758                         fi
2759                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2760                                 dflt="$dflt medium"
2761                         fi
2762                         if $test -d /lib/large || $test -d /usr/lib/large; then
2763                                 dflt="$dflt large"
2764                         fi
2765                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2766                                 dflt="$dflt huge"
2767                         fi
2768                 esac
2769         fi;;
2770 *) dflt="$models";;
2771 esac
2772 $cat <<EOM
2773  
2774 Some systems have different model sizes.  On most systems they are called
2775 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2776 split.  If your system doesn't support different memory models, say "none".
2777 If you wish to force everything to one memory model, say "none" here and
2778 put the appropriate flags later when it asks you for other cc and ld flags.
2779 Venix systems may wish to put "none" and let the compiler figure things out.
2780 (In the following question multiple model names should be space separated.)
2781
2782 The default for most systems is "none".
2783
2784 EOM
2785 rp="Which memory models are supported?"
2786 . ./myread
2787 models="$ans"
2788
2789 case "$models" in
2790 none)
2791         small=''
2792         medium=''
2793         large=''
2794         huge=''
2795         unsplit=''
2796         split=''
2797         ;;
2798 *split)
2799         case "$split" in
2800         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2801                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2802                         dflt='-i'
2803                 else
2804                         dflt='none'
2805                 fi;;
2806         *) dflt="$split";;
2807         esac
2808         rp="What flag indicates separate I and D space?"
2809         . ./myread
2810         tans="$ans"
2811         case "$tans" in
2812         none) tans='';;
2813         esac
2814         split="$tans"
2815         unsplit='';;
2816 *large*|*small*|*medium*|*huge*)
2817         case "$models" in
2818         *large*)
2819                 case "$large" in
2820                 '') dflt='-Ml';;
2821                 *) dflt="$large";;
2822                 esac
2823         rp="What flag indicates large model?"
2824         . ./myread
2825         tans="$ans"
2826         case "$tans" in
2827         none) tans='';
2828         esac
2829         large="$tans";;
2830         *) large='';;
2831         esac
2832         case "$models" in
2833         *huge*) case "$huge" in
2834                 '') dflt='-Mh';;
2835                 *) dflt="$huge";;
2836                 esac
2837                 rp="What flag indicates huge model?"
2838                 . ./myread
2839                 tans="$ans"
2840                 case "$tans" in
2841                 none) tans='';
2842                 esac
2843                 huge="$tans";;
2844         *) huge="$large";;
2845         esac
2846         case "$models" in
2847         *medium*) case "$medium" in
2848                 '') dflt='-Mm';;
2849                 *) dflt="$medium";;
2850                 esac
2851                 rp="What flag indicates medium model?"
2852                 . ./myread
2853                 tans="$ans"
2854                 case "$tans" in
2855                 none) tans='';
2856                 esac
2857                 medium="$tans";;
2858         *) medium="$large";;
2859         esac
2860         case "$models" in
2861         *small*) case "$small" in
2862                 '') dflt='none';;
2863                 *) dflt="$small";;
2864                 esac
2865                 rp="What flag indicates small model?"
2866                 . ./myread
2867                 tans="$ans"
2868                 case "$tans" in
2869                 none) tans='';
2870                 esac
2871                 small="$tans";;
2872         *) small='';;
2873         esac
2874         ;;
2875 *)
2876         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2877         ;;
2878 esac
2879 $rm -f pdp11.* pdp11
2880
2881 : make some quick guesses about what we are up against
2882 echo " "
2883 $echo $n "Hmm...  $c"
2884 echo exit 1 >bsd
2885 echo exit 1 >usg
2886 echo exit 1 >v7
2887 echo exit 1 >osf1
2888 echo exit 1 >eunice
2889 echo exit 1 >xenix
2890 echo exit 1 >venix
2891 echo exit 1 >os2
2892 d_bsd="$undef"
2893 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2894 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2895 then
2896         echo "Looks kind of like an OSF/1 system, but we'll see..."
2897         echo exit 0 >osf1
2898 elif test `echo abc | tr a-z A-Z` = Abc ; then
2899         xxx=`./loc addbib blurfl $pth`
2900         if $test -f $xxx; then
2901         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2902                 echo exit 0 >bsd
2903                 echo exit 0 >usg
2904         else
2905                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2906                         echo "Looks kind of like an extended USG system, but we'll see..."
2907                 else
2908                         echo "Looks kind of like a USG system, but we'll see..."
2909                 fi
2910                 echo exit 0 >usg
2911         fi
2912 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2913         echo "Looks kind of like a BSD system, but we'll see..."
2914         d_bsd="$define"
2915         echo exit 0 >bsd
2916 else
2917         echo "Looks kind of like a Version 7 system, but we'll see..."
2918         echo exit 0 >v7
2919 fi
2920 case "$eunicefix" in
2921 *unixtovms*)
2922         $cat <<'EOI'
2923 There is, however, a strange, musty smell in the air that reminds me of
2924 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2925 EOI
2926         echo exit 0 >eunice
2927         d_eunice="$define"
2928 : it so happens the Eunice I know will not run shell scripts in Unix format
2929         ;;
2930 *)
2931         echo " "
2932         echo "Congratulations.  You aren't running Eunice."
2933         d_eunice="$undef"
2934         ;;
2935 esac
2936 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2937 case "$p_" in
2938 :) ;;
2939 *)
2940         $cat <<'EOI'
2941 I have the feeling something is not exactly right, however...don't tell me...
2942 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2943 EOI
2944         echo exit 0 >os2
2945         ;;
2946 esac
2947 if test -f /xenix; then
2948         echo "Actually, this looks more like a XENIX system..."
2949         echo exit 0 >xenix
2950         d_xenix="$define"
2951 else
2952         echo " "
2953         echo "It's not Xenix..."
2954         d_xenix="$undef"
2955 fi
2956 chmod +x xenix
2957 $eunicefix xenix
2958 if test -f /venix; then
2959         echo "Actually, this looks more like a VENIX system..."
2960         echo exit 0 >venix
2961 else
2962         echo " "
2963         if ./xenix; then
2964                 : null
2965         else
2966                 echo "Nor is it Venix..."
2967         fi
2968 fi
2969 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2970 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2971 $rm -f foo
2972
2973 : see if we need a special compiler
2974 echo " "
2975 if ./usg; then
2976         case "$cc" in
2977         '') case "$Mcc" in
2978                 /*) dflt='Mcc';;
2979                 *) case "$large" in
2980                         -M*) dflt='cc';;
2981                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2982                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2983                                                 dflt='cc'
2984                                         else
2985                                                 dflt='cc -M'
2986                                         fi
2987                                 else
2988                                         dflt='cc'
2989                                 fi;;
2990                         esac;;
2991                 esac;;
2992         *)  dflt="$cc";;
2993         esac
2994         case "$dflt" in
2995         *M*)    $cat <<'EOM'
2996 On some older systems the default C compiler will not resolve multiple global
2997 references that happen to have the same name.  On some such systems the "Mcc"
2998 command may be used to force these to be resolved.  On other systems a "cc -M"
2999 command is required.  (Note that the -M flag on other systems indicates a
3000 memory model to use!) If you have the Gnu C compiler, you might wish to use
3001 that instead.
3002
3003 EOM
3004         ;;
3005         esac
3006         rp="Use which C compiler?"
3007         . ./myread
3008         cc="$ans"
3009 else
3010         case "$cc" in
3011         '') dflt=cc;;
3012         *) dflt="$cc";;
3013         esac
3014         rp="Use which C compiler?"
3015         . ./myread
3016         cc="$ans"
3017 fi
3018 : Look for a hint-file generated 'call-back-unit'.  Now that the
3019 : user has specified the compiler, we may need to set or change some
3020 : other defaults.
3021 if $test -f cc.cbu; then
3022     . ./cc.cbu
3023 fi
3024 echo " "
3025 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3026 $cat >gccvers.c <<EOM
3027 #include <stdio.h>
3028 int main() {
3029 #ifdef __GNUC__
3030 #ifdef __VERSION__
3031         printf("%s\n", __VERSION__);
3032 #else
3033         printf("%s\n", "1");
3034 #endif
3035 #endif
3036         exit(0);
3037 }
3038 EOM
3039 if $cc -o gccvers gccvers.c; then
3040         gccversion=`./gccvers`
3041         case "$gccversion" in
3042         '') echo "You are not using GNU cc." ;;
3043         *)  echo "You are using GNU cc $gccversion." ;;
3044         esac
3045 else
3046         echo " "
3047         echo "*** WHOA THERE!!! ***" >&4
3048         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3049         case "$knowitall" in
3050         '')
3051         echo "    You'd better start hunting for one and let me know about it." >&4
3052                 exit 1
3053                 ;;
3054         esac
3055 fi
3056 $rm -f gccvers*
3057 case "$gccversion" in
3058 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3059 esac
3060
3061 : see how we invoke the C preprocessor
3062 echo " "
3063 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3064 cat <<'EOT' >testcpp.c
3065 #define ABC abc
3066 #define XYZ xyz
3067 ABC.XYZ
3068 EOT
3069 cd ..
3070 if test ! -f cppstdin; then
3071         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3072                 # AIX cc -E doesn't show the absolute headerfile
3073                 # locations but we'll cheat by using the -M flag.
3074                 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
3075         else
3076                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3077         fi
3078 else
3079         echo "Keeping your $hint cppstdin wrapper."
3080 fi
3081 chmod 755 cppstdin
3082 wrapper=`pwd`/cppstdin
3083 ok='false'
3084 cd UU
3085
3086 if $test "X$cppstdin" != "X" && \
3087         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3088         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3089 then
3090         echo "You used to use $cppstdin $cppminus so we'll use that again."
3091         case "$cpprun" in
3092         '') echo "But let's see if we can live without a wrapper..." ;;
3093         *)
3094                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3095                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3096                 then
3097                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3098                         ok='true'
3099                 else
3100                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3101                 fi
3102                 ;;
3103         esac
3104 else
3105         case "$cppstdin" in
3106         '') ;;
3107         *)
3108                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3109                 ;;
3110         esac
3111 fi
3112
3113 if $ok; then
3114         : nothing
3115 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3116         $cc -E <testcpp.c >testcpp.out 2>&1; \
3117         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3118         echo "Yup, it does."
3119         x_cpp="$cc -E"
3120         x_minus='';
3121 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3122         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3123         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3124         echo "Yup, it does."
3125         x_cpp="$cc -E"
3126         x_minus='-';
3127 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3128         $cc -P <testcpp.c >testcpp.out 2>&1; \
3129         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3130         echo "Yipee, that works!"
3131         x_cpp="$cc -P"
3132         x_minus='';
3133 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3134         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3135         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3136         echo "At long last!"
3137         x_cpp="$cc -P"
3138         x_minus='-';
3139 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3140         $cpp <testcpp.c >testcpp.out 2>&1; \
3141         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3142         echo "It works!"
3143         x_cpp="$cpp"
3144         x_minus='';
3145 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3146         $cpp - <testcpp.c >testcpp.out 2>&1; \
3147         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3148         echo "Hooray, it works!  I was beginning to wonder."
3149         x_cpp="$cpp"
3150         x_minus='-';
3151 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3152         $wrapper <testcpp.c >testcpp.out 2>&1; \
3153         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3154         x_cpp="$wrapper"
3155         x_minus=''
3156         echo "Eureka!"
3157 else
3158         dflt=''
3159         rp="No dice.  I can't find a C preprocessor.  Name one:"
3160         . ./myread
3161         x_cpp="$ans"
3162         x_minus=''
3163         $x_cpp <testcpp.c >testcpp.out 2>&1
3164         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3165                 echo "OK, that will do." >&4
3166         else
3167 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3168                 exit 1
3169         fi
3170 fi
3171
3172 case "$ok" in
3173 false)
3174         cppstdin="$x_cpp"
3175         cppminus="$x_minus"
3176         cpprun="$x_cpp"
3177         cpplast="$x_minus"
3178         set X $x_cpp
3179         shift
3180         case "$1" in
3181         "$cpp")
3182                 echo "Perhaps can we force $cc -E using a wrapper..."
3183                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3184                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3185                 then
3186                         echo "Yup, we can."
3187                         cppstdin="$wrapper"
3188                         cppminus='';
3189                 else
3190                         echo "Nope, we'll have to live without it..."
3191                 fi
3192                 ;;
3193         esac
3194         case "$cpprun" in
3195         "$wrapper")
3196                 cpprun=''
3197                 cpplast=''
3198                 ;;
3199         esac
3200         ;;
3201 esac
3202
3203 case "$cppstdin" in
3204 "$wrapper"|'cppstdin') ;;
3205 *) $rm -f $wrapper;;
3206 esac
3207 $rm -f testcpp.c testcpp.out
3208
3209 : decide how portable to be.  Allow command line overrides.
3210 case "$d_portable" in
3211 "$undef") ;;
3212 *)      d_portable="$define" ;;
3213 esac
3214
3215 : set up shell script to do ~ expansion
3216 cat >filexp <<EOSS
3217 $startsh
3218 : expand filename
3219 case "\$1" in
3220  ~/*|~)
3221         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3222         ;;
3223  ~*)
3224         if $test -f /bin/csh; then
3225                 /bin/csh -f -c "glob \$1"
3226                 failed=\$?
3227                 echo ""
3228                 exit \$failed
3229         else
3230                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3231                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3232                 if $test ! -d "\$dir"; then
3233                         me=\`basename \$0\`
3234                         echo "\$me: can't locate home directory for: \$name" >&2
3235                         exit 1
3236                 fi
3237                 case "\$1" in
3238                 */*)
3239                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3240                         ;;
3241                 *)
3242                         echo \$dir
3243                         ;;
3244                 esac
3245         fi
3246         ;;
3247 *)
3248         echo \$1
3249         ;;
3250 esac
3251 EOSS
3252 chmod +x filexp
3253 $eunicefix filexp
3254
3255 : now set up to get a file name
3256 cat <<EOS >getfile
3257 $startsh
3258 EOS
3259 cat <<'EOSC' >>getfile
3260 tilde=''
3261 fullpath=''
3262 already=''
3263 skip=''
3264 none_ok=''
3265 exp_file=''
3266 nopath_ok=''
3267 orig_rp="$rp"
3268 orig_dflt="$dflt"
3269 case "$gfpth" in
3270 '') gfpth='.' ;;
3271 esac
3272
3273 case "$fn" in
3274 *\(*)
3275         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3276         fn=`echo $fn | sed 's/(.*)//'`
3277         ;;
3278 esac
3279
3280 case "$fn" in
3281 *:*)
3282         loc_file=`expr $fn : '.*:\(.*\)'`
3283         fn=`expr $fn : '\(.*\):.*'`
3284         ;;
3285 esac
3286
3287 case "$fn" in
3288 *~*) tilde=true;;
3289 esac
3290 case "$fn" in
3291 */*) fullpath=true;;
3292 esac
3293 case "$fn" in
3294 *+*) skip=true;;
3295 esac
3296 case "$fn" in
3297 *n*) none_ok=true;;
3298 esac
3299 case "$fn" in
3300 *e*) exp_file=true;;
3301 esac
3302 case "$fn" in
3303 *p*) nopath_ok=true;;
3304 esac
3305
3306 case "$fn" in
3307 *f*) type='File';;
3308 *d*) type='Directory';;
3309 *l*) type='Locate';;
3310 esac
3311
3312 what="$type"
3313 case "$what" in
3314 Locate) what='File';;
3315 esac
3316
3317 case "$exp_file" in
3318 '')
3319         case "$d_portable" in
3320         "$define") ;;
3321         *) exp_file=true;;
3322         esac
3323         ;;
3324 esac
3325
3326 cd ..
3327 while test "$type"; do
3328         redo=''
3329         rp="$orig_rp"
3330         dflt="$orig_dflt"
3331         case "$tilde" in
3332         true) rp="$rp (~name ok)";;
3333         esac
3334         . UU/myread
3335         if test -f UU/getfile.ok && \
3336                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3337         then
3338                 value="$ans"
3339                 ansexp="$ans"
3340                 break
3341         fi
3342         case "$ans" in
3343         none)
3344                 value=''
3345                 ansexp=''
3346                 case "$none_ok" in
3347                 true) type='';;
3348                 esac
3349                 ;;
3350         *)
3351                 case "$tilde" in
3352                 '') value="$ans"
3353                         ansexp="$ans";;
3354                 *)
3355                         value=`UU/filexp $ans`
3356                         case $? in
3357                         0)
3358                                 if test "$ans" != "$value"; then
3359                                         echo "(That expands to $value on this system.)"
3360                                 fi
3361                                 ;;
3362                         *) value="$ans";;
3363                         esac
3364                         ansexp="$value"
3365                         case "$exp_file" in
3366                         '') value="$ans";;
3367                         esac
3368                         ;;
3369                 esac
3370                 case "$fullpath" in
3371                 true)
3372                         case "$ansexp" in
3373                         /*) value="$ansexp" ;;
3374                         *)
3375                                 redo=true
3376                                 case "$already" in
3377                                 true)
3378                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3379                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3380                                         ;;
3381                                 *)
3382                                 echo "Please give a full path name, starting with slash." >&4
3383                                         case "$tilde" in
3384                                         true)
3385                                 echo "Note that using ~name is ok provided it expands well." >&4
3386                                                 already=true
3387                                                 ;;
3388                                         esac
3389                                 esac
3390                                 ;;
3391                         esac
3392                         ;;
3393                 esac
3394                 case "$redo" in
3395                 '')
3396                         case "$type" in
3397                         File)
3398                                 for fp in $gfpth; do
3399                                         if test "X$fp" = X.; then
3400                                             pf="$ansexp"
3401                                         else    
3402                                             pf="$fp/$ansexp"
3403                                         fi
3404                                         if test -f "$pf"; then
3405                                                 type=''
3406                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3407                                         then
3408                                                 echo "($value is not a plain file, but that's ok.)"
3409                                                 type=''
3410                                         fi
3411                                         if test X"$type" = X; then
3412                                             value="$pf"
3413                                             break
3414                                         fi
3415                                 done
3416                                 ;;
3417                         Directory)
3418                                 for fp in $gfpth; do
3419                                         if test "X$fp" = X.; then
3420                                             pf="$ansexp"
3421                                         else    
3422                                             pf="$fp/$ansexp"
3423                                         fi
3424                                         if test -d "$pf"; then
3425                                                 type=''
3426                                                 value="$pf"
3427                                                 break
3428                                         fi
3429                                 done
3430                                 ;;
3431                         Locate)
3432                                 if test -d "$ansexp"; then
3433                                         echo "(Looking for $loc_file in directory $value.)"
3434                                         value="$value/$loc_file"
3435                                         ansexp="$ansexp/$loc_file"
3436                                 fi
3437                                 if test -f "$ansexp"; then
3438                                         type=''
3439                                 fi
3440                                 case "$nopath_ok" in
3441                                 true)   case "$value" in
3442                                         */*) ;;
3443                                         *)      echo "Assuming $value will be in people's path."
3444                                                 type=''
3445                                                 ;;
3446                                         esac
3447                                         ;;
3448                                 esac
3449                                 ;;
3450                         esac
3451
3452                         case "$skip" in
3453                         true) type='';
3454                         esac
3455
3456                         case "$type" in
3457                         '') ;;
3458                         *)
3459                                 if test "$fastread" = yes; then
3460                                         dflt=y
3461                                 else
3462                                         dflt=n
3463                                 fi
3464                                 rp="$what $value doesn't exist.  Use that name anyway?"
3465                                 . UU/myread
3466                                 dflt=''
3467                                 case "$ans" in
3468                                 y*) type='';;
3469                                 *) echo " ";;
3470                                 esac
3471                                 ;;
3472                         esac
3473                         ;;
3474                 esac
3475                 ;;
3476         esac
3477 done
3478 cd UU
3479 ans="$value"
3480 rp="$orig_rp"
3481 dflt="$orig_dflt"
3482 rm -f getfile.ok
3483 test "X$gfpthkeep" != Xy && gfpth=""
3484 EOSC
3485
3486 : What should the include directory be ?
3487 echo " "
3488 $echo $n "Hmm...  $c"
3489 dflt='/usr/include'
3490 incpath=''
3491 mips_type=''
3492 if $test -f /bin/mips && /bin/mips; then
3493         echo "Looks like a MIPS system..."
3494         $cat >usr.c <<'EOCP'
3495 #ifdef SYSTYPE_BSD43
3496 /bsd43
3497 #endif
3498 EOCP
3499         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3500                 dflt='/bsd43/usr/include'
3501                 incpath='/bsd43'
3502                 mips_type='BSD 4.3'
3503         else
3504                 mips_type='System V'
3505         fi
3506         $rm -f usr.c usr.out
3507         echo "and you're compiling with the $mips_type compiler and libraries."
3508         xxx_prompt=y
3509         echo "exit 0" >mips
3510 else
3511         echo "Doesn't look like a MIPS system."
3512         xxx_prompt=n
3513         echo "exit 1" >mips
3514 fi
3515 chmod +x mips
3516 $eunicefix mips
3517 case "$usrinc" in
3518 '') ;;
3519 *) dflt="$usrinc";;
3520 esac
3521 case "$xxx_prompt" in
3522 y)      fn=d/
3523         echo " "
3524         rp='Where are the include files you want to use?'
3525         . ./getfile
3526         usrinc="$ans"
3527         ;;
3528 *)      usrinc="$dflt"
3529         ;;
3530 esac
3531
3532 : Set private lib path
3533 case "$plibpth" in
3534 '') if ./mips; then
3535                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3536         fi;;
3537 esac
3538 case "$libpth" in
3539 ' ') dlist='';;
3540 '') dlist="$loclibpth $plibpth $glibpth";;
3541 *) dlist="$libpth";;
3542 esac
3543
3544 : Now check and see which directories actually exist, avoiding duplicates
3545 libpth=''
3546 for xxx in $dlist
3547 do
3548     if $test -d $xxx; then
3549                 case " $libpth " in
3550                 *" $xxx "*) ;;
3551                 *) libpth="$libpth $xxx";;
3552                 esac
3553     fi
3554 done
3555 $cat <<'EOM'
3556
3557 Some systems have incompatible or broken versions of libraries.  Among
3558 the directories listed in the question below, please remove any you
3559 know not to be holding relevant libraries, and add any that are needed.
3560 Say "none" for none.
3561
3562 EOM
3563 case "$libpth" in
3564 '') dflt='none';;
3565 *)
3566         set X $libpth
3567         shift
3568         dflt=${1+"$@"}
3569         ;;
3570 esac
3571 rp="Directories to use for library searches?"
3572 . ./myread
3573 case "$ans" in
3574 none) libpth=' ';;
3575 *) libpth="$ans";;
3576 esac
3577
3578 : compute shared library extension
3579 case "$so" in
3580 '')
3581         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3582                 dflt='sl'
3583         else
3584                 dflt='so'
3585         fi
3586         ;;
3587 *) dflt="$so";;
3588 esac
3589 $cat <<EOM
3590
3591 On some systems, shared libraries may be available.  Answer 'none' if
3592 you want to suppress searching of shared libraries for the remaining
3593 of this configuration.
3594
3595 EOM
3596 rp='What is the file extension used for shared libraries?'
3597 . ./myread
3598 so="$ans"
3599
3600 : Define several unixisms.
3601 : Hints files or command line option can be used to override them.
3602 : The convoluted testing is in case hints files set either the old
3603 : or the new name.
3604 case "$_exe" in
3605 '')     case "$exe_ext" in
3606     '') ;;
3607         *)      _exe="$exe_ext" ;;
3608         esac
3609         ;;
3610 esac
3611 case "$_a" in
3612 '')     case "$lib_ext" in
3613     '') _a='.a';;
3614         *)      _a="$lib_ext" ;;
3615         esac
3616         ;;
3617 esac
3618 case "$_o" in
3619 '') case "$obj_ext" in
3620         '')     _o='.o';;
3621         *)      _o="$obj_ext";;
3622         esac
3623         ;;
3624 esac
3625 case "$p_" in
3626 '') case "$path_sep" in
3627         '')     p_=':';;
3628         *)      p_="$path_sep";;
3629         esac
3630         ;;
3631 esac
3632 exe_ext=$_exe
3633 lib_ext=$_a
3634 obj_ext=$_o
3635 path_sep=$p_
3636
3637 : Which makefile gets called first.  This is used by make depend.
3638 case "$firstmakefile" in
3639 '') firstmakefile='makefile';;
3640 esac
3641
3642 cat <<EOM
3643
3644 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3645 Configure must be run with -Dusesocks.
3646
3647 Normally you do not need this and you should answer no.
3648
3649 EOM
3650 case "$usesocks" in
3651 $define|true|[yY]*)     dflt='y';;
3652 *) dflt='n';;
3653 esac
3654 rp='Build Perl for SOCKS?'
3655 . ./myread
3656 case "$ans" in
3657 y|Y)    val="$define" ;;     
3658 *)      val="$undef" ;;
3659 esac
3660 set usesocks
3661 eval $setvar
3662
3663 : Looking for optional libraries
3664 echo " "
3665 echo "Checking for optional libraries..." >&4
3666 case "$libs" in
3667 ' '|'') dflt='';;
3668 *) dflt="$libs";;
3669 esac
3670 case "$libswanted" in
3671 '') libswanted='c_s';;
3672 esac
3673 case "$usesocks" in
3674 $define)
3675         libswanted="$libswanted socks5 socks5_sh"
3676         ;;
3677 esac
3678 for thislib in $libswanted; do
3679         
3680         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3681                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3682                 echo "Found -l$thislib (shared)."
3683                 case " $dflt " in
3684                 *"-l$thislib "*);;
3685                 *) dflt="$dflt -l$thislib";;
3686                 esac
3687         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3688                 echo "Found -l$thislib (shared)."
3689                 case " $dflt " in
3690                 *"-l$thislib "*);;
3691                 *) dflt="$dflt -l$thislib";;
3692                 esac
3693         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3694                 echo "Found -l$thislib."
3695                 case " $dflt " in
3696                 *"-l$thislib "*);;
3697                 *) dflt="$dflt -l$thislib";;
3698                 esac
3699         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3700                 echo "Found -l$thislib."
3701                 case " $dflt " in
3702                 *"-l$thislib "*);;
3703                 *) dflt="$dflt -l$thislib";;
3704                 esac
3705         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3706                 echo "Found -l${thislib}_s."
3707                 case " $dflt " in
3708                 *"-l$thislib "*);;
3709                 *) dflt="$dflt -l${thislib}_s";;
3710                 esac
3711         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3712                 echo "Found -l$thislib."
3713                 case " $dflt " in
3714                 *"-l$thislib "*);;
3715                 *) dflt="$dflt -l$thislib";;
3716                 esac
3717         else
3718                 echo "No -l$thislib."
3719         fi
3720 done
3721 set X $dflt
3722 shift
3723 dflt="$*"
3724 case "$libs" in
3725 '') dflt="$dflt";;
3726 *) dflt="$libs";;
3727 esac
3728 case "$dflt" in
3729 ' '|'') dflt='none';;
3730 esac
3731
3732 $cat <<EOM
3733
3734 In order to compile $package on your machine, a number of libraries
3735 are usually needed.  Include any other special libraries here as well.
3736 Say "none" for none.  The default list is almost always right.
3737 EOM
3738
3739 echo " "
3740 rp="What libraries to use?"
3741 . ./myread
3742 case "$ans" in
3743 none) libs=' ';;
3744 *) libs="$ans";;
3745 esac
3746
3747 : determine optimization, if desired, or use for debug flag also
3748 case "$optimize" in
3749 ' '|$undef) dflt='none';;
3750 '') dflt='-O';;
3751 *) dflt="$optimize";;
3752 esac
3753 $cat <<EOH
3754
3755 By default, $package compiles with the -O flag to use the optimizer.
3756 Alternately, you might want to use the symbolic debugger, which uses
3757 the -g flag (on traditional Unix systems).  Either flag can be
3758 specified here.  To use neither flag, specify the word "none".
3759
3760 EOH
3761 rp="What optimizer/debugger flag should be used?"
3762 . ./myread
3763 optimize="$ans"
3764 case "$optimize" in
3765 'none') optimize=" ";;
3766 esac
3767
3768 dflt=''
3769 : We will not override a previous value, but we might want to
3770 : augment a hint file
3771 case "$hint" in
3772 default|recommended)
3773         case "$gccversion" in
3774         1*) dflt='-fpcc-struct-return' ;;
3775         esac
3776         case "$optimize" in
3777         *-g*) dflt="$dflt -DDEBUGGING";;
3778         esac
3779         case "$gccversion" in
3780         2*) if test -d /etc/conf/kconfig.d &&
3781                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3782                 then
3783                         dflt="$dflt -posix"
3784                 fi
3785                 ;;
3786         esac
3787         case "$gccversion" in
3788         1*) ;;
3789         2.[0-8]*) ;;
3790         ?*)     echo " "
3791                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3792                 echo 'int main(void) { return 0; }' > gcctest.c
3793                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3794                         echo "Yes, it does." 2>&1
3795                         case "$ccflags" in
3796                         *strict-aliasing*) 
3797                                 echo "Leaving current flags $ccflags alone." 2>&1
3798                                 ;;
3799                         *) dflt="$dflt -fno-strict-aliasing" ;;
3800                         esac
3801                 else
3802                         echo "Nope, it doesn't, but that's ok." 2>&1
3803                 fi
3804                 ;;
3805         esac
3806         ;;
3807 esac
3808
3809 case "$mips_type" in
3810 *BSD*|'') inclwanted="$locincpth $usrinc";;
3811 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3812 esac
3813 for thisincl in $inclwanted; do
3814         if $test -d $thisincl; then
3815                 if $test x$thisincl != x$usrinc; then
3816                         case "$dflt" in
3817                         *$thisincl*);;
3818                         *) dflt="$dflt -I$thisincl";;
3819                         esac
3820                 fi
3821         fi
3822 done
3823
3824 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3825         xxx=true;
3826 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3827         xxx=true;
3828 else
3829         xxx=false;
3830 fi;
3831 if $xxx; then
3832         case "$dflt" in
3833         *$2*);;
3834         *) dflt="$dflt -D$2";;
3835         esac;
3836 fi'
3837
3838 set signal.h LANGUAGE_C; eval $inctest
3839
3840 case "$usesocks" in
3841 $define)
3842         ccflags="$ccflags -DSOCKS"
3843         ;;
3844 esac
3845
3846 case "$hint" in
3847 default|recommended) dflt="$ccflags $dflt" ;;
3848 *) dflt="$ccflags";;
3849 esac
3850
3851 case "$dflt" in
3852 ''|' ') dflt=none;;
3853 esac
3854 $cat <<EOH
3855
3856 Your C compiler may want other flags.  For this question you should include
3857 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3858 but you should NOT include libraries or ld flags like -lwhatever.  If you
3859 want $package to honor its debug switch, you should include -DDEBUGGING here.
3860 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3861
3862 To use no flags, specify the word "none".
3863
3864 EOH
3865 set X $dflt
3866 shift
3867 dflt=${1+"$@"}
3868 rp="Any additional cc flags?"
3869 . ./myread
3870 case "$ans" in
3871 none) ccflags='';;
3872 *) ccflags="$ans";;
3873 esac
3874
3875 : the following weeds options from ccflags that are of no interest to cpp
3876 cppflags="$ccflags"
3877 case "$gccversion" in
3878 1*) cppflags="$cppflags -D__GNUC__"
3879 esac
3880 case "$mips_type" in
3881 '');;
3882 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3883 esac
3884 case "$cppflags" in
3885 '');;
3886 *)
3887         echo " "
3888         echo "Let me guess what the preprocessor flags are..." >&4
3889         set X $cppflags
3890         shift
3891         cppflags=''
3892         $cat >cpp.c <<'EOM'
3893 #define BLURFL foo
3894
3895 BLURFL xx LFRULB
3896 EOM
3897         previous=''
3898         for flag in $*
3899         do
3900                 case "$flag" in
3901                 -*) ftry="$flag";;
3902                 *) ftry="$previous $flag";;
3903                 esac
3904                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3905                         >cpp1.out 2>/dev/null && \
3906                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3907                         >cpp2.out 2>/dev/null && \
3908                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3909                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3910                 then
3911                         cppflags="$cppflags $ftry"
3912                         previous=''
3913                 else
3914                         previous="$flag"
3915                 fi
3916         done
3917         set X $cppflags
3918         shift
3919         cppflags=${1+"$@"}
3920         case "$cppflags" in
3921         *-*)  echo "They appear to be: $cppflags";;
3922         esac
3923         $rm -f cpp.c cpp?.out
3924         ;;
3925 esac
3926
3927 : flags used in final linking phase
3928 case "$ldflags" in
3929 '') if ./venix; then
3930                 dflt='-i -z'
3931         else
3932                 dflt=''
3933         fi
3934         case "$ccflags" in
3935         *-posix*) dflt="$dflt -posix" ;;
3936         esac
3937         ;;
3938 *) dflt="$ldflags";;
3939 esac
3940
3941 : Try to guess additional flags to pick up local libraries.
3942 for thislibdir in $libpth; do
3943         case " $loclibpth " in
3944         *" $thislibdir "*)
3945                 case "$dflt " in 
3946                 *"-L$thislibdir "*) ;;
3947                 *)  dflt="$dflt -L$thislibdir" ;;
3948                 esac
3949                 ;;
3950         esac
3951 done
3952
3953 case "$dflt" in
3954 '') dflt='none' ;;
3955 esac
3956
3957 $cat <<EOH
3958
3959 Your C linker may need flags.  For this question you should
3960 include -L/whatever and any other flags used by the C linker, but you
3961 should NOT include libraries like -lwhatever.
3962
3963 Make sure you include the appropriate -L/path flags if your C linker
3964 does not normally search all of the directories you specified above,
3965 namely
3966         $libpth
3967 To use no flags, specify the word "none".
3968
3969 EOH
3970
3971 rp="Any additional ld flags (NOT including libraries)?"
3972 . ./myread
3973 case "$ans" in
3974 none) ldflags='';;
3975 *) ldflags="$ans";;
3976 esac
3977 rmlist="$rmlist pdp11"
3978
3979 : coherency check
3980 echo " "
3981 echo "Checking your choice of C compiler and flags for coherency..." >&4
3982 $cat > try.c <<'EOF'
3983 #include <stdio.h>
3984 int main() { printf("Ok\n"); exit(0); }
3985 EOF
3986 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
3987 shift
3988 $cat >try.msg <<'EOM'
3989 I've tried to compile and run the following simple program:
3990
3991 EOM
3992 $cat try.c >> try.msg
3993
3994 $cat >> try.msg <<EOM
3995
3996 I used the command:
3997
3998         $*
3999         ./try
4000
4001 and I got the following output:
4002
4003 EOM
4004 dflt=y
4005 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4006         if sh -c './try' >>try.msg 2>&1; then
4007                 xxx=`./try`
4008                 case "$xxx" in
4009                 "Ok") dflt=n ;;
4010                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4011                         case " $libs " in
4012                         *" -lsfio "*)
4013                                 cat >> try.msg <<'EOQS'
4014 If $libs contains -lsfio, and sfio is mis-configured, then it
4015 sometimes (apparently) runs and exits with a 0 status, but with no
4016 output!  It may have to do with sfio's use of _exit vs. exit.
4017
4018 EOQS
4019                                 rp="You have a big problem.  Shall I abort Configure"
4020                                 dflt=y
4021                                 ;;
4022                         esac
4023                         ;;
4024                 esac
4025         else
4026                 echo "The program compiled OK, but exited with status $?." >>try.msg
4027                 rp="You have a problem.  Shall I abort Configure"
4028                 dflt=y
4029         fi
4030 else
4031         echo "I can't compile the test program." >>try.msg
4032         rp="You have a BIG problem.  Shall I abort Configure"
4033         dflt=y
4034 fi
4035 case "$dflt" in
4036 y)
4037         $cat try.msg >&4
4038         case "$knowitall" in
4039         '')
4040                 echo "(The supplied flags or libraries might be incorrect.)"
4041                 ;;
4042         *) dflt=n;;
4043         esac
4044         echo " "
4045         . ./myread
4046         case "$ans" in
4047         n*|N*) ;;
4048         *)      echo "Ok.  Stopping Configure." >&4
4049                 exit 1
4050                 ;;
4051         esac
4052         ;;
4053 n) echo "OK, that should do.";;
4054 esac
4055 $rm -f try try.* core
4056
4057 : define an is-a-typedef? function
4058 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4059 case "$inclist" in
4060 "") inclist="sys/types.h";;
4061 esac;
4062 eval "varval=\$$var";
4063 case "$varval" in
4064 "")
4065         $rm -f temp.c;
4066         for inc in $inclist; do
4067                 echo "#include <$inc>" >>temp.c;
4068         done;
4069         echo "#ifdef $type" >> temp.c;
4070         echo "printf(\"We have $type\");" >> temp.c;
4071         echo "#endif" >> temp.c;
4072         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4073         if $contains $type temp.E >/dev/null 2>&1; then
4074                 eval "$var=\$type";
4075         else
4076                 eval "$var=\$def";
4077         fi;
4078         $rm -f temp.?;;
4079 *) eval "$var=\$varval";;
4080 esac'
4081
4082 : define an is-a-typedef? function that prompts if the type is not available.
4083 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4084 case "$inclist" in
4085 "") inclist="sys/types.h";;
4086 esac;
4087 eval "varval=\$$var";
4088 case "$varval" in
4089 "")
4090         $rm -f temp.c;
4091         for inc in $inclist; do
4092                 echo "#include <$inc>" >>temp.c;
4093         done;
4094         echo "#ifdef $type" >> temp.c;
4095         echo "printf(\"We have $type\");" >> temp.c;
4096         echo "#endif" >> temp.c;
4097         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4098         echo " " ;
4099         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4100         if $contains $type temp.E >/dev/null 2>&1; then
4101                 echo "$type found." >&4;
4102                 eval "$var=\$type";
4103         else
4104                 echo "$type NOT found." >&4;
4105                 dflt="$def";
4106                 . ./myread ;
4107                 eval "$var=\$ans";
4108         fi;
4109         $rm -f temp.?;;
4110 *) eval "$var=\$varval";;
4111 esac'
4112
4113 : define a shorthand compile call
4114 compile='
4115 mc_file=$1;
4116 shift;
4117 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4118 : define a shorthand compile call for compilations that should be ok.
4119 compile_ok='
4120 mc_file=$1;
4121 shift;
4122 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4123
4124 : check for lengths of integral types
4125 echo " "
4126 case "$intsize" in
4127 '')
4128         echo "Checking to see how big your integers are..." >&4
4129         $cat >intsize.c <<'EOCP'
4130 #include <stdio.h>
4131 int main()
4132 {
4133         printf("intsize=%d;\n", (int)sizeof(int));
4134         printf("longsize=%d;\n", (int)sizeof(long));
4135         printf("shortsize=%d;\n", (int)sizeof(short));
4136         exit(0);
4137 }
4138 EOCP
4139         set intsize
4140         if eval $compile_ok && ./intsize > /dev/null; then
4141                 eval `./intsize`
4142                 echo "Your integers are $intsize bytes long."
4143                 echo "Your long integers are $longsize bytes long."
4144                 echo "Your short integers are $shortsize bytes long."
4145         else
4146                 $cat >&4 <<EOM
4147 !
4148 Help! I can't compile and run the intsize test program: please enlighten me!
4149 (This is probably a misconfiguration in your system or libraries, and
4150 you really ought to fix it.  Still, I'll try anyway.)
4151 !
4152 EOM
4153                 dflt=4
4154                 rp="What is the size of an integer (in bytes)?"
4155                 . ./myread
4156                 intsize="$ans"
4157                 dflt=$intsize
4158                 rp="What is the size of a long integer (in bytes)?"
4159                 . ./myread
4160                 longsize="$ans"
4161                 dflt=2
4162                 rp="What is the size of a short integer (in bytes)?"
4163                 . ./myread
4164                 shortsize="$ans"
4165         fi
4166         ;;
4167 esac
4168 $rm -f intsize intsize.*
4169
4170 : see what type lseek is declared as in the kernel
4171 rp="What is the type used for lseek's offset on this system?"
4172 set off_t lseektype long stdio.h sys/types.h
4173 eval $typedef_ask
4174
4175 echo " "
4176 $echo $n "Checking to see how big your file offsets are...$c" >&4
4177 $cat >try.c <<EOCP
4178 #include <sys/types.h>
4179 #include <stdio.h>
4180 int main()
4181 {
4182     printf("%d\n", (int)sizeof($lseektype));
4183     return(0); 
4184 }
4185 EOCP
4186 set try
4187 if eval $compile_ok; then
4188         lseeksize=`./try`
4189         $echo " $lseeksize bytes." >&4
4190 else
4191         dflt=$longsize
4192         echo " "
4193         echo "(I can't seem to compile the test program.  Guessing...)"
4194         rp="What is the size of your file offsets (in bytes)?"
4195         . ./myread
4196         lseeksize="$ans"
4197 fi
4198 $rm -f try.c try
4199
4200 : see what type file positions are declared as in the library
4201 rp="What is the type for file position used by fsetpos()?"
4202 set fpos_t fpostype long stdio.h sys/types.h
4203 eval $typedef_ask
4204
4205 echo " "
4206 case "$fpostype" in
4207 *_t) zzz="$fpostype"    ;;
4208 *)   zzz="fpos_t"       ;;
4209 esac
4210 $echo $n "Checking the size of $zzz...$c" >&4 
4211 cat > try.c <<EOCP
4212 #include <sys/types.h>
4213 #include <stdio.h>
4214 int main() {
4215     printf("%d\n", (int)sizeof($fpostype));
4216     exit(0);
4217 }
4218 EOCP
4219 set try
4220 if eval $compile_ok; then
4221         yyy=`./try`
4222         case "$yyy" in
4223         '')     fpossize=4
4224                 echo " "
4225                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4226                 ;;
4227         *)      fpossize=$yyy
4228                 echo " $fpossize bytes."
4229                 ;;
4230         esac
4231 else
4232         dflt="$longsize"
4233         echo " "
4234         echo "(I can't compile the test program.  Guessing...)" >&4
4235         rp="What is the size of your file positions (in bytes)?"
4236         . ./myread
4237         fpossize="$ans"
4238 fi
4239
4240
4241
4242 case "$lseeksize:$fpossize" in
4243 8:8) cat <<EOM
4244
4245 You can have files larger than 2 gigabytes.
4246 EOM
4247    val="$define" ;;
4248 *) cat <<EOM
4249
4250 Perl can be built to understand large files (files larger than 2 gigabytes)
4251 on some systems.  To do so, Configure must be run with -Duselargefiles.
4252
4253 If this doesn't make any sense to you, just accept the default 'y'.
4254 EOM
4255    case "$uselargefiles" in
4256    "$undef"|false|[nN]*) dflt='n' ;;
4257    *)   dflt='y' ;;
4258    esac
4259    rp='Try to understand large files, if available?'
4260    . ./myread
4261    case "$ans" in
4262    y|Y)         val="$define" ;;
4263    *)           val="$undef"  ;;
4264    esac
4265    ;;
4266 esac
4267 set uselargefiles
4268 eval $setvar
4269 case "$uselargefiles" in
4270 "$define")
4271 : Look for a hint-file generated 'call-back-unit'.  If the
4272 : user has specified that a large files perl is to be built,
4273 : we may need to set or change some other defaults.
4274         if $test -f uselfs.cbu; then
4275                 echo "Your platform has some specific hints for large file builds, using them..."
4276                 . ./uselfs.cbu
4277                 echo " "
4278                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4279                 $cat >try.c <<EOCP
4280 #include <sys/types.h>
4281 #include <stdio.h>
4282 int main()
4283 {
4284     printf("%d\n", (int)sizeof($lseektype));
4285     return(0); 
4286 }
4287 EOCP
4288                 set try
4289                 if eval $compile_ok; then
4290                         lseeksize=`./try`
4291                         $echo " $lseeksize bytes." >&4
4292                 else
4293                         dflt="$lseeksize"
4294                         echo " "
4295                         echo "(I can't seem to compile the test program.  Guessing...)"
4296                         rp="What is the size of your file offsets (in bytes)?"
4297                         . ./myread
4298                         lseeksize="$ans"
4299                 fi
4300                 case "$fpostype" in
4301                 *_t) zzz="$fpostype"    ;;
4302                 *)   zzz="fpos_t"       ;;
4303                 esac
4304                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4305                 $cat > try.c <<EOCP
4306 #include <sys/types.h>
4307 #include <stdio.h>
4308 int main() {
4309     printf("%d\n", (int)sizeof($fpostype));
4310     exit(0);
4311 }
4312 EOCP
4313                 set try
4314                 if eval $compile_ok; then
4315                         yyy=`./try`
4316                         dflt="$lseeksize"
4317                         case "$yyy" in
4318                         '')     echo " "
4319                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4320                                 ;;
4321                         *)      fpossize=$yyy
4322                                 echo " $fpossize bytes."
4323                                 ;;
4324                         esac
4325                 else
4326                         dflt="$fpossize"
4327                         echo " "
4328                         echo "(I can't compile the test program.  Guessing...)" >&4
4329                         rp="What is the size of your file positions (in bytes)?"
4330                         . ./myread
4331                         fpossize="$ans"
4332                 fi
4333                 $rm -f try.c try
4334         fi
4335         ;;
4336 esac
4337
4338
4339 case "$usemorebits" in
4340 "$define"|true|[yY]*)
4341         use64bits="$define"
4342         uselongdouble="$define"
4343         usemorebits="$define"
4344         ;;
4345 *)      usemorebits="$undef"
4346         ;;
4347 esac
4348
4349
4350 case "$intsize:$longsize" in
4351 8:*|*:8) cat <<EOM
4352
4353 You have natively 64-bit integers.
4354 EOM
4355    val="$define" ;;
4356 *) cat <<EOM
4357
4358 Perl can be built to take advantage of 64-bit integer types
4359 on some systems.  To do so, Configure must be run with -Duse64bits.
4360
4361 If this doesn't make any sense to you, just accept the default.
4362 EOM
4363   case "$use64bits" in
4364   $define|true|[yY]*)   dflt='y';;
4365   *) dflt='n';;
4366   esac
4367   rp='Try to use 64-bit integers, if available?'
4368   . ./myread
4369   case "$ans" in
4370   y|Y) val="$define" ;;
4371   *)   val="$undef"  ;;
4372   esac
4373   ;;
4374 esac
4375 set use64bits
4376 eval $setvar
4377
4378 case "$archname64" in
4379 '') archname64='' ;;    # not a typo
4380 esac
4381
4382 case "$use64bits" in
4383 "$define"|true|[yY]*)
4384 : Look for a hint-file generated 'call-back-unit'.  If the
4385 : user has specified that a 64-bit perl is to be built,
4386 : we may need to set or change some other defaults.
4387         if $test -f use64bits.cbu; then
4388                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4389                 . ./use64bits.cbu
4390         else
4391                 $cat <<EOM
4392 (Your platform doesn't have any specific hints for 64-bit builds.)
4393 EOM
4394                 case "$intsize:$longsize" in
4395 8:*|*:8) cat <<EOM
4396 (This is probably okay, as your system is a natively 64-bit system.)
4397 EOM
4398                   ;;
4399                 esac
4400                 case "$gccversion" in
4401                 '')     ;;
4402                 *)      case "$ccflags" in
4403                         *-DUSE_LONG_LONG*) ;;
4404                         *) $cat <<EOM
4405 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4406 to the compilation flags.
4407 EOM
4408                            ccflags="$ccflags -DUSE_LONG_LONG"
4409                            ;;
4410                         esac
4411                         ;;
4412                 esac
4413         fi
4414         ;;
4415 esac
4416
4417 : determine the architecture name
4418 echo " "
4419 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4420         tarch=`arch`"-$osname"
4421 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4422         if uname -m > tmparch 2>&1 ; then
4423                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4424                         -e 's/$/'"-$osname/" tmparch`
4425         else
4426                 tarch="$osname"
4427         fi
4428         $rm -f tmparch
4429 else
4430         tarch="$osname"
4431 fi
4432 case "$myarchname" in
4433 ''|"$tarch") ;;
4434 *)
4435         echo "(Your architecture name used to be $myarchname.)"
4436         archname=''
4437         ;;
4438 esac
4439 myarchname="$tarch"
4440 case "$archname" in
4441 '') dflt="$tarch";;
4442 *) dflt="$archname";;
4443 esac
4444 rp='What is your architecture name'
4445 . ./myread
4446 archname="$ans"
4447 case "$usethreads" in
4448 $define)
4449         echo "Threads selected." >&4
4450         case "$archname" in
4451         *-thread*) echo "...and architecture name already has -thread." >&4
4452                 ;;
4453         *)      archname="$archname-thread"
4454                 echo "...setting architecture name to $archname." >&4
4455                 ;;
4456         esac
4457         ;;
4458 esac
4459 case "$usemultiplicity" in
4460 $define)
4461         echo "Multiplicity selected." >&4
4462         case "$archname" in
4463         *-multi*) echo "...and architecture name already has -multi." >&4
4464                 ;;
4465         *)      archname="$archname-multi"
4466                 echo "...setting architecture name to $archname." >&4
4467                 ;;
4468         esac
4469         ;;
4470 esac
4471 case "$use64bits" in
4472 $define)
4473         case "$archname64" in
4474         '')
4475                 ;;
4476         *)
4477                 case "$archname" in
4478                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4479                         ;;
4480                 *)      archname="$archname-$archname64"
4481                         echo "...setting architecture name to $archname." >&4
4482                         ;;
4483                 esac
4484                 ;;
4485         esac
4486 esac
4487
4488 : determine root of directory hierarchy where package will be installed.
4489 case "$prefix" in
4490 '')
4491         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4492         ;;
4493 *)
4494         dflt="$prefix"
4495         ;;
4496 esac
4497 $cat <<EOM
4498
4499 By default, $package will be installed in $dflt/bin, manual pages
4500 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4501 installation directories. Typically this is something like /usr/local.
4502 If you wish to have binaries under /usr/bin but other parts of the
4503 installation under /usr/local, that's ok: you will be prompted
4504 separately for each of the installation directories, the prefix being
4505 only used to set the defaults.
4506
4507 EOM
4508 fn=d~
4509 rp='Installation prefix to use?'
4510 . ./getfile
4511 oldprefix=''
4512 case "$prefix" in
4513 '') ;;
4514 *)
4515         case "$ans" in
4516         "$prefix") ;;
4517         *) oldprefix="$prefix";;
4518         esac
4519         ;;
4520 esac
4521 prefix="$ans"
4522 prefixexp="$ansexp"
4523
4524 : is AFS running?
4525 echo " "
4526 case "$afs" in
4527 $define|true)   afs=true ;;
4528 $undef|false)   afs=false ;;
4529 *)      if test -d /afs; then
4530                 afs=true
4531         else
4532                 afs=false
4533         fi
4534         ;;
4535 esac
4536 if $afs; then
4537         echo "AFS may be running... I'll be extra cautious then..." >&4
4538 else
4539         echo "AFS does not seem to be running..." >&4
4540 fi
4541
4542 : determine installation prefix for where package is to be installed.
4543 if $afs; then 
4544 $cat <<EOM
4545
4546 Since you are running AFS, I need to distinguish the directory in which
4547 files will reside from the directory in which they are installed (and from
4548 which they are presumably copied to the former directory by occult means).
4549
4550 EOM
4551         case "$installprefix" in
4552         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4553         *) dflt="$installprefix";;
4554         esac
4555 else
4556 $cat <<EOM
4557
4558 In some special cases, particularly when building $package for distribution,
4559 it is convenient to distinguish between the directory in which files should 
4560 be installed from the directory ($prefix) in which they 
4561 will eventually reside.  For most users, these two directories are the same.
4562
4563 EOM
4564         case "$installprefix" in
4565         '') dflt=$prefix ;;
4566         *) dflt=$installprefix;;
4567         esac
4568 fi
4569 fn=d~
4570 rp='What installation prefix should I use for installing files?'
4571 . ./getfile
4572 installprefix="$ans"
4573 installprefixexp="$ansexp"
4574
4575 : set the prefixit variable, to compute a suitable default value
4576 prefixit='case "$3" in
4577 ""|none)
4578         case "$oldprefix" in
4579         "") eval "$1=\"\$$2\"";;
4580         *)
4581                 case "$3" in
4582                 "") eval "$1=";;
4583                 none)
4584                         eval "tp=\"\$$2\"";
4585                         case "$tp" in
4586                         ""|" ") eval "$1=\"\$$2\"";;
4587                         *) eval "$1=";;
4588                         esac;;
4589                 esac;;
4590         esac;;
4591 *)
4592         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4593         case "$tp" in
4594         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4595         /*-$oldprefix/*|\~*-$oldprefix/*)
4596                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4597         *) eval "$1=\"\$$2\"";;
4598         esac;;
4599 esac'
4600
4601 : set the base revision
4602 baserev=5.0
4603
4604 : get the patchlevel
4605 echo " "
4606 echo "Getting the current patchlevel..." >&4
4607 if $test -r $rsrc/patchlevel.h;then
4608         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4609         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4610         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
4611 else
4612         patchlevel=0
4613         subversion=0
4614         apiversion=0
4615 fi
4616 $echo $n "(You have $package" $c
4617 case "$package" in
4618 "*$baserev")    ;;
4619 *)              $echo $n " $baserev" $c ;;
4620 esac
4621 $echo $n " patchlevel $patchlevel" $c
4622 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4623 echo ".)"
4624
4625 if test 0 -eq "$subversion"; then
4626         version=`LC_ALL=C; export LC_ALL; \
4627                  echo $baserev $patchlevel | \
4628                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
4629 else
4630         version=`LC_ALL=C; export LC_ALL; \
4631                  echo $baserev $patchlevel $subversion | \
4632                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
4633 fi
4634
4635 : determine installation style
4636 : For now, try to deduce it from prefix unless it is already set.
4637 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4638 case "$installstyle" in
4639 '')     case "$prefix" in
4640                 *perl*) dflt='lib';;
4641                 *) dflt='lib/perl5' ;;
4642         esac
4643         ;;
4644 *)      dflt='lib/perl5' ;;
4645 esac
4646 : Probably not worth prompting for this since we prompt for all
4647 : the directories individually, and the prompt would be too long and
4648 : confusing anyway.
4649 installstyle=$dflt
4650
4651 : determine where private library files go
4652 : Usual default is /usr/local/lib/perl5/$version.
4653 : Also allow things like /opt/perl/lib/$version, since 
4654 : /opt/perl/lib/perl5... would be redundant.
4655 : The default "style" setting is made in installstyle.U
4656 case "$installstyle" in
4657 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4658 *)       set dflt privlib lib/$version ;;
4659 esac
4660 eval $prefixit
4661 $cat <<EOM
4662
4663 There are some auxiliary files for $package that need to be put into a
4664 private library directory that is accessible by everyone.
4665
4666 EOM
4667 fn=d~+
4668 rp='Pathname where the private library files will reside?'
4669 . ./getfile
4670 privlib="$ans"
4671 privlibexp="$ansexp"
4672 : Change installation prefix, if necessary.
4673 if $test X"$prefix" != X"$installprefix"; then
4674         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4675 else
4676         installprivlib="$privlibexp"
4677 fi
4678
4679 : set the prefixup variable, to restore leading tilda escape
4680 prefixup='case "$prefixexp" in
4681 "$prefix") ;;
4682 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4683 esac'
4684
4685 : determine where public architecture dependent libraries go
4686 set archlib archlib
4687 eval $prefixit
4688 : privlib default is /usr/local/lib/$package/$version
4689 : archlib default is /usr/local/lib/$package/$version/$archname
4690 : privlib may have an optional trailing /share.
4691 tdflt=`echo $privlib | $sed 's,/share$,,'`
4692 tdflt=$tdflt/$archname
4693 case "$archlib" in
4694 '')     dflt=$tdflt
4695         ;;
4696 *)      dflt="$archlib"
4697     ;;
4698 esac
4699 $cat <<EOM
4700
4701 $spackage contains architecture-dependent library files.  If you are
4702 sharing libraries in a heterogeneous environment, you might store
4703 these files in a separate location.  Otherwise, you can just include
4704 them with the rest of the public library files.
4705
4706 EOM
4707 fn=d+~
4708 rp='Where do you want to put the public architecture-dependent libraries?'
4709 . ./getfile
4710 archlib="$ans"
4711 archlibexp="$ansexp"
4712 if $test X"$archlib" = X"$privlib"; then
4713         d_archlib="$undef"
4714 else
4715         d_archlib="$define"
4716 fi
4717 : Change installation prefix, if necessary.
4718 if $test X"$prefix" != X"$installprefix"; then
4719         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4720 else
4721         installarchlib="$archlibexp"
4722 fi
4723
4724
4725 : Binary compatibility with 5.005 is not possible for builds
4726 : with advanced features
4727 case "$usethreads$usemultiplicity" in
4728 *define*)
4729         bincompat5005="$undef"
4730         d_bincompat5005="$undef"
4731         ;;
4732 *)      $cat <<EOM
4733
4734 Perl 5.006 can be compiled for binary compatibility with 5.005.
4735 If you decide to do so, you will be able to continue using most
4736 of the extensions that were compiled for Perl 5.005.
4737
4738 EOM
4739         case "$bincompat5005$d_bincompat5005" in
4740         *"$undef"*) dflt=n ;;
4741         *) dflt=y ;;
4742         esac
4743         rp='Binary compatibility with Perl 5.005?'
4744         . ./myread
4745         case "$ans" in
4746         y*) val="$define" ;;
4747         *)  val="$undef" ;;
4748         esac
4749         set d_bincompat5005
4750         eval $setvar
4751         case "$d_bincompat5005" in
4752         "$define")
4753                 bincompat5005="$define"
4754                 ;;
4755         *)      bincompat5005="$undef"
4756                 d_bincompat5005="$undef"
4757                 ;;
4758         esac
4759         ;;
4760 esac
4761
4762
4763 : see if setuid scripts can be secure
4764 $cat <<EOM
4765
4766 Some kernels have a bug that prevents setuid #! scripts from being
4767 secure.  Some sites have disabled setuid #! scripts because of this.
4768
4769 First let's decide if your kernel supports secure setuid #! scripts.
4770 (If setuid #! scripts would be secure but have been disabled anyway,
4771 don't say that they are secure if asked.)
4772
4773 EOM
4774
4775 val="$undef"
4776 if $test -d /dev/fd; then
4777         echo "#!$ls" >reflect
4778         chmod +x,u+s reflect
4779         ./reflect >flect 2>&1
4780         if $contains "/dev/fd" flect >/dev/null; then
4781                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4782                 val="$define"
4783         else
4784                 $cat <<EOM
4785 If you are not sure if they are secure, I can check but I'll need a
4786 username and password different from the one you are using right now.
4787 If you don't have such a username or don't want me to test, simply
4788 enter 'none'.
4789
4790 EOM
4791                 rp='Other username to test security of setuid scripts with?'
4792                 dflt='none'
4793                 . ./myread
4794                 case "$ans" in
4795                 n|none)
4796                         case "$d_suidsafe" in
4797                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4798                                 dflt=n;;
4799                         "$undef")
4800                                 echo "Well, the $hint value is *not* secure." >&4
4801                                 dflt=n;;
4802                         *)      echo "Well, the $hint value *is* secure." >&4
4803                                 dflt=y;;
4804                         esac
4805                         ;;
4806                 *)
4807                         $rm -f reflect flect
4808                         echo "#!$ls" >reflect
4809                         chmod +x,u+s reflect
4810                         echo >flect
4811                         chmod a+w flect
4812                         echo '"su" will (probably) prompt you for '"$ans's password."
4813                         su $ans -c './reflect >flect'
4814                         if $contains "/dev/fd" flect >/dev/null; then
4815                                 echo "Okay, it looks like setuid scripts are secure." >&4
4816                                 dflt=y
4817                         else
4818                                 echo "I don't think setuid scripts are secure." >&4
4819                                 dflt=n
4820                         fi
4821                         ;;
4822                 esac
4823                 rp='Does your kernel have *secure* setuid scripts?'
4824                 . ./myread
4825                 case "$ans" in
4826                 [yY]*)  val="$define";;
4827                 *)      val="$undef";;
4828                 esac
4829         fi
4830 else
4831         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4832         echo "(That's for file descriptors, not floppy disks.)"
4833         val="$undef"
4834 fi
4835 set d_suidsafe
4836 eval $setvar
4837
4838 $rm -f reflect flect
4839
4840 : now see if they want to do setuid emulation
4841 echo " "
4842 val="$undef"
4843 case "$d_suidsafe" in
4844 "$define")
4845         val="$undef"
4846         echo "No need to emulate SUID scripts since they are secure here." >& 4
4847         ;;
4848 *)
4849         $cat <<EOM
4850 Some systems have disabled setuid scripts, especially systems where
4851 setuid scripts cannot be secure.  On systems where setuid scripts have
4852 been disabled, the setuid/setgid bits on scripts are currently
4853 useless.  It is possible for $package to detect those bits and emulate
4854 setuid/setgid in a secure fashion.  This emulation will only work if
4855 setuid scripts have been disabled in your kernel.
4856
4857 EOM
4858         case "$d_dosuid" in
4859         "$define") dflt=y ;;
4860         *) dflt=n ;;
4861         esac
4862         rp="Do you want to do setuid/setgid emulation?"
4863         . ./myread
4864         case "$ans" in
4865         [yY]*)  val="$define";;
4866         *)      val="$undef";;
4867         esac
4868         ;;
4869 esac
4870 set d_dosuid
4871 eval $setvar
4872
4873 : determine filename position in cpp output
4874 echo " "
4875 echo "Computing filename position in cpp output for #include directives..." >&4
4876 echo '#include <stdio.h>' > foo.c
4877 $cat >fieldn <<EOF
4878 $startsh
4879 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4880 $grep '^[       ]*#.*stdio\.h' | \
4881 while read cline; do
4882         pos=1
4883         set \$cline
4884         while $test \$# -gt 0; do
4885                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4886                         echo "\$pos"
4887                         exit 0
4888                 fi
4889                 shift
4890                 pos=\`expr \$pos + 1\`
4891         done
4892 done
4893 EOF
4894 chmod +x fieldn
4895 fieldn=`./fieldn`
4896 $rm -f foo.c fieldn
4897 case $fieldn in
4898 '') pos='???';;
4899 1) pos=first;;
4900 2) pos=second;;
4901 3) pos=third;;
4902 *) pos="${fieldn}th";;
4903 esac
4904 echo "Your cpp writes the filename in the $pos field of the line."
4905
4906 : locate header file
4907 $cat >findhdr <<EOF
4908 $startsh
4909 wanted=\$1
4910 name=''
4911 for usrincdir in $usrinc
4912 do
4913         if test -f \$usrincdir/\$wanted; then
4914                 echo "\$usrincdir/\$wanted"
4915                 exit 0
4916         fi
4917 done
4918 awkprg='{ print \$$fieldn }'
4919 echo "#include <\$wanted>" > foo\$\$.c
4920 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4921 $grep "^[       ]*#.*\$wanted" | \
4922 while read cline; do
4923         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4924         case "\$name" in
4925         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4926         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4927         *) exit 2;;
4928         esac;
4929 done;
4930 #
4931 # status = 0: grep returned 0 lines, case statement not executed
4932 # status = 1: headerfile found
4933 # status = 2: while loop executed, no headerfile found
4934 #
4935 status=\$?
4936 $rm -f foo\$\$.c;
4937 if test \$status -eq 1; then
4938         exit 0;
4939 fi
4940 exit 1
4941 EOF
4942 chmod +x findhdr
4943
4944 : define an alternate in-header-list? function
4945 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4946 cont=true; xxf="echo \"<\$1> found.\" >&4";
4947 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4948 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4949 esac;
4950 case $# in 4) instead=instead;; *) instead="at last";; esac;
4951 while $test "$cont"; do
4952         xxx=`./findhdr $1`
4953         var=$2; eval "was=\$$2";
4954         if $test "$xxx" && $test -r "$xxx";
4955         then eval $xxf;
4956         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4957                 cont="";
4958         else eval $xxnf;
4959         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4960         set $yyy; shift; shift; yyy=$@;
4961         case $# in 0) cont="";;
4962         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4963                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4964         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4965                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4966         esac;
4967 done;
4968 while $test "$yyy";
4969 do set $yyy; var=$2; eval "was=\$$2";
4970         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4971         set $yyy; shift; shift; yyy=$@;
4972 done'
4973
4974 : see if this is a malloc.h system
4975 set malloc.h i_malloc
4976 eval $inhdr
4977
4978 : see if stdlib is available
4979 set stdlib.h i_stdlib
4980 eval $inhdr
4981
4982 : determine which malloc to compile in
4983 echo " "
4984 case "$usemymalloc" in
4985 ''|[yY]*|true|$define)  dflt='y' ;;
4986 *)      dflt='n' ;;
4987 esac
4988 rp="Do you wish to attempt to use the malloc that comes with $package?"
4989 . ./myread
4990 usemymalloc="$ans"
4991 case "$ans" in
4992 y*|true)
4993         usemymalloc='y'
4994         mallocsrc='malloc.c'
4995         mallocobj="malloc$_o"
4996         d_mymalloc="$define"
4997         case "$libs" in
4998         *-lmalloc*)
4999                 : Remove malloc from list of libraries to use
5000                 echo "Removing unneeded -lmalloc from library list" >&4
5001                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5002                 shift
5003                 libs="$*"
5004                 echo "libs = $libs" >&4
5005                 ;;
5006         esac
5007         ;;
5008 *)
5009         usemymalloc='n'
5010         mallocsrc=''
5011         mallocobj=''
5012         d_mymalloc="$undef"
5013         ;;
5014 esac
5015
5016 : compute the return types of malloc and free
5017 echo " "
5018 $cat >malloc.c <<END
5019 #$i_malloc I_MALLOC
5020 #$i_stdlib I_STDLIB
5021 #include <stdio.h>
5022 #include <sys/types.h>
5023 #ifdef I_MALLOC
5024 #include <malloc.h>
5025 #endif
5026 #ifdef I_STDLIB
5027 #include <stdlib.h>
5028 #endif
5029 #ifdef TRY_MALLOC
5030 void *malloc();
5031 #endif
5032 #ifdef TRY_FREE
5033 void free();
5034 #endif
5035 END
5036 case "$malloctype" in
5037 '')
5038         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5039                 malloctype='void *'
5040         else
5041                 malloctype='char *'
5042         fi
5043         ;;
5044 esac
5045 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5046
5047 case "$freetype" in
5048 '')
5049         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5050                 freetype='void'
5051         else
5052                 freetype='int'
5053         fi
5054         ;;
5055 esac
5056 echo "Your system uses $freetype free(), it would seem." >&4
5057 $rm -f malloc.[co]
5058 $cat <<EOM
5059
5060 The installation process will also create a directory for
5061 vendor-supplied add-ons.  Vendors who supply perl with their system
5062 may find it convenient to place all vendor-supplied files in this
5063 directory rather than in the main distribution directory.  This will
5064 ease upgrades between binary-compatible maintenance versions of perl.
5065
5066 Of course you may also use these directories in whatever way you see
5067 fit.  For example, you might use them to access modules shared over a
5068 company-wide network.
5069
5070 The default answer should be fine for most people.
5071 This causes further questions about vendor add-ons to be skipped
5072 and no vendor-specific directories will be configured for perl.
5073
5074 EOM
5075 rp='Do you want to configure vendor-specific add-on directories?'
5076 case "$usevendorprefix" in
5077 define|true|[yY]*) dflt=y ;;
5078 *) dflt=n ;;
5079 esac
5080 . ./myread
5081 case "$ans" in
5082 [yY]*)  fn=d~+
5083         rp='Installation prefix to use for vendor-supplied add-ons?'
5084         case "$vendorprefix" in
5085         '') dflt='' ;;
5086         *)  dflt=$vendorprefix ;;
5087         esac
5088         . ./getfile
5089         oldvendorprefix=''
5090         case "$vendorprefix" in
5091         '') ;;
5092         *)      case "$ans" in
5093                 "$prefix") ;;
5094                 *) oldvendorprefix="$prefix";;
5095                 esac
5096                 ;;
5097         esac
5098         usevendorprefix="$define"
5099         vendorprefix="$ans"
5100         vendorprefixexp="$ansexp"
5101         ;;
5102 *)      usevendorprefix="$undef"
5103         vendorprefix=''
5104         vendorprefixexp=''
5105         ;;
5106 esac
5107
5108 case "$vendorprefix" in
5109 '')     d_vendorlib="$undef"
5110         vendorlib=''
5111         vendorlibexp=''
5112         ;;
5113 *)      d_vendorlib="$define"
5114         : determine where vendor-supplied modules go.
5115         : Usual default is /usr/local/lib/perl5/vendor_perl
5116         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5117         case "$installstyle" in
5118         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
5119         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
5120         esac
5121         fn=d~+
5122         rp='Pathname for the vendor-supplied library files?'
5123         . ./getfile
5124         vendorlib="$ans"
5125         vendorlibexp="$ansexp"
5126         : Change installation prefix, if necessary.
5127         if $test X"$prefix" != X"$installprefix"; then
5128                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5129         else
5130                 installvendorlib="$vendorlibexp"
5131         fi
5132         ;;
5133 esac
5134
5135 : Cruising for prototypes
5136 echo " "
5137 echo "Checking out function prototypes..." >&4
5138 $cat >prototype.c <<'EOCP'
5139 int main(int argc, char *argv[]) {
5140         exit(0);}
5141 EOCP
5142 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5143         echo "Your C compiler appears to support function prototypes."
5144         val="$define"
5145 else
5146         echo "Your C compiler doesn't seem to understand function prototypes."
5147         val="$undef"
5148 fi
5149 set prototype
5150 eval $setvar
5151 $rm -f prototype*
5152
5153 case "$prototype" in
5154 "$define") ;;
5155 *)      ansi2knr='ansi2knr'
5156         echo " "
5157         cat <<EOM >&4
5158
5159 $me:  FATAL ERROR:
5160 This version of $package can only be compiled by a compiler that 
5161 understands function prototypes.  Unfortunately, your C compiler 
5162         $cc $ccflags
5163 doesn't seem to understand them.  Sorry about that.
5164
5165 If GNU cc is available for your system, perhaps you could try that instead.  
5166
5167 Eventually, we hope to support building Perl with pre-ANSI compilers.
5168 If you would like to help in that effort, please contact <perlbug@perl.org>.
5169
5170 Aborting Configure now.
5171 EOM
5172         exit 2
5173         ;;
5174 esac
5175
5176 : determine where public executables go
5177 echo " "
5178 set dflt bin bin
5179 eval $prefixit
5180 fn=d~
5181 rp='Pathname where the public executables will reside?'
5182 . ./getfile
5183 if $test "X$ansexp" != "X$binexp"; then
5184         installbin=''
5185 fi
5186 bin="$ans"
5187 binexp="$ansexp"
5188 : Change installation prefix, if necessary.
5189 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5190 if $test X"$prefix" != X"$installprefix"; then
5191         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5192 else
5193         installbin="$binexp"
5194 fi
5195
5196 : determine whether to install perl also as /usr/bin/perl
5197
5198 echo " "
5199 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5200         $cat <<EOM
5201 Many scripts expect to perl to be installed as /usr/bin/perl.
5202 I can install the perl you are about to compile also as /usr/bin/perl
5203 (in addition to $installbin/perl).
5204 EOM
5205         case "$installusrbinperl" in
5206         "$undef"|[nN]*) dflt='n';;
5207         *)              dflt='y';;
5208         esac
5209         rp="Do you want to install perl as /usr/bin/perl?"
5210         . ./myread
5211         case "$ans" in
5212         [yY]*)  val="$define";;
5213         *)      val="$undef" ;;
5214         esac
5215 else
5216         val="$undef"
5217 fi
5218 set installusrbinperl
5219 eval $setvar
5220
5221 echo " "
5222 echo "Checking for GNU C Library..." >&4
5223 cat >gnulibc.c <<EOM
5224 #include <stdio.h>
5225 int main()
5226 {
5227 #ifdef __GLIBC__
5228     exit(0);
5229 #else
5230     exit(1);
5231 #endif
5232 }
5233 EOM
5234 set gnulibc
5235 if eval $compile_ok && ./gnulibc; then
5236         val="$define"
5237         echo "You are using the GNU C Library"
5238 else
5239         val="$undef"
5240         echo "You are not using the GNU C Library"
5241 fi
5242 $rm -f gnulibc*
5243 set d_gnulibc
5244 eval $setvar
5245
5246 : see if nm is to be used to determine whether a symbol is defined or not
5247 case "$usenm" in
5248 '')
5249         dflt=''
5250         case "$d_gnulibc" in
5251         "$define")
5252                 echo " "
5253                 echo "nm probably won't work on the GNU C Library." >&4
5254                 dflt=n
5255                 ;;
5256         esac
5257         case "$dflt" in
5258         '') 
5259                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5260                         echo " "
5261                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5262                         echo "'nm' won't be sufficient on this sytem." >&4
5263                         dflt=n
5264                 fi
5265                 ;;
5266         esac
5267         case "$dflt" in
5268         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5269                 if $test $dflt -gt 20; then
5270                         dflt=y
5271                 else
5272                         dflt=n
5273                 fi
5274                 ;;
5275         esac
5276         ;;
5277 *)
5278         case "$usenm" in
5279         true|$define) dflt=y;;
5280         *) dflt=n;;
5281         esac
5282         ;;
5283 esac
5284 $cat <<EOM
5285
5286 I can use $nm to extract the symbols from your C libraries. This
5287 is a time consuming task which may generate huge output on the disk (up
5288 to 3 megabytes) but that should make the symbols extraction faster. The
5289 alternative is to skip the 'nm' extraction part and to compile a small
5290 test program instead to determine whether each symbol is present. If
5291 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5292 this may be the best solution.
5293
5294 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5295
5296 EOM
5297 rp="Shall I use $nm to extract C symbols from the libraries?"
5298 . ./myread
5299 case "$ans" in
5300 [Nn]*) usenm=false;;
5301 *) usenm=true;;
5302 esac
5303
5304 runnm=$usenm
5305 case "$reuseval" in
5306 true) runnm=false;;
5307 esac
5308
5309 : nm options which may be necessary
5310 case "$nm_opt" in
5311 '') if $test -f /mach_boot; then
5312                 nm_opt=''       # Mach
5313         elif $test -d /usr/ccs/lib; then
5314                 nm_opt='-p'     # Solaris (and SunOS?)
5315         elif $test -f /dgux; then
5316                 nm_opt='-p'     # DG-UX
5317         elif $test -f /lib64/rld; then
5318                 nm_opt='-p'     # 64-bit Irix
5319         else
5320                 nm_opt=''
5321         fi;;
5322 esac
5323
5324 : nm options which may be necessary for shared libraries but illegal
5325 : for archive libraries.  Thank you, Linux.
5326 case "$nm_so_opt" in
5327 '')     case "$myuname" in
5328         *linux*)
5329                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5330                         nm_so_opt='--dynamic'
5331                 fi
5332                 ;;
5333         esac
5334         ;;
5335 esac
5336
5337 case "$runnm" in
5338 true)
5339 : get list of predefined functions in a handy place
5340 echo " "
5341 case "$libc" in
5342 '') libc=unknown
5343         case "$libs" in
5344         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5345         esac
5346         ;;
5347 esac
5348 libnames='';
5349 case "$libs" in
5350 '') ;;
5351 *)  for thislib in $libs; do
5352         case "$thislib" in
5353         -lc|-lc_s)
5354                 : Handle C library specially below.
5355                 ;;
5356         -l*)
5357                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5358                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5359                         :
5360                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5361                         :
5362                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5363                         :
5364                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5365                         :
5366                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5367                         :
5368                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5369                         :
5370                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5371                         :
5372                 else
5373                         try=''
5374                 fi
5375                 libnames="$libnames $try"
5376                 ;;
5377         *) libnames="$libnames $thislib" ;;
5378         esac
5379         done
5380         ;;
5381 esac
5382 xxx=normal
5383 case "$libc" in
5384 unknown)
5385         set /lib/libc.$so
5386         for xxx in $libpth; do
5387                 $test -r $1 || set $xxx/libc.$so
5388                 : The messy sed command sorts on library version numbers.
5389                 $test -r $1 || \
5390                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5391                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5392                                 h
5393                                 s/[0-9][0-9]*/0000&/g
5394                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5395                                 G
5396                                 s/\n/ /' | \
5397                          sort | $sed -e 's/^.* //'`
5398                 eval set \$$#
5399         done
5400         $test -r $1 || set /usr/ccs/lib/libc.$so
5401         $test -r $1 || set /lib/libsys_s$_a
5402         ;;
5403 *)
5404         set blurfl
5405         ;;
5406 esac
5407 if $test -r "$1"; then
5408         echo "Your (shared) C library seems to be in $1."
5409         libc="$1"
5410 elif $test -r /lib/libc && $test -r /lib/clib; then
5411         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5412         xxx=apollo
5413         libc='/lib/clib /lib/libc'
5414         if $test -r /lib/syslib; then
5415                 echo "(Your math library is in /lib/syslib.)"
5416                 libc="$libc /lib/syslib"
5417         fi
5418 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5419         echo "Your C library seems to be in $libc, as you said before."
5420 elif $test -r $incpath/usr/lib/libc$_a; then
5421         libc=$incpath/usr/lib/libc$_a;
5422         echo "Your C library seems to be in $libc.  That's fine."
5423 elif $test -r /lib/libc$_a; then
5424         libc=/lib/libc$_a;
5425         echo "Your C library seems to be in $libc.  You're normal."
5426 else
5427         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5428                 :
5429         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5430                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5431         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5432                 :
5433         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5434                 :
5435         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5436                 :
5437         else
5438                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5439         fi
5440         if $test -r "$tans"; then
5441                 echo "Your C library seems to be in $tans, of all places."
5442                 libc=$tans
5443         else
5444                 libc='blurfl'
5445         fi
5446 fi
5447 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5448         dflt="$libc"
5449         cat <<EOM
5450
5451 If the guess above is wrong (which it might be if you're using a strange
5452 compiler, or your machine supports multiple models), you can override it here.
5453
5454 EOM
5455 else
5456         dflt=''
5457         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5458         cat >&4 <<EOM
5459 I can't seem to find your C library.  I've looked in the following places:
5460
5461 EOM
5462         $sed 's/^/      /' libpath
5463         cat <<EOM
5464
5465 None of these seems to contain your C library. I need to get its name...
5466
5467 EOM
5468 fi
5469 fn=f
5470 rp='Where is your C library?'
5471 . ./getfile
5472 libc="$ans"
5473
5474 echo " "
5475 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5476 set X `cat libnames`
5477 shift
5478 xxx=files
5479 case $# in 1) xxx=file; esac
5480 echo "Extracting names from the following $xxx for later perusal:" >&4
5481 echo " "
5482 $sed 's/^/      /' libnames >&4
5483 echo " "
5484 $echo $n "This may take a while...$c" >&4
5485
5486 for file in $*; do
5487         case $file in
5488         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5489         *) $nm $nm_opt $file 2>/dev/null;;
5490         esac
5491 done >libc.tmp
5492
5493 $echo $n ".$c"
5494 $grep fprintf libc.tmp > libc.ptf
5495 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5496 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5497 xxx='[ADTSIW]'
5498 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5499         eval $xscan;\
5500         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5501                 eval $xrun
5502 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5503         eval $xscan;\
5504         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5505                 eval $xrun
5506 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5507         eval $xscan;\
5508         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5509                 eval $xrun
5510 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5511         eval $xscan;\
5512         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5513                 eval $xrun
5514 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5515         eval $xscan;\
5516         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5517                 eval $xrun
5518 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5519         eval $xscan;\
5520         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5521                 eval $xrun
5522 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5523                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5524         eval $xscan;\
5525         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5526                 eval $xrun
5527 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5528         eval $xscan;\
5529         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5530                 eval $xrun
5531 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5532         eval $xscan;\
5533         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5534                 eval $xrun
5535 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5536         eval $xscan;\
5537         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5538                 eval $xrun
5539 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5540         eval $xscan;\
5541         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5542                 eval $xrun
5543 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5544         eval $xscan;\
5545         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5546                 eval $xrun
5547 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5548         eval $xscan;\
5549         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5550                 eval $xrun
5551 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5552         eval $xscan;\
5553         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5554                 eval $xrun
5555 else
5556         $nm -p $* 2>/dev/null >libc.tmp
5557         $grep fprintf libc.tmp > libc.ptf
5558         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5559                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5560         then
5561                 nm_opt='-p'
5562                 eval $xrun
5563         else
5564                 echo " "
5565                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5566                 com=''
5567                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5568                         for thisname in $libnames $libc; do
5569                                 $ar t $thisname >>libc.tmp
5570                         done
5571                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5572                         echo "Ok." >&4
5573                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5574                         # Repeat libc to extract forwarders to DLL entries too
5575                         for thisname in $libnames $libc; do
5576                                 $ar tv $thisname >>libc.tmp
5577                                 # Revision 50 of EMX has bug in $ar.
5578                                 # it will not extract forwarders to DLL entries
5579                                 # Use emximp which will extract exactly them.
5580                                 emximp -o tmp.imp $thisname \
5581                                     2>/dev/null && \
5582                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5583                                     < tmp.imp >>libc.tmp
5584                                 $rm tmp.imp
5585                         done
5586                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5587                         echo "Ok." >&4
5588                 else
5589                         echo "$ar didn't seem to work right." >&4
5590                         echo "Maybe this is a Cray...trying bld instead..." >&4
5591                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5592                         then
5593                                 for thisname in $libnames; do
5594                                         bld t $libnames | \
5595                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5596                                         $ar t $thisname >>libc.tmp
5597                                 done
5598                                 echo "Ok." >&4
5599                         else
5600                                 echo "That didn't work either.  Giving up." >&4
5601                                 exit 1
5602                         fi
5603                 fi
5604         fi
5605 fi
5606 nm_extract="$com"
5607 if $test -f /lib/syscalls.exp; then
5608         echo " "
5609         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5610         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5611 fi
5612 ;;
5613 esac
5614 $rm -f libnames libpath
5615
5616 : see if dld is available
5617 set dld.h i_dld
5618 eval $inhdr
5619
5620 : is a C symbol defined?
5621 csym='tlook=$1;
5622 case "$3" in
5623 -v) tf=libc.tmp; tc=""; tdc="";;
5624 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5625 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5626 esac;
5627 tx=yes;
5628 case "$reuseval-$4" in
5629 true-) ;;
5630 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5631 esac;
5632 case "$tx" in
5633 yes)
5634         case "$runnm" in
5635         true)
5636                 if $contains $tlook $tf >/dev/null 2>&1;
5637                 then tval=true;
5638                 else tval=false;
5639                 fi;;
5640         *)
5641                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5642                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5643                 then tval=true;
5644                 else tval=false;
5645                 fi;
5646                 $rm -f t t.c;;
5647         esac;;
5648 *)
5649         case "$tval" in
5650         $define) tval=true;;
5651         *) tval=false;;
5652         esac;;
5653 esac;
5654 eval "$2=$tval"'
5655
5656 : define an is-in-libc? function
5657 inlibc='echo " "; td=$define; tu=$undef;
5658 sym=$1; var=$2; eval "was=\$$2";
5659 tx=yes;
5660 case "$reuseval$was" in
5661 true) ;;
5662 true*) tx=no;;
5663 esac;
5664 case "$tx" in
5665 yes)
5666         set $sym tres -f;
5667         eval $csym;
5668         case "$tres" in
5669         true)
5670                 echo "$sym() found." >&4;
5671                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5672         *)
5673                 echo "$sym() NOT found." >&4;
5674                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5675         esac;;
5676 *)
5677         case "$was" in
5678         $define) echo "$sym() found." >&4;;
5679         *) echo "$sym() NOT found." >&4;;
5680         esac;;
5681 esac'
5682
5683 : see if dlopen exists
5684 xxx_runnm="$runnm"
5685 runnm=false
5686 set dlopen d_dlopen
5687 eval $inlibc
5688 runnm="$xxx_runnm"
5689
5690 : determine which dynamic loading, if any, to compile in
5691 echo " "
5692 dldir="ext/DynaLoader"
5693 case "$usedl" in
5694 $define|y|true)
5695         dflt='y'
5696         usedl="$define"
5697         ;;
5698 $undef|n|false)
5699         dflt='n'
5700         usedl="$undef"
5701         ;;
5702 *) 
5703         dflt='n'
5704         case "$d_dlopen" in
5705             $define) dflt='y' ;;
5706         esac
5707         case "$i_dld" in
5708             $define) dflt='y' ;;
5709         esac
5710         : Does a dl_xxx.xs file exist for this operating system
5711         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5712         ;;
5713 esac
5714 rp="Do you wish to use dynamic loading?"
5715 . ./myread
5716 usedl="$ans"
5717 case "$ans" in
5718 y*) usedl="$define"
5719         case "$dlsrc" in
5720         '')
5721                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5722                         dflt="$dldir/dl_${osname}.xs"
5723                 elif $test "$d_dlopen" = "$define" ; then
5724                         dflt="$dldir/dl_dlopen.xs"
5725                 elif $test "$i_dld" = "$define" ; then
5726                         dflt="$dldir/dl_dld.xs"
5727                 else
5728                         dflt=''
5729                 fi
5730                 ;;
5731         *)      dflt="$dldir/$dlsrc"
5732                 ;;
5733         esac
5734     echo "The following dynamic loading files are available:"
5735         : Can not go over to $dldir because getfile has path hard-coded in.
5736         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5737         rp="Source file to use for dynamic loading"
5738         fn="fne"
5739         gfpth="$src"
5740         . ./getfile
5741         usedl="$define"
5742         : emulate basename
5743         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5744
5745         $cat << EOM
5746
5747 Some systems may require passing special flags to $cc -c to
5748 compile modules that will be used to create a shared library.
5749 To use no flags, say "none".
5750
5751 EOM
5752     case "$cccdlflags" in
5753     '') case "$gccversion" in
5754                 '') case "$osname" in
5755                         hpux)   dflt='+z' ;;
5756                         next)   dflt='none' ;;
5757                         irix*)  dflt='-KPIC' ;;
5758                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5759                         sunos)  dflt='-pic' ;;
5760                         *)      dflt='none' ;;
5761                     esac
5762                         ;;
5763                 *)  case "$osname" in
5764                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5765                         *)      dflt='-fpic' ;;
5766                     esac ;;
5767             esac ;;
5768         ' ') dflt='none' ;;
5769     *)  dflt="$cccdlflags" ;;
5770     esac
5771     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5772     . ./myread
5773     case "$ans" in
5774     none) cccdlflags=' ' ;;
5775     *) cccdlflags="$ans" ;;
5776     esac
5777
5778     cat << EOM
5779
5780 Some systems use ld to create libraries that can be dynamically loaded,
5781 while other systems (such as those using ELF) use $cc.
5782
5783 EOM
5784         case "$ld" in
5785         '')     $cat >try.c <<'EOM'
5786 /* Test for whether ELF binaries are produced */
5787 #include <fcntl.h>
5788 #include <stdlib.h>
5789 int main() {
5790         char b[4];
5791         int i = open("a.out",O_RDONLY);
5792         if(i == -1) 
5793                 exit(1); /* fail */
5794         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5795                 exit(0); /* succeed (yes, it's ELF) */
5796         else
5797                 exit(1); /* fail */
5798 }
5799 EOM
5800                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5801                         cat <<EOM
5802 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5803 EOM
5804                         dflt="$cc"
5805                 else
5806                         echo "I'll use ld to build dynamic libraries."
5807                         dflt='ld'
5808                 fi
5809                 rm -f try.c a.out
5810                 ;;
5811         *)      dflt="$ld"
5812                 ;;
5813         esac
5814
5815     rp="What command should be used to create dynamic libraries?"
5816     . ./myread
5817         ld="$ans"
5818
5819     cat << EOM
5820
5821 Some systems may require passing special flags to $ld to create a
5822 library that can be dynamically loaded.  If your ld flags include
5823 -L/other/path options to locate libraries outside your loader's normal
5824 search path, you may need to specify those -L options here as well.  To
5825 use no flags, say "none".
5826
5827 EOM
5828     case "$lddlflags" in
5829     '') case "$osname" in
5830                         beos) dflt='-nostart' ;;
5831                         hpux)  dflt='-b' ;;
5832                         linux|irix*)    dflt='-shared' ;;
5833                         next)  dflt='none' ;;
5834                         solaris) dflt='-G' ;;
5835                         sunos) dflt='-assert nodefinitions' ;;
5836                         svr4*|esix*) dflt="-G $ldflags" ;;
5837                 *)     dflt='none' ;;
5838                         esac
5839                         ;;
5840     *) dflt="$lddlflags" ;;
5841     esac
5842
5843         : Try to guess additional flags to pick up local libraries.
5844         : Be careful not to append to a plain 'none'
5845         case "$dflt" in
5846         none) dflt='' ;;
5847         esac
5848         for thisflag in $ldflags; do
5849                 case "$thisflag" in
5850                 -L*)
5851                         case " $dflt " in
5852                         *" $thisflag "*) ;;
5853                         *) dflt="$dflt $thisflag" ;;
5854                         esac
5855                         ;;
5856                 esac
5857         done
5858
5859         case "$dflt" in
5860         ''|' ') dflt='none' ;;
5861         esac
5862
5863     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5864     . ./myread
5865     case "$ans" in
5866     none) lddlflags=' ' ;;
5867     *) lddlflags="$ans" ;;
5868     esac
5869
5870         cat <<EOM
5871
5872 Some systems may require passing special flags to $cc to indicate that
5873 the resulting executable will use dynamic linking.  To use no flags,
5874 say "none".
5875
5876 EOM
5877     case "$ccdlflags" in
5878     '') case "$osname" in
5879                 hpux)   dflt='-Wl,-E' ;;
5880                 linux)  dflt='-rdynamic' ;;
5881                 next)   dflt='none' ;;
5882                 sunos)  dflt='none' ;;
5883                 *)      dflt='none' ;;
5884             esac ;;
5885     ' ')  dflt='none' ;;
5886     *)  dflt="$ccdlflags" ;;
5887     esac
5888     rp="Any special flags to pass to $cc to use dynamic loading?"
5889     . ./myread
5890     case "$ans" in
5891     none) ccdlflags=' ' ;;
5892     *) ccdlflags="$ans" ;;
5893     esac
5894     ;;
5895 *)  usedl="$undef"
5896         ld='ld'
5897     dlsrc='dl_none.xs'
5898     lddlflags=''
5899     ccdlflags=''
5900     ;;
5901 esac
5902
5903 also=''
5904 case "$usedl" in
5905 $undef)
5906         # No dynamic loading being used, so don't bother even to prompt.
5907         useshrplib='false'
5908         ;;
5909 *)      case "$useshrplib" in
5910         '')     case "$osname" in
5911                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
5912                         dflt=y
5913                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5914                         ;;
5915                 next*)
5916                         case "$osvers" in
5917                         4*)     dflt=y
5918                                 also='Building a shared libperl is needed for MAB support.'
5919                                 ;;
5920                         *)      dflt=n
5921                                 ;;
5922                         esac
5923                         ;;
5924                 *)      dflt=n
5925                         ;;
5926                 esac
5927                 ;;
5928         $define|true|[Yy]*)
5929                 dflt=y
5930                 ;;
5931         *)      dflt=n
5932                 ;;
5933         esac
5934         $cat << EOM
5935
5936 The perl executable is normally obtained by linking perlmain.c with
5937 libperl${_a}, any static extensions (usually just DynaLoader), and
5938 any other libraries needed on this system (such as -lm, etc.).  Since
5939 your system supports dynamic loading, it is probably possible to build
5940 a shared libperl.$so.  If you will have more than one executable linked
5941 to libperl.$so, this will significantly reduce the size of each
5942 executable, but it may have a noticeable affect on performance.  The
5943 default is probably sensible for your system.
5944 $also
5945
5946 EOM
5947         rp="Build a shared libperl.$so (y/n)"
5948         . ./myread
5949         case "$ans" in
5950         true|$define|[Yy]*)
5951                 useshrplib='true'  ;;
5952         *)      useshrplib='false' ;;
5953         esac
5954         ;;
5955 esac
5956
5957 case "$useshrplib" in
5958 true)
5959         case "$libperl" in
5960         '')
5961                 # Figure out a good name for libperl.so.  Since it gets stored in
5962                 # a version-specific architecture-dependent library, the version
5963                 # number isn't really that important, except for making cc/ld happy.
5964                 #
5965                 # A name such as libperl.so.3.1
5966                 majmin="libperl.$so.$patchlevel.$subversion"
5967                 # A name such as libperl.so.301
5968                 majonly=`echo $patchlevel $subversion |
5969                         $awk '{printf "%d%02d", $1, $2}'`
5970                 majonly=libperl.$so.$majonly
5971                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5972                 # rely on figuring it out from the naming of libc.
5973                 case "${osname}${osvers}" in
5974                 next4*)
5975                         dflt=libperl.5.$so
5976                         # XXX How handle the --version stuff for MAB?
5977                         ;;
5978                 linux*)  # ld won't link with a bare -lperl otherwise.
5979                         dflt=libperl.$so
5980                         ;;
5981                 cygwin*) # include version
5982                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
5983                         ;;
5984                 *)      # Try to guess based on whether libc has major.minor.
5985                         case "$libc" in
5986                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5987                         *libc.$so.[0-9]*) dflt=$majonly ;;
5988                         *)      dflt=libperl.$so ;;
5989                         esac
5990                         ;;
5991                 esac
5992                 ;;
5993         *)      dflt=$libperl
5994                 ;;
5995         esac
5996         cat << EOM
5997
5998 I need to select a good name for the shared libperl.  If your system uses
5999 library names with major and minor numbers, then you might want something
6000 like $majmin.  Alternatively, if your system uses a single version
6001 number for shared libraries, then you might want to use $majonly.
6002 Or, your system might be quite happy with a simple libperl.$so.
6003
6004 Since the shared libperl will get installed into a version-specific
6005 architecture-dependent directory, the version number of the shared perl
6006 library probably isn't important, so the default should be o.k.
6007
6008 EOM
6009         rp='What name do you want to give to the shared libperl?'
6010         . ./myread
6011         libperl=$ans
6012         echo "Ok, I'll use $libperl"
6013         ;;
6014 *)
6015         libperl="libperl${_a}"
6016         ;;
6017 esac
6018
6019 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6020 case "$shrpdir" in
6021 '') ;;
6022 *)      $cat >&4 <<EOM
6023 WARNING:  Use of the shrpdir variable for the installation location of
6024 the shared $libperl is not supported.  It was never documented and
6025 will not work in this version.  Let me (perlbug@perl.com)
6026 know of any problems this may cause.
6027
6028 EOM
6029         case "$shrpdir" in
6030         "$archlibexp/CORE")
6031                 $cat >&4 <<EOM
6032 But your current setting of $shrpdir is
6033 the default anyway, so it's harmless.
6034 EOM
6035                 ;;
6036         *)
6037                 $cat >&4 <<EOM
6038 Further, your current attempted setting of $shrpdir
6039 conflicts with the value of $archlibexp/CORE
6040 that installperl will use.
6041 EOM
6042                 ;;
6043         esac
6044         ;;
6045 esac
6046
6047 # How will the perl executable find the installed shared $libperl?
6048 # Add $xxx to ccdlflags.
6049 # If we can't figure out a command-line option, use $shrpenv to
6050 # set env LD_RUN_PATH.  The main perl makefile uses this.
6051 shrpdir=$archlibexp/CORE
6052 xxx=''
6053 tmp_shrpenv=''
6054 if "$useshrplib"; then
6055     case "$osname" in 
6056         aix)
6057                 # We'll set it in Makefile.SH...
6058                 ;;
6059         solaris|netbsd)
6060                 xxx="-R $shrpdir"
6061                 ;;
6062         freebsd)
6063                 xxx="-Wl,-R$shrpdir"
6064                 ;;
6065         linux|irix*|dec_osf)
6066                 xxx="-Wl,-rpath,$shrpdir"
6067                 ;;
6068         next)
6069                 # next doesn't like the default...
6070                 ;;
6071         beos)
6072                 # beos doesn't like the default, either.
6073                 ;;
6074         hpux*)
6075                 # hpux doesn't like the default, either.
6076                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6077                 ;;
6078         *)
6079                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6080                 ;;
6081         esac
6082         case "$xxx" in
6083         '') ;;
6084         *)      
6085                 # Only add $xxx if it isn't already in ccdlflags.
6086                 case " $ccdlflags " in
6087                 *" $xxx "*)     ;;
6088                 *)      ccdlflags="$ccdlflags $xxx"
6089                         cat <<EOM >&4
6090
6091 Adding $xxx to the flags
6092 passed to $ld so that the perl executable will find the 
6093 installed shared $libperl.
6094
6095 EOM
6096                         ;;
6097                 esac
6098                 ;;
6099         esac
6100 fi
6101 # Fix ccdlflags in AIX for building external extensions.
6102 # (For building Perl itself bare -bE:perl.exp is needed,
6103 #  Makefile.SH takes care of this.)
6104 case "$osname" in
6105 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6106 esac
6107 # Respect a hint or command-line value.
6108 case "$shrpenv" in
6109 '') shrpenv="$tmp_shrpenv" ;;
6110 esac
6111 case "$ldlibpthname" in
6112 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6113 none)   ldlibpthname='' ;;
6114 esac
6115
6116 : determine where manual pages go
6117 set man1dir man1dir none
6118 eval $prefixit
6119 $cat <<EOM
6120
6121 $spackage has manual pages available in source form.
6122 EOM
6123 case "$nroff" in
6124 nroff)
6125         echo "However, you don't have nroff, so they're probably useless to you."
6126         case "$man1dir" in
6127         '') man1dir="none";;
6128         esac;;
6129 esac
6130 echo "If you don't want the manual sources installed, answer 'none'."
6131 case "$man1dir" in
6132 ' ') dflt=none
6133         ;;
6134 '')
6135         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6136         lookpath="$lookpath $prefixexp/man/p_man/man1"
6137         lookpath="$lookpath $prefixexp/man/u_man/man1"
6138         lookpath="$lookpath $prefixexp/man/man.1"
6139         case "$sysman" in
6140         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6141         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6142         esac
6143         set dflt
6144         eval $prefixup
6145         ;;
6146 *)  dflt="$man1dir"
6147         ;;
6148 esac
6149 echo " "
6150 fn=dn+~
6151 rp="Where do the main $spackage manual pages (source) go?"
6152 . ./getfile
6153 if $test "X$man1direxp" != "X$ansexp"; then
6154         installman1dir=''
6155 fi
6156 man1dir="$ans"
6157 man1direxp="$ansexp"
6158 case "$man1dir" in
6159 '')     man1dir=' '
6160         installman1dir='';;
6161 esac
6162
6163 : Change installation prefix, if necessary.
6164 if $test X"$prefix" != X"$installprefix"; then
6165         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6166 else
6167         installman1dir="$man1direxp"
6168 fi
6169
6170 : What suffix to use on installed man pages
6171
6172 case "$man1dir" in
6173 ' ')
6174         man1ext='0'
6175         ;;
6176 *)
6177         rp="What suffix should be used for the main $spackage man pages?"
6178         case "$man1ext" in
6179         '')     case "$man1dir" in
6180                 *1)  dflt=1 ;;
6181                 *1p) dflt=1p ;;
6182                 *1pm) dflt=1pm ;;
6183                 *l) dflt=l;;
6184                 *n) dflt=n;;
6185                 *o) dflt=o;;
6186                 *p) dflt=p;;
6187                 *C) dflt=C;;
6188                 *L) dflt=L;;
6189                 *L1) dflt=L1;;
6190                 *) dflt=1;;
6191                 esac
6192                 ;;
6193         *)      dflt="$man1ext";;
6194         esac
6195         . ./myread
6196         man1ext="$ans"
6197         ;;
6198 esac
6199
6200 : see if we can have long filenames
6201 echo " "
6202 rmlist="$rmlist /tmp/cf$$"
6203 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6204 first=123456789abcdef
6205 second=/tmp/cf$$/$first
6206 $rm -f $first $second
6207 if (echo hi >$first) 2>/dev/null; then
6208         if $test -f 123456789abcde; then
6209                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6210                 val="$undef"
6211         else
6212                 if (echo hi >$second) 2>/dev/null; then
6213                         if $test -f /tmp/cf$$/123456789abcde; then
6214                                 $cat <<'EOM'
6215 That's peculiar... You can have filenames longer than 14 characters, but only
6216 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6217 I shall consider your system cannot support long filenames at all.
6218 EOM
6219                                 val="$undef"
6220                         else
6221                                 echo 'You can have filenames longer than 14 characters.' >&4
6222                                 val="$define"
6223                         fi
6224                 else
6225                         $cat <<'EOM'
6226 How confusing! Some of your filesystems are sane enough to allow filenames
6227 longer than 14 characters but some others like /tmp can't even think about them.
6228 So, for now on, I shall assume your kernel does not allow them at all.
6229 EOM
6230                         val="$undef"
6231                 fi
6232         fi
6233 else
6234         $cat <<'EOM'
6235 You can't have filenames longer than 14 chars.  You can't even think about them!
6236 EOM
6237         val="$undef"
6238 fi 
6239 set d_flexfnam
6240 eval $setvar
6241 $rm -rf /tmp/cf$$ 123456789abcde*
6242
6243 : determine where library module manual pages go
6244 set man3dir man3dir none
6245 eval $prefixit
6246 $cat <<EOM
6247
6248 $spackage has manual pages for many of the library modules.
6249 EOM
6250
6251 case "$nroff" in
6252 nroff)
6253         $cat <<'EOM'
6254 However, you don't have nroff, so they're probably useless to you.
6255 EOM
6256         case "$man3dir" in
6257         '') man3dir="none";;
6258         esac;;
6259 esac
6260
6261 case "$d_flexfnam" in
6262 undef)
6263         $cat <<'EOM'
6264 However, your system can't handle the long file names like File::Basename.3. 
6265 EOM
6266         case "$man3dir" in
6267         '') man3dir="none";;
6268         esac;;
6269 esac
6270
6271 echo "If you don't want the manual sources installed, answer 'none'."
6272 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6273 case "$man3dir" in
6274 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6275         if $test -d "$privlib/man/man3"; then
6276                 cat <<EOM >&4
6277
6278 WARNING:  Previous versions of perl installed man3 pages into
6279 $privlib/man/man3.  This version will suggest a 
6280 new default of $dflt.  
6281 EOM
6282                 tdflt=$dflt
6283                 dflt='n'
6284                 rp='Do you wish to preserve the old behavior?(y/n)'
6285                 . ./myread
6286                 case "$ans" in
6287                 y*) dflt="$privlib/man/man3" ;;
6288                 *)  dflt=$tdflt ;;
6289                 esac
6290     fi
6291         ;;
6292 ' ') dflt=none;;
6293 *)      dflt="$man3dir" ;;
6294 esac
6295 echo " "
6296 fn=dn+~
6297 rp="Where do the $package library man pages (source) go?"
6298 . ./getfile
6299 man3dir="$ans"
6300 man3direxp="$ansexp"
6301 case "$man1dir" in
6302 '')     man3dir=' '
6303         installman3dir='';;
6304 esac
6305
6306 : Change installation prefix, if necessary.
6307 if $test X"$prefix" != X"$installprefix"; then
6308         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6309 else
6310         installman3dir="$man3direxp"
6311 fi
6312
6313 : What suffix to use on installed man pages
6314 case "$man3dir" in
6315 ' ')
6316         man3ext='0'
6317         ;;
6318 *)
6319         rp="What suffix should be used for the $package library man pages?"
6320         case "$man3ext" in
6321         '')     case "$man3dir" in
6322                 *3)  dflt=3 ;;
6323                 *3p) dflt=3p ;;
6324                 *3pm) dflt=3pm ;;
6325                 *l) dflt=l;;
6326                 *n) dflt=n;;
6327                 *o) dflt=o;;
6328                 *p) dflt=p;;
6329                 *C) dflt=C;;
6330                 *L) dflt=L;;
6331                 *L3) dflt=L3;;
6332                 *) dflt=3;;
6333                 esac
6334                 ;;
6335         *)      dflt="$man3ext";;
6336         esac
6337         . ./myread
6338         man3ext="$ans"
6339         ;;
6340 esac
6341
6342 : see if we have to deal with yellow pages, now NIS.
6343 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6344         if $test -f /usr/etc/nibindd; then
6345                 echo " "
6346                 echo "I'm fairly confident you're on a NeXT."
6347                 echo " "
6348                 rp='Do you get the hosts file via NetInfo?'
6349                 dflt=y
6350                 case "$hostcat" in
6351                 nidump*) ;;
6352                 '') ;;
6353                 *) dflt=n;;
6354                 esac
6355                 . ./myread
6356                 case "$ans" in
6357                 y*) hostcat='nidump hosts .';;
6358                 *)      case "$hostcat" in
6359                         nidump*) hostcat='';;
6360                         esac
6361                         ;;
6362                 esac
6363         fi
6364         case "$hostcat" in
6365         nidump*) ;;
6366         *)
6367                 case "$hostcat" in
6368                 *ypcat*) dflt=y;;
6369                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6370                                 dflt=y
6371                         else
6372                                 dflt=n
6373                         fi;;
6374                 *) dflt=n;;
6375                 esac
6376                 echo " "
6377                 rp='Are you getting the hosts file via yellow pages?'
6378                 . ./myread
6379                 case "$ans" in
6380                 y*) hostcat='ypcat hosts';;
6381                 *) hostcat='cat /etc/hosts';;
6382                 esac
6383                 ;;
6384         esac
6385 fi
6386 case "$hostcat" in
6387 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6388 esac
6389 case "$groupcat" in
6390 '') test -f /etc/group && groupcat='cat /etc/group';;
6391 esac
6392 case "$passcat" in
6393 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6394 esac
6395
6396 : now get the host name
6397 echo " "
6398 echo "Figuring out host name..." >&4
6399 case "$myhostname" in
6400 '') cont=true
6401         echo 'Maybe "hostname" will work...'
6402         if tans=`sh -c hostname 2>&1` ; then
6403                 myhostname=$tans
6404                 phostname=hostname
6405                 cont=''
6406         fi
6407         ;;
6408 *) cont='';;
6409 esac
6410 if $test "$cont"; then
6411         if ./xenix; then
6412                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6413                 if tans=`cat /etc/systemid 2>&1` ; then
6414                         myhostname=$tans
6415                         phostname='cat /etc/systemid'
6416                         echo "Whadyaknow.  Xenix always was a bit strange..."
6417                         cont=''
6418                 fi
6419         elif $test -r /etc/systemid; then
6420                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6421         fi
6422 fi
6423 if $test "$cont"; then
6424         echo 'No, maybe "uuname -l" will work...'
6425         if tans=`sh -c 'uuname -l' 2>&1` ; then
6426                 myhostname=$tans
6427                 phostname='uuname -l'
6428         else
6429                 echo 'Strange.  Maybe "uname -n" will work...'
6430                 if tans=`sh -c 'uname -n' 2>&1` ; then
6431                         myhostname=$tans
6432                         phostname='uname -n'
6433                 else
6434                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6435                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6436                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6437                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6438                         else
6439                                 case "$myhostname" in
6440                                 '') echo "Does this machine have an identity crisis or something?"
6441                                         phostname='';;
6442                                 *)
6443                                         echo "Well, you said $myhostname before..."
6444                                         phostname='echo $myhostname';;
6445                                 esac
6446                         fi
6447                 fi
6448         fi
6449 fi
6450 : you do not want to know about this
6451 set $myhostname
6452 myhostname=$1
6453
6454 : verify guess
6455 if $test "$myhostname" ; then
6456         dflt=y
6457         rp='Your host name appears to be "'$myhostname'".'" Right?"
6458         . ./myread
6459         case "$ans" in
6460         y*) ;;
6461         *) myhostname='';;
6462         esac
6463 fi
6464
6465 : bad guess or no guess
6466 while $test "X$myhostname" = X ; do
6467         dflt=''
6468         rp="Please type the (one word) name of your host:"
6469         . ./myread
6470         myhostname="$ans"
6471 done
6472
6473 : translate upper to lower if necessary
6474 case "$myhostname" in
6475 *[A-Z]*)
6476         echo "(Normalizing case in your host name)"
6477         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6478         ;;
6479 esac
6480
6481 case "$myhostname" in
6482 *.*)
6483         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6484         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6485         echo "(Trimming domain name from host name--host name is now $myhostname)"
6486         ;;
6487 *) case "$mydomain" in
6488         '')
6489                 {
6490                         test "X$hostcat" = "Xypcat hosts" &&
6491                         ypmatch "$myhostname" hosts 2>/dev/null |\
6492                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6493                         $test -s hosts
6494                 } || {
6495                         test "X$hostcat" != "X" &&
6496                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6497                                         /[       ]$myhostname[  . ]/p" > hosts
6498                 }
6499                 tmp_re="[       . ]"
6500                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6501                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6502                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6503                         hosts | $sort | $uniq | \
6504                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6505                 case `$echo X$dflt` in
6506                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6507                         dflt=.
6508                         ;;
6509                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6510                         ;;
6511                 esac
6512                 case "$dflt" in
6513                 .)
6514                         tans=`./loc resolv.conf X /etc /usr/etc`
6515                         if $test -f "$tans"; then
6516                                 echo "(Attempting domain name extraction from $tans)"
6517                                 dflt=.`$sed -n -e 's/   / /g' \
6518                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6519                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6520                                 case "$dflt" in
6521                                 .) dflt=.`$sed -n -e 's/        / /g' \
6522                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6523                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6524                                         ;;
6525                                 esac
6526                         fi
6527                         ;;
6528                 esac
6529                 case "$dflt" in
6530                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6531                         dflt=.`sh -c domainname 2>/dev/null`
6532                         case "$dflt" in
6533                         '') dflt='.';;
6534                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6535                         esac
6536                         ;;
6537                 esac
6538                 case "$dflt" in
6539                 .) echo "(Lost all hope -- silly guess then)"
6540                         dflt='.uucp'
6541                         ;;
6542                 esac
6543                 $rm -f hosts
6544                 ;;
6545         *) dflt="$mydomain";;
6546         esac;;
6547 esac
6548 echo " "
6549 rp="What is your domain name?"
6550 . ./myread
6551 tans="$ans"
6552 case "$ans" in
6553 '') ;;
6554 .*) ;;
6555 *) tans=".$tans";;
6556 esac
6557 mydomain="$tans"
6558
6559 : translate upper to lower if necessary
6560 case "$mydomain" in
6561 *[A-Z]*)
6562         echo "(Normalizing case in your domain name)"
6563         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6564         ;;
6565 esac
6566
6567 : a little sanity check here
6568 case "$phostname" in
6569 '') ;;
6570 *)
6571         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6572         $myhostname$mydomain|$myhostname) ;;
6573         *)
6574                 case "$phostname" in
6575                 sed*)
6576                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6577                         ;;
6578                 *)
6579                         echo "(That doesn't agree with your $phostname command, by the way.)"
6580                         ;;
6581                 esac
6582         ;;
6583         esac
6584         ;;
6585 esac
6586
6587 $cat <<EOM
6588
6589 I need to get your e-mail address in Internet format if possible, i.e.
6590 something like user@host.domain. Please answer accurately since I have
6591 no easy means to double check it. The default value provided below
6592 is most probably close to the reality but may not be valid from outside
6593 your organization...
6594
6595 EOM
6596 cont=x
6597 while test "$cont"; do
6598         case "$cf_email" in
6599         '') dflt="$cf_by@$myhostname$mydomain";;
6600         *) dflt="$cf_email";;
6601         esac
6602         rp='What is your e-mail address?'
6603         . ./myread
6604         cf_email="$ans"
6605         case "$cf_email" in
6606         *@*.*) cont='' ;;
6607         *)
6608                 rp='Address does not look like an Internet one.  Use it anyway?'
6609                 case "$fastread" in
6610                 yes) dflt=y ;;
6611                 *) dflt=n ;;
6612                 esac
6613                 . ./myread
6614                 case "$ans" in
6615                 y*) cont='' ;;
6616                 *) echo " " ;;
6617                 esac
6618                 ;;
6619         esac
6620 done
6621
6622 $cat <<EOM
6623
6624 If you or somebody else will be maintaining perl at your site, please
6625 fill in the correct e-mail address here so that they may be contacted
6626 if necessary. Currently, the "perlbug" program included with perl
6627 will send mail to this address in addition to perlbug@perl.com. You may
6628 enter "none" for no administrator.
6629
6630 EOM
6631 case "$perladmin" in
6632 '') dflt="$cf_email";;
6633 *) dflt="$perladmin";;
6634 esac
6635 rp='Perl administrator e-mail address'
6636 . ./myread
6637 perladmin="$ans"
6638
6639 : figure out how to guarantee perl startup
6640 case "$startperl" in
6641 '')
6642         case "$sharpbang" in
6643         *!)
6644                 $cat <<EOH
6645
6646 I can use the #! construct to start perl on your system. This will
6647 make startup of perl scripts faster, but may cause problems if you
6648 want to share those scripts and perl is not in a standard place
6649 ($binexp/perl) on all your platforms. The alternative is to force
6650 a shell by starting the script with a single ':' character.
6651
6652 EOH
6653                 dflt="$binexp/perl"
6654                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6655                 . ./myread
6656                 case "$ans" in
6657                 none)   startperl=": # use perl";;
6658                 *)      startperl="#!$ans"
6659                         if $test 30 -lt `echo "$ans" | wc -c`; then
6660                                 $cat >&4 <<EOM
6661
6662 WARNING:  Some systems limit the #! command to 32 characters.
6663 If you experience difficulty running Perl scripts with #!, try
6664 installing Perl in a directory with a shorter pathname.
6665
6666 EOM
6667                         fi ;;
6668                 esac
6669                 ;;
6670         *) startperl=": # use perl"
6671                 ;;
6672         esac
6673         ;;
6674 esac
6675 echo "I'll use $startperl to start perl scripts."
6676
6677 : figure best path for perl in scripts
6678 case "$perlpath" in
6679 '')
6680         perlpath="$binexp/perl"
6681         case "$startperl" in
6682         *!*) ;;
6683         *)
6684                 $cat <<EOH
6685
6686 I will use the "eval 'exec'" idiom to start Perl on your system.
6687 I can use the full path of your Perl binary for this purpose, but
6688 doing so may cause problems if you want to share those scripts and
6689 Perl is not always in a standard place ($binexp/perl).
6690
6691 EOH
6692                 dflt="$binexp/perl"
6693                 rp="What path shall I use in \"eval 'exec'\"?"
6694                 . ./myread
6695                 perlpath="$ans"
6696                 ;;
6697         esac
6698         ;;
6699 esac
6700 case "$startperl" in
6701 *!*)    ;;
6702 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6703 esac
6704
6705 : determine where public executable scripts go
6706 set scriptdir scriptdir
6707 eval $prefixit
6708 case "$scriptdir" in
6709 '')
6710         dflt="$bin"
6711         : guess some guesses
6712         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6713         $test -d /usr/share/bin     && dflt=/usr/share/bin
6714         $test -d /usr/local/script  && dflt=/usr/local/script
6715         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6716         $test -d $prefixexp/script  && dflt=$prefixexp/script
6717         set dflt
6718         eval $prefixup
6719         ;;
6720 *)  dflt="$scriptdir"
6721         ;;
6722 esac
6723 $cat <<EOM
6724  
6725 Some installations have a separate directory just for executable scripts so
6726 that they can mount it across multiple architectures but keep the scripts in
6727 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6728 Or you might just lump your scripts in with all your other executables.
6729  
6730 EOM
6731 fn=d~
6732 rp='Where do you keep publicly executable scripts?'
6733 . ./getfile
6734 if $test "X$ansexp" != "X$scriptdirexp"; then
6735         installscript=''
6736 fi
6737 scriptdir="$ans"
6738 scriptdirexp="$ansexp"
6739 : Change installation prefix, if necessary.
6740 if $test X"$prefix" != X"$installprefix"; then
6741         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6742 else
6743         installscript="$scriptdirexp"
6744 fi
6745
6746 $cat <<EOM
6747
6748 After $package is installed, you may wish to install various
6749 add-on modules and utilities.  Typically, these add-ons will
6750 be installed under $prefix with the rest
6751 of this package.  However, you may wish to install such add-ons
6752 elsewhere under a different prefix.
6753
6754 If you do not wish to put everything under a single prefix, that's
6755 ok.  You will be prompted for the individual locations; this siteprefix
6756 is only used to suggest the defaults.
6757
6758 The default should be fine for most people.
6759
6760 EOM
6761 fn=d~+
6762 rp='Installation prefix to use for add-on modules and utilities?'
6763 : XXX Here might be another good place for an installstyle setting.
6764 case "$siteprefix" in
6765 '') dflt=$prefix ;;
6766 *)  dflt=$siteprefix ;;
6767 esac
6768 . ./getfile
6769 oldsiteprefix=''
6770 case "$siteprefix" in
6771 '') ;;
6772 *)
6773         case "$ans" in
6774         "$prefix") ;;
6775         *) oldsiteprefix="$prefix";;
6776         esac
6777         ;;
6778 esac
6779 siteprefix="$ans"
6780 siteprefixexp="$ansexp"
6781
6782 : determine where site specific libraries go.
6783 : Usual default is /usr/local/lib/perl5/site_perl
6784 : The default "style" setting is made in installstyle.U
6785 : XXX No longer works with Prefixit stuff.
6786 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6787 case "$installstyle" in
6788 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog ;;
6789 *)       dflt=$siteprefix/lib/site_$prog ;;
6790 esac
6791 $cat <<EOM
6792
6793 The installation process will create a directory for
6794 site-specific extensions and modules.  Most users find it convenient
6795 to place all site-specific files in this directory rather than in the
6796 main distribution directory.
6797
6798 EOM
6799 fn=d~+
6800 rp='Pathname for the site-specific library files?'
6801 . ./getfile
6802 sitelib="$ans"
6803 sitelibexp="$ansexp"
6804 : Change installation prefix, if necessary.
6805 if $test X"$prefix" != X"$installprefix"; then
6806         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6807 else
6808         installsitelib="$sitelibexp"
6809 fi
6810
6811 : determine where site specific architecture-dependent libraries go.
6812 : sitelib  default is /usr/local/lib/perl5/site_perl/
6813 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6814 : sitelib may have an optional trailing /share.
6815 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6816 tdflt="$tdflt/$apiversion/$archname"
6817 set sitearch sitearch none
6818 eval $prefixit
6819 case "$sitearch" in
6820 '')     dflt="$tdflt" ;;
6821 *)      dflt="$sitearch" ;;
6822 esac
6823 $cat <<EOM
6824
6825 The installation process will also create a directory for
6826 architecture-dependent site-specific extensions and modules.
6827
6828 EOM
6829 fn=nd~+
6830 rp='Pathname for the site-specific architecture-dependent library files?'
6831 . ./getfile
6832 sitearch="$ans"
6833 sitearchexp="$ansexp"
6834 : Change installation prefix, if necessary.
6835 if $test X"$prefix" != X"$installprefix"; then
6836         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6837 else
6838         installsitearch="$sitearchexp"
6839 fi
6840
6841 : determine where add-on public executables go
6842 case "$sitebin" in
6843 '')     dflt=$siteprefix/bin ;;
6844 *)      dflt=$sitebin ;;
6845 esac
6846 fn=d~
6847 rp='Pathname where the add-on public executables should be installed?'
6848 . ./getfile
6849 sitebin="$ans"
6850 sitebinexp="$ansexp"
6851 : Change installation prefix, if necessary.
6852 if $test X"$prefix" != X"$installprefix"; then
6853         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6854 else
6855         installsitebin="$sitebinexp"
6856 fi
6857
6858 cat <<EOM
6859
6860 Perl can be built to take advantage of long doubles which
6861 (if available) may give more accuracy and range for floating point numbers.
6862
6863 If this doesn't make any sense to you, just accept the default 'n'.
6864 EOM
6865
6866 case "$ccflags" in
6867 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6868 esac
6869
6870 case "$uselongdouble" in
6871 $define|true|[yY]*)     dflt='y';;
6872 *) dflt='n';;
6873 esac
6874 rp='Try to use long doubles if available?'
6875 . ./myread
6876 case "$ans" in
6877 y|Y)    val="$define"   ;;
6878 *)      val="$undef"    ;;
6879 esac
6880 set uselongdouble
6881 eval $setvar
6882
6883 case "$uselongdouble" in
6884 true|[yY]*) uselongdouble="$define" ;;
6885 esac
6886
6887 case "$uselongdouble" in
6888 $define)
6889 : Look for a hint-file generated 'call-back-unit'.  If the
6890 : user has specified that long doubles should be used,
6891 : we may need to set or change some other defaults.
6892         if $test -f uselongdouble.cbu; then
6893                 echo "Your platform has some specific hints for long doubles, using them..."
6894                 . ./uselongdouble.cbu
6895         else
6896                 $cat <<EOM
6897 (Your platform doesn't have any specific hints for long doubles.)
6898 EOM
6899         fi
6900         ;;
6901 esac
6902
6903 cat <<EOM
6904
6905 Perl can be built to take advantage of long longs which
6906 (if available) may give more range for integer numbers.
6907
6908 If this doesn't make any sense to you, just accept the default 'n'.
6909 EOM
6910
6911 case "$ccflags" in
6912 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
6913 esac
6914
6915 case "$uselonglong" in
6916 $define|true|[yY]*)     dflt='y';;
6917 *) dflt='n';;
6918 esac
6919 rp='Try to use long longs if available?'
6920 . ./myread
6921 case "$ans" in
6922 y|Y)    val="$define"   ;;
6923 *)      val="$undef"    ;;
6924 esac
6925 set uselonglong
6926 eval $setvar
6927
6928 case "$uselonglong" in
6929 true|[yY]*) uselonglong="$define" ;;
6930 esac
6931
6932 case "$uselonglong" in
6933 $define)
6934 : Look for a hint-file generated 'call-back-unit'.  If the
6935 : user has specified that long longs should be used,
6936 : we may need to set or change some other defaults.
6937         if $test -f uselonglong.cbu; then
6938                 echo "Your platform has some specific hints for long longs, using them..."
6939                 . ./uselonglong.cbu
6940         else
6941                 $cat <<EOM
6942 (Your platform doesn't have any specific hints for long longs.)
6943 EOM
6944         fi
6945         ;;
6946 esac
6947
6948 cat <<EOM
6949
6950 Previous version of $package used the standard IO mechanisms as defined
6951 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6952 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6953 the default.  This abstraction layer can use AT&T's sfio (if you already
6954 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6955 problems with some extension modules.  Using PerlIO with stdio is safe,
6956 but it is slower than plain stdio and therefore is not the default.
6957
6958 If this doesn't make any sense to you, just accept the default 'n'.
6959 EOM
6960 case "$useperlio" in
6961 $define|true|[yY]*)     dflt='y';;
6962 *) dflt='n';;
6963 esac
6964 rp='Use the experimental PerlIO abstraction layer?'
6965 . ./myread
6966 case "$ans" in
6967 y|Y) 
6968         val="$define"
6969         ;;     
6970 *)      
6971         echo "Ok, doing things the stdio way"
6972         val="$undef"
6973         ;;
6974 esac
6975 set useperlio
6976 eval $setvar 
6977
6978 case "$vendorprefix" in
6979 '')     d_vendorbin="$undef"
6980         vendorbin=''
6981         vendorbinexp=''
6982         ;;
6983 *)      d_vendorbin="$define"
6984         : determine where vendor-supplied executables go.
6985         dflt=$vendorprefix/bin
6986         fn=d~+
6987         rp='Pathname for the vendor-supplied executables directory?'
6988         . ./getfile
6989         vendorbin="$ans"
6990         vendorbinexp="$ansexp"
6991         : Change installation prefix, if necessary.
6992         if $test X"$prefix" != X"$installprefix"; then
6993                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
6994         else
6995                 installvendorbin="$vendorbinexp"
6996         fi
6997         ;;
6998 esac
6999
7000 : Check how to convert floats to strings.
7001 if test "X$d_Gconvert" = X; then
7002         echo " "
7003         echo "Checking for an efficient way to convert floats to strings."
7004         $cat >try.c <<'EOP'
7005 #ifdef TRY_gconvert
7006 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7007 char *myname = "gconvert";
7008 #endif
7009 #ifdef TRY_gcvt
7010 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7011 char *myname = "gcvt";
7012 #endif
7013 #ifdef TRY_sprintf
7014 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7015 char *myname = "sprintf";
7016 #endif
7017
7018 #include <stdio.h>
7019
7020 int
7021 checkit(expect, got)
7022 char *expect;
7023 char *got;
7024 {
7025     if (strcmp(expect, got)) {
7026                 printf("%s oddity:  Expected %s, got %s\n",
7027                         myname, expect, got);
7028                 exit(1);
7029         }
7030 }
7031
7032 int main()
7033
7034         char buf[64]; 
7035         buf[63] = '\0';
7036
7037         /* This must be 1st test on (which?) platform */
7038         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7039         Gconvert(0.1, 8, 0, buf);
7040         checkit("0.1", buf);
7041
7042         Gconvert(1.0, 8, 0, buf); 
7043         checkit("1", buf);
7044
7045         Gconvert(0.0, 8, 0, buf); 
7046         checkit("0", buf);
7047
7048         Gconvert(-1.0, 8, 0, buf); 
7049         checkit("-1", buf);
7050
7051         /* Some Linux gcvt's give 1.e+5 here. */
7052         Gconvert(100000.0, 8, 0, buf); 
7053         checkit("100000", buf);
7054         
7055         /* Some Linux gcvt's give -1.e+5 here. */
7056         Gconvert(-100000.0, 8, 0, buf); 
7057         checkit("-100000", buf);
7058
7059         exit(0);
7060 }
7061 EOP
7062         case "$d_Gconvert" in
7063         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7064         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7065         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7066         *) xxx_list='gconvert gcvt sprintf' ;;
7067         esac
7068
7069         for xxx_convert in $xxx_list; do
7070                 echo "Trying $xxx_convert"
7071                 $rm -f try try$_o
7072                 set try -DTRY_$xxx_convert
7073                 if eval $compile; then
7074                         echo "$xxx_convert" found. >&4
7075                         if ./try; then
7076                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7077                                 break;
7078                         else
7079                                 echo "...But $xxx_convert didn't work as I expected."
7080                         fi
7081                 else
7082                         echo "$xxx_convert NOT found." >&4
7083                 fi
7084         done
7085                 
7086         case "$xxx_convert" in
7087         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7088         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7089         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7090         esac
7091 fi
7092
7093 : check for length of double
7094 echo " "
7095 case "$doublesize" in
7096 '')
7097         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7098         $cat >try.c <<'EOCP'
7099 #include <stdio.h>
7100 int main()
7101 {
7102     printf("%d\n", (int)sizeof(double));
7103     exit(0);
7104 }
7105 EOCP
7106         set try
7107         if eval $compile_ok; then
7108                 doublesize=`./try`
7109                 $echo " $doublesize bytes." >&4
7110         else
7111                 dflt='8'
7112                 echo "(I can't seem to compile the test program.  Guessing...)"
7113                 rp="What is the size of a double precision number (in bytes)?"
7114                 . ./myread
7115                 doublesize="$ans"
7116         fi
7117         ;;
7118 esac
7119 $rm -f try.c try
7120
7121 : check for long doubles
7122 echo " "
7123 $echo $n "Checking to see if your system supports long double..." $c >&4
7124 echo 'int main() { long double x = 7.0; }' > try.c
7125 set try
7126 if eval $compile; then
7127         val="$define"
7128         echo " Yes, it does." >&4
7129 else
7130         val="$undef"
7131         echo " No, it doesn't." >&4
7132 fi
7133 $rm try.*
7134 set d_longdbl
7135 eval $setvar
7136
7137 : check for length of long double
7138 case "${d_longdbl}${longdblsize}" in
7139 $define)
7140         echo " "
7141         $echo $n "Checking to see how big your long doubles are..." $c >&4
7142         $cat >try.c <<'EOCP'
7143 #include <stdio.h>
7144 int main()
7145 {
7146         printf("%d\n", sizeof(long double));
7147 }
7148 EOCP
7149         set try
7150         set try
7151         if eval $compile; then
7152                 longdblsize=`./try$exe_ext`
7153                 $echo " $longdblsize bytes." >&4
7154         else
7155                 dflt='8'
7156                 echo " "
7157                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7158                 rp="What is the size of a long double (in bytes)?"
7159                 . ./myread
7160                 longdblsize="$ans"
7161         fi
7162         if $test "X$doublesize" = "X$longdblsize"; then
7163                 echo "(That isn't any different from an ordinary double.)"
7164         fi      
7165         ;;
7166 esac
7167 $rm -f try.* try
7168
7169 echo " "
7170
7171 if $test X"$d_longdbl" = X"$define"; then
7172
7173 echo "Checking how to print long doubles..." >&4
7174
7175 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7176         $cat >try.c <<'EOCP'
7177 #include <sys/types.h>
7178 #include <stdio.h>
7179 int main() {
7180   double d = 123.456;
7181   printf("%.3f\n", d);
7182 }
7183 EOCP
7184         set try
7185         if eval $compile; then
7186                 yyy=`./try$exe_ext`
7187                 case "$yyy" in
7188                 123.456)
7189                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7190                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7191                         echo "We will use %f."
7192                         ;;
7193                 esac
7194         fi
7195 fi
7196
7197 if $test X"$sPRIfldbl" = X; then
7198         $cat >try.c <<'EOCP'
7199 #include <sys/types.h>
7200 #include <stdio.h>
7201 int main() {
7202   long double d = 123.456;
7203   printf("%.3llf\n", d);
7204 }
7205 EOCP
7206         set try
7207         if eval $compile; then
7208                 yyy=`./try$exe_ext`
7209                 case "$yyy" in
7210                 123.456)
7211                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7212                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7213                         echo "We will use %llf."
7214                         ;;
7215                 esac
7216         fi
7217 fi
7218
7219 if $test X"$sPRIfldbl" = X; then
7220         $cat >try.c <<'EOCP'
7221 #include <sys/types.h>
7222 #include <stdio.h>
7223 int main() {
7224   long double d = 123.456;
7225   printf("%.3Lf\n", d);
7226 }
7227 EOCP
7228         set try
7229         if eval $compile; then
7230                 yyy=`./try$exe_ext`
7231                 case "$yyy" in
7232                 123.456)
7233                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7234                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7235                         echo "We will use %Lf."
7236                         ;;
7237                 esac
7238         fi
7239 fi
7240
7241 if $test X"$sPRIfldbl" = X; then
7242         $cat >try.c <<'EOCP'
7243 #include <sys/types.h>
7244 #include <stdio.h>
7245 int main() {
7246   long double d = 123.456;
7247   printf("%.3lf\n", d);
7248 }
7249 EOCP
7250         set try
7251         if eval $compile; then
7252                 yyy=`./try$exe_ext`
7253                 case "$yyy" in
7254                 123.456)
7255                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7256                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7257                         echo "We will use %lf."
7258                         ;;
7259                 esac
7260         fi
7261 fi
7262
7263 if $test X"$sPRIfldbl" = X; then
7264         echo "Cannot figure out how to print long doubles." >&4
7265 fi
7266
7267 $rm -f try try.*
7268
7269 fi # d_longdbl
7270
7271 case "$sPRIfldbl" in
7272 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7273         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7274         ;;
7275 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7276         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7277         ;;
7278 esac
7279
7280 : Initialize h_fcntl
7281 h_fcntl=false
7282
7283 : Initialize h_sysfile
7284 h_sysfile=false
7285
7286 : access call always available on UNIX
7287 set access d_access
7288 eval $inlibc
7289
7290 : locate the flags for 'access()'
7291 case "$d_access" in
7292 "$define")
7293         echo " "
7294         $cat >access.c <<'EOCP'
7295 #include <sys/types.h>
7296 #ifdef I_FCNTL
7297 #include <fcntl.h>
7298 #endif
7299 #ifdef I_SYS_FILE
7300 #include <sys/file.h>
7301 #endif
7302 #ifdef I_UNISTD
7303 #include <unistd.h>
7304 #endif
7305 int main() {
7306         exit(R_OK);
7307 }
7308 EOCP
7309         : check sys/file.h first, no particular reason here
7310         if $test `./findhdr sys/file.h` && \
7311                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7312                 h_sysfile=true;
7313                 echo "<sys/file.h> defines the *_OK access constants." >&4
7314         elif $test `./findhdr fcntl.h` && \
7315                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7316                 h_fcntl=true;
7317                 echo "<fcntl.h> defines the *_OK access constants." >&4
7318         elif $test `./findhdr unistd.h` && \
7319                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7320                 echo "<unistd.h> defines the *_OK access constants." >&4
7321         else
7322                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7323         fi
7324         ;;
7325 esac
7326 $rm -f access*
7327
7328 : see if accessx exists
7329 set accessx d_accessx
7330 eval $inlibc
7331
7332 : see if alarm exists
7333 set alarm d_alarm
7334 eval $inlibc
7335
7336 : see if atolf exists
7337 set atolf d_atolf
7338 eval $inlibc
7339
7340 : see if atoll exists
7341 set atoll d_atoll
7342 eval $inlibc
7343
7344 : Look for GNU-cc style attribute checking
7345 echo " "
7346 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7347 $cat >attrib.c <<'EOCP'
7348 #include <stdio.h>
7349 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7350 EOCP
7351 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7352         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7353                 echo "Your C compiler doesn't fully support __attribute__."
7354                 val="$undef"
7355         else
7356                 echo "Your C compiler supports __attribute__."
7357                 val="$define"
7358         fi
7359 else
7360         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7361         val="$undef"
7362 fi
7363 set d_attribut
7364 eval $setvar
7365 $rm -f attrib*
7366
7367 : see if bcmp exists
7368 set bcmp d_bcmp
7369 eval $inlibc
7370
7371 : see if bcopy exists
7372 set bcopy d_bcopy
7373 eval $inlibc
7374
7375 : see if this is a unistd.h system
7376 set unistd.h i_unistd
7377 eval $inhdr
7378
7379 : see if getpgrp exists
7380 set getpgrp d_getpgrp
7381 eval $inlibc
7382
7383 case "$d_getpgrp" in
7384 "$define")
7385         echo " "
7386         echo "Checking to see which flavor of getpgrp is in use..."
7387         $cat >set.c <<EOP
7388 #$i_unistd I_UNISTD
7389 #include <sys/types.h>
7390 #ifdef I_UNISTD
7391 #  include <unistd.h>
7392 #endif
7393 int main()
7394 {
7395         if (getuid() == 0) {
7396                 printf("(I see you are running Configure as super-user...)\n");
7397                 setuid(1);
7398         }
7399 #ifdef TRY_BSD_PGRP
7400         if (getpgrp(1) == 0)
7401                 exit(0);
7402 #else
7403         if (getpgrp() > 0)
7404                 exit(0);
7405 #endif
7406         exit(1);
7407 }
7408 EOP
7409         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7410                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7411                 val="$define"
7412         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7413                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7414                 val="$undef"
7415         else
7416                 echo "I can't seem to compile and run the test program."
7417                 if ./usg; then
7418                         xxx="a USG one, i.e. you use getpgrp()."
7419                 else
7420                         # SVR4 systems can appear rather BSD-ish.
7421                         case "$i_unistd" in
7422                         $undef)
7423                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7424                                 val="$define"
7425                                 ;;
7426                         $define)
7427                                 xxx="probably a USG one, i.e. you use getpgrp()."
7428                                 val="$undef"
7429                                 ;;
7430                         esac
7431                 fi
7432                 echo "Assuming your getpgrp is $xxx" >&4
7433         fi
7434         ;;
7435 *) val="$undef";;
7436 esac
7437 set d_bsdgetpgrp
7438 eval $setvar
7439 $rm -f set set.c
7440
7441 : see if setpgrp exists
7442 set setpgrp d_setpgrp
7443 eval $inlibc
7444
7445 case "$d_setpgrp" in
7446 "$define")
7447         echo " "
7448         echo "Checking to see which flavor of setpgrp is in use..."
7449         $cat >set.c <<EOP
7450 #$i_unistd I_UNISTD
7451 #include <sys/types.h>
7452 #ifdef I_UNISTD
7453 #  include <unistd.h>
7454 #endif
7455 int main()
7456 {
7457         if (getuid() == 0) {
7458                 printf("(I see you are running Configure as super-user...)\n");
7459                 setuid(1);
7460         }
7461 #ifdef TRY_BSD_PGRP
7462         if (-1 == setpgrp(1, 1))
7463                 exit(0);
7464 #else
7465         if (setpgrp() != -1)
7466                 exit(0);
7467 #endif
7468         exit(1);
7469 }
7470 EOP
7471         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7472                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7473                 val="$define"
7474         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7475                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7476                 val="$undef"
7477         else
7478                 echo "(I can't seem to compile and run the test program.)"
7479                 if ./usg; then
7480                         xxx="a USG one, i.e. you use setpgrp()."
7481                 else
7482                         # SVR4 systems can appear rather BSD-ish.
7483                         case "$i_unistd" in
7484                         $undef)
7485                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7486                                 val="$define"
7487                                 ;;
7488                         $define)
7489                                 xxx="probably a USG one, i.e. you use setpgrp()."
7490                                 val="$undef"
7491                                 ;;
7492                         esac
7493                 fi
7494                 echo "Assuming your setpgrp is $xxx" >&4
7495         fi
7496         ;;
7497 *) val="$undef";;
7498 esac
7499 set d_bsdsetpgrp
7500 eval $setvar
7501 $rm -f set set.c
7502 : see if bzero exists
7503 set bzero d_bzero
7504 eval $inlibc
7505
7506 : see if signal is declared as pointer to function returning int or void
7507 echo " "
7508 xxx=`./findhdr signal.h`
7509 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7510 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7511         echo "You have int (*signal())() instead of void." >&4
7512         val="$undef"
7513 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7514         echo "You have void (*signal())()." >&4
7515         val="$define"
7516 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7517         echo "You have int (*signal())() instead of void." >&4
7518         val="$undef"
7519 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7520         echo "You have void (*signal())()." >&4
7521         val="$define"
7522 else
7523         case "$d_voidsig" in
7524         '')
7525         echo "I can't determine whether signal handler returns void or int..." >&4
7526                 dflt=void
7527                 rp="What type does your signal handler return?"
7528                 . ./myread
7529                 case "$ans" in
7530                 v*) val="$define";;
7531                 *) val="$undef";;
7532                 esac;;
7533         "$define")
7534                 echo "As you already told me, signal handler returns void." >&4
7535                 val="$define"
7536                 ;;
7537         *)      echo "As you already told me, signal handler returns int." >&4
7538                 val="$undef"
7539                 ;;
7540         esac
7541 fi
7542 set d_voidsig
7543 eval $setvar
7544 case "$d_voidsig" in
7545 "$define") signal_t="void";;
7546 *) signal_t="int";;
7547 esac
7548 $rm -f $$.tmp
7549
7550 : check for ability to cast large floats to 32-bit ints.
7551 echo " "
7552 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7553 if $test "$intsize" -ge 4; then
7554         xxx=int
7555 else
7556         xxx=long
7557 fi
7558 $cat >try.c <<EOCP
7559 #include <stdio.h>
7560 #include <sys/types.h>
7561 #include <signal.h>
7562 $signal_t blech(s) int s; { exit(3); }
7563 int main()
7564 {
7565         $xxx i32;
7566         double f, g;
7567         int result = 0;
7568         char str[16];
7569         signal(SIGFPE, blech);
7570
7571         /* Don't let compiler optimize the test away.  Store the number 
7572            in a writable string for gcc to pass to sscanf under HP/UX.
7573         */
7574         sprintf(str, "2147483647");
7575         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7576         g = 10 * f;
7577         i32  = ($xxx) g;
7578
7579         /* x86 processors will probably give 0x8000 0000, which is a
7580        sign change.  We don't want that.  We want to mimic SPARC
7581            behavior here, which is to preserve the sign and give
7582            back 0x7fff ffff.
7583         */
7584         if (i32 != ($xxx) f)
7585                 result |= 1;
7586         exit(result);
7587 }
7588 EOCP
7589 set try
7590 if eval $compile_ok; then
7591         ./try
7592         yyy=$?
7593 else
7594         echo "(I can't seem to compile the test program--assuming it can't)"
7595         yyy=1
7596 fi
7597 case "$yyy" in
7598 0)      val="$define"
7599         echo "Yup, it can."
7600         ;;
7601 *)      val="$undef"
7602         echo "Nope, it can't."
7603         ;;
7604 esac
7605 set d_casti32
7606 eval $setvar
7607 $rm -f try try.*
7608
7609 : check for ability to cast negative floats to unsigned
7610 echo " "
7611 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7612 $cat >try.c <<EOCP
7613 #include <stdio.h>
7614 #include <sys/types.h>
7615 #include <signal.h>
7616 $signal_t blech(s) int s; { exit(7); }
7617 $signal_t blech_in_list(s) int s; { exit(4); }
7618 unsigned long dummy_long(p) unsigned long p; { return p; }
7619 unsigned int dummy_int(p) unsigned int p; { return p; }
7620 unsigned short dummy_short(p) unsigned short p; { return p; }
7621 int main()
7622 {
7623         double f;
7624         unsigned long along;
7625         unsigned int aint;
7626         unsigned short ashort;
7627         int result = 0;
7628         char str[16];
7629         
7630         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7631            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7632            optimized the whole file away
7633         */
7634         /* Store the number in a writable string for gcc to pass to 
7635            sscanf under HP/UX.
7636         */
7637         sprintf(str, "-123");
7638         sscanf(str, "%lf", &f);  /* f = -123.; */
7639
7640         signal(SIGFPE, blech);
7641         along = (unsigned long)f;
7642         aint = (unsigned int)f;
7643         ashort = (unsigned short)f;
7644         if (along != (unsigned long)-123)
7645                 result |= 1;
7646         if (aint != (unsigned int)-123)
7647                 result |= 1;
7648         if (ashort != (unsigned short)-123)
7649                 result |= 1;
7650         sprintf(str, "1073741824.");
7651         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7652         f = f + f;
7653         along = 0;
7654         along = (unsigned long)f;
7655         if (along != 0x80000000)
7656                 result |= 2;
7657         f -= 1.;
7658         along = 0;
7659         along = (unsigned long)f;
7660         if (along != 0x7fffffff)
7661                 result |= 1;
7662         f += 2.;
7663         along = 0;
7664         along = (unsigned long)f;
7665         if (along != 0x80000001)
7666                 result |= 2;
7667         if (result)
7668                 exit(result);
7669         signal(SIGFPE, blech_in_list);
7670         sprintf(str, "123.");
7671         sscanf(str, "%lf", &f);  /* f = 123.; */
7672         along = dummy_long((unsigned long)f);
7673         aint = dummy_int((unsigned int)f);
7674         ashort = dummy_short((unsigned short)f);
7675         if (along != (unsigned long)123)
7676                 result |= 4;
7677         if (aint != (unsigned int)123)
7678                 result |= 4;
7679         if (ashort != (unsigned short)123)
7680                 result |= 4;
7681         exit(result);
7682
7683 }
7684 EOCP
7685 set try
7686 if eval $compile_ok; then
7687         ./try
7688         castflags=$?
7689 else
7690         echo "(I can't seem to compile the test program--assuming it can't)"
7691         castflags=7
7692 fi
7693 case "$castflags" in
7694 0)      val="$define"
7695         echo "Yup, it can."
7696         ;;
7697 *)      val="$undef"
7698         echo "Nope, it can't."
7699         ;;
7700 esac
7701 set d_castneg
7702 eval $setvar
7703 $rm -f try.*
7704
7705 : see if vprintf exists
7706 echo " "
7707 if set vprintf val -f d_vprintf; eval $csym; $val; then
7708         echo 'vprintf() found.' >&4
7709         val="$define"
7710         $cat >vprintf.c <<'EOF'
7711 #include <varargs.h>
7712
7713 int main() { xxx("foo"); }
7714
7715 xxx(va_alist)
7716 va_dcl
7717 {
7718         va_list args;
7719         char buf[10];
7720
7721         va_start(args);
7722         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7723 }
7724 EOF
7725         set vprintf
7726         if eval $compile && ./vprintf; then
7727                 echo "Your vsprintf() returns (int)." >&4
7728                 val2="$undef"
7729         else
7730                 echo "Your vsprintf() returns (char*)." >&4
7731                 val2="$define"
7732         fi
7733 else
7734         echo 'vprintf() NOT found.' >&4
7735                 val="$undef"
7736                 val2="$undef"
7737 fi
7738 set d_vprintf
7739 eval $setvar
7740 val=$val2
7741 set d_charvspr
7742 eval $setvar
7743
7744 : see if chown exists
7745 set chown d_chown
7746 eval $inlibc
7747
7748 : see if chroot exists
7749 set chroot d_chroot
7750 eval $inlibc
7751
7752 : see if chsize exists
7753 set chsize d_chsize
7754 eval $inlibc
7755
7756 : check for const keyword
7757 echo " "
7758 echo 'Checking to see if your C compiler knows about "const"...' >&4
7759 $cat >const.c <<'EOCP'
7760 typedef struct spug { int drokk; } spug;
7761 int main()
7762 {
7763         const char *foo;
7764         const spug y;
7765 }
7766 EOCP
7767 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7768         val="$define"
7769         echo "Yup, it does."
7770 else
7771         val="$undef"
7772         echo "Nope, it doesn't."
7773 fi
7774 set d_const
7775 eval $setvar
7776
7777 : see if crypt exists
7778 echo " "
7779 if set crypt val -f d_crypt; eval $csym; $val; then
7780         echo 'crypt() found.' >&4
7781         val="$define"
7782         cryptlib=''
7783 else
7784         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7785         if $test -z "$cryptlib"; then
7786                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7787         else
7788                 cryptlib=-lcrypt
7789         fi
7790         if $test -z "$cryptlib"; then
7791                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7792         else
7793                 cryptlib=-lcrypt
7794         fi
7795         if $test -z "$cryptlib"; then
7796                 cryptlib=`./loc libcrypt$_a "" $libpth`
7797         else
7798                 cryptlib=-lcrypt
7799         fi
7800         if $test -z "$cryptlib"; then
7801                 echo 'crypt() NOT found.' >&4
7802                 val="$undef"
7803         else
7804                 val="$define"
7805         fi
7806 fi
7807 set d_crypt
7808 eval $setvar
7809
7810 : get csh whereabouts
7811 case "$csh" in
7812 'csh') val="$undef" ;;
7813 *) val="$define" ;;
7814 esac
7815 set d_csh
7816 eval $setvar
7817 : Respect a hint or command line value for full_csh.
7818 case "$full_csh" in
7819 '') full_csh=$csh ;;
7820 esac
7821
7822 : see if cuserid exists
7823 set cuserid d_cuserid
7824 eval $inlibc
7825
7826 : see if this is a limits.h system
7827 set limits.h i_limits
7828 eval $inhdr
7829
7830 : see if this is a float.h system
7831 set float.h i_float
7832 eval $inhdr
7833
7834 : See if number of significant digits in a double precision number is known
7835 echo " "
7836 $cat >dbl_dig.c <<EOM
7837 #$i_limits I_LIMITS
7838 #$i_float I_FLOAT
7839 #ifdef I_LIMITS
7840 #include <limits.h>
7841 #endif
7842 #ifdef I_FLOAT
7843 #include <float.h>
7844 #endif
7845 #ifdef DBL_DIG
7846 printf("Contains DBL_DIG");
7847 #endif
7848 EOM
7849 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7850 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7851         echo "DBL_DIG found." >&4
7852         val="$define"
7853 else
7854         echo "DBL_DIG NOT found." >&4
7855         val="$undef"
7856 fi
7857 $rm -f dbl_dig.?
7858 set d_dbl_dig
7859 eval $setvar
7860
7861 : see if difftime exists
7862 set difftime d_difftime
7863 eval $inlibc
7864
7865 : see if this is a dirent system
7866 echo " "
7867 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7868         val="$define"
7869         echo "<dirent.h> found." >&4
7870 else
7871         val="$undef"
7872         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7873                 echo "<sys/dir.h> found." >&4
7874                 echo " "
7875         else
7876                 xinc=`./findhdr sys/ndir.h`
7877         fi
7878         echo "<dirent.h> NOT found." >&4
7879 fi
7880 set i_dirent
7881 eval $setvar
7882
7883 : Look for type of directory structure.
7884 echo " "
7885 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7886
7887 case "$direntrytype" in
7888 ''|' ')
7889         case "$i_dirent" in
7890         $define) guess1='struct dirent' ;;
7891         *) guess1='struct direct'  ;;
7892         esac
7893         ;;
7894 *)      guess1="$direntrytype"
7895         ;;
7896 esac
7897
7898 case "$guess1" in
7899 'struct dirent') guess2='struct direct' ;;
7900 *) guess2='struct dirent' ;;
7901 esac
7902                 
7903 if $contains "$guess1" try.c >/dev/null 2>&1; then
7904         direntrytype="$guess1"
7905         echo "Your directory entries are $direntrytype." >&4
7906 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7907         direntrytype="$guess2"
7908         echo "Your directory entries seem to be $direntrytype." >&4
7909 else
7910         echo "I don't recognize your system's directory entries." >&4
7911         rp="What type is used for directory entries on this system?"
7912         dflt="$guess1"
7913         . ./myread
7914         direntrytype="$ans"
7915 fi
7916 $rm -f try.c
7917
7918
7919 : see if the directory entry stores field length
7920 echo " "
7921 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7922 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7923         echo "Good, your directory entry keeps length information in d_namlen." >&4
7924         val="$define"
7925 else
7926         echo "Your directory entry does not know about the d_namlen field." >&4
7927         val="$undef"
7928 fi
7929 set d_dirnamlen
7930 eval $setvar
7931 $rm -f try.c
7932
7933 : see if dlerror exists
7934 xxx_runnm="$runnm"
7935 runnm=false
7936 set dlerror d_dlerror
7937 eval $inlibc
7938 runnm="$xxx_runnm"
7939
7940 : see if dlfcn is available
7941 set dlfcn.h i_dlfcn
7942 eval $inhdr
7943
7944 case "$usedl" in
7945 $define|y|true)
7946         $cat << EOM
7947
7948 On a few systems, the dynamically loaded modules that perl generates and uses
7949 will need a different extension than shared libs. The default will probably
7950 be appropriate.
7951
7952 EOM
7953         case "$dlext" in
7954         '')     dflt="$so" ;;
7955         *)      dflt="$dlext" ;;
7956         esac
7957         rp='What is the extension of dynamically loaded modules'
7958         . ./myread
7959         dlext="$ans"
7960         ;;
7961 *)
7962         dlext="none"
7963         ;;
7964 esac
7965
7966 : Check if dlsym need a leading underscore
7967 echo " "
7968 val="$undef"
7969
7970 case "$dlsrc" in
7971 dl_dlopen.xs)
7972         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7973         $cat >dyna.c <<'EOM'
7974 fred () { }
7975 EOM
7976
7977 $cat >fred.c<<EOM
7978
7979 #include <stdio.h>
7980 #$i_dlfcn I_DLFCN
7981 #ifdef I_DLFCN
7982 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7983 #else
7984 #include <sys/types.h>
7985 #include <nlist.h>
7986 #include <link.h>
7987 #endif
7988
7989 extern int fred() ;
7990
7991 int main()
7992 {
7993     void * handle ;
7994     void * symbol ;
7995 #ifndef RTLD_LAZY
7996     int mode = 1 ;
7997 #else
7998     int mode = RTLD_LAZY ;
7999 #endif
8000     handle = dlopen("./dyna.$dlext", mode) ;
8001     if (handle == NULL) {
8002         printf ("1\n") ;
8003         fflush (stdout) ;
8004         exit(0);
8005     }
8006     symbol = dlsym(handle, "fred") ;
8007     if (symbol == NULL) {
8008         /* try putting a leading underscore */
8009         symbol = dlsym(handle, "_fred") ;
8010         if (symbol == NULL) {
8011             printf ("2\n") ;
8012             fflush (stdout) ;
8013             exit(0);
8014         }
8015         printf ("3\n") ;
8016     }
8017     else
8018         printf ("4\n") ;
8019     fflush (stdout) ;
8020     exit(0);
8021 }
8022 EOM
8023         : Call the object file tmp-dyna.o in case dlext=o.
8024         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8025                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8026                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8027                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8028                 xxx=`./fred`
8029                 case $xxx in
8030                 1)      echo "Test program failed using dlopen." >&4
8031                         echo "Perhaps you should not use dynamic loading." >&4;;
8032                 2)      echo "Test program failed using dlsym." >&4
8033                         echo "Perhaps you should not use dynamic loading." >&4;;
8034                 3)      echo "dlsym needs a leading underscore" >&4
8035                         val="$define" ;;
8036                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8037                 esac
8038         else
8039                 echo "I can't compile and run the test program." >&4
8040                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8041         fi
8042         ;;
8043 esac
8044                 
8045 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8046
8047 set d_dlsymun
8048 eval $setvar
8049
8050 hasproto='varname=$1; func=$2; shift; shift;
8051 while $test $# -ge 2; do
8052         case "$1" in
8053         $define) echo "#include <$2>";;
8054         esac ;
8055     shift 2;
8056 done > try.c;
8057 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8058 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8059         echo "$func() prototype found.";
8060         val="$define";
8061 else
8062         echo "$func() prototype NOT found.";
8063         val="$undef";
8064 fi;
8065 set $varname;
8066 eval $setvar;
8067 $rm -f try.c tryout.c'
8068
8069 : see if prototype for drand48 is available
8070 echo " "
8071 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8072 eval $hasproto
8073
8074 : see if dup2 exists
8075 set dup2 d_dup2
8076 eval $inlibc
8077
8078 : see if eaccess exists
8079 set eaccess d_eaccess
8080 eval $inlibc
8081
8082 : see if endgrent exists
8083 set endgrent d_endgrent
8084 eval $inlibc
8085
8086 : see if endhostent exists
8087 set endhostent d_endhent
8088 eval $inlibc
8089
8090 : see if endnetent exists
8091 set endnetent d_endnent
8092 eval $inlibc
8093
8094 : see if endprotoent exists
8095 set endprotoent d_endpent
8096 eval $inlibc
8097
8098 : see if endpwent exists
8099 set endpwent d_endpwent
8100 eval $inlibc
8101
8102 : see if endservent exists
8103 set endservent d_endsent
8104 eval $inlibc
8105
8106 : see if endspent exists
8107 set endspent d_endspent
8108 eval $inlibc
8109
8110 : Locate the flags for 'open()'
8111 echo " "
8112 $cat >open3.c <<'EOCP'
8113 #include <sys/types.h>
8114 #ifdef I_FCNTL
8115 #include <fcntl.h>
8116 #endif
8117 #ifdef I_SYS_FILE
8118 #include <sys/file.h>
8119 #endif
8120 int main() {
8121         if(O_RDONLY);
8122 #ifdef O_TRUNC
8123         exit(0);
8124 #else
8125         exit(1);
8126 #endif
8127 }
8128 EOCP
8129 : check sys/file.h first to get FREAD on Sun
8130 if $test `./findhdr sys/file.h` && \
8131                 set open3 -DI_SYS_FILE && eval $compile; then
8132         h_sysfile=true;
8133         echo "<sys/file.h> defines the O_* constants..." >&4
8134         if ./open3; then
8135                 echo "and you have the 3 argument form of open()." >&4
8136                 val="$define"
8137         else
8138                 echo "but not the 3 argument form of open().  Oh, well." >&4
8139                 val="$undef"
8140         fi
8141 elif $test `./findhdr fcntl.h` && \
8142                 set open3 -DI_FCNTL && eval $compile; then
8143         h_fcntl=true;
8144         echo "<fcntl.h> defines the O_* constants..." >&4
8145         if ./open3; then
8146                 echo "and you have the 3 argument form of open()." >&4
8147                 val="$define"
8148         else
8149                 echo "but not the 3 argument form of open().  Oh, well." >&4
8150                 val="$undef"
8151         fi
8152 else
8153         val="$undef"
8154         echo "I can't find the O_* constant definitions!  You got problems." >&4
8155 fi
8156 set d_open3
8157 eval $setvar
8158 $rm -f open3*
8159
8160 : see which of string.h or strings.h is needed
8161 echo " "
8162 strings=`./findhdr string.h`
8163 if $test "$strings" && $test -r "$strings"; then
8164         echo "Using <string.h> instead of <strings.h>." >&4
8165         val="$define"
8166 else
8167         val="$undef"
8168         strings=`./findhdr strings.h`
8169         if $test "$strings" && $test -r "$strings"; then
8170                 echo "Using <strings.h> instead of <string.h>." >&4
8171         else
8172                 echo "No string header found -- You'll surely have problems." >&4
8173         fi
8174 fi
8175 set i_string
8176 eval $setvar
8177 case "$i_string" in
8178 "$undef") strings=`./findhdr strings.h`;;
8179 *)        strings=`./findhdr string.h`;;
8180 esac
8181
8182 : check for non-blocking I/O stuff
8183 case "$h_sysfile" in
8184 true) echo "#include <sys/file.h>" > head.c;;
8185 *)
8186         case "$h_fcntl" in
8187         true) echo "#include <fcntl.h>" > head.c;;
8188         *) echo "#include <sys/fcntl.h>" > head.c;;
8189         esac
8190         ;;
8191 esac
8192 echo " "
8193 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8194 case "$o_nonblock" in
8195 '')
8196         $cat head.c > try.c
8197         $cat >>try.c <<'EOCP'
8198 #include <stdio.h>
8199 int main() {
8200 #ifdef O_NONBLOCK
8201         printf("O_NONBLOCK\n");
8202         exit(0);
8203 #endif
8204 #ifdef O_NDELAY
8205         printf("O_NDELAY\n");
8206         exit(0);
8207 #endif
8208 #ifdef FNDELAY
8209         printf("FNDELAY\n");
8210         exit(0);
8211 #endif
8212         exit(0);
8213 }
8214 EOCP
8215         set try
8216         if eval $compile_ok; then
8217                 o_nonblock=`./try`
8218                 case "$o_nonblock" in
8219                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8220                 *) echo "Seems like we can use $o_nonblock.";;
8221                 esac
8222         else
8223                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8224         fi
8225         ;;
8226 *) echo "Using $hint value $o_nonblock.";;
8227 esac
8228 $rm -f try try.* .out core
8229
8230 echo " "
8231 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8232 case "$eagain" in
8233 '')
8234         $cat head.c > try.c
8235         $cat >>try.c <<EOCP
8236 #include <errno.h>
8237 #include <sys/types.h>
8238 #include <signal.h>
8239 #include <stdio.h> 
8240 #define MY_O_NONBLOCK $o_nonblock
8241 #ifndef errno  /* XXX need better Configure test */
8242 extern int errno;
8243 #endif
8244 #$i_unistd I_UNISTD
8245 #ifdef I_UNISTD
8246 #include <unistd.h>
8247 #endif
8248 #ifdef $i_string
8249 #include <string.h>
8250 #else
8251 #include <strings.h>
8252 #endif
8253 $signal_t blech(x) int x; { exit(3); }
8254 EOCP
8255         $cat >> try.c <<'EOCP'
8256 int main()
8257 {
8258         int pd[2];
8259         int pu[2];
8260         char buf[1];
8261         char string[100];
8262
8263         pipe(pd);       /* Down: child -> parent */
8264         pipe(pu);       /* Up: parent -> child */
8265         if (0 != fork()) {
8266                 int ret;
8267                 close(pd[1]);   /* Parent reads from pd[0] */
8268                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8269                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8270                         exit(1);
8271                 signal(SIGALRM, blech);
8272                 alarm(5);
8273                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8274                         exit(2);
8275                 sprintf(string, "%d\n", ret);
8276                 write(2, string, strlen(string));
8277                 alarm(0);
8278 #ifdef EAGAIN
8279                 if (errno == EAGAIN) {
8280                         printf("EAGAIN\n");
8281                         goto ok;
8282                 }
8283 #endif
8284 #ifdef EWOULDBLOCK
8285                 if (errno == EWOULDBLOCK)
8286                         printf("EWOULDBLOCK\n");
8287 #endif
8288         ok:
8289                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8290                 sleep(2);                               /* Give it time to close our pipe */
8291                 alarm(5);
8292                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8293                 alarm(0);
8294                 sprintf(string, "%d\n", ret);
8295                 write(3, string, strlen(string));
8296                 exit(0);
8297         }
8298
8299         close(pd[0]);                   /* We write to pd[1] */
8300         close(pu[1]);                   /* We read from pu[0] */
8301         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8302         close(pd[1]);                   /* Pipe pd is now fully closed! */
8303         exit(0);                                /* Bye bye, thank you for playing! */
8304 }
8305 EOCP
8306         set try
8307         if eval $compile_ok; then
8308                 echo "$startsh" >mtry
8309                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8310                 chmod +x mtry
8311                 ./mtry >/dev/null 2>&1
8312                 case $? in
8313                 0) eagain=`$cat try.out`;;
8314                 1) echo "Could not perform non-blocking setting!";;
8315                 2) echo "I did a successful read() for something that was not there!";;
8316                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8317                 *) echo "Something terribly wrong happened during testing.";;
8318                 esac
8319                 rd_nodata=`$cat try.ret`
8320                 echo "A read() system call with no data present returns $rd_nodata."
8321                 case "$rd_nodata" in
8322                 0|-1) ;;
8323                 *)
8324                         echo "(That's peculiar, fixing that to be -1.)"
8325                         rd_nodata=-1
8326                         ;;
8327                 esac
8328                 case "$eagain" in
8329                 '')
8330                         echo "Forcing errno EAGAIN on read() with no data available."
8331                         eagain=EAGAIN
8332                         ;;
8333                 *)
8334                         echo "Your read() sets errno to $eagain when no data is available."
8335                         ;;
8336                 esac
8337                 status=`$cat try.err`
8338                 case "$status" in
8339                 0) echo "And it correctly returns 0 to signal EOF.";;
8340                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8341                 *) echo "However, your read() returns '$status' on EOF??";;
8342                 esac
8343                 val="$define"
8344                 if test "$status" = "$rd_nodata"; then
8345                         echo "WARNING: you can't distinguish between EOF and no data!"
8346                         val="$undef"
8347                 fi
8348         else
8349                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8350                 eagain=EAGAIN
8351         fi
8352         set d_eofnblk
8353         eval $setvar
8354         ;;
8355 *)
8356         echo "Using $hint value $eagain."
8357         echo "Your read() returns $rd_nodata when no data is present."
8358         case "$d_eofnblk" in
8359         "$define") echo "And you can see EOF because read() returns 0.";;
8360         "$undef") echo "But you can't see EOF status from read() returned value.";;
8361         *)
8362                 echo "(Assuming you can't see EOF status from read anyway.)"
8363                 d_eofnblk=$undef
8364                 ;;
8365         esac
8366         ;;
8367 esac
8368 $rm -f try try.* .out core head.c mtry
8369
8370 : see if fchmod exists
8371 set fchmod d_fchmod
8372 eval $inlibc
8373
8374 : see if fchown exists
8375 set fchown d_fchown
8376 eval $inlibc
8377
8378 : see if this is an fcntl system
8379 set fcntl d_fcntl
8380 eval $inlibc
8381
8382 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8383 while $test $# -ge 2; do
8384         case "$1" in
8385         $define) echo "#include <$2>";;
8386         esac ;
8387     shift 2;
8388 done > try.c;
8389 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8390 set try;
8391 if eval $compile; then
8392         val="$define";
8393 else
8394         val="$undef";
8395 fi;
8396 set $varname;
8397 eval $setvar;
8398 $rm -f try.c try.o'
8399
8400 socketlib=''
8401 sockethdr=''
8402 : see whether socket exists
8403 echo " "
8404 $echo $n "Hmm... $c" >&4
8405 if set socket val -f d_socket; eval $csym; $val; then
8406         echo "Looks like you have Berkeley networking support." >&4
8407         d_socket="$define"
8408         if set setsockopt val -f; eval $csym; $val; then
8409                 d_oldsock="$undef"
8410         else
8411                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8412                 d_oldsock="$define"
8413         fi
8414 else
8415         if $contains socklib libc.list >/dev/null 2>&1; then
8416                 echo "Looks like you have Berkeley networking support." >&4
8417                 d_socket="$define"
8418                 : we will have to assume that it supports the 4.2 BSD interface
8419                 d_oldsock="$undef"
8420         else
8421                 echo "You don't have Berkeley networking in libc$_a..." >&4
8422                 if test "X$d_socket" = "X$define"; then
8423                    echo "...but you seem to believe that you have sockets." >&4
8424                 else
8425                         for net in net socket
8426                         do
8427                                 if test -f /usr/lib/lib$net$_a; then
8428                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8429                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8430                                         if $contains socket libc.list >/dev/null 2>&1; then
8431                                                 d_socket="$define"
8432                                                 socketlib="-l$net"
8433                                                 case "$net" in
8434                                                 net)
8435                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8436                                                         sockethdr="-I/usr/netinclude"
8437                                                         ;;
8438                                                 esac
8439                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8440                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8441                                                         d_oldsock="$undef"
8442                                                 else
8443                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8444                                                         d_oldsock="$define"
8445                                                 fi
8446                                                 break
8447                                         fi
8448                                 fi
8449                         done
8450                         if test "X$d_socket" != "X$define"; then
8451                            echo "or anywhere else I see." >&4
8452                            d_socket="$undef"
8453                            d_oldsock="$undef"
8454                         fi
8455                 fi
8456         fi
8457 fi
8458
8459 : see if socketpair exists
8460 set socketpair d_sockpair
8461 eval $inlibc
8462
8463
8464 echo " "
8465 echo "Checking the availability of certain socket constants..." >& 4
8466 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8467         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8468         $cat >try.c <<EOF
8469 #include <sys/types.h>
8470 #include <sys/socket.h>
8471 int main() {
8472     int i = $ENUM;
8473 }
8474 EOF
8475         val="$undef"
8476         set try; if eval $compile; then
8477                 val="$define"
8478         fi
8479         set d_${enum}; eval $setvar
8480         $rm -f try.c try
8481 done
8482
8483 : see if sys/select.h has to be included
8484 set sys/select.h i_sysselct
8485 eval $inhdr
8486
8487 : see if we should include time.h, sys/time.h, or both
8488 echo " "
8489 if test "X$timeincl" = X; then
8490         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8491         $echo $n "I'm now running the test program...$c"
8492         $cat >try.c <<'EOCP'
8493 #include <sys/types.h>
8494 #ifdef I_TIME
8495 #include <time.h>
8496 #endif
8497 #ifdef I_SYSTIME
8498 #ifdef SYSTIMEKERNEL
8499 #define KERNEL
8500 #endif
8501 #include <sys/time.h>
8502 #endif
8503 #ifdef I_SYSSELECT
8504 #include <sys/select.h>
8505 #endif
8506 int main()
8507 {
8508         struct tm foo;
8509 #ifdef S_TIMEVAL
8510         struct timeval bar;
8511 #endif
8512 #ifdef S_TIMEZONE
8513         struct timezone tzp;
8514 #endif
8515         if (foo.tm_sec == foo.tm_sec)
8516                 exit(0);
8517 #ifdef S_TIMEVAL
8518         if (bar.tv_sec == bar.tv_sec)
8519                 exit(0);
8520 #endif
8521         exit(1);
8522 }
8523 EOCP
8524         flags=''
8525         for s_timezone in '-DS_TIMEZONE' ''; do
8526         sysselect=''
8527         for s_timeval in '-DS_TIMEVAL' ''; do
8528         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8529         for i_time in '' '-DI_TIME'; do
8530         for i_systime in '-DI_SYSTIME' ''; do
8531                 case "$flags" in
8532                 '') $echo $n ".$c"
8533                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8534                         if eval $compile; then
8535                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8536                                 shift
8537                                 flags="$*"
8538                                 echo " "
8539                                 $echo $n "Succeeded with $flags$c"
8540                         fi
8541                         ;;
8542                 esac
8543         done
8544         done
8545         done
8546         done
8547         done
8548         timeincl=''
8549         echo " "
8550         case "$flags" in
8551         *SYSTIMEKERNEL*) i_systimek="$define"
8552                 timeincl=`./findhdr sys/time.h`
8553                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8554         *) i_systimek="$undef";;
8555         esac
8556         case "$flags" in
8557         *I_TIME*) i_time="$define"
8558                 timeincl=`./findhdr time.h`" $timeincl"
8559                 echo "We'll include <time.h>." >&4;;
8560         *) i_time="$undef";;
8561         esac
8562         case "$flags" in
8563         *I_SYSTIME*) i_systime="$define"
8564                 timeincl=`./findhdr sys/time.h`" $timeincl"
8565                 echo "We'll include <sys/time.h>." >&4;;
8566         *) i_systime="$undef";;
8567         esac
8568         $rm -f try.c try
8569 fi
8570
8571 : check for fd_set items
8572 $cat <<EOM
8573
8574 Checking to see how well your C compiler handles fd_set and friends ...
8575 EOM
8576 $cat >fd_set.c <<EOCP
8577 #$i_systime I_SYS_TIME
8578 #$i_sysselct I_SYS_SELECT
8579 #$d_socket HAS_SOCKET
8580 #include <sys/types.h>
8581 #ifdef HAS_SOCKET
8582 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8583 #endif
8584 #ifdef I_SYS_TIME
8585 #include <sys/time.h>
8586 #endif
8587 #ifdef I_SYS_SELECT
8588 #include <sys/select.h>
8589 #endif
8590 int main() {
8591         fd_set fds;
8592
8593 #ifdef TRYBITS
8594         if(fds.fds_bits);
8595 #endif
8596
8597 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8598         exit(0);
8599 #else
8600         exit(1);
8601 #endif
8602 }
8603 EOCP
8604 set fd_set -DTRYBITS
8605 if eval $compile; then
8606         d_fds_bits="$define"
8607         d_fd_set="$define"
8608         echo "Well, your system knows about the normal fd_set typedef..." >&4
8609         if ./fd_set; then
8610                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8611                 d_fd_macros="$define"
8612         else
8613                 $cat >&4 <<'EOM'
8614 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8615 EOM
8616                 d_fd_macros="$undef"
8617         fi
8618 else
8619         $cat <<'EOM'
8620 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8621 EOM
8622         set fd_set
8623         if eval $compile; then
8624                 d_fds_bits="$undef"
8625                 d_fd_set="$define"
8626                 echo "Well, your system has some sort of fd_set available..." >&4
8627                 if ./fd_set; then
8628                         echo "and you have the normal fd_set macros." >&4
8629                         d_fd_macros="$define"
8630                 else
8631                         $cat <<'EOM'
8632 but not the normal fd_set macros!  Gross!  More work for me...
8633 EOM
8634                         d_fd_macros="$undef"
8635                 fi
8636         else
8637         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8638                 d_fd_set="$undef"
8639                 d_fds_bits="$undef"
8640                 d_fd_macros="$undef"
8641         fi
8642 fi
8643 $rm -f fd_set*
8644
8645 : see if fgetpos exists
8646 set fgetpos d_fgetpos
8647 eval $inlibc
8648
8649 : see if flock exists
8650 set flock d_flock
8651 eval $inlibc
8652
8653 : see if fork exists
8654 set fork d_fork
8655 eval $inlibc
8656
8657 : see if pathconf exists
8658 set pathconf d_pathconf
8659 eval $inlibc
8660
8661 : see if fpathconf exists
8662 set fpathconf d_fpathconf
8663 eval $inlibc
8664
8665
8666 : check for off64_t
8667 echo " "
8668 echo "Checking to see if your system supports off64_t..." >&4
8669 $cat >try.c <<EOCP
8670 #include <sys/types.h>
8671 #include <unistd.h>
8672 int main() { off64_t x = 7; }'
8673 EOCP
8674 set try
8675 if eval $compile; then
8676         val="$define"
8677         echo "Yes, it does."
8678 else
8679         val="$undef"
8680         echo "No, it doesn't."
8681         case "$lseeksize" in
8682         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8683         esac
8684 fi
8685 $rm -f try.* try
8686 set d_off64_t
8687 eval $setvar
8688
8689 : check for fpos64_t
8690 echo " "
8691 echo "Checking to see if your system supports fpos64_t..." >&4
8692 $cat >try.c <<EOCP
8693 #include <sys/stdio.h>
8694 int main() { fpos64_t x x = 7; }'
8695 EOCP
8696 set try
8697 if eval $compile; then
8698         val="$define"
8699         echo "Yes, it does."
8700 else
8701         val="$undef"
8702         echo "No, it doesn't."
8703         case "$fpossize" in
8704         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8705         esac
8706 fi
8707 $rm -f try.* try
8708 set d_fpos64_t
8709 eval $setvar
8710
8711 hasstruct='varname=$1; struct=$2; shift; shift;
8712 while $test $# -ge 2; do
8713         case "$1" in
8714         $define) echo "#include <$2>";;
8715         esac ;
8716     shift 2;
8717 done > try.c;
8718 echo "int main () { struct $struct foo; }" >> try.c;
8719 set try;
8720 if eval $compile; then
8721         val="$define";
8722 else
8723         val="$undef";
8724 fi;
8725 set $varname;
8726 eval $setvar;
8727 $rm -f try.c try.o'
8728
8729 : see if this is a sys/param system
8730 set sys/param.h i_sysparam
8731 eval $inhdr
8732
8733 : see if this is a sys/mount.h system
8734 set sys/mount.h i_sysmount
8735 eval $inhdr
8736
8737 : see if sys/types.h has to be included
8738 set sys/types.h i_systypes
8739 eval $inhdr
8740
8741
8742 echo " "
8743 echo "Checking to see if your system supports struct fs_data..." >&4
8744 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8745 eval $hasstruct
8746 case "$d_fs_data_s" in
8747 "$define")      echo "Yes, it does."   ;;
8748 *)              echo "No, it doesn't." ;;
8749 esac
8750
8751 : see if fseeko exists
8752 set fseeko d_fseeko
8753 eval $inlibc
8754 case "$longsize" in
8755 8) echo "(Your long is 64 bits, so in a pinch you could use fseek.)" ;;
8756 esac
8757
8758 : see if fsetpos exists
8759 set fsetpos d_fsetpos
8760 eval $inlibc
8761
8762
8763 : see if fstatfs exists
8764 set fstatfs d_fstatfs
8765 eval $inlibc
8766
8767
8768 : see if statvfs exists
8769 set statvfs d_statvfs
8770 eval $inlibc
8771
8772 : see if fstatvfs exists
8773 set fstatvfs d_fstatvfs
8774 eval $inlibc
8775
8776
8777 : see if ftello exists
8778 set ftello d_ftello
8779 eval $inlibc
8780 case "$longsize" in
8781 8) echo "(Your long is 64 bits, so in a pinch you could use ftell.)" ;;
8782 esac
8783
8784 : see if getgrent exists
8785 set getgrent d_getgrent
8786 eval $inlibc
8787
8788 : see if gethostbyaddr exists
8789 set gethostbyaddr d_gethbyaddr
8790 eval $inlibc
8791
8792 : see if gethostbyname exists
8793 set gethostbyname d_gethbyname
8794 eval $inlibc
8795
8796 : see if gethostent exists
8797 set gethostent d_gethent
8798 eval $inlibc
8799
8800 : see how we will look up host name
8801 echo " "
8802 call=''
8803 if set gethostname val -f d_gethname; eval $csym; $val; then
8804         echo 'gethostname() found.' >&4
8805         d_gethname="$define"
8806         call=gethostname
8807 fi
8808 if set uname val -f d_uname; eval $csym; $val; then
8809         if ./xenix; then
8810                 $cat <<'EOM'
8811 uname() was found, but you're running xenix, and older versions of xenix
8812 have a broken uname(). If you don't really know whether your xenix is old
8813 enough to have a broken system call, use the default answer.
8814
8815 EOM
8816                 dflt=y
8817                 case "$d_uname" in
8818                 "$define") dflt=n;;
8819                 esac
8820                 rp='Is your uname() broken?'
8821                 . ./myread
8822                 case "$ans" in
8823                 n*) d_uname="$define"; call=uname;;
8824                 esac
8825         else
8826                 echo 'uname() found.' >&4
8827                 d_uname="$define"
8828                 case "$call" in
8829                 '') call=uname ;;
8830                 esac
8831         fi
8832 fi
8833 case "$d_gethname" in
8834 '') d_gethname="$undef";;
8835 esac
8836 case "$d_uname" in
8837 '') d_uname="$undef";;
8838 esac
8839 case "$d_uname$d_gethname" in
8840 *define*)
8841         dflt=n
8842         cat <<EOM
8843  
8844 Every now and then someone has a $call() that lies about the hostname
8845 but can't be fixed for political or economic reasons.  If you wish, I can
8846 pretend $call() isn't there and maybe compute hostname at run-time
8847 thanks to the '$phostname' command.
8848
8849 EOM
8850         rp="Shall I ignore $call() from now on?"
8851         . ./myread
8852         case "$ans" in
8853         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8854         esac;;
8855 esac
8856 case "$phostname" in
8857 '') aphostname='';;
8858 *) case "$aphostname" in
8859         /*) ;;
8860         *) set X $phostname
8861                 shift
8862                 file=$1
8863                 shift
8864                 file=`./loc $file $file $pth`
8865                 aphostname=`echo $file $*`
8866                 ;;
8867         esac
8868         ;;
8869 esac
8870 case "$d_uname$d_gethname" in
8871 *define*) ;;
8872 *)
8873         case "$phostname" in
8874         '')
8875                 echo "There will be no way for $package to get your hostname." >&4;;
8876         *)
8877         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8878                 ;;
8879         esac;;
8880 esac
8881 case "$d_phostname" in
8882 '') d_phostname="$undef";;
8883 esac
8884
8885 : see if this is a netdb.h system
8886 set netdb.h i_netdb
8887 eval $inhdr
8888
8889 : see if prototypes for various gethostxxx netdb.h functions are available
8890 echo " "
8891 set d_gethostprotos gethostent $i_netdb netdb.h
8892 eval $hasproto
8893
8894 : see if getlogin exists
8895 set getlogin d_getlogin
8896 eval $inlibc
8897
8898 : see if getmnt exists
8899 set getmnt d_getmnt
8900 eval $inlibc
8901
8902 : see if getmntent exists
8903 set getmntent d_getmntent
8904 eval $inlibc
8905
8906 : see if getnetbyaddr exists
8907 set getnetbyaddr d_getnbyaddr
8908 eval $inlibc
8909
8910 : see if getnetbyname exists
8911 set getnetbyname d_getnbyname
8912 eval $inlibc
8913
8914 : see if getnetent exists
8915 set getnetent d_getnent
8916 eval $inlibc
8917
8918 : see if prototypes for various getnetxxx netdb.h functions are available
8919 echo " "
8920 set d_getnetprotos getnetent $i_netdb netdb.h
8921 eval $hasproto
8922
8923
8924 : see if getprotobyname exists
8925 set getprotobyname d_getpbyname
8926 eval $inlibc
8927
8928 : see if getprotobynumber exists
8929 set getprotobynumber d_getpbynumber
8930 eval $inlibc
8931
8932 : see if getprotoent exists
8933 set getprotoent d_getpent
8934 eval $inlibc
8935
8936 : see if getpgid exists
8937 set getpgid d_getpgid
8938 eval $inlibc
8939
8940 : see if getpgrp2 exists
8941 set getpgrp2 d_getpgrp2
8942 eval $inlibc
8943
8944 : see if getppid exists
8945 set getppid d_getppid
8946 eval $inlibc
8947
8948 : see if getpriority exists
8949 set getpriority d_getprior
8950 eval $inlibc
8951
8952 : see if prototypes for various getprotoxxx netdb.h functions are available
8953 echo " "
8954 set d_getprotoprotos getprotoent $i_netdb netdb.h
8955 eval $hasproto
8956
8957 : see if getpwent exists
8958 set getpwent d_getpwent
8959 eval $inlibc
8960
8961
8962 : see if getservbyname exists
8963 set getservbyname d_getsbyname
8964 eval $inlibc
8965
8966 : see if getservbyport exists
8967 set getservbyport d_getsbyport
8968 eval $inlibc
8969
8970 : see if getservent exists
8971 set getservent d_getsent
8972 eval $inlibc
8973
8974 : see if prototypes for various getservxxx netdb.h functions are available
8975 echo " "
8976 set d_getservprotos getservent $i_netdb netdb.h
8977 eval $hasproto
8978
8979 : see if getspent exists
8980 set getspent d_getspent
8981 eval $inlibc
8982
8983 : see if getspnam exists
8984 set getspnam d_getspnam
8985 eval $inlibc
8986
8987 : see if gettimeofday or ftime exists
8988 set gettimeofday d_gettimeod
8989 eval $inlibc
8990 case "$d_gettimeod" in
8991 "$undef")
8992         set ftime d_ftime 
8993         eval $inlibc
8994         ;;
8995 *)
8996         val="$undef"; set d_ftime; eval $setvar
8997         ;;
8998 esac
8999 case "$d_gettimeod$d_ftime" in
9000 "$undef$undef")
9001         echo " "
9002         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9003         ;;
9004 esac
9005
9006 : see if this is an grp system
9007 set grp.h i_grp
9008 eval $inhdr
9009
9010 case "$i_grp" in
9011 $define)
9012         xxx=`./findhdr grp.h`
9013         $cppstdin $cppflags $cppminus < $xxx >$$.h
9014
9015         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9016                 val="$define"
9017         else
9018                 val="$undef"
9019         fi
9020         set d_grpasswd
9021         eval $setvar
9022
9023         $rm -f $$.h
9024         ;;
9025 *)
9026         val="$undef";
9027         set d_grpasswd; eval $setvar
9028         ;;
9029 esac
9030
9031 : see if hasmntopt exists
9032 set hasmntopt d_hasmntopt
9033 eval $inlibc
9034
9035 : see if this is a netinet/in.h or sys/in.h system
9036 set netinet/in.h i_niin sys/in.h i_sysin
9037 eval $inhdr
9038
9039 : see if arpa/inet.h has to be included
9040 set arpa/inet.h i_arpainet
9041 eval $inhdr
9042
9043 : see if htonl --and friends-- exists
9044 val=''
9045 set htonl val
9046 eval $inlibc
9047
9048 : Maybe they are macros.
9049 case "$val" in
9050 $undef)
9051         $cat >htonl.c <<EOM
9052 #include <stdio.h>
9053 #include <sys/types.h>
9054 #$i_niin I_NETINET_IN
9055 #$i_sysin I_SYS_IN
9056 #$i_arpainet I_ARPA_INET
9057 #ifdef I_NETINET_IN
9058 #include <netinet/in.h>
9059 #endif
9060 #ifdef I_SYS_IN
9061 #include <sys/in.h>
9062 #endif
9063 #ifdef I_ARPA_INET
9064 #include <arpa/inet.h>
9065 #endif
9066 #ifdef htonl
9067 printf("Defined as a macro.");
9068 #endif
9069 EOM
9070         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9071         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9072                 val="$define"
9073                 echo "But it seems to be defined as a macro." >&4
9074         fi
9075         $rm -f htonl.?
9076         ;;
9077 esac
9078 set d_htonl
9079 eval $setvar
9080
9081 : index or strchr
9082 echo " "
9083 if set index val -f; eval $csym; $val; then
9084         if set strchr val -f d_strchr; eval $csym; $val; then
9085                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9086                         val="$define"
9087                         vali="$undef"
9088                         echo "strchr() found." >&4
9089                 else
9090                         val="$undef"
9091                         vali="$define"
9092                         echo "index() found." >&4
9093                 fi
9094         else
9095                 val="$undef"
9096                 vali="$define"
9097                 echo "index() found." >&4
9098         fi
9099 else
9100         if set strchr val -f d_strchr; eval $csym; $val; then
9101                 val="$define"
9102                 vali="$undef"
9103                 echo "strchr() found." >&4
9104         else
9105                 echo "No index() or strchr() found!" >&4
9106                 val="$undef"
9107                 vali="$undef"
9108         fi
9109 fi
9110 set d_strchr; eval $setvar
9111 val="$vali"
9112 set d_index; eval $setvar
9113
9114 : check whether inet_aton exists
9115 set inet_aton d_inetaton
9116 eval $inlibc
9117
9118 : see if inttypes.h is available
9119 : we want a real compile instead of Inhdr because some systems
9120 : have an inttypes.h which includes non-existent headers
9121 echo " "
9122 $cat >try.c <<EOCP
9123 #include <inttypes.h>
9124 int main() {
9125         static int32_t foo32 = 0x12345678;
9126 }
9127 EOCP
9128 set try
9129 if eval $compile; then
9130         echo "<inttypes.h> found." >&4
9131         val="$define"
9132 else
9133         echo "<inttypes.h> NOT found." >&4
9134         val="$undef"
9135 fi
9136 $rm -f try.c try
9137 set i_inttypes
9138 eval $setvar
9139
9140 : check for int64_t
9141 echo " "
9142 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9143 $cat >try.c <<EOCP
9144 #include <sys/types.h>
9145 #$i_inttypes I_INTTYPES
9146 #ifdef I_INTTYPES
9147 #include <inttypes.h>
9148 #endif
9149 int main() { int64_t x = 7; }
9150 EOCP
9151 set try
9152 if eval $compile; then
9153         val="$define"
9154         echo " Yes, it does." >&4
9155 else
9156         val="$undef"
9157         echo " No, it doesn't." >&4
9158 fi
9159 $rm -f try try.*
9160 set d_int64t
9161 eval $setvar
9162
9163 : Look for isascii
9164 echo " "
9165 $cat >isascii.c <<'EOCP'
9166 #include <stdio.h>
9167 #include <ctype.h>
9168 int main() {
9169         int c = 'A';
9170         if (isascii(c))
9171                 exit(0);
9172         else
9173                 exit(1);
9174 }
9175 EOCP
9176 set isascii
9177 if eval $compile; then
9178         echo "isascii() found." >&4
9179         val="$define"
9180 else
9181         echo "isascii() NOT found." >&4
9182         val="$undef"
9183 fi
9184 set d_isascii
9185 eval $setvar
9186 $rm -f isascii*
9187
9188 : see if killpg exists
9189 set killpg d_killpg
9190 eval $inlibc
9191
9192 : see if lchown exists
9193 echo " "
9194 $cat > try.c <<'EOCP'
9195 /* System header to define __stub macros and hopefully few prototypes,
9196     which can conflict with char lchown(); below.  */
9197 #include <assert.h>
9198 /* Override any gcc2 internal prototype to avoid an error.  */
9199 /* We use char because int might match the return type of a gcc2
9200    builtin and then its argument prototype would still apply.  */
9201 char lchown();
9202 int main() {
9203     /*  The GNU C library defines this for functions which it implements
9204         to always fail with ENOSYS.  Some functions are actually named
9205         something starting with __ and the normal name is an alias.  */
9206 #if defined (__stub_lchown) || defined (__stub___lchown)
9207 choke me
9208 #else
9209 lchown();
9210 #endif
9211 ; return 0; }
9212 EOCP
9213 set try
9214 if eval $compile; then
9215     $echo "lchown() found." >&4
9216     val="$define"
9217 else
9218     $echo "lchown() NOT found." >&4
9219     val="$undef"
9220 fi
9221 set d_lchown
9222 eval $setvar
9223
9224 : See if number of significant digits in a double precision number is known
9225 echo " "
9226 $cat >ldbl_dig.c <<EOM
9227 #$i_limits I_LIMITS
9228 #$i_float I_FLOAT
9229 #ifdef I_LIMITS
9230 #include <limits.h>
9231 #endif
9232 #ifdef I_FLOAT
9233 #include <float.h>
9234 #endif
9235 #ifdef LDBL_DIG
9236 printf("Contains LDBL_DIG");
9237 #endif
9238 EOM
9239 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9240 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9241         echo "LDBL_DIG found." >&4
9242         val="$define"
9243 else
9244         echo "LDBL_DIG NOT found." >&4
9245         val="$undef"
9246 fi
9247 $rm -f ldbl_dig.?
9248 set d_ldbl_dig
9249 eval $setvar
9250
9251 : see if link exists
9252 set link d_link
9253 eval $inlibc
9254
9255 : see if localeconv exists
9256 set localeconv d_locconv
9257 eval $inlibc
9258
9259 : see if lockf exists
9260 set lockf d_lockf
9261 eval $inlibc
9262
9263 : check for long long
9264 echo " "
9265 $echo $n "Checking to see if your system supports long long..." $c >&4
9266 echo 'int main() { long long x = 7; return 0; }' > try.c
9267 set try
9268 if eval $compile; then
9269         val="$define"
9270         echo " Yes, it does." >&4
9271 else
9272         val="$undef"
9273         echo " No, it doesn't." >&4
9274 fi
9275 $rm try.*
9276 set d_longlong
9277 eval $setvar
9278
9279 : check for length of long long
9280 case "${d_longlong}${longlongsize}" in
9281 $define)
9282         echo " "
9283         $echo $n "Checking to see how big your long longs are..." $c >&4
9284         $cat >try.c <<'EOCP'
9285 #include <stdio.h>
9286 int main()
9287 {
9288     printf("%d\n", (int)sizeof(long long));
9289     return(0);
9290 }
9291 EOCP
9292         set try
9293         if eval $compile_ok; then
9294                 longlongsize=`./try$exe_ext`
9295                 $echo " $longlongsize bytes." >&4
9296         else
9297                 dflt='8'
9298                 echo " "
9299                 echo "(I can't seem to compile the test program.  Guessing...)"
9300                 rp="What is the size of a long long (in bytes)?"
9301                 . ./myread
9302                 longlongsize="$ans"
9303         fi
9304         if $test "X$longsize" = "X$longlongsize"; then
9305                 echo "(That isn't any different from an ordinary long.)"
9306         fi      
9307         ;;
9308 esac
9309 $rm -f try.* try
9310
9311 : see if lstat exists
9312 set lstat d_lstat
9313 eval $inlibc
9314
9315 : see if mblen exists
9316 set mblen d_mblen
9317 eval $inlibc
9318
9319 : see if mbstowcs exists
9320 set mbstowcs d_mbstowcs
9321 eval $inlibc
9322
9323 : see if mbtowc exists
9324 set mbtowc d_mbtowc
9325 eval $inlibc
9326
9327 : see if memchr exists
9328 set memchr d_memchr
9329 eval $inlibc
9330
9331 : see if memcmp exists
9332 set memcmp d_memcmp
9333 eval $inlibc
9334
9335 : see if memcpy exists
9336 set memcpy d_memcpy
9337 eval $inlibc
9338
9339 : see if memmove exists
9340 set memmove d_memmove
9341 eval $inlibc
9342
9343 : see if memset exists
9344 set memset d_memset
9345 eval $inlibc
9346
9347 : see if mkdir exists
9348 set mkdir d_mkdir
9349 eval $inlibc
9350
9351 : see if mkfifo exists
9352 set mkfifo d_mkfifo
9353 eval $inlibc
9354
9355 : see if mktime exists
9356 set mktime d_mktime
9357 eval $inlibc
9358
9359 : see if msgctl exists
9360 set msgctl d_msgctl
9361 eval $inlibc
9362
9363 : see if msgget exists
9364 set msgget d_msgget
9365 eval $inlibc
9366
9367 : see if msgsnd exists
9368 set msgsnd d_msgsnd
9369 eval $inlibc
9370
9371 : see if msgrcv exists
9372 set msgrcv d_msgrcv
9373 eval $inlibc
9374
9375 : see how much of the 'msg*(2)' library is present.
9376 h_msg=true
9377 echo " "
9378 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9379 *"$undef"*) h_msg=false;;
9380 esac
9381 case "$osname" in
9382 freebsd)
9383     case "`ipcs 2>&1`" in
9384     "SVID messages"*"not configured"*)
9385         echo "Your $osname does not have the msg*(2) configured." >&4
9386         h_msg=false
9387         val="$undef"
9388         set msgctl d_msgctl
9389         eval $setvar
9390         set msgget d_msgget
9391         eval $setvar
9392         set msgsnd d_msgsnd
9393         eval $setvar
9394         set msgrcv d_msgrcv
9395         eval $setvar
9396         ;;
9397     esac
9398     ;;
9399 esac
9400 : we could also check for sys/ipc.h ...
9401 if $h_msg && $test `./findhdr sys/msg.h`; then
9402         echo "You have the full msg*(2) library." >&4
9403         val="$define"
9404 else
9405         echo "You don't have the full msg*(2) library." >&4
9406         val="$undef"
9407 fi
9408 set d_msg
9409 eval $setvar
9410
9411 : see if nice exists
9412 set nice d_nice
9413 eval $inlibc
9414
9415 : see if POSIX threads are available
9416 set pthread.h i_pthread
9417 eval $inhdr
9418
9419
9420
9421
9422 : how to create joinable pthreads
9423 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9424         echo " "
9425         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9426         $cat >try.c <<'EOCP'
9427 #include <pthread.h>
9428 int main() {
9429     int detachstate = JOINABLE;
9430 }
9431 EOCP
9432         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9433         if eval $compile; then
9434                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9435                 val="$undef" # Yes, undef.
9436                 set d_old_pthread_create_joinable
9437                 eval $setvar
9438                 val=""
9439                 set old_pthread_create_joinable
9440                 eval $setvar
9441         else
9442                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9443                 if eval $compile; then
9444                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9445                         val="$define"
9446                         set d_old_pthread_create_joinable
9447                         eval $setvar
9448                         val=PTHREAD_CREATE_UNDETACHED
9449                         set old_pthread_create_joinable
9450                         eval $setvar
9451                 else            
9452                         set try -DJOINABLE=__UNDETACHED
9453                         if eval $compile; then
9454                                 echo "You seem to use __UNDETACHED." >&4
9455                                 val="$define"
9456                                 set d_old_pthread_create_joinable
9457                                 eval $setvar
9458                                 val=__UNDETACHED
9459                                 set old_pthread_create_joinable
9460                                 eval $setvar
9461                         else
9462                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9463                                 val="$define"
9464                                 set d_old_pthread_create_joinable
9465                                 eval $setvar
9466                                 val=0
9467                                 set old_pthread_create_joinable
9468                                 eval $setvar
9469                         fi
9470                 fi
9471         fi
9472         $rm -f try try.*
9473 else
9474     d_old_pthread_create_joinable="$undef"
9475     old_pthread_create_joinable=""
9476 fi
9477
9478 : see if pause exists
9479 set pause d_pause
9480 eval $inlibc
9481
9482 : see if pipe exists
9483 set pipe d_pipe
9484 eval $inlibc
9485
9486 : see if poll exists
9487 set poll d_poll
9488 eval $inlibc
9489
9490
9491 : see whether the various POSIXish _yields exist
9492 $cat >try.c <<EOP
9493 #include <pthread.h>
9494 #include <stdio.h>
9495 int main() {
9496 #ifdef SCHED_YIELD
9497         sched_yield();
9498 #else
9499 #ifdef PTHREAD_YIELD
9500         pthread_yield();
9501 #else
9502 #ifdef PTHREAD_YIELD_NULL
9503         pthread_yield(NULL);
9504 #endif
9505 #endif
9506 #endif
9507 }
9508 EOP
9509 : see if sched_yield exists
9510 set try -DSCHED_YIELD
9511 if eval $compile; then
9512     val="$define"
9513     sched_yield='sched_yield()'
9514 else
9515     val="$undef"
9516 fi
9517 case "$usethreads" in
9518 $define)
9519         case "$val" in
9520         $define) echo 'sched_yield() found.' >&4        ;;
9521         *)       echo 'sched_yield() NOT found.' >&4    ;;
9522         esac
9523 esac
9524 set d_sched_yield
9525 eval $setvar
9526
9527 : see if pthread_yield exists
9528 set try -DPTHREAD_YIELD
9529 if eval $compile; then
9530     val="$define"
9531     case "$sched_yield" in
9532     '') sched_yield='pthread_yield()' ;;
9533     esac
9534 else
9535     set try -DPTHREAD_YIELD_NULL
9536     if eval $compile; then
9537         val="$define"
9538         case "$sched_yield" in
9539         '') sched_yield='pthread_yield(NULL)' ;;
9540         esac
9541     else
9542         val="$undef"
9543     fi
9544 fi
9545 case "$usethreads" in
9546 $define)
9547         case "$val" in
9548         $define) echo 'pthread_yield() found.' >&4      ;;
9549         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9550         esac
9551         ;;
9552 esac
9553 set d_pthread_yield
9554 eval $setvar
9555
9556 case "$sched_yield" in
9557 '') sched_yield=undef ;;
9558 esac
9559
9560 $rm -f try try.*
9561
9562 : see if this is a pwd.h system
9563 set pwd.h i_pwd
9564 eval $inhdr
9565
9566 case "$i_pwd" in
9567 $define)
9568         xxx=`./findhdr pwd.h`
9569         $cppstdin $cppflags $cppminus < $xxx >$$.h
9570
9571         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9572                 val="$define"
9573         else
9574                 val="$undef"
9575         fi
9576         set d_pwquota
9577         eval $setvar
9578
9579         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9580                 val="$define"
9581         else
9582                 val="$undef"
9583         fi
9584         set d_pwage
9585         eval $setvar
9586
9587         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9588                 val="$define"
9589         else
9590                 val="$undef"
9591         fi
9592         set d_pwchange
9593         eval $setvar
9594
9595         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9596                 val="$define"
9597         else
9598                 val="$undef"
9599         fi
9600         set d_pwclass
9601         eval $setvar
9602
9603         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9604                 val="$define"
9605         else
9606                 val="$undef"
9607         fi
9608         set d_pwexpire
9609         eval $setvar
9610
9611         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9612                 val="$define"
9613         else
9614                 val="$undef"
9615         fi
9616         set d_pwcomment
9617         eval $setvar
9618
9619         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9620                 val="$define"
9621         else
9622                 val="$undef"
9623         fi
9624         set d_pwgecos
9625         eval $setvar
9626
9627         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9628                 val="$define"
9629         else
9630                 val="$undef"
9631         fi
9632         set d_pwpasswd
9633         eval $setvar
9634
9635         $rm -f $$.h
9636         ;;
9637 *)
9638         val="$undef"; 
9639         set d_pwquota; eval $setvar
9640         set d_pwage; eval $setvar
9641         set d_pwchange; eval $setvar
9642         set d_pwclass; eval $setvar
9643         set d_pwexpire; eval $setvar
9644         set d_pwcomment; eval $setvar
9645         set d_pwgecos; eval $setvar
9646         set d_pwpasswd; eval $setvar
9647         ;;
9648 esac
9649
9650
9651 echo " "
9652 echo "Checking which 64-bit integer type we could use..." >&4
9653
9654 case "$intsize" in
9655 8) val=int
9656    set quadtype
9657    eval $setvar
9658    val='"unsigned int"'
9659    set uquadtype
9660    eval $setvar
9661    quadkind=1
9662    ;;
9663 *) case "$longsize" in
9664    8) val=long
9665       set quadtype
9666       eval $setvar
9667       val='"unsigned long"'
9668       set uquadtype
9669       eval $setvar
9670       quadkind=2
9671       ;;
9672    *) case "$uselonglong:$d_longlong:$longlongsize" in
9673       define:define:8)
9674         val='"long long"'
9675         set quadtype
9676         eval $setvar
9677         val='"unsigned long long"'
9678         set uquadtype
9679         eval $setvar
9680         quadkind=3
9681         ;;
9682       *) case "$d_int64t" in
9683          define)
9684            val=int64_t
9685            set quadtype
9686            eval $setvar
9687            val=uint64_t
9688            set uquadtype
9689            eval $setvar
9690            quadkind=4
9691            ;;
9692          esac
9693          ;;
9694       esac
9695       ;;
9696    esac
9697    ;;
9698 esac
9699
9700 case "$quadtype" in
9701 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9702         undef:define:8)
9703            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9704         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9705         esac
9706         d_quad="$undef"
9707         ;;
9708 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9709             verb="will"
9710         else
9711             verb="could"
9712         fi
9713         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9714         d_quad="$define"
9715         ;;
9716 esac
9717
9718 : see if readdir and friends exist
9719 set readdir d_readdir
9720 eval $inlibc
9721 set seekdir d_seekdir
9722 eval $inlibc
9723 set telldir d_telldir
9724 eval $inlibc
9725 set rewinddir d_rewinddir
9726 eval $inlibc
9727
9728 : see if readlink exists
9729 set readlink d_readlink
9730 eval $inlibc
9731
9732 : see if rename exists
9733 set rename d_rename
9734 eval $inlibc
9735
9736 : see if rmdir exists
9737 set rmdir d_rmdir
9738 eval $inlibc
9739
9740 : see if memory.h is available.
9741 val=''
9742 set memory.h val
9743 eval $inhdr
9744
9745 : See if it conflicts with string.h
9746 case "$val" in
9747 $define)
9748         case "$strings" in
9749         '') ;;
9750         *)
9751                 $cppstdin $cppflags $cppminus < $strings > mem.h
9752                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9753                         echo " "
9754                         echo "We won't be including <memory.h>."
9755                         val="$undef"
9756                 fi
9757                 $rm -f mem.h
9758                 ;;
9759         esac
9760 esac
9761 set i_memory
9762 eval $setvar
9763
9764 : can bcopy handle overlapping blocks?
9765 val="$undef"
9766 case "$d_bcopy" in
9767 "$define")
9768         echo " "
9769         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9770         $cat >try.c <<EOCP
9771 #$i_memory I_MEMORY
9772 #$i_stdlib I_STDLIB
9773 #$i_string I_STRING
9774 #$i_unistd I_UNISTD
9775 EOCP
9776         $cat >>try.c <<'EOCP'
9777 #include <stdio.h>
9778 #ifdef I_MEMORY
9779 #  include <memory.h>
9780 #endif
9781 #ifdef I_STDLIB
9782 #  include <stdlib.h>
9783 #endif
9784 #ifdef I_STRING
9785 #  include <string.h>
9786 #else
9787 #  include <strings.h>
9788 #endif
9789 #ifdef I_UNISTD
9790 #  include <unistd.h>  /* Needed for NetBSD */
9791 #endif
9792 int main()
9793 {
9794 char buf[128], abc[128];
9795 char *b;
9796 int len;
9797 int off;
9798 int align;
9799
9800 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9801
9802 for (align = 7; align >= 0; align--) {
9803         for (len = 36; len; len--) {
9804                 b = buf+align;
9805                 bcopy(abc, b, len);
9806                 for (off = 1; off <= len; off++) {
9807                         bcopy(b, b+off, len);
9808                         bcopy(b+off, b, len);
9809                         if (bcmp(b, abc, len))
9810                                 exit(1);
9811                 }
9812         }
9813 }
9814 exit(0);
9815 }
9816 EOCP
9817         set try
9818         if eval $compile_ok; then
9819                 if ./try 2>/dev/null; then
9820                         echo "Yes, it can."
9821                         val="$define"
9822                 else
9823                         echo "It can't, sorry."
9824                         case "$d_memmove" in
9825                         "$define") echo "But that's Ok since you have memmove()." ;;
9826                         esac
9827                 fi
9828         else
9829                 echo "(I can't compile the test program, so we'll assume not...)"
9830                 case "$d_memmove" in
9831                 "$define") echo "But that's Ok since you have memmove()." ;;
9832                 esac
9833         fi
9834         ;;
9835 esac
9836 $rm -f try.* try core
9837 set d_safebcpy
9838 eval $setvar
9839
9840 : can memcpy handle overlapping blocks?
9841 val="$undef"
9842 case "$d_memcpy" in
9843 "$define")
9844         echo " "
9845         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9846         $cat >try.c <<EOCP
9847 #$i_memory I_MEMORY
9848 #$i_stdlib I_STDLIB
9849 #$i_string I_STRING
9850 #$i_unistd I_UNISTD
9851 EOCP
9852         $cat >>try.c <<'EOCP'
9853 #include <stdio.h>
9854 #ifdef I_MEMORY
9855 #  include <memory.h>
9856 #endif
9857 #ifdef I_STDLIB
9858 #  include <stdlib.h>
9859 #endif
9860 #ifdef I_STRING
9861 #  include <string.h>
9862 #else
9863 #  include <strings.h>
9864 #endif
9865 #ifdef I_UNISTD
9866 #  include <unistd.h>  /* Needed for NetBSD */
9867 #endif
9868 int main()
9869 {
9870 char buf[128], abc[128];
9871 char *b;
9872 int len;
9873 int off;
9874 int align;
9875
9876 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9877    try to store the string in read-only memory. */
9878 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9879
9880 for (align = 7; align >= 0; align--) {
9881         for (len = 36; len; len--) {
9882                 b = buf+align;
9883                 memcpy(b, abc, len);
9884                 for (off = 1; off <= len; off++) {
9885                         memcpy(b+off, b, len);
9886                         memcpy(b, b+off, len);
9887                         if (memcmp(b, abc, len))
9888                                 exit(1);
9889                 }
9890         }
9891 }
9892 exit(0);
9893 }
9894 EOCP
9895         set try
9896         if eval $compile_ok; then
9897                 if ./try 2>/dev/null; then
9898                         echo "Yes, it can."
9899                         val="$define"
9900                 else
9901                         echo "It can't, sorry."
9902                         case "$d_memmove" in
9903                         "$define") echo "But that's Ok since you have memmove()." ;;
9904                         esac
9905                 fi
9906         else
9907                 echo "(I can't compile the test program, so we'll assume not...)"
9908                 case "$d_memmove" in
9909                 "$define") echo "But that's Ok since you have memmove()." ;;
9910                 esac
9911         fi
9912         ;;
9913 esac
9914 $rm -f try.* try core
9915 set d_safemcpy
9916 eval $setvar
9917
9918 : can memcmp be trusted to compare relative magnitude?
9919 val="$undef"
9920 case "$d_memcmp" in
9921 "$define")
9922         echo " "
9923         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9924         $cat >try.c <<EOCP
9925 #$i_memory I_MEMORY
9926 #$i_stdlib I_STDLIB
9927 #$i_string I_STRING
9928 #$i_unistd I_UNISTD
9929 EOCP
9930         $cat >>try.c <<'EOCP'
9931 #include <stdio.h>
9932 #ifdef I_MEMORY
9933 #  include <memory.h>
9934 #endif
9935 #ifdef I_STDLIB
9936 #  include <stdlib.h>
9937 #endif
9938 #ifdef I_STRING
9939 #  include <string.h>
9940 #else
9941 #  include <strings.h>
9942 #endif
9943 #ifdef I_UNISTD
9944 #  include <unistd.h>  /* Needed for NetBSD */
9945 #endif
9946 int main()
9947 {
9948 char a = -1;
9949 char b = 0;
9950 if ((a < b) && memcmp(&a, &b, 1) < 0)
9951         exit(1);
9952 exit(0);
9953 }
9954 EOCP
9955         set try
9956         if eval $compile_ok; then
9957                 if ./try 2>/dev/null; then
9958                         echo "Yes, it can."
9959                         val="$define"
9960                 else
9961                         echo "No, it can't (it uses signed chars)."
9962                 fi
9963         else
9964                 echo "(I can't compile the test program, so we'll assume not...)"
9965         fi
9966         ;;
9967 esac
9968 $rm -f try.* try core
9969 set d_sanemcmp
9970 eval $setvar
9971
9972 : see if select exists
9973 set select d_select
9974 eval $inlibc
9975
9976 : see if semctl exists
9977 set semctl d_semctl
9978 eval $inlibc
9979
9980 : see if semget exists
9981 set semget d_semget
9982 eval $inlibc
9983
9984 : see if semop exists
9985 set semop d_semop
9986 eval $inlibc
9987
9988 : see how much of the 'sem*(2)' library is present.
9989 h_sem=true
9990 echo " "
9991 case "$d_semctl$d_semget$d_semop" in
9992 *"$undef"*) h_sem=false;;
9993 esac
9994 case "$osname" in
9995 freebsd)
9996     case "`ipcs 2>&1`" in
9997     "SVID messages"*"not configured"*)
9998         echo "Your $osname does not have the sem*(2) configured." >&4
9999         h_sem=false
10000         val="$undef"
10001         set semctl d_semctl
10002         eval $setvar
10003         set semget d_semget
10004         eval $setvar
10005         set semop d_semop
10006         eval $setvar
10007         ;;
10008     esac
10009     ;;
10010 esac
10011 : we could also check for sys/ipc.h ...
10012 if $h_sem && $test `./findhdr sys/sem.h`; then
10013         echo "You have the full sem*(2) library." >&4
10014         val="$define"
10015 else
10016         echo "You don't have the full sem*(2) library." >&4
10017         val="$undef"
10018 fi
10019 set d_sem
10020 eval $setvar
10021
10022 : see whether sys/sem.h defines union semun
10023 echo " "
10024 $cat > try.c <<'END'
10025 #include <sys/types.h>
10026 #include <sys/ipc.h>
10027 #include <sys/sem.h>
10028 int main () { union semun semun; semun.buf = 0; }
10029 END
10030 set try
10031 if eval $compile; then
10032     echo "You have union semun in <sys/sem.h>." >&4
10033     val="$define"
10034 else
10035     echo "You do not have union semun in <sys/sem.h>." >&4
10036     val="$undef"
10037 fi
10038 $rm -f try try.c try.h
10039 set d_union_semun
10040 eval $setvar
10041
10042 : see how to do semctl IPC_STAT
10043 case "$d_sem" in
10044 $define)
10045     : see whether semctl IPC_STAT can use union semun
10046     echo " "
10047     $cat > try.h <<END
10048 #ifndef S_IRUSR
10049 #   ifdef S_IREAD
10050 #       define S_IRUSR S_IREAD
10051 #       define S_IWUSR S_IWRITE
10052 #       define S_IXUSR S_IEXEC
10053 #   else
10054 #       define S_IRUSR 0400
10055 #       define S_IWUSR 0200
10056 #       define S_IXUSR 0100
10057 #   endif
10058 #   define S_IRGRP (S_IRUSR>>3)
10059 #   define S_IWGRP (S_IWUSR>>3)
10060 #   define S_IXGRP (S_IXUSR>>3)
10061 #   define S_IROTH (S_IRUSR>>6)
10062 #   define S_IWOTH (S_IWUSR>>6)
10063 #   define S_IXOTH (S_IXUSR>>6)
10064 #endif
10065 #ifndef S_IRWXU
10066 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10067 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10068 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10069 #endif
10070 END
10071
10072     $cat > try.c <<END
10073 #include <sys/types.h>
10074 #include <sys/ipc.h>
10075 #include <sys/sem.h>
10076 #include <sys/stat.h>
10077 #include <stdio.h>
10078 #include <errno.h>
10079 #include "try.h"
10080 #ifndef errno
10081 extern int errno;
10082 #endif
10083 #$d_union_semun HAS_UNION_SEMUN
10084 int main() {
10085     union semun
10086 #ifndef HAS_UNION_SEMUN
10087     {
10088         int val;
10089         struct semid_ds *buf;
10090         unsigned short *array;
10091     }
10092 #endif
10093     arg;
10094     int sem, st;
10095
10096 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10097     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10098     if (sem > -1) {
10099         struct semid_ds argbuf;
10100         arg.buf = &argbuf;
10101 #       ifdef IPC_STAT
10102         st = semctl(sem, 0, IPC_STAT, arg);
10103         if (st == 0)
10104             printf("semun\n");
10105         else
10106 #       endif /* IPC_STAT */
10107             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10108 #       ifdef IPC_RMID
10109         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10110 #       endif /* IPC_RMID */
10111             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10112     } else
10113 #endif /* IPC_PRIVATE && ... */
10114         printf("semget failed: errno = %d\n", errno);
10115   return 0;
10116 }
10117 END
10118     val="$undef"
10119     set try
10120     if eval $compile; then
10121         xxx=`./try`
10122         case "$xxx" in
10123         semun) val="$define" ;;
10124         esac
10125     fi
10126     $rm -f try try.c
10127     set d_semctl_semun
10128     eval $setvar
10129     case "$d_semctl_semun" in
10130     $define)
10131         echo "You can use union semun for semctl IPC_STAT." >&4
10132         also='also'
10133         ;;
10134     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10135         also=''
10136         ;;
10137     esac
10138
10139     : see whether semctl IPC_STAT can use struct semid_ds pointer
10140     $cat > try.c <<'END'
10141 #include <sys/types.h>
10142 #include <sys/ipc.h>
10143 #include <sys/sem.h>
10144 #include <sys/stat.h>
10145 #include "try.h"
10146 #include <stdio.h>
10147 #include <errno.h>
10148 #ifndef errno
10149 extern int errno;
10150 #endif
10151 int main() {
10152     struct semid_ds arg;
10153     int sem, st;
10154
10155 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10156     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10157     if (sem > -1) {
10158 #       ifdef IPC_STAT
10159         st = semctl(sem, 0, IPC_STAT, &arg);
10160         if (st == 0)
10161             printf("semid_ds\n");
10162         else
10163 #       endif /* IPC_STAT */
10164             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10165 #       ifdef IPC_RMID
10166         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10167 #       endif /* IPC_RMID */
10168             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10169     } else
10170 #endif /* IPC_PRIVATE && ... */
10171         printf("semget failed: errno = %d\n", errno);
10172
10173     return 0;
10174 }
10175 END
10176     val="$undef"
10177     set try
10178     if eval $compile; then
10179         xxx=`./try`
10180         case "$xxx" in
10181         semid_ds) val="$define" ;;
10182         esac
10183     fi
10184     $rm -f try try.c
10185     set d_semctl_semid_ds
10186     eval $setvar
10187     case "$d_semctl_semid_ds" in
10188     $define)
10189         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10190         ;;
10191     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10192         ;;
10193     esac
10194     $rm -f try.h
10195     ;;
10196 *)  val="$undef"
10197
10198     # We do not have the full sem*(2) library, so assume we can not
10199     # use either.
10200
10201     set d_semctl_semun
10202     eval $setvar
10203
10204     set d_semctl_semid_ds
10205     eval $setvar
10206     ;;
10207 esac
10208
10209 : see if setegid exists
10210 set setegid d_setegid
10211 eval $inlibc
10212
10213 : see if seteuid exists
10214 set seteuid d_seteuid
10215 eval $inlibc
10216
10217 : see if setgrent exists
10218 set setgrent d_setgrent
10219 eval $inlibc
10220
10221 : see if sethostent exists
10222 set sethostent d_sethent
10223 eval $inlibc
10224
10225 : see if setlinebuf exists
10226 set setlinebuf d_setlinebuf
10227 eval $inlibc
10228
10229 : see if setlocale exists
10230 set setlocale d_setlocale
10231 eval $inlibc
10232
10233 : see if setnetent exists
10234 set setnetent d_setnent
10235 eval $inlibc
10236
10237 : see if setprotoent exists
10238 set setprotoent d_setpent
10239 eval $inlibc
10240
10241 : see if setpgid exists
10242 set setpgid d_setpgid
10243 eval $inlibc
10244
10245 : see if setpgrp2 exists
10246 set setpgrp2 d_setpgrp2
10247 eval $inlibc
10248
10249 : see if setpriority exists
10250 set setpriority d_setprior
10251 eval $inlibc
10252
10253 : see if setpwent exists
10254 set setpwent d_setpwent
10255 eval $inlibc
10256
10257 : see if setregid exists
10258 set setregid d_setregid
10259 eval $inlibc
10260 set setresgid d_setresgid
10261 eval $inlibc
10262
10263 : see if setreuid exists
10264 set setreuid d_setreuid
10265 eval $inlibc
10266 set setresuid d_setresuid
10267 eval $inlibc
10268
10269 : see if setrgid exists
10270 set setrgid d_setrgid
10271 eval $inlibc
10272
10273 : see if setruid exists
10274 set setruid d_setruid
10275 eval $inlibc
10276
10277 : see if setservent exists
10278 set setservent d_setsent
10279 eval $inlibc
10280
10281 : see if setsid exists
10282 set setsid d_setsid
10283 eval $inlibc
10284
10285 : see if setspent exists
10286 set setspent d_setspent
10287 eval $inlibc
10288
10289 : see if setvbuf exists
10290 set setvbuf d_setvbuf
10291 eval $inlibc
10292
10293 : see if sfio.h is available
10294 set sfio.h i_sfio
10295 eval $inhdr
10296
10297
10298 : see if sfio library is available
10299 case "$i_sfio" in
10300 $define)
10301         val=''
10302         set sfreserve val
10303         eval $inlibc
10304         ;;
10305 *)
10306         val="$undef"
10307         ;;
10308 esac
10309 : Ok, but do we want to use it.
10310 case "$val" in
10311 $define)
10312         case "$usesfio" in
10313         true|$define|[yY]*) dflt='y';;
10314         *) dflt='n';;
10315         esac
10316         echo "$package can use the sfio library, but it is experimental."
10317         rp="You seem to have sfio available, do you want to try using it?"
10318         . ./myread
10319         case "$ans" in
10320         y|Y) ;;
10321         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10322                 val="$undef"
10323                 : Remove sfio from list of libraries to use
10324                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10325                 shift
10326                 libs="$*"
10327                 echo "libs = $libs" >&4
10328                 ;;
10329         esac
10330         ;;
10331 *)      case "$usesfio" in
10332         true|$define|[yY]*)
10333                 echo "Sorry, cannot find sfio on this machine" >&4
10334                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10335                 ;;
10336         esac
10337         ;;
10338 esac
10339 set d_sfio
10340 eval $setvar
10341 case "$d_sfio" in
10342 $define) usesfio='true';;
10343 *) usesfio='false';;
10344 esac
10345
10346 : see if shmctl exists
10347 set shmctl d_shmctl
10348 eval $inlibc
10349
10350 : see if shmget exists
10351 set shmget d_shmget
10352 eval $inlibc
10353
10354 : see if shmat exists
10355 set shmat d_shmat
10356 eval $inlibc
10357 : see what shmat returns
10358 case "$d_shmat" in
10359 "$define")
10360         $cat >shmat.c <<'END'
10361 #include <sys/shm.h>
10362 void *shmat();
10363 END
10364         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10365                 shmattype='void *'
10366         else
10367                 shmattype='char *'
10368         fi
10369         echo "and it returns ($shmattype)." >&4
10370         : see if a prototype for shmat is available
10371         xxx=`./findhdr sys/shm.h`
10372         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10373         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10374                 val="$define"
10375         else
10376                 val="$undef"
10377         fi
10378         $rm -f shmat.[co]
10379         ;;
10380 *)
10381         val="$undef"
10382         ;;
10383 esac
10384 set d_shmatprototype
10385 eval $setvar
10386
10387 : see if shmdt exists
10388 set shmdt d_shmdt
10389 eval $inlibc
10390
10391 : see how much of the 'shm*(2)' library is present.
10392 h_shm=true
10393 echo " "
10394 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10395 *"$undef"*) h_shm=false;;
10396 esac
10397 case "$osname" in
10398 freebsd)
10399     case "`ipcs 2>&1`" in
10400     "SVID shared memory"*"not configured"*)
10401         echo "Your $osname does not have the shm*(2) configured." >&4
10402         h_shm=false
10403         val="$undef"
10404         set shmctl d_shmctl
10405         evat $setvar
10406         set shmget d_shmget
10407         evat $setvar
10408         set shmat d_shmat
10409         evat $setvar
10410         set shmdt d_shmdt
10411         evat $setvar
10412         ;;
10413     esac
10414     ;;
10415 esac
10416 : we could also check for sys/ipc.h ...
10417 if $h_shm && $test `./findhdr sys/shm.h`; then
10418         echo "You have the full shm*(2) library." >&4
10419         val="$define"
10420 else
10421         echo "You don't have the full shm*(2) library." >&4
10422         val="$undef"
10423 fi
10424 set d_shm
10425 eval $setvar
10426
10427 echo " "
10428 : see if we have sigaction
10429 if set sigaction val -f d_sigaction; eval $csym; $val; then
10430         echo 'sigaction() found.' >&4
10431         $cat > try.c <<'EOP'
10432 #include <stdio.h>
10433 #include <sys/types.h>
10434 #include <signal.h>
10435 int main()
10436 {
10437     struct sigaction act, oact;
10438     act.sa_flags = 0;
10439     oact.sa_handler = 0;
10440     /* so that act and oact are used */
10441     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10442 }
10443 EOP
10444         set try
10445         if eval $compile_ok; then
10446                 val="$define"
10447         else
10448                 echo "But you don't seem to have a useable struct sigaction." >&4
10449                 val="$undef"
10450         fi
10451 else
10452         echo 'sigaction NOT found.' >&4
10453         val="$undef"
10454 fi
10455 set d_sigaction; eval $setvar
10456 $rm -f try try$_o try.c
10457
10458 : see if sigsetjmp exists
10459 echo " "
10460 case "$d_sigsetjmp" in
10461 '')
10462         $cat >try.c <<'EOP'
10463 #include <setjmp.h>
10464 sigjmp_buf env;
10465 int set = 1;
10466 int main()
10467 {
10468         if (sigsetjmp(env,1))
10469                 exit(set);
10470         set = 0;
10471         siglongjmp(env, 1);
10472         exit(1);
10473 }
10474 EOP
10475         set try
10476         if eval $compile; then
10477                 if ./try >/dev/null 2>&1; then
10478                         echo "POSIX sigsetjmp found." >&4
10479                         val="$define"
10480                 else
10481                         $cat >&4 <<EOM
10482 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10483 I'll ignore them.
10484 EOM
10485                         val="$undef"
10486                 fi
10487         else
10488                 echo "sigsetjmp not found." >&4
10489                 val="$undef"
10490         fi
10491         ;;
10492 *) val="$d_sigsetjmp"
10493         case "$d_sigsetjmp" in
10494         $define) echo "POSIX sigsetjmp found." >&4;;
10495         $undef) echo "sigsetjmp not found." >&4;;
10496         esac
10497         ;;
10498 esac
10499 set d_sigsetjmp
10500 eval $setvar
10501 $rm -f try.c try
10502
10503 : see if sqrtl exists
10504 set sqrtl d_sqrtl
10505 eval $inlibc
10506
10507 : see if sys/stat.h is available
10508 set sys/stat.h i_sysstat
10509 eval $inhdr
10510
10511
10512 : see if stat knows about block sizes
10513 echo " "
10514 echo "Checking to see if your struct stat has st_blocks field..." >&4
10515 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10516 eval $hasfield
10517
10518
10519 : see if this is a sys/vfs.h system
10520 set sys/vfs.h i_sysvfs
10521 eval $inhdr
10522
10523
10524 : see if this is a sys/statfs.h system
10525 set sys/statfs.h i_sysstatfs
10526 eval $inhdr
10527
10528
10529 echo " "
10530 echo "Checking to see if your system supports struct statfs..." >&4
10531 set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
10532 eval $hasstruct
10533 case "$d_statfs_s" in
10534 "$define")      echo "Yes, it does."   ;;
10535 *)              echo "No, it doesn't." ;;
10536 esac
10537
10538
10539
10540 : see if struct statfs knows about f_flags
10541 case "$d_statfs_s" in
10542 define) 
10543         echo " "
10544         echo "Checking to see if your struct statfs has f_flags field..." >&4
10545         set d_statfs_f_flags statfs f_flags $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
10546         eval $hasfield
10547         ;;
10548 *)      val="$undef"
10549         set d_statfs_f_flags
10550         eval $setvar
10551         ;;
10552 esac
10553 case "$d_statfs_f_flags" in
10554 "$define")      echo "Yes, it does."   ;;
10555 *)              echo "No, it doesn't." ;;
10556 esac
10557
10558 : see if _ptr and _cnt from stdio act std
10559 echo " "
10560 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10561         echo "(Looks like you have stdio.h from Linux.)"
10562         case "$stdio_ptr" in
10563         '') stdio_ptr='((fp)->_IO_read_ptr)'
10564                 ptr_lval=$define
10565                 ;;
10566         *)      ptr_lval=$d_stdio_ptr_lval;;
10567         esac
10568         case "$stdio_cnt" in
10569         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10570                 cnt_lval=$undef
10571                 ;;
10572         *)      cnt_lval=$d_stdio_cnt_lval;;
10573         esac
10574         case "$stdio_base" in
10575         '') stdio_base='((fp)->_IO_read_base)';;
10576         esac
10577         case "$stdio_bufsiz" in
10578         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10579         esac
10580 else
10581         case "$stdio_ptr" in
10582         '') stdio_ptr='((fp)->_ptr)'
10583                 ptr_lval=$define
10584                 ;;
10585         *)      ptr_lval=$d_stdio_ptr_lval;;
10586         esac
10587         case "$stdio_cnt" in
10588         '') stdio_cnt='((fp)->_cnt)'
10589                 cnt_lval=$define
10590                 ;;
10591         *)      cnt_lval=$d_stdio_cnt_lval;;
10592         esac
10593         case "$stdio_base" in
10594         '') stdio_base='((fp)->_base)';;
10595         esac
10596         case "$stdio_bufsiz" in
10597         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10598         esac
10599 fi
10600 : test whether _ptr and _cnt really work
10601 echo "Checking how std your stdio is..." >&4
10602 $cat >try.c <<EOP
10603 #include <stdio.h>
10604 #define FILE_ptr(fp)    $stdio_ptr
10605 #define FILE_cnt(fp)    $stdio_cnt
10606 int main() {
10607         FILE *fp = fopen("try.c", "r");
10608         char c = getc(fp);
10609         if (
10610                 18 <= FILE_cnt(fp) &&
10611                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10612         )
10613                 exit(0);
10614         exit(1);
10615 }
10616 EOP
10617 val="$undef"
10618 set try
10619 if eval $compile; then
10620         if ./try; then
10621                 echo "Your stdio acts pretty std."
10622                 val="$define"
10623         else
10624                 echo "Your stdio isn't very std."
10625         fi
10626 else
10627         echo "Your stdio doesn't appear very std."
10628 fi
10629 $rm -f try.c try
10630 set d_stdstdio
10631 eval $setvar
10632
10633 : Can _ptr be used as an lvalue?
10634 case "$d_stdstdio$ptr_lval" in
10635 $define$define) val=$define ;;
10636 *) val=$undef ;;
10637 esac
10638 set d_stdio_ptr_lval
10639 eval $setvar
10640
10641 : Can _cnt be used as an lvalue?
10642 case "$d_stdstdio$cnt_lval" in
10643 $define$define) val=$define ;;
10644 *) val=$undef ;;
10645 esac
10646 set d_stdio_cnt_lval
10647 eval $setvar
10648
10649 : see if _base is also standard
10650 val="$undef"
10651 case "$d_stdstdio" in
10652 $define)
10653         $cat >try.c <<EOP
10654 #include <stdio.h>
10655 #define FILE_base(fp)   $stdio_base
10656 #define FILE_bufsiz(fp) $stdio_bufsiz
10657 int main() {
10658         FILE *fp = fopen("try.c", "r");
10659         char c = getc(fp);
10660         if (
10661                 19 <= FILE_bufsiz(fp) &&
10662                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10663         )
10664                 exit(0);
10665         exit(1);
10666 }
10667 EOP
10668         set try
10669         if eval $compile; then
10670                 if ./try; then
10671                         echo "And its _base field acts std."
10672                         val="$define"
10673                 else
10674                         echo "But its _base field isn't std."
10675                 fi
10676         else
10677                 echo "However, it seems to be lacking the _base field."
10678         fi
10679         $rm -f try.c try
10680         ;;
10681 esac
10682 set d_stdiobase
10683 eval $setvar
10684
10685 $cat >&4 <<EOM
10686 Checking how to access stdio streams by file descriptor number...
10687 EOM
10688 case "$stdio_stream_array" in
10689 '')     $cat >try.c <<EOCP
10690 #include <stdio.h>
10691 int main() {
10692   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10693     printf("yes\n");
10694 }
10695 EOCP
10696         for s in _iob __iob __sF
10697         do
10698                 set try -DSTDIO_STREAM_ARRAY=$s
10699                 if eval $compile; then
10700                         case "`./try$exe_ext`" in
10701                         yes)    stdio_stream_array=$s; break ;;
10702                         esac
10703                 fi
10704         done
10705         $rm -f try.* try$exe_ext
10706 esac
10707 case "$stdio_stream_array" in
10708 '')     $cat >&4 <<EOM
10709 I can't figure out how to access stdio streams by file descriptor number.
10710 EOM
10711         d_stdio_stream_array="$undef"
10712         ;;
10713 *)      $cat >&4 <<EOM
10714 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10715 EOM
10716         d_stdio_stream_array="$define"
10717         ;;
10718 esac
10719
10720 : see if strcoll exists
10721 set strcoll d_strcoll
10722 eval $inlibc
10723
10724 : check for structure copying
10725 echo " "
10726 echo "Checking to see if your C compiler can copy structs..." >&4
10727 $cat >try.c <<'EOCP'
10728 int main()
10729 {
10730         struct blurfl {
10731                 int dyick;
10732         } foo, bar;
10733
10734         foo = bar;
10735 }
10736 EOCP
10737 if $cc -c try.c >/dev/null 2>&1 ; then
10738         val="$define"
10739         echo "Yup, it can."
10740 else
10741         val="$undef"
10742         echo "Nope, it can't."
10743 fi
10744 set d_strctcpy
10745 eval $setvar
10746 $rm -f try.*
10747
10748 : see if strerror and/or sys_errlist[] exist
10749 echo " "
10750 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10751     if set strerror val -f d_strerror; eval $csym; $val; then
10752                 echo 'strerror() found.' >&4
10753                 d_strerror="$define"
10754                 d_strerrm='strerror(e)'
10755                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10756                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10757                         d_syserrlst="$define"
10758                 else
10759                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10760                         d_syserrlst="$undef"
10761                 fi
10762     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10763                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10764                 echo 'strerror() found in string header.' >&4
10765                 d_strerror="$define"
10766                 d_strerrm='strerror(e)'
10767                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10768                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10769                                 d_syserrlst="$define"
10770                 else
10771                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10772                         d_syserrlst="$undef"
10773                 fi
10774     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10775                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10776                 d_strerror="$undef"
10777                 d_syserrlst="$define"
10778                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10779     else
10780                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10781                 d_strerror="$undef"
10782                 d_syserrlst="$undef"
10783                 d_strerrm='"unknown"'
10784     fi
10785 fi
10786
10787 : see if strtod exists
10788 set strtod d_strtod
10789 eval $inlibc
10790
10791 : see if strtol exists
10792 set strtol d_strtol
10793 eval $inlibc
10794
10795 : see if strtoul exists
10796 set strtoul d_strtoul
10797 eval $inlibc
10798
10799 : see if strtoull exists
10800 set strtoull d_strtoull
10801 eval $inlibc
10802
10803 : see if strxfrm exists
10804 set strxfrm d_strxfrm
10805 eval $inlibc
10806
10807 : see if symlink exists
10808 set symlink d_symlink
10809 eval $inlibc
10810
10811 : see if syscall exists
10812 set syscall d_syscall
10813 eval $inlibc
10814
10815 : see if sysconf exists
10816 set sysconf d_sysconf
10817 eval $inlibc
10818
10819 : see if system exists
10820 set system d_system
10821 eval $inlibc
10822
10823 : see if tcgetpgrp exists
10824 set tcgetpgrp d_tcgetpgrp
10825 eval $inlibc
10826
10827 : see if tcsetpgrp exists
10828 set tcsetpgrp d_tcsetpgrp
10829 eval $inlibc
10830
10831 : see if prototype for telldir is available
10832 echo " "
10833 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10834 eval $hasproto
10835
10836 : see if this is a sys/times.h system
10837 set sys/times.h i_systimes
10838 eval $inhdr
10839
10840 : see if times exists
10841 echo " "
10842 if set times val -f d_times; eval $csym; $val; then
10843         echo 'times() found.' >&4
10844         d_times="$define"
10845         inc=''
10846         case "$i_systimes" in
10847         "$define") inc='sys/times.h';;
10848         esac
10849         rp="What is the type returned by times() on this system?"
10850         set clock_t clocktype long stdio.h sys/types.h $inc
10851         eval $typedef_ask
10852 else
10853         echo 'times() NOT found, hope that will do.' >&4
10854         d_times="$undef"
10855         clocktype='int'
10856 fi
10857
10858 : see if truncate exists
10859 set truncate d_truncate
10860 eval $inlibc
10861
10862 : see if tzname[] exists
10863 echo " "
10864 if set tzname val -a d_tzname; eval $csym; $val; then
10865         val="$define"
10866         echo 'tzname[] found.' >&4
10867 else
10868         val="$undef"
10869         echo 'tzname[] NOT found.' >&4
10870 fi
10871 set d_tzname
10872 eval $setvar
10873
10874 : see if umask exists
10875 set umask d_umask
10876 eval $inlibc
10877
10878 : see if ustat exists
10879 set ustat d_ustat
10880 eval $inlibc
10881
10882 : backward compatibility for d_hvfork
10883 if test X$d_hvfork != X; then
10884         d_vfork="$d_hvfork"
10885         d_hvfork=''
10886 fi
10887 : see if there is a vfork
10888 val=''
10889 set vfork val
10890 eval $inlibc
10891
10892 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10893 : perl on Solaris 2.x, and probably elsewhere.
10894 case "$val" in
10895 $define)
10896         echo " "
10897         case "$usevfork" in
10898         false) dflt='n';;
10899         *) dflt='y';;
10900         esac
10901         cat <<'EOM'
10902  
10903 Perl can only use a vfork() that doesn't suffer from strict
10904 restrictions on calling functions or modifying global data in
10905 the child.  For example, glibc-2.1 contains such a vfork()
10906 that is unsuitable.  If your system provides a proper fork()
10907 call, chances are that you do NOT want perl to use vfork().
10908
10909 EOM
10910         rp="Do you still want to use vfork()?"
10911         . ./myread
10912         case "$ans" in
10913         y|Y) ;;
10914         *)
10915                 echo "Ok, we won't use vfork()."
10916                 val="$undef"
10917                 ;;
10918         esac
10919         ;;
10920 esac
10921 set d_vfork
10922 eval $setvar
10923 case "$d_vfork" in
10924 $define) usevfork='true';;
10925 *) usevfork='false';;
10926 esac
10927
10928 : see if this is an sysdir system
10929 set sys/dir.h i_sysdir
10930 eval $inhdr
10931
10932 : see if this is an sysndir system
10933 set sys/ndir.h i_sysndir
10934 eval $inhdr
10935
10936 : see if closedir exists
10937 set closedir d_closedir
10938 eval $inlibc
10939
10940 case "$d_closedir" in
10941 "$define")
10942         echo " "
10943         echo "Checking whether closedir() returns a status..." >&4
10944         cat > closedir.c <<EOM
10945 #$i_dirent I_DIRENT             /**/
10946 #$i_sysdir I_SYS_DIR            /**/
10947 #$i_sysndir I_SYS_NDIR          /**/
10948 #$i_systypes I_SYS_TYPES        /**/
10949
10950 #if defined(I_SYS_TYPES)
10951 #include <sys/types.h>
10952 #endif
10953 #if defined(I_DIRENT)
10954 #include <dirent.h>
10955 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10956 #include <sys/dir.h>
10957 #endif
10958 #else
10959 #ifdef I_SYS_NDIR
10960 #include <sys/ndir.h>
10961 #else
10962 #ifdef I_SYS_DIR
10963 #ifdef hp9000s500
10964 #include <ndir.h>       /* may be wrong in the future */
10965 #else
10966 #include <sys/dir.h>
10967 #endif
10968 #endif
10969 #endif
10970 #endif 
10971 int main() { return closedir(opendir(".")); }
10972 EOM
10973         set closedir
10974         if eval $compile_ok; then
10975                 if ./closedir > /dev/null 2>&1 ; then
10976                         echo "Yes, it does."
10977                         val="$undef"
10978                 else
10979                         echo "No, it doesn't."
10980                         val="$define"
10981                 fi
10982         else
10983                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10984                 val="$define"
10985         fi
10986         ;;
10987 *)
10988         val="$undef";
10989         ;;
10990 esac
10991 set d_void_closedir
10992 eval $setvar
10993 $rm -f closedir*
10994 : check for volatile keyword
10995 echo " "
10996 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10997 $cat >try.c <<'EOCP'
10998 int main()
10999 {
11000         typedef struct _goo_struct goo_struct;
11001         goo_struct * volatile goo = ((goo_struct *)0);
11002         struct _goo_struct {
11003                 long long_int;
11004                 int reg_int;
11005                 char char_var;
11006         };
11007         typedef unsigned short foo_t;
11008         char *volatile foo;
11009         volatile int bar;
11010         volatile foo_t blech;
11011         foo = foo;
11012 }
11013 EOCP
11014 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11015         val="$define"
11016         echo "Yup, it does."
11017 else
11018         val="$undef"
11019         echo "Nope, it doesn't."
11020 fi
11021 set d_volatile
11022 eval $setvar
11023 $rm -f try.*
11024
11025 : see if there is a wait4
11026 set wait4 d_wait4
11027 eval $inlibc
11028
11029 : see if waitpid exists
11030 set waitpid d_waitpid
11031 eval $inlibc
11032
11033 : see if wcstombs exists
11034 set wcstombs d_wcstombs
11035 eval $inlibc
11036
11037 : see if wctomb exists
11038 set wctomb d_wctomb
11039 eval $inlibc
11040
11041 : preserve RCS keywords in files with variable substitution, grrr
11042 Date='$Date'
11043 Id='$Id'
11044 Log='$Log'
11045 RCSfile='$RCSfile'
11046 Revision='$Revision'
11047
11048 case "$crosscompile" in
11049 ''|[nN]*) crosscompile="$undef" ;;
11050 esac
11051
11052 case "$osname" in
11053 next|rhapsody) multiarch="$define" ;;
11054 esac
11055 case "$multiarch" in
11056 ''|[nN]*) multiarch="$undef" ;;
11057 esac
11058
11059 : check for alignment requirements
11060 echo " "
11061 case "$crosscompile$multiarch" in
11062 *$define*)
11063         $cat <<EOM
11064 You seem to be either cross-compiling or doing a multiarchitecture build,
11065 skipping the memory alignment check.
11066
11067 EOM
11068         case "$alignbytes" in
11069         '') alignbytes=8 ;;
11070         esac
11071         ;;
11072 *)
11073         case "$alignbytes" in
11074         '') echo "Checking alignment constraints..." >&4
11075                 $cat >try.c <<'EOCP'
11076 #include <stdio.h>
11077 struct foobar {
11078         char foo;
11079         double bar;
11080 } try_algn;
11081 int main()
11082 {
11083     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11084     return(0);
11085 }
11086 EOCP
11087                 set try
11088                 if eval $compile_ok; then
11089                         dflt=`./try`
11090                 else
11091                         dflt='8'
11092                         echo "(I can't seem to compile the test program...)"
11093                 fi
11094                 ;;
11095         *) dflt="$alignbytes"
11096                 ;;
11097         esac
11098         rp="Doubles must be aligned on a how-many-byte boundary?"
11099         . ./myread
11100         alignbytes="$ans"
11101         $rm -f try.c try
11102         ;;
11103 esac
11104
11105
11106 : check for ordering of bytes in a long
11107 echo " "
11108 case "$crosscompile$multiarch" in
11109 *$define*)
11110         $cat <<EOM
11111 You seem to be either cross-compiling or doing a multiarchitecture build,
11112 skipping the byteorder check.
11113
11114 EOM
11115         byteorder='0xffff'
11116         ;;
11117 *)
11118         case "$byteorder" in
11119         '')
11120                 $cat <<'EOM'
11121 In the following, larger digits indicate more significance.  A big-endian
11122 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11123 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11124 machines may have weird orders like 3412.  A Cray will report 87654321,
11125 an Alpha will report 12345678. If the test program works the default is
11126 probably right.
11127 I'm now running the test program...
11128 EOM
11129                 $cat >try.c <<'EOCP'
11130 #include <stdio.h>
11131 int main()
11132 {
11133         int i;
11134         union {
11135                 unsigned long l;
11136                 char c[sizeof(long)];
11137         } u;
11138
11139         if (sizeof(long) > 4)
11140                 u.l = (0x08070605L << 32) | 0x04030201L;
11141         else
11142                 u.l = 0x04030201L;
11143         for (i = 0; i < sizeof(long); i++)
11144                 printf("%c", u.c[i]+'0');
11145         printf("\n");
11146         exit(0);
11147 }
11148 EOCP
11149                 xxx_prompt=y
11150                 set try
11151                 if eval $compile && ./try > /dev/null; then
11152                         dflt=`./try`
11153                         case "$dflt" in
11154                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11155                                 echo "(The test program ran ok.)"
11156                                 echo "byteorder=$dflt"
11157                                 xxx_prompt=n
11158                         ;;
11159                         ????|????????) echo "(The test program ran ok.)" ;;
11160                         *) echo "(The test program didn't run right for some reason.)" ;;
11161                         esac
11162                 else
11163                         dflt='4321'
11164                         cat <<'EOM'
11165 (I can't seem to compile the test program.  Guessing big-endian...)
11166 EOM
11167                 fi
11168                 case "$xxx_prompt" in
11169                 y)
11170                         rp="What is the order of bytes in a long?"
11171                         . ./myread
11172                         byteorder="$ans"
11173                         ;;
11174                 *)      byteorder=$dflt
11175                         ;;
11176                 esac
11177                 ;;
11178         esac
11179         $rm -f try.c try
11180         ;;
11181 esac
11182
11183
11184 : how do we catenate cpp tokens here?
11185 echo " "
11186 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11187 $cat >cpp_stuff.c <<'EOCP'
11188 #define RCAT(a,b)a/**/b
11189 #define ACAT(a,b)a ## b
11190 RCAT(Rei,ser)
11191 ACAT(Cir,cus)
11192 EOCP
11193 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11194 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11195         echo "Oh!  Smells like ANSI's been here." >&4
11196         echo "We can catify or stringify, separately or together!"
11197         cpp_stuff=42
11198 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11199         echo "Ah, yes!  The good old days!" >&4
11200         echo "However, in the good old days we don't know how to stringify and"
11201         echo "catify at the same time."
11202         cpp_stuff=1
11203 else
11204         $cat >&4 <<EOM
11205 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11206 to have to edit the values of CAT[2-5] in config.h...
11207 EOM
11208         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11209 fi
11210 $rm -f cpp_stuff.*
11211
11212 : see if this is a db.h system
11213 set db.h i_db
11214 eval $inhdr
11215
11216 case "$i_db" in
11217 $define)
11218         : Check db version.
11219         echo " "
11220         echo "Checking Berkeley DB version ..." >&4
11221         $cat >try.c <<EOCP
11222 #$d_const HASCONST
11223 #ifndef HASCONST
11224 #define const
11225 #endif
11226 #include <sys/types.h>
11227 #include <stdio.h>
11228 #include <db.h>
11229 int main()
11230 {
11231 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11232     int Major, Minor, Patch ;
11233     unsigned long Version ;
11234     (void)db_version(&Major, &Minor, &Patch) ;
11235     printf("You have Berkeley DB Version 2 or greater\n");
11236
11237     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11238                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11239     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11240                 Major, Minor, Patch) ;
11241
11242     /* check that db.h & libdb are compatible */
11243     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11244         printf("db.h and libdb are incompatible\n") ;
11245         exit(3);        
11246     }
11247
11248     printf("db.h and libdb are compatible\n") ;
11249
11250     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11251                 + DB_VERSION_PATCH ;
11252
11253     /* needs to be >= 2.3.4 */
11254     if (Version < 2003004) {
11255     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11256         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11257         exit(2);        
11258     }
11259
11260     exit(0);
11261 #else
11262 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11263     printf("You have Berkeley DB Version 1\n");
11264     exit(0);    /* DB version < 2: the coast is clear. */
11265 #else
11266     exit(1);    /* <db.h> not Berkeley DB? */
11267 #endif
11268 #endif
11269 }
11270 EOCP
11271         set try
11272         if eval $compile_ok && ./try; then
11273                 echo 'Looks OK.' >&4
11274         else
11275                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11276                 i_db=$undef
11277                 case " $libs " in
11278                 *"-ldb "*)
11279                         : Remove db from list of libraries to use
11280                         echo "Removing unusable -ldb from library list" >&4
11281                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11282                         shift
11283                         libs="$*"
11284                         echo "libs = $libs" >&4
11285                         ;;
11286                 esac
11287         fi
11288         $rm -f try.*
11289         ;;
11290 esac
11291
11292 case "$i_db" in
11293 define)
11294         : Check the return type needed for hash 
11295         echo " "
11296         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11297         $cat >try.c <<EOCP
11298 #$d_const HASCONST
11299 #ifndef HASCONST
11300 #define const
11301 #endif
11302 #include <sys/types.h>
11303 #include <db.h>
11304
11305 #ifndef DB_VERSION_MAJOR
11306 u_int32_t hash_cb (ptr, size)
11307 const void *ptr;
11308 size_t size;
11309 {
11310 }
11311 HASHINFO info;
11312 int main()
11313 {
11314         info.hash = hash_cb;
11315 }
11316 #endif
11317 EOCP
11318         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11319                 if $contains warning try.out >>/dev/null 2>&1 ; then
11320                         db_hashtype='int'
11321                 else
11322                         db_hashtype='u_int32_t'
11323                 fi
11324         else
11325                 : XXX Maybe we should just give up here.
11326                 db_hashtype=u_int32_t
11327                 $cat try.out >&4
11328                 echo "Help:  I can't seem to compile the db test program." >&4
11329                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11330         fi
11331         $rm -f try.*
11332         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11333         ;;
11334 *)      db_hashtype=u_int32_t
11335         ;;
11336 esac
11337 case "$i_db" in
11338 define)
11339         : Check the return type needed for prefix 
11340         echo " "
11341         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11342         cat >try.c <<EOCP
11343 #$d_const HASCONST
11344 #ifndef HASCONST
11345 #define const
11346 #endif
11347 #include <sys/types.h>
11348 #include <db.h>
11349
11350 #ifndef DB_VERSION_MAJOR
11351 size_t prefix_cb (key1, key2)
11352 const DBT *key1;
11353 const DBT *key2;
11354 {
11355 }
11356 BTREEINFO info;
11357 int main()
11358 {
11359         info.prefix = prefix_cb;
11360 }
11361 #endif
11362 EOCP
11363         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11364                 if $contains warning try.out >>/dev/null 2>&1 ; then
11365                         db_prefixtype='int'
11366                 else
11367                         db_prefixtype='size_t'
11368                 fi
11369         else
11370                 db_prefixtype='size_t'
11371                 : XXX Maybe we should just give up here.
11372                 $cat try.out >&4
11373                 echo "Help:  I can't seem to compile the db test program." >&4
11374                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11375         fi
11376         $rm -f try.*
11377         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11378         ;;
11379 *)      db_prefixtype='size_t'
11380         ;;
11381 esac
11382
11383 : check for void type
11384 echo " "
11385 echo "Checking to see how well your C compiler groks the void type..." >&4
11386 case "$voidflags" in
11387 '')
11388         $cat >try.c <<'EOCP'
11389 #if TRY & 1
11390 void sub() {
11391 #else
11392 sub() {
11393 #endif
11394         extern void moo();      /* function returning void */
11395         void (*goo)();          /* ptr to func returning void */
11396 #if TRY & 8
11397         void *hue;              /* generic ptr */
11398 #endif
11399 #if TRY & 2
11400         void (*foo[10])();
11401 #endif
11402
11403 #if TRY & 4
11404         if(goo == moo) {
11405                 exit(0);
11406         }
11407 #endif
11408         exit(0);
11409 }
11410 int main() { sub(); }
11411 EOCP
11412         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11413                 voidflags=$defvoidused
11414         echo "Good.  It appears to support void to the level $package wants.">&4
11415                 if $contains warning .out >/dev/null 2>&1; then
11416                         echo "However, you might get some warnings that look like this:"
11417                         $cat .out
11418                 fi
11419         else
11420 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11421                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11422                         echo "It supports 1..."
11423                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11424                                 echo "It also supports 2..."
11425                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11426                                         voidflags=7
11427                                         echo "And it supports 4 but not 8 definitely."
11428                                 else
11429                                         echo "It doesn't support 4..."
11430                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11431                                                 voidflags=11
11432                                                 echo "But it supports 8."
11433                                         else
11434                                                 voidflags=3
11435                                                 echo "Neither does it support 8."
11436                                         fi
11437                                 fi
11438                         else
11439                                 echo "It does not support 2..."
11440                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11441                                         voidflags=13
11442                                         echo "But it supports 4 and 8."
11443                                 else
11444                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11445                                                 voidflags=5
11446                                                 echo "And it supports 4 but has not heard about 8."
11447                                         else
11448                                                 echo "However it supports 8 but not 4."
11449                                         fi
11450                                 fi
11451                         fi
11452                 else
11453                         echo "There is no support at all for void."
11454                         voidflags=0
11455                 fi
11456         fi
11457 esac
11458 case "$voidflags" in
11459 "$defvoidused") ;;
11460 *)      $cat >&4 <<'EOM'
11461   Support flag bits are:
11462     1: basic void declarations.
11463     2: arrays of pointers to functions returning void.
11464     4: operations between pointers to and addresses of void functions.
11465     8: generic void pointers.
11466 EOM
11467         dflt="$voidflags";
11468         rp="Your void support flags add up to what?"
11469         . ./myread
11470         voidflags="$ans"
11471         ;;
11472 esac
11473 $rm -f try.* .out
11474
11475
11476 : How can we generate normalized random numbers ?
11477 echo " "
11478 echo "Looking for a random number function..." >&4
11479 case "$randfunc" in
11480 '')
11481         if set drand48 val -f; eval $csym; $val; then
11482                 dflt="drand48"
11483                 echo "Good, found drand48()." >&4
11484         elif set random val -f; eval $csym; $val; then
11485                 dflt="random"
11486                 echo "OK, found random()." >&4
11487         else
11488                 dflt="rand"
11489                 echo "Yick, looks like I have to use rand()." >&4
11490         fi
11491         echo " "
11492         ;;
11493 *)
11494         dflt="$randfunc"
11495         ;;
11496 esac
11497 cont=true
11498
11499 case "$ccflags" in
11500 *-Dmy_rand=*|*-Dmy_srand=*)
11501         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11502         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11503         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11504         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11505         ;;
11506 esac
11507
11508 while $test "$cont"; do
11509         rp="Use which function to generate random numbers?"
11510         . ./myread
11511         if $test "$ans" = "$dflt"; then
11512                 : null
11513         else
11514                 randbits=''
11515         fi
11516         randfunc="$ans"
11517         if set $ans val -f; eval $csym; $val; then
11518                 cont=''
11519         else
11520                 dflt=y
11521                 rp="I cannot find function $ans. Use that name anyway?"
11522                 . ./myread
11523                 dflt=rand
11524                 case "$ans" in
11525                         [yY]*) cont='';;
11526                 esac
11527         fi
11528         case "$cont" in
11529         '')
11530                 case "$randfunc" in
11531                 drand48)
11532                         drand01="drand48()"
11533                         seedfunc="srand48"
11534                         randbits=48
11535                         randseedtype=long
11536                         ;;
11537                 rand|random)
11538                         case "$randbits" in
11539                         '')
11540 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11541                                 $cat >try.c <<EOCP
11542 #$i_unistd I_UNISTD
11543 #$i_stdlib I_STDLIB
11544 #include <stdio.h>
11545 #ifdef I_UNISTD
11546 #  include <unistd.h>
11547 #endif
11548 #ifdef I_STDLIB
11549 #  include <stdlib.h>
11550 #endif
11551 int main()
11552 {
11553         register int i;
11554         register unsigned long tmp;
11555         register unsigned long max = 0L;
11556
11557         for (i = 1000; i; i--) {
11558                 tmp = (unsigned long) $randfunc();
11559                 if (tmp > max) max = tmp;
11560         }
11561         for (i = 0; max; i++)
11562                 max /= 2;
11563         printf("%d\n",i);
11564 }
11565 EOCP
11566                                 set try
11567                                 if eval $compile_ok; then
11568                                         dflt=`try`
11569                                 else
11570                                         dflt='?'
11571                                         echo "(I can't seem to compile the test program...)"
11572                                 fi
11573                                 ;;
11574                         *)
11575                                 dflt="$randbits"
11576                                 ;;
11577                         esac
11578                         rp="How many bits does your $randfunc() function produce?"
11579                         . ./myread
11580                         randbits="$ans"
11581                         $rm -f try.c try
11582                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11583                         seedfunc="s$randfunc"
11584                         randseedtype=unsigned
11585                         ;;
11586                 *)
11587                         dflt="31"
11588                         rp="How many bits does your $randfunc() function produce?"
11589                         . ./myread
11590                         randbits="$ans"
11591                         seedfunc="s$randfunc"
11592                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11593                         if set $seedfunc val -f; eval $csym; $val; then
11594                                 echo "(Using $seedfunc() to seed random generator)"
11595                         else
11596                                 echo "(Warning: no $seedfunc() to seed random generator)"
11597                                 seedfunc=rand
11598                         fi
11599                         randseedtype=unsigned
11600                         ;;
11601                 esac
11602                 ;;
11603         esac
11604 done
11605
11606 echo " "
11607 echo "Determining whether or not we are on an EBCDIC system..." >&4
11608 $cat >tebcdic.c <<'EOM'
11609 int main()
11610 {
11611   if ('M'==0xd4) return 0;
11612   return 1;
11613 }
11614 EOM
11615
11616 val=$undef
11617 set tebcdic
11618 if eval $compile_ok; then
11619         if ./tebcdic; then
11620                 echo "You have EBCDIC." >&4
11621                 val="$define"
11622         else
11623                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
11624         fi
11625 else
11626         echo "I'm unable to compile the test program." >&4
11627         echo "I'll assume ASCII or some ISO Latin." >&4
11628 fi
11629 $rm -f tebcdic.c tebcdic
11630 set ebcdic
11631 eval $setvar
11632
11633 echo " "
11634 $cat >&4 <<EOM
11635 Checking how to flush all pending stdio output...
11636 EOM
11637 # I only know how to find the first 32 possibly open files on SunOS.
11638 # See also hints/sunos_4_1.sh and util.c  --AD
11639 case "$osname" in
11640 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11641 esac
11642 $cat >>try.c <<EOCP
11643 #include <stdio.h>
11644 #$i_unistd I_UNISTD
11645 #ifdef I_UNISTD
11646 # include <unistd.h>
11647 #endif
11648 #$d_sysconf HAS_SYSCONF
11649 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11650 #ifdef HAS_STDIO_STREAM_ARRAY
11651 # define STDIO_STREAM_ARRAY $stdio_stream_array
11652 #endif
11653 int main() {
11654   FILE* p = fopen("try.out", "w");
11655 #ifdef TRY_FPUTC
11656   fputc('x', p);
11657 #else
11658 # ifdef TRY_FPRINTF
11659   fprintf(p, "x");
11660 # endif
11661 #endif
11662 #ifdef TRY_FFLUSH_NULL
11663   fflush(NULL);
11664 #endif
11665 #ifdef TRY_FFLUSH_ALL
11666   {
11667     long open_max = -1;
11668 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11669     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11670 # else
11671 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11672     open_max = sysconf(_SC_OPEN_MAX);
11673 #  else
11674 #   ifdef FOPEN_MAX
11675     open_max = FOPEN_MAX;
11676 #   else
11677 #    ifdef OPEN_MAX
11678     open_max = OPEN_MAX;
11679 #    else
11680 #     ifdef _NFILE
11681     open_max = _NFILE;
11682 #     endif
11683 #    endif
11684 #   endif
11685 #  endif
11686 # endif 
11687 # ifdef HAS_STDIO_STREAM_ARRAY
11688     if (open_max > 0) {
11689       long i;
11690       for (i = 0; i < open_max; i++)
11691             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11692                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11693                 STDIO_STREAM_ARRAY[i]._flag)
11694                 fflush(&STDIO_STREAM_ARRAY[i]);
11695     }   
11696   }
11697 # endif
11698 #endif
11699   _exit(42);
11700 }
11701 EOCP
11702 : first we have to find out how _not_ to flush
11703 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11704     output=''
11705     set try -DTRY_FPUTC
11706     if eval $compile; then
11707             $rm -f try.out
11708             ./try$exe_ext 2>/dev/null
11709             if $test ! -s try.out -a "X$?" = X42; then
11710                 output=-DTRY_FPUTC
11711             fi
11712     fi
11713     case "$output" in
11714     '')
11715             set try -DTRY_FPRINTF
11716             $rm -f try.out
11717             if eval $compile; then
11718                     $rm -f try.out
11719                     ./try$exe_ext 2>/dev/null
11720                     if $test ! -s try.out -a "X$?" = X42; then
11721                         output=-DTRY_FPRINTF
11722                     fi
11723             fi
11724         ;;
11725     esac
11726 fi
11727 : check for fflush NULL behaviour
11728 case "$fflushNULL" in
11729 '')     set try -DTRY_FFLUSH_NULL $output
11730         if eval $compile; then
11731                 $rm -f try.out
11732                 ./try$exe_ext 2>/dev/null
11733                 code="$?"
11734                 if $test -s try.out -a "X$code" = X42; then
11735                         fflushNULL="`$cat try.out`"
11736                 else
11737                         if $test "X$code" != X42; then
11738                                 $cat >&4 <<EOM
11739 (If this test failed, don't worry, we'll try another method shortly.)
11740 EOM
11741                         fi
11742                 fi
11743         fi
11744         $rm -f core try.core core.try.*
11745         case "$fflushNULL" in
11746         x)      $cat >&4 <<EOM
11747 Your fflush(NULL) works okay.
11748 EOM
11749                 fflushNULL="$define"
11750                 ;;
11751         '')     $cat >&4 <<EOM
11752 Your fflush(NULL) isn't working (contrary to ANSI C).
11753 EOM
11754                 fflushNULL="$undef"
11755                 ;;
11756         *)      $cat >&4 <<EOM
11757 Cannot figure out whether your fflush(NULL) works or not.
11758 I'm assuming it doesn't (contrary to ANSI C).
11759 EOM
11760                 fflushNULL="$undef"
11761                 ;;
11762         esac
11763         ;;
11764 $define|true|[yY]*)
11765         fflushNULL="$define"
11766         ;;
11767 *)
11768         fflushNULL="$undef"
11769         ;;
11770 esac
11771 : check explicit looping only if NULL did not work
11772 case "$fflushNULL" in
11773 "$undef")
11774         : check for fflush all behaviour
11775         case "$fflushall" in
11776         '')     set try -DTRY_FFLUSH_ALL $output
11777                 if eval $compile; then
11778                         $cat >&4 <<EOM
11779 (Now testing the other method--but note that also this may fail.)
11780 EOM
11781                         $rm -f try.out
11782                         ./try$exe_ext 2>/dev/null
11783                         if $test -s try.out -a "X$?" = X42; then
11784                                 fflushall="`$cat try.out`"
11785                         fi
11786                 fi
11787                 $rm -f core try.core core.try.*
11788                 case "$fflushall" in
11789                 x)      $cat >&4 <<EOM
11790 Whew. Flushing explicitly all the stdio streams works.
11791 EOM
11792                         fflushall="$define"
11793                         ;;
11794                 '')     $cat >&4 <<EOM
11795 Sigh. Flushing explicitly all the stdio streams doesn't work.
11796 EOM
11797                         fflushall="$undef"
11798                         ;;
11799                 *)      $cat >&4 <<EOM
11800 Cannot figure out whether flushing stdio streams explicitly works or not.
11801 I'm assuming it doesn't.
11802 EOM
11803                         fflushall="$undef"
11804                         ;;
11805                 esac
11806                 ;;
11807         "$define"|true|[yY]*)
11808                 fflushall="$define"
11809                 ;;
11810         *)
11811                 fflushall="$undef"
11812                 ;;
11813         esac
11814         ;;
11815 *)      fflushall="$undef"      
11816         ;;
11817 esac
11818 case "$fflushNULL$fflushall" in
11819 undefundef)
11820         $cat <<EOM
11821 I cannot figure out how to flush pending stdio output.
11822 EOM
11823         ;;
11824 esac
11825 $rm -f try.* try$exe_ext
11826
11827 : Store the full pathname to the ar program for use in the C program
11828 : Respect a hint or command line value for full_ar.
11829 case "$full_ar" in
11830 '') full_ar=$ar ;;
11831 esac
11832
11833 : Store the full pathname to the sed program for use in the C program
11834 full_sed=$sed
11835
11836 : see what type gids are declared as in the kernel
11837 echo " "
11838 echo "Looking for the type for group ids returned by getgid()."
11839 set gid_t gidtype xxx stdio.h sys/types.h
11840 eval $typedef
11841 case "$gidtype" in
11842 xxx)
11843         xxx=`./findhdr sys/user.h`
11844         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11845         case $1 in
11846         unsigned) dflt="$1 $2" ;;
11847         *) dflt="$1" ;;
11848         esac
11849         ;;
11850 *) dflt="$gidtype";;
11851 esac
11852 case "$gidtype" in
11853 gid_t) echo "gid_t found." ;;
11854 *)      rp="What is the type for group ids returned by getgid()?"
11855         . ./myread
11856         gidtype="$ans"
11857         ;;
11858 esac
11859
11860 echo " "
11861 case "$gidtype" in
11862 *_t) zzz="$gidtype"     ;;
11863 *)   zzz="gid"          ;;
11864 esac
11865 echo "Checking the size of $zzz..." >&4 
11866 cat > try.c <<EOCP
11867 #include <sys/types.h>
11868 #include <stdio.h>
11869 int main() {
11870     printf("%d\n", (int)sizeof($gidtype));
11871     exit(0);
11872 }
11873 EOCP
11874 set try
11875 if eval $compile_ok; then
11876         yyy=`./try`
11877         case "$yyy" in
11878         '')     gidsize=4
11879                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
11880                 ;;
11881         *)      gidsize=$yyy
11882                 echo "Your $zzz size is $gidsize bytes."
11883                 ;;
11884         esac
11885 else
11886         gidsize=4
11887         echo "(I can't compile the test program--guessing $gidsize.)" >&4
11888 fi
11889
11890
11891 echo " "
11892 case "$gidtype" in
11893 *_t) zzz="$gidtype"     ;;
11894 *)   zzz="gid"          ;;
11895 esac
11896 echo "Checking the sign of $zzz..." >&4 
11897 cat > try.c <<EOCP
11898 #include <sys/types.h>
11899 #include <stdio.h>
11900 int main() {
11901         $gidtype foo = -1;
11902         if (foo < 0)
11903                 printf("-1\n");
11904         else
11905                 printf("1\n");
11906 }
11907 EOCP
11908 set try
11909 if eval $compile; then
11910         yyy=`./try`
11911         case "$yyy" in
11912         '')     gidsign=1
11913                 echo "(I can't execute the test program--guessing unsigned.)" >&4
11914                 ;;
11915         *)      gidsign=$yyy
11916                 case "$gidsign" in
11917                  1) echo "Your $zzz is unsigned." ;;
11918                 -1) echo "Your $zzz is signed."   ;;
11919                 esac
11920                 ;;
11921         esac
11922 else
11923         gidsign=1
11924         echo "(I can't compile the test program--guessing unsigned.)" >&4
11925 fi
11926
11927
11928 : check for length of character
11929 echo " "
11930 case "$charsize" in
11931 '')
11932         echo "Checking to see how big your characters are (hey, you never know)..." >&4
11933         $cat >try.c <<'EOCP'
11934 #include <stdio.h>
11935 int main()
11936 {
11937     printf("%d\n", (int)sizeof(char));
11938     exit(0);
11939 }
11940 EOCP
11941         set try
11942         if eval $compile_ok; then
11943                 dflt=`./try`
11944         else
11945                 dflt='1'
11946                 echo "(I can't seem to compile the test program.  Guessing...)"
11947         fi
11948         ;;
11949 *)
11950         dflt="$charsize"
11951         ;;
11952 esac
11953 rp="What is the size of a character (in bytes)?"
11954 . ./myread
11955 charsize="$ans"
11956 $rm -f try.c try
11957
11958
11959 echo " "
11960 $echo "Choosing the C types to be used for Perl's internal types..." >&4
11961
11962 case "$use64bits:$d_quad:$quadtype" in
11963 define:define:?*)
11964         ivtype="$quadtype"
11965         uvtype="$uquadtype"
11966         ivsize=8
11967         uvsize=8
11968         ;;
11969 *)      ivtype="long"
11970         uvtype="unsigned long"
11971         ivsize=$longsize
11972         uvsize=$longsize
11973         ;;
11974 esac
11975
11976 case "$uselongdouble:$d_longdbl" in
11977 define:define)
11978         nvtype="long double"
11979         nvsize=$longdblsize
11980         ;;
11981 *)      nvtype=double
11982         nvsize=$doublesize
11983         ;;
11984 esac
11985
11986 echo "(IV will be "$ivtype", $ivsize bytes)"
11987 echo "(UV will be "$uvtype", $uvsize bytes)"
11988 echo "(NV will be "$nvtype", $nvsize bytes)"
11989
11990 $cat >try.c <<EOCP
11991 #$i_inttypes I_INTTYPES
11992 #ifdef I_INTTYPES
11993 #include <inttypes.h>
11994 #endif
11995 #include <stdio.h>
11996 int main() {
11997 #ifdef INT8
11998    int8_t i =  INT8_MAX;
11999   uint8_t u = UINT8_MAX;
12000   printf("int8_t\n");
12001 #endif
12002 #ifdef INT16
12003    int16_t i =  INT16_MAX;
12004   uint16_t i = UINT16_MAX;
12005   printf("int16_t\n");
12006 #endif
12007 #ifdef INT32
12008    int32_t i =  INT32_MAX;
12009   uint32_t u = UINT32_MAX;
12010   printf("int32_t\n");
12011 #endif
12012 }
12013 EOCP
12014
12015 case "$i8type" in
12016 '')     case "$charsize" in
12017         1)      i8type=char
12018                 u8type="unsigned char"
12019                 i8size=$charsize
12020                 u8size=$charsize
12021                 ;;
12022         esac
12023         ;;
12024 esac
12025 case "$i8type" in
12026 '')     set try -DINT8
12027         if eval $compile; then
12028                 case "`./try$exe_ext`" in
12029                 int8_t) i8type=int8_t
12030                         u8type=uint8_t
12031                         i8size=1
12032                         u8size=1
12033                         ;;
12034                 esac
12035         fi
12036         ;;
12037 esac
12038 case "$i8type" in
12039 '')     if $test $charsize -ge 1; then
12040                 i8type=char
12041                 u8type="unsigned char"
12042                 i8size=$charsize
12043                 u8size=$charsize
12044         fi
12045         ;;
12046 esac
12047
12048 case "$i16type" in
12049 '')     case "$shortsize" in
12050         2)      i16type=short
12051                 u16type="unsigned short"
12052                 i16size=$shortsize
12053                 u16size=$shortsize
12054                 ;;
12055         esac
12056         ;;
12057 esac
12058 case "$i16type" in
12059 '')     set try -DINT16
12060         if eval $compile; then
12061                 case "`./try$exe_ext`" in
12062                 int16_t)
12063                         i16type=int16_t
12064                         u16type=uint16_t
12065                         i16size=2
12066                         u16size=2
12067                         ;;
12068                 esac
12069         fi
12070         ;;
12071 esac
12072 case "$i16type" in
12073 '')     if $test $shortsize -ge 2; then
12074                 i16type=short
12075                 u16type="unsigned short"
12076                 i16size=$shortsize
12077                 u16size=$shortsize
12078         fi
12079         ;;
12080 esac
12081
12082 case "$i32type" in
12083 '')     case "$longsize" in
12084         4)      i32type=long
12085                 u32type="unsigned long"
12086                 i32size=$longsize
12087                 u32size=$longsize
12088                 ;;
12089         *)      case "$intsize" in
12090                 4)      i32type=int
12091                         u32type="unsigned int"
12092                         i32size=$intsize
12093                         u32size=$intsize
12094                         ;;
12095                 esac
12096                 ;;
12097         esac
12098         ;;
12099 esac
12100 case "$i32type" in
12101 '')     set try -DINT32
12102         if eval $compile; then
12103                 case "`./try$exe_ext`" in
12104                 int32_t)
12105                         i32type=int32_t
12106                         u32type=uint32_t
12107                         i32size=4
12108                         u32size=4
12109                         ;;
12110                 esac
12111         fi
12112         ;;
12113 esac
12114 case "$i32type" in
12115 '')     if $test $intsize -ge 4; then
12116                 i32type=int
12117                 u32type="unsigned int"
12118                 i32size=$intsize
12119                 u32size=$intsize
12120         fi
12121         ;;
12122 esac
12123
12124 case "$i64type" in
12125 '')     case "$d_quad:$quadtype" in
12126         define:?*)
12127                 i64type="$quadtype"
12128                 u64type="$uquadtype"
12129                 i64size=8
12130                 u64size=8
12131                 ;;
12132         esac
12133         ;;
12134 esac
12135
12136 $rm -f try.* try
12137
12138 echo " "
12139
12140 if $test X"$quadtype" != X; then
12141
12142 echo "Checking how to print 64-bit integers..." >&4
12143
12144 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12145         $cat >try.c <<'EOCP'
12146 #include <sys/types.h>
12147 #include <stdio.h>
12148 int main() {
12149   int q = 12345678901;
12150   printf("%ld\n", q);
12151 }
12152 EOCP
12153         set try
12154         if eval $compile; then
12155                 yyy=`./try$exe_ext`
12156                 case "$yyy" in
12157                 12345678901)
12158                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12159                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12160                         echo "We will use %d."
12161                         ;;
12162                 esac
12163         fi
12164 fi
12165
12166 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12167         $cat >try.c <<'EOCP'
12168 #include <sys/types.h>
12169 #include <stdio.h>
12170 int main() {
12171   long q = 12345678901;
12172   printf("%ld\n", q);
12173 }
12174 EOCP
12175         set try
12176         if eval $compile; then
12177                 yyy=`./try$exe_ext`
12178                 case "$yyy" in
12179                 12345678901)
12180                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12181                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12182                         echo "We will use %ld."
12183                         ;;
12184                 esac
12185         fi
12186 fi
12187
12188 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$quadtype" = Xint64_t; then
12189         $cat >try.c <<'EOCP'
12190 #include <sys/types.h>
12191 #include <inttypes.h>
12192 #include <stdio.h>
12193 int main() {
12194   int64_t q = 12345678901;
12195   printf("%" PRId64 "\n", q);
12196 }
12197 EOCP
12198         set try
12199         if eval $compile; then
12200                 yyy=`./try$exe_ext`
12201                 case "$yyy" in
12202                 12345678901)
12203                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12204                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12205                         echo "We will use the C9X style."
12206                         ;;
12207                 esac
12208         fi
12209 fi
12210
12211 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12212         $cat >try.c <<'EOCP'
12213 #include <sys/types.h>
12214 #include <stdio.h>
12215 int main() {
12216   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12217   printf("%lld\n", q);
12218 }
12219 EOCP
12220         set try
12221         if eval $compile; then
12222                 yyy=`./try$exe_ext`
12223                 case "$yyy" in
12224                 12345678901)
12225                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12226                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12227                         echo "We will use the %lld style."
12228                         ;;
12229                 esac
12230         fi
12231 fi
12232
12233 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12234         $cat >try.c <<EOCP
12235 #include <sys/types.h>
12236 #include <stdio.h>
12237 int main() {
12238   $quadtype q = 12345678901;
12239   printf("%Ld\n", q);
12240 }
12241 EOCP
12242         set try
12243         if eval $compile; then
12244                 yyy=`./try$exe_ext`
12245                 case "$yyy" in
12246                 12345678901)
12247                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12248                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12249                         echo "We will use %Ld."
12250                         ;;
12251                 esac
12252         fi
12253 fi
12254
12255 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12256         $cat >try.c <<EOCP
12257 #include <sys/types.h>
12258 #include <stdio.h>
12259 int main() {
12260   $quadtype q = 12345678901;
12261   printf("%qd\n", q);
12262 }
12263 EOCP
12264         set try
12265         if eval $compile; then
12266                 yyy=`./try$exe_ext`
12267                 case "$yyy" in
12268                 12345678901)
12269                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12270                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12271                         echo "We will use %qd."
12272                         ;;
12273                 esac
12274         fi
12275 fi
12276
12277 if $test X"$sPRId64" = X; then
12278         echo "Cannot figure out how to print 64-bit integers." >&4
12279 fi
12280
12281 $rm -f try try.*
12282
12283 fi
12284
12285 case "$sPRId64" in
12286 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12287         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12288         ;;
12289 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12290         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12291         ;;
12292 esac
12293
12294
12295 echo " "
12296 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12297
12298 if $test X"$ivsize" = X8; then
12299         ivdformat="$sPRId64"
12300         uvuformat="$sPRIu64"
12301         uvoformat="$sPRIo64"
12302         uvxformat="$sPRIx64"
12303 else
12304         if $test X"$ivsize" = X"$longsize"; then
12305                 ivdformat='"ld"'
12306                 uvuformat='"lu"'
12307                 uvoformat='"lo"'
12308                 uvxformat='"lx"'
12309         else
12310                 if $test X"$ivsize" = X"$intsize"; then
12311                         ivdformat='"d"'
12312                         uvuformat='"u"'
12313                         uvoformat='"o"'
12314                         uvxformat='"x"'
12315                 else
12316                         : far out
12317                         if $test X"$ivsize" = X"$shortsize"; then
12318                                 ivdformat='"hd"'
12319                                 uvuformat='"hu"'
12320                                 uvoformat='"ho"'
12321                                 uvxformat='"hx"'
12322                         fi
12323                 fi
12324         fi
12325 fi
12326
12327 case "$ivdformat" in
12328 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12329     exit 1
12330     ;;
12331 esac
12332
12333
12334 echo " "
12335 $echo "Checking the format string to be used for gids..." >&4
12336
12337 case "$gidsign" in
12338 -1)     if $test X"$gidsize" = X"$ivsize"; then
12339                 gidformat="$ivdformat"
12340         else
12341                 if $test X"$gidsize" = X"$longsize"; then
12342                         gidformat='"ld"'
12343                 else
12344                         if $test X"$gidsize" = X"$intsize"; then
12345                                 gidformat='"d"'
12346                         else
12347                                 if $test X"$gidsize" = X"$shortsize"; then
12348                                         gidformat='"hd"'
12349                                 fi
12350                         fi
12351                 fi
12352         fi
12353         ;;
12354 *)      if $test X"$gidsize" = X"$uvsize"; then
12355                 gidformat="$uvuformat"
12356         else
12357                 if $test X"$gidsize" = X"$longsize"; then
12358                         gidformat='"lu"'
12359                 else
12360                         if $test X"$gidsize" = X"$intsize"; then
12361                                 gidformat='"u"'
12362                         else
12363                                 if $test X"$gidsize" = X"$shortsize"; then
12364                                         gidformat='"hu"'
12365                                 fi
12366                         fi
12367                 fi
12368         fi
12369         ;;
12370 esac
12371
12372 : see if getgroups exists
12373 set getgroups d_getgrps
12374 eval $inlibc
12375
12376 : see if setgroups exists
12377 set setgroups d_setgrps
12378 eval $inlibc
12379
12380
12381 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12382 echo " "
12383 case "$d_getgrps$d_setgrps" in
12384 *define*)
12385         case "$groupstype" in
12386         '') dflt="$gidtype" ;;
12387         *)  dflt="$groupstype" ;;
12388         esac
12389         $cat <<EOM
12390 What type of pointer is the second argument to getgroups() and setgroups()?
12391 Usually this is the same as group ids, $gidtype, but not always.
12392
12393 EOM
12394         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12395         . ./myread
12396         groupstype="$ans"
12397         ;;
12398 *)  groupstype="$gidtype";;
12399 esac
12400
12401 echo " "
12402 echo "Checking if your $make program sets \$(MAKE)..." >&4
12403 case "$make_set_make" in
12404 '')
12405         $sed 's/^X //' > testmake.mak << 'EOF'
12406 Xall:
12407 X       @echo 'maketemp="$(MAKE)"'
12408 EOF
12409         case "`$make -f testmake.mak 2>/dev/null`" in
12410         *maketemp=*) make_set_make='#' ;;
12411         *)      make_set_make="MAKE=$make" ;;
12412         esac
12413         $rm -f testmake.mak
12414         ;;
12415 esac
12416 case "$make_set_make" in
12417 '#') echo "Yup, it does.";;
12418 *) echo "Nope, it doesn't.";;
12419 esac
12420
12421 : see what type is used for mode_t
12422 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12423 set mode_t modetype int stdio.h sys/types.h
12424 eval $typedef_ask
12425
12426 : define a fucntion to check prototypes
12427 $cat > protochk <<EOSH
12428 $startsh
12429 cc="$cc"
12430 optimize="$optimize"
12431 ccflags="$ccflags"
12432 prototype="$prototype"
12433 define="$define"
12434 rm=$rm
12435 EOSH
12436
12437 $cat >> protochk <<'EOSH'
12438
12439 $rm -f try.c
12440 foo="$1"
12441 shift
12442 while test $# -ge 2; do
12443         case "$1" in
12444                 $define) echo "#include <$2>" >> try.c ;;
12445                 literal) echo "$2" >> try.c ;;
12446         esac
12447     shift 2
12448 done
12449 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12450 cat >> try.c <<'EOCP'
12451 #ifdef CAN_PROTOTYPE
12452 #define _(args) args
12453 #else
12454 #define _(args) ()
12455 #endif
12456 EOCP
12457 echo "$foo" >> try.c
12458 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12459 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12460 status=$?
12461 $rm -f try.[co]
12462 exit $status
12463 EOSH
12464 chmod +x protochk
12465 $eunicefix protochk
12466
12467 : see what type is used for size_t
12468 rp="What is the type used for the length parameter for string functions?"
12469 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12470 eval $typedef_ask
12471
12472 : check for type of arguments to gethostbyaddr. 
12473 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12474         case "$d_gethbyaddr" in
12475         $define)
12476                 $cat <<EOM
12477
12478 Checking to see what type of arguments are accepted by gethostbyaddr().
12479 EOM
12480                 hdrs="$define sys/types.h
12481                         $d_socket sys/socket.h 
12482                         $i_niin netinet/in.h 
12483                         $i_netdb netdb.h
12484                         $i_unistd unistd.h"
12485                 : The first arg can 'char *' or 'void *'
12486                 : The second arg is some of integral type
12487                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12488                         for yyy in size_t long int; do
12489                                 case "$netdb_host_type" in
12490                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12491                                         if ./protochk "$try" $hdrs; then
12492                                                 echo "Your system accepts $xxx for the first arg."
12493                                                 echo "...and $yyy for the second arg."
12494                                                 netdb_host_type="$xxx"
12495                                                 netdb_hlen_type="$yyy"
12496                                         fi
12497                                         ;;
12498                                 esac
12499                         done
12500                 done
12501                 : In case none of those worked, prompt the user.
12502                 case "$netdb_host_type" in
12503                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12504                         dflt='char *'
12505                         . ./myread
12506                         netdb_host_type=$ans
12507                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12508                         dflt="$sizetype"
12509                         . ./myread
12510                         netdb_hlen_type=$ans
12511                         ;;
12512                 esac
12513                 ;;
12514         *)      : no gethostbyaddr, so pick harmless defaults
12515                 netdb_host_type='char *'
12516                 netdb_hlen_type="$sizetype"
12517                 ;;
12518         esac
12519         # Remove the "const" if needed. -- but then we'll have a 
12520         # prototype clash!
12521         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12522 fi
12523
12524 : check for type of argument to gethostbyname. 
12525 if test "X$netdb_name_type" = X ; then
12526         case "$d_gethbyname" in
12527         $define)
12528                 $cat <<EOM
12529
12530 Checking to see what type of argument is accepted by gethostbyname().
12531 EOM
12532                 hdrs="$define sys/types.h
12533                         $d_socket sys/socket.h 
12534                         $i_niin netinet/in.h 
12535                         $i_netdb netdb.h
12536                         $i_unistd unistd.h"
12537                 for xxx in "const char *" "char *"; do
12538                         case "$netdb_name_type" in
12539                         '')     try="extern struct hostent *gethostbyname($xxx);"
12540                                 if ./protochk "$try" $hdrs; then
12541                                         echo "Your system accepts $xxx."
12542                                         netdb_name_type="$xxx"
12543                                 fi
12544                                 ;;
12545                         esac
12546                 done
12547                 : In case none of those worked, prompt the user.
12548                 case "$netdb_name_type" in
12549                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12550                         dflt='char *'
12551                         . ./myread
12552                         netdb_name_type=$ans
12553                         ;;
12554                 esac
12555                 ;;
12556         *)      : no gethostbyname, so pick harmless default
12557                 netdb_name_type='char *'
12558                 ;;
12559         esac
12560 fi
12561
12562 : check for type of 1st argument to getnetbyaddr. 
12563 if test "X$netdb_net_type" = X ; then
12564         case "$d_getnbyaddr" in
12565         $define)
12566                 $cat <<EOM
12567
12568 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12569 EOM
12570                 hdrs="$define sys/types.h
12571                         $d_socket sys/socket.h 
12572                         $i_niin netinet/in.h 
12573                         $i_netdb netdb.h
12574                         $i_unistd unistd.h"
12575                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12576                         case "$netdb_net_type" in
12577                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12578                                 if ./protochk "$try" $hdrs; then
12579                                         echo "Your system accepts $xxx."
12580                                         netdb_net_type="$xxx"
12581                                 fi
12582                                 ;;
12583                         esac
12584                 done
12585                 : In case none of those worked, prompt the user.
12586                 case "$netdb_net_type" in
12587                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12588                         dflt='long'
12589                         . ./myread
12590                         netdb_net_type=$ans
12591                         ;;
12592                 esac
12593                 ;;
12594         *)      : no getnetbyaddr, so pick harmless default
12595                 netdb_net_type='long'
12596                 ;;
12597         esac
12598 fi
12599 : locate the preferred pager for this system
12600 case "$pager" in
12601 '')
12602         dflt=''
12603         case "$pg" in
12604         /*) dflt=$pg;;
12605         esac
12606         case "$more" in
12607         /*) dflt=$more;;
12608         esac
12609         case "$less" in
12610         /*) dflt=$less;;
12611         esac
12612         case "$dflt" in
12613         '') dflt=/usr/ucb/more;;
12614         esac
12615         ;;
12616 *) dflt="$pager";;
12617 esac
12618 echo " "
12619 fn=f/
12620 rp='What pager is used on your system?'
12621 . ./getfile
12622 pager="$ans"
12623
12624 : see what type pids are declared as in the kernel
12625 rp="What is the type of process ids on this system?"
12626 set pid_t pidtype int stdio.h sys/types.h
12627 eval $typedef_ask
12628
12629 : Find earliest binary compatible site_perl subdirectory perl can use.
12630 case "$bincompat5005" in
12631 "$define") xs_apiversion='5.005' ;;
12632 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
12633 esac
12634 : Find earliest pure perl site_perl subdirectory perl can use.
12635 : The versioned directories started at 5.005.
12636 pm_apiversion='5.005'
12637
12638 : check for length of pointer
12639 echo " "
12640 case "$ptrsize" in
12641 '')
12642         $echo $n "Checking to see how big your pointers are...$c" >&4
12643         if test "$voidflags" -gt 7; then
12644                 echo '#define VOID_PTR char *' > try.c
12645         else
12646                 echo '#define VOID_PTR void *' > try.c
12647         fi
12648         $cat >>try.c <<'EOCP'
12649 #include <stdio.h>
12650 int main()
12651 {
12652     printf("%d\n", (int)sizeof(VOID_PTR));
12653     exit(0);
12654 }
12655 EOCP
12656         set try
12657         if eval $compile_ok; then
12658                 ptrsize=`./try`
12659                 $echo " $ptrsize bytes." >&4
12660         else
12661                 dflt='4'
12662                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12663                 rp="What is the size of a pointer (in bytes)?"
12664                 . ./myread
12665                 ptrsize="$ans"
12666         fi
12667         ;;
12668 esac
12669 $rm -f try.c try
12670
12671 : see if ar generates random libraries by itself
12672 echo " "
12673 echo "Checking how to generate random libraries on your machine..." >&4
12674 echo 'int bar1() { return bar2(); }' > bar1.c
12675 echo 'int bar2() { return 2; }' > bar2.c
12676 $cat > foo.c <<'EOP'
12677 int main() { printf("%d\n", bar1()); exit(0); }
12678 EOP
12679 $cc $ccflags -c bar1.c >/dev/null 2>&1
12680 $cc $ccflags -c bar2.c >/dev/null 2>&1
12681 $cc $ccflags -c foo.c >/dev/null 2>&1
12682 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12683 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12684         ./foobar >/dev/null 2>&1; then
12685         echo "$ar appears to generate random libraries itself."
12686         orderlib=false
12687         ranlib=":"
12688 elif $ar ts bar$_a >/dev/null 2>&1 &&
12689         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12690         ./foobar >/dev/null 2>&1; then
12691                 echo "a table of contents needs to be added with '$ar ts'."
12692                 orderlib=false
12693                 ranlib="$ar ts"
12694 else
12695         case "$ranlib" in
12696         :) ranlib='';;
12697         '')
12698                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12699                 $test -f $ranlib || ranlib=''
12700                 ;;
12701         esac
12702         if $test -n "$ranlib"; then
12703                 echo "your system has '$ranlib'; we'll use that."
12704                 orderlib=false
12705         else
12706                 echo "your system doesn't seem to support random libraries"
12707                 echo "so we'll use lorder and tsort to order the libraries."
12708                 orderlib=true
12709                 ranlib=":"
12710         fi
12711 fi
12712 $rm -f foo* bar* 
12713
12714 : check for type of arguments to select. 
12715 case "$selecttype" in
12716 '') case "$d_select" in
12717         $define)
12718                 $cat <<EOM
12719 Checking to see what type of arguments are accepted by select().
12720 EOM
12721                 hdrs="$define sys/types.h
12722                         $i_systime sys/time.h 
12723                         $i_sysselct sys/select.h
12724                         $d_socket sys/socket.h"
12725                 : The first arg can be int, unsigned, or size_t
12726                 : The last arg may or may not be 'const'
12727                 val=''
12728                 : void pointer has been seen but using that
12729                 : breaks the selectminbits test
12730                 for xxx in 'fd_set *' 'int *'; do
12731                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12732                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12733                                         case "$val" in
12734                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12735                                                 if ./protochk "$try" $hdrs; then
12736                                                         echo "Your system accepts $xxx."
12737                                                         val="$xxx"
12738                                                 fi
12739                                                 ;;
12740                                         esac
12741                                 done
12742                         done
12743                 done
12744                 case "$val" in
12745                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12746                         case "$d_fd_set" in
12747                                 $define) dflt="fd_set *" ;;
12748                                 *)              dflt="int *" ;;
12749                         esac
12750                         . ./myread
12751                         val=$ans
12752                         ;;
12753                 esac
12754                 selecttype="$val"
12755                 ;;
12756         *)      : no select, so pick a harmless default
12757                 selecttype='int *'
12758                 ;;
12759         esac
12760         ;;
12761 esac
12762
12763 : check for the select 'width'
12764 case "$selectminbits" in
12765 '') case "$d_select" in
12766         $define)
12767                 $cat <<EOM
12768
12769 Checking to see on how many bits at a time your select() operates...
12770 EOM
12771                 $cat >try.c <<EOCP
12772 #include <sys/types.h>
12773 #$i_time I_TIME
12774 #$i_systime I_SYS_TIME
12775 #$i_systimek I_SYS_TIME_KERNEL
12776 #ifdef I_TIME
12777 #   include <time.h>
12778 #endif
12779 #ifdef I_SYS_TIME
12780 #   ifdef I_SYS_TIME_KERNEL
12781 #       define KERNEL
12782 #   endif
12783 #   include <sys/time.h>
12784 #   ifdef I_SYS_TIME_KERNEL
12785 #       undef KERNEL
12786 #   endif
12787 #endif
12788 #$i_sysselct I_SYS_SELECT
12789 #ifdef I_SYS_SELECT
12790 #include <sys/select.h>
12791 #endif
12792 #$d_socket HAS_SOCKET
12793 #ifdef HAS_SOCKET
12794 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12795 #endif
12796 #include <stdio.h>
12797 $selecttype b;
12798 #define S sizeof(*(b))
12799 #define MINBITS 64
12800 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12801 #define NBITS  (NBYTES * 8)
12802 int main() {
12803     char s[NBYTES];
12804     struct timeval t;
12805     int i;
12806     FILE* fp;
12807     int fd;
12808
12809     fclose(stdin);
12810     fp = fopen("try.c", "r");
12811     if (fp == 0)
12812       exit(1);
12813     fd = fileno(fp);
12814     if (fd < 0)
12815       exit(2);
12816     b = ($selecttype)s;
12817     for (i = 0; i < NBITS; i++)
12818         FD_SET(i, b);
12819     t.tv_sec  = 0;
12820     t.tv_usec = 0;
12821     select(fd + 1, b, 0, 0, &t);
12822     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12823     printf("%d\n", i + 1);
12824     return 0;
12825 }
12826 EOCP
12827                 set try
12828                 if eval $compile_ok; then
12829                         selectminbits=`./try`
12830                         case "$selectminbits" in
12831                         '')     cat >&4 <<EOM
12832 Cannot figure out on how many bits at a time your select() operates.
12833 I'll play safe and guess it is 32 bits.
12834 EOM
12835                                 selectminbits=32
12836                                 bits="32 bits"
12837                                 ;;
12838                         1)      bits="1 bit" ;;
12839                         *)      bits="$selectminbits bits" ;;
12840                         esac
12841                         echo "Your select() operates on $bits at a time." >&4
12842                 else
12843                         rp='What is the minimum number of bits your select() operates on?'
12844                         case "$byteorder" in
12845                         1234|12345678)  dflt=32 ;;
12846                         *)              dflt=1  ;;
12847                         esac
12848                         . ./myread
12849                         val=$ans
12850                         selectminbits="$val"
12851                 fi
12852                 $rm -f try.* try
12853                 ;;
12854         *)      : no select, so pick a harmless default
12855                 selectminbits='32'
12856                 ;;
12857         esac
12858         ;;
12859 esac
12860
12861 : Trace out the files included by signal.h, then look for SIGxxx names.
12862 : Remove SIGARRAYSIZE used by HPUX.
12863 : Remove SIGSTKSIZE used by Linux.
12864 : Remove SIGSTKSZ used by Posix.
12865 : Remove SIGTYP void lines used by OS2.
12866 : Some cpps, like os390, dont give the file name anywhere
12867 if [ "X$fieldn" = X ]; then
12868         : Just make some guesses.  We check them later.
12869         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
12870 else
12871         xxx=`echo '#include <signal.h>' |
12872         $cppstdin $cppminus $cppflags 2>/dev/null |
12873         $grep '^[       ]*#.*include' | 
12874         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12875 fi
12876 : Check this list of files to be sure we have parsed the cpp output ok.
12877 : This will also avoid potentially non-existent files, such 
12878 : as ../foo/bar.h
12879 xxxfiles=''
12880 for xx in $xxx /dev/null ; do
12881         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12882 done
12883 : If we have found no files, at least try signal.h
12884 case "$xxxfiles" in
12885 '')     xxxfiles=`./findhdr signal.h` ;;
12886 esac
12887 xxx=`awk '
12888 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12889         print substr($2, 4, 20)
12890 }
12891 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12892         print substr($3, 4, 20)
12893 }' $xxxfiles`
12894 : Append some common names just in case the awk scan failed.
12895 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
12896 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
12897 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
12898 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
12899 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
12900
12901 : generate a few handy files for later
12902 $cat > signal.c <<'EOCP'
12903 #include <sys/types.h>
12904 #include <signal.h>
12905 #include <stdio.h>
12906 int main() {
12907
12908 /* Strange style to avoid deeply-nested #if/#else/#endif */
12909 #ifndef NSIG
12910 #  ifdef _NSIG
12911 #    define NSIG (_NSIG)
12912 #  endif
12913 #endif
12914
12915 #ifndef NSIG
12916 #  ifdef SIGMAX
12917 #    define NSIG (SIGMAX+1)
12918 #  endif
12919 #endif
12920
12921 #ifndef NSIG
12922 #  ifdef SIG_MAX
12923 #    define NSIG (SIG_MAX+1)
12924 #  endif
12925 #endif
12926
12927 #ifndef NSIG
12928 #  ifdef MAXSIG
12929 #    define NSIG (MAXSIG+1)
12930 #  endif
12931 #endif
12932
12933 #ifndef NSIG
12934 #  ifdef MAX_SIG
12935 #    define NSIG (MAX_SIG+1)
12936 #  endif
12937 #endif
12938
12939 #ifndef NSIG
12940 #  ifdef SIGARRAYSIZE
12941 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12942 #  endif
12943 #endif
12944
12945 #ifndef NSIG
12946 #  ifdef _sys_nsig
12947 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12948 #  endif
12949 #endif
12950
12951 /* Default to some arbitrary number that's big enough to get most
12952    of the common signals.
12953 */
12954 #ifndef NSIG
12955 #    define NSIG 50
12956 #endif
12957
12958 printf("NSIG %d\n", NSIG);
12959
12960 #ifndef JUST_NSIG
12961
12962 EOCP
12963
12964 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12965 {
12966         printf "#ifdef SIG"; printf $1; printf "\n"
12967         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12968         printf $1; printf ");\n"
12969         printf "#endif\n"
12970 }
12971 END {
12972         printf "#endif /* JUST_NSIG */\n";
12973         printf "exit(0);\n}\n";
12974 }
12975 ' >>signal.c
12976 $cat >signal.awk <<'EOP'
12977 BEGIN { ndups = 0 }
12978 $1 ~ /^NSIG$/ { nsig = $2 }
12979 ($1 !~ /^NSIG$/) && (NF == 2) {
12980     if ($2 > maxsig) { maxsig = $2 }
12981     if (sig_name[$2]) {
12982         dup_name[ndups] = $1
12983         dup_num[ndups] = $2
12984         ndups++ 
12985     }
12986     else {
12987         sig_name[$2] = $1
12988         sig_num[$2] = $2
12989     }
12990 }
12991 END { 
12992     if (nsig == 0) {
12993         nsig = maxsig + 1
12994     }
12995     printf("NSIG %d\n", nsig);
12996     for (n = 1; n < nsig; n++) {
12997         if (sig_name[n]) {
12998             printf("%s %d\n", sig_name[n], sig_num[n])
12999         }
13000         else {
13001             printf("NUM%d %d\n", n, n) 
13002         }
13003     }
13004     for (n = 0; n < ndups; n++) {
13005         printf("%s %d\n", dup_name[n], dup_num[n])
13006     }
13007 }
13008 EOP
13009 $cat >signal_cmd <<EOS
13010 $startsh
13011 if $test -s signal.lst; then
13012     echo "Using your existing signal.lst file"
13013         exit 0
13014 fi
13015 xxx="$xxx"
13016 EOS
13017 $cat >>signal_cmd <<'EOS'
13018
13019 set signal
13020 if eval $compile_ok; then
13021         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13022 else
13023         echo "(I can't seem be able to compile the whole test program)" >&4
13024         echo "(I'll try it in little pieces.)" >&4
13025         set signal -DJUST_NSIG
13026         if eval $compile_ok; then
13027                 ./signal$_exe > signal.nsg
13028                 $cat signal.nsg
13029         else
13030                 echo "I can't seem to figure out how many signals you have." >&4
13031                 echo "Guessing 50." >&4
13032                 echo 'NSIG 50' > signal.nsg
13033         fi
13034         : Now look at all the signal names, one at a time.
13035         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13036                 $cat > signal.c <<EOCP
13037 #include <sys/types.h>
13038 #include <signal.h>
13039 #include <stdio.h>
13040 int main() {
13041 printf("$xx %d\n", SIG${xx});
13042 return 0;
13043 }
13044 EOCP
13045                 set signal
13046                 if eval $compile; then
13047                         echo "SIG${xx} found."
13048                         ./signal$_exe  >> signal.ls1
13049                 else
13050                         echo "SIG${xx} NOT found."
13051                 fi
13052         done
13053         if $test -s signal.ls1; then
13054                 $cat signal.nsg signal.ls1 |
13055                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13056         fi
13057
13058 fi
13059 if $test -s signal.lst; then
13060         :
13061 else
13062         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13063         echo 'kill -l' >signal
13064         set X `csh -f <signal`
13065         $rm -f signal
13066         shift
13067         case $# in
13068         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13069         esac
13070         echo $@ | $tr ' ' $trnl | \
13071             $awk '{ printf "%s %d\n", $1, ++s; }
13072                   END { printf "NSIG %d\n", ++s }' >signal.lst
13073 fi
13074 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13075 EOS
13076 chmod a+x signal_cmd
13077 $eunicefix signal_cmd
13078
13079 : generate list of signal names
13080 echo " "
13081 case "$sig_name_init" in
13082 '') doinit=yes ;;
13083 *)  case "$sig_num_init" in
13084     ''|*,*) doinit=yes ;;
13085     esac ;;
13086 esac
13087 case "$doinit" in
13088 yes)
13089         echo "Generating a list of signal names and numbers..." >&4
13090         . ./signal_cmd
13091         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13092         sig_name=`$awk 'BEGIN { printf "ZERO " }
13093                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13094         sig_num=`$awk  'BEGIN { printf "0 " }
13095                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13096         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13097                              !/^NSIG/   { printf "\"%s\", ", $1 }
13098                              END        { printf "0\n" }' signal.lst`
13099         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13100                              !/^NSIG/   { printf "%d, ", $2}
13101                              END        { printf "0\n"}' signal.lst`
13102         ;;
13103 esac
13104 echo "The following $sig_count signals are available:"
13105 echo " "
13106 echo $sig_name | $awk \
13107 'BEGIN { linelen = 0 }
13108 {
13109         for (i = 1; i <= NF; i++) {
13110                 name = "SIG" $i " "
13111                 linelen = linelen + length(name)
13112                 if (linelen > 70) {
13113                         printf "\n"
13114                         linelen = length(name)
13115                 }
13116                 printf "%s", name
13117         }
13118         printf "\n"
13119 }'
13120 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13121
13122 : see what type is used for signed size_t
13123 set ssize_t ssizetype int stdio.h sys/types.h
13124 eval $typedef
13125 dflt="$ssizetype"
13126 $cat > ssize.c <<EOM
13127 #include <stdio.h>
13128 #include <sys/types.h>
13129 #define Size_t $sizetype
13130 #define SSize_t $dflt
13131 int main()
13132 {
13133         if (sizeof(Size_t) == sizeof(SSize_t))
13134                 printf("$dflt\n");
13135         else if (sizeof(Size_t) == sizeof(int))
13136                 printf("int\n");
13137         else 
13138                 printf("long\n");
13139         exit(0);
13140 }
13141 EOM
13142 echo " "
13143 set ssize
13144 if eval $compile_ok && ./ssize > /dev/null; then
13145         ssizetype=`./ssize`
13146         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13147 else
13148         $cat >&4 <<EOM
13149 Help! I can't compile and run the ssize_t test program: please enlighten me!
13150 (This is probably a misconfiguration in your system or libraries, and
13151 you really ought to fix it.  Still, I'll try anyway.)
13152
13153 I need a type that is the same size as $sizetype, but is guaranteed to
13154 be signed.  Common values are ssize_t, int and long.
13155
13156 EOM
13157         rp="What signed type is the same size as $sizetype?"
13158         . ./myread
13159         ssizetype="$ans"
13160 fi
13161 $rm -f ssize ssize.*
13162
13163 : see what type of char stdio uses.
13164 echo " "
13165 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13166         echo "Your stdio uses unsigned chars." >&4
13167         stdchar="unsigned char"
13168 else
13169         echo "Your stdio uses signed chars." >&4
13170         stdchar="char"
13171 fi
13172
13173 : see if time exists
13174 echo " "
13175 if test "X$d_time" = X -o X"$timetype" = X; then
13176     if set time val -f d_time; eval $csym; $val; then
13177                 echo 'time() found.' >&4
13178                 val="$define"
13179                 rp="What is the type returned by time() on this system?"
13180                 set time_t timetype long stdio.h sys/types.h
13181                 eval $typedef_ask
13182     else
13183                 echo 'time() not found, hope that will do.' >&4
13184                 val="$undef"
13185                 timetype='int';
13186     fi
13187     set d_time
13188     eval $setvar
13189 fi
13190
13191 : see what type uids are declared as in the kernel
13192 echo " "
13193 echo "Looking for the type for user ids returned by getuid()."
13194 set uid_t uidtype xxx stdio.h sys/types.h
13195 eval $typedef
13196 case "$uidtype" in
13197 xxx)
13198         xxx=`./findhdr sys/user.h`
13199         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13200         case $1 in
13201         unsigned) dflt="$1 $2" ;;
13202         *) dflt="$1" ;;
13203         esac
13204         ;;
13205 *) dflt="$uidtype";;
13206 esac
13207 case "$uidtype" in
13208 uid_t)  echo "uid_t found." ;;
13209 *)      rp="What is the type for user ids returned by getuid()?"
13210         . ./myread
13211         uidtype="$ans"
13212         ;;
13213 esac
13214
13215 echo " "
13216 case "$uidtype" in
13217 *_t) zzz="$uidtype"     ;;
13218 *)   zzz="uid"          ;;
13219 esac
13220 echo "Checking the size of $zzz..." >&4 
13221 cat > try.c <<EOCP
13222 #include <sys/types.h>
13223 #include <stdio.h>
13224 int main() {
13225     printf("%d\n", (int)sizeof($uidtype));
13226     exit(0);
13227 }
13228 EOCP
13229 set try
13230 if eval $compile_ok; then
13231         yyy=`./try`
13232         case "$yyy" in
13233         '')     uidsize=4
13234                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13235                 ;;
13236         *)      uidsize=$yyy
13237                 echo "Your $zzz size is $uidsize bytes."
13238                 ;;
13239         esac
13240 else
13241         uidsize=4
13242         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13243 fi
13244
13245 echo " "
13246 case "$uidtype" in
13247 *_t) zzz="$uidtype"     ;;
13248 *)   zzz="uid"          ;;
13249 esac
13250 echo "Checking the sign of $zzz..." >&4
13251 cat > try.c <<EOCP
13252 #include <sys/types.h>
13253 #include <stdio.h>
13254 int main() {
13255         $uidtype foo = -1;
13256         if (foo < 0)
13257                 printf("-1\n");
13258         else
13259                 printf("1\n");
13260 }
13261 EOCP
13262 set try
13263 if eval $compile; then
13264         yyy=`./try`
13265         case "$yyy" in
13266         '')     uidsign=1
13267                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13268                 ;;
13269         *)      uidsign=$yyy
13270                 case "$uidsign" in
13271                  1) echo "Your $zzz is unsigned." ;;
13272                 -1) echo "Your $zzz is signed."   ;;
13273                 esac
13274                 ;;
13275         esac
13276 else
13277         uidsign=1
13278         echo "(I can't compile the test program--guessing unsigned.)" >&4
13279 fi
13280
13281
13282
13283 echo " "
13284 $echo "Checking the format string to be used for uids..." >&4
13285
13286 case "$uidsign" in
13287 -1)     if $test X"$uidsize" = X"$ivsize"; then
13288                 uidformat="$ivdformat"
13289         else
13290                 if $test X"$uidsize" = X"$longsize"; then
13291                         uidformat='"ld"'
13292                 else
13293                         if $test X"$uidsize" = X"$intsize"; then
13294                                 uidformat='"d"'
13295                         else
13296                                 if $test X"$uidsize" = X"$shortsize"; then
13297                                         uidformat='"hd"'
13298                                 fi
13299                         fi
13300                 fi
13301         fi
13302         ;;
13303 *)      if $test X"$uidsize" = X"$uvsize"; then
13304                 uidformat="$uvuformat"
13305         else
13306                 if $test X"$uidsize" = X"$longsize"; then
13307                         uidformat='"lu"'
13308                 else
13309                         if $test X"$uidsize" = X"$intsize"; then
13310                                 uidformat='"u"'
13311                         else
13312                                 if $test X"$uidsize" = X"$shortsize"; then
13313                                         uidformat='"hu"'
13314                                 fi
13315                         fi
13316                 fi
13317         fi
13318         ;;
13319 esac
13320
13321 : see if dbm.h is available
13322 : see if dbmclose exists
13323 set dbmclose d_dbmclose
13324 eval $inlibc
13325
13326 case "$d_dbmclose" in
13327 $define)
13328         set dbm.h i_dbm
13329         eval $inhdr
13330         case "$i_dbm" in
13331         $define)
13332                 val="$undef"
13333                 set i_rpcsvcdbm
13334                 eval $setvar
13335                 ;;
13336         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13337                 eval $inhdr
13338                 ;;
13339         esac
13340         ;;
13341 *)      echo "We won't be including <dbm.h>"
13342         val="$undef"
13343         set i_dbm
13344         eval $setvar
13345         val="$undef"
13346         set i_rpcsvcdbm
13347         eval $setvar
13348         ;;
13349 esac
13350
13351 : see if this is a sys/file.h system
13352 val=''
13353 set sys/file.h val
13354 eval $inhdr
13355
13356 : do we need to include sys/file.h ?
13357 case "$val" in
13358 "$define")
13359         echo " "
13360         if $h_sysfile; then
13361                 val="$define"
13362                 echo "We'll be including <sys/file.h>." >&4
13363         else
13364                 val="$undef"
13365                 echo "We won't be including <sys/file.h>." >&4
13366         fi
13367         ;;
13368 *)
13369         h_sysfile=false
13370         ;;
13371 esac
13372 set i_sysfile
13373 eval $setvar
13374
13375 : see if fcntl.h is there
13376 val=''
13377 set fcntl.h val
13378 eval $inhdr
13379
13380 : see if we can include fcntl.h
13381 case "$val" in
13382 "$define")
13383         echo " "
13384         if $h_fcntl; then
13385                 val="$define"
13386                 echo "We'll be including <fcntl.h>." >&4
13387         else
13388                 val="$undef"
13389                 if $h_sysfile; then
13390         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13391                 else
13392                         echo "We won't be including <fcntl.h>." >&4
13393                 fi
13394         fi
13395         ;;
13396 *)
13397         h_fcntl=false
13398         val="$undef"
13399         ;;
13400 esac
13401 set i_fcntl
13402 eval $setvar
13403
13404 : see if locale.h is available
13405 set locale.h i_locale
13406 eval $inhdr
13407
13408 : see if mach cthreads are available
13409 if test "X$usethreads" = "X$define"; then
13410         set mach/cthreads.h i_machcthr
13411         eval $inhdr
13412 else
13413         i_machcthr="$undef"
13414 fi
13415
13416
13417
13418 : see if this is a math.h system
13419 set math.h i_math
13420 eval $inhdr
13421
13422 : see if this is a mntent.h system
13423 set mntent.h i_mntent
13424 eval $inhdr
13425
13426 : see if ndbm.h is available
13427 set ndbm.h t_ndbm
13428 eval $inhdr
13429 case "$t_ndbm" in
13430 $define)
13431         : see if dbm_open exists
13432         set dbm_open d_dbm_open
13433         eval $inlibc
13434         case "$d_dbm_open" in
13435         $undef)
13436                 t_ndbm="$undef"
13437                 echo "We won't be including <ndbm.h>"
13438                 ;;
13439         esac
13440         ;;
13441 esac
13442 val="$t_ndbm"
13443 set i_ndbm
13444 eval $setvar
13445
13446 : see if net/errno.h is available
13447 val=''
13448 set net/errno.h val
13449 eval $inhdr
13450
13451 : Unfortunately, it causes problems on some systems.  Arrgh.
13452 case "$val" in
13453 $define)
13454         cat > try.c <<'EOM'
13455 #include <stdio.h>
13456 #include <errno.h>
13457 #include <net/errno.h>
13458 int func()
13459 {
13460         return ENOTSOCK;
13461 }
13462 EOM
13463         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13464                 echo "We'll be including <net/errno.h>." >&4
13465         else
13466                 echo "We won't be including <net/errno.h>." >&4
13467                 val="$undef"
13468         fi
13469         $rm -f try.* try
13470         ;;
13471 esac
13472 set i_neterrno
13473 eval $setvar
13474
13475 : see if netinet/tcp.h is available
13476 set netinet/tcp.h i_netinettcp
13477 eval $inhdr
13478
13479 : see if this is a poll.h system
13480 set poll.h i_poll
13481 eval $inhdr
13482
13483 : get C preprocessor symbols handy
13484 echo " "
13485 $echo $n "Hmm... $c"
13486 echo $al | $tr ' ' $trnl >Cppsym.know
13487 $cat <<EOSS >Cppsym
13488 $startsh
13489 case "\$1" in
13490 -l) list=true
13491         shift
13492         ;;
13493 esac
13494 unknown=''
13495 case "\$list\$#" in
13496 1|2)
13497         for sym do
13498                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
13499                         exit 0
13500                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
13501                         :
13502                 else
13503                         unknown="\$unknown \$sym"
13504                 fi
13505         done
13506         set X \$unknown
13507         shift
13508         ;;
13509 esac
13510 case \$# in
13511 0) exit 1;;
13512 esac
13513 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
13514 #ifdef \1\\
13515 exit 0; _ _ _ _\1\\      \1\\
13516 #endif\\
13517 /' >Cppsym\$\$
13518 echo "exit 1; _ _ _" >>Cppsym\$\$
13519 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
13520 case "\$list" in
13521 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
13522 *)
13523         sh Cppsym2\$\$
13524         status=\$?
13525         ;;
13526 esac
13527 $rm -f Cppsym\$\$ Cppsym2\$\$
13528 exit \$status
13529 EOSS
13530 chmod +x Cppsym
13531 $eunicefix Cppsym
13532 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
13533
13534 : now check the C compiler for additional symbols
13535 postprocess_cc_v=''
13536 case "$osname" in
13537 aix) postprocess_cc_v="|$tr , ' '" ;;
13538 esac
13539 $cat >ccsym <<EOS
13540 $startsh
13541 $cat >tmp.c <<EOF
13542 extern int foo;
13543 EOF
13544 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13545 do
13546         case "\$i" in
13547         -D*) echo "\$i" | $sed 's/^-D//';;
13548         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13549         esac
13550 done
13551 $rm -f try.c
13552 EOS
13553 postprocess_cc_v=''
13554 chmod +x ccsym
13555 $eunicefix ccsym
13556 ./ccsym > ccsym1.raw
13557 if $test -s ccsym1.raw; then
13558        $sort ccsym1.raw | $uniq >ccsym.raw
13559 else
13560        mv ccsym1.raw ccsym.raw
13561 fi
13562
13563 $awk '/\=/ { print $0; next }
13564         { print $0"=1" }' ccsym.raw >ccsym.list
13565 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
13566 $comm -13 ccsym.true ccsym.list >ccsym.own
13567 $comm -12 ccsym.true ccsym.list >ccsym.com
13568 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13569 also=''
13570 if $test -z ccsym.raw; then
13571         echo "Your C compiler doesn't seem to define any symbols!" >&4
13572         echo " "
13573         echo "However, your C preprocessor defines the following symbols:"
13574         $cat Cppsym.true
13575         ccsymbols=''
13576         cppsymbols=`$cat Cppsym.true`
13577         cppsymbols=`echo $cppsymbols`
13578         cppccsymbols="$cppsymbols"
13579 else
13580         if $test -s ccsym.com; then
13581                 echo "Your C compiler and pre-processor define these symbols:"
13582                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13583                 also='also '
13584                 symbols='ones'
13585                 cppccsymbols=`$cat ccsym.com`
13586                 cppccsymbols=`echo $cppccsymbols`
13587                 $test "$silent" || sleep 1
13588         fi
13589         if $test -s ccsym.cpp; then
13590                 $test "$also" && echo " "
13591                 echo "Your C pre-processor ${also}defines the following symbols:"
13592                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13593                 also='further '
13594                 cppsymbols=`$cat ccsym.cpp`
13595                 cppsymbols=`echo $cppsymbols`
13596                 $test "$silent" || sleep 1
13597         fi
13598         if $test -s ccsym.own; then
13599                 $test "$also" && echo " "
13600                 echo "Your C compiler ${also}defines the following cpp symbols:"
13601                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13602                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13603                 ccsymbols=`$cat ccsym.own`
13604                 ccsymbols=`echo $ccsymbols`
13605                 $test "$silent" || sleep 1
13606         fi
13607 fi
13608 $rm -f ccsym*
13609
13610 : see if this is a termio system
13611 val="$undef"
13612 val2="$undef"
13613 val3="$undef"
13614 if $test `./findhdr termios.h`; then
13615         set tcsetattr i_termios
13616         eval $inlibc
13617         val3="$i_termios"
13618 fi
13619 echo " "
13620 case "$val3" in
13621 "$define") echo "You have POSIX termios.h... good!" >&4;;
13622 *) if ./Cppsym pyr; then
13623                 case "`/bin/universe`" in
13624                 ucb) if $test `./findhdr sgtty.h`; then
13625                                 val2="$define"
13626                                 echo "<sgtty.h> found." >&4
13627                         else
13628                                 echo "System is pyramid with BSD universe."
13629                                 echo "<sgtty.h> not found--you could have problems." >&4
13630                         fi;;
13631                 *) if $test `./findhdr termio.h`; then
13632                                 val="$define"
13633                                 echo "<termio.h> found." >&4
13634                         else
13635                                 echo "System is pyramid with USG universe."
13636                                 echo "<termio.h> not found--you could have problems." >&4
13637                         fi;;
13638                 esac
13639         elif ./usg; then
13640                 if $test `./findhdr termio.h`; then
13641                         echo "<termio.h> found." >&4
13642                         val="$define"
13643                 elif $test `./findhdr sgtty.h`; then
13644                         echo "<sgtty.h> found." >&4
13645                         val2="$define"
13646                 else
13647 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13648                 fi
13649         else
13650                 if $test `./findhdr sgtty.h`; then
13651                         echo "<sgtty.h> found." >&4
13652                         val2="$define"
13653                 elif $test `./findhdr termio.h`; then
13654                         echo "<termio.h> found." >&4
13655                         val="$define"
13656                 else
13657 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13658                 fi
13659         fi;;
13660 esac
13661 set i_termio; eval $setvar
13662 val=$val2; set i_sgtty; eval $setvar
13663 val=$val3; set i_termios; eval $setvar
13664
13665 : see if this is a shadow.h system
13666 set shadow.h i_shadow
13667 eval $inhdr
13668
13669 : see if this is a socks.h system
13670 set socks.h i_socks
13671 eval $inhdr
13672
13673 : see if stdarg is available
13674 echo " "
13675 if $test `./findhdr stdarg.h`; then
13676         echo "<stdarg.h> found." >&4
13677         valstd="$define"
13678 else
13679         echo "<stdarg.h> NOT found." >&4
13680         valstd="$undef"
13681 fi
13682
13683 : see if varags is available
13684 echo " "
13685 if $test `./findhdr varargs.h`; then
13686         echo "<varargs.h> found." >&4
13687 else
13688         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13689 fi
13690
13691 : set up the varargs testing programs
13692 $cat > varargs.c <<EOP
13693 #ifdef I_STDARG
13694 #include <stdarg.h>
13695 #endif
13696 #ifdef I_VARARGS
13697 #include <varargs.h>
13698 #endif
13699
13700 #ifdef I_STDARG
13701 int f(char *p, ...)
13702 #else
13703 int f(va_alist)
13704 va_dcl
13705 #endif
13706 {
13707         va_list ap;
13708 #ifndef I_STDARG
13709         char *p;
13710 #endif
13711 #ifdef I_STDARG
13712         va_start(ap,p);
13713 #else
13714         va_start(ap);
13715         p = va_arg(ap, char *);
13716 #endif
13717         va_end(ap);
13718 }
13719 EOP
13720 $cat > varargs <<EOP
13721 $startsh
13722 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13723         echo "true"
13724 else
13725         echo "false"
13726 fi
13727 $rm -f varargs$_o
13728 EOP
13729 chmod +x varargs
13730
13731 : now check which varargs header should be included
13732 echo " "
13733 i_varhdr=''
13734 case "$valstd" in
13735 "$define")
13736         if `./varargs I_STDARG`; then
13737                 val='stdarg.h'
13738         elif `./varargs I_VARARGS`; then
13739                 val='varargs.h'
13740         fi
13741         ;;
13742 *)
13743         if `./varargs I_VARARGS`; then
13744                 val='varargs.h'
13745         fi
13746         ;;
13747 esac
13748 case "$val" in
13749 '')
13750 echo "I could not find the definition for va_dcl... You have problems..." >&4
13751         val="$undef"; set i_stdarg; eval $setvar
13752         val="$undef"; set i_varargs; eval $setvar
13753         ;;
13754 *) 
13755         set i_varhdr
13756         eval $setvar
13757         case "$i_varhdr" in
13758         stdarg.h)
13759                 val="$define"; set i_stdarg; eval $setvar
13760                 val="$undef"; set i_varargs; eval $setvar
13761                 ;;
13762         varargs.h)
13763                 val="$undef"; set i_stdarg; eval $setvar
13764                 val="$define"; set i_varargs; eval $setvar
13765                 ;;
13766         esac
13767         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13768 esac
13769 $rm -f varargs*
13770
13771 : see if stddef is available
13772 set stddef.h i_stddef
13773 eval $inhdr
13774
13775 : see if sys/access.h is available
13776 set sys/access.h i_sysaccess
13777 eval $inhdr
13778
13779 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13780 set sys/filio.h i_sysfilio
13781 eval $inhdr
13782 echo " "
13783 if $test `./findhdr sys/ioctl.h`; then
13784         val="$define"
13785         echo '<sys/ioctl.h> found.' >&4
13786 else
13787         val="$undef"
13788         if $test $i_sysfilio = "$define"; then
13789             echo '<sys/ioctl.h> NOT found.' >&4
13790         else
13791                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13792                 $test $i_termio = "$define" && xxx="termio.h"
13793                 $test $i_termios = "$define" && xxx="termios.h"
13794 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13795         fi
13796 fi
13797 set i_sysioctl
13798 eval $setvar
13799
13800 : see if sys/resource.h has to be included
13801 set sys/resource.h i_sysresrc
13802 eval $inhdr
13803
13804 : see if sys/security.h is available
13805 set sys/security.h i_syssecrt
13806 eval $inhdr
13807
13808 : see if this is a sys/statvfs.h system
13809 set sys/statvfs.h i_sysstatvfs
13810 eval $inhdr
13811
13812 : see if this is a sys/uio.h system
13813 set sys/uio.h i_sysuio
13814 eval $inhdr
13815
13816 : see if this is a sys/un.h system
13817 set sys/un.h i_sysun
13818 eval $inhdr
13819
13820 : see if this is a syswait system
13821 set sys/wait.h i_syswait
13822 eval $inhdr
13823
13824 : see if this is a ustat.h system
13825 set ustat.h i_ustat
13826 eval $inhdr
13827
13828 : see if this is an utime system
13829 set utime.h i_utime
13830 eval $inhdr
13831
13832 : see if this is a values.h system
13833 set values.h i_values
13834 eval $inhdr
13835
13836 : see if this is a vfork system
13837 case "$d_vfork" in
13838 "$define")
13839         set vfork.h i_vfork
13840         eval $inhdr
13841         ;;
13842 *)
13843         i_vfork="$undef"
13844         ;;
13845 esac
13846
13847 : see if gdbm.h is available
13848 set gdbm.h t_gdbm
13849 eval $inhdr
13850 case "$t_gdbm" in
13851 $define)
13852         : see if gdbm_open exists
13853         set gdbm_open d_gdbm_open
13854         eval $inlibc
13855         case "$d_gdbm_open" in
13856         $undef)
13857                 t_gdbm="$undef"
13858                 echo "We won't be including <gdbm.h>"
13859                 ;;
13860         esac
13861         ;;
13862 esac
13863 val="$t_gdbm"
13864 set i_gdbm
13865 eval $setvar
13866
13867 echo " "
13868 echo "Looking for extensions..." >&4
13869 : If we are using the old config.sh, known_extensions may contain
13870 : old or inaccurate or duplicate values.
13871 known_extensions=''
13872 nonxs_extensions=''
13873 : We do not use find because it might not be available.
13874 : We do not just use MANIFEST because the user may have dropped
13875 : some additional extensions into the source tree and expect them
13876 : to be built.
13877
13878 : Function to recursively find available extensions, ignoring DynaLoader
13879 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13880 find_extensions='
13881     for xxx in *; do
13882        case "$xxx" in
13883            DynaLoader|dynaload) ;;
13884            *)
13885            if $test -f $xxx/$xxx.xs; then
13886                known_extensions="$known_extensions $1$xxx";
13887            elif $test -f $xxx/Makefile.PL; then
13888                nonxs_extensions="$nonxs_extensions $1$xxx";
13889            else
13890                if $test -d $xxx -a $# -lt 10; then
13891                    set $1$xxx/ $*;
13892                    cd $xxx;
13893                    eval $find_extensions;
13894                    cd ..;
13895                    shift;
13896                fi;
13897            fi
13898            ;;
13899        esac;
13900     done'
13901 tdir=`pwd`
13902 cd $rsrc/ext
13903 set X
13904 shift
13905 eval $find_extensions
13906 set X $nonxs_extensions
13907 shift
13908 nonxs_extensions="$*"
13909 set X $known_extensions
13910 shift
13911 known_extensions="$*"
13912 cd $tdir
13913
13914 : Now see which are supported on this system.
13915 avail_ext=''
13916 for xxx in $known_extensions ; do
13917         case "$xxx" in
13918         DB_File|db_file)
13919                 case "$i_db" in
13920                 $define) avail_ext="$avail_ext $xxx" ;;
13921                 esac
13922                 ;;
13923         GDBM_File|gdbm_fil)
13924                 case "$i_gdbm" in 
13925                 $define) avail_ext="$avail_ext $xxx" ;;
13926                 esac
13927                 ;;
13928         NDBM_File|ndbm_fil)
13929                 case "$i_ndbm" in
13930                 $define) avail_ext="$avail_ext $xxx" ;;
13931                 esac
13932                 ;;
13933         ODBM_File|odbm_fil) 
13934                 case "${i_dbm}${i_rpcsvcdbm}" in
13935                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13936                 esac
13937                 ;;
13938         POSIX|posix)
13939                 case "$useposix" in
13940                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13941                 esac
13942                 ;;
13943         Opcode|opcode)
13944                 case "$useopcode" in
13945                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13946                 esac
13947                 ;;
13948         Socket|socket)
13949                 case "$d_socket" in 
13950                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13951                 esac
13952                 ;;
13953         Thread|thread)
13954                 case "$usethreads" in 
13955                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13956                 esac
13957                 ;;
13958         IPC/SysV|ipc/sysv)
13959                 : XXX Do we need a useipcsysv variable here
13960                 case "${d_msg}${d_sem}${d_shm}" in 
13961                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13962                 esac
13963                 ;;
13964         *)      avail_ext="$avail_ext $xxx"
13965                 ;;
13966         esac
13967 done
13968
13969 set X $avail_ext
13970 shift
13971 avail_ext="$*"
13972
13973 : Now see which nonxs extensions are supported on this system.
13974 : For now assume all are.
13975 nonxs_ext=''
13976 for xxx in $nonxs_extensions ; do
13977         case "$xxx" in
13978         *)      nonxs_ext="$nonxs_ext $xxx"
13979                 ;;
13980         esac
13981 done
13982
13983 set X $nonxs_ext
13984 shift
13985 nonxs_ext="$*"
13986
13987 case $usedl in
13988 $define)
13989         $cat <<EOM
13990 A number of extensions are supplied with $package.  You may choose to
13991 compile these extensions for dynamic loading (the default), compile
13992 them into the $package executable (static loading), or not include
13993 them at all.  Answer "none" to include no extensions.
13994 Note that DynaLoader is always built and need not be mentioned here.
13995
13996 EOM
13997         case "$dynamic_ext" in
13998         '') dflt="$avail_ext" ;;
13999         *)      dflt="$dynamic_ext"
14000                 # Perhaps we are reusing an old out-of-date config.sh.
14001                 case "$hint" in
14002                 previous)
14003                         if test X"$dynamic_ext" != X"$avail_ext"; then
14004                                 $cat <<EOM
14005 NOTICE:  Your previous config.sh list may be incorrect. 
14006 The extensions now available to you are 
14007         ${avail_ext}
14008 but the default list from your previous config.sh is
14009         ${dynamic_ext} 
14010
14011 EOM
14012                         fi
14013                         ;;
14014                 esac
14015                 ;;
14016         esac
14017         case "$dflt" in
14018         '')     dflt=none;;
14019         esac
14020         rp="What extensions do you wish to load dynamically?"
14021         . ./myread
14022         case "$ans" in
14023         none) dynamic_ext=' ' ;;
14024         *) dynamic_ext="$ans" ;;
14025         esac
14026
14027         case "$static_ext" in
14028         '')
14029                 : Exclude those already listed in dynamic linking
14030                 dflt=''
14031                 for xxx in $avail_ext; do
14032                         case " $dynamic_ext " in
14033                         *" $xxx "*) ;;
14034                         *) dflt="$dflt $xxx" ;;
14035                         esac
14036                 done
14037                 set X $dflt
14038                 shift
14039                 dflt="$*"
14040                 ;;
14041         *)  dflt="$static_ext" 
14042                 ;;
14043         esac
14044
14045         case "$dflt" in
14046         '')     dflt=none;;
14047         esac
14048         rp="What extensions do you wish to load statically?"
14049         . ./myread
14050         case "$ans" in
14051         none) static_ext=' ' ;;
14052         *) static_ext="$ans" ;;
14053         esac
14054         ;;
14055 *)
14056         $cat <<EOM
14057 A number of extensions are supplied with $package.  Answer "none" 
14058 to include no extensions. 
14059 Note that DynaLoader is always built and need not be mentioned here.
14060
14061 EOM
14062         case "$static_ext" in
14063         '') dflt="$avail_ext" ;;
14064         *)      dflt="$static_ext"
14065                 # Perhaps we are reusing an old out-of-date config.sh.
14066                 case "$hint" in
14067                 previous)
14068                         if test X"$static_ext" != X"$avail_ext"; then
14069                                 $cat <<EOM
14070 NOTICE:  Your previous config.sh list may be incorrect. 
14071 The extensions now available to you are 
14072         ${avail_ext}
14073 but the default list from your previous config.sh is
14074         ${static_ext} 
14075
14076 EOM
14077                         fi
14078                         ;;
14079                 esac
14080                 ;;
14081         esac
14082         : Exclude those that are not xs extensions
14083         case "$dflt" in
14084         '')     dflt=none;;
14085         esac
14086         rp="What extensions do you wish to include?"
14087         . ./myread
14088         case "$ans" in
14089         none) static_ext=' ' ;;
14090         *) static_ext="$ans" ;;
14091         esac
14092         ;;
14093 esac
14094
14095 set X $dynamic_ext $static_ext $nonxs_ext
14096 shift
14097 extensions="$*"
14098
14099 : Remove build directory name from cppstdin so it can be used from
14100 : either the present location or the final installed location.
14101 echo " "
14102 : Get out of the UU directory to get correct path name.
14103 cd ..
14104 case "$cppstdin" in
14105 `pwd`/cppstdin)
14106         echo "Stripping down cppstdin path name"
14107         cppstdin=cppstdin
14108         ;;
14109 esac
14110 cd UU
14111
14112 : end of configuration questions
14113 echo " "
14114 echo "End of configuration questions."
14115 echo " "
14116
14117 : back to where it started
14118 if test -d ../UU; then
14119         cd ..
14120 fi
14121
14122 : configuration may be patched via a 'config.over' file
14123 if $test -f config.over; then
14124         echo " "
14125         dflt=y
14126         rp='I see a config.over file.  Do you wish to load it?'
14127         . UU/myread
14128         case "$ans" in
14129         n*) echo "OK, I'll ignore it.";;
14130         *)      . ./config.over
14131                 echo "Configuration override changes have been loaded."
14132                 ;;
14133         esac
14134 fi
14135
14136 : in case they want portability, strip down executable paths
14137 case "$d_portable" in
14138 "$define")
14139         echo " "
14140         echo "Stripping down executable paths..." >&4
14141         for file in $loclist $trylist; do
14142                 eval temp=\$$file
14143                 eval $file=`basename $temp`
14144         done
14145         ;;
14146 esac
14147
14148 : create config.sh file
14149 echo " "
14150 echo "Creating config.sh..." >&4
14151 $spitshell <<EOT >config.sh
14152 $startsh
14153 #
14154 # This file was produced by running the Configure script. It holds all the
14155 # definitions figured out by Configure. Should you modify one of these values,
14156 # do not forget to propagate your changes by running "Configure -der". You may
14157 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14158 #
14159
14160 # Package name      : $package
14161 # Source directory  : $src
14162 # Configuration time: $cf_time
14163 # Configured by     : $cf_by
14164 # Target system     : $myuname
14165
14166 Author='$Author'
14167 Date='$Date'
14168 Header='$Header'
14169 Id='$Id'
14170 Locker='$Locker'
14171 Log='$Log'
14172 Mcc='$Mcc'
14173 RCSfile='$RCSfile'
14174 Revision='$Revision'
14175 Source='$Source'
14176 State='$State'
14177 _a='$_a'
14178 _exe='$_exe'
14179 _o='$_o'
14180 afs='$afs'
14181 alignbytes='$alignbytes'
14182 ansi2knr='$ansi2knr'
14183 aphostname='$aphostname'
14184 apiversion='$apiversion'
14185 ar='$ar'
14186 archlib='$archlib'
14187 archlibexp='$archlibexp'
14188 archname64='$archname64'
14189 archname='$archname'
14190 archobjs='$archobjs'
14191 awk='$awk'
14192 baserev='$baserev'
14193 bash='$bash'
14194 bin='$bin'
14195 bincompat5005='$bincompat5005'
14196 binexp='$binexp'
14197 bison='$bison'
14198 byacc='$byacc'
14199 byteorder='$byteorder'
14200 c='$c'
14201 castflags='$castflags'
14202 cat='$cat'
14203 cc='$cc'
14204 cccdlflags='$cccdlflags'
14205 ccdlflags='$ccdlflags'
14206 ccflags='$ccflags'
14207 ccsymbols='$ccsymbols'
14208 cf_by='$cf_by'
14209 cf_email='$cf_email'
14210 cf_time='$cf_time'
14211 charsize='$charsize'
14212 chgrp='$chgrp'
14213 chmod='$chmod'
14214 chown='$chown'
14215 clocktype='$clocktype'
14216 comm='$comm'
14217 compress='$compress'
14218 contains='$contains'
14219 cp='$cp'
14220 cpio='$cpio'
14221 cpp='$cpp'
14222 cpp_stuff='$cpp_stuff'
14223 cppccsymbols='$cppccsymbols'
14224 cppflags='$cppflags'
14225 cpplast='$cpplast'
14226 cppminus='$cppminus'
14227 cpprun='$cpprun'
14228 cppstdin='$cppstdin'
14229 cppsymbols='$cppsymbols'
14230 crosscompile='$crosscompile'
14231 cryptlib='$cryptlib'
14232 csh='$csh'
14233 d_Gconvert='$d_Gconvert'
14234 d_PRIEldbl='$d_PRIEldbl'
14235 d_PRIFldbl='$d_PRIFldbl'
14236 d_PRIGldbl='$d_PRIGldbl'
14237 d_PRIX64='$d_PRIX64'
14238 d_PRId64='$d_PRId64'
14239 d_PRIeldbl='$d_PRIeldbl'
14240 d_PRIfldbl='$d_PRIfldbl'
14241 d_PRIgldbl='$d_PRIgldbl'
14242 d_PRIi64='$d_PRIi64'
14243 d_PRIo64='$d_PRIo64'
14244 d_PRIu64='$d_PRIu64'
14245 d_PRIx64='$d_PRIx64'
14246 d_access='$d_access'
14247 d_accessx='$d_accessx'
14248 d_alarm='$d_alarm'
14249 d_archlib='$d_archlib'
14250 d_atolf='$d_atolf'
14251 d_atoll='$d_atoll'
14252 d_attribut='$d_attribut'
14253 d_bcmp='$d_bcmp'
14254 d_bcopy='$d_bcopy'
14255 d_bincompat5005='$d_bincompat5005'
14256 d_bsd='$d_bsd'
14257 d_bsdgetpgrp='$d_bsdgetpgrp'
14258 d_bsdsetpgrp='$d_bsdsetpgrp'
14259 d_bzero='$d_bzero'
14260 d_casti32='$d_casti32'
14261 d_castneg='$d_castneg'
14262 d_charvspr='$d_charvspr'
14263 d_chown='$d_chown'
14264 d_chroot='$d_chroot'
14265 d_chsize='$d_chsize'
14266 d_closedir='$d_closedir'
14267 d_const='$d_const'
14268 d_crypt='$d_crypt'
14269 d_csh='$d_csh'
14270 d_cuserid='$d_cuserid'
14271 d_dbl_dig='$d_dbl_dig'
14272 d_difftime='$d_difftime'
14273 d_dirnamlen='$d_dirnamlen'
14274 d_dlerror='$d_dlerror'
14275 d_dlopen='$d_dlopen'
14276 d_dlsymun='$d_dlsymun'
14277 d_dosuid='$d_dosuid'
14278 d_drand48proto='$d_drand48proto'
14279 d_dup2='$d_dup2'
14280 d_eaccess='$d_eaccess'
14281 d_endgrent='$d_endgrent'
14282 d_endhent='$d_endhent'
14283 d_endnent='$d_endnent'
14284 d_endpent='$d_endpent'
14285 d_endpwent='$d_endpwent'
14286 d_endsent='$d_endsent'
14287 d_endspent='$d_endspent'
14288 d_eofnblk='$d_eofnblk'
14289 d_eunice='$d_eunice'
14290 d_fchmod='$d_fchmod'
14291 d_fchown='$d_fchown'
14292 d_fcntl='$d_fcntl'
14293 d_fd_macros='$d_fd_macros'
14294 d_fd_set='$d_fd_set'
14295 d_fds_bits='$d_fds_bits'
14296 d_fgetpos='$d_fgetpos'
14297 d_flexfnam='$d_flexfnam'
14298 d_flock='$d_flock'
14299 d_fork='$d_fork'
14300 d_fpathconf='$d_fpathconf'
14301 d_fpos64_t='$d_fpos64_t'
14302 d_fs_data_s='$d_fs_data_s'
14303 d_fseeko='$d_fseeko'
14304 d_fsetpos='$d_fsetpos'
14305 d_fstatfs='$d_fstatfs'
14306 d_fstatvfs='$d_fstatvfs'
14307 d_ftello='$d_ftello'
14308 d_ftime='$d_ftime'
14309 d_getgrent='$d_getgrent'
14310 d_getgrps='$d_getgrps'
14311 d_gethbyaddr='$d_gethbyaddr'
14312 d_gethbyname='$d_gethbyname'
14313 d_gethent='$d_gethent'
14314 d_gethname='$d_gethname'
14315 d_gethostprotos='$d_gethostprotos'
14316 d_getlogin='$d_getlogin'
14317 d_getmnt='$d_getmnt'
14318 d_getmntent='$d_getmntent'
14319 d_getnbyaddr='$d_getnbyaddr'
14320 d_getnbyname='$d_getnbyname'
14321 d_getnent='$d_getnent'
14322 d_getnetprotos='$d_getnetprotos'
14323 d_getpbyname='$d_getpbyname'
14324 d_getpbynumber='$d_getpbynumber'
14325 d_getpent='$d_getpent'
14326 d_getpgid='$d_getpgid'
14327 d_getpgrp2='$d_getpgrp2'
14328 d_getpgrp='$d_getpgrp'
14329 d_getppid='$d_getppid'
14330 d_getprior='$d_getprior'
14331 d_getprotoprotos='$d_getprotoprotos'
14332 d_getpwent='$d_getpwent'
14333 d_getsbyname='$d_getsbyname'
14334 d_getsbyport='$d_getsbyport'
14335 d_getsent='$d_getsent'
14336 d_getservprotos='$d_getservprotos'
14337 d_getspent='$d_getspent'
14338 d_getspnam='$d_getspnam'
14339 d_gettimeod='$d_gettimeod'
14340 d_gnulibc='$d_gnulibc'
14341 d_grpasswd='$d_grpasswd'
14342 d_hasmntopt='$d_hasmntopt'
14343 d_htonl='$d_htonl'
14344 d_index='$d_index'
14345 d_inetaton='$d_inetaton'
14346 d_int64t='$d_int64t'
14347 d_isascii='$d_isascii'
14348 d_killpg='$d_killpg'
14349 d_lchown='$d_lchown'
14350 d_ldbl_dig='$d_ldbl_dig'
14351 d_link='$d_link'
14352 d_locconv='$d_locconv'
14353 d_lockf='$d_lockf'
14354 d_longdbl='$d_longdbl'
14355 d_longlong='$d_longlong'
14356 d_lstat='$d_lstat'
14357 d_mblen='$d_mblen'
14358 d_mbstowcs='$d_mbstowcs'
14359 d_mbtowc='$d_mbtowc'
14360 d_memchr='$d_memchr'
14361 d_memcmp='$d_memcmp'
14362 d_memcpy='$d_memcpy'
14363 d_memmove='$d_memmove'
14364 d_memset='$d_memset'
14365 d_mkdir='$d_mkdir'
14366 d_mkfifo='$d_mkfifo'
14367 d_mktime='$d_mktime'
14368 d_msg='$d_msg'
14369 d_msg_ctrunc='$d_msg_ctrunc'
14370 d_msg_dontroute='$d_msg_dontroute'
14371 d_msg_oob='$d_msg_oob'
14372 d_msg_peek='$d_msg_peek'
14373 d_msg_proxy='$d_msg_proxy'
14374 d_msgctl='$d_msgctl'
14375 d_msgget='$d_msgget'
14376 d_msgrcv='$d_msgrcv'
14377 d_msgsnd='$d_msgsnd'
14378 d_mymalloc='$d_mymalloc'
14379 d_nice='$d_nice'
14380 d_off64_t='$d_off64_t'
14381 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14382 d_oldpthreads='$d_oldpthreads'
14383 d_oldsock='$d_oldsock'
14384 d_open3='$d_open3'
14385 d_pathconf='$d_pathconf'
14386 d_pause='$d_pause'
14387 d_phostname='$d_phostname'
14388 d_pipe='$d_pipe'
14389 d_poll='$d_poll'
14390 d_portable='$d_portable'
14391 d_pthread_yield='$d_pthread_yield'
14392 d_pwage='$d_pwage'
14393 d_pwchange='$d_pwchange'
14394 d_pwclass='$d_pwclass'
14395 d_pwcomment='$d_pwcomment'
14396 d_pwexpire='$d_pwexpire'
14397 d_pwgecos='$d_pwgecos'
14398 d_pwpasswd='$d_pwpasswd'
14399 d_pwquota='$d_pwquota'
14400 d_quad='$d_quad'
14401 d_readdir='$d_readdir'
14402 d_readlink='$d_readlink'
14403 d_rename='$d_rename'
14404 d_rewinddir='$d_rewinddir'
14405 d_rmdir='$d_rmdir'
14406 d_safebcpy='$d_safebcpy'
14407 d_safemcpy='$d_safemcpy'
14408 d_sanemcmp='$d_sanemcmp'
14409 d_sched_yield='$d_sched_yield'
14410 d_scm_rights='$d_scm_rights'
14411 d_seekdir='$d_seekdir'
14412 d_select='$d_select'
14413 d_sem='$d_sem'
14414 d_semctl='$d_semctl'
14415 d_semctl_semid_ds='$d_semctl_semid_ds'
14416 d_semctl_semun='$d_semctl_semun'
14417 d_semget='$d_semget'
14418 d_semop='$d_semop'
14419 d_setegid='$d_setegid'
14420 d_seteuid='$d_seteuid'
14421 d_setgrent='$d_setgrent'
14422 d_setgrps='$d_setgrps'
14423 d_sethent='$d_sethent'
14424 d_setlinebuf='$d_setlinebuf'
14425 d_setlocale='$d_setlocale'
14426 d_setnent='$d_setnent'
14427 d_setpent='$d_setpent'
14428 d_setpgid='$d_setpgid'
14429 d_setpgrp2='$d_setpgrp2'
14430 d_setpgrp='$d_setpgrp'
14431 d_setprior='$d_setprior'
14432 d_setpwent='$d_setpwent'
14433 d_setregid='$d_setregid'
14434 d_setresgid='$d_setresgid'
14435 d_setresuid='$d_setresuid'
14436 d_setreuid='$d_setreuid'
14437 d_setrgid='$d_setrgid'
14438 d_setruid='$d_setruid'
14439 d_setsent='$d_setsent'
14440 d_setsid='$d_setsid'
14441 d_setspent='$d_setspent'
14442 d_setvbuf='$d_setvbuf'
14443 d_sfio='$d_sfio'
14444 d_shm='$d_shm'
14445 d_shmat='$d_shmat'
14446 d_shmatprototype='$d_shmatprototype'
14447 d_shmctl='$d_shmctl'
14448 d_shmdt='$d_shmdt'
14449 d_shmget='$d_shmget'
14450 d_sigaction='$d_sigaction'
14451 d_sigsetjmp='$d_sigsetjmp'
14452 d_socket='$d_socket'
14453 d_sockpair='$d_sockpair'
14454 d_sqrtl='$d_sqrtl'
14455 d_statblks='$d_statblks'
14456 d_statfs_f_flags='$d_statfs_f_flags'
14457 d_statfs_s='$d_statfs_s'
14458 d_statvfs='$d_statvfs'
14459 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14460 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14461 d_stdio_stream_array='$d_stdio_stream_array'
14462 d_stdiobase='$d_stdiobase'
14463 d_stdstdio='$d_stdstdio'
14464 d_strchr='$d_strchr'
14465 d_strcoll='$d_strcoll'
14466 d_strctcpy='$d_strctcpy'
14467 d_strerrm='$d_strerrm'
14468 d_strerror='$d_strerror'
14469 d_strtod='$d_strtod'
14470 d_strtol='$d_strtol'
14471 d_strtoul='$d_strtoul'
14472 d_strtoull='$d_strtoull'
14473 d_strxfrm='$d_strxfrm'
14474 d_suidsafe='$d_suidsafe'
14475 d_symlink='$d_symlink'
14476 d_syscall='$d_syscall'
14477 d_sysconf='$d_sysconf'
14478 d_sysernlst='$d_sysernlst'
14479 d_syserrlst='$d_syserrlst'
14480 d_system='$d_system'
14481 d_tcgetpgrp='$d_tcgetpgrp'
14482 d_tcsetpgrp='$d_tcsetpgrp'
14483 d_telldir='$d_telldir'
14484 d_telldirproto='$d_telldirproto'
14485 d_time='$d_time'
14486 d_times='$d_times'
14487 d_truncate='$d_truncate'
14488 d_tzname='$d_tzname'
14489 d_umask='$d_umask'
14490 d_uname='$d_uname'
14491 d_union_semun='$d_union_semun'
14492 d_ustat='$d_ustat'
14493 d_vendorbin='$d_vendorbin'
14494 d_vendorlib='$d_vendorlib'
14495 d_vfork='$d_vfork'
14496 d_void_closedir='$d_void_closedir'
14497 d_voidsig='$d_voidsig'
14498 d_voidtty='$d_voidtty'
14499 d_volatile='$d_volatile'
14500 d_vprintf='$d_vprintf'
14501 d_wait4='$d_wait4'
14502 d_waitpid='$d_waitpid'
14503 d_wcstombs='$d_wcstombs'
14504 d_wctomb='$d_wctomb'
14505 d_xenix='$d_xenix'
14506 date='$date'
14507 db_hashtype='$db_hashtype'
14508 db_prefixtype='$db_prefixtype'
14509 defvoidused='$defvoidused'
14510 direntrytype='$direntrytype'
14511 dlext='$dlext'
14512 dlsrc='$dlsrc'
14513 doublesize='$doublesize'
14514 drand01='$drand01'
14515 dynamic_ext='$dynamic_ext'
14516 eagain='$eagain'
14517 ebcdic='$ebcdic'
14518 echo='$echo'
14519 egrep='$egrep'
14520 emacs='$emacs'
14521 eunicefix='$eunicefix'
14522 exe_ext='$exe_ext'
14523 expr='$expr'
14524 extensions='$extensions'
14525 fflushNULL='$fflushNULL'
14526 fflushall='$fflushall'
14527 find='$find'
14528 firstmakefile='$firstmakefile'
14529 flex='$flex'
14530 fpossize='$fpossize'
14531 fpostype='$fpostype'
14532 freetype='$freetype'
14533 full_ar='$full_ar'
14534 full_csh='$full_csh'
14535 full_sed='$full_sed'
14536 gccversion='$gccversion'
14537 gidformat='$gidformat'
14538 gidsign='$gidsign'
14539 gidsize='$gidsize'
14540 gidtype='$gidtype'
14541 glibpth='$glibpth'
14542 grep='$grep'
14543 groupcat='$groupcat'
14544 groupstype='$groupstype'
14545 gzip='$gzip'
14546 h_fcntl='$h_fcntl'
14547 h_sysfile='$h_sysfile'
14548 hint='$hint'
14549 hostcat='$hostcat'
14550 huge='$huge'
14551 i16size='$i16size'
14552 i16type='$i16type'
14553 i32size='$i32size'
14554 i32type='$i32type'
14555 i64size='$i64size'
14556 i64type='$i64type'
14557 i8size='$i8size'
14558 i8type='$i8type'
14559 i_arpainet='$i_arpainet'
14560 i_bsdioctl='$i_bsdioctl'
14561 i_db='$i_db'
14562 i_dbm='$i_dbm'
14563 i_dirent='$i_dirent'
14564 i_dld='$i_dld'
14565 i_dlfcn='$i_dlfcn'
14566 i_fcntl='$i_fcntl'
14567 i_float='$i_float'
14568 i_gdbm='$i_gdbm'
14569 i_grp='$i_grp'
14570 i_inttypes='$i_inttypes'
14571 i_limits='$i_limits'
14572 i_locale='$i_locale'
14573 i_machcthr='$i_machcthr'
14574 i_malloc='$i_malloc'
14575 i_math='$i_math'
14576 i_memory='$i_memory'
14577 i_mntent='$i_mntent'
14578 i_ndbm='$i_ndbm'
14579 i_netdb='$i_netdb'
14580 i_neterrno='$i_neterrno'
14581 i_netinettcp='$i_netinettcp'
14582 i_niin='$i_niin'
14583 i_poll='$i_poll'
14584 i_pthread='$i_pthread'
14585 i_pwd='$i_pwd'
14586 i_rpcsvcdbm='$i_rpcsvcdbm'
14587 i_sfio='$i_sfio'
14588 i_sgtty='$i_sgtty'
14589 i_shadow='$i_shadow'
14590 i_socks='$i_socks'
14591 i_stdarg='$i_stdarg'
14592 i_stddef='$i_stddef'
14593 i_stdlib='$i_stdlib'
14594 i_string='$i_string'
14595 i_sysaccess='$i_sysaccess'
14596 i_sysdir='$i_sysdir'
14597 i_sysfile='$i_sysfile'
14598 i_sysfilio='$i_sysfilio'
14599 i_sysin='$i_sysin'
14600 i_sysioctl='$i_sysioctl'
14601 i_sysmount='$i_sysmount'
14602 i_sysndir='$i_sysndir'
14603 i_sysparam='$i_sysparam'
14604 i_sysresrc='$i_sysresrc'
14605 i_syssecrt='$i_syssecrt'
14606 i_sysselct='$i_sysselct'
14607 i_syssockio='$i_syssockio'
14608 i_sysstat='$i_sysstat'
14609 i_sysstatfs='$i_sysstatfs'
14610 i_sysstatvfs='$i_sysstatvfs'
14611 i_systime='$i_systime'
14612 i_systimek='$i_systimek'
14613 i_systimes='$i_systimes'
14614 i_systypes='$i_systypes'
14615 i_sysuio='$i_sysuio'
14616 i_sysun='$i_sysun'
14617 i_sysvfs='$i_sysvfs'
14618 i_syswait='$i_syswait'
14619 i_termio='$i_termio'
14620 i_termios='$i_termios'
14621 i_time='$i_time'
14622 i_unistd='$i_unistd'
14623 i_ustat='$i_ustat'
14624 i_utime='$i_utime'
14625 i_values='$i_values'
14626 i_varargs='$i_varargs'
14627 i_varhdr='$i_varhdr'
14628 i_vfork='$i_vfork'
14629 ignore_versioned_solibs='$ignore_versioned_solibs'
14630 incpath='$incpath'
14631 inews='$inews'
14632 installarchlib='$installarchlib'
14633 installbin='$installbin'
14634 installman1dir='$installman1dir'
14635 installman3dir='$installman3dir'
14636 installprefix='$installprefix'
14637 installprefixexp='$installprefixexp'
14638 installprivlib='$installprivlib'
14639 installscript='$installscript'
14640 installsitearch='$installsitearch'
14641 installsitebin='$installsitebin'
14642 installsitelib='$installsitelib'
14643 installstyle='$installstyle'
14644 installusrbinperl='$installusrbinperl'
14645 installvendorbin='$installvendorbin'
14646 installvendorlib='$installvendorlib'
14647 intsize='$intsize'
14648 ivdformat='$ivdformat'
14649 ivsize='$ivsize'
14650 ivtype='$ivtype'
14651 known_extensions='$known_extensions'
14652 ksh='$ksh'
14653 large='$large'
14654 ld='$ld'
14655 lddlflags='$lddlflags'
14656 ldflags='$ldflags'
14657 ldlibpthname='$ldlibpthname'
14658 less='$less'
14659 lib_ext='$lib_ext'
14660 libc='$libc'
14661 libperl='$libperl'
14662 libpth='$libpth'
14663 libs='$libs'
14664 libswanted='$libswanted'
14665 line='$line'
14666 lint='$lint'
14667 lkflags='$lkflags'
14668 ln='$ln'
14669 lns='$lns'
14670 locincpth='$locincpth'
14671 loclibpth='$loclibpth'
14672 longdblsize='$longdblsize'
14673 longlongsize='$longlongsize'
14674 longsize='$longsize'
14675 lp='$lp'
14676 lpr='$lpr'
14677 ls='$ls'
14678 lseeksize='$lseeksize'
14679 lseektype='$lseektype'
14680 mail='$mail'
14681 mailx='$mailx'
14682 make='$make'
14683 make_set_make='$make_set_make'
14684 mallocobj='$mallocobj'
14685 mallocsrc='$mallocsrc'
14686 malloctype='$malloctype'
14687 man1dir='$man1dir'
14688 man1direxp='$man1direxp'
14689 man1ext='$man1ext'
14690 man3dir='$man3dir'
14691 man3direxp='$man3direxp'
14692 man3ext='$man3ext'
14693 medium='$medium'
14694 mips_type='$mips_type'
14695 mkdir='$mkdir'
14696 models='$models'
14697 modetype='$modetype'
14698 more='$more'
14699 multiarch='$multiarch'
14700 mv='$mv'
14701 myarchname='$myarchname'
14702 mydomain='$mydomain'
14703 myhostname='$myhostname'
14704 myuname='$myuname'
14705 n='$n'
14706 netdb_hlen_type='$netdb_hlen_type'
14707 netdb_host_type='$netdb_host_type'
14708 netdb_name_type='$netdb_name_type'
14709 netdb_net_type='$netdb_net_type'
14710 nm='$nm'
14711 nm_opt='$nm_opt'
14712 nm_so_opt='$nm_so_opt'
14713 nonxs_ext='$nonxs_ext'
14714 nroff='$nroff'
14715 nvsize='$nvsize'
14716 nvtype='$nvtype'
14717 o_nonblock='$o_nonblock'
14718 obj_ext='$obj_ext'
14719 old_pthread_create_joinable='$old_pthread_create_joinable'
14720 optimize='$optimize'
14721 orderlib='$orderlib'
14722 osname='$osname'
14723 osvers='$osvers'
14724 package='$package'
14725 pager='$pager'
14726 passcat='$passcat'
14727 patchlevel='$patchlevel'
14728 path_sep='$path_sep'
14729 perl='$perl'
14730 perladmin='$perladmin'
14731 perlpath='$perlpath'
14732 pg='$pg'
14733 phostname='$phostname'
14734 pidtype='$pidtype'
14735 plibpth='$plibpth'
14736 pm_apiversion='$pm_apiversion'
14737 pmake='$pmake'
14738 pr='$pr'
14739 prefix='$prefix'
14740 prefixexp='$prefixexp'
14741 privlib='$privlib'
14742 privlibexp='$privlibexp'
14743 prototype='$prototype'
14744 ptrsize='$ptrsize'
14745 quadkind='$quadkind'
14746 quadtype='$quadtype'
14747 randbits='$randbits'
14748 randfunc='$randfunc'
14749 randseedtype='$randseedtype'
14750 ranlib='$ranlib'
14751 rd_nodata='$rd_nodata'
14752 rm='$rm'
14753 rmail='$rmail'
14754 runnm='$runnm'
14755 sPRIEldbl='$sPRIEldbl'
14756 sPRIFldbl='$sPRIFldbl'
14757 sPRIGldbl='$sPRIGldbl'
14758 sPRIX64='$sPRIX64'
14759 sPRId64='$sPRId64'
14760 sPRIeldbl='$sPRIeldbl'
14761 sPRIfldbl='$sPRIfldbl'
14762 sPRIgldbl='$sPRIgldbl'
14763 sPRIi64='$sPRIi64'
14764 sPRIo64='$sPRIo64'
14765 sPRIu64='$sPRIu64'
14766 sPRIx64='$sPRIx64'
14767 sched_yield='$sched_yield'
14768 scriptdir='$scriptdir'
14769 scriptdirexp='$scriptdirexp'
14770 sed='$sed'
14771 seedfunc='$seedfunc'
14772 selectminbits='$selectminbits'
14773 selecttype='$selecttype'
14774 sendmail='$sendmail'
14775 sh='$sh'
14776 shar='$shar'
14777 sharpbang='$sharpbang'
14778 shmattype='$shmattype'
14779 shortsize='$shortsize'
14780 shrpenv='$shrpenv'
14781 shsharp='$shsharp'
14782 sig_count='$sig_count'
14783 sig_name='$sig_name'
14784 sig_name_init='$sig_name_init'
14785 sig_num='$sig_num'
14786 sig_num_init='$sig_num_init'
14787 signal_t='$signal_t'
14788 sitearch='$sitearch'
14789 sitearchexp='$sitearchexp'
14790 sitebin='$sitebin'
14791 sitebinexp='$sitebinexp'
14792 sitelib='$sitelib'
14793 sitelibexp='$sitelibexp'
14794 siteprefix='$siteprefix'
14795 siteprefixexp='$siteprefixexp'
14796 sizetype='$sizetype'
14797 sleep='$sleep'
14798 smail='$smail'
14799 small='$small'
14800 so='$so'
14801 sockethdr='$sockethdr'
14802 socketlib='$socketlib'
14803 sort='$sort'
14804 spackage='$spackage'
14805 spitshell='$spitshell'
14806 split='$split'
14807 src='$src'
14808 ssizetype='$ssizetype'
14809 startperl='$startperl'
14810 startsh='$startsh'
14811 static_ext='$static_ext'
14812 stdchar='$stdchar'
14813 stdio_base='$stdio_base'
14814 stdio_bufsiz='$stdio_bufsiz'
14815 stdio_cnt='$stdio_cnt'
14816 stdio_filbuf='$stdio_filbuf'
14817 stdio_ptr='$stdio_ptr'
14818 stdio_stream_array='$stdio_stream_array'
14819 strings='$strings'
14820 submit='$submit'
14821 subversion='$subversion'
14822 sysman='$sysman'
14823 tail='$tail'
14824 tar='$tar'
14825 tbl='$tbl'
14826 tee='$tee'
14827 test='$test'
14828 timeincl='$timeincl'
14829 timetype='$timetype'
14830 touch='$touch'
14831 tr='$tr'
14832 trnl='$trnl'
14833 troff='$troff'
14834 u16size='$u16size'
14835 u16type='$u16type'
14836 u32size='$u32size'
14837 u32type='$u32type'
14838 u64size='$u64size'
14839 u64type='$u64type'
14840 u8size='$u8size'
14841 u8type='$u8type'
14842 uidformat='$uidformat'
14843 uidsign='$uidsign'
14844 uidsize='$uidsize'
14845 uidtype='$uidtype'
14846 uname='$uname'
14847 uniq='$uniq'
14848 uquadtype='$uquadtype'
14849 use64bits='$use64bits'
14850 usedl='$usedl'
14851 uselargefiles='$uselargefiles'
14852 uselongdouble='$uselongdouble'
14853 uselonglong='$uselonglong'
14854 usemorebits='$usemorebits'
14855 usemultiplicity='$usemultiplicity'
14856 usemymalloc='$usemymalloc'
14857 usenm='$usenm'
14858 useopcode='$useopcode'
14859 useperlio='$useperlio'
14860 useposix='$useposix'
14861 usesfio='$usesfio'
14862 useshrplib='$useshrplib'
14863 usesocks='$usesocks'
14864 usethreads='$usethreads'
14865 usevendorprefix='$usevendorprefix'
14866 usevfork='$usevfork'
14867 usrinc='$usrinc'
14868 uuname='$uuname'
14869 uvoformat='$uvoformat'
14870 uvsize='$uvsize'
14871 uvtype='$uvtype'
14872 uvuformat='$uvuformat'
14873 uvxformat='$uvxformat'
14874 vendorbin='$vendorbin'
14875 vendorbinexp='$vendorbinexp'
14876 vendorlib='$vendorlib'
14877 vendorlibexp='$vendorlibexp'
14878 vendorprefix='$vendorprefix'
14879 vendorprefixexp='$vendorprefixexp'
14880 version='$version'
14881 vi='$vi'
14882 voidflags='$voidflags'
14883 xlibpth='$xlibpth'
14884 xs_apiversion='$xs_apiversion'
14885 zcat='$zcat'
14886 zip='$zip'
14887 EOT
14888
14889 : Add in command line options if available
14890 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14891
14892 : add special variables
14893 $test -f $src/patchlevel.h && \
14894 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14895 echo "CONFIGDOTSH=true" >>config.sh
14896
14897 : propagate old symbols
14898 if $test -f UU/config.sh; then
14899         <UU/config.sh sort | uniq >UU/oldconfig.sh
14900         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14901         sort | uniq -u >UU/oldsyms
14902         set X `cat UU/oldsyms`
14903         shift
14904         case $# in
14905         0) ;;
14906         *)
14907                 cat <<EOM
14908 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14909 EOM
14910                 echo "# Variables propagated from previous config.sh file." >>config.sh
14911                 for sym in `cat UU/oldsyms`; do
14912                         echo "    Propagating $hint variable "'$'"$sym..."
14913                         eval 'tmp="$'"${sym}"'"'
14914                         echo "$tmp" | \
14915                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14916                 done
14917                 ;;
14918         esac
14919 fi
14920
14921 : Finish up by extracting the .SH files
14922 case "$alldone" in
14923 exit)
14924         $rm -rf UU
14925         echo "Done."
14926         exit 0
14927         ;;
14928 cont)
14929         ;;
14930 '')
14931         dflt=''
14932         nostick=true
14933         $cat <<EOM
14934
14935 If you'd like to make any changes to the config.sh file before I begin
14936 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14937
14938 EOM
14939         rp="Press return or use a shell escape to edit config.sh:"
14940         . UU/myread
14941         nostick=''
14942         case "$ans" in
14943         '') ;;
14944         *) : in case they cannot read
14945                 sh 1>&4 -c "$ans";;
14946         esac
14947         ;;
14948 esac
14949
14950 : if this fails, just run all the .SH files by hand
14951 . ./config.sh
14952
14953 echo " "
14954 exec 1>&4
14955 . ./UU/extract
14956
14957 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14958         dflt=y
14959         case "$silent" in
14960         true) ;;
14961         *)
14962                 $cat <<EOM
14963
14964 Now you need to generate make dependencies by running "$make depend".
14965 You might prefer to run it in background: "$make depend > makedepend.out &"
14966 It can take a while, so you might not want to run it right now.
14967
14968 EOM
14969                 ;;
14970         esac
14971         rp="Run $make depend now?"
14972         . UU/myread
14973         case "$ans" in
14974         y*)
14975                 $make depend && echo "Now you must run a $make."
14976                 ;;
14977         *)
14978                 echo "You must run '$make depend' then '$make'."
14979                 ;;
14980         esac
14981 elif test -f [Mm]akefile; then
14982         echo " "
14983         echo "Now you must run a $make."
14984 else
14985         echo "Done."
14986 fi
14987
14988 if $test -f Policy.sh; then
14989     $cat <<EOM
14990
14991 If you compile $package on a different machine or from a different object
14992 directory, copy the Policy.sh file from this object directory to the
14993 new one before you run Configure -- this will help you with most of
14994 the policy defaults.
14995
14996 EOM
14997 fi
14998 if $test -f config.msg; then
14999     echo "Hmm.  I also noted the following information while running:"
15000     echo " "
15001     $cat config.msg >&4
15002     $rm -f config.msg
15003 fi
15004 $rm -f kit*isdone ark*isdone
15005 $rm -rf UU
15006
15007 : End of Configure
15008