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