Harumph, also AIX will spill its guts (i.e. dump core)
[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 Fri Jun  8 02:03:31 EET DST 2001 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >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 >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 c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ 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 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 afsroot=''
277 alignbytes=''
278 ansi2knr=''
279 archlib=''
280 archlibexp=''
281 d_archlib=''
282 installarchlib=''
283 archname=''
284 myarchname=''
285 d_atolf=''
286 d_atoll=''
287 baserev=''
288 bin=''
289 binexp=''
290 installbin=''
291 bincompat5005=''
292 d_bincompat5005=''
293 byteorder=''
294 cc=''
295 ccflags=''
296 cppflags=''
297 ldflags=''
298 lkflags=''
299 locincpth=''
300 optimize=''
301 cf_email=''
302 cf_by=''
303 cf_time=''
304 charsize=''
305 contains=''
306 cpp_stuff=''
307 cpplast=''
308 cppminus=''
309 cpprun=''
310 cppstdin=''
311 crosscompile=''
312 d__fwalk=''
313 d_access=''
314 d_accessx=''
315 d_alarm=''
316 d_attribut=''
317 d_bcmp=''
318 d_bcopy=''
319 d_bzero=''
320 d_casti32=''
321 castflags=''
322 d_castneg=''
323 d_chown=''
324 d_chroot=''
325 d_chsize=''
326 d_closedir=''
327 d_void_closedir=''
328 d_cmsghdr_s=''
329 d_const=''
330 cryptlib=''
331 d_crypt=''
332 d_csh=''
333 full_csh=''
334 d_cuserid=''
335 d_dbl_dig=''
336 d_dbminitproto=''
337 d_difftime=''
338 d_dlerror=''
339 d_dlopen=''
340 d_dlsymun=''
341 d_dosuid=''
342 d_suidsafe=''
343 d_drand48proto=''
344 d_dup2=''
345 d_eaccess=''
346 d_endgrent=''
347 d_endhent=''
348 d_endnent=''
349 d_endpent=''
350 d_endpwent=''
351 d_endsent=''
352 d_fchmod=''
353 d_fchown=''
354 d_fcntl=''
355 d_fcntl_can_lock=''
356 d_fd_macros=''
357 d_fd_set=''
358 d_fds_bits=''
359 d_fgetpos=''
360 d_flexfnam=''
361 d_flock=''
362 d_flockproto=''
363 d_fork=''
364 d_fpos64_t=''
365 d_frexpl=''
366 d_fs_data_s=''
367 d_fseeko=''
368 d_fsetpos=''
369 d_fstatfs=''
370 d_fsync=''
371 d_ftello=''
372 d_ftime=''
373 d_gettimeod=''
374 d_Gconvert=''
375 d_getcwd=''
376 d_getespwnam=''
377 d_getfsstat=''
378 d_getgrent=''
379 d_getgrps=''
380 d_gethbyaddr=''
381 d_gethbyname=''
382 d_gethent=''
383 aphostname=''
384 d_gethname=''
385 d_phostname=''
386 d_uname=''
387 d_gethostprotos=''
388 d_getitimer=''
389 d_getlogin=''
390 d_getmnt=''
391 d_getmntent=''
392 d_getnbyaddr=''
393 d_getnbyname=''
394 d_getnent=''
395 d_getnetprotos=''
396 d_getpagsz=''
397 d_getpent=''
398 d_getpgid=''
399 d_getpgrp2=''
400 d_bsdgetpgrp=''
401 d_getpgrp=''
402 d_getppid=''
403 d_getprior=''
404 d_getpbyname=''
405 d_getpbynumber=''
406 d_getprotoprotos=''
407 d_getprpwnam=''
408 d_getpwent=''
409 d_getsent=''
410 d_getservprotos=''
411 d_getspnam=''
412 d_getsbyname=''
413 d_getsbyport=''
414 d_gnulibc=''
415 d_hasmntopt=''
416 d_htonl=''
417 d_iconv=''
418 d_inetaton=''
419 d_int64_t=''
420 d_isascii=''
421 d_isnan=''
422 d_isnanl=''
423 d_killpg=''
424 d_lchown=''
425 d_ldbl_dig=''
426 d_link=''
427 d_locconv=''
428 d_lockf=''
429 d_longdbl=''
430 longdblsize=''
431 d_longlong=''
432 longlongsize=''
433 d_lseekproto=''
434 d_lstat=''
435 d_madvise=''
436 d_mblen=''
437 d_mbstowcs=''
438 d_mbtowc=''
439 d_memchr=''
440 d_memcmp=''
441 d_memcpy=''
442 d_memmove=''
443 d_memset=''
444 d_mkdir=''
445 d_mkdtemp=''
446 d_mkfifo=''
447 d_mkstemp=''
448 d_mkstemps=''
449 d_mktime=''
450 d_mmap=''
451 mmaptype=''
452 d_modfl=''
453 d_mprotect=''
454 d_msg=''
455 d_msgctl=''
456 d_msgget=''
457 d_msghdr_s=''
458 d_msgrcv=''
459 d_msgsnd=''
460 d_msync=''
461 d_munmap=''
462 d_nice=''
463 d_off64_t=''
464 d_open3=''
465 d_fpathconf=''
466 d_pathconf=''
467 d_pause=''
468 d_pipe=''
469 d_poll=''
470 d_portable=''
471 d_old_pthread_create_joinable=''
472 old_pthread_create_joinable=''
473 d_pthread_yield=''
474 d_sched_yield=''
475 sched_yield=''
476 d_qgcvt=''
477 d_readdir=''
478 d_rewinddir=''
479 d_seekdir=''
480 d_telldir=''
481 d_readlink=''
482 d_readv=''
483 d_realpath=''
484 d_recvmsg=''
485 d_rename=''
486 d_rmdir=''
487 d_safebcpy=''
488 d_safemcpy=''
489 d_sanemcmp=''
490 d_sbrkproto=''
491 d_select=''
492 d_sem=''
493 d_semctl=''
494 d_semget=''
495 d_semop=''
496 d_sendmsg=''
497 d_setegid=''
498 d_seteuid=''
499 d_setgrent=''
500 d_setgrps=''
501 d_sethent=''
502 d_setitimer=''
503 d_setlinebuf=''
504 d_setlocale=''
505 d_setnent=''
506 d_setpent=''
507 d_setpgid=''
508 d_setpgrp2=''
509 d_bsdsetpgrp=''
510 d_setpgrp=''
511 d_setprior=''
512 d_setproctitle=''
513 d_setpwent=''
514 d_setregid=''
515 d_setresgid=''
516 d_setresuid=''
517 d_setreuid=''
518 d_setrgid=''
519 d_setruid=''
520 d_setsent=''
521 d_setsid=''
522 d_setvbuf=''
523 d_sfio=''
524 usesfio=''
525 d_shm=''
526 d_shmat=''
527 d_shmatprototype=''
528 shmattype=''
529 d_shmctl=''
530 d_shmdt=''
531 d_shmget=''
532 d_sigaction=''
533 d_sigprocmask=''
534 d_sigsetjmp=''
535 d_sockatmark=''
536 d_sockatmarkproto=''
537 d_msg_ctrunc=''
538 d_msg_dontroute=''
539 d_msg_oob=''
540 d_msg_peek=''
541 d_msg_proxy=''
542 d_oldsock=''
543 d_scm_rights=''
544 d_socket=''
545 d_sockpair=''
546 sockethdr=''
547 socketlib=''
548 d_socklen_t=''
549 d_socks5_init=''
550 d_sqrtl=''
551 d_sresgproto=''
552 d_sresuproto=''
553 d_statblks=''
554 d_statfs_f_flags=''
555 d_statfs_s=''
556 d_fstatvfs=''
557 d_statvfs=''
558 d_stdio_cnt_lval=''
559 d_stdio_ptr_lval=''
560 d_stdio_ptr_lval_nochange_cnt=''
561 d_stdio_ptr_lval_sets_cnt=''
562 d_stdiobase=''
563 d_stdstdio=''
564 stdio_base=''
565 stdio_bufsiz=''
566 stdio_cnt=''
567 stdio_filbuf=''
568 stdio_ptr=''
569 d_index=''
570 d_strchr=''
571 d_strcoll=''
572 d_strctcpy=''
573 d_strerrm=''
574 d_strerror=''
575 d_sysernlst=''
576 d_syserrlst=''
577 d_strftime=''
578 d_strtod=''
579 d_strtol=''
580 d_strtold=''
581 d_strtoll=''
582 d_strtoq=''
583 d_strtoul=''
584 d_strtoull=''
585 d_strtouq=''
586 d_strxfrm=''
587 d_symlink=''
588 d_syscall=''
589 d_syscallproto=''
590 d_sysconf=''
591 d_system=''
592 d_tcgetpgrp=''
593 d_tcsetpgrp=''
594 d_telldirproto=''
595 d_time=''
596 timetype=''
597 clocktype=''
598 d_times=''
599 d_truncate=''
600 d_tzname=''
601 d_u32align=''
602 d_ualarm=''
603 d_umask=''
604 d_semctl_semid_ds=''
605 d_semctl_semun=''
606 d_union_semun=''
607 d_usleep=''
608 d_usleepproto=''
609 d_ustat=''
610 d_vfork=''
611 usevfork=''
612 d_voidsig=''
613 signal_t=''
614 d_volatile=''
615 d_charvspr=''
616 d_vprintf=''
617 d_wait4=''
618 d_waitpid=''
619 d_wcstombs=''
620 d_wctomb=''
621 d_writev=''
622 dlext=''
623 cccdlflags=''
624 ccdlflags=''
625 dlsrc=''
626 ld=''
627 lddlflags=''
628 usedl=''
629 doublesize=''
630 ebcdic=''
631 fflushNULL=''
632 fflushall=''
633 fpossize=''
634 fpostype=''
635 gccosandvers=''
636 gccversion=''
637 gidformat=''
638 gidsign=''
639 gidsize=''
640 gidtype=''
641 groupstype=''
642 h_fcntl=''
643 h_sysfile=''
644 i_arpainet=''
645 db_hashtype=''
646 db_prefixtype=''
647 db_version_major=''
648 db_version_minor=''
649 db_version_patch=''
650 i_db=''
651 i_dbm=''
652 i_rpcsvcdbm=''
653 d_dirnamlen=''
654 direntrytype=''
655 i_dirent=''
656 i_dld=''
657 i_dlfcn=''
658 i_fcntl=''
659 i_float=''
660 i_gdbm=''
661 d_grpasswd=''
662 i_grp=''
663 i_iconv=''
664 i_ieeefp=''
665 i_inttypes=''
666 i_libutil=''
667 i_limits=''
668 i_locale=''
669 i_machcthr=''
670 i_malloc=''
671 i_math=''
672 i_memory=''
673 i_mntent=''
674 i_ndbm=''
675 i_netdb=''
676 i_neterrno=''
677 i_netinettcp=''
678 i_niin=''
679 i_sysin=''
680 i_poll=''
681 i_prot=''
682 i_pthread=''
683 d_pwage=''
684 d_pwchange=''
685 d_pwclass=''
686 d_pwcomment=''
687 d_pwexpire=''
688 d_pwgecos=''
689 d_pwpasswd=''
690 d_pwquota=''
691 i_pwd=''
692 i_sfio=''
693 i_shadow=''
694 i_socks=''
695 i_stddef=''
696 i_stdlib=''
697 i_string=''
698 strings=''
699 i_sunmath=''
700 i_sysaccess=''
701 i_sysdir=''
702 i_sysfile=''
703 d_voidtty=''
704 i_bsdioctl=''
705 i_sysfilio=''
706 i_sysioctl=''
707 i_syssockio=''
708 i_syslog=''
709 i_sysmman=''
710 i_sysmode=''
711 i_sysmount=''
712 i_sysndir=''
713 i_sysparam=''
714 i_sysresrc=''
715 i_syssecrt=''
716 i_sysselct=''
717 i_sysstat=''
718 i_sysstatfs=''
719 i_sysstatvfs=''
720 i_systimes=''
721 i_systypes=''
722 i_sysuio=''
723 i_sysun=''
724 i_sysutsname=''
725 i_sysvfs=''
726 i_syswait=''
727 i_sgtty=''
728 i_termio=''
729 i_termios=''
730 i_systime=''
731 i_systimek=''
732 i_time=''
733 timeincl=''
734 i_unistd=''
735 i_ustat=''
736 i_utime=''
737 i_values=''
738 i_stdarg=''
739 i_varargs=''
740 i_varhdr=''
741 i_vfork=''
742 inc_version_list=''
743 inc_version_list_init=''
744 installprefix=''
745 installprefixexp=''
746 installstyle=''
747 installusrbinperl=''
748 intsize=''
749 longsize=''
750 shortsize=''
751 issymlink=''
752 libc=''
753 ldlibpthname=''
754 libperl=''
755 shrpenv=''
756 useshrplib=''
757 glibpth=''
758 libpth=''
759 loclibpth=''
760 plibpth=''
761 xlibpth=''
762 ignore_versioned_solibs=''
763 libs=''
764 libsdirs=''
765 libsfiles=''
766 libsfound=''
767 libspath=''
768 lns=''
769 d_PRIEUldbl=''
770 d_PRIFUldbl=''
771 d_PRIGUldbl=''
772 d_PRIeldbl=''
773 d_PRIfldbl=''
774 d_PRIgldbl=''
775 d_SCNfldbl=''
776 sPRIEUldbl=''
777 sPRIFUldbl=''
778 sPRIGUldbl=''
779 sPRIeldbl=''
780 sPRIfldbl=''
781 sPRIgldbl=''
782 sSCNfldbl=''
783 lseeksize=''
784 lseektype=''
785 make_set_make=''
786 d_mymalloc=''
787 freetype=''
788 mallocobj=''
789 mallocsrc=''
790 malloctype=''
791 usemymalloc=''
792 installman1dir=''
793 man1dir=''
794 man1direxp=''
795 man1ext=''
796 installman3dir=''
797 man3dir=''
798 man3direxp=''
799 man3ext=''
800 modetype=''
801 multiarch=''
802 mydomain=''
803 myhostname=''
804 phostname=''
805 c=''
806 n=''
807 d_eofnblk=''
808 eagain=''
809 o_nonblock=''
810 rd_nodata=''
811 need_va_copy=''
812 netdb_hlen_type=''
813 netdb_host_type=''
814 netdb_name_type=''
815 netdb_net_type=''
816 groupcat=''
817 hostcat=''
818 passcat=''
819 orderlib=''
820 ranlib=''
821 d_perl_otherlibdirs=''
822 otherlibdirs=''
823 package=''
824 spackage=''
825 pager=''
826 api_revision=''
827 api_subversion=''
828 api_version=''
829 api_versionstring=''
830 patchlevel=''
831 perl_patchlevel=''
832 revision=''
833 subversion=''
834 version=''
835 perl5=''
836 perladmin=''
837 perlpath=''
838 d_nv_preserves_uv=''
839 d_nv_preserves_uv_bits=''
840 i16size=''
841 i16type=''
842 i32size=''
843 i32type=''
844 i64size=''
845 i64type=''
846 i8size=''
847 i8type=''
848 ivsize=''
849 ivtype=''
850 nvsize=''
851 nvtype=''
852 u16size=''
853 u16type=''
854 u32size=''
855 u32type=''
856 u64size=''
857 u64type=''
858 u8size=''
859 u8type=''
860 uvsize=''
861 uvtype=''
862 ivdformat=''
863 nvEUformat=''
864 nvFUformat=''
865 nvGUformat=''
866 nveformat=''
867 nvfformat=''
868 nvgformat=''
869 uvXUformat=''
870 uvoformat=''
871 uvuformat=''
872 uvxformat=''
873 pidtype=''
874 prefix=''
875 prefixexp=''
876 installprivlib=''
877 privlib=''
878 privlibexp=''
879 prototype=''
880 ptrsize=''
881 d_PRIXU64=''
882 d_PRId64=''
883 d_PRIi64=''
884 d_PRIo64=''
885 d_PRIu64=''
886 d_PRIx64=''
887 sPRIXU64=''
888 sPRId64=''
889 sPRIi64=''
890 sPRIo64=''
891 sPRIu64=''
892 sPRIx64=''
893 d_quad=''
894 quadkind=''
895 quadtype=''
896 uquadtype=''
897 drand01=''
898 randbits=''
899 randfunc=''
900 randseedtype=''
901 seedfunc=''
902 installscript=''
903 scriptdir=''
904 scriptdirexp=''
905 selectminbits=''
906 selecttype=''
907 sh=''
908 sig_count=''
909 sig_name=''
910 sig_name_init=''
911 sig_num=''
912 sig_num_init=''
913 sig_size=''
914 installsitearch=''
915 sitearch=''
916 sitearchexp=''
917 installsitebin=''
918 sitebin=''
919 sitebinexp=''
920 installsitelib=''
921 sitelib=''
922 sitelib_stem=''
923 sitelibexp=''
924 siteprefix=''
925 siteprefixexp=''
926 sizesize=''
927 sizetype=''
928 so=''
929 socksizetype=''
930 sharpbang=''
931 shsharp=''
932 spitshell=''
933 src=''
934 ssizetype=''
935 startperl=''
936 startsh=''
937 stdchar=''
938 d_stdio_stream_array=''
939 stdio_stream_array=''
940 sysman=''
941 trnl=''
942 uidformat=''
943 uidsign=''
944 uidsize=''
945 uidtype=''
946 archname64=''
947 use64bitall=''
948 use64bitint=''
949 ccflags_uselargefiles=''
950 ldflags_uselargefiles=''
951 libswanted_uselargefiles=''
952 uselargefiles=''
953 uselongdouble=''
954 usemorebits=''
955 usemultiplicity=''
956 nm_opt=''
957 nm_so_opt=''
958 runnm=''
959 usenm=''
960 useperlio=''
961 usesocks=''
962 d_oldpthreads=''
963 use5005threads=''
964 useithreads=''
965 usethreads=''
966 incpath=''
967 mips_type=''
968 usrinc=''
969 d_vendorarch=''
970 installvendorarch=''
971 vendorarch=''
972 vendorarchexp=''
973 d_vendorbin=''
974 installvendorbin=''
975 vendorbin=''
976 vendorbinexp=''
977 d_vendorlib=''
978 installvendorlib=''
979 vendorlib=''
980 vendorlib_stem=''
981 vendorlibexp=''
982 usevendorprefix=''
983 vendorprefix=''
984 vendorprefixexp=''
985 versiononly=''
986 defvoidused=''
987 voidflags=''
988 pm_apiversion=''
989 xs_apiversion=''
990 yacc=''
991 yaccflags=''
992 CONFIG=''
993
994 define='define'
995 undef='undef'
996 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
997 rmlist=''
998
999 : We must find out about Eunice early
1000 eunicefix=':'
1001 if test -f /etc/unixtovms; then
1002         eunicefix=/etc/unixtovms
1003 fi
1004 if test -f /etc/unixtovms.exe; then
1005         eunicefix=/etc/unixtovms.exe
1006 fi
1007
1008 i_whoami=''
1009 ccname=''
1010 ccversion=''
1011 perllibs=''
1012 : set useposix=false in your hint file to disable the POSIX extension.
1013 useposix=true
1014 : set useopcode=false in your hint file to disable the Opcode extension.
1015 useopcode=true
1016 : Trailing extension.  Override this in a hint file, if needed.
1017 _exe=''
1018 : Extra object files, if any, needed on this platform.
1019 archobjs=''
1020 archname=''
1021 : Possible local include directories to search.
1022 : Set locincpth to "" in a hint file to defeat local include searches.
1023 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1024 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1025 :
1026 : no include file wanted by default
1027 inclwanted=''
1028
1029 groupstype=''
1030 : change the next line if compiling for Xenix/286 on Xenix/386
1031 xlibpth='/usr/lib/386 /lib/386'
1032 : Possible local library directories to search.
1033 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1034 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1035
1036 : general looking path for locating libraries
1037 glibpth="/lib /usr/lib $xlibpth"
1038 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1039 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1040 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1041
1042 : Private path used by Configure to find libraries.  Its value
1043 : is prepended to libpth. This variable takes care of special
1044 : machines, like the mips.  Usually, it should be empty.
1045 plibpth=''
1046
1047 : default library list
1048 libswanted=''
1049 : some systems want to use only the non-versioned libso:s
1050 ignore_versioned_solibs=''
1051 archname64=''
1052 ccflags_uselargefiles=''
1053 ldflags_uselargefiles=''
1054 libswanted_uselargefiles=''
1055 : set usemultiplicity on the Configure command line to enable multiplicity.
1056 : set usesocks on the Configure command line to enable socks.
1057 : set usethreads on the Configure command line to enable threads.
1058 : full support for void wanted by default
1059 defvoidused=15
1060
1061 : List of libraries we want.
1062 : If anyone needs -lnet, put it in a hint file.
1063 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1064 libswanted="$libswanted dld ld sun m c cposix posix"
1065 libswanted="$libswanted ndir dir crypt sec"
1066 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1067 : We probably want to search /usr/shlib before most other libraries.
1068 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1069 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1070 glibpth="/usr/shlib $glibpth"
1071 : Do not use vfork unless overridden by a hint file.
1072 usevfork=false
1073
1074 : Find the basic shell for Bourne shell scripts
1075 case "$sh" in
1076 '')
1077         case "$SYSTYPE" in
1078         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1079         *) xxx='/bin/sh';;
1080         esac
1081         if test -f "$xxx"; then
1082                 sh="$xxx"
1083         else
1084                 : Build up a list and do a single loop so we can 'break' out.
1085                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1086                 for xxx in sh bash ksh pdksh ash; do
1087                         for p in $pth; do
1088                                 try="$try ${p}/${xxx}"
1089                         done
1090                 done
1091                 for xxx in $try; do
1092                         if test -f "$xxx"; then
1093                                 sh="$xxx";
1094                                 break
1095                         elif test -f "$xxx.exe"; then
1096                                 sh="$xxx";
1097                                 break
1098                         fi
1099                 done
1100         fi
1101         ;;
1102 esac
1103
1104 case "$sh" in
1105 '')     cat <<EOM >&2
1106 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1107
1108 Usually it's in /bin/sh.  How did you even get this far?
1109 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1110 we'll try to straighten this all out.
1111 EOM
1112         exit 1
1113         ;;
1114 esac
1115
1116 : see if sh knows # comments
1117 if `$sh -c '#' >/dev/null 2>&1`; then
1118         shsharp=true
1119         spitshell=cat
1120         xcat=/bin/cat
1121         test -f $xcat || xcat=/usr/bin/cat
1122         echo "#!$xcat" >try
1123         $eunicefix try
1124         chmod +x try
1125         ./try > today
1126         if test -s today; then
1127                 sharpbang='#!'
1128         else
1129                 echo "#! $xcat" > try
1130                 $eunicefix try
1131                 chmod +x try
1132                 ./try > today
1133                 if test -s today; then
1134                         sharpbang='#! '
1135                 else
1136                         sharpbang=': use '
1137                 fi
1138         fi
1139 else
1140         echo " "
1141         echo "Your $sh doesn't grok # comments--I will strip them later on."
1142         shsharp=false
1143         cd ..
1144         echo "exec grep -v '^[  ]*#'" >spitshell
1145         chmod +x spitshell
1146         $eunicefix spitshell
1147         spitshell=`pwd`/spitshell
1148         cd UU
1149         echo "I presume that if # doesn't work, #! won't work either!"
1150         sharpbang=': use '
1151 fi
1152 rm -f try today
1153
1154 : figure out how to guarantee sh startup
1155 case "$startsh" in
1156 '') startsh=${sharpbang}${sh} ;;
1157 *)
1158 esac
1159 cat >try <<EOSS
1160 $startsh
1161 set abc
1162 test "$?abc" != 1
1163 EOSS
1164
1165 chmod +x try
1166 $eunicefix try
1167 if ./try; then
1168         : echo "Yup, it does."
1169 else
1170         echo "Hmm... '$startsh' does not guarantee sh startup..."
1171         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1172 fi
1173 rm -f try
1174
1175
1176 : Save command line options in file UU/cmdline.opt for later use in
1177 : generating config.sh.
1178 cat > cmdline.opt <<EOSH
1179 # Configure command line arguments.
1180 config_arg0='$0'
1181 config_args='$*'
1182 config_argc=$#
1183 EOSH
1184 argn=1
1185 for arg in "$@"; do
1186         cat >>cmdline.opt <<EOSH
1187 config_arg$argn='$arg'
1188 EOSH
1189         argn=`expr $argn + 1`
1190 done
1191
1192 : produce awk script to parse command line options
1193 cat >options.awk <<'EOF'
1194 BEGIN {
1195         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1196
1197         len = length(optstr);
1198         for (i = 1; i <= len; i++) {
1199                 c = substr(optstr, i, 1);
1200                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1201                 if (a == ":") {
1202                         arg[c] = 1;
1203                         i++;
1204                 }
1205                 opt[c] = 1;
1206         }
1207 }
1208 {
1209         expect = 0;
1210         str = $0;
1211         if (substr(str, 1, 1) != "-") {
1212                 printf("'%s'\n", str);
1213                 next;
1214         }
1215         len = length($0);
1216         for (i = 2; i <= len; i++) {
1217                 c = substr(str, i, 1);
1218                 if (!opt[c]) {
1219                         printf("-%s\n", substr(str, i));
1220                         next;
1221                 }
1222                 printf("-%s\n", c);
1223                 if (arg[c]) {
1224                         if (i < len)
1225                                 printf("'%s'\n", substr(str, i + 1));
1226                         else
1227                                 expect = 1;
1228                         next;
1229                 }
1230         }
1231 }
1232 END {
1233         if (expect)
1234                 print "?";
1235 }
1236 EOF
1237
1238 : process the command line options
1239 set X `for arg in "$@"; do echo "X$arg"; done |
1240         sed -e s/X// | awk -f options.awk`
1241 eval "set $*"
1242 shift
1243 rm -f options.awk
1244
1245 : set up default values
1246 fastread=''
1247 reuseval=false
1248 config_sh=''
1249 alldone=''
1250 error=''
1251 silent=''
1252 extractsh=''
1253 override=''
1254 knowitall=''
1255 rm -f optdef.sh posthint.sh
1256 cat >optdef.sh <<EOS
1257 $startsh
1258 EOS
1259
1260
1261 : option parsing
1262 while test $# -gt 0; do
1263         case "$1" in
1264         -d) shift; fastread=yes;;
1265         -e) shift; alldone=cont;;
1266         -f)
1267                 shift
1268                 cd ..
1269                 if test -r "$1"; then
1270                         config_sh="$1"
1271                 else
1272                         echo "$me: cannot read config file $1." >&2
1273                         error=true
1274                 fi
1275                 cd UU
1276                 shift;;
1277         -h) shift; error=true;;
1278         -r) shift; reuseval=true;;
1279         -s) shift; silent=true; realsilent=true;;
1280         -E) shift; alldone=exit;;
1281         -K) shift; knowitall=true;;
1282         -O) shift; override=true;;
1283         -S) shift; silent=true; extractsh=true;;
1284         -D)
1285                 shift
1286                 case "$1" in
1287                 *=)
1288                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1289                         echo "$me: ignoring -D $1" >&2
1290                         ;;
1291                 *=*) echo "$1" | \
1292                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1293                 *) echo "$1='define'" >> optdef.sh;;
1294                 esac
1295                 shift
1296                 ;;
1297         -U)
1298                 shift
1299                 case "$1" in
1300                 *=) echo "$1" >> optdef.sh;;
1301                 *=*)
1302                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1303                         echo "$me: ignoring -U $1" >&2
1304                         ;;
1305                 *) echo "$1='undef'" >> optdef.sh;;
1306                 esac
1307                 shift
1308                 ;;
1309         -A)
1310             shift
1311             xxx=''
1312             yyy="$1"
1313             zzz=''
1314             uuu=undef
1315             case "$yyy" in
1316             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1317                  case "$zzz" in
1318                  *:*) zzz='' ;;
1319                  *)   xxx=append
1320                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1321                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1322                  esac
1323                  ;;
1324             esac
1325             case "$xxx" in
1326             '')  case "$yyy" in
1327                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1328                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1329                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1330                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1331                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1332                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1333                  esac
1334                  ;;       
1335             esac
1336             case "$xxx" in
1337             append)
1338                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1339             clear)
1340                 echo "$yyy=''"                  >> posthint.sh ;;
1341             define)
1342                 case "$zzz" in
1343                 '') zzz=define ;;
1344                 esac
1345                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1346             eval)
1347                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1348             prepend)
1349                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1350             undef)
1351                 case "$zzz" in
1352                 '') zzz="$uuu" ;;
1353                 esac
1354                 echo "$yyy=$zzz"                >> posthint.sh ;;
1355             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1356             esac
1357             shift
1358             ;;
1359         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1360             exit 0;;
1361         --) break;;
1362         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1363         *) break;;
1364         esac
1365 done
1366
1367 case "$error" in
1368 true)
1369         cat >&2 <<EOM
1370 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1371                  [-U symbol] [-U symbol=] [-A command:symbol...]
1372   -d : use defaults for all answers.
1373   -e : go on without questioning past the production of config.sh.
1374   -f : specify an alternate default configuration file.
1375   -h : print this help message and exit (with an error status).
1376   -r : reuse C symbols value if possible (skips costly nm extraction).
1377   -s : silent mode, only echoes questions and essential information.
1378   -D : define symbol to have some value:
1379          -D symbol         symbol gets the value 'define'
1380          -D symbol=value   symbol gets the value 'value'
1381   -E : stop at the end of questions, after having produced config.sh.
1382   -K : do not use unless you know what you are doing.
1383   -O : let -D and -U override definitions from loaded configuration file.
1384   -S : perform variable substitutions on all .SH files (can mix with -f)
1385   -U : undefine symbol:
1386          -U symbol    symbol gets the value 'undef'
1387          -U symbol=   symbol gets completely empty
1388   -A : manipulate symbol after the platform specific hints have been applied:
1389          -A symbol=value                append " "value to symbol
1390          -A append:symbol=value         append value to symbol
1391          -A define:symbol=value         define symbol to have value
1392          -A clear:symbol                define symbol to be ''
1393          -A define:symbol               define symbol to be 'define'
1394          -A eval:symbol=value           define symbol to be eval of value
1395          -A prepend:symbol=value        prepend value to symbol
1396          -A undef:symbol                define symbol to be 'undef'
1397          -A undef:symbol=               define symbol to be ''
1398   -V : print version number and exit (with a zero status).
1399 EOM
1400         exit 1
1401         ;;
1402 esac
1403
1404 : Sanity checks
1405 case "$fastread$alldone" in
1406 yescont|yesexit) ;;
1407 *)
1408         case "$extractsh" in
1409         true) ;;
1410         *)
1411                 if test ! -t 0; then
1412                         echo "Say 'sh Configure', not 'sh <Configure'"
1413                         exit 1
1414                 fi
1415                 ;;
1416         esac
1417         ;;
1418 esac
1419
1420 exec 4>&1
1421 case "$silent" in
1422 true) exec 1>/dev/null;;
1423 esac
1424
1425 : run the defines and the undefines, if any, but leave the file out there...
1426 touch optdef.sh
1427 . ./optdef.sh
1428 : create the posthint manipulation script and leave the file out there...
1429 touch posthint.sh
1430
1431 : set package name
1432 package=perl5
1433 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1434 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1435 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1436 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1437 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1438 esac
1439
1440 : Some greps do not return status, grrr.
1441 echo "grimblepritz" >grimble
1442 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1443         contains=contains
1444 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1445         contains=grep
1446 else
1447         contains=contains
1448 fi
1449 rm -f grimble
1450 : the following should work in any shell
1451 case "$contains" in
1452 contains*)
1453         echo " "
1454         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1455         cat >contains <<'EOSS'
1456 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1457 EOSS
1458 chmod +x contains
1459 esac
1460
1461 : Find the path to the source tree
1462 case "$src" in
1463 '') case "$0" in
1464     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1465          case "$src" in
1466          /*)    ;;
1467          .)     ;;
1468          *)     src=`cd ../$src && pwd` ;;
1469          esac
1470          ;;
1471     *)   src='.';;
1472     esac;;
1473 esac
1474 case "$src" in
1475 '')     src=/
1476         rsrc=/
1477         ;;
1478 /*) rsrc="$src";;
1479 *) rsrc="../$src";;
1480 esac
1481 if test -f $rsrc/Configure && \
1482         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1483 then
1484    : found it, so we are ok.
1485 else
1486         rsrc=''
1487         for src in . .. ../.. ../../.. ../../../..; do
1488                 if test -f ../$src/Configure && \
1489                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1490                 then
1491                         rsrc=../$src
1492                         break
1493                 fi
1494         done
1495 fi
1496 case "$rsrc" in
1497 '')
1498         cat <<EOM >&4
1499
1500 Sorry, I can't seem to locate the source dir for $package.  Please start
1501 Configure with an explicit path -- i.e. /some/path/Configure.
1502
1503 EOM
1504         exit 1
1505         ;;
1506 ../.)   rsrc='..';;
1507 *)
1508         echo " "
1509         echo "Sources for $package found in \"$src\"." >&4
1510         ;;
1511 esac
1512
1513 : script used to extract .SH files with variable substitutions
1514 cat >extract <<'EOS'
1515 PERL_CONFIG_SH=true
1516 echo "Doing variable substitutions on .SH files..."
1517 if test -f MANIFEST; then
1518         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1519 else
1520         echo "(Looking for .SH files under the source directory.)"
1521         set x `(cd $src; find . -name "*.SH" -print)`
1522 fi
1523 shift
1524 case $# in
1525 0) set x `(cd $src; echo *.SH)`; shift;;
1526 esac
1527 if test ! -f $src/$1; then
1528         shift
1529 fi
1530 mkdir_p='
1531 name=$1;
1532 create="";
1533 while test $name; do
1534         if test ! -d "$name"; then
1535                 create="$name $create";
1536                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1537                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1538         else
1539                 name="";
1540         fi;
1541 done;
1542 for file in $create; do
1543         mkdir $file;
1544 done
1545 '
1546 for file in $*; do
1547         case "$src" in
1548         ".")
1549                 case "$file" in
1550                 */*)
1551                         dir=`expr X$file : 'X\(.*\)/'`
1552                         file=`expr X$file : 'X.*/\(.*\)'`
1553                         (cd $dir && . ./$file)
1554                         ;;
1555                 *)
1556                         . ./$file
1557                         ;;
1558                 esac
1559                 ;;
1560         *)
1561                 case "$file" in
1562                 */*)
1563                         dir=`expr X$file : 'X\(.*\)/'`
1564                         file=`expr X$file : 'X.*/\(.*\)'`
1565                         (set x $dir; shift; eval $mkdir_p)
1566                         sh <$src/$dir/$file
1567                         ;;
1568                 *)
1569                         sh <$src/$file
1570                         ;;
1571                 esac
1572                 ;;
1573         esac
1574 done
1575 if test -f $src/config_h.SH; then
1576         if test ! -f config.h; then
1577         : oops, they left it out of MANIFEST, probably, so do it anyway.
1578         . $src/config_h.SH
1579         fi
1580 fi
1581 EOS
1582
1583 : extract files and exit if asked to do so
1584 case "$extractsh" in
1585 true)
1586         case "$realsilent" in
1587         true) ;;
1588         *) exec 1>&4;;
1589         esac
1590         case "$config_sh" in
1591         '') config_sh='config.sh';;
1592         esac
1593         echo " "
1594         echo "Fetching answers from $config_sh..."
1595         cd ..
1596         . $config_sh
1597         test "$override" && . ./optdef.sh
1598         echo " "
1599         . UU/extract
1600         rm -rf UU
1601         echo "Extraction done."
1602         exit 0
1603         ;;
1604 esac
1605
1606 : Eunice requires " " instead of "", can you believe it
1607 echo " "
1608 : Here we go...
1609 echo "Beginning of configuration questions for $package."
1610
1611 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1612
1613 : first determine how to suppress newline on echo command
1614 echo " "
1615 echo "Checking echo to see how to suppress newlines..."
1616 (echo "hi there\c" ; echo " ") >.echotmp
1617 if $contains c .echotmp >/dev/null 2>&1 ; then
1618         echo "...using -n."
1619         n='-n'
1620         c=''
1621 else
1622         cat <<'EOM'
1623 ...using \c
1624 EOM
1625         n=''
1626         c='\c'
1627 fi
1628 echo $n "The star should be here-->$c"
1629 echo '*'
1630 rm -f .echotmp
1631
1632 : Now test for existence of everything in MANIFEST
1633 echo " "
1634 if test -f $rsrc/MANIFEST; then
1635         echo "First let's make sure your kit is complete.  Checking..." >&4
1636         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1637         rm -f missing
1638         tmppwd=`pwd`
1639         for filelist in x??; do
1640                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1641         done
1642         if test -s missing; then
1643                 cat missing >&4
1644                 cat >&4 <<'EOM'
1645
1646 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1647
1648 You have the option of continuing the configuration process, despite the
1649 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1650 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1651 and contact the author (perlbug@perl.org).
1652
1653 EOM
1654                 echo $n "Continue? [n] $c" >&4
1655                 read ans
1656                 case "$ans" in
1657                 y*)
1658                         echo "Continuing..." >&4
1659                         rm -f missing
1660                         ;;
1661                 *)
1662                         echo "ABORTING..." >&4
1663                         kill $$
1664                         ;;
1665                 esac
1666         else
1667                 echo "Looks good..."
1668         fi
1669 else
1670         echo "There is no MANIFEST file.  I hope your kit is complete !"
1671 fi
1672 rm -f missing x??
1673
1674 echo " "
1675 : Find the appropriate value for a newline for tr
1676 if test -n "$DJGPP"; then
1677        trnl='\012'
1678 fi
1679 if test X"$trnl" = X; then
1680         case "`echo foo|tr '\n' x 2>/dev/null`" in
1681         foox) trnl='\n' ;;
1682         esac
1683 fi
1684 if test X"$trnl" = X; then
1685         case "`echo foo|tr '\012' x 2>/dev/null`" in
1686         foox) trnl='\012' ;;
1687         esac
1688 fi
1689 if test X"$trnl" = X; then
1690         cat <<EOM >&2
1691
1692 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1693
1694 EOM
1695         exit 1
1696 fi
1697
1698 : compute the number of columns on the terminal for proper question formatting
1699 case "$COLUMNS" in
1700 '') COLUMNS='80';;
1701 esac
1702
1703 : set up the echo used in my read
1704 myecho="case \"\$xxxm\" in
1705 '') echo $n \"\$rp $c\" >&4;;
1706 *) case \"\$rp\" in
1707         '') echo $n \"[\$xxxm] $c\";;
1708         *)
1709                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1710                         echo \"\$rp\" >&4
1711                         echo $n \"[\$xxxm] $c\" >&4
1712                 else
1713                         echo $n \"\$rp [\$xxxm] $c\" >&4
1714                 fi
1715                 ;;
1716         esac;;
1717 esac"
1718
1719 : now set up to do reads with possible shell escape and default assignment
1720 cat <<EOSC >myread
1721 $startsh
1722 xxxm=\$dflt
1723 $myecho
1724 ans='!'
1725 case "\$fastread" in
1726 yes) case "\$dflt" in
1727         '') ;;
1728         *) ans='';
1729                 case "\$silent-\$rp" in
1730                 true-) ;;
1731                 *) echo " " >&4;;
1732                 esac;;
1733         esac;;
1734 *) case "\$silent" in
1735         true) case "\$rp" in
1736                 '') ans='';;
1737                 esac;;
1738         esac;;
1739 esac
1740 while expr "X\$ans" : "X!" >/dev/null; do
1741         read answ
1742         set x \$xxxm
1743         shift
1744         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1745         case  "\$answ" in
1746         "!")
1747                 sh 1>&4
1748                 echo " "
1749                 $myecho
1750                 ;;
1751         !*)
1752                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1753                 shift
1754                 sh 1>&4 -c "\$*"
1755                 echo " "
1756                 $myecho
1757                 ;;
1758         "\$ans")
1759                 case "\$ans" in
1760                 \\&*)
1761                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1762                         shift
1763                         case "\$1" in
1764                         -d)
1765                                 fastread=yes
1766                                 echo "(OK, I'll run with -d after this question.)" >&4
1767                                 ;;
1768                         -*)
1769                                 echo "*** Sorry, \$1 not supported yet." >&4
1770                                 ;;
1771                         esac
1772                         $myecho
1773                         ans=!
1774                         ;;
1775                 esac;;
1776         *)
1777                 case "\$aok" in
1778                 y)
1779                         echo "*** Substitution done -- please confirm."
1780                         xxxm="\$ans"
1781                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1782                         xxxm="\$ans"
1783                         ans=!
1784                         ;;
1785                 *)
1786                         echo "*** Error -- try again."
1787                         ans=!
1788                         ;;
1789                 esac
1790                 $myecho
1791                 ;;
1792         esac
1793         case "\$ans\$xxxm\$nostick" in
1794         '')
1795                 ans=!
1796                 $myecho
1797                 ;;
1798         esac
1799 done
1800 case "\$ans" in
1801 '') ans="\$xxxm";;
1802 esac
1803 EOSC
1804
1805 : create .config dir to save info across Configure sessions
1806 test -d ../.config || mkdir ../.config
1807 cat >../.config/README <<EOF
1808 This directory created by Configure to save information that should
1809 persist across sessions for $package.
1810
1811 You may safely delete it if you wish.
1812 EOF
1813
1814 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1815 case "$usedevel" in
1816 $define|true|[yY]*) ;;
1817 *) case "$xversion" in
1818    *[13579])
1819         cat >&4 <<EOH
1820 *** WHOA THERE!!! ***
1821
1822     This is an UNSTABLE DEVELOPMENT release.
1823     The version of this $package distribution is $xversion, that is, odd,
1824     (as opposed to even) and that signifies a development release.
1825     If you want a maintenance release, you want an even-numbered version.
1826
1827     Do ***NOT*** install this into production use.
1828     Data corruption and crashes are possible.
1829
1830     It is most seriously suggested that you do not continue any further
1831     unless you want to help in developing and debugging Perl.
1832
1833     If you *still* want to build perl, you can answer 'y' now,
1834     or pass -Dusedevel to Configure.
1835
1836 EOH
1837         rp='Do you really want to continue?'
1838         dflt='n'
1839         . ./myread
1840         case "$ans" in
1841         [yY]) echo >&4 "Okay, continuing."
1842               usedevel="$define" ;;
1843         *) echo >&4 "Okay, bye."
1844            exit 1
1845            ;;
1846         esac
1847         ;;
1848     esac
1849     ;;
1850 esac
1851 case "$usedevel" in
1852 $define|true|[yY]*)
1853         case "$versiononly" in
1854         '') versiononly="$define" ;;
1855         esac
1856         case "$installusrbinperl" in
1857         '') installusrbinperl="$undef" ;;
1858         esac
1859         ;;
1860 esac
1861
1862 : general instructions
1863 needman=true
1864 firsttime=true
1865 user=`(logname) 2>/dev/null`
1866 case "$user" in
1867 '') user=`whoami 2>&1`;;
1868 esac
1869 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1870         firsttime=false
1871         echo " "
1872         rp='Would you like to see the instructions?'
1873         dflt=n
1874         . ./myread
1875         case "$ans" in
1876         [yY]*) ;;
1877         *) needman=false;;
1878         esac
1879 fi
1880 if $needman; then
1881         cat <<EOH
1882
1883 This installation shell script will examine your system and ask you questions
1884 to determine how the perl5 package should be installed. If you get
1885 stuck on a question, you may use a ! shell escape to start a subshell or
1886 execute a command.  Many of the questions will have default answers in square
1887 brackets; typing carriage return will give you the default.
1888
1889 On some of the questions which ask for file or directory names you are allowed
1890 to use the ~name construct to specify the login directory belonging to "name",
1891 even if you don't have a shell which knows about that.  Questions where this is
1892 allowed will be marked "(~name ok)".
1893
1894 EOH
1895         rp=''
1896         dflt='Type carriage return to continue'
1897         . ./myread
1898         cat <<'EOH'
1899
1900 The prompter used in this script allows you to use shell variables and
1901 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1902 in the default answer, as if the default line was a set of arguments given to a
1903 script shell.  This means you may also use $* to repeat the whole default line,
1904 so you do not have to re-type everything to add something to the default.
1905
1906 Everytime there is a substitution, you will have to confirm.  If there is an
1907 error (e.g. an unmatched backtick), the default answer will remain unchanged
1908 and you will be prompted again.
1909
1910 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1911 the questions and use the computed defaults (or the previous answers if there
1912 was already a config.sh file). Type 'Configure -h' for a list of options.
1913 You may also start interactively and then answer '& -d' at any prompt to turn
1914 on the non-interactive behaviour for the remainder of the execution.
1915
1916 EOH
1917         . ./myread
1918         cat <<EOH
1919
1920 Much effort has been expended to ensure that this shell script will run on any
1921 Unix system.  If despite that it blows up on yours, your best bet is to edit
1922 Configure and run it again.  If you can't run Configure for some reason,
1923 you'll have to generate a config.sh file by hand.  Whatever problems you
1924 have, let me (perlbug@perl.org) know how I blew it.
1925
1926 This installation script affects things in two ways:
1927
1928 1) it may do direct variable substitutions on some of the files included
1929    in this kit.
1930 2) it builds a config.h file for inclusion in C programs.  You may edit
1931    any of these files as the need arises after running this script.
1932
1933 If you make a mistake on a question, there is no easy way to back up to it
1934 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1935 files.  Configure will offer to let you do this before it runs the SH files.
1936
1937 EOH
1938         dflt='Type carriage return to continue'
1939         . ./myread
1940         case "$firsttime" in
1941         true) echo $user >>../.config/instruct;;
1942         esac
1943 fi
1944
1945 : find out where common programs are
1946 echo " "
1947 echo "Locating common programs..." >&4
1948 cat <<EOSC >loc
1949 $startsh
1950 case \$# in
1951 0) exit 1;;
1952 esac
1953 thing=\$1
1954 shift
1955 dflt=\$1
1956 shift
1957 for dir in \$*; do
1958         case "\$thing" in
1959         .)
1960         if test -d \$dir/\$thing; then
1961                 echo \$dir
1962                 exit 0
1963         fi
1964         ;;
1965         *)
1966         for thisthing in \$dir/\$thing; do
1967                 : just loop through to pick last item
1968         done
1969         if test -f \$thisthing; then
1970                 echo \$thisthing
1971                 exit 0
1972         elif test -f \$dir/\$thing.exe; then
1973                 if test -n "$DJGPP"; then
1974                         echo \$dir/\$thing.exe
1975                 else
1976                         : on Eunice apparently
1977                         echo \$dir/\$thing
1978                 fi
1979                 exit 0
1980         fi
1981         ;;
1982         esac
1983 done
1984 echo \$dflt
1985 exit 1
1986 EOSC
1987 chmod +x loc
1988 $eunicefix loc
1989 loclist="
1990 awk
1991 cat
1992 comm
1993 cp
1994 echo
1995 expr
1996 grep
1997 ls
1998 make
1999 mkdir
2000 rm
2001 sed
2002 sort
2003 touch
2004 tr
2005 uniq
2006 "
2007 trylist="
2008 Mcc
2009 ar
2010 bison
2011 byacc
2012 cpp
2013 csh
2014 date
2015 egrep
2016 gzip
2017 less
2018 ln
2019 more
2020 nm
2021 nroff
2022 pg
2023 test
2024 uname
2025 zip
2026 "
2027 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2028 pth="$pth /lib /usr/lib"
2029 for file in $loclist; do
2030         eval xxx=\$$file
2031         case "$xxx" in
2032         /*|?:[\\/]*)
2033                 if test -f "$xxx"; then
2034                         : ok
2035                 else
2036                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2037                         xxx=`./loc $file $file $pth`
2038                 fi
2039                 ;;
2040         '') xxx=`./loc $file $file $pth`;;
2041         *) xxx=`./loc $xxx $xxx $pth`;;
2042         esac
2043         eval $file=$xxx
2044         eval _$file=$xxx
2045         case "$xxx" in
2046         /*)
2047                 echo $file is in $xxx.
2048                 ;;
2049         ?:[\\/]*)
2050                 echo $file is in $xxx.
2051                 ;;
2052         *)
2053                 echo "I don't know where '$file' is, and my life depends on it." >&4
2054                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2055                 exit 1
2056                 ;;
2057         esac
2058 done
2059 echo " "
2060 echo "Don't worry if any of the following aren't found..."
2061 say=offhand
2062 for file in $trylist; do
2063         eval xxx=\$$file
2064         case "$xxx" in
2065         /*|?:[\\/]*)
2066                 if test -f "$xxx"; then
2067                         : ok
2068                 else
2069                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2070                         xxx=`./loc $file $file $pth`
2071                 fi
2072                 ;;
2073         '') xxx=`./loc $file $file $pth`;;
2074         *) xxx=`./loc $xxx $xxx $pth`;;
2075         esac
2076         eval $file=$xxx
2077         eval _$file=$xxx
2078         case "$xxx" in
2079         /*)
2080                 echo $file is in $xxx.
2081                 ;;
2082         ?:[\\/]*)
2083                 echo $file is in $xxx.
2084                 ;;
2085         *)
2086                 echo "I don't see $file out there, $say."
2087                 say=either
2088                 ;;
2089         esac
2090 done
2091 case "$egrep" in
2092 egrep)
2093         echo "Substituting grep for egrep."
2094         egrep=$grep
2095         ;;
2096 esac
2097 case "$ln" in
2098 ln)
2099         echo "Substituting cp for ln."
2100         ln=$cp
2101         ;;
2102 esac
2103 case "$test" in
2104 test)
2105         echo "Hopefully test is built into your sh."
2106         ;;
2107 *)
2108         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2109                 echo "Using the test built into your sh."
2110                 test=test
2111                 _test=test
2112         fi
2113         ;;
2114 esac
2115 case "$echo" in
2116 echo)
2117         echo "Hopefully echo is built into your sh."
2118         ;;
2119 '') ;;
2120 *)
2121         echo " "
2122 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2123         $echo $n "hi there$c" >foo1
2124         echo $n "hi there$c" >foo2
2125         if cmp foo1 foo2 >/dev/null 2>&1; then
2126                 echo "They are compatible.  In fact, they may be identical."
2127         else
2128                 case "$n" in
2129                 '-n') n='' c='\c';;
2130                 *) n='-n' c='';;
2131                 esac
2132                 cat <<FOO
2133 They are not compatible!  You are probably running ksh on a non-USG system.
2134 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2135 have echo built in and we may have to run some Bourne shell scripts.  That
2136 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2137
2138 FOO
2139                 $echo $n "The star should be here-->$c"
2140                 $echo "*"
2141         fi
2142         $rm -f foo1 foo2
2143         ;;
2144 esac
2145
2146 cat <<EOS >checkcc
2147 $startsh
2148 EOS
2149 cat <<'EOSC' >>checkcc
2150 case "$cc" in
2151 '') ;;
2152 *)  $rm -f try try.*
2153     $cat >try.c <<EOM
2154 int main(int argc, char *argv[]) {
2155   return 0;
2156 }
2157 EOM
2158     if $cc -o try $ccflags $ldflags try.c; then
2159        :
2160     else
2161         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2162         despair=yes
2163         trygcc=yes
2164         case "$cc" in
2165         *gcc*) trygcc=no ;;
2166         esac
2167         case "`$cc -v -c try.c 2>&1`" in
2168         *gcc*) trygcc=no ;;
2169         esac
2170         if $test X"$trygcc" = Xyes; then
2171             if gcc -o try -c try.c; then
2172                 echo " "
2173                 echo "You seem to have a working gcc, though." >&4
2174                 rp="Would you like to use it?"
2175                 dflt=y
2176                 if $test -f myread; then
2177                     . ./myread
2178                 else
2179                     if $test -f UU/myread; then
2180                         . ./UU/myread
2181                     else
2182                         echo "Cannot find myread, sorry.  Aborting." >&2
2183                         exit 1
2184                     fi
2185                 fi  
2186                 case "$ans" in
2187                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2188                 esac
2189             fi
2190         fi
2191         if $test X"$despair" = Xyes; then
2192             $cat >&4 <<EOM
2193 You need to find a working C compiler.
2194 Either (purchase and) install the C compiler supplied by your OS vendor,
2195 or for a free C compiler try http://gcc.gnu.org/
2196 I cannot continue any further, aborting.
2197 EOM
2198             exit 1
2199         fi
2200     fi
2201     $rm -f try try.*
2202     ;;
2203 esac
2204 EOSC
2205
2206 : determine whether symbolic links are supported
2207 echo " "
2208 $touch blurfl
2209 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2210         echo "Symbolic links are supported." >&4
2211         lns="$ln -s"
2212 else
2213         echo "Symbolic links are NOT supported." >&4
2214         lns="$ln"
2215 fi
2216 $rm -f blurfl sym
2217
2218 : determine whether symbolic links are supported
2219 echo " "
2220 case "$lns" in
2221 *"ln -s")
2222         echo "Checking how to test for symbolic links..." >&4
2223         $lns blurfl sym
2224         if $test "X$issymlink" = X; then
2225                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2226                 if test $? = 0; then
2227                         issymlink="test -h"
2228                 fi              
2229         fi
2230         if $test "X$issymlink" = X; then
2231                 if  $test -h >/dev/null 2>&1; then
2232                         issymlink="$test -h"
2233                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2234                 fi              
2235         fi
2236         if $test "X$issymlink" = X; then
2237                 if $test -L sym 2>/dev/null; then
2238                         issymlink="$test -L"
2239                 fi
2240         fi
2241         if $test "X$issymlink" != X; then
2242                 echo "You can test for symbolic links with '$issymlink'." >&4
2243         else
2244                 echo "I do not know how you can test for symbolic links." >&4
2245         fi
2246         $rm -f blurfl sym
2247         ;;
2248 *)      echo "No symbolic links, so not testing for their testing..." >&4
2249         ;;
2250 esac
2251 echo " "
2252
2253
2254 case "$mksymlinks" in
2255 $define|true|[yY]*)
2256         case "$src" in
2257         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2258                 exit 1
2259                 ;;
2260         *)      case "$lns:$issymlink" in
2261                 *"ln -s:"*"test -"?)
2262                         echo "Creating the symbolic links..." >&4
2263                         echo "(First creating the subdirectories...)" >&4
2264                         cd ..
2265                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2266                                 read directory
2267                                 test -z "$directory" && break
2268                                 mkdir -p $directory
2269                         done
2270                         # Sanity check 1.
2271                         if test ! -d t/base; then
2272                                 echo "Failed to create the subdirectories.  Aborting." >&4
2273                                 exit 1
2274                         fi
2275                         echo "(Then creating the symlinks...)" >&4
2276                         awk '{print $1}' $src/MANIFEST | while true; do
2277                                 read filename
2278                                 test -z "$filename" && break
2279                                 if test -f $filename; then
2280                                         if $issymlink $filename; then
2281                                                 rm -f $filename
2282                                         fi
2283                                 fi
2284                                 if test -f $filename; then
2285                                         echo "$filename already exists, not symlinking."
2286                                 else
2287                                         ln -s $src/$filename $filename
2288                                 fi
2289                         done
2290                         # Sanity check 2.
2291                         if test ! -f t/base/commonsense.t; then
2292                                 echo "Failed to create the symlinks.  Aborting." >&4
2293                                 exit 1
2294                         fi
2295                         cd UU
2296                         ;;
2297                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2298                         ;;
2299                 esac
2300                 ;;
2301         esac
2302         ;;
2303 esac
2304
2305 : see whether [:lower:] and [:upper:] are supported character classes
2306 echo " "
2307 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2308 ABYZ)
2309         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2310         up='[:upper:]'
2311         low='[:lower:]'
2312         ;;
2313 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2314         # (0xc9 and 0xd1), therefore that is a nice testing point.
2315         if test "X$up" = X -o "X$low" = X; then
2316             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2317             ij) up='[A-Z]'
2318                 low='[a-z]'
2319                 ;;
2320             esac
2321         fi
2322         if test "X$up" = X -o "X$low" = X; then
2323             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2324             ij) up='A-Z'
2325                 low='a-z'
2326                 ;;
2327             esac
2328         fi
2329         if test "X$up" = X -o "X$low" = X; then
2330             case "`echo IJ | od -x 2>/dev/null`" in
2331             *C9D1*|*c9d1*)
2332                 echo "Hey, this might be EBCDIC." >&4
2333                 if test "X$up" = X -o "X$low" = X; then
2334                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2335                     ij) up='[A-IJ-RS-Z]'
2336                         low='[a-ij-rs-z]'
2337                         ;;
2338                     esac
2339                 fi
2340                 if test "X$up" = X -o "X$low" = X; then
2341                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2342                     ij) up='A-IJ-RS-Z'
2343                         low='a-ij-rs-z'
2344                         ;;
2345                     esac
2346                 fi
2347                 ;;
2348             esac
2349         fi
2350 esac
2351 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2352 ij)
2353     echo "Using $up and $low to convert case." >&4
2354     ;;
2355 *)
2356     echo "I don't know how to translate letters from upper to lower case." >&4
2357     echo "Your tr is not acting any way I know of." >&4
2358     exit 1
2359     ;;
2360 esac
2361 : set up the translation script tr, must be called with ./tr of course
2362 cat >tr <<EOSC
2363 $startsh
2364 case "\$1\$2" in
2365 '[A-Z][a-z]') exec $tr '$up' '$low';;
2366 '[a-z][A-Z]') exec $tr '$low' '$up';;
2367 esac
2368 exec $tr "\$@"
2369 EOSC
2370 chmod +x tr
2371 $eunicefix tr
2372
2373 : Try to determine whether config.sh was made on this system
2374 case "$config_sh" in
2375 '')
2376 myuname=`$uname -a 2>/dev/null`
2377 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2378 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2379 # because the A-Z/a-z are not consecutive.
2380 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2381         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2382 newmyuname="$myuname"
2383 dflt=n
2384 case "$knowitall" in
2385 '')
2386         if test -f ../config.sh; then
2387                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2388                         eval "`grep myuname= ../config.sh`"
2389                 fi
2390                 if test "X$myuname" = "X$newmyuname"; then
2391                         dflt=y
2392                 fi
2393         fi
2394         ;;
2395 *) dflt=y;;
2396 esac
2397
2398 : Get old answers from old config file if Configure was run on the
2399 : same system, otherwise use the hints.
2400 hint=default
2401 cd ..
2402 if test -f config.sh; then
2403         echo " "
2404         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2405         . UU/myread
2406         case "$ans" in
2407         n*|N*) echo "OK, I'll ignore it."
2408                 mv config.sh config.sh.old
2409                 myuname="$newmyuname"
2410                 ;;
2411         *)  echo "Fetching default answers from your old config.sh file..." >&4
2412                 tmp_n="$n"
2413                 tmp_c="$c"
2414                 tmp_sh="$sh"
2415                 . ./config.sh
2416                 cp config.sh UU
2417                 n="$tmp_n"
2418                 c="$tmp_c"
2419                 : Older versions did not always set $sh.  Catch re-use of such
2420                 : an old config.sh.
2421                 case "$sh" in
2422                 '') sh="$tmp_sh" ;;
2423                 esac
2424                 hint=previous
2425                 ;;
2426         esac
2427 fi
2428 . ./UU/checkcc
2429 if test ! -f config.sh; then
2430         $cat <<EOM
2431
2432 First time through, eh?  I have some defaults handy for some systems
2433 that need some extra help getting the Configure answers right:
2434
2435 EOM
2436         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2437         dflt=''
2438         : Half the following guesses are probably wrong... If you have better
2439         : tests or hints, please send them to perlbug@perl.org
2440         : The metaconfig authors would also appreciate a copy...
2441         $test -f /irix && osname=irix
2442         $test -f /xenix && osname=sco_xenix
2443         $test -f /dynix && osname=dynix
2444         $test -f /dnix && osname=dnix
2445         $test -f /lynx.os && osname=lynxos
2446         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2447         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2448         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2449         $test -f /bin/mips && /bin/mips && osname=mips
2450         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2451                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2452         $test -d /usr/apollo/bin && osname=apollo
2453         $test -f /etc/saf/_sactab && osname=svr4
2454         $test -d /usr/include/minix && osname=minix
2455         if $test -d /MachTen -o -d /MachTen_Folder; then
2456                 osname=machten
2457                 if $test -x /sbin/version; then
2458                         osvers=`/sbin/version | $awk '{print $2}' |
2459                         $sed -e 's/[A-Za-z]$//'`
2460                 elif $test -x /usr/etc/version; then
2461                         osvers=`/usr/etc/version | $awk '{print $2}' |
2462                         $sed -e 's/[A-Za-z]$//'`
2463                 else
2464                         osvers="$2.$3"
2465                 fi
2466         fi
2467
2468         $test -f /sys/posix.dll &&
2469                 $test -f /usr/bin/what &&
2470                 set X `/usr/bin/what /sys/posix.dll` &&
2471                 $test "$3" = UWIN &&
2472                 osname=uwin &&
2473                 osvers="$5"
2474
2475         if $test -f $uname; then
2476                 set X $myuname
2477                 shift
2478
2479                 case "$5" in
2480                 fps*) osname=fps ;;
2481                 mips*)
2482                         case "$4" in
2483                         umips) osname=umips ;;
2484                         *) osname=mips ;;
2485                         esac;;
2486                 [23]100) osname=mips ;;
2487                 next*) osname=next ;;
2488                 i386*)
2489                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2490                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2491                                 osname='sco'
2492                                 osvers=$tmp
2493                         elif $test -f /etc/kconfig; then
2494                                 osname=isc
2495                                 if test "$lns" = "$ln -s"; then
2496                                         osvers=4
2497                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2498                                         osvers=3
2499                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2500                                         osvers=2
2501                                 fi
2502                         fi
2503                         tmp=''
2504                         ;;
2505                 pc*)
2506                         if test -n "$DJGPP"; then
2507                                 osname=dos
2508                                 osvers=djgpp
2509                         fi
2510                         ;;
2511                 esac
2512
2513                 case "$1" in
2514                 aix) osname=aix
2515                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2516                         case "$tmp" in
2517                         'not found') osvers="$4"."$3" ;;
2518                         '<3240'|'<>3240') osvers=3.2.0 ;;
2519                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2520                         '=3250'|'>3250') osvers=3.2.5 ;;
2521                         *) osvers=$tmp;;
2522                         esac
2523                         ;;
2524                 bsd386) osname=bsd386
2525                         osvers=`$uname -r`
2526                         ;;
2527                 cygwin*) osname=cygwin
2528                         osvers="$3"
2529                         ;;
2530                 *dc.osx) osname=dcosx
2531                         osvers="$3"
2532                         ;;
2533                 dnix) osname=dnix
2534                         osvers="$3"
2535                         ;;
2536                 domainos) osname=apollo
2537                         osvers="$3"
2538                         ;;
2539                 dgux) osname=dgux 
2540                         osvers="$3"
2541                         ;;
2542                 dynixptx*) osname=dynixptx
2543                         osvers=`echo "$4"|sed 's/^v//'`
2544                         ;;
2545                 freebsd) osname=freebsd 
2546                         osvers="$3" ;;
2547                 genix) osname=genix ;;
2548                 hp*) osname=hpux 
2549                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2550                         ;;
2551                 irix*) osname=irix
2552                         case "$3" in
2553                         4*) osvers=4 ;;
2554                         5*) osvers=5 ;;
2555                         *)      osvers="$3" ;;
2556                         esac
2557                         ;;
2558                 linux) osname=linux
2559                         case "$3" in
2560                         *)      osvers="$3" ;;
2561                         esac
2562                         ;;
2563                 MiNT) osname=mint
2564                         ;;
2565                 netbsd*) osname=netbsd
2566                         osvers="$3"
2567                         ;;
2568                 news-os) osvers="$3"
2569                         case "$3" in
2570                         4*) osname=newsos4 ;;
2571                         *) osname=newsos ;;
2572                         esac
2573                         ;;
2574                 next*) osname=next ;;
2575                 nonstop-ux) osname=nonstopux ;;
2576                 POSIX-BC | posix-bc ) osname=posix-bc
2577                         osvers="$3"
2578                         ;;
2579                 powerux | power_ux | powermax_os | powermaxos | \
2580                 powerunix | power_unix) osname=powerux
2581                         osvers="$3"
2582                         ;;
2583                 qnx) osname=qnx
2584                         osvers="$4"
2585                         ;;
2586                 solaris) osname=solaris
2587                         case "$3" in
2588                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2589                         *)      osvers="$3" ;;
2590                         esac
2591                         ;;
2592                 sunos) osname=sunos
2593                         case "$3" in
2594                         5*) osname=solaris
2595                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2596                         *)      osvers="$3" ;;
2597                         esac
2598                         ;;
2599                 titanos) osname=titanos
2600                         case "$3" in
2601                         1*) osvers=1 ;;
2602                         2*) osvers=2 ;;
2603                         3*) osvers=3 ;;
2604                         4*) osvers=4 ;;
2605                         *)      osvers="$3" ;;
2606                         esac
2607                         ;;
2608                 ultrix) osname=ultrix
2609                         osvers="$3"
2610                         ;;
2611                 osf1|mls+)      case "$5" in
2612                                 alpha)
2613                                         osname=dec_osf
2614                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2615                                         case "$osvers" in
2616                                         [1-9].[0-9]*) ;;
2617                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2618                                         esac
2619                                         ;;
2620                         hp*)    osname=hp_osf1  ;;
2621                         mips)   osname=mips_osf1 ;;
2622                         esac
2623                         ;;
2624                 unixware) osname=svr5
2625                         osvers="$4"
2626                         ;;
2627                 uts) osname=uts
2628                         osvers="$3"
2629                         ;;
2630                 $2) case "$osname" in
2631                         *isc*) ;;
2632                         *freebsd*) ;;
2633                         svr*)
2634                                 : svr4.x or possibly later
2635                                 case "svr$3" in 
2636                                 ${osname}*)
2637                                         osname=svr$3
2638                                         osvers=$4
2639                                         ;;
2640                                 esac
2641                                 case "$osname" in
2642                                 svr4.0)
2643                                         : Check for ESIX
2644                                         if test -f /stand/boot ; then
2645                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2646                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2647                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2648                                                         if test -n "$isesix"; then
2649                                                                 osname=esix4
2650                                                         fi
2651                                                 fi
2652                                         fi
2653                                         ;;
2654                                 esac
2655                                 ;;
2656                         *)      if test -f /etc/systemid; then
2657                                         osname=sco
2658                                         set `echo $3 | $sed 's/\./ /g'` $4
2659                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2660                                                 osvers=$1.$2.$3
2661                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2662                                                 osvers=$1.$2
2663                                         elif $test -f $src/hints/sco_$1.sh; then
2664                                                 osvers=$1
2665                                         fi
2666                                 else
2667                                         case "$osname" in
2668                                         '') : Still unknown.  Probably a generic Sys V.
2669                                                 osname="sysv"
2670                                                 osvers="$3"
2671                                                 ;;
2672                                         esac
2673                                 fi
2674                                 ;;
2675                         esac
2676                         ;;
2677                 *)      case "$osname" in
2678                         '') : Still unknown.  Probably a generic BSD.
2679                                 osname="$1"
2680                                 osvers="$3"
2681                                 ;;
2682                         esac
2683                         ;;
2684                 esac
2685         else
2686                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2687                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2688                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2689                                 osname=news_os
2690                         fi
2691                         $rm -f UU/kernel.what
2692                 elif test -d c:/.; then
2693                         set X $myuname
2694                         osname=os2
2695                         osvers="$5"
2696                 fi
2697         fi
2698         
2699         : Now look for a hint file osname_osvers, unless one has been
2700         : specified already.
2701         case "$hintfile" in
2702         ''|' ')
2703                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2704                 : Also try without trailing minor version numbers.
2705                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2706                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2707                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2708                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2709                 case "$file" in
2710                 '') dflt=none ;;
2711                 *)  case "$osvers" in
2712                         '') dflt=$file
2713                                 ;;
2714                         *)  if $test -f $src/hints/$file.sh ; then
2715                                         dflt=$file
2716                                 elif $test -f $src/hints/$xfile.sh ; then
2717                                         dflt=$xfile
2718                                 elif $test -f $src/hints/$xxfile.sh ; then
2719                                         dflt=$xxfile
2720                                 elif $test -f $src/hints/$xxxfile.sh ; then
2721                                         dflt=$xxxfile
2722                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2723                                         dflt=$xxxxfile
2724                                 elif $test -f "$src/hints/${osname}.sh" ; then
2725                                         dflt="${osname}"
2726                                 else
2727                                         dflt=none
2728                                 fi
2729                                 ;;
2730                         esac
2731                         ;;
2732                 esac
2733                 if $test -f Policy.sh ; then
2734                         case "$dflt" in
2735                         *Policy*) ;;
2736                         none) dflt="Policy" ;;
2737                         *) dflt="Policy $dflt" ;;
2738                         esac
2739                 fi
2740                 ;;
2741         *)
2742                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2743                 ;;
2744         esac
2745
2746         if $test -f Policy.sh ; then
2747                 $cat <<EOM
2748
2749 There's also a Policy hint file available, which should make the
2750 site-specific (policy) questions easier to answer.
2751 EOM
2752
2753         fi
2754
2755         $cat <<EOM
2756
2757 You may give one or more space-separated answers, or "none" if appropriate.
2758 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2759 is a good thing.  DO NOT give a wrong version or a wrong OS.
2760
2761 EOM
2762
2763         rp="Which of these apply, if any?"
2764         . UU/myread
2765         tans=$ans
2766         for file in $tans; do
2767                 if $test X$file = XPolicy -a -f Policy.sh; then
2768                         . Policy.sh
2769                         $cat Policy.sh >> UU/config.sh
2770                 elif $test -f $src/hints/$file.sh; then
2771                         . $src/hints/$file.sh
2772                         $cat $src/hints/$file.sh >> UU/config.sh
2773                 elif $test X$tans = X -o X$tans = Xnone ; then
2774                         : nothing
2775                 else
2776                         : Give one chance to correct a possible typo.
2777                         echo "$file.sh does not exist"
2778                         dflt=$file
2779                         rp="hint to use instead?"
2780                         . UU/myread
2781                         for file in $ans; do
2782                                 if $test -f "$src/hints/$file.sh"; then
2783                                         . $src/hints/$file.sh
2784                                         $cat $src/hints/$file.sh >> UU/config.sh
2785                                 elif $test X$ans = X -o X$ans = Xnone ; then
2786                                         : nothing
2787                                 else
2788                                         echo "$file.sh does not exist -- ignored."
2789                                 fi
2790                         done
2791                 fi
2792         done
2793
2794         hint=recommended
2795         : Remember our hint file for later.
2796         if $test -f "$src/hints/$file.sh" ; then
2797                 hintfile="$file"
2798         else
2799                 hintfile=''
2800         fi
2801 fi
2802 cd UU
2803 ;;
2804 *)
2805         echo " "
2806         echo "Fetching default answers from $config_sh..." >&4
2807         tmp_n="$n"
2808         tmp_c="$c"
2809         cd ..
2810         cp $config_sh config.sh 2>/dev/null
2811         chmod +w config.sh
2812         . ./config.sh
2813         cd UU
2814         cp ../config.sh .
2815         n="$tmp_n"
2816         c="$tmp_c"
2817         hint=previous
2818         ;;
2819 esac
2820 test "$override" && . ./optdef.sh
2821
2822 : Restore computed paths
2823 for file in $loclist $trylist; do
2824         eval $file="\$_$file"
2825 done
2826
2827 cat << EOM
2828
2829 Configure uses the operating system name and version to set some defaults.
2830 The default value is probably right if the name rings a bell. Otherwise,
2831 since spelling matters for me, either accept the default or answer "none"
2832 to leave it blank.
2833
2834 EOM
2835 case "$osname" in
2836         ''|' ')
2837                 case "$hintfile" in
2838                 ''|' '|none) dflt=none ;;
2839                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2840                 esac
2841                 ;;
2842         *) dflt="$osname" ;;
2843 esac
2844 rp="Operating system name?"
2845 . ./myread
2846 case "$ans" in
2847 none)  osname='' ;;
2848 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2849 esac
2850 echo " "
2851 case "$osvers" in
2852         ''|' ')
2853                 case "$hintfile" in
2854                 ''|' '|none) dflt=none ;;
2855                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2856                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2857                         case "$dflt" in
2858                         ''|' ') dflt=none ;;
2859                         esac
2860                         ;;
2861                 esac
2862                 ;;
2863         *) dflt="$osvers" ;;
2864 esac
2865 rp="Operating system version?"
2866 . ./myread
2867 case "$ans" in
2868 none)  osvers='' ;;
2869 *) osvers="$ans" ;;
2870 esac
2871
2872
2873 . ./posthint.sh
2874
2875 : who configured the system
2876 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2877 cf_by=`(logname) 2>/dev/null`
2878 case "$cf_by" in
2879 "")
2880         cf_by=`(whoami) 2>/dev/null`
2881         case "$cf_by" in
2882         "") cf_by=unknown ;;
2883         esac ;;
2884 esac
2885
2886 : set up the script used to warn in case of inconsistency
2887 cat <<EOS >whoa
2888 $startsh
2889 EOS
2890 cat <<'EOSC' >>whoa
2891 dflt=y
2892 echo " "
2893 echo "*** WHOA THERE!!! ***" >&4
2894 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2895 rp="    Keep the $hint value?"
2896 . ./myread
2897 case "$ans" in
2898 y) td=$was; tu=$was;;
2899 esac
2900 EOSC
2901
2902 : function used to set $1 to $val
2903 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2904 case "$val$was" in
2905 $define$undef) . ./whoa; eval "$var=\$td";;
2906 $undef$define) . ./whoa; eval "$var=\$tu";;
2907 *) eval "$var=$val";;
2908 esac'
2909
2910 case "$usethreads" in
2911 $define|true|[yY]*)     dflt='y';;
2912 *) dflt='n';;
2913 esac
2914 cat <<EOM
2915
2916 Perl can be built to take advantage of threads on some systems.
2917 To do so, Configure can be run with -Dusethreads.
2918
2919 Note that threading is a highly experimental feature, and
2920 some known race conditions still remain.  If you choose to try
2921 it, be very sure to not actually deploy it for production
2922 purposes.  README.threads has more details, and is required
2923 reading if you enable threads.
2924
2925 If this doesn't make any sense to you, just accept the default '$dflt'.
2926 EOM
2927 rp='Build a threading Perl?'
2928 . ./myread
2929 case "$ans" in
2930 y|Y)    val="$define" ;;
2931 *)      val="$undef" ;;
2932 esac
2933 set usethreads
2934 eval $setvar
2935
2936 case "$usethreads" in
2937 $define)
2938         $cat <<EOM
2939
2940 As of 5.5.640, Perl has two different internal threading implementations,
2941 the 5.005 version (5005threads) and an interpreter-based version
2942 (ithreads) that has one interpreter per thread.  Both are very 
2943 experimental.  This arrangement exists to help developers work out
2944 which one is better.
2945
2946 If you're a casual user, you probably don't want interpreter-threads
2947 at this time.  There doesn't yet exist a way to create threads from
2948 within Perl in this model, i.e., "use Thread;" will NOT work.
2949 EOM
2950         : Default to ithreads unless overridden on command line or with
2951         : old config.sh
2952         dflt='y'
2953         case "$use5005threads" in
2954                 $define|true|[yY]*) dflt='n';;
2955         esac
2956         case "$useithreads" in
2957                 $undef|false|[nN]*) dflt='n';;
2958         esac
2959         rp='Use interpreter-based ithreads?'
2960         . ./myread
2961         case "$ans" in
2962         y|Y)    val="$define" ;;
2963         *)      val="$undef" ;;
2964         esac
2965         set useithreads
2966         eval $setvar
2967         : Now set use5005threads to the opposite value.
2968         case "$useithreads" in
2969         $define) val="$undef" ;;
2970         *) val="$define" ;;
2971         esac
2972         set use5005threads
2973         eval $setvar
2974         ;;
2975 *)
2976         useithreads="$undef"
2977         use5005threads="$undef"
2978         ;;
2979 esac
2980
2981 case "$useithreads$use5005threads" in
2982 "$define$define")
2983         $cat >&4 <<EOM
2984
2985 You cannot have both the ithreads and the 5.005 threads enabled
2986 at the same time.  Disabling the 5.005 threads since they are
2987 much less stable than the ithreads.
2988
2989 EOM
2990         use5005threads="$undef"
2991         ;;
2992 esac
2993
2994 case "$d_oldpthreads" in
2995 '')     : Configure tests would be welcome here.  For now, assume undef.
2996         val="$undef" ;;
2997 *)      val="$d_oldpthreads" ;;
2998 esac
2999 set d_oldpthreads
3000 eval $setvar
3001
3002
3003 case "$usethreads" in
3004 "$define"|true|[yY]*)
3005 : Look for a hint-file generated 'call-back-unit'.  If the
3006 : user has specified that a threading perl is to be built,
3007 : we may need to set or change some other defaults.
3008         if $test -f usethreads.cbu; then
3009                 echo "Your platform has some specific hints for threaded builds, using them..."
3010                 . ./usethreads.cbu
3011         else
3012                 $cat <<EOM
3013 (Your platform doesn't have any specific hints for threaded builds.
3014  Assuming POSIX threads, then.)
3015 EOM
3016         fi
3017         ;;
3018 esac
3019
3020 cat <<EOM
3021
3022 Perl can be built so that multiple Perl interpreters can coexist
3023 within the same Perl executable.
3024 EOM
3025
3026 case "$useithreads" in
3027 $define)
3028         cat <<EOM
3029 This multiple interpreter support is required for interpreter-based threads.
3030 EOM
3031         val="$define"
3032         ;;
3033 *)      case "$usemultiplicity" in
3034         $define|true|[yY]*)     dflt='y';;
3035         *) dflt='n';;
3036         esac
3037         echo " "
3038         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3039         rp='Build Perl for multiplicity?'
3040         . ./myread
3041         case "$ans" in
3042         y|Y)    val="$define" ;;
3043         *)      val="$undef" ;;
3044         esac
3045         ;;
3046 esac
3047 set usemultiplicity
3048 eval $setvar
3049
3050 : make some quick guesses about what we are up against
3051 echo " "
3052 $echo $n "Hmm...  $c"
3053 echo exit 1 >bsd
3054 echo exit 1 >usg
3055 echo exit 1 >v7
3056 echo exit 1 >osf1
3057 echo exit 1 >eunice
3058 echo exit 1 >xenix
3059 echo exit 1 >venix
3060 echo exit 1 >os2
3061 d_bsd="$undef"
3062 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3063 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3064 then
3065         echo "Looks kind of like an OSF/1 system, but we'll see..."
3066         echo exit 0 >osf1
3067 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3068         xxx=`./loc addbib blurfl $pth`
3069         if $test -f $xxx; then
3070         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3071                 echo exit 0 >bsd
3072                 echo exit 0 >usg
3073         else
3074                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3075                         echo "Looks kind of like an extended USG system, but we'll see..."
3076                 else
3077                         echo "Looks kind of like a USG system, but we'll see..."
3078                 fi
3079                 echo exit 0 >usg
3080         fi
3081 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3082         echo "Looks kind of like a BSD system, but we'll see..."
3083         d_bsd="$define"
3084         echo exit 0 >bsd
3085 else
3086         echo "Looks kind of like a Version 7 system, but we'll see..."
3087         echo exit 0 >v7
3088 fi
3089 case "$eunicefix" in
3090 *unixtovms*)
3091         $cat <<'EOI'
3092 There is, however, a strange, musty smell in the air that reminds me of
3093 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3094 EOI
3095         echo exit 0 >eunice
3096         d_eunice="$define"
3097 : it so happens the Eunice I know will not run shell scripts in Unix format
3098         ;;
3099 *)
3100         echo " "
3101         echo "Congratulations.  You aren't running Eunice."
3102         d_eunice="$undef"
3103         ;;
3104 esac
3105 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3106 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3107 : semicolon as a patch separator
3108 case "$p_" in
3109 :) ;;
3110 *)
3111         $cat <<'EOI'
3112 I have the feeling something is not exactly right, however...don't tell me...
3113 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3114 (Or you may be running DOS with DJGPP.)
3115 EOI
3116         echo exit 0 >os2
3117         ;;
3118 esac
3119 if test -f /xenix; then
3120         echo "Actually, this looks more like a XENIX system..."
3121         echo exit 0 >xenix
3122         d_xenix="$define"
3123 else
3124         echo " "
3125         echo "It's not Xenix..."
3126         d_xenix="$undef"
3127 fi
3128 chmod +x xenix
3129 $eunicefix xenix
3130 if test -f /venix; then
3131         echo "Actually, this looks more like a VENIX system..."
3132         echo exit 0 >venix
3133 else
3134         echo " "
3135         if ./xenix; then
3136                 : null
3137         else
3138                 echo "Nor is it Venix..."
3139         fi
3140 fi
3141 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3142 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3143 $rm -f foo
3144
3145 case "$cc" in
3146 '') dflt=cc;;
3147 *) dflt="$cc";;
3148 esac
3149 rp="Use which C compiler?"
3150 . ./myread
3151 cc="$ans"
3152 : Look for a hint-file generated 'call-back-unit'.  Now that the
3153 : user has specified the compiler, we may need to set or change some
3154 : other defaults.
3155 if $test -f cc.cbu; then
3156     . ./cc.cbu
3157 fi
3158 . ./checkcc
3159
3160 echo " "
3161 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3162 $cat >gccvers.c <<EOM
3163 #include <stdio.h>
3164 int main() {
3165 #ifdef __GNUC__
3166 #ifdef __VERSION__
3167         printf("%s\n", __VERSION__);
3168 #else
3169         printf("%s\n", "1");
3170 #endif
3171 #endif
3172         exit(0);
3173 }
3174 EOM
3175 if $cc -o gccvers $ccflags $ldflags gccvers.c; then
3176         gccversion=`./gccvers`
3177         case "$gccversion" in
3178         '') echo "You are not using GNU cc." ;;
3179         *)  echo "You are using GNU cc $gccversion."
3180             ccname=gcc  
3181             ;;
3182         esac
3183 else
3184         echo " "
3185         echo "*** WHOA THERE!!! ***" >&4
3186         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3187         case "$knowitall" in
3188         '')
3189         echo "    You'd better start hunting for one and let me know about it." >&4
3190                 exit 1
3191                 ;;
3192         esac
3193 fi
3194 $rm -f gccvers*
3195 case "$gccversion" in
3196 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3197 esac
3198 case "$gccversion" in
3199 '') gccosandvers='' ;;
3200 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3201    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3202    gccshortvers=''
3203    case "$gccosandvers" in
3204    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3205    $osname$osvers) ;; # looking good
3206    $osname*) cat <<EOM >&4
3207
3208 *** WHOA THERE!!! ***
3209
3210     Your gcc has not been compiled for the exact release of
3211     your operating system ($gccosandvers versus $osname$osvers).
3212
3213     In general it is a good idea to keep gcc synchronized with
3214     the operating system because otherwise serious problems
3215     may ensue when trying to compile software, like Perl.
3216
3217     I'm trying to be optimistic here, though, and will continue.
3218     If later during the configuration and build icky compilation
3219     problems appear (headerfile conflicts being the most common
3220     manifestation), I suggest reinstalling the gcc to match
3221     your operating system release.
3222
3223 EOM
3224       ;;
3225    *) gccosandvers='' ;; # failed to parse, better be silent
3226    esac
3227    ;;
3228 esac
3229 case "$ccname" in
3230 '') ccname="$cc" ;;
3231 esac
3232
3233 case "$gccversion" in
3234 '') ;;
3235 *)  case "$ccflags" in
3236     *-Wall*) ;;
3237     *) ccflags="$ccflags -Wall" ;;
3238     esac
3239     ;;
3240 esac
3241
3242 : see how we invoke the C preprocessor
3243 echo " "
3244 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3245 cat <<'EOT' >testcpp.c
3246 #define ABC abc
3247 #define XYZ xyz
3248 ABC.XYZ
3249 EOT
3250 cd ..
3251 if test ! -f cppstdin; then
3252         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3253                 # AIX cc -E doesn't show the absolute headerfile
3254                 # locations but we'll cheat by using the -M flag.
3255                 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
3256         else
3257                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3258         fi
3259 else
3260         echo "Keeping your $hint cppstdin wrapper."
3261 fi
3262 chmod 755 cppstdin
3263 wrapper=`pwd`/cppstdin
3264 ok='false'
3265 cd UU
3266
3267 if $test "X$cppstdin" != "X" && \
3268         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3269         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3270 then
3271         echo "You used to use $cppstdin $cppminus so we'll use that again."
3272         case "$cpprun" in
3273         '') echo "But let's see if we can live without a wrapper..." ;;
3274         *)
3275                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3276                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3277                 then
3278                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3279                         ok='true'
3280                 else
3281                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3282                 fi
3283                 ;;
3284         esac
3285 else
3286         case "$cppstdin" in
3287         '') ;;
3288         *)
3289                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3290                 ;;
3291         esac
3292 fi
3293
3294 if $ok; then
3295         : nothing
3296 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3297         $cc -E <testcpp.c >testcpp.out 2>&1; \
3298         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3299         echo "Yup, it does."
3300         x_cpp="$cc -E"
3301         x_minus='';
3302 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3303         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3304         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3305         echo "Yup, it does."
3306         x_cpp="$cc -E"
3307         x_minus='-';
3308 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3309         $cc -P <testcpp.c >testcpp.out 2>&1; \
3310         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3311         echo "Yipee, that works!"
3312         x_cpp="$cc -P"
3313         x_minus='';
3314 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3315         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3316         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3317         echo "At long last!"
3318         x_cpp="$cc -P"
3319         x_minus='-';
3320 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3321         $cpp <testcpp.c >testcpp.out 2>&1; \
3322         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3323         echo "It works!"
3324         x_cpp="$cpp"
3325         x_minus='';
3326 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3327         $cpp - <testcpp.c >testcpp.out 2>&1; \
3328         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3329         echo "Hooray, it works!  I was beginning to wonder."
3330         x_cpp="$cpp"
3331         x_minus='-';
3332 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3333         $wrapper <testcpp.c >testcpp.out 2>&1; \
3334         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3335         x_cpp="$wrapper"
3336         x_minus=''
3337         echo "Eureka!"
3338 else
3339         dflt=''
3340         rp="No dice.  I can't find a C preprocessor.  Name one:"
3341         . ./myread
3342         x_cpp="$ans"
3343         x_minus=''
3344         $x_cpp <testcpp.c >testcpp.out 2>&1
3345         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3346                 echo "OK, that will do." >&4
3347         else
3348 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3349                 exit 1
3350         fi
3351 fi
3352
3353 case "$ok" in
3354 false)
3355         cppstdin="$x_cpp"
3356         cppminus="$x_minus"
3357         cpprun="$x_cpp"
3358         cpplast="$x_minus"
3359         set X $x_cpp
3360         shift
3361         case "$1" in
3362         "$cpp")
3363                 echo "Perhaps can we force $cc -E using a wrapper..."
3364                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3365                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3366                 then
3367                         echo "Yup, we can."
3368                         cppstdin="$wrapper"
3369                         cppminus='';
3370                 else
3371                         echo "Nope, we'll have to live without it..."
3372                 fi
3373                 ;;
3374         esac
3375         case "$cpprun" in
3376         "$wrapper")
3377                 cpprun=''
3378                 cpplast=''
3379                 ;;
3380         esac
3381         ;;
3382 esac
3383
3384 case "$cppstdin" in
3385 "$wrapper"|'cppstdin') ;;
3386 *) $rm -f $wrapper;;
3387 esac
3388 $rm -f testcpp.c testcpp.out
3389
3390 : decide how portable to be.  Allow command line overrides.
3391 case "$d_portable" in
3392 "$undef") ;;
3393 *)      d_portable="$define" ;;
3394 esac
3395
3396 : set up shell script to do ~ expansion
3397 cat >filexp <<EOSS
3398 $startsh
3399 : expand filename
3400 case "\$1" in
3401  ~/*|~)
3402         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3403         ;;
3404  ~*)
3405         if $test -f /bin/csh; then
3406                 /bin/csh -f -c "glob \$1"
3407                 failed=\$?
3408                 echo ""
3409                 exit \$failed
3410         else
3411                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3412                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3413                 if $test ! -d "\$dir"; then
3414                         me=\`basename \$0\`
3415                         echo "\$me: can't locate home directory for: \$name" >&2
3416                         exit 1
3417                 fi
3418                 case "\$1" in
3419                 */*)
3420                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3421                         ;;
3422                 *)
3423                         echo \$dir
3424                         ;;
3425                 esac
3426         fi
3427         ;;
3428 *)
3429         echo \$1
3430         ;;
3431 esac
3432 EOSS
3433 chmod +x filexp
3434 $eunicefix filexp
3435
3436 : now set up to get a file name
3437 cat <<EOS >getfile
3438 $startsh
3439 EOS
3440 cat <<'EOSC' >>getfile
3441 tilde=''
3442 fullpath=''
3443 already=''
3444 skip=''
3445 none_ok=''
3446 exp_file=''
3447 nopath_ok=''
3448 orig_rp="$rp"
3449 orig_dflt="$dflt"
3450 case "$gfpth" in
3451 '') gfpth='.' ;;
3452 esac
3453
3454 case "$fn" in
3455 *\(*)
3456         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3457         fn=`echo $fn | sed 's/(.*)//'`
3458         ;;
3459 esac
3460
3461 case "$fn" in
3462 *:*)
3463         loc_file=`expr $fn : '.*:\(.*\)'`
3464         fn=`expr $fn : '\(.*\):.*'`
3465         ;;
3466 esac
3467
3468 case "$fn" in
3469 *~*) tilde=true;;
3470 esac
3471 case "$fn" in
3472 */*) fullpath=true;;
3473 esac
3474 case "$fn" in
3475 *+*) skip=true;;
3476 esac
3477 case "$fn" in
3478 *n*) none_ok=true;;
3479 esac
3480 case "$fn" in
3481 *e*) exp_file=true;;
3482 esac
3483 case "$fn" in
3484 *p*) nopath_ok=true;;
3485 esac
3486
3487 case "$fn" in
3488 *f*) type='File';;
3489 *d*) type='Directory';;
3490 *l*) type='Locate';;
3491 esac
3492
3493 what="$type"
3494 case "$what" in
3495 Locate) what='File';;
3496 esac
3497
3498 case "$exp_file" in
3499 '')
3500         case "$d_portable" in
3501         "$define") ;;
3502         *) exp_file=true;;
3503         esac
3504         ;;
3505 esac
3506
3507 cd ..
3508 while test "$type"; do
3509         redo=''
3510         rp="$orig_rp"
3511         dflt="$orig_dflt"
3512         case "$tilde" in
3513         true) rp="$rp (~name ok)";;
3514         esac
3515         . UU/myread
3516         if test -f UU/getfile.ok && \
3517                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3518         then
3519                 value="$ans"
3520                 ansexp="$ans"
3521                 break
3522         fi
3523         case "$ans" in
3524         none)
3525                 value=''
3526                 ansexp=''
3527                 case "$none_ok" in
3528                 true) type='';;
3529                 esac
3530                 ;;
3531         *)
3532                 case "$tilde" in
3533                 '') value="$ans"
3534                         ansexp="$ans";;
3535                 *)
3536                         value=`UU/filexp $ans`
3537                         case $? in
3538                         0)
3539                                 if test "$ans" != "$value"; then
3540                                         echo "(That expands to $value on this system.)"
3541                                 fi
3542                                 ;;
3543                         *) value="$ans";;
3544                         esac
3545                         ansexp="$value"
3546                         case "$exp_file" in
3547                         '') value="$ans";;
3548                         esac
3549                         ;;
3550                 esac
3551                 case "$fullpath" in
3552                 true)
3553                         case "$ansexp" in
3554                         /*) value="$ansexp" ;;
3555                         [a-zA-Z]:/*) value="$ansexp" ;;
3556                         *)
3557                                 redo=true
3558                                 case "$already" in
3559                                 true)
3560                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3561                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3562                                         ;;
3563                                 *)
3564                                 echo "Please give a full path name, starting with slash." >&4
3565                                         case "$tilde" in
3566                                         true)
3567                                 echo "Note that using ~name is ok provided it expands well." >&4
3568                                                 already=true
3569                                                 ;;
3570                                         esac
3571                                 esac
3572                                 ;;
3573                         esac
3574                         ;;
3575                 esac
3576                 case "$redo" in
3577                 '')
3578                         case "$type" in
3579                         File)
3580                                 for fp in $gfpth; do
3581                                         if test "X$fp" = X.; then
3582                                             pf="$ansexp"
3583                                         else    
3584                                             pf="$fp/$ansexp"
3585                                         fi
3586                                         if test -f "$pf"; then
3587                                                 type=''
3588                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3589                                         then
3590                                                 echo "($value is not a plain file, but that's ok.)"
3591                                                 type=''
3592                                         fi
3593                                         if test X"$type" = X; then
3594                                             value="$pf"
3595                                             break
3596                                         fi
3597                                 done
3598                                 ;;
3599                         Directory)
3600                                 for fp in $gfpth; do
3601                                         if test "X$fp" = X.; then
3602                                             dir="$ans"
3603                                             direxp="$ansexp"
3604                                         else    
3605                                             dir="$fp/$ansexp"
3606                                             direxp="$fp/$ansexp"
3607                                         fi
3608                                         if test -d "$direxp"; then
3609                                                 type=''
3610                                                 value="$dir"
3611                                                 break
3612                                         fi
3613                                 done
3614                                 ;;
3615                         Locate)
3616                                 if test -d "$ansexp"; then
3617                                         echo "(Looking for $loc_file in directory $value.)"
3618                                         value="$value/$loc_file"
3619                                         ansexp="$ansexp/$loc_file"
3620                                 fi
3621                                 if test -f "$ansexp"; then
3622                                         type=''
3623                                 fi
3624                                 case "$nopath_ok" in
3625                                 true)   case "$value" in
3626                                         */*) ;;
3627                                         *)      echo "Assuming $value will be in people's path."
3628                                                 type=''
3629                                                 ;;
3630                                         esac
3631                                         ;;
3632                                 esac
3633                                 ;;
3634                         esac
3635
3636                         case "$skip" in
3637                         true) type='';
3638                         esac
3639
3640                         case "$type" in
3641                         '') ;;
3642                         *)
3643                                 if test "$fastread" = yes; then
3644                                         dflt=y
3645                                 else
3646                                         dflt=n
3647                                 fi
3648                                 rp="$what $value doesn't exist.  Use that name anyway?"
3649                                 . UU/myread
3650                                 dflt=''
3651                                 case "$ans" in
3652                                 y*) type='';;
3653                                 *) echo " ";;
3654                                 esac
3655                                 ;;
3656                         esac
3657                         ;;
3658                 esac
3659                 ;;
3660         esac
3661 done
3662 cd UU
3663 ans="$value"
3664 rp="$orig_rp"
3665 dflt="$orig_dflt"
3666 rm -f getfile.ok
3667 test "X$gfpthkeep" != Xy && gfpth=""
3668 EOSC
3669
3670 : What should the include directory be ?
3671 echo " "
3672 $echo $n "Hmm...  $c"
3673 dflt='/usr/include'
3674 incpath=''
3675 mips_type=''
3676 if $test -f /bin/mips && /bin/mips; then
3677         echo "Looks like a MIPS system..."
3678         $cat >usr.c <<'EOCP'
3679 #ifdef SYSTYPE_BSD43
3680 /bsd43
3681 #endif
3682 EOCP
3683         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3684                 dflt='/bsd43/usr/include'
3685                 incpath='/bsd43'
3686                 mips_type='BSD 4.3'
3687         else
3688                 mips_type='System V'
3689         fi
3690         $rm -f usr.c usr.out
3691         echo "and you're compiling with the $mips_type compiler and libraries."
3692         xxx_prompt=y
3693         echo "exit 0" >mips
3694 else
3695         echo "Doesn't look like a MIPS system."
3696         xxx_prompt=n
3697         echo "exit 1" >mips
3698 fi
3699 chmod +x mips
3700 $eunicefix mips
3701 case "$usrinc" in
3702 '') ;;
3703 *) dflt="$usrinc";;
3704 esac
3705 case "$xxx_prompt" in
3706 y)      fn=d/
3707         echo " "
3708         rp='Where are the include files you want to use?'
3709         . ./getfile
3710         usrinc="$ans"
3711         ;;
3712 *)      usrinc="$dflt"
3713         ;;
3714 esac
3715
3716 : Set private lib path
3717 case "$plibpth" in
3718 '') if ./mips; then
3719                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3720         fi;;
3721 esac
3722 case "$libpth" in
3723 ' ') dlist='';;
3724 '') dlist="$loclibpth $plibpth $glibpth";;
3725 *) dlist="$libpth";;
3726 esac
3727
3728 : Now check and see which directories actually exist, avoiding duplicates
3729 libpth=''
3730 for xxx in $dlist
3731 do
3732     if $test -d $xxx; then
3733                 case " $libpth " in
3734                 *" $xxx "*) ;;
3735                 *) libpth="$libpth $xxx";;
3736                 esac
3737     fi
3738 done
3739 $cat <<'EOM'
3740
3741 Some systems have incompatible or broken versions of libraries.  Among
3742 the directories listed in the question below, please remove any you
3743 know not to be holding relevant libraries, and add any that are needed.
3744 Say "none" for none.
3745
3746 EOM
3747 case "$libpth" in
3748 '') dflt='none';;
3749 *)
3750         set X $libpth
3751         shift
3752         dflt=${1+"$@"}
3753         ;;
3754 esac
3755 rp="Directories to use for library searches?"
3756 . ./myread
3757 case "$ans" in
3758 none) libpth=' ';;
3759 *) libpth="$ans";;
3760 esac
3761
3762 : compute shared library extension
3763 case "$so" in
3764 '')
3765         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3766                 dflt='sl'
3767         else
3768                 dflt='so'
3769         fi
3770         ;;
3771 *) dflt="$so";;
3772 esac
3773 $cat <<EOM
3774
3775 On some systems, shared libraries may be available.  Answer 'none' if
3776 you want to suppress searching of shared libraries for the remainder
3777 of this configuration.
3778
3779 EOM
3780 rp='What is the file extension used for shared libraries?'
3781 . ./myread
3782 so="$ans"
3783
3784 : Define several unixisms.
3785 : Hints files or command line option can be used to override them.
3786 : The convoluted testing is in case hints files set either the old
3787 : or the new name.
3788 case "$_exe" in
3789 '')     case "$exe_ext" in
3790     '') ;;
3791         *)      _exe="$exe_ext" ;;
3792         esac
3793         ;;
3794 esac
3795 case "$_a" in
3796 '')     case "$lib_ext" in
3797     '') _a='.a';;
3798         *)      _a="$lib_ext" ;;
3799         esac
3800         ;;
3801 esac
3802 case "$_o" in
3803 '') case "$obj_ext" in
3804         '')     _o='.o';;
3805         *)      _o="$obj_ext";;
3806         esac
3807         ;;
3808 esac
3809 case "$p_" in
3810 '') case "$path_sep" in
3811         '')     p_=':';;
3812         *)      p_="$path_sep";;
3813         esac
3814         ;;
3815 esac
3816 exe_ext=$_exe
3817 lib_ext=$_a
3818 obj_ext=$_o
3819 path_sep=$p_
3820
3821 : Which makefile gets called first.  This is used by make depend.
3822 case "$firstmakefile" in
3823 '') firstmakefile='makefile';;
3824 esac
3825
3826 case "$usesocks" in
3827 $define|true|[yY]*)     dflt='y';;
3828 *) dflt='n';;
3829 esac
3830 cat <<EOM
3831
3832 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3833 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3834 to use the PerlIO abstraction layer, this will be implicitly selected.
3835
3836 If this doesn't make any sense to you, just accept the default '$dflt'.
3837 EOM
3838 rp='Build Perl for SOCKS?'
3839 . ./myread
3840 case "$ans" in
3841 y|Y)    val="$define" ;;     
3842 *)      val="$undef" ;;
3843 esac
3844 set usesocks
3845 eval $setvar
3846
3847 case "$usesocks" in
3848 $define|true|[yY]*) useperlio="$define";;
3849 esac
3850
3851 : Looking for optional libraries
3852 echo " "
3853 echo "Checking for optional libraries..." >&4
3854 case "$libs" in
3855 ' '|'') dflt='';;
3856 *) dflt="$libs";;
3857 esac
3858 case "$libswanted" in
3859 '') libswanted='c_s';;
3860 esac
3861 case "$usesocks" in
3862 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3863 esac
3864 libsfound=''
3865 libsfiles=''
3866 libsdirs=''
3867 libspath=''
3868 for thisdir in $libpth $xlibpth; do
3869   test -d $thisdir && libspath="$libspath $thisdir"
3870 done
3871 for thislib in $libswanted; do
3872         for thisdir in $libspath; do
3873             xxx=''
3874             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3875                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3876                 $test -f "$xxx" && eval $libscheck
3877                 $test -f "$xxx" && libstyle=shared
3878             fi
3879             if test ! -f "$xxx"; then
3880                 xxx=$thisdir/lib$thislib.$so
3881                 $test -f "$xxx" && eval $libscheck
3882                 $test -f "$xxx" && libstyle=shared
3883             fi  
3884             if test ! -f "$xxx"; then
3885                 xxx=$thisdir/lib$thislib$_a
3886                 $test -f "$xxx" && eval $libscheck
3887                 $test -f "$xxx" && libstyle=static
3888             fi
3889             if test ! -f "$xxx"; then
3890                 xxx=$thisdir/$thislib$_a
3891                 $test -f "$xxx" && eval $libscheck
3892                 $test -f "$xxx" && libstyle=static
3893             fi
3894             if test ! -f "$xxx"; then
3895                 xxx=$thisdir/lib${thislib}_s$_a
3896                 $test -f "$xxx" && eval $libscheck
3897                 $test -f "$xxx" && libstyle=static
3898                 $test -f "$xxx" && thislib=${thislib}_s
3899             fi
3900             if test ! -f "$xxx"; then
3901                 xxx=$thisdir/Slib$thislib$_a
3902                 $test -f "$xxx" && eval $libscheck
3903                 $test -f "$xxx" && libstyle=static
3904             fi
3905             if $test -f "$xxx"; then
3906                 case "$libstyle" in
3907                 shared) echo "Found -l$thislib (shared)." ;;
3908                 static) echo "Found -l$thislib." ;;
3909                 *)      echo "Found -l$thislib ($libstyle)." ;;
3910                 esac
3911                 case " $dflt " in
3912                 *"-l$thislib "*);;
3913                 *) dflt="$dflt -l$thislib"
3914                    libsfound="$libsfound $xxx"
3915                    yyy=`basename $xxx`
3916                    libsfiles="$libsfiles $yyy"
3917                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3918                    case " $libsdirs " in
3919                    *" $yyy "*) ;;
3920                    *) libsdirs="$libsdirs $yyy" ;;
3921                    esac
3922                    ;;
3923                 esac
3924                 break
3925             fi  
3926         done
3927         if $test ! -f "$xxx"; then
3928             echo "No -l$thislib."
3929         fi
3930 done
3931 set X $dflt
3932 shift
3933 dflt="$*"
3934 case "$libs" in
3935 '') dflt="$dflt";;
3936 *) dflt="$libs";;
3937 esac
3938 case "$dflt" in
3939 ' '|'') dflt='none';;
3940 esac
3941
3942 $cat <<EOM
3943
3944 In order to compile $package on your machine, a number of libraries
3945 are usually needed.  Include any other special libraries here as well.
3946 Say "none" for none.  The default list is almost always right.
3947 EOM
3948
3949 echo " "
3950 rp="What libraries to use?"
3951 . ./myread
3952 case "$ans" in
3953 none) libs=' ';;
3954 *) libs="$ans";;
3955 esac
3956
3957 : determine optimization, if desired, or use for debug flag also
3958 case "$optimize" in
3959 ' '|$undef) dflt='none';;
3960 '') dflt='-O';;
3961 *) dflt="$optimize";;
3962 esac
3963 $cat <<EOH
3964
3965 By default, $package compiles with the -O flag to use the optimizer.
3966 Alternately, you might want to use the symbolic debugger, which uses
3967 the -g flag (on traditional Unix systems).  Either flag can be
3968 specified here.  To use neither flag, specify the word "none".
3969
3970 EOH
3971 rp="What optimizer/debugger flag should be used?"
3972 . ./myread
3973 optimize="$ans"
3974 case "$optimize" in
3975 'none') optimize=" ";;
3976 esac
3977
3978 dflt=''
3979 : We will not override a previous value, but we might want to
3980 : augment a hint file
3981 case "$hint" in
3982 default|recommended)
3983         case "$gccversion" in
3984         1*) dflt='-fpcc-struct-return' ;;
3985         esac
3986         case "$optimize" in
3987         *-g*) dflt="$dflt -DDEBUGGING";;
3988         esac
3989         case "$gccversion" in
3990         2*) if test -d /etc/conf/kconfig.d &&
3991                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3992                 then
3993                         dflt="$dflt -posix"
3994                 fi
3995                 ;;
3996         esac
3997         case "$gccversion" in
3998         1*) ;;
3999         2.[0-8]*) ;;
4000         ?*)     echo " "
4001                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4002                 echo 'int main(void) { return 0; }' > gcctest.c
4003                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4004                         echo "Yes, it does." 2>&1
4005                         case "$ccflags" in
4006                         *strict-aliasing*) 
4007                                 echo "Leaving current flags $ccflags alone." 2>&1
4008                                 ;;
4009                         *) dflt="$dflt -fno-strict-aliasing" ;;
4010                         esac
4011                 else
4012                         echo "Nope, it doesn't, but that's ok." 2>&1
4013                 fi
4014                 ;;
4015         esac
4016         ;;
4017 esac
4018
4019 case "$mips_type" in
4020 *BSD*|'') inclwanted="$locincpth $usrinc";;
4021 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4022 esac
4023 for thisincl in $inclwanted; do
4024         if $test -d $thisincl; then
4025                 if $test x$thisincl != x$usrinc; then
4026                         case "$dflt" in
4027                         *" -I$thisincl "*);;
4028                         *) dflt="$dflt -I$thisincl ";;
4029                         esac
4030                 fi
4031         fi
4032 done
4033
4034 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4035         xxx=true;
4036 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4037         xxx=true;
4038 else
4039         xxx=false;
4040 fi;
4041 if $xxx; then
4042         case "$dflt" in
4043         *$2*);;
4044         *) dflt="$dflt -D$2";;
4045         esac;
4046 fi'
4047
4048 set signal.h LANGUAGE_C; eval $inctest
4049
4050 case "$usesocks" in
4051 $define)
4052         ccflags="$ccflags -DSOCKS"
4053         ;;
4054 esac
4055
4056 case "$hint" in
4057 default|recommended) dflt="$ccflags $dflt" ;;
4058 *) dflt="$ccflags";;
4059 esac
4060
4061 case "$dflt" in
4062 ''|' ') dflt=none;;
4063 esac
4064
4065 $cat <<EOH
4066
4067 Your C compiler may want other flags.  For this question you should include
4068 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4069 but you should NOT include libraries or ld flags like -lwhatever.  If you
4070 want $package to honor its debug switch, you should include -DDEBUGGING here.
4071 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4072
4073 To use no flags, specify the word "none".
4074
4075 EOH
4076 set X $dflt
4077 shift
4078 dflt=${1+"$@"}
4079 rp="Any additional cc flags?"
4080 . ./myread
4081 case "$ans" in
4082 none) ccflags='';;
4083 *) ccflags="$ans";;
4084 esac
4085
4086 : the following weeds options from ccflags that are of no interest to cpp
4087 case "$cppflags" in
4088 '') cppflags="$ccflags" ;;
4089 *)  cppflags="$cppflags $ccflags" ;;
4090 esac
4091 case "$gccversion" in
4092 1*) cppflags="$cppflags -D__GNUC__"
4093 esac
4094 case "$mips_type" in
4095 '');;
4096 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4097 esac
4098 case "$cppflags" in
4099 '');;
4100 *)
4101         echo " "
4102         echo "Let me guess what the preprocessor flags are..." >&4
4103         set X $cppflags
4104         shift
4105         cppflags=''
4106         $cat >cpp.c <<'EOM'
4107 #define BLURFL foo
4108
4109 BLURFL xx LFRULB
4110 EOM
4111         previous=''
4112         for flag in $*
4113         do
4114                 case "$flag" in
4115                 -*) ftry="$flag";;
4116                 *) ftry="$previous $flag";;
4117                 esac
4118                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4119                         >cpp1.out 2>/dev/null && \
4120                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4121                         >cpp2.out 2>/dev/null && \
4122                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4123                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4124                 then
4125                         cppflags="$cppflags $ftry"
4126                         previous=''
4127                 else
4128                         previous="$flag"
4129                 fi
4130         done
4131         set X $cppflags
4132         shift
4133         cppflags=${1+"$@"}
4134         case "$cppflags" in
4135         *-*)  echo "They appear to be: $cppflags";;
4136         esac
4137         $rm -f cpp.c cpp?.out
4138         ;;
4139 esac
4140
4141 : flags used in final linking phase
4142 case "$ldflags" in
4143 '') if ./venix; then
4144                 dflt='-i -z'
4145         else
4146                 dflt=''
4147         fi
4148         case "$ccflags" in
4149         *-posix*) dflt="$dflt -posix" ;;
4150         esac
4151         ;;
4152 *) dflt="$ldflags";;
4153 esac
4154
4155 : Try to guess additional flags to pick up local libraries.
4156 for thislibdir in $libpth; do
4157         case " $loclibpth " in
4158         *" $thislibdir "*)
4159                 case "$dflt " in 
4160                 *"-L$thislibdir "*) ;;
4161                 *)  dflt="$dflt -L$thislibdir" ;;
4162                 esac
4163                 ;;
4164         esac
4165 done
4166
4167 case "$dflt" in
4168 '') dflt='none' ;;
4169 esac
4170
4171 $cat <<EOH
4172
4173 Your C linker may need flags.  For this question you should
4174 include -L/whatever and any other flags used by the C linker, but you
4175 should NOT include libraries like -lwhatever.
4176
4177 Make sure you include the appropriate -L/path flags if your C linker
4178 does not normally search all of the directories you specified above,
4179 namely
4180         $libpth
4181 To use no flags, specify the word "none".
4182
4183 EOH
4184
4185 rp="Any additional ld flags (NOT including libraries)?"
4186 . ./myread
4187 case "$ans" in
4188 none) ldflags='';;
4189 *) ldflags="$ans";;
4190 esac
4191 rmlist="$rmlist pdp11"
4192
4193 : coherency check
4194 echo " "
4195 echo "Checking your choice of C compiler and flags for coherency..." >&4
4196 $cat > try.c <<'EOF'
4197 #include <stdio.h>
4198 int main() { printf("Ok\n"); exit(0); }
4199 EOF
4200 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4201 shift
4202 $cat >try.msg <<'EOM'
4203 I've tried to compile and run the following simple program:
4204
4205 EOM
4206 $cat try.c >> try.msg
4207
4208 $cat >> try.msg <<EOM
4209
4210 I used the command:
4211
4212         $*
4213         ./try
4214
4215 and I got the following output:
4216
4217 EOM
4218 dflt=y
4219 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4220         if $sh -c './try' >>try.msg 2>&1; then
4221                 xxx=`./try`
4222                 case "$xxx" in
4223                 "Ok") dflt=n ;;
4224                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4225                         case " $libs " in
4226                         *" -lsfio "*)
4227                                 cat >> try.msg <<'EOQS'
4228 If $libs contains -lsfio, and sfio is mis-configured, then it
4229 sometimes (apparently) runs and exits with a 0 status, but with no
4230 output!  It may have to do with sfio's use of _exit vs. exit.
4231
4232 EOQS
4233                                 rp="You have a big problem.  Shall I abort Configure"
4234                                 dflt=y
4235                                 ;;
4236                         esac
4237                         ;;
4238                 esac
4239         else
4240                 echo "The program compiled OK, but exited with status $?." >>try.msg
4241                 rp="You have a problem.  Shall I abort Configure"
4242                 dflt=y
4243         fi
4244 else
4245         echo "I can't compile the test program." >>try.msg
4246         rp="You have a BIG problem.  Shall I abort Configure"
4247         dflt=y
4248 fi
4249 case "$dflt" in
4250 y)
4251         $cat try.msg >&4
4252         case "$knowitall" in
4253         '')
4254                 echo "(The supplied flags or libraries might be incorrect.)"
4255                 ;;
4256         *) dflt=n;;
4257         esac
4258         echo " "
4259         . ./myread
4260         case "$ans" in
4261         n*|N*) ;;
4262         *)      echo "Ok.  Stopping Configure." >&4
4263                 exit 1
4264                 ;;
4265         esac
4266         ;;
4267 n) echo "OK, that should do.";;
4268 esac
4269 $rm -f try try.* core
4270
4271 : define an is-a-typedef? function
4272 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4273 case "$inclist" in
4274 "") inclist="sys/types.h";;
4275 esac;
4276 eval "varval=\$$var";
4277 case "$varval" in
4278 "")
4279         $rm -f temp.c;
4280         for inc in $inclist; do
4281                 echo "#include <$inc>" >>temp.c;
4282         done;
4283         echo "#ifdef $type" >> temp.c;
4284         echo "printf(\"We have $type\");" >> temp.c;
4285         echo "#endif" >> temp.c;
4286         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4287         if $contains $type temp.E >/dev/null 2>&1; then
4288                 eval "$var=\$type";
4289         else
4290                 eval "$var=\$def";
4291         fi;
4292         $rm -f temp.?;;
4293 *) eval "$var=\$varval";;
4294 esac'
4295
4296 : define an is-a-typedef? function that prompts if the type is not available.
4297 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4298 case "$inclist" in
4299 "") inclist="sys/types.h";;
4300 esac;
4301 eval "varval=\$$var";
4302 case "$varval" in
4303 "")
4304         $rm -f temp.c;
4305         for inc in $inclist; do
4306                 echo "#include <$inc>" >>temp.c;
4307         done;
4308         echo "#ifdef $type" >> temp.c;
4309         echo "printf(\"We have $type\");" >> temp.c;
4310         echo "#endif" >> temp.c;
4311         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4312         echo " " ;
4313         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4314         if $contains $type temp.E >/dev/null 2>&1; then
4315                 echo "$type found." >&4;
4316                 eval "$var=\$type";
4317         else
4318                 echo "$type NOT found." >&4;
4319                 dflt="$def";
4320                 . ./myread ;
4321                 eval "$var=\$ans";
4322         fi;
4323         $rm -f temp.?;;
4324 *) eval "$var=\$varval";;
4325 esac'
4326
4327 : define a shorthand compile call
4328 compile='
4329 mc_file=$1;
4330 shift;
4331 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4332 : define a shorthand compile call for compilations that should be ok.
4333 compile_ok='
4334 mc_file=$1;
4335 shift;
4336 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4337
4338 : check for lengths of integral types
4339 echo " "
4340 case "$intsize" in
4341 '')
4342         echo "Checking to see how big your integers are..." >&4
4343         $cat >intsize.c <<'EOCP'
4344 #include <stdio.h>
4345 int main()
4346 {
4347         printf("intsize=%d;\n", (int)sizeof(int));
4348         printf("longsize=%d;\n", (int)sizeof(long));
4349         printf("shortsize=%d;\n", (int)sizeof(short));
4350         exit(0);
4351 }
4352 EOCP
4353         set intsize
4354         if eval $compile_ok && ./intsize > /dev/null; then
4355                 eval `./intsize`
4356                 echo "Your integers are $intsize bytes long."
4357                 echo "Your long integers are $longsize bytes long."
4358                 echo "Your short integers are $shortsize bytes long."
4359         else
4360                 $cat >&4 <<EOM
4361 !
4362 Help! I can't compile and run the intsize test program: please enlighten me!
4363 (This is probably a misconfiguration in your system or libraries, and
4364 you really ought to fix it.  Still, I'll try anyway.)
4365 !
4366 EOM
4367                 dflt=4
4368                 rp="What is the size of an integer (in bytes)?"
4369                 . ./myread
4370                 intsize="$ans"
4371                 dflt=$intsize
4372                 rp="What is the size of a long integer (in bytes)?"
4373                 . ./myread
4374                 longsize="$ans"
4375                 dflt=2
4376                 rp="What is the size of a short integer (in bytes)?"
4377                 . ./myread
4378                 shortsize="$ans"
4379         fi
4380         ;;
4381 esac
4382 $rm -f intsize intsize.*
4383
4384 : see what type lseek is declared as in the kernel
4385 rp="What is the type used for lseek's offset on this system?"
4386 set off_t lseektype long stdio.h sys/types.h
4387 eval $typedef_ask
4388
4389 echo " "
4390 echo "Checking to see how big your file offsets are..." >&4
4391 $cat >try.c <<EOCP
4392 #include <sys/types.h>
4393 #include <stdio.h>
4394 int main()
4395 {
4396     printf("%d\n", (int)sizeof($lseektype));
4397     return(0); 
4398 }
4399 EOCP
4400 set try
4401 if eval $compile_ok; then
4402         lseeksize=`./try`
4403         echo "Your file offsets are $lseeksize bytes long."
4404 else
4405         dflt=$longsize
4406         echo " "
4407         echo "(I can't seem to compile the test program.  Guessing...)"
4408         rp="What is the size of your file offsets (in bytes)?"
4409         . ./myread
4410         lseeksize="$ans"
4411 fi
4412 $rm -f try.c try
4413
4414 : see what type file positions are declared as in the library
4415 rp="What is the type for file position used by fsetpos()?"
4416 set fpos_t fpostype long stdio.h sys/types.h
4417 eval $typedef_ask
4418
4419 echo " "
4420 case "$fpostype" in
4421 *_t) zzz="$fpostype"    ;;
4422 *)   zzz="fpos_t"       ;;
4423 esac
4424 echo "Checking the size of $zzz..." >&4 
4425 cat > try.c <<EOCP
4426 #include <sys/types.h>
4427 #include <stdio.h>
4428 int main() {
4429     printf("%d\n", (int)sizeof($fpostype));
4430     exit(0);
4431 }
4432 EOCP
4433 set try
4434 if eval $compile_ok; then
4435         yyy=`./try`
4436         case "$yyy" in
4437         '')     fpossize=4
4438                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4439                 ;;
4440         *)      fpossize=$yyy
4441                 echo "Your $zzz is $fpossize bytes long."
4442                 ;;
4443         esac
4444 else
4445         dflt="$longsize"
4446         echo " " >&4
4447         echo "(I can't compile the test program.  Guessing...)" >&4
4448         rp="What is the size of your file positions (in bytes)?"
4449         . ./myread
4450         fpossize="$ans"
4451 fi
4452
4453
4454
4455 # Backward compatibility (uselfs is deprecated).
4456 case "$uselfs" in
4457 "$define"|true|[yY]*)
4458         cat <<EOM >&4
4459
4460 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4461 EOM
4462         uselargefiles="$define"
4463         ;;
4464 esac                          
4465
4466 case "$lseeksize:$fpossize" in
4467 8:8) cat <<EOM
4468
4469 You can have files larger than 2 gigabytes.
4470 EOM
4471    val="$define" ;;
4472 *)    case "$uselargefiles" in
4473    "$undef"|false|[nN]*) dflt='n' ;;
4474    *)   dflt='y' ;;
4475    esac
4476    cat <<EOM
4477
4478 Perl can be built to understand large files (files larger than 2 gigabytes)
4479 on some systems.  To do so, Configure can be run with -Duselargefiles.
4480
4481 If this doesn't make any sense to you, just accept the default '$dflt'.
4482 EOM
4483    rp='Try to understand large files, if available?'
4484    . ./myread
4485    case "$ans" in
4486    y|Y)         val="$define" ;;
4487    *)           val="$undef"  ;;
4488    esac
4489    ;;
4490 esac
4491 set uselargefiles
4492 eval $setvar
4493 case "$uselargefiles" in
4494 "$define")
4495 : Look for a hint-file generated 'call-back-unit'.  If the
4496 : user has specified that a large files perl is to be built,
4497 : we may need to set or change some other defaults.
4498         if $test -f uselargefiles.cbu; then
4499                 echo "Your platform has some specific hints for large file builds, using them..."
4500                 . ./uselargefiles.cbu
4501                 echo " "
4502                 echo "Rechecking to see how big your file offsets are..." >&4
4503                 $cat >try.c <<EOCP
4504 #include <sys/types.h>
4505 #include <stdio.h>
4506 int main()
4507 {
4508     printf("%d\n", (int)sizeof($lseektype));
4509     return(0); 
4510 }
4511 EOCP
4512                 set try
4513                 if eval $compile_ok; then
4514                         lseeksize=`./try`
4515                         $echo "Your file offsets are now $lseeksize bytes long."
4516                 else
4517                         dflt="$lseeksize"
4518                         echo " "
4519                         echo "(I can't seem to compile the test program.  Guessing...)"
4520                         rp="What is the size of your file offsets (in bytes)?"
4521                         . ./myread
4522                         lseeksize="$ans"
4523                 fi
4524                 case "$fpostype" in
4525                 *_t) zzz="$fpostype"    ;;
4526                 *)   zzz="fpos_t"       ;;
4527                 esac
4528                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4529                 $cat > try.c <<EOCP
4530 #include <sys/types.h>
4531 #include <stdio.h>
4532 int main() {
4533     printf("%d\n", (int)sizeof($fpostype));
4534     exit(0);
4535 }
4536 EOCP
4537                 set try
4538                 if eval $compile_ok; then
4539                         yyy=`./try`
4540                         dflt="$lseeksize"
4541                         case "$yyy" in
4542                         '')     echo " "
4543                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4544                                 ;;
4545                         *)      fpossize=$yyy
4546                                 echo " $fpossize bytes." >&4
4547                                 ;;
4548                         esac
4549                 else
4550                         dflt="$fpossize"
4551                         echo " "
4552                         echo "(I can't compile the test program.  Guessing...)" >&4
4553                         rp="What is the size of your file positions (in bytes)?"
4554                         . ./myread
4555                         fpossize="$ans"
4556                 fi
4557                 $rm -f try.c try
4558         fi
4559         ;;
4560 esac
4561
4562
4563 case "$usemorebits" in
4564 "$define"|true|[yY]*)
4565         use64bitint="$define"
4566         uselongdouble="$define"
4567         usemorebits="$define"
4568         ;;
4569 *)      usemorebits="$undef"
4570         ;;
4571 esac
4572
4573 : check for void type
4574 echo " "
4575 echo "Checking to see how well your C compiler groks the void type..." >&4
4576 case "$voidflags" in
4577 '')
4578         $cat >try.c <<'EOCP'
4579 #if TRY & 1
4580 void sub() {
4581 #else
4582 sub() {
4583 #endif
4584         extern void moo();      /* function returning void */
4585         void (*goo)();          /* ptr to func returning void */
4586 #if TRY & 8
4587         void *hue;              /* generic ptr */
4588 #endif
4589 #if TRY & 2
4590         void (*foo[10])();
4591 #endif
4592
4593 #if TRY & 4
4594         if(goo == moo) {
4595                 exit(0);
4596         }
4597 #endif
4598         exit(0);
4599 }
4600 int main() { sub(); }
4601 EOCP
4602         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4603                 voidflags=$defvoidused
4604         echo "Good.  It appears to support void to the level $package wants.">&4
4605                 if $contains warning .out >/dev/null 2>&1; then
4606                         echo "However, you might get some warnings that look like this:"
4607                         $cat .out
4608                 fi
4609         else
4610 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4611                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4612                         echo "It supports 1..."
4613                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4614                                 echo "It also supports 2..."
4615                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4616                                         voidflags=7
4617                                         echo "And it supports 4 but not 8 definitely."
4618                                 else
4619                                         echo "It doesn't support 4..."
4620                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4621                                                 voidflags=11
4622                                                 echo "But it supports 8."
4623                                         else
4624                                                 voidflags=3
4625                                                 echo "Neither does it support 8."
4626                                         fi
4627                                 fi
4628                         else
4629                                 echo "It does not support 2..."
4630                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4631                                         voidflags=13
4632                                         echo "But it supports 4 and 8."
4633                                 else
4634                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4635                                                 voidflags=5
4636                                                 echo "And it supports 4 but has not heard about 8."
4637                                         else
4638                                                 echo "However it supports 8 but not 4."
4639                                         fi
4640                                 fi
4641                         fi
4642                 else
4643                         echo "There is no support at all for void."
4644                         voidflags=0
4645                 fi
4646         fi
4647 esac
4648 case "$voidflags" in
4649 "$defvoidused") ;;
4650 *)      $cat >&4 <<'EOM'
4651   Support flag bits are:
4652     1: basic void declarations.
4653     2: arrays of pointers to functions returning void.
4654     4: operations between pointers to and addresses of void functions.
4655     8: generic void pointers.
4656 EOM
4657         dflt="$voidflags";
4658         rp="Your void support flags add up to what?"
4659         . ./myread
4660         voidflags="$ans"
4661         ;;
4662 esac
4663 $rm -f try.* .out
4664
4665 : check for length of pointer
4666 echo " "
4667 case "$ptrsize" in
4668 '')
4669         echo "Checking to see how big your pointers are..." >&4
4670         if test "$voidflags" -gt 7; then
4671                 echo '#define VOID_PTR char *' > try.c
4672         else
4673                 echo '#define VOID_PTR void *' > try.c
4674         fi
4675         $cat >>try.c <<'EOCP'
4676 #include <stdio.h>
4677 int main()
4678 {
4679     printf("%d\n", (int)sizeof(VOID_PTR));
4680     exit(0);
4681 }
4682 EOCP
4683         set try
4684         if eval $compile_ok; then
4685                 ptrsize=`./try`
4686                 echo "Your pointers are $ptrsize bytes long."
4687         else
4688                 dflt='4'
4689                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4690                 rp="What is the size of a pointer (in bytes)?"
4691                 . ./myread
4692                 ptrsize="$ans"
4693         fi
4694         ;;
4695 esac
4696 $rm -f try.c try
4697
4698 : check for long long
4699 echo " "
4700 echo "Checking to see if you have long long..." >&4
4701 echo 'int main() { long long x = 7; return 0; }' > try.c
4702 set try
4703 if eval $compile; then
4704         val="$define"
4705         echo "You have long long."
4706 else
4707         val="$undef"
4708         echo "You do not have long long."
4709 fi
4710 $rm try.*
4711 set d_longlong
4712 eval $setvar
4713
4714 : check for length of long long
4715 case "${d_longlong}${longlongsize}" in
4716 $define)
4717         echo " "
4718         echo "Checking to see how big your long longs are..." >&4
4719         $cat >try.c <<'EOCP'
4720 #include <stdio.h>
4721 int main()
4722 {
4723     printf("%d\n", (int)sizeof(long long));
4724     return(0);
4725 }
4726 EOCP
4727         set try
4728         if eval $compile_ok; then
4729                 longlongsize=`./try$exe_ext`
4730                 echo "Your long longs are $longlongsize bytes long."
4731         else
4732                 dflt='8'
4733                 echo " "
4734                 echo "(I can't seem to compile the test program.  Guessing...)"
4735                 rp="What is the size of a long long (in bytes)?"
4736                 . ./myread
4737                 longlongsize="$ans"
4738         fi
4739         if $test "X$longsize" = "X$longlongsize"; then
4740                 echo "(That isn't any different from an ordinary long.)"
4741         fi      
4742         ;;
4743 esac
4744 $rm -f try.* try
4745
4746 : determine filename position in cpp output
4747 echo " "
4748 echo "Computing filename position in cpp output for #include directives..." >&4
4749 echo '#include <stdio.h>' > foo.c
4750 $cat >fieldn <<EOF
4751 $startsh
4752 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4753 $grep '^[       ]*#.*stdio\.h' | \
4754 while read cline; do
4755         pos=1
4756         set \$cline
4757         while $test \$# -gt 0; do
4758                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4759                         echo "\$pos"
4760                         exit 0
4761                 fi
4762                 shift
4763                 pos=\`expr \$pos + 1\`
4764         done
4765 done
4766 EOF
4767 chmod +x fieldn
4768 fieldn=`./fieldn`
4769 $rm -f foo.c fieldn
4770 case $fieldn in
4771 '') pos='???';;
4772 1) pos=first;;
4773 2) pos=second;;
4774 3) pos=third;;
4775 *) pos="${fieldn}th";;
4776 esac
4777 echo "Your cpp writes the filename in the $pos field of the line."
4778
4779 : locate header file
4780 $cat >findhdr <<EOF
4781 $startsh
4782 wanted=\$1
4783 name=''
4784 for usrincdir in $usrinc
4785 do
4786         if test -f \$usrincdir/\$wanted; then
4787                 echo "\$usrincdir/\$wanted"
4788                 exit 0
4789         fi
4790 done
4791 awkprg='{ print \$$fieldn }'
4792 echo "#include <\$wanted>" > foo\$\$.c
4793 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4794 $grep "^[       ]*#.*\$wanted" | \
4795 while read cline; do
4796         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4797         case "\$name" in
4798         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4799         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4800         *) exit 2;;
4801         esac;
4802 done;
4803 #
4804 # status = 0: grep returned 0 lines, case statement not executed
4805 # status = 1: headerfile found
4806 # status = 2: while loop executed, no headerfile found
4807 #
4808 status=\$?
4809 $rm -f foo\$\$.c;
4810 if test \$status -eq 1; then
4811         exit 0;
4812 fi
4813 exit 1
4814 EOF
4815 chmod +x findhdr
4816
4817 : define an alternate in-header-list? function
4818 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4819 cont=true; xxf="echo \"<\$1> found.\" >&4";
4820 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4821 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4822 esac;
4823 case $# in 4) instead=instead;; *) instead="at last";; esac;
4824 while $test "$cont"; do
4825         xxx=`./findhdr $1`
4826         var=$2; eval "was=\$$2";
4827         if $test "$xxx" && $test -r "$xxx";
4828         then eval $xxf;
4829         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4830                 cont="";
4831         else eval $xxnf;
4832         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4833         set $yyy; shift; shift; yyy=$@;
4834         case $# in 0) cont="";;
4835         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4836                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4837         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4838                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4839         esac;
4840 done;
4841 while $test "$yyy";
4842 do set $yyy; var=$2; eval "was=\$$2";
4843         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4844         set $yyy; shift; shift; yyy=$@;
4845 done'
4846
4847 : see if inttypes.h is available
4848 : we want a real compile instead of Inhdr because some systems
4849 : have an inttypes.h which includes non-existent headers
4850 echo " "
4851 $cat >try.c <<EOCP
4852 #include <inttypes.h>
4853 int main() {
4854         static int32_t foo32 = 0x12345678;
4855 }
4856 EOCP
4857 set try
4858 if eval $compile; then
4859         echo "<inttypes.h> found." >&4
4860         val="$define"
4861 else
4862         echo "<inttypes.h> NOT found." >&4
4863         val="$undef"
4864 fi
4865 $rm -f try.c try
4866 set i_inttypes
4867 eval $setvar
4868
4869 : check for int64_t
4870 echo " "
4871 echo "Checking to see if you have int64_t..." >&4
4872 $cat >try.c <<EOCP
4873 #include <sys/types.h>
4874 #$i_inttypes I_INTTYPES
4875 #ifdef I_INTTYPES
4876 #include <inttypes.h>
4877 #endif
4878 int main() { int64_t x = 7; }
4879 EOCP
4880 set try
4881 if eval $compile; then
4882         val="$define"
4883         echo "You have int64_t."
4884 else
4885         val="$undef"
4886         echo "You do not have int64_t."
4887 fi
4888 $rm -f try try.*
4889 set d_int64_t
4890 eval $setvar
4891
4892
4893 echo " "
4894 echo "Checking which 64-bit integer type we could use..." >&4
4895
4896 case "$intsize" in
4897 8) val=int
4898    set quadtype
4899    eval $setvar
4900    val='"unsigned int"'
4901    set uquadtype
4902    eval $setvar
4903    quadkind=1
4904    ;;
4905 *) case "$longsize" in
4906    8) val=long
4907       set quadtype
4908       eval $setvar
4909       val='"unsigned long"'
4910       set uquadtype
4911       eval $setvar
4912       quadkind=2
4913       ;;
4914    *) case "$d_longlong:$longlongsize" in
4915       define:8)
4916         val='"long long"'
4917         set quadtype
4918         eval $setvar
4919         val='"unsigned long long"'
4920         set uquadtype
4921         eval $setvar
4922         quadkind=3
4923         ;;
4924       *) case "$d_int64_t" in
4925          define)
4926            val=int64_t
4927            set quadtype
4928            eval $setvar
4929            val=uint64_t
4930            set uquadtype
4931            eval $setvar
4932            quadkind=4
4933            ;;
4934          esac
4935          ;;
4936       esac
4937       ;;
4938    esac
4939    ;;
4940 esac
4941
4942 case "$quadtype" in
4943 '')     echo "Alas, no 64-bit integer types in sight." >&4
4944         d_quad="$undef"
4945         ;;
4946 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4947         d_quad="$define"
4948         ;;
4949 esac
4950
4951
4952 case "$uselonglong" in
4953 "$define"|true|[yY]*)
4954         cat <<EOM >&4
4955
4956 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4957 EOM
4958         use64bitint="$define"
4959         ;;
4960 esac                          
4961 case "$use64bits" in
4962 "$define"|true|[yY]*)
4963         cat <<EOM >&4
4964
4965 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4966 EOM
4967         use64bitint="$define"
4968         ;;
4969 esac                          
4970 case "$use64bitints" in
4971 "$define"|true|[yY]*)
4972         cat <<EOM >&4
4973
4974 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4975 EOM
4976         use64bitint="$define"
4977         ;;
4978 esac                          
4979 case "$use64bitsint" in
4980 "$define"|true|[yY]*)
4981         cat <<EOM >&4
4982
4983 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4984 EOM
4985         use64bitint="$define"
4986         ;;
4987 esac                          
4988 case "$uselonglongs" in
4989 "$define"|true|[yY]*)
4990         cat <<EOM >&4
4991
4992 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4993 EOM
4994         use64bitint="$define"
4995         ;;
4996 esac                          
4997 case "$use64bitsall" in
4998 "$define"|true|[yY]*)
4999         cat <<EOM >&4
5000
5001 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5002 EOM
5003         use64bitall="$define"
5004         ;;
5005 esac                          
5006
5007 case "$ccflags" in
5008 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5009 esac
5010 case "$use64bitall" in
5011 "$define"|true|[yY]*) use64bitint="$define" ;;
5012 esac
5013
5014 case "$longsize" in
5015 8) cat <<EOM
5016
5017 You have natively 64-bit long integers.
5018 EOM
5019    val="$define"
5020    ;;
5021 *) case "$use64bitint" in
5022    "$define"|true|[yY]*) dflt='y';;
5023    *) dflt='n';;
5024    esac
5025    case "$d_quad" in
5026    "$define") ;;
5027    *) dflt='n' ;;
5028    esac
5029    cat <<EOM
5030
5031 Perl can be built to take advantage of 64-bit integer types
5032 on some systems.  To do so, Configure can be run with -Duse64bitint.
5033 Choosing this option will most probably introduce binary incompatibilities.
5034
5035 If this doesn't make any sense to you, just accept the default '$dflt'.
5036 (The default has been chosen based on your configuration.)
5037 EOM
5038    rp='Try to use 64-bit integers, if available?'
5039    . ./myread
5040    case "$ans" in
5041    [yY]*) val="$define" ;;
5042    *)     val="$undef"  ;;
5043    esac
5044    ;;
5045 esac
5046 set use64bitint
5047 eval $setvar
5048
5049 case "$use64bitall" in
5050 "$define"|true|[yY]*) dflt='y' ;;
5051 *) case "$longsize" in
5052    8) dflt='y' ;;
5053    *) dflt='n' ;;
5054    esac
5055    ;;
5056 esac    
5057 cat <<EOM
5058
5059 You may also choose to try maximal 64-bitness.  It means using as much
5060 64-bitness as possible on the platform.  This in turn means even more
5061 binary incompatibilities.  On the other hand, your platform may not
5062 have any more 64-bitness available than what you already have chosen.
5063
5064 If this doesn't make any sense to you, just accept the default '$dflt'.
5065 (The default has been chosen based on your configuration.)
5066 EOM
5067 rp='Try to use maximal 64-bit support, if available?'
5068 . ./myread
5069 case "$ans" in
5070 [yY]*) val="$define" ;;
5071 *)     val="$undef"  ;;
5072 esac
5073 set use64bitall
5074 eval $setvar
5075 case "$use64bitall" in
5076 "$define")
5077         case "$use64bitint" in
5078         "$undef")
5079                 cat <<EOM
5080
5081 Since you have chosen a maximally 64-bit build, I'm also turning on
5082 the use of 64-bit integers.
5083 EOM
5084                 use64bitint="$define" ;;
5085         esac
5086         ;;
5087 esac
5088
5089 case "$use64bitall" in
5090 "$define"|true|[yY]*)
5091         case "$ptrsize" in
5092         4)      cat <<EOM >&4
5093
5094 *** You have chosen a maximally 64-bit build, but your pointers
5095 *** are only 4 bytes wide, disabling maximal 64-bitness.
5096
5097 EOM
5098                 use64bitall="$undef"
5099                 case "$use64bitint" in
5100                 "$define"|true|[yY]*) ;;
5101                 *)      cat <<EOM >&4
5102
5103 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5104
5105 EOM
5106                         use64bitint="$define"
5107                         ;;
5108                 esac
5109                 ;;
5110         esac
5111         ;;
5112 esac
5113
5114 case "$use64bitint" in
5115 "$define"|true|[yY]*)
5116 : Look for a hint-file generated 'call-back-unit'.  If the
5117 : user has specified that a 64-bit perl is to be built,
5118 : we may need to set or change some other defaults.
5119         if $test -f use64bitint.cbu; then
5120                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5121                 . ./use64bitint.cbu
5122         fi
5123         case "$longsize" in
5124         4) case "$archname64" in
5125            '') archname64=64int ;;
5126            esac
5127            ;;
5128         esac
5129         ;;
5130 esac
5131
5132 case "$use64bitall" in
5133 "$define"|true|[yY]*)
5134 : Look for a hint-file generated 'call-back-unit'.  If the
5135 : user has specified that a maximally 64-bit perl is to be built,
5136 : we may need to set or change some other defaults.
5137         if $test -f use64bitall.cbu; then
5138                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5139                 . ./use64bitall.cbu
5140         fi
5141         case "$longsize" in
5142         4) case "$archname64" in
5143            ''|64int) archname64=64all ;;
5144            esac
5145            ;;
5146         esac
5147         ;;
5148 esac
5149
5150 echo " "
5151 echo "Checking for GNU C Library..." >&4
5152 cat >gnulibc.c <<EOM
5153 #include <stdio.h>
5154 int main()
5155 {
5156 #ifdef __GLIBC__
5157     exit(0);
5158 #else
5159     exit(1);
5160 #endif
5161 }
5162 EOM
5163 set gnulibc
5164 if eval $compile_ok && ./gnulibc; then
5165         val="$define"
5166         echo "You are using the GNU C Library"
5167 else
5168         val="$undef"
5169         echo "You are not using the GNU C Library"
5170 fi
5171 $rm -f gnulibc*
5172 set d_gnulibc
5173 eval $setvar
5174
5175 : see if nm is to be used to determine whether a symbol is defined or not
5176 case "$usenm" in
5177 '')
5178         dflt=''
5179         case "$d_gnulibc" in
5180         "$define")
5181                 echo " "
5182                 echo "nm probably won't work on the GNU C Library." >&4
5183                 dflt=n
5184                 ;;
5185         esac
5186         case "$dflt" in
5187         '') 
5188                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5189                         echo " "
5190                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5191                         echo "'nm' won't be sufficient on this sytem." >&4
5192                         dflt=n
5193                 fi
5194                 ;;
5195         esac
5196         case "$dflt" in
5197         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5198                 if $test $dflt -gt 20; then
5199                         dflt=y
5200                 else
5201                         dflt=n
5202                 fi
5203                 ;;
5204         esac
5205         ;;
5206 *)
5207         case "$usenm" in
5208         true|$define) dflt=y;;
5209         *) dflt=n;;
5210         esac
5211         ;;
5212 esac
5213 $cat <<EOM
5214
5215 I can use $nm to extract the symbols from your C libraries. This
5216 is a time consuming task which may generate huge output on the disk (up
5217 to 3 megabytes) but that should make the symbols extraction faster. The
5218 alternative is to skip the 'nm' extraction part and to compile a small
5219 test program instead to determine whether each symbol is present. If
5220 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5221 this may be the best solution.
5222
5223 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5224
5225 EOM
5226 rp="Shall I use $nm to extract C symbols from the libraries?"
5227 . ./myread
5228 case "$ans" in
5229 [Nn]*) usenm=false;;
5230 *) usenm=true;;
5231 esac
5232
5233 runnm=$usenm
5234 case "$reuseval" in
5235 true) runnm=false;;
5236 esac
5237
5238 : nm options which may be necessary
5239 case "$nm_opt" in
5240 '') if $test -f /mach_boot; then
5241                 nm_opt=''       # Mach
5242         elif $test -d /usr/ccs/lib; then
5243                 nm_opt='-p'     # Solaris (and SunOS?)
5244         elif $test -f /dgux; then
5245                 nm_opt='-p'     # DG-UX
5246         elif $test -f /lib64/rld; then
5247                 nm_opt='-p'     # 64-bit Irix
5248         else
5249                 nm_opt=''
5250         fi;;
5251 esac
5252
5253 : nm options which may be necessary for shared libraries but illegal
5254 : for archive libraries.  Thank you, Linux.
5255 case "$nm_so_opt" in
5256 '')     case "$myuname" in
5257         *linux*)
5258                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5259                         nm_so_opt='--dynamic'
5260                 fi
5261                 ;;
5262         esac
5263         ;;
5264 esac
5265
5266 case "$runnm" in
5267 true)
5268 : get list of predefined functions in a handy place
5269 echo " "
5270 case "$libc" in
5271 '') libc=unknown
5272         case "$libs" in
5273         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5274         esac
5275         ;;
5276 esac
5277 libnames='';
5278 case "$libs" in
5279 '') ;;
5280 *)  for thislib in $libs; do
5281         case "$thislib" in
5282         -lc|-lc_s)
5283                 : Handle C library specially below.
5284                 ;;
5285         -l*)
5286                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5287                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5288                         :
5289                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5290                         :
5291                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5292                         :
5293                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5294                         :
5295                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5296                         :
5297                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5298                         :
5299                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5300                         :
5301                 else
5302                         try=''
5303                 fi
5304                 libnames="$libnames $try"
5305                 ;;
5306         *) libnames="$libnames $thislib" ;;
5307         esac
5308         done
5309         ;;
5310 esac
5311 xxx=normal
5312 case "$libc" in
5313 unknown)
5314         set /lib/libc.$so
5315         for xxx in $libpth; do
5316                 $test -r $1 || set $xxx/libc.$so
5317                 : The messy sed command sorts on library version numbers.
5318                 $test -r $1 || \
5319                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5320                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5321                                 h
5322                                 s/[0-9][0-9]*/0000&/g
5323                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5324                                 G
5325                                 s/\n/ /' | \
5326                          $sort | $sed -e 's/^.* //'`
5327                 eval set \$$#
5328         done
5329         $test -r $1 || set /usr/ccs/lib/libc.$so
5330         $test -r $1 || set /lib/libsys_s$_a
5331         ;;
5332 *)
5333         set blurfl
5334         ;;
5335 esac
5336 if $test -r "$1"; then
5337         echo "Your (shared) C library seems to be in $1."
5338         libc="$1"
5339 elif $test -r /lib/libc && $test -r /lib/clib; then
5340         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5341         xxx=apollo
5342         libc='/lib/clib /lib/libc'
5343         if $test -r /lib/syslib; then
5344                 echo "(Your math library is in /lib/syslib.)"
5345                 libc="$libc /lib/syslib"
5346         fi
5347 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5348         echo "Your C library seems to be in $libc, as you said before."
5349 elif $test -r $incpath/usr/lib/libc$_a; then
5350         libc=$incpath/usr/lib/libc$_a;
5351         echo "Your C library seems to be in $libc.  That's fine."
5352 elif $test -r /lib/libc$_a; then
5353         libc=/lib/libc$_a;
5354         echo "Your C library seems to be in $libc.  You're normal."
5355 else
5356         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5357                 :
5358         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5359                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5360         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5361                 :
5362         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5363                 :
5364         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5365                 :
5366         else
5367                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5368         fi
5369         if $test -r "$tans"; then
5370                 echo "Your C library seems to be in $tans, of all places."
5371                 libc=$tans
5372         else
5373                 libc='blurfl'
5374         fi
5375 fi
5376 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5377         dflt="$libc"
5378         cat <<EOM
5379
5380 If the guess above is wrong (which it might be if you're using a strange
5381 compiler, or your machine supports multiple models), you can override it here.
5382
5383 EOM
5384 else
5385         dflt=''
5386         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5387         cat >&4 <<EOM
5388 I can't seem to find your C library.  I've looked in the following places:
5389
5390 EOM
5391         $sed 's/^/      /' libpath
5392         cat <<EOM
5393
5394 None of these seems to contain your C library. I need to get its name...
5395
5396 EOM
5397 fi
5398 fn=f
5399 rp='Where is your C library?'
5400 . ./getfile
5401 libc="$ans"
5402
5403 echo " "
5404 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5405 set X `cat libnames`
5406 shift
5407 xxx=files
5408 case $# in 1) xxx=file; esac
5409 echo "Extracting names from the following $xxx for later perusal:" >&4
5410 echo " "
5411 $sed 's/^/      /' libnames >&4
5412 echo " "
5413 $echo $n "This may take a while...$c" >&4
5414
5415 for file in $*; do
5416         case $file in
5417         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5418         *) $nm $nm_opt $file 2>/dev/null;;
5419         esac
5420 done >libc.tmp
5421
5422 $echo $n ".$c"
5423 $grep fprintf libc.tmp > libc.ptf
5424 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5425 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5426 xxx='[ADTSIW]'
5427 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5428         eval $xscan;\
5429         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5430                 eval $xrun
5431 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5432         eval $xscan;\
5433         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5434                 eval $xrun
5435 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5436         eval $xscan;\
5437         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5438                 eval $xrun
5439 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5440         eval $xscan;\
5441         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5442                 eval $xrun
5443 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5444         eval $xscan;\
5445         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5446                 eval $xrun
5447 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5448         eval $xscan;\
5449         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5450                 eval $xrun
5451 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5452                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5453         eval $xscan;\
5454         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5455                 eval $xrun
5456 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5457         eval $xscan;\
5458         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5459                 eval $xrun
5460 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5461         eval $xscan;\
5462         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5463                 eval $xrun
5464 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5465         eval $xscan;\
5466         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5467                 eval $xrun
5468 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5469         eval $xscan;\
5470         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5471                 eval $xrun
5472 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5473         eval $xscan;\
5474         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5475                 eval $xrun
5476 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5477         eval $xscan;\
5478         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5479                 eval $xrun
5480 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5481         eval $xscan;\
5482         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5483                 eval $xrun
5484 else
5485         $nm -p $* 2>/dev/null >libc.tmp
5486         $grep fprintf libc.tmp > libc.ptf
5487         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5488                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5489         then
5490                 nm_opt='-p'
5491                 eval $xrun
5492         else
5493                 echo " "
5494                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5495                 com=''
5496                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5497                         for thisname in $libnames $libc; do
5498                                 $ar t $thisname >>libc.tmp
5499                         done
5500                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5501                         echo "Ok." >&4
5502                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5503                         # Repeat libc to extract forwarders to DLL entries too
5504                         for thisname in $libnames $libc; do
5505                                 $ar tv $thisname >>libc.tmp
5506                                 # Revision 50 of EMX has bug in $ar.
5507                                 # it will not extract forwarders to DLL entries
5508                                 # Use emximp which will extract exactly them.
5509                                 emximp -o tmp.imp $thisname \
5510                                     2>/dev/null && \
5511                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5512                                     < tmp.imp >>libc.tmp
5513                                 $rm tmp.imp
5514                         done
5515                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5516                         echo "Ok." >&4
5517                 else
5518                         echo "$ar didn't seem to work right." >&4
5519                         echo "Maybe this is a Cray...trying bld instead..." >&4
5520                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5521                         then
5522                                 for thisname in $libnames; do
5523                                         bld t $libnames | \
5524                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5525                                         $ar t $thisname >>libc.tmp
5526                                 done
5527                                 echo "Ok." >&4
5528                         else
5529                                 echo "That didn't work either.  Giving up." >&4
5530                                 exit 1
5531                         fi
5532                 fi
5533         fi
5534 fi
5535 nm_extract="$com"
5536 if $test -f /lib/syscalls.exp; then
5537         echo " "
5538         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5539         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5540 fi
5541 ;;
5542 esac
5543 $rm -f libnames libpath
5544
5545 : is a C symbol defined?
5546 csym='tlook=$1;
5547 case "$3" in
5548 -v) tf=libc.tmp; tc=""; tdc="";;
5549 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5550 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5551 esac;
5552 tx=yes;
5553 case "$reuseval-$4" in
5554 true-) ;;
5555 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5556 esac;
5557 case "$tx" in
5558 yes)
5559         case "$runnm" in
5560         true)
5561                 if $contains $tlook $tf >/dev/null 2>&1;
5562                 then tval=true;
5563                 else tval=false;
5564                 fi;;
5565         *)
5566                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5567                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5568                 then tval=true;
5569                 else tval=false;
5570                 fi;
5571                 $rm -f t t.c;;
5572         esac;;
5573 *)
5574         case "$tval" in
5575         $define) tval=true;;
5576         *) tval=false;;
5577         esac;;
5578 esac;
5579 eval "$2=$tval"'
5580
5581 : define an is-in-libc? function
5582 inlibc='echo " "; td=$define; tu=$undef;
5583 sym=$1; var=$2; eval "was=\$$2";
5584 tx=yes;
5585 case "$reuseval$was" in
5586 true) ;;
5587 true*) tx=no;;
5588 esac;
5589 case "$tx" in
5590 yes)
5591         set $sym tres -f;
5592         eval $csym;
5593         case "$tres" in
5594         true)
5595                 echo "$sym() found." >&4;
5596                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5597         *)
5598                 echo "$sym() NOT found." >&4;
5599                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5600         esac;;
5601 *)
5602         case "$was" in
5603         $define) echo "$sym() found." >&4;;
5604         *) echo "$sym() NOT found." >&4;;
5605         esac;;
5606 esac'
5607
5608 : see if sqrtl exists
5609 set sqrtl d_sqrtl
5610 eval $inlibc
5611
5612 case "$ccflags" in
5613 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5614 esac
5615
5616 case "$uselongdouble" in
5617 $define|true|[yY]*)     dflt='y';;
5618 *) dflt='n';;
5619 esac
5620 cat <<EOM
5621
5622 Perl can be built to take advantage of long doubles which
5623 (if available) may give more accuracy and range for floating point numbers.
5624
5625 If this doesn't make any sense to you, just accept the default '$dflt'.
5626 EOM
5627 rp='Try to use long doubles if available?'
5628 . ./myread
5629 case "$ans" in
5630 y|Y)    val="$define"   ;;
5631 *)      val="$undef"    ;;
5632 esac
5633 set uselongdouble
5634 eval $setvar
5635
5636 case "$uselongdouble" in
5637 true|[yY]*) uselongdouble="$define" ;;
5638 esac
5639
5640 case "$uselongdouble" in
5641 $define)
5642 : Look for a hint-file generated 'call-back-unit'.  If the
5643 : user has specified that long doubles should be used,
5644 : we may need to set or change some other defaults.
5645         if $test -f uselongdouble.cbu; then
5646                 echo "Your platform has some specific hints for long doubles, using them..."
5647                 . ./uselongdouble.cbu
5648         else
5649                 $cat <<EOM
5650 (Your platform doesn't have any specific hints for long doubles.)
5651 EOM
5652         fi
5653         ;;
5654 esac
5655
5656 case "$uselongdouble:$d_sqrtl" in
5657 $define:$undef)
5658                 $cat <<EOM >&4
5659
5660 *** You requested the use of long doubles but you do not seem to have
5661 *** the mathematic functions for long doubles.  I'm disabling the use
5662 *** of long doubles.
5663
5664 EOM
5665         uselongdouble=$undef
5666         ;;
5667 esac
5668
5669 : check for length of double
5670 echo " "
5671 case "$doublesize" in
5672 '')
5673         echo "Checking to see how big your double precision numbers are..." >&4
5674         $cat >try.c <<'EOCP'
5675 #include <stdio.h>
5676 int main()
5677 {
5678     printf("%d\n", (int)sizeof(double));
5679     exit(0);
5680 }
5681 EOCP
5682         set try
5683         if eval $compile_ok; then
5684                 doublesize=`./try`
5685                 echo "Your double is $doublesize bytes long."
5686         else
5687                 dflt='8'
5688                 echo "(I can't seem to compile the test program.  Guessing...)"
5689                 rp="What is the size of a double precision number (in bytes)?"
5690                 . ./myread
5691                 doublesize="$ans"
5692         fi
5693         ;;
5694 esac
5695 $rm -f try.c try
5696
5697 : check for long doubles
5698 echo " "
5699 echo "Checking to see if you have long double..." >&4
5700 echo 'int main() { long double x = 7.0; }' > try.c
5701 set try
5702 if eval $compile; then
5703         val="$define"
5704         echo "You have long double."
5705 else
5706         val="$undef"
5707         echo "You do not have long double."
5708 fi
5709 $rm try.*
5710 set d_longdbl
5711 eval $setvar
5712
5713 : check for length of long double
5714 case "${d_longdbl}${longdblsize}" in
5715 $define)
5716         echo " "
5717         echo "Checking to see how big your long doubles are..." >&4
5718         $cat >try.c <<'EOCP'
5719 #include <stdio.h>
5720 int main()
5721 {
5722         printf("%d\n", sizeof(long double));
5723 }
5724 EOCP
5725         set try
5726         set try
5727         if eval $compile; then
5728                 longdblsize=`./try$exe_ext`
5729                 echo "Your long doubles are $longdblsize bytes long."
5730         else
5731                 dflt='8'
5732                 echo " "
5733                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5734                 rp="What is the size of a long double (in bytes)?"
5735                 . ./myread
5736                 longdblsize="$ans"
5737         fi
5738         if $test "X$doublesize" = "X$longdblsize"; then
5739                 echo "(That isn't any different from an ordinary double.)"
5740         fi      
5741         ;;
5742 esac
5743 $rm -f try.* try
5744
5745 case "$useperlio" in
5746 $define|true|[yY]*|'')  dflt='y';;
5747 *) dflt='n';;
5748 esac
5749 cat <<EOM
5750
5751 Previous version of $package used the standard IO mechanisms as
5752 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5753 alternate IO mechanisms via the PerlIO abstraction layer, but the
5754 stdio mechanism is still available if needed.  The abstraction layer
5755 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5756 Using PerlIO with sfio may cause problems with some extension modules.
5757
5758 If this doesn't make any sense to you, just accept the default '$dflt'.
5759 EOM
5760 rp='Use the PerlIO abstraction layer?'
5761 . ./myread
5762 case "$ans" in
5763 y|Y) 
5764         val="$define"
5765         ;;
5766 *)      
5767         echo "Ok, doing things the stdio way."
5768         val="$undef"
5769         ;;
5770 esac
5771 set useperlio
5772 eval $setvar 
5773
5774 case "$usesocks" in
5775 $define|true|[yY]*)
5776         case "$useperlio" in
5777         $define|true|[yY]*) ;;
5778         *)      cat >&4 <<EOM
5779
5780 You are using the SOCKS proxy protocol library which means that you
5781 should also use the PerlIO layer.  You may be headed for trouble.
5782
5783 EOM
5784                 ;;
5785         esac
5786         ;;
5787 esac
5788
5789         
5790 : determine the architecture name
5791 echo " "
5792 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5793         tarch=`arch`"-$osname"
5794 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5795         if uname -m > tmparch 2>&1 ; then
5796                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5797                         -e 's/$/'"-$osname/" tmparch`
5798         else
5799                 tarch="$osname"
5800         fi
5801         $rm -f tmparch
5802 else
5803         tarch="$osname"
5804 fi
5805 case "$myarchname" in
5806 ''|"$tarch") ;;
5807 *)
5808         echo "(Your architecture name used to be $myarchname.)"
5809         archname=''
5810         ;;
5811 esac
5812 myarchname="$tarch"
5813 case "$archname" in
5814 '') dflt="$tarch";;
5815 *) dflt="$archname";;
5816 esac
5817 rp='What is your architecture name'
5818 . ./myread
5819 archname="$ans"
5820 case "$usethreads" in
5821 $define)
5822         echo "Threads selected." >&4
5823         case "$archname" in
5824         *-thread*) echo "...and architecture name already has -thread." >&4
5825                 ;;
5826         *)      archname="$archname-thread"
5827                 echo "...setting architecture name to $archname." >&4
5828                 ;;
5829         esac
5830         ;;
5831 esac
5832 case "$usemultiplicity" in
5833 $define)
5834         echo "Multiplicity selected." >&4
5835         case "$archname" in
5836         *-multi*) echo "...and architecture name already has -multi." >&4
5837                 ;;
5838         *)      archname="$archname-multi"
5839                 echo "...setting architecture name to $archname." >&4
5840                 ;;
5841         esac
5842         ;;
5843 esac
5844 case "$use64bitint$use64bitall" in
5845 *"$define"*)
5846         case "$archname64" in
5847         '')
5848                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5849                 ;;
5850         *)
5851                 case "$use64bitint" in
5852                 "$define") echo "64 bit integers selected." >&4 ;;
5853                 esac
5854                 case "$use64bitall" in
5855                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5856                 esac
5857                 case "$archname" in
5858                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5859                         ;;
5860                 *)      archname="$archname-$archname64"
5861                         echo "...setting architecture name to $archname." >&4
5862                         ;;
5863                 esac
5864                 ;;
5865         esac
5866 esac
5867 case "$uselongdouble" in
5868 $define)
5869         echo "Long doubles selected." >&4
5870         case "$longdblsize" in
5871         $doublesize)
5872                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5873                 ;;
5874         *)
5875                 case "$archname" in
5876                 *-ld*) echo "...and architecture name already has -ld." >&4
5877                         ;;
5878                 *)      archname="$archname-ld"
5879                         echo "...setting architecture name to $archname." >&4
5880                         ;;
5881                 esac
5882                 ;;
5883         esac
5884         ;;
5885 esac
5886 case "$useperlio" in
5887 $define)
5888         echo "Perlio selected." >&4
5889         ;;
5890 *)
5891         echo "Perlio not selected, using stdio." >&4
5892         case "$archname" in
5893         *-stdio*) echo "...and architecture name already has -stdio." >&4
5894                 ;;
5895         *)      archname="$archname-stdio"
5896                 echo "...setting architecture name to $archname." >&4
5897                 ;;
5898         esac
5899         ;;
5900 esac
5901
5902 : determine root of directory hierarchy where package will be installed.
5903 case "$prefix" in
5904 '')
5905         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5906         ;;
5907 *)
5908         dflt="$prefix"
5909         ;;
5910 esac
5911 $cat <<EOM
5912
5913 By default, $package will be installed in $dflt/bin, manual pages
5914 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5915 installation directories. Typically this is something like /usr/local.
5916 If you wish to have binaries under /usr/bin but other parts of the
5917 installation under /usr/local, that's ok: you will be prompted
5918 separately for each of the installation directories, the prefix being
5919 only used to set the defaults.
5920
5921 EOM
5922 fn=d~
5923 rp='Installation prefix to use?'
5924 . ./getfile
5925 oldprefix=''
5926 case "$prefix" in
5927 '') ;;
5928 *)
5929         case "$ans" in
5930         "$prefix") ;;
5931         *) oldprefix="$prefix";;
5932         esac
5933         ;;
5934 esac
5935 prefix="$ans"
5936 prefixexp="$ansexp"
5937
5938 case "$afsroot" in
5939 '')     afsroot=/afs ;;
5940 *)      afsroot=$afsroot ;;
5941 esac
5942
5943 : is AFS running?
5944 echo " "
5945 case "$afs" in
5946 $define|true)   afs=true ;;
5947 $undef|false)   afs=false ;;
5948 *)      if test -d $afsroot; then
5949                 afs=true
5950         else
5951                 afs=false
5952         fi
5953         ;;
5954 esac
5955 if $afs; then
5956         echo "AFS may be running... I'll be extra cautious then..." >&4
5957 else
5958         echo "AFS does not seem to be running..." >&4
5959 fi
5960
5961 : determine installation prefix for where package is to be installed.
5962 if $afs; then 
5963 $cat <<EOM
5964
5965 Since you are running AFS, I need to distinguish the directory in which
5966 files will reside from the directory in which they are installed (and from
5967 which they are presumably copied to the former directory by occult means).
5968
5969 EOM
5970         case "$installprefix" in
5971         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5972         *) dflt="$installprefix";;
5973         esac
5974 else
5975 $cat <<EOM
5976
5977 In some special cases, particularly when building $package for distribution,
5978 it is convenient to distinguish between the directory in which files should 
5979 be installed from the directory ($prefix) in which they 
5980 will eventually reside.  For most users, these two directories are the same.
5981
5982 EOM
5983         case "$installprefix" in
5984         '') dflt=$prefix ;;
5985         *) dflt=$installprefix;;
5986         esac
5987 fi
5988 fn=d~
5989 rp='What installation prefix should I use for installing files?'
5990 . ./getfile
5991 installprefix="$ans"
5992 installprefixexp="$ansexp"
5993
5994 : set the prefixit variable, to compute a suitable default value
5995 prefixit='case "$3" in
5996 ""|none)
5997         case "$oldprefix" in
5998         "") eval "$1=\"\$$2\"";;
5999         *)
6000                 case "$3" in
6001                 "") eval "$1=";;
6002                 none)
6003                         eval "tp=\"\$$2\"";
6004                         case "$tp" in
6005                         ""|" ") eval "$1=\"\$$2\"";;
6006                         *) eval "$1=";;
6007                         esac;;
6008                 esac;;
6009         esac;;
6010 *)
6011         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6012         case "$tp" in
6013         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6014         /*-$oldprefix/*|\~*-$oldprefix/*)
6015                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6016         *) eval "$1=\"\$$2\"";;
6017         esac;;
6018 esac'
6019
6020
6021 : get the patchlevel
6022 echo " "
6023 echo "Getting the current patchlevel..." >&4
6024 if $test -r $rsrc/patchlevel.h;then
6025         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6026         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6027         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6028         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6029         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6030         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6031        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6032 else
6033         revision=0
6034         patchlevel=0
6035         subversion=0
6036         api_revision=0
6037         api_version=0
6038         api_subversion=0
6039         perl_patchlevel=0
6040         $echo "(You do not have patchlevel.h.  Eek.)"
6041 fi
6042 if $test -r $rsrc/.patch ; then  
6043         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6044                 perl_patchlevel=`cat $rsrc/.patch`
6045         fi
6046 fi
6047 case "$perl_patchlevel" in
6048 0)  ;;
6049 '') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
6050 *)  $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
6051 esac
6052 case "$osname" in
6053 dos|vms)
6054         : XXX Should be a Configure test for double-dots in filenames.
6055         version=`echo $revision $patchlevel $subversion | \
6056                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6057         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6058                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6059         ;;
6060 *)
6061         version=`echo $revision $patchlevel $subversion | \
6062                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6063         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6064                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6065         ;;
6066 esac
6067 : Special case the 5.005_xx maintenance series, which used 5.005
6068 : without any subversion label as a subdirectory in $sitelib
6069 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6070         api_versionstring='5.005'
6071 fi
6072
6073 : determine installation style
6074 : For now, try to deduce it from prefix unless it is already set.
6075 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6076 case "$installstyle" in
6077 '')     case "$prefix" in
6078                 *perl*) dflt='lib';;
6079                 *) dflt='lib/perl5' ;;
6080         esac
6081         ;;
6082 *)      dflt="$installstyle" ;;
6083 esac
6084 : Probably not worth prompting for this since we prompt for all
6085 : the directories individually, and the prompt would be too long and
6086 : confusing anyway.
6087 installstyle=$dflt
6088
6089 : determine where private library files go
6090 : Usual default is /usr/local/lib/perl5/$version.
6091 : Also allow things like /opt/perl/lib/$version, since 
6092 : /opt/perl/lib/perl5... would be redundant.
6093 : The default "style" setting is made in installstyle.U
6094 case "$installstyle" in
6095 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6096 *)       set dflt privlib lib/$version ;;
6097 esac
6098 eval $prefixit
6099 $cat <<EOM
6100
6101 There are some auxiliary files for $package that need to be put into a
6102 private library directory that is accessible by everyone.
6103
6104 EOM
6105 fn=d~+
6106 rp='Pathname where the private library files will reside?'
6107 . ./getfile
6108 privlib="$ans"
6109 privlibexp="$ansexp"
6110 : Change installation prefix, if necessary.
6111 if $test X"$prefix" != X"$installprefix"; then
6112         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6113 else
6114         installprivlib="$privlibexp"
6115 fi
6116
6117 : set the prefixup variable, to restore leading tilda escape
6118 prefixup='case "$prefixexp" in
6119 "$prefix") ;;
6120 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6121 esac'
6122
6123 : determine where public architecture dependent libraries go
6124 set archlib archlib
6125 eval $prefixit
6126 : privlib default is /usr/local/lib/$package/$version
6127 : archlib default is /usr/local/lib/$package/$version/$archname
6128 : privlib may have an optional trailing /share.
6129 tdflt=`echo $privlib | $sed 's,/share$,,'`
6130 tdflt=$tdflt/$archname
6131 case "$archlib" in
6132 '')     dflt=$tdflt
6133         ;;
6134 *)      dflt="$archlib"
6135     ;;
6136 esac
6137 $cat <<EOM
6138
6139 $spackage contains architecture-dependent library files.  If you are
6140 sharing libraries in a heterogeneous environment, you might store
6141 these files in a separate location.  Otherwise, you can just include
6142 them with the rest of the public library files.
6143
6144 EOM
6145 fn=d+~
6146 rp='Where do you want to put the public architecture-dependent libraries?'
6147 . ./getfile
6148 archlib="$ans"
6149 archlibexp="$ansexp"
6150 if $test X"$archlib" = X"$privlib"; then
6151         d_archlib="$undef"
6152 else
6153         d_archlib="$define"
6154 fi
6155 : Change installation prefix, if necessary.
6156 if $test X"$prefix" != X"$installprefix"; then
6157         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6158 else
6159         installarchlib="$archlibexp"
6160 fi
6161
6162
6163 : Binary compatibility with 5.005 is not possible for builds
6164 : with advanced features
6165 case "$usethreads$usemultiplicity" in
6166 *define*)
6167         bincompat5005="$undef"
6168         d_bincompat5005="$undef"
6169         ;;
6170 *)      $cat <<EOM
6171
6172 This version of Perl can be compiled for binary compatibility with 5.005.
6173 If you decide to do so, you will be able to continue using most of the
6174 extensions that were compiled for Perl 5.005.
6175
6176 EOM
6177         case "$bincompat5005$d_bincompat5005" in
6178         *"$undef"*) dflt=n ;;
6179         *) dflt=y ;;
6180         esac
6181         rp='Binary compatibility with Perl 5.005?'
6182         . ./myread
6183         case "$ans" in
6184         y*) val="$define" ;;
6185         *)  val="$undef" ;;
6186         esac
6187         set d_bincompat5005
6188         eval $setvar
6189         case "$d_bincompat5005" in
6190         "$define")
6191                 bincompat5005="$define"
6192                 ;;
6193         *)      bincompat5005="$undef"
6194                 d_bincompat5005="$undef"
6195                 ;;
6196         esac
6197         ;;
6198 esac
6199
6200
6201 : see if setuid scripts can be secure
6202 $cat <<EOM
6203
6204 Some kernels have a bug that prevents setuid #! scripts from being
6205 secure.  Some sites have disabled setuid #! scripts because of this.
6206
6207 First let's decide if your kernel supports secure setuid #! scripts.
6208 (If setuid #! scripts would be secure but have been disabled anyway,
6209 don't say that they are secure if asked.)
6210
6211 EOM
6212
6213 val="$undef"
6214 if $test -d /dev/fd; then
6215         echo "#!$ls" >reflect
6216         chmod +x,u+s reflect
6217         ./reflect >flect 2>&1
6218         if $contains "/dev/fd" flect >/dev/null; then
6219                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6220                 val="$define"
6221         else
6222                 $cat <<EOM
6223 If you are not sure if they are secure, I can check but I'll need a
6224 username and password different from the one you are using right now.
6225 If you don't have such a username or don't want me to test, simply
6226 enter 'none'.
6227
6228 EOM
6229                 rp='Other username to test security of setuid scripts with?'
6230                 dflt='none'
6231                 . ./myread
6232                 case "$ans" in
6233                 n|none)
6234                         case "$d_suidsafe" in
6235                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6236                                 dflt=n;;
6237                         "$undef")
6238                                 echo "Well, the $hint value is *not* secure." >&4
6239                                 dflt=n;;
6240                         *)      echo "Well, the $hint value *is* secure." >&4
6241                                 dflt=y;;
6242                         esac
6243                         ;;
6244                 *)
6245                         $rm -f reflect flect
6246                         echo "#!$ls" >reflect
6247                         chmod +x,u+s reflect
6248                         echo >flect
6249                         chmod a+w flect
6250                         echo '"su" will (probably) prompt you for '"$ans's password."
6251                         su $ans -c './reflect >flect'
6252                         if $contains "/dev/fd" flect >/dev/null; then
6253                                 echo "Okay, it looks like setuid scripts are secure." >&4
6254                                 dflt=y
6255                         else
6256                                 echo "I don't think setuid scripts are secure." >&4
6257                                 dflt=n
6258                         fi
6259                         ;;
6260                 esac
6261                 rp='Does your kernel have *secure* setuid scripts?'
6262                 . ./myread
6263                 case "$ans" in
6264                 [yY]*)  val="$define";;
6265                 *)      val="$undef";;
6266                 esac
6267         fi
6268 else
6269         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6270         echo "(That's for file descriptors, not floppy disks.)"
6271         val="$undef"
6272 fi
6273 set d_suidsafe
6274 eval $setvar
6275
6276 $rm -f reflect flect
6277
6278 : now see if they want to do setuid emulation
6279 echo " "
6280 val="$undef"
6281 case "$d_suidsafe" in
6282 "$define")
6283         val="$undef"
6284         echo "No need to emulate SUID scripts since they are secure here." >& 4
6285         ;;
6286 *)
6287         $cat <<EOM
6288 Some systems have disabled setuid scripts, especially systems where
6289 setuid scripts cannot be secure.  On systems where setuid scripts have
6290 been disabled, the setuid/setgid bits on scripts are currently
6291 useless.  It is possible for $package to detect those bits and emulate
6292 setuid/setgid in a secure fashion.  This emulation will only work if
6293 setuid scripts have been disabled in your kernel.
6294
6295 EOM
6296         case "$d_dosuid" in
6297         "$define") dflt=y ;;
6298         *) dflt=n ;;
6299         esac
6300         rp="Do you want to do setuid/setgid emulation?"
6301         . ./myread
6302         case "$ans" in
6303         [yY]*)  val="$define";;
6304         *)      val="$undef";;
6305         esac
6306         ;;
6307 esac
6308 set d_dosuid
6309 eval $setvar
6310
6311 : see if this is a malloc.h system
6312 set malloc.h i_malloc
6313 eval $inhdr
6314
6315 : see if stdlib is available
6316 set stdlib.h i_stdlib
6317 eval $inhdr
6318
6319 : determine which malloc to compile in
6320 echo " "
6321 case "$usemymalloc" in
6322 [yY]*|true|$define)     dflt='y' ;;
6323 [nN]*|false|$undef)     dflt='n' ;;
6324 *)      case "$ptrsize" in
6325         4) dflt='y' ;;
6326         *) dflt='n' ;;
6327         esac
6328         ;;
6329 esac
6330 rp="Do you wish to attempt to use the malloc that comes with $package?"
6331 . ./myread
6332 usemymalloc="$ans"
6333 case "$ans" in
6334 y*|true)
6335         usemymalloc='y'
6336         mallocsrc='malloc.c'
6337         mallocobj="malloc$_o"
6338         d_mymalloc="$define"
6339         case "$libs" in
6340         *-lmalloc*)
6341                 : Remove malloc from list of libraries to use
6342                 echo "Removing unneeded -lmalloc from library list" >&4
6343                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6344                 shift
6345                 libs="$*"
6346                 echo "libs = $libs" >&4
6347                 ;;
6348         esac
6349         ;;
6350 *)
6351         usemymalloc='n'
6352         mallocsrc=''
6353         mallocobj=''
6354         d_mymalloc="$undef"
6355         ;;
6356 esac
6357
6358 : compute the return types of malloc and free
6359 echo " "
6360 $cat >malloc.c <<END
6361 #$i_malloc I_MALLOC
6362 #$i_stdlib I_STDLIB
6363 #include <stdio.h>
6364 #include <sys/types.h>
6365 #ifdef I_MALLOC
6366 #include <malloc.h>
6367 #endif
6368 #ifdef I_STDLIB
6369 #include <stdlib.h>
6370 #endif
6371 #ifdef TRY_MALLOC
6372 void *malloc();
6373 #endif
6374 #ifdef TRY_FREE
6375 void free();
6376 #endif
6377 END
6378 case "$malloctype" in
6379 '')
6380         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6381                 malloctype='void *'
6382         else
6383                 malloctype='char *'
6384         fi
6385         ;;
6386 esac
6387 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6388
6389 case "$freetype" in
6390 '')
6391         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6392                 freetype='void'
6393         else
6394                 freetype='int'
6395         fi
6396         ;;
6397 esac
6398 echo "Your system uses $freetype free(), it would seem." >&4
6399 $rm -f malloc.[co]
6400 $cat <<EOM
6401
6402 After $package is installed, you may wish to install various
6403 add-on modules and utilities.  Typically, these add-ons will
6404 be installed under $prefix with the rest
6405 of this package.  However, you may wish to install such add-ons
6406 elsewhere under a different prefix.
6407
6408 If you do not wish to put everything under a single prefix, that's
6409 ok.  You will be prompted for the individual locations; this siteprefix
6410 is only used to suggest the defaults.
6411
6412 The default should be fine for most people.
6413
6414 EOM
6415 fn=d~+
6416 rp='Installation prefix to use for add-on modules and utilities?'
6417 : XXX Here might be another good place for an installstyle setting.
6418 case "$siteprefix" in
6419 '') dflt=$prefix ;;
6420 *)  dflt=$siteprefix ;;
6421 esac
6422 . ./getfile
6423 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6424 oldsiteprefix=''
6425 case "$siteprefix" in
6426 '') ;;
6427 *)      case "$ans" in
6428         "$prefix") ;;
6429         *) oldsiteprefix="$prefix";;
6430         esac
6431         ;;
6432 esac
6433 siteprefix="$ans"
6434 siteprefixexp="$ansexp"
6435
6436 : determine where site specific libraries go.
6437 : Usual default is /usr/local/lib/perl5/site_perl/$version
6438 : The default "style" setting is made in installstyle.U
6439 : XXX No longer works with Prefixit stuff.
6440 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6441 case "$sitelib" in
6442 '') case "$installstyle" in
6443         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6444         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6445         esac
6446         ;;
6447 *)      dflt="$sitelib"
6448         ;;
6449 esac
6450 $cat <<EOM
6451
6452 The installation process will create a directory for
6453 site-specific extensions and modules.  Most users find it convenient
6454 to place all site-specific files in this directory rather than in the
6455 main distribution directory.
6456
6457 EOM
6458 fn=d~+
6459 rp='Pathname for the site-specific library files?'
6460 . ./getfile
6461 sitelib="$ans"
6462 sitelibexp="$ansexp"
6463 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6464 : Change installation prefix, if necessary.
6465 if $test X"$prefix" != X"$installprefix"; then
6466         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6467 else
6468         installsitelib="$sitelibexp"
6469 fi
6470
6471 : determine where site specific architecture-dependent libraries go.
6472 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6473 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6474 : sitelib may have an optional trailing /share.
6475 case "$sitearch" in
6476 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6477         dflt="$dflt/$archname"
6478         ;;
6479 *)      dflt="$sitearch"
6480         ;;
6481 esac
6482 set sitearch sitearch none
6483 eval $prefixit
6484 $cat <<EOM
6485
6486 The installation process will also create a directory for
6487 architecture-dependent site-specific extensions and modules.
6488
6489 EOM
6490 fn=d~+
6491 rp='Pathname for the site-specific architecture-dependent library files?'
6492 . ./getfile
6493 sitearch="$ans"
6494 sitearchexp="$ansexp"
6495 : Change installation prefix, if necessary.
6496 if $test X"$prefix" != X"$installprefix"; then
6497         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6498 else
6499         installsitearch="$sitearchexp"
6500 fi
6501
6502 $cat <<EOM
6503
6504 The installation process will also create a directory for
6505 vendor-supplied add-ons.  Vendors who supply perl with their system
6506 may find it convenient to place all vendor-supplied files in this
6507 directory rather than in the main distribution directory.  This will
6508 ease upgrades between binary-compatible maintenance versions of perl.
6509
6510 Of course you may also use these directories in whatever way you see
6511 fit.  For example, you might use them to access modules shared over a
6512 company-wide network.
6513
6514 The default answer should be fine for most people.
6515 This causes further questions about vendor add-ons to be skipped
6516 and no vendor-specific directories will be configured for perl.
6517
6518 EOM
6519 rp='Do you want to configure vendor-specific add-on directories?'
6520 case "$usevendorprefix" in
6521 define|true|[yY]*) dflt=y ;;
6522 *)      : User may have set vendorprefix directly on Configure command line.
6523         case "$vendorprefix" in
6524         ''|' ') dflt=n ;;
6525         *)      dflt=y ;;
6526         esac
6527         ;;
6528 esac
6529 . ./myread
6530 case "$ans" in
6531 [yY]*)  fn=d~+
6532         rp='Installation prefix to use for vendor-supplied add-ons?'
6533         case "$vendorprefix" in
6534         '') dflt='' ;;
6535         *)  dflt=$vendorprefix ;;
6536         esac
6537         . ./getfile
6538         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6539         oldvendorprefix=''
6540         case "$vendorprefix" in
6541         '') ;;
6542         *)      case "$ans" in
6543                 "$prefix") ;;
6544                 *) oldvendorprefix="$prefix";;
6545                 esac
6546                 ;;
6547         esac
6548         usevendorprefix="$define"
6549         vendorprefix="$ans"
6550         vendorprefixexp="$ansexp"
6551         ;;
6552 *)      usevendorprefix="$undef"
6553         vendorprefix=''
6554         vendorprefixexp=''
6555         ;;
6556 esac
6557
6558 case "$vendorprefix" in
6559 '')     d_vendorlib="$undef"
6560         vendorlib=''
6561         vendorlibexp=''
6562         ;;
6563 *)      d_vendorlib="$define"
6564         : determine where vendor-supplied modules go.
6565         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6566         case "$vendorlib" in
6567         '')
6568                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6569                 case "$installstyle" in
6570                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6571                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6572                 esac
6573                 ;;
6574         *)      dflt="$vendorlib"
6575                 ;;
6576         esac
6577         fn=d~+
6578         rp='Pathname for the vendor-supplied library files?'
6579         . ./getfile
6580         vendorlib="$ans"
6581         vendorlibexp="$ansexp"
6582         ;;
6583 esac
6584 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6585 : Change installation prefix, if necessary.
6586 if $test X"$prefix" != X"$installprefix"; then
6587         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6588 else
6589         installvendorlib="$vendorlibexp"
6590 fi
6591
6592 case "$vendorprefix" in
6593 '')     d_vendorarch="$undef"
6594         vendorarch=''
6595         vendorarchexp=''
6596         ;;
6597 *)      d_vendorarch="$define"
6598         : determine where vendor-supplied architecture-dependent libraries go.
6599         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6600         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6601         : vendorlib may have an optional trailing /share.
6602         case "$vendorarch" in
6603         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6604                 dflt="$dflt/$archname"
6605                 ;;
6606         *)      dflt="$vendorarch" ;;
6607         esac
6608         fn=d~+
6609         rp='Pathname for vendor-supplied architecture-dependent files?'
6610         . ./getfile
6611         vendorarch="$ans"
6612         vendorarchexp="$ansexp"
6613         ;;
6614 esac
6615 : Change installation prefix, if necessary.
6616 if $test X"$prefix" != X"$installprefix"; then
6617         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6618 else
6619         installvendorarch="$vendorarchexp"
6620 fi
6621
6622 : Final catch-all directories to search
6623 $cat <<EOM
6624
6625 Lastly, you can have perl look in other directories for extensions and
6626 modules in addition to those already specified.
6627 These directories will be searched after 
6628         $sitearch 
6629         $sitelib 
6630 EOM
6631 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6632 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6633 echo ' '
6634 case "$otherlibdirs" in
6635 ''|' ') dflt='none' ;;
6636 *)      dflt="$otherlibdirs" ;;
6637 esac
6638 $cat <<EOM
6639 Enter a colon-separated set of extra paths to include in perl's @INC
6640 search path, or enter 'none' for no extra paths.
6641
6642 EOM
6643
6644 rp='Colon-separated list of additional directories for perl to search?'
6645 . ./myread
6646 case "$ans" in
6647 ' '|''|none)    otherlibdirs=' ' ;;     
6648 *)      otherlibdirs="$ans" ;;
6649 esac
6650 case "$otherlibdirs" in
6651 ' ') val=$undef ;;
6652 *)      val=$define ;;
6653 esac
6654 set d_perl_otherlibdirs
6655 eval $setvar
6656
6657 : Cruising for prototypes
6658 echo " "
6659 echo "Checking out function prototypes..." >&4
6660 $cat >prototype.c <<'EOCP'
6661 int main(int argc, char *argv[]) {
6662         exit(0);}
6663 EOCP
6664 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6665         echo "Your C compiler appears to support function prototypes."
6666         val="$define"
6667 else
6668         echo "Your C compiler doesn't seem to understand function prototypes."
6669         val="$undef"
6670 fi
6671 set prototype
6672 eval $setvar
6673 $rm -f prototype*
6674
6675 case "$prototype" in
6676 "$define") ;;
6677 *)      ansi2knr='ansi2knr'
6678         echo " "
6679         cat <<EOM >&4
6680
6681 $me:  FATAL ERROR:
6682 This version of $package can only be compiled by a compiler that 
6683 understands function prototypes.  Unfortunately, your C compiler 
6684         $cc $ccflags
6685 doesn't seem to understand them.  Sorry about that.
6686
6687 If GNU cc is available for your system, perhaps you could try that instead.  
6688
6689 Eventually, we hope to support building Perl with pre-ANSI compilers.
6690 If you would like to help in that effort, please contact <perlbug@perl.org>.
6691
6692 Aborting Configure now.
6693 EOM
6694         exit 2
6695         ;;
6696 esac
6697
6698 : determine where public executables go
6699 echo " "
6700 set dflt bin bin
6701 eval $prefixit
6702 fn=d~
6703 rp='Pathname where the public executables will reside?'
6704 . ./getfile
6705 if $test "X$ansexp" != "X$binexp"; then
6706         installbin=''
6707 fi
6708 bin="$ans"
6709 binexp="$ansexp"
6710 : Change installation prefix, if necessary.
6711 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6712 if $test X"$prefix" != X"$installprefix"; then
6713         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6714 else
6715         installbin="$binexp"
6716 fi
6717
6718 : Find perl5.005 or later.
6719 echo "Looking for a previously installed perl5.005 or later... "
6720 case "$perl5" in
6721 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6722                 : Check if this perl is recent and can load a simple module
6723                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6724                         perl5=$tdir/perl
6725                         break;
6726                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6727                         perl5=$tdir/perl5
6728                         break;
6729                 fi
6730         done
6731         ;;
6732 *)      perl5="$perl5"
6733         ;;
6734 esac
6735 case "$perl5" in
6736 '')     echo "None found.  That's ok.";;
6737 *)      echo "Using $perl5." ;;
6738 esac
6739
6740 : Determine list of previous versions to include in @INC
6741 $cat > getverlist <<EOPL
6742 #!$perl5 -w
6743 use File::Basename;
6744 \$api_versionstring = "$api_versionstring";
6745 \$version = "$version";
6746 \$stem = "$sitelib_stem";
6747 \$archname = "$archname";
6748 EOPL
6749         $cat >> getverlist <<'EOPL'
6750 # Can't have leading @ because metaconfig interprets it as a command!
6751 ;@inc_version_list=();
6752 # XXX Redo to do opendir/readdir? 
6753 if (-d $stem) {
6754     chdir($stem);
6755     ;@candidates = glob("5.*");
6756 }
6757 else {
6758     ;@candidates = ();
6759 }
6760
6761 # XXX ToDo:  These comparisons must be reworked when two-digit
6762 # subversions come along, so that 5.7.10 compares as greater than
6763 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6764 # widespread that we can use the built-in version vectors rather
6765 # than reinventing them here.  For 5.6.0, however, we must
6766 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6767 foreach $d (@candidates) {
6768     if ($d lt $version) {
6769         if ($d ge $api_versionstring) {
6770             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6771         }
6772         elsif ($d ge "5.005") {
6773             unshift(@inc_version_list, grep { -d } $d);
6774         }
6775     }
6776     else {
6777         # Skip newer version.  I.e. don't look in
6778         # 5.7.0 if we're installing 5.6.1.
6779     }
6780 }
6781
6782 if (@inc_version_list) {
6783     print join(' ', @inc_version_list);
6784 }
6785 else {
6786     # Blank space to preserve value for next Configure run.
6787     print " ";
6788 }
6789 EOPL
6790 chmod +x getverlist
6791 case "$inc_version_list" in
6792 '')     if test -x "$perl5$exe_ext"; then
6793                 dflt=`$perl5 getverlist`
6794         else
6795                 dflt='none'
6796         fi
6797         ;;
6798 $undef) dflt='none' ;;
6799 *)  eval dflt=\"$inc_version_list\" ;;
6800 esac
6801 case "$dflt" in
6802 ''|' ') dflt=none ;;
6803 esac
6804 case "$dflt" in
6805 5.005) case "$bincompat5005" in
6806        $define|true|[yY]*) ;;
6807        *) dflt=none ;;
6808        esac
6809        ;;
6810 esac
6811 $cat <<'EOM'
6812
6813 In order to ease the process of upgrading, this version of perl 
6814 can be configured to use modules built and installed with earlier 
6815 versions of perl that were installed under $prefix.  Specify here
6816 the list of earlier versions that this version of perl should check.
6817 If Configure detected no earlier versions of perl installed under
6818 $prefix, then the list will be empty.  Answer 'none' to tell perl
6819 to not search earlier versions.
6820
6821 The default should almost always be sensible, so if you're not sure,
6822 just accept the default.
6823 EOM
6824
6825 rp='List of earlier versions to include in @INC?'
6826 . ./myread
6827 case "$ans" in
6828 [Nn]one|''|' ') inc_version_list=' ' ;;
6829 *) inc_version_list="$ans" ;;
6830 esac
6831 case "$inc_version_list" in
6832 ''|' ') 
6833         inc_version_list_init='0';;
6834 *)      inc_version_list_init=`echo $inc_version_list |
6835                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6836         ;;
6837 esac
6838 $rm -f getverlist
6839
6840 : determine whether to install perl also as /usr/bin/perl
6841
6842 echo " "
6843 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6844         $cat <<EOM
6845 Many scripts expect perl to be installed as /usr/bin/perl.
6846 I can install the perl you are about to compile also as /usr/bin/perl
6847 (in addition to $installbin/perl).
6848 EOM
6849         case "$installusrbinperl" in
6850         "$undef"|[nN]*) dflt='n';;
6851         *)              dflt='y';;
6852         esac
6853         rp="Do you want to install perl as /usr/bin/perl?"
6854         . ./myread
6855         case "$ans" in
6856         [yY]*)  val="$define";;
6857         *)      val="$undef" ;;
6858         esac
6859 else
6860         val="$undef"
6861 fi
6862 set installusrbinperl
6863 eval $setvar
6864
6865 : see if dld is available
6866 set dld.h i_dld
6867 eval $inhdr
6868
6869 : see if dlopen exists
6870 xxx_runnm="$runnm"
6871 runnm=false
6872 set dlopen d_dlopen
6873 eval $inlibc
6874 runnm="$xxx_runnm"
6875
6876 : determine which dynamic loading, if any, to compile in
6877 echo " "
6878 dldir="ext/DynaLoader"
6879 case "$usedl" in
6880 $define|y|true)
6881         dflt='y'
6882         usedl="$define"
6883         ;;
6884 $undef|n|false)
6885         dflt='n'
6886         usedl="$undef"
6887         ;;
6888 *) 
6889         dflt='n'
6890         case "$d_dlopen" in
6891             $define) dflt='y' ;;
6892         esac
6893         case "$i_dld" in
6894             $define) dflt='y' ;;
6895         esac
6896         : Does a dl_xxx.xs file exist for this operating system
6897         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6898         ;;
6899 esac
6900 rp="Do you wish to use dynamic loading?"
6901 . ./myread
6902 usedl="$ans"
6903 case "$ans" in
6904 y*) usedl="$define"
6905         case "$dlsrc" in
6906         '')
6907                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6908                         dflt="$dldir/dl_${osname}.xs"
6909                 elif $test "$d_dlopen" = "$define" ; then
6910                         dflt="$dldir/dl_dlopen.xs"
6911                 elif $test "$i_dld" = "$define" ; then
6912                         dflt="$dldir/dl_dld.xs"
6913                 else
6914                         dflt=''
6915                 fi
6916                 ;;
6917         *)      dflt="$dldir/$dlsrc"
6918                 ;;
6919         esac
6920     echo "The following dynamic loading files are available:"
6921         : Can not go over to $dldir because getfile has path hard-coded in.
6922         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6923         rp="Source file to use for dynamic loading"
6924         fn="fne"
6925         gfpth="$src"
6926         . ./getfile
6927         usedl="$define"
6928         : emulate basename
6929         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6930
6931         $cat << EOM
6932
6933 Some systems may require passing special flags to $cc -c to
6934 compile modules that will be used to create a shared library.
6935 To use no flags, say "none".
6936
6937 EOM
6938     case "$cccdlflags" in
6939     '') case "$gccversion" in
6940                 '') case "$osname" in
6941                         hpux)   dflt='+z' ;;
6942                         next)   dflt='none' ;;
6943                         irix*)  dflt='-KPIC' ;;
6944                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6945                         sunos)  dflt='-pic' ;;
6946                         *)      dflt='none' ;;
6947                     esac
6948                         ;;
6949                 *)  case "$osname" in
6950                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6951                         *)      dflt='-fpic' ;;
6952                     esac ;;
6953             esac ;;
6954         ' ') dflt='none' ;;
6955     *)  dflt="$cccdlflags" ;;
6956     esac
6957     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6958     . ./myread
6959     case "$ans" in
6960     none) cccdlflags=' ' ;;
6961     *) cccdlflags="$ans" ;;
6962     esac
6963
6964     cat << EOM
6965
6966 Some systems use ld to create libraries that can be dynamically loaded,
6967 while other systems (such as those using ELF) use $cc.
6968
6969 EOM
6970         case "$ld" in
6971         '')     $cat >try.c <<'EOM'
6972 /* Test for whether ELF binaries are produced */
6973 #include <fcntl.h>
6974 #include <stdlib.h>
6975 int main() {
6976         char b[4];
6977         int i = open("a.out",O_RDONLY);
6978         if(i == -1) 
6979                 exit(1); /* fail */
6980         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6981                 exit(0); /* succeed (yes, it's ELF) */
6982         else
6983                 exit(1); /* fail */
6984 }
6985 EOM
6986                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && ./a.out; then
6987                         cat <<EOM
6988 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6989 EOM
6990                         dflt="$cc"
6991                 else
6992                         echo "I'll use ld to build dynamic libraries."
6993                         dflt='ld'
6994                 fi
6995                 rm -f try.c a.out
6996                 ;;
6997         *)      dflt="$ld"
6998                 ;;
6999         esac
7000
7001     rp="What command should be used to create dynamic libraries?"
7002     . ./myread
7003         ld="$ans"
7004
7005     cat << EOM
7006
7007 Some systems may require passing special flags to $ld to create a
7008 library that can be dynamically loaded.  If your ld flags include
7009 -L/other/path options to locate libraries outside your loader's normal
7010 search path, you may need to specify those -L options here as well.  To
7011 use no flags, say "none".
7012
7013 EOM
7014     case "$lddlflags" in
7015     '') case "$osname" in
7016                         beos) dflt='-nostart' ;;
7017                         hpux) dflt='-b';
7018                               case "$gccversion" in
7019                               '') dflt="$dflt +vnocompatwarnings" ;;
7020                               esac
7021                               ;;        
7022                         linux|irix*)    dflt='-shared' ;;
7023                         next)  dflt='none' ;;
7024                         solaris) dflt='-G' ;;
7025                         sunos) dflt='-assert nodefinitions' ;;
7026                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7027                 *)     dflt='none' ;;
7028                         esac
7029                         ;;
7030     *) dflt="$lddlflags" ;;
7031     esac
7032
7033         : Try to guess additional flags to pick up local libraries.
7034         : Be careful not to append to a plain 'none'
7035         case "$dflt" in
7036         none) dflt='' ;;
7037         esac
7038         for thisflag in $ldflags; do
7039                 case "$thisflag" in
7040                 -L*|-R*)
7041                         case " $dflt " in
7042                         *" $thisflag "*) ;;
7043                         *) dflt="$dflt $thisflag" ;;
7044                         esac
7045                         ;;
7046                 esac
7047         done
7048
7049         case "$dflt" in
7050         ''|' ') dflt='none' ;;
7051         esac
7052
7053     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7054     . ./myread
7055     case "$ans" in
7056     none) lddlflags=' ' ;;
7057     *) lddlflags="$ans" ;;
7058     esac
7059
7060         cat <<EOM
7061
7062 Some systems may require passing special flags to $cc to indicate that
7063 the resulting executable will use dynamic linking.  To use no flags,
7064 say "none".
7065
7066 EOM
7067     case "$ccdlflags" in
7068     '') case "$osname" in
7069                 hpux)   dflt='-Wl,-E' ;;
7070                 linux)  dflt='-rdynamic' ;;
7071                 next)   dflt='none' ;;
7072                 sunos)  dflt='none' ;;
7073                 *)      dflt='none' ;;
7074             esac ;;
7075     ' ')  dflt='none' ;;
7076     *)  dflt="$ccdlflags" ;;
7077     esac
7078     rp="Any special flags to pass to $cc to use dynamic linking?"
7079     . ./myread
7080     case "$ans" in
7081     none) ccdlflags=' ' ;;
7082     *) ccdlflags="$ans" ;;
7083     esac
7084     ;;
7085 *)  usedl="$undef"
7086         ld='ld'
7087     dlsrc='dl_none.xs'
7088     lddlflags=''
7089     ccdlflags=''
7090     ;;
7091 esac
7092
7093 also=''
7094 case "$usedl" in
7095 $undef)
7096         # No dynamic loading being used, so don't bother even to prompt.
7097         useshrplib='false'
7098         ;;
7099 *)      case "$useshrplib" in
7100         '')     case "$osname" in
7101                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7102                         dflt=y
7103                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7104                         ;;
7105                 next*)
7106                         case "$osvers" in
7107                         4*)     dflt=y
7108                                 also='Building a shared libperl is needed for MAB support.'
7109                                 ;;
7110                         *)      dflt=n
7111                                 ;;
7112                         esac
7113                         ;;
7114                 *)      dflt=n
7115                         ;;
7116                 esac
7117                 ;;
7118         $define|true|[Yy]*)
7119                 dflt=y
7120                 ;;
7121         *)      dflt=n
7122                 ;;
7123         esac
7124         $cat << EOM
7125
7126 The perl executable is normally obtained by linking perlmain.c with
7127 libperl${_a}, any static extensions (usually just DynaLoader), and
7128 any other libraries needed on this system (such as -lm, etc.).  Since
7129 your system supports dynamic loading, it is probably possible to build
7130 a shared libperl.$so.  If you will have more than one executable linked
7131 to libperl.$so, this will significantly reduce the size of each
7132 executable, but it may have a noticeable affect on performance.  The
7133 default is probably sensible for your system.
7134 $also
7135
7136 EOM
7137         rp="Build a shared libperl.$so (y/n)"
7138         . ./myread
7139         case "$ans" in
7140         true|$define|[Yy]*)
7141                 useshrplib='true'  ;;
7142         *)      useshrplib='false' ;;
7143         esac
7144         ;;
7145 esac
7146
7147 case "$useshrplib" in
7148 true)
7149         case "$libperl" in
7150         '')
7151                 # Figure out a good name for libperl.so.  Since it gets stored in
7152                 # a version-specific architecture-dependent library, the version
7153                 # number isn't really that important, except for making cc/ld happy.
7154                 #
7155                 # A name such as libperl.so.3.1
7156                 majmin="libperl.$so.$patchlevel.$subversion"
7157                 # A name such as libperl.so.301
7158                 majonly=`echo $patchlevel $subversion |
7159                         $awk '{printf "%d%02d", $1, $2}'`
7160                 majonly=libperl.$so.$majonly
7161                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7162                 # rely on figuring it out from the naming of libc.
7163                 case "${osname}${osvers}" in
7164                 next4*)
7165                         dflt=libperl.5.$so
7166                         # XXX How handle the --version stuff for MAB?
7167                         ;;
7168                 linux*)  # ld won't link with a bare -lperl otherwise.
7169                         dflt=libperl.$so
7170                         ;;
7171                 cygwin*) # include version
7172                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7173                         ;;
7174                 *)      # Try to guess based on whether libc has major.minor.
7175                         case "$libc" in
7176                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7177                         *libc.$so.[0-9]*) dflt=$majonly ;;
7178                         *)      dflt=libperl.$so ;;
7179                         esac
7180                         ;;
7181                 esac
7182                 ;;
7183         *)      dflt=$libperl
7184                 ;;
7185         esac
7186         cat << EOM
7187
7188 I need to select a good name for the shared libperl.  If your system uses
7189 library names with major and minor numbers, then you might want something
7190 like $majmin.  Alternatively, if your system uses a single version
7191 number for shared libraries, then you might want to use $majonly.
7192 Or, your system might be quite happy with a simple libperl.$so.
7193
7194 Since the shared libperl will get installed into a version-specific
7195 architecture-dependent directory, the version number of the shared perl
7196 library probably isn't important, so the default should be o.k.
7197
7198 EOM
7199         rp='What name do you want to give to the shared libperl?'
7200         . ./myread
7201         libperl=$ans
7202         echo "Ok, I'll use $libperl"
7203         ;;
7204 *)
7205         libperl="libperl${_a}"
7206         ;;
7207 esac
7208
7209 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7210 case "$shrpdir" in
7211 '') ;;
7212 *)      $cat >&4 <<EOM
7213 WARNING:  Use of the shrpdir variable for the installation location of
7214 the shared $libperl is not supported.  It was never documented and
7215 will not work in this version.  Let me (perlbug@perl.org)
7216 know of any problems this may cause.
7217
7218 EOM
7219         case "$shrpdir" in
7220         "$archlibexp/CORE")
7221                 $cat >&4 <<EOM
7222 But your current setting of $shrpdir is
7223 the default anyway, so it's harmless.
7224 EOM
7225                 ;;
7226         *)
7227                 $cat >&4 <<EOM
7228 Further, your current attempted setting of $shrpdir
7229 conflicts with the value of $archlibexp/CORE
7230 that installperl will use.
7231 EOM
7232                 ;;
7233         esac
7234         ;;
7235 esac
7236
7237 # How will the perl executable find the installed shared $libperl?
7238 # Add $xxx to ccdlflags.
7239 # If we can't figure out a command-line option, use $shrpenv to
7240 # set env LD_RUN_PATH.  The main perl makefile uses this.
7241 shrpdir=$archlibexp/CORE
7242 xxx=''
7243 tmp_shrpenv=''
7244 if "$useshrplib"; then
7245     case "$osname" in 
7246         aix)
7247                 # We'll set it in Makefile.SH...
7248                 ;;
7249         solaris|netbsd)
7250                 xxx="-R $shrpdir"
7251                 ;;
7252         freebsd)
7253                 xxx="-Wl,-R$shrpdir"
7254                 ;;
7255         linux|irix*|dec_osf)
7256                 xxx="-Wl,-rpath,$shrpdir"
7257                 ;;
7258         next)
7259                 # next doesn't like the default...
7260                 ;;
7261         beos)
7262                 # beos doesn't like the default, either.
7263                 ;;
7264         hpux*)
7265                 # hpux doesn't like the default, either.
7266                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7267                 ;;
7268         *)
7269                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7270                 ;;
7271         esac
7272         case "$xxx" in
7273         '') ;;
7274         *)      
7275                 # Only add $xxx if it isn't already in ccdlflags.
7276                 case " $ccdlflags " in
7277                 *" $xxx "*)     ;;
7278                 *)      ccdlflags="$ccdlflags $xxx"
7279                         cat <<EOM >&4
7280
7281 Adding $xxx to the flags
7282 passed to $ld so that the perl executable will find the 
7283 installed shared $libperl.
7284
7285 EOM
7286                         ;;
7287                 esac
7288                 ;;
7289         esac
7290 fi
7291 # Fix ccdlflags in AIX for building external extensions.
7292 # (For building Perl itself bare -bE:perl.exp is needed,
7293 #  Makefile.SH takes care of this.)
7294 case "$osname" in
7295 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7296 esac
7297 # Respect a hint or command-line value.
7298 case "$shrpenv" in
7299 '') shrpenv="$tmp_shrpenv" ;;
7300 esac
7301 case "$ldlibpthname" in
7302 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7303 none)   ldlibpthname='' ;;
7304 esac
7305
7306 : determine where manual pages are on this system
7307 echo " "
7308 case "$sysman" in
7309 '') 
7310         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7311         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7312         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7313         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7314         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7315         sysman=`./loc . /usr/man/man1 $syspath`
7316         ;;
7317 esac
7318 if $test -d "$sysman"; then
7319         echo "System manual is in $sysman." >&4
7320 else
7321         echo "Could not find manual pages in source form." >&4
7322 fi
7323
7324 : determine where manual pages go
7325 set man1dir man1dir none
7326 eval $prefixit
7327 $cat <<EOM
7328
7329 $spackage has manual pages available in source form.
7330 EOM
7331 case "$nroff" in
7332 nroff)
7333         echo "However, you don't have nroff, so they're probably useless to you."
7334         case "$man1dir" in
7335         '') man1dir="none";;
7336         esac;;
7337 esac
7338 echo "If you don't want the manual sources installed, answer 'none'."
7339 case "$man1dir" in
7340 ' ') dflt=none
7341         ;;
7342 '')
7343         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7344         lookpath="$lookpath $prefixexp/man/p_man/man1"
7345         lookpath="$lookpath $prefixexp/man/u_man/man1"
7346         lookpath="$lookpath $prefixexp/man/man.1"
7347         case "$sysman" in
7348         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7349         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7350         esac
7351         set dflt
7352         eval $prefixup
7353         ;;
7354 *)  dflt="$man1dir"
7355         ;;
7356 esac
7357 echo " "
7358 fn=dn+~
7359 rp="Where do the main $spackage manual pages (source) go?"
7360 . ./getfile
7361 if $test "X$man1direxp" != "X$ansexp"; then
7362         installman1dir=''
7363 fi
7364 man1dir="$ans"
7365 man1direxp="$ansexp"
7366 case "$man1dir" in
7367 '')     man1dir=' '
7368         installman1dir='';;
7369 esac
7370
7371 : Change installation prefix, if necessary.
7372 if $test X"$prefix" != X"$installprefix"; then
7373         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7374 else
7375         installman1dir="$man1direxp"
7376 fi
7377
7378 : What suffix to use on installed man pages
7379
7380 case "$man1dir" in
7381 ' ')
7382         man1ext='0'
7383         ;;
7384 *)
7385         rp="What suffix should be used for the main $spackage man pages?"
7386         case "$man1ext" in
7387         '')     case "$man1dir" in
7388                 *1)  dflt=1 ;;
7389                 *1p) dflt=1p ;;
7390                 *1pm) dflt=1pm ;;
7391                 *l) dflt=l;;
7392                 *n) dflt=n;;
7393                 *o) dflt=o;;
7394                 *p) dflt=p;;
7395                 *C) dflt=C;;
7396                 *L) dflt=L;;
7397                 *L1) dflt=L1;;
7398                 *) dflt=1;;
7399                 esac
7400                 ;;
7401         *)      dflt="$man1ext";;
7402         esac
7403         . ./myread
7404         man1ext="$ans"
7405         ;;
7406 esac
7407
7408 : see if we can have long filenames
7409 echo " "
7410 first=123456789abcdef
7411 $rm -f $first
7412 if (echo hi >$first) 2>/dev/null; then
7413         if $test -f 123456789abcde; then
7414                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7415                 val="$undef"
7416         else
7417                 echo 'You can have filenames longer than 14 characters.'>&4
7418                 val="$define"
7419         fi
7420 else
7421         $cat <<'EOM'
7422 You can't have filenames longer than 14 chars.
7423 You can't even think about them!
7424 EOM
7425         val="$undef"
7426 fi 
7427 set d_flexfnam
7428 eval $setvar
7429 $rm -rf 123456789abcde*
7430
7431 : determine where library module manual pages go
7432 set man3dir man3dir none
7433 eval $prefixit
7434 $cat <<EOM
7435
7436 $spackage has manual pages for many of the library modules.
7437 EOM
7438
7439 case "$nroff" in
7440 nroff)
7441         $cat <<'EOM'
7442 However, you don't have nroff, so they're probably useless to you.
7443 EOM
7444         case "$man3dir" in
7445         '') man3dir="none";;
7446         esac;;
7447 esac
7448
7449 case "$d_flexfnam" in
7450 undef)
7451         $cat <<'EOM'
7452 However, your system can't handle the long file names like File::Basename.3. 
7453 EOM
7454         case "$man3dir" in
7455         '') man3dir="none";;
7456         esac;;
7457 esac
7458
7459 echo "If you don't want the manual sources installed, answer 'none'."
7460 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7461 case "$man3dir" in
7462 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7463         if $test -d "$privlib/man/man3"; then
7464                 cat <<EOM >&4
7465
7466 WARNING:  Previous versions of perl installed man3 pages into
7467 $privlib/man/man3.  This version will suggest a 
7468 new default of $dflt.  
7469 EOM
7470                 tdflt=$dflt
7471                 dflt='n'
7472                 rp='Do you wish to preserve the old behavior?(y/n)'
7473                 . ./myread
7474                 case "$ans" in
7475                 y*) dflt="$privlib/man/man3" ;;
7476                 *)  dflt=$tdflt ;;
7477                 esac
7478     fi
7479         ;;
7480 *)      dflt="$man3dir" ;;
7481 esac
7482 case "$dflt" in
7483 ' ') dflt=none ;;
7484 esac
7485 echo " "
7486 fn=dn+~
7487 rp="Where do the $package library man pages (source) go?"
7488 . ./getfile
7489 man3dir="$ans"
7490 man3direxp="$ansexp"
7491 case "$man3dir" in
7492 '')     man3dir=' '
7493         installman3dir='';;
7494 esac
7495
7496 : Change installation prefix, if necessary.
7497 if $test X"$prefix" != X"$installprefix"; then
7498         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7499 else
7500         installman3dir="$man3direxp"
7501 fi
7502
7503 : What suffix to use on installed man pages
7504 case "$man3dir" in
7505 ' ')
7506         man3ext='0'
7507         ;;
7508 *)
7509         rp="What suffix should be used for the $package library man pages?"
7510         case "$man3ext" in
7511         '')     case "$man3dir" in
7512                 *3)  dflt=3 ;;
7513                 *3p) dflt=3p ;;
7514                 *3pm) dflt=3pm ;;
7515                 *l) dflt=l;;
7516                 *n) dflt=n;;
7517                 *o) dflt=o;;
7518                 *p) dflt=p;;
7519                 *C) dflt=C;;
7520                 *L) dflt=L;;
7521                 *L3) dflt=L3;;
7522                 *) dflt=3;;
7523                 esac
7524                 ;;
7525         *)      dflt="$man3ext";;
7526         esac
7527         . ./myread
7528         man3ext="$ans"
7529         ;;
7530 esac
7531
7532 : see if we have to deal with yellow pages, now NIS.
7533 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7534         if $test -f /usr/etc/nibindd; then
7535                 echo " "
7536                 echo "I'm fairly confident you're on a NeXT."
7537                 echo " "
7538                 rp='Do you get the hosts file via NetInfo?'
7539                 dflt=y
7540                 case "$hostcat" in
7541                 nidump*) ;;
7542                 '') ;;
7543                 *) dflt=n;;
7544                 esac
7545                 . ./myread
7546                 case "$ans" in
7547                 y*) hostcat='nidump hosts .';;
7548                 *)      case "$hostcat" in
7549                         nidump*) hostcat='';;
7550                         esac
7551                         ;;
7552                 esac
7553         fi
7554         case "$hostcat" in
7555         nidump*) ;;
7556         *)
7557                 case "$hostcat" in
7558                 *ypcat*) dflt=y;;
7559                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7560                                 dflt=y
7561                         else
7562                                 dflt=n
7563                         fi;;
7564                 *) dflt=n;;
7565                 esac
7566                 echo " "
7567                 rp='Are you getting the hosts file via yellow pages?'
7568                 . ./myread
7569                 case "$ans" in
7570                 y*) hostcat='ypcat hosts';;
7571                 *) hostcat='cat /etc/hosts';;
7572                 esac
7573                 ;;
7574         esac
7575 fi
7576 case "$hostcat" in
7577 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7578 esac
7579 case "$groupcat" in
7580 '') test -f /etc/group && groupcat='cat /etc/group';;
7581 esac
7582 case "$passcat" in
7583 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7584 esac
7585
7586 : now get the host name
7587 echo " "
7588 echo "Figuring out host name..." >&4
7589 case "$myhostname" in
7590 '') cont=true
7591         echo 'Maybe "hostname" will work...'
7592         if tans=`sh -c hostname 2>&1` ; then
7593                 myhostname=$tans
7594                 phostname=hostname
7595                 cont=''
7596         fi
7597         ;;
7598 *) cont='';;
7599 esac
7600 if $test "$cont"; then
7601         if ./xenix; then
7602                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7603                 if tans=`cat /etc/systemid 2>&1` ; then
7604                         myhostname=$tans
7605                         phostname='cat /etc/systemid'
7606                         echo "Whadyaknow.  Xenix always was a bit strange..."
7607                         cont=''
7608                 fi
7609         elif $test -r /etc/systemid; then
7610                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7611         fi
7612 fi
7613 if $test "$cont"; then
7614         echo 'No, maybe "uuname -l" will work...'
7615         if tans=`sh -c 'uuname -l' 2>&1` ; then
7616                 myhostname=$tans
7617                 phostname='uuname -l'
7618         else
7619                 echo 'Strange.  Maybe "uname -n" will work...'
7620                 if tans=`sh -c 'uname -n' 2>&1` ; then
7621                         myhostname=$tans
7622                         phostname='uname -n'
7623                 else
7624                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7625                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7626                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7627                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7628                         else
7629                                 case "$myhostname" in
7630                                 '') echo "Does this machine have an identity crisis or something?"
7631                                         phostname='';;
7632                                 *)
7633                                         echo "Well, you said $myhostname before..."
7634                                         phostname='echo $myhostname';;
7635                                 esac
7636                         fi
7637                 fi
7638         fi
7639 fi
7640 : you do not want to know about this
7641 set $myhostname
7642 myhostname=$1
7643
7644 : verify guess
7645 if $test "$myhostname" ; then
7646         dflt=y
7647         rp='Your host name appears to be "'$myhostname'".'" Right?"
7648         . ./myread
7649         case "$ans" in
7650         y*) ;;
7651         *) myhostname='';;
7652         esac
7653 fi
7654
7655 : bad guess or no guess
7656 while $test "X$myhostname" = X ; do
7657         dflt=''
7658         rp="Please type the (one word) name of your host:"
7659         . ./myread
7660         myhostname="$ans"
7661 done
7662
7663 : translate upper to lower if necessary
7664 case "$myhostname" in
7665 *[A-Z]*)
7666         echo "(Normalizing case in your host name)"
7667         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7668         ;;
7669 esac
7670
7671 case "$myhostname" in
7672 *.*)
7673         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7674         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7675         echo "(Trimming domain name from host name--host name is now $myhostname)"
7676         ;;
7677 *) case "$mydomain" in
7678         '')
7679                 {
7680                         test "X$hostcat" = "Xypcat hosts" &&
7681                         ypmatch "$myhostname" hosts 2>/dev/null |\
7682                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7683                         $test -s hosts
7684                 } || {
7685                         test "X$hostcat" != "X" &&
7686                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7687                                         /[       ]$myhostname[  . ]/p" > hosts
7688                 }
7689                 tmp_re="[       . ]"
7690                 if $test -f hosts; then
7691                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7692                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7693                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7694                                 hosts | $sort | $uniq | \
7695                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7696                         case `$echo X$dflt` in
7697                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7698                                 dflt=.
7699                                 ;;
7700                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7701                                 ;;
7702                         esac
7703                 else
7704                         echo "(I cannot locate a hosts database anywhere)"
7705                         dflt=.
7706                 fi
7707                 case "$dflt" in
7708                 .)
7709                         tans=`./loc resolv.conf X /etc /usr/etc`
7710                         if $test -f "$tans"; then
7711                                 echo "(Attempting domain name extraction from $tans)"
7712                                 dflt=.`$sed -n -e 's/   / /g' \
7713                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7714                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7715                                 case "$dflt" in
7716                                 .) dflt=.`$sed -n -e 's/        / /g' \
7717                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7718                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7719                                         ;;
7720                                 esac
7721                         fi
7722                         ;;
7723                 esac
7724                 case "$dflt" in
7725                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7726                         dflt=.`sh -c domainname 2>/dev/null`
7727                         case "$dflt" in
7728                         '') dflt='.';;
7729                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7730                         esac
7731                         ;;
7732                 esac
7733                 case "$dflt$osname" in
7734                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7735                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7736                         ;;
7737                 esac
7738                 case "$dflt" in
7739                 .) echo "(Lost all hope -- silly guess then)"
7740                         dflt='.uucp'
7741                         ;;
7742                 esac
7743                 $rm -f hosts
7744                 ;;
7745         *) dflt="$mydomain";;
7746         esac;;
7747 esac
7748 echo " "
7749 rp="What is your domain name?"
7750 . ./myread
7751 tans="$ans"
7752 case "$ans" in
7753 '') ;;
7754 .*) ;;
7755 *) tans=".$tans";;
7756 esac
7757 mydomain="$tans"
7758
7759 : translate upper to lower if necessary
7760 case "$mydomain" in
7761 *[A-Z]*)
7762         echo "(Normalizing case in your domain name)"
7763         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7764         ;;
7765 esac
7766
7767 : a little sanity check here
7768 case "$phostname" in
7769 '') ;;
7770 *)
7771         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7772         $myhostname$mydomain|$myhostname) ;;
7773         *)
7774                 case "$phostname" in
7775                 sed*)
7776                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7777                         ;;
7778                 *)
7779                         echo "(That doesn't agree with your $phostname command, by the way.)"
7780                         ;;
7781                 esac
7782         ;;
7783         esac
7784         ;;
7785 esac
7786
7787 $cat <<EOM
7788
7789 I need to get your e-mail address in Internet format if possible, i.e.
7790 something like user@host.domain. Please answer accurately since I have
7791 no easy means to double check it. The default value provided below
7792 is most probably close to reality but may not be valid from outside
7793 your organization...
7794
7795 EOM
7796 cont=x
7797 while test "$cont"; do
7798         case "$cf_email" in
7799         '') dflt="$cf_by@$myhostname$mydomain";;
7800         *) dflt="$cf_email";;
7801         esac
7802         rp='What is your e-mail address?'
7803         . ./myread
7804         cf_email="$ans"
7805         case "$cf_email" in
7806         *@*.*) cont='' ;;
7807         *)
7808                 rp='Address does not look like an Internet one.  Use it anyway?'
7809                 case "$fastread" in
7810                 yes) dflt=y ;;
7811                 *) dflt=n ;;
7812                 esac
7813                 . ./myread
7814                 case "$ans" in
7815                 y*) cont='' ;;
7816                 *) echo " " ;;
7817                 esac
7818                 ;;
7819         esac
7820 done
7821
7822 $cat <<EOM
7823
7824 If you or somebody else will be maintaining perl at your site, please
7825 fill in the correct e-mail address here so that they may be contacted
7826 if necessary. Currently, the "perlbug" program included with perl
7827 will send mail to this address in addition to perlbug@perl.org. You may
7828 enter "none" for no administrator.
7829
7830 EOM
7831 case "$perladmin" in
7832 '') dflt="$cf_email";;
7833 *) dflt="$perladmin";;
7834 esac
7835 rp='Perl administrator e-mail address'
7836 . ./myread
7837 perladmin="$ans"
7838
7839 : determine whether to only install version-specific parts.
7840 echo " "
7841 $cat <<EOM
7842 Do you want to install only the version-specific parts of the perl
7843 distribution?  Usually you do *not* want to do this.
7844 EOM
7845 case "$versiononly" in
7846 "$define"|[Yy]*|true) dflt='y' ;;
7847 *) dflt='n';
7848 esac
7849 rp="Do you want to install only the version-specific parts of perl?"
7850 . ./myread
7851 case "$ans" in
7852 [yY]*)  val="$define";;
7853 *)      val="$undef" ;;
7854 esac
7855 set versiononly
7856 eval $setvar
7857
7858 : figure out how to guarantee perl startup
7859 case "$startperl" in
7860 '')
7861         case "$sharpbang" in
7862         *!)
7863                 $cat <<EOH
7864
7865 I can use the #! construct to start perl on your system. This will
7866 make startup of perl scripts faster, but may cause problems if you
7867 want to share those scripts and perl is not in a standard place
7868 ($binexp/perl) on all your platforms. The alternative is to force
7869 a shell by starting the script with a single ':' character.
7870
7871 EOH
7872                 case "$versiononly" in
7873                 "$define")      dflt="$binexp/perl$version";;  
7874                 *)              dflt="$binexp/perl";;
7875                 esac
7876                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7877                 . ./myread
7878                 case "$ans" in
7879                 none)   startperl=": # use perl";;
7880                 *)      startperl="#!$ans"
7881                         if $test 30 -lt `echo "$ans" | wc -c`; then
7882                                 $cat >&4 <<EOM
7883
7884 WARNING:  Some systems limit the #! command to 32 characters.
7885 If you experience difficulty running Perl scripts with #!, try
7886 installing Perl in a directory with a shorter pathname.
7887
7888 EOM
7889                         fi ;;
7890                 esac
7891                 ;;
7892         *) startperl=": # use perl"
7893                 ;;
7894         esac
7895         ;;
7896 esac
7897 echo "I'll use $startperl to start perl scripts."
7898
7899 : figure best path for perl in scripts
7900 case "$perlpath" in
7901 '')
7902         perlpath="$binexp/perl"
7903         case "$startperl" in
7904         *!*) ;;
7905         *)
7906                 $cat <<EOH
7907
7908 I will use the "eval 'exec'" idiom to start Perl on your system.
7909 I can use the full path of your Perl binary for this purpose, but
7910 doing so may cause problems if you want to share those scripts and
7911 Perl is not always in a standard place ($binexp/perl).
7912
7913 EOH
7914                 dflt="$binexp/perl"
7915                 rp="What path shall I use in \"eval 'exec'\"?"
7916                 . ./myread
7917                 perlpath="$ans"
7918                 ;;
7919         esac
7920         ;;
7921 esac
7922 case "$startperl" in
7923 *!*)    ;;
7924 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7925 esac
7926
7927 : determine where public executable scripts go
7928 set scriptdir scriptdir
7929 eval $prefixit
7930 case "$scriptdir" in
7931 '')
7932         dflt="$bin"
7933         : guess some guesses
7934         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7935         $test -d /usr/share/bin     && dflt=/usr/share/bin
7936         $test -d /usr/local/script  && dflt=/usr/local/script
7937         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7938         $test -d $prefixexp/script  && dflt=$prefixexp/script
7939         set dflt
7940         eval $prefixup
7941         ;;
7942 *)  dflt="$scriptdir"
7943         ;;
7944 esac
7945 $cat <<EOM
7946  
7947 Some installations have a separate directory just for executable scripts so
7948 that they can mount it across multiple architectures but keep the scripts in
7949 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7950 Or you might just lump your scripts in with all your other executables.
7951  
7952 EOM
7953 fn=d~
7954 rp='Where do you keep publicly executable scripts?'
7955 . ./getfile
7956 if $test "X$ansexp" != "X$scriptdirexp"; then
7957         installscript=''
7958 fi
7959 scriptdir="$ans"
7960 scriptdirexp="$ansexp"
7961 : Change installation prefix, if necessary.
7962 if $test X"$prefix" != X"$installprefix"; then
7963         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7964 else
7965         installscript="$scriptdirexp"
7966 fi
7967
7968 : determine where add-on public executables go
7969 case "$sitebin" in
7970 '')     dflt=$siteprefix/bin ;;
7971 *)      dflt=$sitebin ;;
7972 esac
7973 fn=d~
7974 rp='Pathname where the add-on public executables should be installed?'
7975 . ./getfile
7976 sitebin="$ans"
7977 sitebinexp="$ansexp"
7978 : Change installation prefix, if necessary.
7979 if $test X"$prefix" != X"$installprefix"; then
7980         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7981 else
7982         installsitebin="$sitebinexp"
7983 fi
7984
7985 case "$vendorprefix" in
7986 '')     d_vendorbin="$undef"
7987         vendorbin=''
7988         vendorbinexp=''
7989         ;;
7990 *)      d_vendorbin="$define"
7991         : determine where vendor-supplied executables go.
7992         case "$vendorbin" in
7993         '') dflt=$vendorprefix/bin ;;
7994         *)      dflt="$vendorbin" ;;
7995         esac
7996         fn=d~+
7997         rp='Pathname for the vendor-supplied executables directory?'
7998         . ./getfile
7999         vendorbin="$ans"
8000         vendorbinexp="$ansexp"
8001         ;;
8002 esac
8003 : Change installation prefix, if necessary.
8004 if $test X"$prefix" != X"$installprefix"; then
8005         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8006 else
8007         installvendorbin="$vendorbinexp"
8008 fi
8009
8010 : see if qgcvt exists
8011 set qgcvt d_qgcvt
8012 eval $inlibc
8013
8014 echo " "
8015
8016 if $test X"$d_longdbl" = X"$define"; then
8017
8018 echo "Checking how to print long doubles..." >&4
8019
8020 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8021         $cat >try.c <<'EOCP'
8022 #include <sys/types.h>
8023 #include <stdio.h>
8024 int main() {
8025   double d = 123.456;
8026   printf("%.3f\n", d);
8027 }
8028 EOCP
8029         set try
8030         if eval $compile; then
8031                 yyy=`./try$exe_ext`
8032                 case "$yyy" in
8033                 123.456)
8034                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8035                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8036                         echo "We will use %f."
8037                         ;;
8038                 esac
8039         fi
8040 fi
8041
8042 if $test X"$sPRIfldbl" = X; then
8043         $cat >try.c <<'EOCP'
8044 #include <sys/types.h>
8045 #include <stdio.h>
8046 int main() {
8047   long double d = 123.456;
8048   printf("%.3Lf\n", d);
8049 }
8050 EOCP
8051         set try
8052         if eval $compile; then
8053                 yyy=`./try$exe_ext`
8054                 case "$yyy" in
8055                 123.456)
8056                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8057                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8058                         echo "We will use %Lf."
8059                         ;;
8060                 esac
8061         fi
8062 fi
8063
8064 if $test X"$sPRIfldbl" = X; then
8065         $cat >try.c <<'EOCP'
8066 #include <sys/types.h>
8067 #include <stdio.h>
8068 int main() {
8069   long double d = 123.456;
8070   printf("%.3llf\n", d);
8071 }
8072 EOCP
8073         set try
8074         if eval $compile; then
8075                 yyy=`./try$exe_ext`
8076                 case "$yyy" in
8077                 123.456)
8078                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8079                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8080                         echo "We will use %llf."
8081                         ;;
8082                 esac
8083         fi
8084 fi
8085
8086 if $test X"$sPRIfldbl" = X; then
8087         $cat >try.c <<'EOCP'
8088 #include <sys/types.h>
8089 #include <stdio.h>
8090 int main() {
8091   long double d = 123.456;
8092   printf("%.3lf\n", d);
8093 }
8094 EOCP
8095         set try
8096         if eval $compile; then
8097                 yyy=`./try$exe_ext`
8098                 case "$yyy" in
8099                 123.456)
8100                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8101                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8102                         echo "We will use %lf."
8103                         ;;
8104                 esac
8105         fi
8106 fi
8107
8108 if $test X"$sPRIfldbl" = X; then
8109         echo "Cannot figure out how to print long doubles." >&4
8110 else
8111         sSCNfldbl=$sPRIfldbl    # expect consistency
8112 fi
8113
8114 $rm -f try try.*
8115
8116 fi # d_longdbl
8117
8118 case "$sPRIfldbl" in
8119 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8120         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8121         d_SCNfldbl="$undef";
8122         ;;
8123 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8124         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8125         d_SCNfldbl="$define";
8126         ;;
8127 esac
8128
8129 : Check how to convert floats to strings.
8130 echo " "
8131 echo "Checking for an efficient way to convert floats to strings."
8132 echo " " > try.c
8133 case "$uselongdouble" in
8134 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8135 esac
8136 case "$d_longdbl" in
8137 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8138 esac
8139 case "$d_PRIgldbl" in
8140 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8141 esac
8142 $cat >>try.c <<EOP
8143 #ifdef TRY_gconvert
8144 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8145 char *myname = "gconvert";
8146 #endif
8147 #ifdef TRY_gcvt
8148 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8149 char *myname = "gcvt";
8150 #endif
8151 #ifdef TRY_qgcvt
8152 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8153 char *myname = "qgcvt";
8154 #define DOUBLETYPE long double
8155 #endif
8156 #ifdef TRY_sprintf
8157 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8158 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8159 #else
8160 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8161 #endif
8162 char *myname = "sprintf";
8163 #endif
8164
8165 #ifndef DOUBLETYPE
8166 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8167 #define DOUBLETYPE long double
8168 #else
8169 #define DOUBLETYPE double
8170 #endif
8171 #endif
8172
8173 #include <stdio.h>
8174
8175 #define I_STDLIB $i_stdlib
8176 #ifdef I_STDLIB
8177 #include <stdlib.h>
8178 #endif
8179
8180 int
8181 checkit(expect, got)
8182 char *expect;
8183 char *got;
8184 {
8185     if (strcmp(expect, got)) {
8186                 printf("%s oddity:  Expected %s, got %s\n",
8187                         myname, expect, got);
8188                 exit(1);
8189         }
8190 }
8191
8192 int main()
8193
8194         char buf[64]; 
8195         buf[63] = '\0';
8196
8197         /* This must be 1st test on (which?) platform */
8198         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8199         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8200         checkit("0.1", buf);
8201
8202         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8203         checkit("1", buf);
8204
8205         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8206         checkit("1.1", buf);
8207
8208         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8209         checkit("1.01", buf);
8210
8211         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8212         checkit("1.001", buf);
8213
8214         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8215         checkit("1.0001", buf);
8216
8217         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8218         checkit("1.00001", buf);
8219
8220         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8221         checkit("1.000001", buf);
8222
8223         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8224         checkit("0", buf);
8225
8226         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8227         checkit("-1", buf);
8228
8229         /* Some Linux gcvt's give 1.e+5 here. */
8230         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8231         checkit("100000", buf);
8232         
8233         /* Some Linux gcvt's give -1.e+5 here. */
8234         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8235         checkit("-100000", buf);
8236
8237         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8238         checkit("123.456", buf);
8239
8240         exit(0);
8241 }
8242 EOP
8243 case "$d_Gconvert" in
8244 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8245 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8246 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8247 *) xxx_list='gconvert gcvt sprintf' ;;
8248 esac
8249
8250 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8251 "$define$define$define")
8252     # for long doubles prefer first qgcvt, then sprintf
8253     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8254     xxx_list="sprintf $xxx_list"
8255     case "$d_qgcvt" in
8256     "$define") xxx_list="qgcvt $xxx_list" ;;
8257     esac
8258     ;;
8259 esac
8260
8261 for xxx_convert in $xxx_list; do
8262         echo "Trying $xxx_convert..."
8263         $rm -f try try$_o
8264         set try -DTRY_$xxx_convert
8265         if eval $compile; then
8266                 echo "$xxx_convert() found." >&4
8267                 if ./try; then
8268                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8269                         break;
8270                 else
8271                         echo "...But $xxx_convert didn't work as I expected."
8272                 fi
8273         else
8274                 echo "$xxx_convert NOT found." >&4
8275         fi
8276 done
8277         
8278 case "$xxx_convert" in
8279 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8280 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8281 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8282 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8283    "$define$define$define")
8284       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8285    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8286    esac
8287    ;;  
8288 esac
8289
8290 : see if _fwalk exists
8291 set fwalk d__fwalk
8292 eval $inlibc
8293
8294 : Initialize h_fcntl
8295 h_fcntl=false
8296
8297 : Initialize h_sysfile
8298 h_sysfile=false
8299
8300 : access call always available on UNIX
8301 set access d_access
8302 eval $inlibc
8303
8304 : locate the flags for 'access()'
8305 case "$d_access" in
8306 "$define")
8307         echo " "
8308         $cat >access.c <<'EOCP'
8309 #include <sys/types.h>
8310 #ifdef I_FCNTL
8311 #include <fcntl.h>
8312 #endif
8313 #ifdef I_SYS_FILE
8314 #include <sys/file.h>
8315 #endif
8316 #ifdef I_UNISTD
8317 #include <unistd.h>
8318 #endif
8319 int main() {
8320         exit(R_OK);
8321 }
8322 EOCP
8323         : check sys/file.h first, no particular reason here
8324         if $test `./findhdr sys/file.h` && \
8325                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8326                 h_sysfile=true;
8327                 echo "<sys/file.h> defines the *_OK access constants." >&4
8328         elif $test `./findhdr fcntl.h` && \
8329                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8330                 h_fcntl=true;
8331                 echo "<fcntl.h> defines the *_OK access constants." >&4
8332         elif $test `./findhdr unistd.h` && \
8333                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8334                 echo "<unistd.h> defines the *_OK access constants." >&4
8335         else
8336                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8337         fi
8338         ;;
8339 esac
8340 $rm -f access*
8341
8342 : see if accessx exists
8343 set accessx d_accessx
8344 eval $inlibc
8345
8346 : see if alarm exists
8347 set alarm d_alarm
8348 eval $inlibc
8349
8350 : see if atolf exists
8351 set atolf d_atolf
8352 eval $inlibc
8353
8354 : see if atoll exists
8355 set atoll d_atoll
8356 eval $inlibc
8357
8358 : Look for GNU-cc style attribute checking
8359 echo " "
8360 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8361 $cat >attrib.c <<'EOCP'
8362 #include <stdio.h>
8363 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8364 EOCP
8365 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8366         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8367                 echo "Your C compiler doesn't fully support __attribute__."
8368                 val="$undef"
8369         else
8370                 echo "Your C compiler supports __attribute__."
8371                 val="$define"
8372         fi
8373 else
8374         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8375         val="$undef"
8376 fi
8377 set d_attribut
8378 eval $setvar
8379 $rm -f attrib*
8380
8381 : see if bcmp exists
8382 set bcmp d_bcmp
8383 eval $inlibc
8384
8385 : see if bcopy exists
8386 set bcopy d_bcopy
8387 eval $inlibc
8388
8389 : see if this is a unistd.h system
8390 set unistd.h i_unistd
8391 eval $inhdr
8392
8393 : see if getpgrp exists
8394 set getpgrp d_getpgrp
8395 eval $inlibc
8396
8397 case "$d_getpgrp" in
8398 "$define")
8399         echo " "
8400         echo "Checking to see which flavor of getpgrp is in use..."
8401         $cat >set.c <<EOP
8402 #$i_unistd I_UNISTD
8403 #include <sys/types.h>
8404 #ifdef I_UNISTD
8405 #  include <unistd.h>
8406 #endif
8407 int main()
8408 {
8409         if (getuid() == 0) {
8410                 printf("(I see you are running Configure as super-user...)\n");
8411                 setuid(1);
8412         }
8413 #ifdef TRY_BSD_PGRP
8414         if (getpgrp(1) == 0)
8415                 exit(0);
8416 #else
8417         if (getpgrp() > 0)
8418                 exit(0);
8419 #endif
8420         exit(1);
8421 }
8422 EOP
8423         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8424                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8425                 val="$define"
8426         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8427                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8428                 val="$undef"
8429         else
8430                 echo "I can't seem to compile and run the test program."
8431                 if ./usg; then
8432                         xxx="a USG one, i.e. you use getpgrp()."
8433                 else
8434                         # SVR4 systems can appear rather BSD-ish.
8435                         case "$i_unistd" in
8436                         $undef)
8437                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8438                                 val="$define"
8439                                 ;;
8440                         $define)
8441                                 xxx="probably a USG one, i.e. you use getpgrp()."
8442                                 val="$undef"
8443                                 ;;
8444                         esac
8445                 fi
8446                 echo "Assuming your getpgrp is $xxx" >&4
8447         fi
8448         ;;
8449 *) val="$undef";;
8450 esac
8451 set d_bsdgetpgrp
8452 eval $setvar
8453 $rm -f set set.c
8454
8455 : see if setpgrp exists
8456 set setpgrp d_setpgrp
8457 eval $inlibc
8458
8459 case "$d_setpgrp" in
8460 "$define")
8461         echo " "
8462         echo "Checking to see which flavor of setpgrp is in use..."
8463         $cat >set.c <<EOP
8464 #$i_unistd I_UNISTD
8465 #include <sys/types.h>
8466 #ifdef I_UNISTD
8467 #  include <unistd.h>
8468 #endif
8469 int main()
8470 {
8471         if (getuid() == 0) {
8472                 printf("(I see you are running Configure as super-user...)\n");
8473                 setuid(1);
8474         }
8475 #ifdef TRY_BSD_PGRP
8476         if (-1 == setpgrp(1, 1))
8477                 exit(0);
8478 #else
8479         if (setpgrp() != -1)
8480                 exit(0);
8481 #endif
8482         exit(1);
8483 }
8484 EOP
8485         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8486                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8487                 val="$define"
8488         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8489                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8490                 val="$undef"
8491         else
8492                 echo "(I can't seem to compile and run the test program.)"
8493                 if ./usg; then
8494                         xxx="a USG one, i.e. you use setpgrp()."
8495                 else
8496                         # SVR4 systems can appear rather BSD-ish.
8497                         case "$i_unistd" in
8498                         $undef)
8499                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8500                                 val="$define"
8501                                 ;;
8502                         $define)
8503                                 xxx="probably a USG one, i.e. you use setpgrp()."
8504                                 val="$undef"
8505                                 ;;
8506                         esac
8507                 fi
8508                 echo "Assuming your setpgrp is $xxx" >&4
8509         fi
8510         ;;
8511 *) val="$undef";;
8512 esac
8513 set d_bsdsetpgrp
8514 eval $setvar
8515 $rm -f set set.c
8516 : see if bzero exists
8517 set bzero d_bzero
8518 eval $inlibc
8519
8520 : see if signal is declared as pointer to function returning int or void
8521 echo " "
8522 xxx=`./findhdr signal.h`
8523 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8524 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8525         echo "You have int (*signal())() instead of void." >&4
8526         val="$undef"
8527 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8528         echo "You have void (*signal())()." >&4
8529         val="$define"
8530 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8531         echo "You have int (*signal())() instead of void." >&4
8532         val="$undef"
8533 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8534         echo "You have void (*signal())()." >&4
8535         val="$define"
8536 else
8537         case "$d_voidsig" in
8538         '')
8539         echo "I can't determine whether signal handler returns void or int..." >&4
8540                 dflt=void
8541                 rp="What type does your signal handler return?"
8542                 . ./myread
8543                 case "$ans" in
8544                 v*) val="$define";;
8545                 *) val="$undef";;
8546                 esac;;
8547         "$define")
8548                 echo "As you already told me, signal handler returns void." >&4
8549                 val="$define"
8550                 ;;
8551         *)      echo "As you already told me, signal handler returns int." >&4
8552                 val="$undef"
8553                 ;;
8554         esac
8555 fi
8556 set d_voidsig
8557 eval $setvar
8558 case "$d_voidsig" in
8559 "$define") signal_t="void";;
8560 *) signal_t="int";;
8561 esac
8562 $rm -f $$.tmp
8563
8564 : check for ability to cast large floats to 32-bit ints.
8565 echo " "
8566 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8567 if $test "$intsize" -ge 4; then
8568         xxx=int
8569 else
8570         xxx=long
8571 fi
8572 $cat >try.c <<EOCP
8573 #include <stdio.h>
8574 #include <sys/types.h>
8575 #include <signal.h>
8576 $signal_t blech(s) int s; { exit(3); }
8577 int main()
8578 {
8579         $xxx i32;
8580         double f, g;
8581         int result = 0;
8582         char str[16];
8583         signal(SIGFPE, blech);
8584
8585         /* Don't let compiler optimize the test away.  Store the number 
8586            in a writable string for gcc to pass to sscanf under HP/UX.
8587         */
8588         sprintf(str, "2147483647");
8589         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8590         g = 10 * f;
8591         i32  = ($xxx) g;
8592
8593         /* x86 processors will probably give 0x8000 0000, which is a
8594        sign change.  We don't want that.  We want to mimic SPARC
8595            behavior here, which is to preserve the sign and give
8596            back 0x7fff ffff.
8597         */
8598         if (i32 != ($xxx) f)
8599                 result |= 1;
8600         exit(result);
8601 }
8602 EOCP
8603 set try
8604 if eval $compile_ok; then
8605         ./try
8606         yyy=$?
8607 else
8608         echo "(I can't seem to compile the test program--assuming it can't)"
8609         yyy=1
8610 fi
8611 case "$yyy" in
8612 0)      val="$define"
8613         echo "Yup, it can."
8614         ;;
8615 *)      val="$undef"
8616         echo "Nope, it can't."
8617         ;;
8618 esac
8619 set d_casti32
8620 eval $setvar
8621 $rm -f try try.*
8622
8623 : check for ability to cast negative floats to unsigned
8624 echo " "
8625 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8626 $cat >try.c <<EOCP
8627 #include <stdio.h>
8628 #include <sys/types.h>
8629 #include <signal.h>
8630 $signal_t blech(s) int s; { exit(7); }
8631 $signal_t blech_in_list(s) int s; { exit(4); }
8632 unsigned long dummy_long(p) unsigned long p; { return p; }
8633 unsigned int dummy_int(p) unsigned int p; { return p; }
8634 unsigned short dummy_short(p) unsigned short p; { return p; }
8635 int main()
8636 {
8637         double f;
8638         unsigned long along;
8639         unsigned int aint;
8640         unsigned short ashort;
8641         int result = 0;
8642         char str[16];
8643         
8644         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8645            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8646            optimized the whole file away
8647         */
8648         /* Store the number in a writable string for gcc to pass to 
8649            sscanf under HP/UX.
8650         */
8651         sprintf(str, "-123");
8652         sscanf(str, "%lf", &f);  /* f = -123.; */
8653
8654         signal(SIGFPE, blech);
8655         along = (unsigned long)f;
8656         aint = (unsigned int)f;
8657         ashort = (unsigned short)f;
8658         if (along != (unsigned long)-123)
8659                 result |= 1;
8660         if (aint != (unsigned int)-123)
8661                 result |= 1;
8662         if (ashort != (unsigned short)-123)
8663                 result |= 1;
8664         sprintf(str, "1073741824.");
8665         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8666         f = f + f;
8667         along = 0;
8668         along = (unsigned long)f;
8669         if (along != 0x80000000)
8670                 result |= 2;
8671         f -= 1.;
8672         along = 0;
8673         along = (unsigned long)f;
8674         if (along != 0x7fffffff)
8675                 result |= 1;
8676         f += 2.;
8677         along = 0;
8678         along = (unsigned long)f;
8679         if (along != 0x80000001)
8680                 result |= 2;
8681         if (result)
8682                 exit(result);
8683         signal(SIGFPE, blech_in_list);
8684         sprintf(str, "123.");
8685         sscanf(str, "%lf", &f);  /* f = 123.; */
8686         along = dummy_long((unsigned long)f);
8687         aint = dummy_int((unsigned int)f);
8688         ashort = dummy_short((unsigned short)f);
8689         if (along != (unsigned long)123)
8690                 result |= 4;
8691         if (aint != (unsigned int)123)
8692                 result |= 4;
8693         if (ashort != (unsigned short)123)
8694                 result |= 4;
8695         exit(result);
8696
8697 }
8698 EOCP
8699 set try
8700 if eval $compile_ok; then
8701         ./try
8702         castflags=$?
8703 else
8704         echo "(I can't seem to compile the test program--assuming it can't)"
8705         castflags=7
8706 fi
8707 case "$castflags" in
8708 0)      val="$define"
8709         echo "Yup, it can."
8710         ;;
8711 *)      val="$undef"
8712         echo "Nope, it can't."
8713         ;;
8714 esac
8715 set d_castneg
8716 eval $setvar
8717 $rm -f try.*
8718
8719 : see if vprintf exists
8720 echo " "
8721 if set vprintf val -f d_vprintf; eval $csym; $val; then
8722         echo 'vprintf() found.' >&4
8723         val="$define"
8724         $cat >vprintf.c <<'EOF'
8725 #include <varargs.h>
8726
8727 int main() { xxx("foo"); }
8728
8729 xxx(va_alist)
8730 va_dcl
8731 {
8732         va_list args;
8733         char buf[10];
8734
8735         va_start(args);
8736         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8737 }
8738 EOF
8739         set vprintf
8740         if eval $compile && ./vprintf; then
8741                 echo "Your vsprintf() returns (int)." >&4
8742                 val2="$undef"
8743         else
8744                 echo "Your vsprintf() returns (char*)." >&4
8745                 val2="$define"
8746         fi
8747 else
8748         echo 'vprintf() NOT found.' >&4
8749                 val="$undef"
8750                 val2="$undef"
8751 fi
8752 set d_vprintf
8753 eval $setvar
8754 val=$val2
8755 set d_charvspr
8756 eval $setvar
8757
8758 : see if chown exists
8759 set chown d_chown
8760 eval $inlibc
8761
8762 : see if chroot exists
8763 set chroot d_chroot
8764 eval $inlibc
8765
8766 : see if chsize exists
8767 set chsize d_chsize
8768 eval $inlibc
8769
8770 hasstruct='varname=$1; struct=$2; shift; shift;
8771 while $test $# -ge 2; do
8772         case "$1" in
8773         $define) echo "#include <$2>";;
8774         esac ;
8775     shift 2;
8776 done > try.c;
8777 echo "int main () { struct $struct foo; }" >> try.c;
8778 set try;
8779 if eval $compile; then
8780         val="$define";
8781 else
8782         val="$undef";
8783 fi;
8784 set $varname;
8785 eval $setvar;
8786 $rm -f try.c try.o'
8787
8788 : see if sys/types.h has to be included
8789 set sys/types.h i_systypes
8790 eval $inhdr
8791
8792 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8793 while $test $# -ge 2; do
8794         case "$1" in
8795         $define) echo "#include <$2>";;
8796         esac ;
8797     shift 2;
8798 done > try.c;
8799 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8800 set try;
8801 if eval $compile; then
8802         val="$define";
8803 else
8804         val="$undef";
8805 fi;
8806 set $varname;
8807 eval $setvar;
8808 $rm -f try.c try.o'
8809
8810 socketlib=''
8811 sockethdr=''
8812 : see whether socket exists
8813 echo " "
8814 $echo $n "Hmm... $c" >&4
8815 if set socket val -f d_socket; eval $csym; $val; then
8816         echo "Looks like you have Berkeley networking support." >&4
8817         d_socket="$define"
8818         if set setsockopt val -f; eval $csym; $val; then
8819                 d_oldsock="$undef"
8820         else
8821                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8822                 d_oldsock="$define"
8823         fi
8824 else
8825         if $contains socklib libc.list >/dev/null 2>&1; then
8826                 echo "Looks like you have Berkeley networking support." >&4
8827                 d_socket="$define"
8828                 : we will have to assume that it supports the 4.2 BSD interface
8829                 d_oldsock="$undef"
8830         else
8831                 echo "You don't have Berkeley networking in libc$_a..." >&4
8832                 if test "X$d_socket" = "X$define"; then
8833                    echo "...but you seem to believe that you have sockets." >&4
8834                 else
8835                         for net in net socket
8836                         do
8837                                 if test -f /usr/lib/lib$net$_a; then
8838                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8839                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8840                                         if $contains socket libc.list >/dev/null 2>&1; then
8841                                                 d_socket="$define"
8842                                                 socketlib="-l$net"
8843                                                 case "$net" in
8844                                                 net)
8845                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8846                                                         sockethdr="-I/usr/netinclude"
8847                                                         ;;
8848                                                 esac
8849                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8850                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8851                                                         d_oldsock="$undef"
8852                                                 else
8853                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8854                                                         d_oldsock="$define"
8855                                                 fi
8856                                                 break
8857                                         fi
8858                                 fi
8859                         done
8860                         if test "X$d_socket" != "X$define"; then
8861                            echo "or anywhere else I see." >&4
8862                            d_socket="$undef"
8863                            d_oldsock="$undef"
8864                         fi
8865                 fi
8866         fi
8867 fi
8868
8869 : see if socketpair exists
8870 set socketpair d_sockpair
8871 eval $inlibc
8872
8873
8874 echo " "
8875 echo "Checking the availability of certain socket constants..." >& 4
8876 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8877         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8878         $cat >try.c <<EOF
8879 #include <sys/types.h>
8880 #include <sys/socket.h>
8881 int main() {
8882     int i = $ENUM;
8883 }
8884 EOF
8885         val="$undef"
8886         set try; if eval $compile; then
8887                 val="$define"
8888         fi
8889         set d_${enum}; eval $setvar
8890         $rm -f try.c try
8891 done
8892
8893 : see if this is a sys/uio.h system
8894 set sys/uio.h i_sysuio
8895 eval $inhdr
8896
8897
8898 echo " "
8899 echo "Checking to see if your system supports struct cmsghdr..." >&4
8900 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
8901 eval $hasstruct
8902 case "$d_cmsghdr_s" in
8903 "$define")      echo "Yes, it does."   ;;
8904 *)              echo "No, it doesn't." ;;
8905 esac
8906
8907
8908 : check for const keyword
8909 echo " "
8910 echo 'Checking to see if your C compiler knows about "const"...' >&4
8911 $cat >const.c <<'EOCP'
8912 typedef struct spug { int drokk; } spug;
8913 int main()
8914 {
8915         const char *foo;
8916         const spug y;
8917 }
8918 EOCP
8919 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8920         val="$define"
8921         echo "Yup, it does."
8922 else
8923         val="$undef"
8924         echo "Nope, it doesn't."
8925 fi
8926 set d_const
8927 eval $setvar
8928
8929 : see if crypt exists
8930 echo " "
8931 if set crypt val -f d_crypt; eval $csym; $val; then
8932         echo 'crypt() found.' >&4
8933         val="$define"
8934         cryptlib=''
8935 else
8936         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8937         if $test -z "$cryptlib"; then
8938                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8939         else
8940                 cryptlib=-lcrypt
8941         fi
8942         if $test -z "$cryptlib"; then
8943                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8944         else
8945                 cryptlib=-lcrypt
8946         fi
8947         if $test -z "$cryptlib"; then
8948                 cryptlib=`./loc libcrypt$_a "" $libpth`
8949         else
8950                 cryptlib=-lcrypt
8951         fi
8952         if $test -z "$cryptlib"; then
8953                 echo 'crypt() NOT found.' >&4
8954                 val="$undef"
8955         else
8956                 val="$define"
8957         fi
8958 fi
8959 set d_crypt
8960 eval $setvar
8961
8962 : get csh whereabouts
8963 case "$csh" in
8964 'csh') val="$undef" ;;
8965 *) val="$define" ;;
8966 esac
8967 set d_csh
8968 eval $setvar
8969 : Respect a hint or command line value for full_csh.
8970 case "$full_csh" in
8971 '') full_csh=$csh ;;
8972 esac
8973
8974 : see if cuserid exists
8975 set cuserid d_cuserid
8976 eval $inlibc
8977
8978 : see if this is a limits.h system
8979 set limits.h i_limits
8980 eval $inhdr
8981
8982 : see if this is a float.h system
8983 set float.h i_float
8984 eval $inhdr
8985
8986 : See if number of significant digits in a double precision number is known
8987 echo " "
8988 $cat >dbl_dig.c <<EOM
8989 #$i_limits I_LIMITS
8990 #$i_float I_FLOAT
8991 #ifdef I_LIMITS
8992 #include <limits.h>
8993 #endif
8994 #ifdef I_FLOAT
8995 #include <float.h>
8996 #endif
8997 #ifdef DBL_DIG
8998 printf("Contains DBL_DIG");
8999 #endif
9000 EOM
9001 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9002 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9003         echo "DBL_DIG found." >&4
9004         val="$define"
9005 else
9006         echo "DBL_DIG NOT found." >&4
9007         val="$undef"
9008 fi
9009 $rm -f dbl_dig.?
9010 set d_dbl_dig
9011 eval $setvar
9012
9013 hasproto='varname=$1; func=$2; shift; shift;
9014 while $test $# -ge 2; do
9015         case "$1" in
9016         $define) echo "#include <$2>";;
9017         esac ;
9018     shift 2;
9019 done > try.c;
9020 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9021 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9022         echo "$func() prototype found.";
9023         val="$define";
9024 else
9025         echo "$func() prototype NOT found.";
9026         val="$undef";
9027 fi;
9028 set $varname;
9029 eval $setvar;
9030 $rm -f try.c tryout.c'
9031
9032 : see if dbm.h is available
9033 : see if dbmclose exists
9034 set dbmclose d_dbmclose
9035 eval $inlibc
9036
9037 case "$d_dbmclose" in
9038 $define)
9039         set dbm.h i_dbm
9040         eval $inhdr
9041         case "$i_dbm" in
9042         $define)
9043                 val="$undef"
9044                 set i_rpcsvcdbm
9045                 eval $setvar
9046                 ;;
9047         *)      set rpcsvc/dbm.h i_rpcsvcdbm
9048                 eval $inhdr
9049                 ;;
9050         esac
9051         ;;
9052 *)      echo "We won't be including <dbm.h>"
9053         val="$undef"
9054         set i_dbm
9055         eval $setvar
9056         val="$undef"
9057         set i_rpcsvcdbm
9058         eval $setvar
9059         ;;
9060 esac
9061
9062 : see if prototype for dbminit is available
9063 echo " "
9064 set d_dbminitproto dbminit $i_dbm dbm.h
9065 eval $hasproto
9066
9067 : see if difftime exists
9068 set difftime d_difftime
9069 eval $inlibc
9070
9071 : see if this is a dirent system
9072 echo " "
9073 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9074         val="$define"
9075         echo "<dirent.h> found." >&4
9076 else
9077         val="$undef"
9078         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9079                 echo "<sys/dir.h> found." >&4
9080                 echo " "
9081         else
9082                 xinc=`./findhdr sys/ndir.h`
9083         fi
9084         echo "<dirent.h> NOT found." >&4
9085 fi
9086 set i_dirent
9087 eval $setvar
9088
9089 : Look for type of directory structure.
9090 echo " "
9091 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9092
9093 case "$direntrytype" in
9094 ''|' ')
9095         case "$i_dirent" in
9096         $define) guess1='struct dirent' ;;
9097         *) guess1='struct direct'  ;;
9098         esac
9099         ;;
9100 *)      guess1="$direntrytype"
9101         ;;
9102 esac
9103
9104 case "$guess1" in
9105 'struct dirent') guess2='struct direct' ;;
9106 *) guess2='struct dirent' ;;
9107 esac
9108                 
9109 if $contains "$guess1" try.c >/dev/null 2>&1; then
9110         direntrytype="$guess1"
9111         echo "Your directory entries are $direntrytype." >&4
9112 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9113         direntrytype="$guess2"
9114         echo "Your directory entries seem to be $direntrytype." >&4
9115 else
9116         echo "I don't recognize your system's directory entries." >&4
9117         rp="What type is used for directory entries on this system?"
9118         dflt="$guess1"
9119         . ./myread
9120         direntrytype="$ans"
9121 fi
9122 $rm -f try.c
9123
9124
9125 : see if the directory entry stores field length
9126 echo " "
9127 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9128 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9129         echo "Good, your directory entry keeps length information in d_namlen." >&4
9130         val="$define"
9131 else
9132         echo "Your directory entry does not know about the d_namlen field." >&4
9133         val="$undef"
9134 fi
9135 set d_dirnamlen
9136 eval $setvar
9137 $rm -f try.c
9138
9139 : see if dlerror exists
9140 xxx_runnm="$runnm"
9141 runnm=false
9142 set dlerror d_dlerror
9143 eval $inlibc
9144 runnm="$xxx_runnm"
9145
9146 : see if dlfcn is available
9147 set dlfcn.h i_dlfcn
9148 eval $inhdr
9149
9150 case "$usedl" in
9151 $define|y|true)
9152         $cat << EOM
9153
9154 On a few systems, the dynamically loaded modules that perl generates and uses
9155 will need a different extension than shared libs. The default will probably
9156 be appropriate.
9157
9158 EOM
9159         case "$dlext" in
9160         '')     dflt="$so" ;;
9161         *)      dflt="$dlext" ;;
9162         esac
9163         rp='What is the extension of dynamically loaded modules'
9164         . ./myread
9165         dlext="$ans"
9166         ;;
9167 *)
9168         dlext="none"
9169         ;;
9170 esac
9171
9172 : Check if dlsym need a leading underscore
9173 echo " "
9174 val="$undef"
9175
9176 case "$dlsrc" in
9177 dl_dlopen.xs)
9178         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9179         $cat >dyna.c <<'EOM'
9180 fred () { }
9181 EOM
9182
9183 $cat >fred.c<<EOM
9184
9185 #include <stdio.h>
9186 #$i_dlfcn I_DLFCN
9187 #ifdef I_DLFCN
9188 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
9189 #else
9190 #include <sys/types.h>
9191 #include <nlist.h>
9192 #include <link.h>
9193 #endif
9194
9195 extern int fred() ;
9196
9197 int main()
9198 {
9199     void * handle ;
9200     void * symbol ;
9201 #ifndef RTLD_LAZY
9202     int mode = 1 ;
9203 #else
9204     int mode = RTLD_LAZY ;
9205 #endif
9206     handle = dlopen("./dyna.$dlext", mode) ;
9207     if (handle == NULL) {
9208         printf ("1\n") ;
9209         fflush (stdout) ;
9210         exit(0);
9211     }
9212     symbol = dlsym(handle, "fred") ;
9213     if (symbol == NULL) {
9214         /* try putting a leading underscore */
9215         symbol = dlsym(handle, "_fred") ;
9216         if (symbol == NULL) {
9217             printf ("2\n") ;
9218             fflush (stdout) ;
9219             exit(0);
9220         }
9221         printf ("3\n") ;
9222     }
9223     else
9224         printf ("4\n") ;
9225     fflush (stdout) ;
9226     exit(0);
9227 }
9228 EOM
9229         : Call the object file tmp-dyna.o in case dlext=o.
9230         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9231                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9232                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9233                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
9234                 xxx=`./fred`
9235                 case $xxx in
9236                 1)      echo "Test program failed using dlopen." >&4
9237                         echo "Perhaps you should not use dynamic loading." >&4;;
9238                 2)      echo "Test program failed using dlsym." >&4
9239                         echo "Perhaps you should not use dynamic loading." >&4;;
9240                 3)      echo "dlsym needs a leading underscore" >&4
9241                         val="$define" ;;
9242                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9243                 esac
9244         else
9245                 echo "I can't compile and run the test program." >&4
9246                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9247         fi
9248         ;;
9249 esac
9250                 
9251 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9252
9253 set d_dlsymun
9254 eval $setvar
9255
9256 : see if prototype for drand48 is available
9257 echo " "
9258 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9259 eval $hasproto
9260
9261 : see if dup2 exists
9262 set dup2 d_dup2
9263 eval $inlibc
9264
9265 : see if eaccess exists
9266 set eaccess d_eaccess
9267 eval $inlibc
9268
9269 : see if endgrent exists
9270 set endgrent d_endgrent
9271 eval $inlibc
9272
9273 : see if endhostent exists
9274 set endhostent d_endhent
9275 eval $inlibc
9276
9277 : see if endnetent exists
9278 set endnetent d_endnent
9279 eval $inlibc
9280
9281 : see if endprotoent exists
9282 set endprotoent d_endpent
9283 eval $inlibc
9284
9285 : see if endpwent exists
9286 set endpwent d_endpwent
9287 eval $inlibc
9288
9289 : see if endservent exists
9290 set endservent d_endsent
9291 eval $inlibc
9292
9293 : Locate the flags for 'open()'
9294 echo " "
9295 $cat >open3.c <<'EOCP'
9296 #include <sys/types.h>
9297 #ifdef I_FCNTL
9298 #include <fcntl.h>
9299 #endif
9300 #ifdef I_SYS_FILE
9301 #include <sys/file.h>
9302 #endif
9303 int main() {
9304         if(O_RDONLY);
9305 #ifdef O_TRUNC
9306         exit(0);
9307 #else
9308         exit(1);
9309 #endif
9310 }
9311 EOCP
9312 : check sys/file.h first to get FREAD on Sun
9313 if $test `./findhdr sys/file.h` && \
9314                 set open3 -DI_SYS_FILE && eval $compile; then
9315         h_sysfile=true;
9316         echo "<sys/file.h> defines the O_* constants..." >&4
9317         if ./open3; then
9318                 echo "and you have the 3 argument form of open()." >&4
9319                 val="$define"
9320         else
9321                 echo "but not the 3 argument form of open().  Oh, well." >&4
9322                 val="$undef"
9323         fi
9324 elif $test `./findhdr fcntl.h` && \
9325                 set open3 -DI_FCNTL && eval $compile; then
9326         h_fcntl=true;
9327         echo "<fcntl.h> defines the O_* constants..." >&4
9328         if ./open3; then
9329                 echo "and you have the 3 argument form of open()." >&4
9330                 val="$define"
9331         else
9332                 echo "but not the 3 argument form of open().  Oh, well." >&4
9333                 val="$undef"
9334         fi
9335 else
9336         val="$undef"
9337         echo "I can't find the O_* constant definitions!  You got problems." >&4
9338 fi
9339 set d_open3
9340 eval $setvar
9341 $rm -f open3*
9342
9343 : see which of string.h or strings.h is needed
9344 echo " "
9345 strings=`./findhdr string.h`
9346 if $test "$strings" && $test -r "$strings"; then
9347         echo "Using <string.h> instead of <strings.h>." >&4
9348         val="$define"
9349 else
9350         val="$undef"
9351         strings=`./findhdr strings.h`
9352         if $test "$strings" && $test -r "$strings"; then
9353                 echo "Using <strings.h> instead of <string.h>." >&4
9354         else
9355                 echo "No string header found -- You'll surely have problems." >&4
9356         fi
9357 fi
9358 set i_string
9359 eval $setvar
9360 case "$i_string" in
9361 "$undef") strings=`./findhdr strings.h`;;
9362 *)        strings=`./findhdr string.h`;;
9363 esac
9364
9365 : check for non-blocking I/O stuff
9366 case "$h_sysfile" in
9367 true) echo "#include <sys/file.h>" > head.c;;
9368 *)
9369        case "$h_fcntl" in
9370        true) echo "#include <fcntl.h>" > head.c;;
9371        *) echo "#include <sys/fcntl.h>" > head.c;;
9372        esac
9373        ;;
9374 esac
9375 echo " "
9376 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9377 case "$o_nonblock" in
9378 '')
9379         $cat head.c > try.c
9380         $cat >>try.c <<'EOCP'
9381 #include <stdio.h>
9382 int main() {
9383 #ifdef O_NONBLOCK
9384         printf("O_NONBLOCK\n");
9385         exit(0);
9386 #endif
9387 #ifdef O_NDELAY
9388         printf("O_NDELAY\n");
9389         exit(0);
9390 #endif
9391 #ifdef FNDELAY
9392         printf("FNDELAY\n");
9393         exit(0);
9394 #endif
9395         exit(0);
9396 }
9397 EOCP
9398         set try
9399         if eval $compile_ok; then
9400                 o_nonblock=`./try`
9401                 case "$o_nonblock" in
9402                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9403                 *) echo "Seems like we can use $o_nonblock.";;
9404                 esac
9405         else
9406                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9407         fi
9408         ;;
9409 *) echo "Using $hint value $o_nonblock.";;
9410 esac
9411 $rm -f try try.* .out core
9412
9413 echo " "
9414 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9415 case "$eagain" in
9416 '')
9417         $cat head.c > try.c
9418         $cat >>try.c <<EOCP
9419 #include <errno.h>
9420 #include <sys/types.h>
9421 #include <signal.h>
9422 #include <stdio.h> 
9423 #define MY_O_NONBLOCK $o_nonblock
9424 #ifndef errno  /* XXX need better Configure test */
9425 extern int errno;
9426 #endif
9427 #$i_unistd I_UNISTD
9428 #ifdef I_UNISTD
9429 #include <unistd.h>
9430 #endif
9431 #$i_string I_STRING
9432 #ifdef I_STRING
9433 #include <string.h>
9434 #else
9435 #include <strings.h>
9436 #endif
9437 $signal_t blech(x) int x; { exit(3); }
9438 EOCP
9439         $cat >> try.c <<'EOCP'
9440 int main()
9441 {
9442         int pd[2];
9443         int pu[2];
9444         char buf[1];
9445         char string[100];
9446
9447         pipe(pd);       /* Down: child -> parent */
9448         pipe(pu);       /* Up: parent -> child */
9449         if (0 != fork()) {
9450                 int ret;
9451                 close(pd[1]);   /* Parent reads from pd[0] */
9452                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9453 #ifdef F_SETFL
9454                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9455                         exit(1);
9456 #else
9457                 exit(4);
9458 #endif
9459                 signal(SIGALRM, blech);
9460                 alarm(5);
9461                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9462                         exit(2);
9463                 sprintf(string, "%d\n", ret);
9464                 write(2, string, strlen(string));
9465                 alarm(0);
9466 #ifdef EAGAIN
9467                 if (errno == EAGAIN) {
9468                         printf("EAGAIN\n");
9469                         goto ok;
9470                 }
9471 #endif
9472 #ifdef EWOULDBLOCK
9473                 if (errno == EWOULDBLOCK)
9474                         printf("EWOULDBLOCK\n");
9475 #endif
9476         ok:
9477                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9478                 sleep(2);                               /* Give it time to close our pipe */
9479                 alarm(5);
9480                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9481                 alarm(0);
9482                 sprintf(string, "%d\n", ret);
9483                 write(3, string, strlen(string));
9484                 exit(0);
9485         }
9486
9487         close(pd[0]);                   /* We write to pd[1] */
9488         close(pu[1]);                   /* We read from pu[0] */
9489         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9490         close(pd[1]);                   /* Pipe pd is now fully closed! */
9491         exit(0);                                /* Bye bye, thank you for playing! */
9492 }
9493 EOCP
9494         set try
9495         if eval $compile_ok; then
9496                 echo "$startsh" >mtry
9497                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9498                 chmod +x mtry
9499                 ./mtry >/dev/null 2>&1
9500                 case $? in
9501                 0) eagain=`$cat try.out`;;
9502                 1) echo "Could not perform non-blocking setting!";;
9503                 2) echo "I did a successful read() for something that was not there!";;
9504                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9505                 4) echo "Could not find F_SETFL!";;
9506                 *) echo "Something terribly wrong happened during testing.";;
9507                 esac
9508                 rd_nodata=`$cat try.ret`
9509                 echo "A read() system call with no data present returns $rd_nodata."
9510                 case "$rd_nodata" in
9511                 0|-1) ;;
9512                 *)
9513                         echo "(That's peculiar, fixing that to be -1.)"
9514                         rd_nodata=-1
9515                         ;;
9516                 esac
9517                 case "$eagain" in
9518                 '')
9519                         echo "Forcing errno EAGAIN on read() with no data available."
9520                         eagain=EAGAIN
9521                         ;;
9522                 *)
9523                         echo "Your read() sets errno to $eagain when no data is available."
9524                         ;;
9525                 esac
9526                 status=`$cat try.err`
9527                 case "$status" in
9528                 0) echo "And it correctly returns 0 to signal EOF.";;
9529                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9530                 *) echo "However, your read() returns '$status' on EOF??";;
9531                 esac
9532                 val="$define"
9533                 if test "$status" = "$rd_nodata"; then
9534                         echo "WARNING: you can't distinguish between EOF and no data!"
9535                         val="$undef"
9536                 fi
9537         else
9538                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9539                 eagain=EAGAIN
9540         fi
9541         set d_eofnblk
9542         eval $setvar
9543         ;;
9544 *)
9545         echo "Using $hint value $eagain."
9546         echo "Your read() returns $rd_nodata when no data is present."
9547         case "$d_eofnblk" in
9548         "$define") echo "And you can see EOF because read() returns 0.";;
9549         "$undef") echo "But you can't see EOF status from read() returned value.";;
9550         *)
9551                 echo "(Assuming you can't see EOF status from read anyway.)"
9552                 d_eofnblk=$undef
9553                 ;;
9554         esac
9555         ;;
9556 esac
9557 $rm -f try try.* .out core head.c mtry
9558
9559 : see if fchmod exists
9560 set fchmod d_fchmod
9561 eval $inlibc
9562
9563 : see if fchown exists
9564 set fchown d_fchown
9565 eval $inlibc
9566
9567 : see if this is an fcntl system
9568 set fcntl d_fcntl
9569 eval $inlibc
9570
9571 echo " "
9572 : See if fcntl-based locking works.
9573 $cat >try.c <<'EOCP'
9574 #include <stdlib.h>
9575 #include <unistd.h>
9576 #include <fcntl.h>
9577 int main() {
9578 #if defined(F_SETLK) && defined(F_SETLKW)
9579      struct flock flock;
9580      int retval, fd;
9581      fd = open("try.c", O_RDONLY);
9582      flock.l_type = F_RDLCK;
9583      flock.l_whence = SEEK_SET;
9584      flock.l_start = flock.l_len = 0;
9585      retval = fcntl(fd, F_SETLK, &flock);
9586      close(fd);
9587      (retval < 0 ? exit(2) : exit(0));
9588 #else
9589      exit(2);
9590 #endif
9591 }
9592 EOCP
9593 echo "Checking if fcntl-based file locking works... "
9594 case "$d_fcntl" in
9595 "$define")
9596         set try
9597         if eval $compile_ok; then
9598                 if ./try; then
9599                         echo "Yes, it seems to work."
9600                         val="$define"
9601                 else
9602                         echo "Nope, it didn't work."
9603                         val="$undef"
9604                 fi
9605         else
9606                 echo "I'm unable to compile the test program, so I'll assume not."
9607                 val="$undef"
9608         fi
9609         ;;
9610 *) val="$undef";
9611         echo "Nope, since you don't even have fcntl()."
9612         ;;
9613 esac
9614 set d_fcntl_can_lock
9615 eval $setvar
9616 $rm -f try*
9617
9618
9619 : see if sys/select.h has to be included
9620 set sys/select.h i_sysselct
9621 eval $inhdr
9622
9623 : see if we should include time.h, sys/time.h, or both
9624 echo " "
9625 if test "X$timeincl" = X; then
9626         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9627         $echo $n "I'm now running the test program...$c"
9628         $cat >try.c <<'EOCP'
9629 #include <sys/types.h>
9630 #ifdef I_TIME
9631 #include <time.h>
9632 #endif
9633 #ifdef I_SYSTIME
9634 #ifdef SYSTIMEKERNEL
9635 #define KERNEL
9636 #endif
9637 #include <sys/time.h>
9638 #endif
9639 #ifdef I_SYSSELECT
9640 #include <sys/select.h>
9641 #endif
9642 int main()
9643 {
9644         struct tm foo;
9645 #ifdef S_TIMEVAL
9646         struct timeval bar;
9647 #endif
9648 #ifdef S_TIMEZONE
9649         struct timezone tzp;
9650 #endif
9651         if (foo.tm_sec == foo.tm_sec)
9652                 exit(0);
9653 #ifdef S_TIMEVAL
9654         if (bar.tv_sec == bar.tv_sec)
9655                 exit(0);
9656 #endif
9657         exit(1);
9658 }
9659 EOCP
9660         flags=''
9661         for s_timezone in '-DS_TIMEZONE' ''; do
9662         sysselect=''
9663         for s_timeval in '-DS_TIMEVAL' ''; do
9664         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9665         for i_time in '' '-DI_TIME'; do
9666         for i_systime in '-DI_SYSTIME' ''; do
9667                 case "$flags" in
9668                 '') $echo $n ".$c"
9669                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9670                         if eval $compile; then
9671                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9672                                 shift
9673                                 flags="$*"
9674                                 echo " "
9675                                 $echo $n "Succeeded with $flags$c"
9676                         fi
9677                         ;;
9678                 esac
9679         done
9680         done
9681         done
9682         done
9683         done
9684         timeincl=''
9685         echo " "
9686         case "$flags" in
9687         *SYSTIMEKERNEL*) i_systimek="$define"
9688                 timeincl=`./findhdr sys/time.h`
9689                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9690         *) i_systimek="$undef";;
9691         esac
9692         case "$flags" in
9693         *I_TIME*) i_time="$define"
9694                 timeincl=`./findhdr time.h`" $timeincl"
9695                 echo "We'll include <time.h>." >&4;;
9696         *) i_time="$undef";;
9697         esac
9698         case "$flags" in
9699         *I_SYSTIME*) i_systime="$define"
9700                 timeincl=`./findhdr sys/time.h`" $timeincl"
9701                 echo "We'll include <sys/time.h>." >&4;;
9702         *) i_systime="$undef";;
9703         esac
9704         $rm -f try.c try
9705 fi
9706
9707 : check for fd_set items
9708 $cat <<EOM
9709
9710 Checking to see how well your C compiler handles fd_set and friends ...
9711 EOM
9712 $cat >fd_set.c <<EOCP
9713 #$i_systime I_SYS_TIME
9714 #$i_sysselct I_SYS_SELECT
9715 #$d_socket HAS_SOCKET
9716 #include <sys/types.h>
9717 #ifdef HAS_SOCKET
9718 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9719 #endif
9720 #ifdef I_SYS_TIME
9721 #include <sys/time.h>
9722 #endif
9723 #ifdef I_SYS_SELECT
9724 #include <sys/select.h>
9725 #endif
9726 int main() {
9727         fd_set fds;
9728
9729 #ifdef TRYBITS
9730         if(fds.fds_bits);
9731 #endif
9732
9733 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9734         exit(0);
9735 #else
9736         exit(1);
9737 #endif
9738 }
9739 EOCP
9740 set fd_set -DTRYBITS
9741 if eval $compile; then
9742         d_fds_bits="$define"
9743         d_fd_set="$define"
9744         echo "Well, your system knows about the normal fd_set typedef..." >&4
9745         if ./fd_set; then
9746                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9747                 d_fd_macros="$define"
9748         else
9749                 $cat >&4 <<'EOM'
9750 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9751 EOM
9752                 d_fd_macros="$undef"
9753         fi
9754 else
9755         $cat <<'EOM'
9756 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9757 EOM
9758         set fd_set
9759         if eval $compile; then
9760                 d_fds_bits="$undef"
9761                 d_fd_set="$define"
9762                 echo "Well, your system has some sort of fd_set available..." >&4
9763                 if ./fd_set; then
9764                         echo "and you have the normal fd_set macros." >&4
9765                         d_fd_macros="$define"
9766                 else
9767                         $cat <<'EOM'
9768 but not the normal fd_set macros!  Gross!  More work for me...
9769 EOM
9770                         d_fd_macros="$undef"
9771                 fi
9772         else
9773         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9774                 d_fd_set="$undef"
9775                 d_fds_bits="$undef"
9776                 d_fd_macros="$undef"
9777         fi
9778 fi
9779 $rm -f fd_set*
9780
9781 : see if fgetpos exists
9782 set fgetpos d_fgetpos
9783 eval $inlibc
9784
9785 : see if flock exists
9786 set flock d_flock
9787 eval $inlibc
9788
9789 : see if this is a sys/file.h system
9790 val=''
9791 set sys/file.h val
9792 eval $inhdr
9793
9794 : do we need to include sys/file.h ?
9795 case "$val" in
9796 "$define")
9797         echo " "
9798         if $h_sysfile; then
9799                 val="$define"
9800                 echo "We'll be including <sys/file.h>." >&4
9801         else
9802                 val="$undef"
9803                 echo "We won't be including <sys/file.h>." >&4
9804         fi
9805         ;;
9806 *)
9807         h_sysfile=false
9808         ;;
9809 esac
9810 set i_sysfile
9811 eval $setvar
9812
9813 : see if prototype for flock is available
9814 echo " "
9815 set d_flockproto flock $i_sysfile sys/file.h
9816 eval $hasproto
9817
9818 : see if fork exists
9819 set fork d_fork
9820 eval $inlibc
9821
9822 : see if pathconf exists
9823 set pathconf d_pathconf
9824 eval $inlibc
9825
9826 : see if fpathconf exists
9827 set fpathconf d_fpathconf
9828 eval $inlibc
9829
9830
9831 : check for fpos64_t
9832 echo " "
9833 echo "Checking to see if you have fpos64_t..." >&4
9834 $cat >try.c <<EOCP
9835 #include <stdio.h>
9836 int main() { fpos64_t x = 7; }
9837 EOCP
9838 set try
9839 if eval $compile; then
9840         val="$define"
9841         echo "You have fpos64_t."
9842 else
9843         val="$undef"
9844         echo "You do not have fpos64_t."
9845         case "$fpossize" in
9846         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9847         esac
9848 fi
9849 $rm -f try.* try
9850 set d_fpos64_t
9851 eval $setvar
9852
9853 : see if frexpl exists
9854 set frexpl d_frexpl
9855 eval $inlibc
9856
9857 : see if this is a sys/param system
9858 set sys/param.h i_sysparam
9859 eval $inhdr
9860
9861 : see if this is a sys/mount.h system
9862 set sys/mount.h i_sysmount
9863 eval $inhdr
9864
9865
9866 echo " "
9867 echo "Checking to see if your system supports struct fs_data..." >&4
9868 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9869 eval $hasstruct
9870 case "$d_fs_data_s" in
9871 "$define")      echo "Yes, it does."   ;;
9872 *)              echo "No, it doesn't." ;;
9873 esac
9874
9875 : see if fseeko exists
9876 set fseeko d_fseeko
9877 eval $inlibc
9878 case "$longsize" in
9879 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9880 esac
9881
9882 : see if fsetpos exists
9883 set fsetpos d_fsetpos
9884 eval $inlibc
9885
9886
9887 : see if fstatfs exists
9888 set fstatfs d_fstatfs
9889 eval $inlibc
9890
9891
9892 : see if statvfs exists
9893 set statvfs d_statvfs
9894 eval $inlibc
9895
9896 : see if fstatvfs exists
9897 set fstatvfs d_fstatvfs
9898 eval $inlibc
9899
9900
9901 : see if fsync exists
9902 set fsync d_fsync
9903 eval $inlibc
9904
9905 : see if ftello exists
9906 set ftello d_ftello
9907 eval $inlibc
9908 case "$longsize" in
9909 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9910 esac
9911
9912 : see if getcwd exists
9913 set getcwd d_getcwd
9914 eval $inlibc
9915
9916 : see if getespwnam exists
9917 set getespwnam d_getespwnam
9918 eval $inlibc
9919
9920
9921 : see if getfsstat exists
9922 set getfsstat d_getfsstat
9923 eval $inlibc
9924
9925 : see if getgrent exists
9926 set getgrent d_getgrent
9927 eval $inlibc
9928
9929 : see if gethostbyaddr exists
9930 set gethostbyaddr d_gethbyaddr
9931 eval $inlibc
9932
9933 : see if gethostbyname exists
9934 set gethostbyname d_gethbyname
9935 eval $inlibc
9936
9937 : see if gethostent exists
9938 set gethostent d_gethent
9939 eval $inlibc
9940
9941 : see how we will look up host name
9942 echo " "
9943 call=''
9944 if set gethostname val -f d_gethname; eval $csym; $val; then
9945         echo 'gethostname() found.' >&4
9946         d_gethname="$define"
9947         call=gethostname
9948 fi
9949 if set uname val -f d_uname; eval $csym; $val; then
9950         if ./xenix; then
9951                 $cat <<'EOM'
9952 uname() was found, but you're running xenix, and older versions of xenix
9953 have a broken uname(). If you don't really know whether your xenix is old
9954 enough to have a broken system call, use the default answer.
9955
9956 EOM
9957                 dflt=y
9958                 case "$d_uname" in
9959                 "$define") dflt=n;;
9960                 esac
9961                 rp='Is your uname() broken?'
9962                 . ./myread
9963                 case "$ans" in
9964                 n*) d_uname="$define"; call=uname;;
9965                 esac
9966         else
9967                 echo 'uname() found.' >&4
9968                 d_uname="$define"
9969                 case "$call" in
9970                 '') call=uname ;;
9971                 esac
9972         fi
9973 fi
9974 case "$d_gethname" in
9975 '') d_gethname="$undef";;
9976 esac
9977 case "$d_uname" in
9978 '') d_uname="$undef";;
9979 esac
9980 case "$d_uname$d_gethname" in
9981 *define*)
9982         dflt=n
9983         cat <<EOM
9984  
9985 Every now and then someone has a $call() that lies about the hostname
9986 but can't be fixed for political or economic reasons.  If you wish, I can
9987 pretend $call() isn't there and maybe compute hostname at run-time
9988 thanks to the '$phostname' command.
9989
9990 EOM
9991         rp="Shall I ignore $call() from now on?"
9992         . ./myread
9993         case "$ans" in
9994         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9995         esac;;
9996 esac
9997 case "$phostname" in
9998 '') aphostname='';;
9999 *) case "$aphostname" in
10000         /*) ;;
10001         *) set X $phostname
10002                 shift
10003                 file=$1
10004                 shift
10005                 file=`./loc $file $file $pth`
10006                 aphostname=`echo $file $*`
10007                 ;;
10008         esac
10009         ;;
10010 esac
10011 case "$d_uname$d_gethname" in
10012 *define*) ;;
10013 *)
10014         case "$phostname" in
10015         '')
10016                 echo "There will be no way for $package to get your hostname." >&4;;
10017         *)
10018         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10019                 ;;
10020         esac;;
10021 esac
10022 case "$d_phostname" in
10023 '') d_phostname="$undef";;
10024 esac
10025
10026 : see if this is a netdb.h system
10027 set netdb.h i_netdb
10028 eval $inhdr
10029
10030 : see if prototypes for various gethostxxx netdb.h functions are available
10031 echo " "
10032 set d_gethostprotos gethostent $i_netdb netdb.h
10033 eval $hasproto
10034
10035 : see if getitimer exists
10036 set getitimer d_getitimer
10037 eval $inlibc
10038
10039 : see if getlogin exists
10040 set getlogin d_getlogin
10041 eval $inlibc
10042
10043 : see if getmnt exists
10044 set getmnt d_getmnt
10045 eval $inlibc
10046
10047 : see if getmntent exists
10048 set getmntent d_getmntent
10049 eval $inlibc
10050
10051 : see if getnetbyaddr exists
10052 set getnetbyaddr d_getnbyaddr
10053 eval $inlibc
10054
10055 : see if getnetbyname exists
10056 set getnetbyname d_getnbyname
10057 eval $inlibc
10058
10059 : see if getnetent exists
10060 set getnetent d_getnent
10061 eval $inlibc
10062
10063 : see if prototypes for various getnetxxx netdb.h functions are available
10064 echo " "
10065 set d_getnetprotos getnetent $i_netdb netdb.h
10066 eval $hasproto
10067
10068 : see if getpagesize exists
10069 set getpagesize d_getpagsz
10070 eval $inlibc
10071
10072
10073 : see if getprotobyname exists
10074 set getprotobyname d_getpbyname
10075 eval $inlibc
10076
10077 : see if getprotobynumber exists
10078 set getprotobynumber d_getpbynumber
10079 eval $inlibc
10080
10081 : see if getprotoent exists
10082 set getprotoent d_getpent
10083 eval $inlibc
10084
10085 : see if getpgid exists
10086 set getpgid d_getpgid
10087 eval $inlibc
10088
10089 : see if getpgrp2 exists
10090 set getpgrp2 d_getpgrp2
10091 eval $inlibc
10092
10093 : see if getppid exists
10094 set getppid d_getppid
10095 eval $inlibc
10096
10097 : see if getpriority exists
10098 set getpriority d_getprior
10099 eval $inlibc
10100
10101 : see if prototypes for various getprotoxxx netdb.h functions are available
10102 echo " "
10103 set d_getprotoprotos getprotoent $i_netdb netdb.h
10104 eval $hasproto
10105
10106 : see if getprpwnam exists
10107 set getprpwnam d_getprpwnam
10108 eval $inlibc
10109
10110 : see if getpwent exists
10111 set getpwent d_getpwent
10112 eval $inlibc
10113
10114
10115 : see if getservbyname exists
10116 set getservbyname d_getsbyname
10117 eval $inlibc
10118
10119 : see if getservbyport exists
10120 set getservbyport d_getsbyport
10121 eval $inlibc
10122
10123 : see if getservent exists
10124 set getservent d_getsent
10125 eval $inlibc
10126
10127 : see if prototypes for various getservxxx netdb.h functions are available
10128 echo " "
10129 set d_getservprotos getservent $i_netdb netdb.h
10130 eval $hasproto
10131
10132 : see if getspnam exists
10133 set getspnam d_getspnam
10134 eval $inlibc
10135
10136 : see if gettimeofday or ftime exists
10137 set gettimeofday d_gettimeod
10138 eval $inlibc
10139 case "$d_gettimeod" in
10140 "$undef")
10141         set ftime d_ftime 
10142         eval $inlibc
10143         ;;
10144 *)
10145         val="$undef"; set d_ftime; eval $setvar
10146         ;;
10147 esac
10148 case "$d_gettimeod$d_ftime" in
10149 "$undef$undef")
10150         echo " "
10151         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10152         ;;
10153 esac
10154
10155 : see if this is an grp system
10156 set grp.h i_grp
10157 eval $inhdr
10158
10159 case "$i_grp" in
10160 $define)
10161         xxx=`./findhdr grp.h`
10162         $cppstdin $cppflags $cppminus < $xxx >$$.h
10163
10164         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10165                 val="$define"
10166         else
10167                 val="$undef"
10168         fi
10169         set d_grpasswd
10170         eval $setvar
10171
10172         $rm -f $$.h
10173         ;;
10174 *)
10175         val="$undef";
10176         set d_grpasswd; eval $setvar
10177         ;;
10178 esac
10179
10180 : see if hasmntopt exists
10181 set hasmntopt d_hasmntopt
10182 eval $inlibc
10183
10184 : see if this is a netinet/in.h or sys/in.h system
10185 set netinet/in.h i_niin sys/in.h i_sysin
10186 eval $inhdr
10187
10188 : see if arpa/inet.h has to be included
10189 set arpa/inet.h i_arpainet
10190 eval $inhdr
10191
10192 : see if htonl --and friends-- exists
10193 val=''
10194 set htonl val
10195 eval $inlibc
10196
10197 : Maybe they are macros.
10198 case "$val" in
10199 $undef)
10200         $cat >htonl.c <<EOM
10201 #include <stdio.h>
10202 #include <sys/types.h>
10203 #$i_niin I_NETINET_IN
10204 #$i_sysin I_SYS_IN
10205 #$i_arpainet I_ARPA_INET
10206 #ifdef I_NETINET_IN
10207 #include <netinet/in.h>
10208 #endif
10209 #ifdef I_SYS_IN
10210 #include <sys/in.h>
10211 #endif
10212 #ifdef I_ARPA_INET
10213 #include <arpa/inet.h>
10214 #endif
10215 #ifdef htonl
10216 printf("Defined as a macro.");
10217 #endif
10218 EOM
10219         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10220         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10221                 val="$define"
10222                 echo "But it seems to be defined as a macro." >&4
10223         fi
10224         $rm -f htonl.?
10225         ;;
10226 esac
10227 set d_htonl
10228 eval $setvar
10229
10230 : see if iconv exists
10231 set iconv d_iconv
10232 eval $inlibc
10233
10234 : index or strchr
10235 echo " "
10236 if set index val -f; eval $csym; $val; then
10237         if set strchr val -f d_strchr; eval $csym; $val; then
10238                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10239                         val="$define"
10240                         vali="$undef"
10241                         echo "strchr() found." >&4
10242                 else
10243                         val="$undef"
10244                         vali="$define"
10245                         echo "index() found." >&4
10246                 fi
10247         else
10248                 val="$undef"
10249                 vali="$define"
10250                 echo "index() found." >&4
10251         fi
10252 else
10253         if set strchr val -f d_strchr; eval $csym; $val; then
10254                 val="$define"
10255                 vali="$undef"
10256                 echo "strchr() found." >&4
10257         else
10258                 echo "No index() or strchr() found!" >&4
10259                 val="$undef"
10260                 vali="$undef"
10261         fi
10262 fi
10263 set d_strchr; eval $setvar
10264 val="$vali"
10265 set d_index; eval $setvar
10266
10267 : check whether inet_aton exists
10268 set inet_aton d_inetaton
10269 eval $inlibc
10270
10271 : Look for isascii
10272 echo " "
10273 $cat >isascii.c <<'EOCP'
10274 #include <stdio.h>
10275 #include <ctype.h>
10276 int main() {
10277         int c = 'A';
10278         if (isascii(c))
10279                 exit(0);
10280         else
10281                 exit(1);
10282 }
10283 EOCP
10284 set isascii
10285 if eval $compile; then
10286         echo "isascii() found." >&4
10287         val="$define"
10288 else
10289         echo "isascii() NOT found." >&4
10290         val="$undef"
10291 fi
10292 set d_isascii
10293 eval $setvar
10294 $rm -f isascii*
10295
10296 : see if isnan exists
10297 set isnan d_isnan
10298 eval $inlibc
10299
10300 : see if isnanl exists
10301 set isnanl d_isnanl
10302 eval $inlibc
10303
10304 : see if killpg exists
10305 set killpg d_killpg
10306 eval $inlibc
10307
10308 : see if lchown exists
10309 echo " "
10310 $cat > try.c <<'EOCP'
10311 /* System header to define __stub macros and hopefully few prototypes,
10312     which can conflict with char lchown(); below.  */
10313 #include <assert.h>
10314 /* Override any gcc2 internal prototype to avoid an error.  */
10315 /* We use char because int might match the return type of a gcc2
10316    builtin and then its argument prototype would still apply.  */
10317 char lchown();
10318 int main() {
10319     /*  The GNU C library defines this for functions which it implements
10320         to always fail with ENOSYS.  Some functions are actually named
10321         something starting with __ and the normal name is an alias.  */
10322 #if defined (__stub_lchown) || defined (__stub___lchown)
10323 choke me
10324 #else
10325 lchown();
10326 #endif
10327 ; return 0; }
10328 EOCP
10329 set try
10330 if eval $compile; then
10331     $echo "lchown() found." >&4
10332     val="$define"
10333 else
10334     $echo "lchown() NOT found." >&4
10335     val="$undef"
10336 fi
10337 set d_lchown
10338 eval $setvar
10339
10340 : See if number of significant digits in a double precision number is known
10341 echo " "
10342 $cat >ldbl_dig.c <<EOM
10343 #$i_limits I_LIMITS
10344 #$i_float I_FLOAT
10345 #ifdef I_LIMITS
10346 #include <limits.h>
10347 #endif
10348 #ifdef I_FLOAT
10349 #include <float.h>
10350 #endif
10351 #ifdef LDBL_DIG
10352 printf("Contains LDBL_DIG");
10353 #endif
10354 EOM
10355 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10356 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10357         echo "LDBL_DIG found." >&4
10358         val="$define"
10359 else
10360         echo "LDBL_DIG NOT found." >&4
10361         val="$undef"
10362 fi
10363 $rm -f ldbl_dig.?
10364 set d_ldbl_dig
10365 eval $setvar
10366
10367 : see if link exists
10368 set link d_link
10369 eval $inlibc
10370
10371 : see if localeconv exists
10372 set localeconv d_locconv
10373 eval $inlibc
10374
10375 : see if lockf exists
10376 set lockf d_lockf
10377 eval $inlibc
10378
10379 : see if prototype for lseek is available
10380 echo " "
10381 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10382 eval $hasproto
10383
10384 : see if lstat exists
10385 set lstat d_lstat
10386 eval $inlibc
10387
10388 : see if madvise exists
10389 set madvise d_madvise
10390 eval $inlibc
10391
10392 : see if mblen exists
10393 set mblen d_mblen
10394 eval $inlibc
10395
10396 : see if mbstowcs exists
10397 set mbstowcs d_mbstowcs
10398 eval $inlibc
10399
10400 : see if mbtowc exists
10401 set mbtowc d_mbtowc
10402 eval $inlibc
10403
10404 : see if memchr exists
10405 set memchr d_memchr
10406 eval $inlibc
10407
10408 : see if memcmp exists
10409 set memcmp d_memcmp
10410 eval $inlibc
10411
10412 : see if memcpy exists
10413 set memcpy d_memcpy
10414 eval $inlibc
10415
10416 : see if memmove exists
10417 set memmove d_memmove
10418 eval $inlibc
10419
10420 : see if memset exists
10421 set memset d_memset
10422 eval $inlibc
10423
10424 : see if mkdir exists
10425 set mkdir d_mkdir
10426 eval $inlibc
10427
10428 : see if mkdtemp exists
10429 set mkdtemp d_mkdtemp
10430 eval $inlibc
10431
10432 : see if mkfifo exists
10433 set mkfifo d_mkfifo
10434 eval $inlibc
10435
10436 : see if mkstemp exists
10437 set mkstemp d_mkstemp
10438 eval $inlibc
10439
10440 : see if mkstemps exists
10441 set mkstemps d_mkstemps
10442 eval $inlibc
10443
10444 : see if mktime exists
10445 set mktime d_mktime
10446 eval $inlibc
10447
10448 : see if this is a sys/mman.h system
10449 set sys/mman.h i_sysmman
10450 eval $inhdr
10451
10452 : see if mmap exists
10453 set mmap d_mmap
10454 eval $inlibc
10455 : see what shmat returns
10456 : default to something harmless
10457 mmaptype='void *'
10458 case "$i_sysmman$d_mmap" in
10459 "$define$define")
10460         $cat >mmap.c <<'END'
10461 #include <sys/mman.h>
10462 void *mmap();
10463 END
10464         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10465                 mmaptype='void *'
10466         else
10467                 mmaptype='caddr_t'
10468         fi
10469         echo "and it returns ($mmaptype)." >&4
10470         ;;
10471 esac
10472
10473
10474
10475 : see if modfl exists
10476 set modfl d_modfl
10477 eval $inlibc
10478
10479 case "$d_longdbl$d_modfl" in
10480 $define$define)
10481         $cat <<EOM
10482 Checking to see whether your modfl() is okay for large values...
10483 EOM
10484 $cat >try.c <<EOCP
10485 #include <math.h> 
10486 #include <stdio.h>
10487 int main() {
10488     long double nv = 4294967303.15;
10489     long double v, w;
10490     v = modfl(nv, &w);         
10491 #ifdef __GLIBC__
10492     printf("glibc");
10493 #endif
10494     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10495     return 0;
10496 }
10497 EOCP
10498         case "$osname:$gccversion" in
10499         aix:)   saveccflags="$ccflags"
10500                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10501         esac
10502         set try
10503         if eval $compile; then
10504                 foo=`./try`
10505                 case "$foo" in
10506                 *" 4294967303.150000 1.150000 4294967302.000000")
10507                         echo >&4 "Your modfl() is broken for large values."
10508                         d_modfl="$undef"
10509                         case "$foo" in
10510                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
10511                         ;;
10512                         esac
10513                         ;;
10514                 *" 4294967303.150000 0.150000 4294967303.000000")
10515                         echo >&4 "Your modfl() seems okay for large values."
10516                         ;;
10517                 *)      echo >&4 "I don't understand your modfl() at all."
10518                         d_modfl="$undef"
10519                         ;;
10520                 esac
10521                 $rm -f try.* try core core.try.*
10522         else
10523                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
10524                 d_modfl="$undef"
10525         fi
10526         case "$osname:$gccversion" in
10527         aix:)   $ccflags="saveccflags" ;; # restore
10528         esac
10529         ;;
10530 esac
10531
10532 : see if mprotect exists
10533 set mprotect d_mprotect
10534 eval $inlibc
10535
10536 : see if msgctl exists
10537 set msgctl d_msgctl
10538 eval $inlibc
10539
10540 : see if msgget exists
10541 set msgget d_msgget
10542 eval $inlibc
10543
10544 : see if msgsnd exists
10545 set msgsnd d_msgsnd
10546 eval $inlibc
10547
10548 : see if msgrcv exists
10549 set msgrcv d_msgrcv
10550 eval $inlibc
10551
10552 : see how much of the 'msg*(2)' library is present.
10553 h_msg=true
10554 echo " "
10555 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10556 *"$undef"*) h_msg=false;;
10557 esac
10558 case "$osname" in
10559 freebsd)
10560     case "`ipcs 2>&1`" in
10561     "SVID messages"*"not configured"*)
10562         echo "Your $osname does not have the msg*(2) configured." >&4
10563         h_msg=false
10564         val="$undef"
10565         set msgctl d_msgctl
10566         eval $setvar
10567         set msgget d_msgget
10568         eval $setvar
10569         set msgsnd d_msgsnd
10570         eval $setvar
10571         set msgrcv d_msgrcv
10572         eval $setvar
10573         ;;
10574     esac
10575     ;;
10576 esac
10577 : we could also check for sys/ipc.h ...
10578 if $h_msg && $test `./findhdr sys/msg.h`; then
10579         echo "You have the full msg*(2) library." >&4
10580         val="$define"
10581 else
10582         echo "You don't have the full msg*(2) library." >&4
10583         val="$undef"
10584 fi
10585 set d_msg
10586 eval $setvar
10587
10588
10589 echo " "
10590 echo "Checking to see if your system supports struct msghdr..." >&4
10591 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10592 eval $hasstruct
10593 case "$d_msghdr_s" in
10594 "$define")      echo "Yes, it does."   ;;
10595 *)              echo "No, it doesn't." ;;
10596 esac
10597
10598
10599 : see if msync exists
10600 set msync d_msync
10601 eval $inlibc
10602
10603 : see if munmap exists
10604 set munmap d_munmap
10605 eval $inlibc
10606
10607 : see if nice exists
10608 set nice d_nice
10609 eval $inlibc
10610
10611 : check for length of character
10612 echo " "
10613 case "$charsize" in
10614 '')
10615         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10616         $cat >try.c <<'EOCP'
10617 #include <stdio.h>
10618 int main()
10619 {
10620     printf("%d\n", (int)sizeof(char));
10621     exit(0);
10622 }
10623 EOCP
10624         set try
10625         if eval $compile_ok; then
10626                 dflt=`./try`
10627         else
10628                 dflt='1'
10629                 echo "(I can't seem to compile the test program.  Guessing...)"
10630         fi
10631         ;;
10632 *)
10633         dflt="$charsize"
10634         ;;
10635 esac
10636 rp="What is the size of a character (in bytes)?"
10637 . ./myread
10638 charsize="$ans"
10639 $rm -f try.c try
10640
10641 : check for volatile keyword
10642 echo " "
10643 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10644 $cat >try.c <<'EOCP'
10645 int main()
10646 {
10647         typedef struct _goo_struct goo_struct;
10648         goo_struct * volatile goo = ((goo_struct *)0);
10649         struct _goo_struct {
10650                 long long_int;
10651                 int reg_int;
10652                 char char_var;
10653         };
10654         typedef unsigned short foo_t;
10655         char *volatile foo;
10656         volatile int bar;
10657         volatile foo_t blech;
10658         foo = foo;
10659 }
10660 EOCP
10661 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10662         val="$define"
10663         echo "Yup, it does."
10664 else
10665         val="$undef"
10666         echo "Nope, it doesn't."
10667 fi
10668 set d_volatile
10669 eval $setvar
10670 $rm -f try.*
10671
10672
10673 echo " "
10674 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10675
10676 case "$use64bitint:$d_quad:$quadtype" in
10677 define:define:?*)
10678         ivtype="$quadtype"
10679         uvtype="$uquadtype"
10680         ivsize=8
10681         uvsize=8
10682         ;;
10683 *)      ivtype="long"
10684         uvtype="unsigned long"
10685         ivsize=$longsize
10686         uvsize=$longsize
10687         ;;
10688 esac
10689
10690 case "$uselongdouble:$d_longdbl" in
10691 define:define)
10692         nvtype="long double"
10693         nvsize=$longdblsize
10694         ;;
10695 *)      nvtype=double
10696         nvsize=$doublesize
10697         ;;
10698 esac
10699
10700 $echo "(IV will be "$ivtype", $ivsize bytes)"
10701 $echo "(UV will be "$uvtype", $uvsize bytes)"
10702 $echo "(NV will be "$nvtype", $nvsize bytes)"
10703
10704 $cat >try.c <<EOCP
10705 #$i_inttypes I_INTTYPES
10706 #ifdef I_INTTYPES
10707 #include <inttypes.h>
10708 #endif
10709 #include <stdio.h>
10710 int main() {
10711 #ifdef INT8
10712    int8_t i =  INT8_MAX;
10713   uint8_t u = UINT8_MAX;
10714   printf("int8_t\n");
10715 #endif
10716 #ifdef INT16
10717    int16_t i =  INT16_MAX;
10718   uint16_t i = UINT16_MAX;
10719   printf("int16_t\n");
10720 #endif
10721 #ifdef INT32
10722    int32_t i =  INT32_MAX;
10723   uint32_t u = UINT32_MAX;
10724   printf("int32_t\n");
10725 #endif
10726 }
10727 EOCP
10728
10729 case "$i8type" in
10730 '')     case "$charsize" in
10731         1)      i8type=char
10732                 u8type="unsigned char"
10733                 i8size=$charsize
10734                 u8size=$charsize
10735                 ;;
10736         esac
10737         ;;
10738 esac
10739 case "$i8type" in
10740 '')     set try -DINT8
10741         if eval $compile; then
10742                 case "`./try$exe_ext`" in
10743                 int8_t) i8type=int8_t
10744                         u8type=uint8_t
10745                         i8size=1
10746                         u8size=1
10747                         ;;
10748                 esac
10749         fi
10750         ;;
10751 esac
10752 case "$i8type" in
10753 '')     if $test $charsize -ge 1; then
10754                 i8type=char
10755                 u8type="unsigned char"
10756                 i8size=$charsize
10757                 u8size=$charsize
10758         fi
10759         ;;
10760 esac
10761
10762 case "$i16type" in
10763 '')     case "$shortsize" in
10764         2)      i16type=short
10765                 u16type="unsigned short"
10766                 i16size=$shortsize
10767                 u16size=$shortsize
10768                 ;;
10769         esac
10770         ;;
10771 esac
10772 case "$i16type" in
10773 '')     set try -DINT16
10774         if eval $compile; then
10775                 case "`./try$exe_ext`" in
10776                 int16_t)
10777                         i16type=int16_t
10778                         u16type=uint16_t
10779                         i16size=2
10780                         u16size=2
10781                         ;;
10782                 esac
10783         fi
10784         ;;
10785 esac
10786 case "$i16type" in
10787 '')     if $test $shortsize -ge 2; then
10788                 i16type=short
10789                 u16type="unsigned short"
10790                 i16size=$shortsize
10791                 u16size=$shortsize
10792         fi
10793         ;;
10794 esac
10795
10796 case "$i32type" in
10797 '')     case "$longsize" in
10798         4)      i32type=long
10799                 u32type="unsigned long"
10800                 i32size=$longsize
10801                 u32size=$longsize
10802                 ;;
10803         *)      case "$intsize" in
10804                 4)      i32type=int
10805                         u32type="unsigned int"
10806                         i32size=$intsize
10807                         u32size=$intsize
10808                         ;;
10809                 esac
10810                 ;;
10811         esac
10812         ;;
10813 esac
10814 case "$i32type" in
10815 '')     set try -DINT32
10816         if eval $compile; then
10817                 case "`./try$exe_ext`" in
10818                 int32_t)
10819                         i32type=int32_t
10820                         u32type=uint32_t
10821                         i32size=4
10822                         u32size=4
10823                         ;;
10824                 esac
10825         fi
10826         ;;
10827 esac
10828 case "$i32type" in
10829 '')     if $test $intsize -ge 4; then
10830                 i32type=int
10831                 u32type="unsigned int"
10832                 i32size=$intsize
10833                 u32size=$intsize
10834         fi
10835         ;;
10836 esac
10837
10838 case "$i64type" in
10839 '')     case "$d_quad:$quadtype" in
10840         define:?*)
10841                 i64type="$quadtype"
10842                 u64type="$uquadtype"
10843                 i64size=8
10844                 u64size=8
10845                 ;;
10846         esac
10847         ;;
10848 esac
10849
10850 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10851 : volatile so that the compiler has to store it out to memory.
10852 if test X"$d_volatile" = X"$define"; then
10853         volatile=volatile
10854 fi
10855 $cat <<EOP >try.c
10856 #include <stdio.h>
10857 #include <sys/types.h>
10858 #include <signal.h>
10859 #ifdef SIGFPE
10860 $volatile int bletched = 0;
10861 $signal_t blech(s) int s; { bletched = 1; }
10862 #endif
10863 int main() {
10864     $uvtype u = 0;
10865     $nvtype d;
10866     int     n = 8 * $uvsize;
10867     int     i;
10868 #ifdef SIGFPE
10869     signal(SIGFPE, blech);
10870 #endif
10871
10872     for (i = 0; i < n; i++) {
10873       u = u << 1 | ($uvtype)1;
10874       d = ($nvtype)u;
10875       if (($uvtype)d != u)
10876         break;
10877       if (d <= 0)
10878         break;
10879       d = ($nvtype)(u - 1);
10880       if (($uvtype)d != (u - 1))
10881         break;
10882 #ifdef SIGFPE
10883       if (bletched) {
10884         break;
10885 #endif
10886       } 
10887     }
10888     printf("%d\n", ((i == n) ? -n : i));
10889     exit(0);
10890 }
10891 EOP
10892 set try
10893
10894 d_nv_preserves_uv="$undef"
10895 if eval $compile; then
10896         d_nv_preserves_uv_bits="`./try$exe_ext`"
10897 fi
10898 case "$d_nv_preserves_uv_bits" in
10899 \-[1-9]*)       
10900         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10901         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10902         d_nv_preserves_uv="$define"
10903         ;;
10904 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10905         d_nv_preserves_uv="$undef" ;;
10906 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10907         d_nv_preserves_uv_bits="$undef" ;;
10908 esac
10909
10910 $rm -f try.* try
10911
10912
10913 : check for off64_t
10914 echo " "
10915 echo "Checking to see if you have off64_t..." >&4
10916 $cat >try.c <<EOCP
10917 #include <sys/types.h>
10918 #include <unistd.h>
10919 int main() { off64_t x = 7; }
10920 EOCP
10921 set try
10922 if eval $compile; then
10923         val="$define"
10924         echo "You have off64_t."
10925 else
10926         val="$undef"
10927         echo "You do not have off64_t."
10928         case "$lseeksize" in
10929         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10930         esac
10931 fi
10932 $rm -f try.* try
10933 set d_off64_t
10934 eval $setvar
10935
10936 : see if POSIX threads are available
10937 set pthread.h i_pthread
10938 eval $inhdr
10939
10940
10941
10942
10943 : how to create joinable pthreads
10944 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10945         echo " "
10946         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10947         $cat >try.c <<'EOCP'
10948 #include <pthread.h>
10949 int main() {
10950     int detachstate = JOINABLE;
10951 }
10952 EOCP
10953         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10954         if eval $compile; then
10955                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10956                 val="$undef" # Yes, undef.
10957                 set d_old_pthread_create_joinable
10958                 eval $setvar
10959                 val=""
10960                 set old_pthread_create_joinable
10961                 eval $setvar
10962         else
10963                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10964                 if eval $compile; then
10965                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10966                         val="$define"
10967                         set d_old_pthread_create_joinable
10968                         eval $setvar
10969                         val=PTHREAD_CREATE_UNDETACHED
10970                         set old_pthread_create_joinable
10971                         eval $setvar
10972                 else            
10973                         set try -DJOINABLE=__UNDETACHED
10974                         if eval $compile; then
10975                                 echo "You seem to use __UNDETACHED." >&4
10976                                 val="$define"
10977                                 set d_old_pthread_create_joinable
10978                                 eval $setvar
10979                                 val=__UNDETACHED
10980                                 set old_pthread_create_joinable
10981                                 eval $setvar
10982                         else
10983                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10984                                 val="$define"
10985                                 set d_old_pthread_create_joinable
10986                                 eval $setvar
10987                                 val=0
10988                                 set old_pthread_create_joinable
10989                                 eval $setvar
10990                         fi
10991                 fi
10992         fi
10993         $rm -f try try.*
10994 else
10995     d_old_pthread_create_joinable="$undef"
10996     old_pthread_create_joinable=""
10997 fi
10998
10999 : see if pause exists
11000 set pause d_pause
11001 eval $inlibc
11002
11003 : see if pipe exists
11004 set pipe d_pipe
11005 eval $inlibc
11006
11007 : see if poll exists
11008 set poll d_poll
11009 eval $inlibc
11010
11011
11012 : see whether the various POSIXish _yields exist
11013 $cat >try.c <<EOP
11014 #include <pthread.h>
11015 #include <stdio.h>
11016 int main() {
11017 #ifdef SCHED_YIELD
11018         sched_yield();
11019 #else
11020 #ifdef PTHREAD_YIELD
11021         pthread_yield();
11022 #else
11023 #ifdef PTHREAD_YIELD_NULL
11024         pthread_yield(NULL);
11025 #endif
11026 #endif
11027 #endif
11028 }
11029 EOP
11030 : see if sched_yield exists
11031 set try -DSCHED_YIELD
11032 if eval $compile; then
11033     val="$define"
11034     sched_yield='sched_yield()'
11035 else
11036     val="$undef"
11037 fi
11038 case "$usethreads" in
11039 $define)
11040         case "$val" in
11041         $define) echo 'sched_yield() found.' >&4        ;;
11042         *)       echo 'sched_yield() NOT found.' >&4    ;;
11043         esac
11044 esac
11045 set d_sched_yield
11046 eval $setvar
11047
11048 : see if pthread_yield exists
11049 set try -DPTHREAD_YIELD
11050 if eval $compile; then
11051     val="$define"
11052     case "$sched_yield" in
11053     '') sched_yield='pthread_yield()' ;;
11054     esac
11055 else
11056     set try -DPTHREAD_YIELD_NULL
11057     if eval $compile; then
11058         val="$define"
11059         case "$sched_yield" in
11060         '') sched_yield='pthread_yield(NULL)' ;;
11061         esac
11062     else
11063         val="$undef"
11064     fi
11065 fi
11066 case "$usethreads" in
11067 $define)
11068         case "$val" in
11069         $define) echo 'pthread_yield() found.' >&4      ;;
11070         *)       echo 'pthread_yield() NOT found.' >&4  ;;
11071         esac
11072         ;;
11073 esac
11074 set d_pthread_yield
11075 eval $setvar
11076
11077 case "$sched_yield" in
11078 '') sched_yield=undef ;;
11079 esac
11080
11081 $rm -f try try.*
11082
11083 : see if this is a pwd.h system
11084 set pwd.h i_pwd
11085 eval $inhdr
11086
11087 case "$i_pwd" in
11088 $define)
11089         xxx=`./findhdr pwd.h`
11090         $cppstdin $cppflags $cppminus < $xxx >$$.h
11091
11092         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11093                 val="$define"
11094         else
11095                 val="$undef"
11096         fi
11097         set d_pwquota
11098         eval $setvar
11099
11100         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11101                 val="$define"
11102         else
11103                 val="$undef"
11104         fi
11105         set d_pwage
11106         eval $setvar
11107
11108         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11109                 val="$define"
11110         else
11111                 val="$undef"
11112         fi
11113         set d_pwchange
11114         eval $setvar
11115
11116         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11117                 val="$define"
11118         else
11119                 val="$undef"
11120         fi
11121         set d_pwclass
11122         eval $setvar
11123
11124         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11125                 val="$define"
11126         else
11127                 val="$undef"
11128         fi
11129         set d_pwexpire
11130         eval $setvar
11131
11132         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11133                 val="$define"
11134         else
11135                 val="$undef"
11136         fi
11137         set d_pwcomment
11138         eval $setvar
11139
11140         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11141                 val="$define"
11142         else
11143                 val="$undef"
11144         fi
11145         set d_pwgecos
11146         eval $setvar
11147
11148         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11149                 val="$define"
11150         else
11151                 val="$undef"
11152         fi
11153         set d_pwpasswd
11154         eval $setvar
11155
11156         $rm -f $$.h
11157         ;;
11158 *)
11159         val="$undef"; 
11160         set d_pwquota; eval $setvar
11161         set d_pwage; eval $setvar
11162         set d_pwchange; eval $setvar
11163         set d_pwclass; eval $setvar
11164         set d_pwexpire; eval $setvar
11165         set d_pwcomment; eval $setvar
11166         set d_pwgecos; eval $setvar
11167         set d_pwpasswd; eval $setvar
11168         ;;
11169 esac
11170
11171 : see if readdir and friends exist
11172 set readdir d_readdir
11173 eval $inlibc
11174 set seekdir d_seekdir
11175 eval $inlibc
11176 set telldir d_telldir
11177 eval $inlibc
11178 set rewinddir d_rewinddir
11179 eval $inlibc
11180
11181 : see if readlink exists
11182 set readlink d_readlink
11183 eval $inlibc
11184
11185 : see if readv exists
11186 set readv d_readv
11187 eval $inlibc
11188
11189 : see if realpath exists
11190 set realpath d_realpath
11191 eval $inlibc
11192
11193 : see if recvmsg exists
11194 set recvmsg d_recvmsg
11195 eval $inlibc
11196
11197 : see if rename exists
11198 set rename d_rename
11199 eval $inlibc
11200
11201 : see if rmdir exists
11202 set rmdir d_rmdir
11203 eval $inlibc
11204
11205 : see if memory.h is available.
11206 val=''
11207 set memory.h val
11208 eval $inhdr
11209
11210 : See if it conflicts with string.h
11211 case "$val" in
11212 $define)
11213         case "$strings" in
11214         '') ;;
11215         *)
11216                 $cppstdin $cppflags $cppminus < $strings > mem.h
11217                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11218                         echo " "
11219                         echo "We won't be including <memory.h>."
11220                         val="$undef"
11221                 fi
11222                 $rm -f mem.h
11223                 ;;
11224         esac
11225 esac
11226 set i_memory
11227 eval $setvar
11228
11229 : can bcopy handle overlapping blocks?
11230 val="$undef"
11231 case "$d_bcopy" in
11232 "$define")
11233         echo " "
11234         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11235         $cat >try.c <<EOCP
11236 #$i_memory I_MEMORY
11237 #$i_stdlib I_STDLIB
11238 #$i_string I_STRING
11239 #$i_unistd I_UNISTD
11240 EOCP
11241         $cat >>try.c <<'EOCP'
11242 #include <stdio.h>
11243 #ifdef I_MEMORY
11244 #  include <memory.h>
11245 #endif
11246 #ifdef I_STDLIB
11247 #  include <stdlib.h>
11248 #endif
11249 #ifdef I_STRING
11250 #  include <string.h>
11251 #else
11252 #  include <strings.h>
11253 #endif
11254 #ifdef I_UNISTD
11255 #  include <unistd.h>  /* Needed for NetBSD */
11256 #endif
11257 int main()
11258 {
11259 char buf[128], abc[128];
11260 char *b;
11261 int len;
11262 int off;
11263 int align;
11264
11265 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11266
11267 for (align = 7; align >= 0; align--) {
11268         for (len = 36; len; len--) {
11269                 b = buf+align;
11270                 bcopy(abc, b, len);
11271                 for (off = 1; off <= len; off++) {
11272                         bcopy(b, b+off, len);
11273                         bcopy(b+off, b, len);
11274                         if (bcmp(b, abc, len))
11275                                 exit(1);
11276                 }
11277         }
11278 }
11279 exit(0);
11280 }
11281 EOCP
11282         set try
11283         if eval $compile_ok; then
11284                 if ./try 2>/dev/null; then
11285                         echo "Yes, it can."
11286                         val="$define"
11287                 else
11288                         echo "It can't, sorry."
11289                         case "$d_memmove" in
11290                         "$define") echo "But that's Ok since you have memmove()." ;;
11291                         esac
11292                 fi
11293         else
11294                 echo "(I can't compile the test program, so we'll assume not...)"
11295                 case "$d_memmove" in
11296                 "$define") echo "But that's Ok since you have memmove()." ;;
11297                 esac
11298         fi
11299         ;;
11300 esac
11301 $rm -f try.* try core
11302 set d_safebcpy
11303 eval $setvar
11304
11305 : can memcpy handle overlapping blocks?
11306 val="$undef"
11307 case "$d_memcpy" in
11308 "$define")
11309         echo " "
11310         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11311         $cat >try.c <<EOCP
11312 #$i_memory I_MEMORY
11313 #$i_stdlib I_STDLIB
11314 #$i_string I_STRING
11315 #$i_unistd I_UNISTD
11316 EOCP
11317         $cat >>try.c <<'EOCP'
11318 #include <stdio.h>
11319 #ifdef I_MEMORY
11320 #  include <memory.h>
11321 #endif
11322 #ifdef I_STDLIB
11323 #  include <stdlib.h>
11324 #endif
11325 #ifdef I_STRING
11326 #  include <string.h>
11327 #else
11328 #  include <strings.h>
11329 #endif
11330 #ifdef I_UNISTD
11331 #  include <unistd.h>  /* Needed for NetBSD */
11332 #endif
11333 int main()
11334 {
11335 char buf[128], abc[128];
11336 char *b;
11337 int len;
11338 int off;
11339 int align;
11340
11341 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11342    try to store the string in read-only memory. */
11343 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11344
11345 for (align = 7; align >= 0; align--) {
11346         for (len = 36; len; len--) {
11347                 b = buf+align;
11348                 memcpy(b, abc, len);
11349                 for (off = 1; off <= len; off++) {
11350                         memcpy(b+off, b, len);
11351                         memcpy(b, b+off, len);
11352                         if (memcmp(b, abc, len))
11353                                 exit(1);
11354                 }
11355         }
11356 }
11357 exit(0);
11358 }
11359 EOCP
11360         set try
11361         if eval $compile_ok; then
11362                 if ./try 2>/dev/null; then
11363                         echo "Yes, it can."
11364                         val="$define"
11365                 else
11366                         echo "It can't, sorry."
11367                         case "$d_memmove" in
11368                         "$define") echo "But that's Ok since you have memmove()." ;;
11369                         esac
11370                 fi
11371         else
11372                 echo "(I can't compile the test program, so we'll assume not...)"
11373                 case "$d_memmove" in
11374                 "$define") echo "But that's Ok since you have memmove()." ;;
11375                 esac
11376         fi
11377         ;;
11378 esac
11379 $rm -f try.* try core
11380 set d_safemcpy
11381 eval $setvar
11382
11383 : can memcmp be trusted to compare relative magnitude?
11384 val="$undef"
11385 case "$d_memcmp" in
11386 "$define")
11387         echo " "
11388         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11389         $cat >try.c <<EOCP
11390 #$i_memory I_MEMORY
11391 #$i_stdlib I_STDLIB
11392 #$i_string I_STRING
11393 #$i_unistd I_UNISTD
11394 EOCP
11395         $cat >>try.c <<'EOCP'
11396 #include <stdio.h>
11397 #ifdef I_MEMORY
11398 #  include <memory.h>
11399 #endif
11400 #ifdef I_STDLIB
11401 #  include <stdlib.h>
11402 #endif
11403 #ifdef I_STRING
11404 #  include <string.h>
11405 #else
11406 #  include <strings.h>
11407 #endif
11408 #ifdef I_UNISTD
11409 #  include <unistd.h>  /* Needed for NetBSD */
11410 #endif
11411 int main()
11412 {
11413 char a = -1;
11414 char b = 0;
11415 if ((a < b) && memcmp(&a, &b, 1) < 0)
11416         exit(1);
11417 exit(0);
11418 }
11419 EOCP
11420         set try
11421         if eval $compile_ok; then
11422                 if ./try 2>/dev/null; then
11423                         echo "Yes, it can."
11424                         val="$define"
11425                 else
11426                         echo "No, it can't (it uses signed chars)."
11427                 fi
11428         else
11429                 echo "(I can't compile the test program, so we'll assume not...)"
11430         fi
11431         ;;
11432 esac
11433 $rm -f try.* try core
11434 set d_sanemcmp
11435 eval $setvar
11436
11437 : see if prototype for sbrk is available
11438 echo " "
11439 set d_sbrkproto sbrk $i_unistd unistd.h
11440 eval $hasproto
11441
11442 : see if select exists
11443 set select d_select
11444 eval $inlibc
11445
11446 : see if semctl exists
11447 set semctl d_semctl
11448 eval $inlibc
11449
11450 : see if semget exists
11451 set semget d_semget
11452 eval $inlibc
11453
11454 : see if semop exists
11455 set semop d_semop
11456 eval $inlibc
11457
11458 : see how much of the 'sem*(2)' library is present.
11459 h_sem=true
11460 echo " "
11461 case "$d_semctl$d_semget$d_semop" in
11462 *"$undef"*) h_sem=false;;
11463 esac
11464 case "$osname" in
11465 freebsd)
11466     case "`ipcs 2>&1`" in
11467     "SVID messages"*"not configured"*)
11468         echo "Your $osname does not have the sem*(2) configured." >&4
11469         h_sem=false
11470         val="$undef"
11471         set semctl d_semctl
11472         eval $setvar
11473         set semget d_semget
11474         eval $setvar
11475         set semop d_semop
11476         eval $setvar
11477         ;;
11478     esac
11479     ;;
11480 esac
11481 : we could also check for sys/ipc.h ...
11482 if $h_sem && $test `./findhdr sys/sem.h`; then
11483         echo "You have the full sem*(2) library." >&4
11484         val="$define"
11485 else
11486         echo "You don't have the full sem*(2) library." >&4
11487         val="$undef"
11488 fi
11489 set d_sem
11490 eval $setvar
11491
11492 : see whether sys/sem.h defines union semun
11493 echo " "
11494 $cat > try.c <<'END'
11495 #include <sys/types.h>
11496 #include <sys/ipc.h>
11497 #include <sys/sem.h>
11498 int main () { union semun semun; semun.buf = 0; }
11499 END
11500 set try
11501 if eval $compile; then
11502     echo "You have union semun in <sys/sem.h>." >&4
11503     val="$define"
11504 else
11505     echo "You do not have union semun in <sys/sem.h>." >&4
11506     val="$undef"
11507 fi
11508 $rm -f try try.c try.h
11509 set d_union_semun
11510 eval $setvar
11511
11512 : see how to do semctl IPC_STAT
11513 case "$d_sem" in
11514 $define)
11515     : see whether semctl IPC_STAT can use union semun
11516     echo " "
11517     $cat > try.h <<END
11518 #ifndef S_IRUSR
11519 #   ifdef S_IREAD
11520 #       define S_IRUSR S_IREAD
11521 #       define S_IWUSR S_IWRITE
11522 #       define S_IXUSR S_IEXEC
11523 #   else
11524 #       define S_IRUSR 0400
11525 #       define S_IWUSR 0200
11526 #       define S_IXUSR 0100
11527 #   endif
11528 #   define S_IRGRP (S_IRUSR>>3)
11529 #   define S_IWGRP (S_IWUSR>>3)
11530 #   define S_IXGRP (S_IXUSR>>3)
11531 #   define S_IROTH (S_IRUSR>>6)
11532 #   define S_IWOTH (S_IWUSR>>6)
11533 #   define S_IXOTH (S_IXUSR>>6)
11534 #endif
11535 #ifndef S_IRWXU
11536 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11537 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11538 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11539 #endif
11540 END
11541
11542     $cat > try.c <<END
11543 #include <sys/types.h>
11544 #include <sys/ipc.h>
11545 #include <sys/sem.h>
11546 #include <sys/stat.h>
11547 #include <stdio.h>
11548 #include <errno.h>
11549 #include "try.h"
11550 #ifndef errno
11551 extern int errno;
11552 #endif
11553 #$d_union_semun HAS_UNION_SEMUN
11554 int main() {
11555     union semun
11556 #ifndef HAS_UNION_SEMUN
11557     {
11558         int val;
11559         struct semid_ds *buf;
11560         unsigned short *array;
11561     }
11562 #endif
11563     arg;
11564     int sem, st;
11565
11566 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11567     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11568     if (sem > -1) {
11569         struct semid_ds argbuf;
11570         arg.buf = &argbuf;
11571 #       ifdef IPC_STAT
11572         st = semctl(sem, 0, IPC_STAT, arg);
11573         if (st == 0)
11574             printf("semun\n");
11575         else
11576 #       endif /* IPC_STAT */
11577             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11578 #       ifdef IPC_RMID
11579         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11580 #       endif /* IPC_RMID */
11581             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11582     } else
11583 #endif /* IPC_PRIVATE && ... */
11584         printf("semget failed: errno = %d\n", errno);
11585   return 0;
11586 }
11587 END
11588     val="$undef"
11589     set try
11590     if eval $compile; then
11591         xxx=`./try`
11592         case "$xxx" in
11593         semun) val="$define" ;;
11594         esac
11595     fi
11596     $rm -f try try.c
11597     set d_semctl_semun
11598     eval $setvar
11599     case "$d_semctl_semun" in
11600     $define)
11601         echo "You can use union semun for semctl IPC_STAT." >&4
11602         also='also'
11603         ;;
11604     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11605         also=''
11606         ;;
11607     esac
11608
11609     : see whether semctl IPC_STAT can use struct semid_ds pointer
11610     $cat > try.c <<'END'
11611 #include <sys/types.h>
11612 #include <sys/ipc.h>
11613 #include <sys/sem.h>
11614 #include <sys/stat.h>
11615 #include "try.h"
11616 #include <stdio.h>
11617 #include <errno.h>
11618 #ifndef errno
11619 extern int errno;
11620 #endif
11621 int main() {
11622     struct semid_ds arg;
11623     int sem, st;
11624
11625 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11626     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11627     if (sem > -1) {
11628 #       ifdef IPC_STAT
11629         st = semctl(sem, 0, IPC_STAT, &arg);
11630         if (st == 0)
11631             printf("semid_ds\n");
11632         else
11633 #       endif /* IPC_STAT */
11634             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11635 #       ifdef IPC_RMID
11636         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11637 #       endif /* IPC_RMID */
11638             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11639     } else
11640 #endif /* IPC_PRIVATE && ... */
11641         printf("semget failed: errno = %d\n", errno);
11642
11643     return 0;
11644 }
11645 END
11646     val="$undef"
11647     set try
11648     if eval $compile; then
11649         xxx=`./try`
11650         case "$xxx" in
11651         semid_ds) val="$define" ;;
11652         esac
11653     fi
11654     $rm -f try try.c
11655     set d_semctl_semid_ds
11656     eval $setvar
11657     case "$d_semctl_semid_ds" in
11658     $define)
11659         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11660         ;;
11661     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11662         ;;
11663     esac
11664     $rm -f try.h
11665     ;;
11666 *)  val="$undef"
11667
11668     # We do not have the full sem*(2) library, so assume we can not
11669     # use either.
11670
11671     set d_semctl_semun
11672     eval $setvar
11673
11674     set d_semctl_semid_ds
11675     eval $setvar
11676     ;;
11677 esac
11678
11679 : see if sendmsg exists
11680 set sendmsg d_sendmsg
11681 eval $inlibc
11682
11683 : see if setegid exists
11684 set setegid d_setegid
11685 eval $inlibc
11686
11687 : see if seteuid exists
11688 set seteuid d_seteuid
11689 eval $inlibc
11690
11691 : see if setgrent exists
11692 set setgrent d_setgrent
11693 eval $inlibc
11694
11695 : see if sethostent exists
11696 set sethostent d_sethent
11697 eval $inlibc
11698
11699 : see if setitimer exists
11700 set setitimer d_setitimer
11701 eval $inlibc
11702
11703 : see if setlinebuf exists
11704 set setlinebuf d_setlinebuf
11705 eval $inlibc
11706
11707 : see if setlocale exists
11708 set setlocale d_setlocale
11709 eval $inlibc
11710
11711 : see if setnetent exists
11712 set setnetent d_setnent
11713 eval $inlibc
11714
11715 : see if setprotoent exists
11716 set setprotoent d_setpent
11717 eval $inlibc
11718
11719 : see if setpgid exists
11720 set setpgid d_setpgid
11721 eval $inlibc
11722
11723 : see if setpgrp2 exists
11724 set setpgrp2 d_setpgrp2
11725 eval $inlibc
11726
11727 : see if setpriority exists
11728 set setpriority d_setprior
11729 eval $inlibc
11730
11731 : see if setproctitle exists
11732 set setproctitle d_setproctitle
11733 eval $inlibc
11734
11735 : see if setpwent exists
11736 set setpwent d_setpwent
11737 eval $inlibc
11738
11739 : see if setregid exists
11740 set setregid d_setregid
11741 eval $inlibc
11742 set setresgid d_setresgid
11743 eval $inlibc
11744
11745 : see if setreuid exists
11746 set setreuid d_setreuid
11747 eval $inlibc
11748 set setresuid d_setresuid
11749 eval $inlibc
11750
11751 : see if setrgid exists
11752 set setrgid d_setrgid
11753 eval $inlibc
11754
11755 : see if setruid exists
11756 set setruid d_setruid
11757 eval $inlibc
11758
11759 : see if setservent exists
11760 set setservent d_setsent
11761 eval $inlibc
11762
11763 : see if setsid exists
11764 set setsid d_setsid
11765 eval $inlibc
11766
11767 : see if setvbuf exists
11768 set setvbuf d_setvbuf
11769 eval $inlibc
11770
11771 : see if sfio.h is available
11772 set sfio.h i_sfio
11773 eval $inhdr
11774
11775
11776 : see if sfio library is available
11777 case "$i_sfio" in
11778 $define)
11779         val=''
11780         set sfreserve val
11781         eval $inlibc
11782         ;;
11783 *)
11784         val="$undef"
11785         ;;
11786 esac
11787 : Ok, but do we want to use it.
11788 case "$val" in
11789 $define)
11790         case "$usesfio" in
11791         true|$define|[yY]*) dflt='y';;
11792         *) dflt='n';;
11793         esac
11794         echo "$package can use the sfio library, but it is experimental."
11795         case "$useperlio" in
11796         "$undef")
11797             echo "For sfio also the PerlIO abstraction layer is needed."
11798             echo "Earlier you said you wouldn't want that."
11799             ;;
11800         esac
11801         rp="You seem to have sfio available, do you want to try using it?"
11802         . ./myread
11803         case "$ans" in
11804         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11805                 useperlio="$define"
11806                 val="$define"
11807                 ;;
11808         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11809                 val="$undef"
11810                 ;;
11811         esac
11812         ;;
11813 *)      case "$usesfio" in
11814         true|$define|[yY]*)
11815                 echo "Sorry, cannot find sfio on this machine." >&4
11816                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11817                 val="$undef"
11818                 ;;
11819         esac
11820         ;;
11821 esac
11822 set d_sfio
11823 eval $setvar
11824 case "$d_sfio" in
11825 $define) usesfio='true';;
11826 *) usesfio='false';;
11827 esac
11828 case "$d_sfio" in
11829 $define) ;;
11830 *)      : Remove sfio from list of libraries to use
11831         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11832         shift
11833         libs="$*"
11834         echo "libs = $libs" >&4
11835 ;;
11836 esac
11837
11838
11839 : see if shmctl exists
11840 set shmctl d_shmctl
11841 eval $inlibc
11842
11843 : see if shmget exists
11844 set shmget d_shmget
11845 eval $inlibc
11846
11847 : see if shmat exists
11848 set shmat d_shmat
11849 eval $inlibc
11850 : see what shmat returns
11851 case "$d_shmat" in
11852 "$define")
11853         $cat >shmat.c <<'END'
11854 #include <sys/shm.h>
11855 void *shmat();
11856 END
11857         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11858                 shmattype='void *'
11859         else
11860                 shmattype='char *'
11861         fi
11862         echo "and it returns ($shmattype)." >&4
11863         : see if a prototype for shmat is available
11864         xxx=`./findhdr sys/shm.h`
11865         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11866         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11867                 val="$define"
11868         else
11869                 val="$undef"
11870         fi
11871         $rm -f shmat.[co]
11872         ;;
11873 *)
11874         val="$undef"
11875         ;;
11876 esac
11877 set d_shmatprototype
11878 eval $setvar
11879
11880 : see if shmdt exists
11881 set shmdt d_shmdt
11882 eval $inlibc
11883
11884 : see how much of the 'shm*(2)' library is present.
11885 h_shm=true
11886 echo " "
11887 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11888 *"$undef"*) h_shm=false;;
11889 esac
11890 case "$osname" in
11891 freebsd)
11892     case "`ipcs 2>&1`" in
11893     "SVID shared memory"*"not configured"*)
11894         echo "Your $osname does not have the shm*(2) configured." >&4
11895         h_shm=false
11896         val="$undef"
11897         set shmctl d_shmctl
11898         evat $setvar
11899         set shmget d_shmget
11900         evat $setvar
11901         set shmat d_shmat
11902         evat $setvar
11903         set shmdt d_shmdt
11904         evat $setvar
11905         ;;
11906     esac
11907     ;;
11908 esac
11909 : we could also check for sys/ipc.h ...
11910 if $h_shm && $test `./findhdr sys/shm.h`; then
11911         echo "You have the full shm*(2) library." >&4
11912         val="$define"
11913 else
11914         echo "You don't have the full shm*(2) library." >&4
11915         val="$undef"
11916 fi
11917 set d_shm
11918 eval $setvar
11919
11920 echo " "
11921 : see if we have sigaction
11922 if set sigaction val -f d_sigaction; eval $csym; $val; then
11923         echo 'sigaction() found.' >&4
11924         $cat > try.c <<'EOP'
11925 #include <stdio.h>
11926 #include <sys/types.h>
11927 #include <signal.h>
11928 int main()
11929 {
11930     struct sigaction act, oact;
11931     act.sa_flags = 0;
11932     oact.sa_handler = 0;
11933     /* so that act and oact are used */
11934     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11935 }
11936 EOP
11937         set try
11938         if eval $compile_ok; then
11939                 val="$define"
11940         else
11941                 echo "But you don't seem to have a useable struct sigaction." >&4
11942                 val="$undef"
11943         fi
11944 else
11945         echo 'sigaction NOT found.' >&4
11946         val="$undef"
11947 fi
11948 set d_sigaction; eval $setvar
11949 $rm -f try try$_o try.c
11950
11951 : see if sigprocmask exists
11952 set sigprocmask d_sigprocmask
11953 eval $inlibc
11954
11955 : see if sigsetjmp exists
11956 echo " "
11957 case "$d_sigsetjmp" in
11958 '')
11959         $cat >try.c <<'EOP'
11960 #include <setjmp.h>
11961 sigjmp_buf env;
11962 int set = 1;
11963 int main()
11964 {
11965         if (sigsetjmp(env,1))
11966                 exit(set);
11967         set = 0;
11968         siglongjmp(env, 1);
11969         exit(1);
11970 }
11971 EOP
11972         set try
11973         if eval $compile; then
11974                 if ./try >/dev/null 2>&1; then
11975                         echo "POSIX sigsetjmp found." >&4
11976                         val="$define"
11977                 else
11978                         $cat >&4 <<EOM
11979 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11980 I'll ignore them.
11981 EOM
11982                         val="$undef"
11983                 fi
11984         else
11985                 echo "sigsetjmp not found." >&4
11986                 val="$undef"
11987         fi
11988         ;;
11989 *) val="$d_sigsetjmp"
11990         case "$d_sigsetjmp" in
11991         $define) echo "POSIX sigsetjmp found." >&4;;
11992         $undef) echo "sigsetjmp not found." >&4;;
11993         esac
11994         ;;
11995 esac
11996 set d_sigsetjmp
11997 eval $setvar
11998 $rm -f try.c try
11999
12000 : see if sockatmark exists
12001 set sockatmark d_sockatmark
12002 eval $inlibc
12003
12004 : see if prototype for sockatmark is available
12005 echo " "
12006 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12007 eval $hasproto
12008
12009 : see if socks5_init exists
12010 set socks5_init d_socks5_init
12011 eval $inlibc
12012
12013 : see if prototype for setresgid is available
12014 echo " "
12015 set d_sresgproto setresgid $i_unistd unistd.h
12016 eval $hasproto
12017
12018 : see if prototype for setresuid is available
12019 echo " "
12020 set d_sresuproto setresuid $i_unistd unistd.h
12021 eval $hasproto
12022
12023 : see if sys/stat.h is available
12024 set sys/stat.h i_sysstat
12025 eval $inhdr
12026
12027
12028 : see if stat knows about block sizes
12029 echo " "
12030 echo "Checking to see if your struct stat has st_blocks field..." >&4
12031 set d_statblks stat st_blocks $i_sysstat sys/stat.h
12032 eval $hasfield
12033
12034
12035 : see if this is a sys/vfs.h system
12036 set sys/vfs.h i_sysvfs
12037 eval $inhdr
12038
12039
12040 : see if this is a sys/statfs.h system
12041 set sys/statfs.h i_sysstatfs
12042 eval $inhdr
12043
12044
12045 echo " "
12046 echo "Checking to see if your system supports struct statfs..." >&4
12047 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
12048 eval $hasstruct
12049 case "$d_statfs_s" in
12050 "$define")      echo "Yes, it does."   ;;
12051 *)              echo "No, it doesn't." ;;
12052 esac
12053
12054
12055
12056 : see if struct statfs knows about f_flags
12057 case "$d_statfs_s" in
12058 define) 
12059         echo " "
12060         echo "Checking to see if your struct statfs has f_flags field..." >&4
12061         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
12062         eval $hasfield
12063         ;;
12064 *)      val="$undef"
12065         set d_statfs_f_flags
12066         eval $setvar
12067         ;;
12068 esac
12069 case "$d_statfs_f_flags" in
12070 "$define")      echo "Yes, it does."   ;;
12071 *)              echo "No, it doesn't." ;;
12072 esac
12073
12074 : see if _ptr and _cnt from stdio act std
12075 echo " "
12076
12077 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12078         echo "(Looks like you have stdio.h from BSD.)"
12079         case "$stdio_ptr" in
12080         '') stdio_ptr='((fp)->_p)'
12081                 ptr_lval=$define
12082                 ;;
12083         *)      ptr_lval=$d_stdio_ptr_lval;;
12084         esac
12085         case "$stdio_cnt" in
12086         '') stdio_cnt='((fp)->_r)'
12087                 cnt_lval=$define
12088                 ;;
12089         *)      cnt_lval=$d_stdio_cnt_lval;;
12090         esac
12091         case "$stdio_base" in
12092         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12093         esac
12094         case "$stdio_bufsiz" in
12095         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12096         esac
12097 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12098         echo "(Looks like you have stdio.h from Linux.)"
12099         case "$stdio_ptr" in
12100         '') stdio_ptr='((fp)->_IO_read_ptr)'
12101                 ptr_lval=$define
12102                 ;;
12103         *)      ptr_lval=$d_stdio_ptr_lval;;
12104         esac
12105         case "$stdio_cnt" in
12106         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12107                 cnt_lval=$undef
12108                 ;;
12109         *)      cnt_lval=$d_stdio_cnt_lval;;
12110         esac
12111         case "$stdio_base" in
12112         '') stdio_base='((fp)->_IO_read_base)';;
12113         esac
12114         case "$stdio_bufsiz" in
12115         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12116         esac
12117 else
12118         case "$stdio_ptr" in
12119         '') stdio_ptr='((fp)->_ptr)'
12120                 ptr_lval=$define
12121                 ;;
12122         *)      ptr_lval=$d_stdio_ptr_lval;;
12123         esac
12124         case "$stdio_cnt" in
12125         '') stdio_cnt='((fp)->_cnt)'
12126                 cnt_lval=$define
12127                 ;;
12128         *)      cnt_lval=$d_stdio_cnt_lval;;
12129         esac
12130         case "$stdio_base" in
12131         '') stdio_base='((fp)->_base)';;
12132         esac
12133         case "$stdio_bufsiz" in
12134         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12135         esac
12136 fi
12137
12138 : test whether _ptr and _cnt really work
12139 echo "Checking how std your stdio is..." >&4
12140 $cat >try.c <<EOP
12141 #include <stdio.h>
12142 #define FILE_ptr(fp)    $stdio_ptr
12143 #define FILE_cnt(fp)    $stdio_cnt
12144 int main() {
12145         FILE *fp = fopen("try.c", "r");
12146         char c = getc(fp);
12147         if (
12148                 18 <= FILE_cnt(fp) &&
12149                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12150         )
12151                 exit(0);
12152         exit(1);
12153 }
12154 EOP
12155 val="$undef"
12156 set try
12157 if eval $compile; then
12158         if ./try; then
12159                 echo "Your stdio acts pretty std."
12160                 val="$define"
12161         else
12162                 echo "Your stdio isn't very std."
12163         fi
12164 else
12165         echo "Your stdio doesn't appear very std."
12166 fi
12167 $rm -f try.c try
12168 set d_stdstdio
12169 eval $setvar
12170
12171 : Can _ptr be used as an lvalue?
12172 case "$d_stdstdio$ptr_lval" in
12173 $define$define) val=$define ;;
12174 *) val=$undef ;;
12175 esac
12176 set d_stdio_ptr_lval
12177 eval $setvar
12178
12179 : Can _cnt be used as an lvalue?
12180 case "$d_stdstdio$cnt_lval" in
12181 $define$define) val=$define ;;
12182 *) val=$undef ;;
12183 esac
12184 set d_stdio_cnt_lval
12185 eval $setvar
12186
12187
12188 : test whether setting _ptr sets _cnt as a side effect
12189 d_stdio_ptr_lval_sets_cnt="$undef"
12190 d_stdio_ptr_lval_nochange_cnt="$undef"
12191 case "$d_stdio_ptr_lval$d_stdstdio" in
12192 $define$define)
12193         echo "Checking to see what happens if we set the stdio ptr..." >&4
12194 $cat >try.c <<EOP
12195 #include <stdio.h>
12196 /* Can we scream? */
12197 /* Eat dust sed :-) */
12198 /* In the buffer space, no one can hear you scream. */
12199 #define FILE_ptr(fp)    $stdio_ptr
12200 #define FILE_cnt(fp)    $stdio_cnt
12201 #include <sys/types.h>
12202 int main() {
12203         FILE *fp = fopen("try.c", "r");
12204         int c;
12205         char *ptr;
12206         size_t cnt;
12207         if (!fp) {
12208             puts("Fail even to read");
12209             exit(1);
12210         }
12211         c = getc(fp); /* Read away the first # */
12212         if (c == EOF) {
12213             puts("Fail even to read");
12214             exit(1);
12215         }
12216         if (!(
12217                 18 <= FILE_cnt(fp) &&
12218                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12219         )) {
12220                 puts("Fail even to read");
12221                 exit (1);
12222         }
12223         ptr = (char*) FILE_ptr(fp);
12224         cnt = (size_t)FILE_cnt(fp);
12225
12226         FILE_ptr(fp) += 42;
12227
12228         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12229                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12230                 exit (1);
12231         }
12232         if (FILE_cnt(fp) <= 20) {
12233                 printf ("Fail (<20 chars to test)");
12234                 exit (1);
12235         }
12236         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12237                 puts("Fail compare");
12238                 exit (1);
12239         }
12240         if (cnt == FILE_cnt(fp)) {
12241                 puts("Pass_unchanged");
12242                 exit (0);
12243         }       
12244         if (FILE_cnt(fp) == (cnt - 42)) {
12245                 puts("Pass_changed");
12246                 exit (0);
12247         }
12248         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12249         return 1;
12250
12251 }
12252 EOP
12253         set try
12254         if eval $compile; then
12255                 case `./try$exe_ext` in
12256                 Pass_changed)
12257                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12258                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12259                 Pass_unchanged)
12260                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12261                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12262                 Fail*)
12263                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12264                 *)
12265                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12266         esac
12267         else
12268                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12269         fi
12270         $rm -f try.c try
12271         ;;
12272 esac
12273
12274 : see if _base is also standard
12275 val="$undef"
12276 case "$d_stdstdio" in
12277 $define)
12278         $cat >try.c <<EOP
12279 #include <stdio.h>
12280 #define FILE_base(fp)   $stdio_base
12281 #define FILE_bufsiz(fp) $stdio_bufsiz
12282 int main() {
12283         FILE *fp = fopen("try.c", "r");
12284         char c = getc(fp);
12285         if (
12286                 19 <= FILE_bufsiz(fp) &&
12287                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12288         )
12289                 exit(0);
12290         exit(1);
12291 }
12292 EOP
12293         set try
12294         if eval $compile; then
12295                 if ./try; then
12296                         echo "And its _base field acts std."
12297                         val="$define"
12298                 else
12299                         echo "But its _base field isn't std."
12300                 fi
12301         else
12302                 echo "However, it seems to be lacking the _base field."
12303         fi
12304         $rm -f try.c try
12305         ;;
12306 esac
12307 set d_stdiobase
12308 eval $setvar
12309
12310 $cat >&4 <<EOM
12311 Checking how to access stdio streams by file descriptor number...
12312 EOM
12313 case "$stdio_stream_array" in
12314 '')     $cat >try.c <<EOCP
12315 #include <stdio.h>
12316 int main() {
12317   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12318     printf("yes\n");
12319 }
12320 EOCP
12321         for s in _iob __iob __sF
12322         do
12323                 set try -DSTDIO_STREAM_ARRAY=$s
12324                 if eval $compile; then
12325                         case "`./try$exe_ext`" in
12326                         yes)    stdio_stream_array=$s; break ;;
12327                         esac
12328                 fi
12329         done
12330         $rm -f try.* try$exe_ext
12331 esac
12332 case "$stdio_stream_array" in
12333 '')     $cat >&4 <<EOM
12334 I can't figure out how to access stdio streams by file descriptor number.
12335 EOM
12336         d_stdio_stream_array="$undef"
12337         ;;
12338 *)      $cat >&4 <<EOM
12339 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12340 EOM
12341         d_stdio_stream_array="$define"
12342         ;;
12343 esac
12344
12345 : see if strcoll exists
12346 set strcoll d_strcoll
12347 eval $inlibc
12348
12349 : check for structure copying
12350 echo " "
12351 echo "Checking to see if your C compiler can copy structs..." >&4
12352 $cat >try.c <<'EOCP'
12353 int main()
12354 {
12355         struct blurfl {
12356                 int dyick;
12357         } foo, bar;
12358
12359         foo = bar;
12360 }
12361 EOCP
12362 if $cc -c try.c >/dev/null 2>&1 ; then
12363         val="$define"
12364         echo "Yup, it can."
12365 else
12366         val="$undef"
12367         echo "Nope, it can't."
12368 fi
12369 set d_strctcpy
12370 eval $setvar
12371 $rm -f try.*
12372
12373 : see if strerror and/or sys_errlist[] exist
12374 echo " "
12375 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12376     if set strerror val -f d_strerror; eval $csym; $val; then
12377                 echo 'strerror() found.' >&4
12378                 d_strerror="$define"
12379                 d_strerrm='strerror(e)'
12380                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12381                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12382                         d_syserrlst="$define"
12383                 else
12384                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12385                         d_syserrlst="$undef"
12386                 fi
12387     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12388                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12389                 echo 'strerror() found in string header.' >&4
12390                 d_strerror="$define"
12391                 d_strerrm='strerror(e)'
12392                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12393                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12394                                 d_syserrlst="$define"
12395                 else
12396                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12397                         d_syserrlst="$undef"
12398                 fi
12399     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12400                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12401                 d_strerror="$undef"
12402                 d_syserrlst="$define"
12403                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12404     else
12405                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12406                 d_strerror="$undef"
12407                 d_syserrlst="$undef"
12408                 d_strerrm='"unknown"'
12409     fi
12410 fi
12411
12412 : see if strftime exists
12413 set strftime d_strftime
12414 eval $inlibc
12415
12416 : see if strtod exists
12417 set strtod d_strtod
12418 eval $inlibc
12419
12420 : see if strtol exists
12421 set strtol d_strtol
12422 eval $inlibc
12423
12424 : see if strtold exists
12425 set strtold d_strtold
12426 eval $inlibc
12427
12428 : see if strtoll exists
12429 set strtoll d_strtoll
12430 eval $inlibc
12431
12432 case "$d_longlong-$d_strtoll" in
12433 "$define-$define")
12434         $cat <<EOM
12435 Checking whether your strtoll() works okay...
12436 EOM
12437         $cat >try.c <<'EOCP'
12438 #include <errno.h>
12439 #ifdef __hpux
12440 #define strtoll __strtoll
12441 #endif
12442 #ifdef __EMX__
12443 #define strtoll _strtoll
12444 #endif
12445 #include <stdio.h>
12446 extern long long int strtoll(char *s, char **, int); 
12447 static int bad = 0;
12448 int check(char *s, long long ell, int een) {
12449         long long gll;
12450         errno = 0;
12451         gll = strtoll(s, 0, 10);
12452         if (!((gll == ell) && (errno == een)))
12453                 bad++;
12454 }
12455 int main() {
12456         check(" 1",                                      1LL, 0);
12457         check(" 0",                                      0LL, 0);
12458         check("-1",                                     -1LL, 0);
12459         check("-9223372036854775808", -9223372036854775808LL, 0);
12460         check("-9223372036854775808", -9223372036854775808LL, 0);
12461         check(" 9223372036854775807",  9223372036854775807LL, 0);
12462         check("-9223372036854775808", -9223372036854775808LL, 0);
12463         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12464         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12465         if (!bad)
12466                 printf("ok\n");
12467 }
12468 EOCP
12469         set try
12470         if eval $compile; then
12471                 yyy=`./try`
12472                 case "$yyy" in
12473                 ok) echo "Your strtoll() seems to be working okay." ;;
12474                 *) cat <<EOM >&4
12475 Your strtoll() doesn't seem to be working okay.
12476 EOM
12477                    d_strtoll="$undef"
12478                    ;;
12479                 esac
12480         else
12481                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12482                 d_strtoll="$undef"
12483         fi
12484         ;;
12485 esac
12486
12487 : see if strtoq exists
12488 set strtoq d_strtoq
12489 eval $inlibc
12490
12491 : see if strtoul exists
12492 set strtoul d_strtoul
12493 eval $inlibc
12494
12495 case "$d_strtoul" in
12496 "$define")
12497         $cat <<EOM
12498 Checking whether your strtoul() works okay...
12499 EOM
12500         $cat >try.c <<'EOCP'
12501 #include <errno.h>
12502 #include <stdio.h>
12503 extern unsigned long int strtoul(char *s, char **, int); 
12504 static int bad = 0;
12505 void check(char *s, unsigned long eul, int een) {
12506         unsigned long gul;
12507         errno = 0;
12508         gul = strtoul(s, 0, 10);
12509         if (!((gul == eul) && (errno == een)))
12510                 bad++;
12511 }
12512 int main() {
12513         check(" 1", 1L, 0);
12514         check(" 0", 0L, 0);
12515 EOCP
12516         case "$longsize" in
12517         8)
12518             $cat >>try.c <<'EOCP'
12519         check("18446744073709551615", 18446744073709551615UL, 0);
12520         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12521 #if 0 /* strtoul() for /^-/ strings is undefined. */
12522         check("-1", 18446744073709551615UL, 0);
12523         check("-18446744073709551614", 2, 0);
12524         check("-18446744073709551615", 1, 0);
12525         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12526         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12527 #endif
12528 EOCP
12529                 ;;
12530         4)
12531                     $cat >>try.c <<'EOCP'
12532         check("4294967295", 4294967295UL, 0);
12533         check("4294967296", 4294967295UL, ERANGE);
12534 #if 0 /* strtoul() for /^-/ strings is undefined. */
12535         check("-1", 4294967295UL, 0);
12536         check("-4294967294", 2, 0);
12537         check("-4294967295", 1, 0);
12538         check("-4294967296", 4294967295UL, ERANGE);
12539         check("-4294967297", 4294967295UL, ERANGE);
12540 #endif
12541 EOCP
12542                 ;;
12543         *)
12544 : Should we write these tests to be more portable by sprintf-ing
12545 : ~0 and then manipulating that char string as input for strtol?
12546                 ;;
12547         esac
12548         $cat >>try.c <<'EOCP'
12549         if (!bad)
12550                 printf("ok\n");
12551         return 0;
12552 }
12553 EOCP
12554         set try
12555         if eval $compile; then
12556                 case "`./try`" in
12557                 ok) echo "Your strtoul() seems to be working okay." ;;
12558                 *) cat <<EOM >&4
12559 Your strtoul() doesn't seem to be working okay.
12560 EOM
12561                    d_strtoul="$undef"
12562                    ;;
12563                 esac
12564         fi
12565         ;;
12566 esac
12567
12568 : see if strtoull exists
12569 set strtoull d_strtoull
12570 eval $inlibc
12571
12572 case "$d_longlong-$d_strtoull" in
12573 "$define-$define")
12574         $cat <<EOM
12575 Checking whether your strtoull() works okay...
12576 EOM
12577         $cat >try.c <<'EOCP'
12578 #include <errno.h>
12579 #ifdef __hpux
12580 #define strtoull __strtoull
12581 #endif
12582 #include <stdio.h>
12583 extern unsigned long long int strtoull(char *s, char **, int); 
12584 static int bad = 0;
12585 int check(char *s, long long eull, int een) {
12586         long long gull;
12587         errno = 0;
12588         gull = strtoull(s, 0, 10);
12589         if (!((gull == eull) && (errno == een)))
12590                 bad++;
12591 }
12592 int main() {
12593         check(" 1",                                        1LL, 0);
12594         check(" 0",                                        0LL, 0);
12595         check("18446744073709551615",  18446744073709551615ULL, 0);
12596         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12597 #if 0 /* strtoull() for /^-/ strings is undefined. */
12598         check("-1",                    18446744073709551615ULL, 0);
12599         check("-18446744073709551614",                     2LL, 0);
12600         check("-18446744073709551615",                     1LL, 0);
12601         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12602         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12603 #endif
12604         if (!bad)
12605                 printf("ok\n");
12606 }
12607 EOCP
12608         set try
12609         if eval $compile; then
12610                 case "`./try`" in
12611                 ok) echo "Your strtoull() seems to be working okay." ;;
12612                 *) cat <<EOM >&4
12613 Your strtoull() doesn't seem to be working okay.
12614 EOM
12615                    d_strtoull="$undef"
12616                    ;;
12617                 esac
12618         fi
12619         ;;
12620 esac
12621
12622 : see if strtouq exists
12623 set strtouq d_strtouq
12624 eval $inlibc
12625
12626 case "$d_strtouq" in
12627 "$define")
12628         $cat <<EOM
12629 Checking whether your strtouq() works okay...
12630 EOM
12631         $cat >try.c <<'EOCP'
12632 #include <errno.h>
12633 #include <stdio.h>
12634 extern unsigned long long int strtouq(char *s, char **, int); 
12635 static int bad = 0;
12636 void check(char *s, unsigned long long eull, int een) {
12637         unsigned long long gull;
12638         errno = 0;
12639         gull = strtouq(s, 0, 10);
12640         if (!((gull == eull) && (errno == een)))
12641                 bad++;
12642 }
12643 int main() {
12644         check(" 1",                                        1LL, 0);
12645         check(" 0",                                        0LL, 0);
12646         check("18446744073709551615",  18446744073709551615ULL, 0);
12647         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12648 #if 0 /* strtouq() for /^-/ strings is undefined. */
12649         check("-1",                    18446744073709551615ULL, 0);
12650         check("-18446744073709551614",                     2LL, 0);
12651         check("-18446744073709551615",                     1LL, 0);
12652         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12653         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12654 #endif
12655         if (!bad)
12656                 printf("ok\n");
12657         return 0;
12658 }
12659 EOCP
12660         set try
12661         if eval $compile; then
12662                 case "`./try`" in
12663                 ok) echo "Your strtouq() seems to be working okay." ;;
12664                 *) cat <<EOM >&4
12665 Your strtouq() doesn't seem to be working okay.
12666 EOM
12667                    d_strtouq="$undef"
12668                    ;;
12669                 esac
12670         fi
12671         ;;
12672 esac
12673
12674 : see if strxfrm exists
12675 set strxfrm d_strxfrm
12676 eval $inlibc
12677
12678 : see if symlink exists
12679 set symlink d_symlink
12680 eval $inlibc
12681
12682 : see if syscall exists
12683 set syscall d_syscall
12684 eval $inlibc
12685
12686 : see if prototype for syscall is available
12687 echo " "
12688 set d_syscallproto syscall $i_unistd unistd.h
12689 eval $hasproto
12690
12691 : see if sysconf exists
12692 set sysconf d_sysconf
12693 eval $inlibc
12694
12695 : see if system exists
12696 set system d_system
12697 eval $inlibc
12698
12699 : see if tcgetpgrp exists
12700 set tcgetpgrp d_tcgetpgrp
12701 eval $inlibc
12702
12703 : see if tcsetpgrp exists
12704 set tcsetpgrp d_tcsetpgrp
12705 eval $inlibc
12706
12707 : see if prototype for telldir is available
12708 echo " "
12709 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12710 eval $hasproto
12711
12712 : see if this is a sys/times.h system
12713 set sys/times.h i_systimes
12714 eval $inhdr
12715
12716 : see if times exists
12717 echo " "
12718 if set times val -f d_times; eval $csym; $val; then
12719         echo 'times() found.' >&4
12720         d_times="$define"
12721         inc=''
12722         case "$i_systimes" in
12723         "$define") inc='sys/times.h';;
12724         esac
12725         rp="What is the type returned by times() on this system?"
12726         set clock_t clocktype long stdio.h sys/types.h $inc
12727         eval $typedef_ask
12728 else
12729         echo 'times() NOT found, hope that will do.' >&4
12730         d_times="$undef"
12731         clocktype='int'
12732 fi
12733
12734 : see if truncate exists
12735 set truncate d_truncate
12736 eval $inlibc
12737
12738 : see if tzname[] exists
12739 echo " "
12740 if set tzname val -a d_tzname; eval $csym; $val; then
12741         val="$define"
12742         echo 'tzname[] found.' >&4
12743 else
12744         val="$undef"
12745         echo 'tzname[] NOT found.' >&4
12746 fi
12747 set d_tzname
12748 eval $setvar
12749
12750 case "$crosscompile" in
12751 ''|[nN]*) crosscompile="$undef" ;;
12752 esac
12753
12754 case "$osname" in
12755 next|rhapsody|darwin) multiarch="$define" ;;
12756 esac
12757 case "$multiarch" in
12758 ''|[nN]*) multiarch="$undef" ;;
12759 esac
12760
12761 : check for ordering of bytes in a long
12762 echo " "
12763 case "$crosscompile$multiarch" in
12764 *$define*)
12765         $cat <<EOM
12766 You seem to be either cross-compiling or doing a multiarchitecture build,
12767 skipping the byteorder check.
12768
12769 EOM
12770         byteorder='0xffff'
12771         ;;
12772 *)
12773         case "$byteorder" in
12774         '')
12775                 $cat <<'EOM'
12776 In the following, larger digits indicate more significance.  A big-endian
12777 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12778 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12779 machines may have weird orders like 3412.  A Cray will report 87654321,
12780 an Alpha will report 12345678. If the test program works the default is
12781 probably right.
12782 I'm now running the test program...
12783 EOM
12784                 $cat >try.c <<'EOCP'
12785 #include <stdio.h>
12786 int main()
12787 {
12788         int i;
12789         union {
12790                 unsigned long l;
12791                 char c[sizeof(long)];
12792         } u;
12793
12794         if (sizeof(long) > 4)
12795                 u.l = (0x08070605L << 32) | 0x04030201L;
12796         else
12797                 u.l = 0x04030201L;
12798         for (i = 0; i < sizeof(long); i++)
12799                 printf("%c", u.c[i]+'0');
12800         printf("\n");
12801         exit(0);
12802 }
12803 EOCP
12804                 xxx_prompt=y
12805                 set try
12806                 if eval $compile && ./try > /dev/null; then
12807                         dflt=`./try`
12808                         case "$dflt" in
12809                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12810                                 echo "(The test program ran ok.)"
12811                                 echo "byteorder=$dflt"
12812                                 xxx_prompt=n
12813                         ;;
12814                         ????|????????) echo "(The test program ran ok.)" ;;
12815                         *) echo "(The test program didn't run right for some reason.)" ;;
12816                         esac
12817                 else
12818                         dflt='4321'
12819                         cat <<'EOM'
12820 (I can't seem to compile the test program.  Guessing big-endian...)
12821 EOM
12822                 fi
12823                 case "$xxx_prompt" in
12824                 y)
12825                         rp="What is the order of bytes in a long?"
12826                         . ./myread
12827                         byteorder="$ans"
12828                         ;;
12829                 *)      byteorder=$dflt
12830                         ;;
12831                 esac
12832                 ;;
12833         esac
12834         $rm -f try.c try
12835         ;;
12836 esac
12837
12838
12839 $cat <<EOM
12840
12841 Checking to see whether you can access character data unalignedly...
12842 EOM
12843 $cat >try.c <<EOCP
12844 #include <stdio.h>
12845 #define U32 $u32type
12846 #define BYTEORDER $byteorder
12847 int main() {
12848 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
12849     U8 buf[] = "\0\0\0\1\0\0\0\0";
12850     U32 *up;
12851     int i;
12852
12853     if (sizeof(U32) != 4) {
12854         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
12855         exit(1);
12856     }
12857
12858     fflush(stdout);
12859
12860     for (i = 0; i < 4; i++) {
12861         up = (U32*)(buf + i);
12862         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
12863                (*up == 1 << (8*(3-i)))  /* little-endian */
12864               )
12865            )
12866         {
12867             printf("read failed (%x)\n", *up);
12868             exit(2);
12869         }
12870     }
12871
12872     /* write test */
12873     for (i = 0; i < 4; i++) {
12874         up = (U32*)(buf + i);
12875         *up = 0xBeef;
12876         if (*up != 0xBeef) {
12877             printf("write failed (%x)\n", *up);
12878             exit(3);
12879         }
12880     }
12881
12882     exit(0);
12883 #else
12884     printf("1\n");
12885     exit(1);
12886 #endif
12887     return 0;
12888 }
12889 EOCP
12890 set try
12891 if eval $compile_ok; then
12892         echo "(This test may dump core.)" >&4
12893         ./try >&2 >/dev/null
12894         case "$?" in
12895         0)      cat >&4 <<EOM
12896 You can access character data pretty unalignedly.
12897 EOM
12898                 d_u32align="$undef"
12899                 ;;
12900         *)      cat >&4 <<EOM
12901 It seems that you must access character data in an aligned manner.
12902 EOM
12903                 d_u32align="$define"
12904                 ;;
12905         esac
12906         $rm -f core core.try.* try.core
12907 else
12908         rp='Can you access character data at unaligned addresses?'
12909         dflt='n'
12910         . ./myread
12911         case "$ans" in
12912         [yY]*)  d_u32align="$undef"  ;;
12913         *)      d_u32align="$define" ;;
12914         esac
12915 fi
12916
12917 : see if ualarm exists
12918 set ualarm d_ualarm
12919 eval $inlibc
12920
12921 : see if umask exists
12922 set umask d_umask
12923 eval $inlibc
12924
12925 : see if usleep exists
12926 set usleep d_usleep
12927 eval $inlibc
12928
12929 : see if prototype for usleep is available
12930 echo " "
12931 set d_usleepproto usleep $i_unistd unistd.h
12932 eval $hasproto
12933
12934 : see if ustat exists
12935 set ustat d_ustat
12936 eval $inlibc
12937
12938 : backward compatibility for d_hvfork
12939 if test X$d_hvfork != X; then
12940         d_vfork="$d_hvfork"
12941         d_hvfork=''
12942 fi
12943 : see if there is a vfork
12944 val=''
12945 set vfork val
12946 eval $inlibc
12947
12948 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12949 : perl on Solaris 2.x, and probably elsewhere.
12950 case "$val" in
12951 $define)
12952         echo " "
12953         case "$usevfork" in
12954         false) dflt='n';;
12955         *) dflt='y';;
12956         esac
12957         cat <<'EOM'
12958  
12959 Perl can only use a vfork() that doesn't suffer from strict
12960 restrictions on calling functions or modifying global data in
12961 the child.  For example, glibc-2.1 contains such a vfork()
12962 that is unsuitable.  If your system provides a proper fork()
12963 call, chances are that you do NOT want perl to use vfork().
12964
12965 EOM
12966         rp="Do you still want to use vfork()?"
12967         . ./myread
12968         case "$ans" in
12969         y|Y) ;;
12970         *)
12971                 echo "Ok, we won't use vfork()."
12972                 val="$undef"
12973                 ;;
12974         esac
12975         ;;
12976 esac
12977 set d_vfork
12978 eval $setvar
12979 case "$d_vfork" in
12980 $define) usevfork='true';;
12981 *) usevfork='false';;
12982 esac
12983
12984 : see if this is an sysdir system
12985 set sys/dir.h i_sysdir
12986 eval $inhdr
12987
12988 : see if this is an sysndir system
12989 set sys/ndir.h i_sysndir
12990 eval $inhdr
12991
12992 : see if closedir exists
12993 set closedir d_closedir
12994 eval $inlibc
12995
12996 case "$d_closedir" in
12997 "$define")
12998         echo " "
12999         echo "Checking whether closedir() returns a status..." >&4
13000         cat > closedir.c <<EOM
13001 #$i_dirent I_DIRENT             /**/
13002 #$i_sysdir I_SYS_DIR            /**/
13003 #$i_sysndir I_SYS_NDIR          /**/
13004 #$i_systypes I_SYS_TYPES        /**/
13005
13006 #if defined(I_SYS_TYPES)
13007 #include <sys/types.h>
13008 #endif
13009 #if defined(I_DIRENT)
13010 #include <dirent.h>
13011 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13012 #include <sys/dir.h>
13013 #endif
13014 #else
13015 #ifdef I_SYS_NDIR
13016 #include <sys/ndir.h>
13017 #else
13018 #ifdef I_SYS_DIR
13019 #ifdef hp9000s500
13020 #include <ndir.h>       /* may be wrong in the future */
13021 #else
13022 #include <sys/dir.h>
13023 #endif
13024 #endif
13025 #endif
13026 #endif 
13027 int main() { return closedir(opendir(".")); }
13028 EOM
13029         set closedir
13030         if eval $compile_ok; then
13031                 if ./closedir > /dev/null 2>&1 ; then
13032                         echo "Yes, it does."
13033                         val="$undef"
13034                 else
13035                         echo "No, it doesn't."
13036                         val="$define"
13037                 fi
13038         else
13039                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13040                 val="$define"
13041         fi
13042         ;;
13043 *)
13044         val="$undef";
13045         ;;
13046 esac
13047 set d_void_closedir
13048 eval $setvar
13049 $rm -f closedir*
13050 : see if there is a wait4
13051 set wait4 d_wait4
13052 eval $inlibc
13053
13054 : see if waitpid exists
13055 set waitpid d_waitpid
13056 eval $inlibc
13057
13058 : see if wcstombs exists
13059 set wcstombs d_wcstombs
13060 eval $inlibc
13061
13062 : see if wctomb exists
13063 set wctomb d_wctomb
13064 eval $inlibc
13065
13066 : see if writev exists
13067 set writev d_writev
13068 eval $inlibc
13069
13070 : preserve RCS keywords in files with variable substitution, grrr
13071 Date='$Date'
13072 Id='$Id'
13073 Log='$Log'
13074 RCSfile='$RCSfile'
13075 Revision='$Revision'
13076
13077 : check for alignment requirements
13078 echo " "
13079 case "$crosscompile$multiarch" in
13080 *$define*)
13081         $cat <<EOM
13082 You seem to be either cross-compiling or doing a multiarchitecture build,
13083 skipping the memory alignment check.
13084
13085 EOM
13086         case "$alignbytes" in
13087         '') alignbytes=8 ;;
13088         esac
13089         ;;
13090 *)
13091         case "$alignbytes" in
13092         '') echo "Checking alignment constraints..." >&4
13093                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13094                         $cat >try.c <<'EOCP'
13095 typedef long double NV;
13096 EOCP
13097                 else
13098                         $cat >try.c <<'EOCP'
13099 typedef double NV;
13100 EOCP
13101                 fi
13102                 $cat >>try.c <<'EOCP'
13103 #include <stdio.h>
13104 struct foobar {
13105         char foo;
13106         NV bar;
13107 } try_algn;
13108 int main()
13109 {
13110     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13111     return(0);
13112 }
13113 EOCP
13114                 set try
13115                 if eval $compile_ok; then
13116                         dflt=`./try`
13117                 else
13118                         dflt='8'
13119                         echo "(I can't seem to compile the test program...)"
13120                 fi
13121                 ;;
13122         *) dflt="$alignbytes"
13123                 ;;
13124         esac
13125         rp="Doubles must be aligned on a how-many-byte boundary?"
13126         . ./myread
13127         alignbytes="$ans"
13128         $rm -f try.c try
13129         ;;
13130 esac
13131
13132
13133 : set the base revision
13134 baserev=5.0
13135
13136 : how do we catenate cpp tokens here?
13137 echo " "
13138 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13139 $cat >cpp_stuff.c <<'EOCP'
13140 #define RCAT(a,b)a/**/b
13141 #define ACAT(a,b)a ## b
13142 RCAT(Rei,ser)
13143 ACAT(Cir,cus)
13144 EOCP
13145 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13146 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13147         echo "Oh!  Smells like ANSI's been here." >&4
13148         echo "We can catify or stringify, separately or together!"
13149         cpp_stuff=42
13150 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13151         echo "Ah, yes!  The good old days!" >&4
13152         echo "However, in the good old days we don't know how to stringify and"
13153         echo "catify at the same time."
13154         cpp_stuff=1
13155 else
13156         $cat >&4 <<EOM
13157 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13158 to have to edit the values of CAT[2-5] in config.h...
13159 EOM
13160         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13161 fi
13162 $rm -f cpp_stuff.*
13163
13164 : see if this is a db.h system
13165 set db.h i_db
13166 eval $inhdr
13167
13168 case "$i_db" in
13169 $define)
13170         : Check db version.
13171         echo " "
13172         echo "Checking Berkeley DB version ..." >&4
13173         $cat >try.c <<EOCP
13174 #$d_const HASCONST
13175 #ifndef HASCONST
13176 #define const
13177 #endif
13178 #include <sys/types.h>
13179 #include <stdio.h>
13180 #include <db.h>
13181 int main(int argc, char *argv[])
13182 {
13183 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13184     int Major, Minor, Patch ;
13185     unsigned long Version ;
13186     (void)db_version(&Major, &Minor, &Patch) ;
13187     if (argc == 2) {
13188         printf("%d %d %d %d %d %d\n",
13189                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13190                Major, Minor, Patch);
13191         exit(0);
13192     }
13193     printf("You have Berkeley DB Version 2 or greater.\n");
13194
13195     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13196                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13197     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13198                 Major, Minor, Patch) ;
13199
13200     /* check that db.h & libdb are compatible */
13201     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13202         printf("db.h and libdb are incompatible.\n") ;
13203         exit(3);        
13204     }
13205
13206     printf("db.h and libdb are compatible.\n") ;
13207
13208     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13209                 + DB_VERSION_PATCH ;
13210
13211     /* needs to be >= 2.3.4 */
13212     if (Version < 2003004) {
13213     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13214         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13215         exit(2);        
13216     }
13217
13218     exit(0);
13219 #else
13220 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13221     if (argc == 2) {
13222         printf("1 0 0\n");
13223         exit(0);
13224     }
13225     printf("You have Berkeley DB Version 1.\n");
13226     exit(0);    /* DB version < 2: the coast is clear. */
13227 #else
13228     exit(1);    /* <db.h> not Berkeley DB? */
13229 #endif
13230 #endif
13231 }
13232 EOCP
13233         set try
13234         if eval $compile_ok && ./try; then
13235                 echo 'Looks OK.' >&4
13236                 set `./try 1`
13237                 db_version_major=$1
13238                 db_version_minor=$2
13239                 db_version_patch=$3
13240         else
13241                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13242                 i_db=$undef
13243                 case " $libs " in
13244                 *"-ldb "*)
13245                         : Remove db from list of libraries to use
13246                         echo "Removing unusable -ldb from library list" >&4
13247                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13248                         shift
13249                         libs="$*"
13250                         echo "libs = $libs" >&4
13251                         ;;
13252                 esac
13253         fi
13254         $rm -f try.*
13255         ;;
13256 esac
13257
13258 case "$i_db" in
13259 define)
13260         : Check the return type needed for hash 
13261         echo " "
13262         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13263         $cat >try.c <<EOCP
13264 #$d_const HASCONST
13265 #ifndef HASCONST
13266 #define const
13267 #endif
13268 #include <sys/types.h>
13269 #include <db.h>
13270
13271 #ifndef DB_VERSION_MAJOR
13272 u_int32_t hash_cb (ptr, size)
13273 const void *ptr;
13274 size_t size;
13275 {
13276 }
13277 HASHINFO info;
13278 int main()
13279 {
13280         info.hash = hash_cb;
13281 }
13282 #endif
13283 EOCP
13284         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13285                 if $contains warning try.out >>/dev/null 2>&1 ; then
13286                         db_hashtype='int'
13287                 else
13288                         db_hashtype='u_int32_t'
13289                 fi
13290         else
13291                 : XXX Maybe we should just give up here.
13292                 db_hashtype=u_int32_t
13293                 $cat try.out >&4
13294                 echo "Help:  I can't seem to compile the db test program." >&4
13295                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13296         fi
13297         $rm -f try.*
13298         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13299         ;;
13300 *)      db_hashtype=u_int32_t
13301         ;;
13302 esac
13303 case "$i_db" in
13304 define)
13305         : Check the return type needed for prefix 
13306         echo " "
13307         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13308         cat >try.c <<EOCP
13309 #$d_const HASCONST
13310 #ifndef HASCONST
13311 #define const
13312 #endif
13313 #include <sys/types.h>
13314 #include <db.h>
13315
13316 #ifndef DB_VERSION_MAJOR
13317 size_t prefix_cb (key1, key2)
13318 const DBT *key1;
13319 const DBT *key2;
13320 {
13321 }
13322 BTREEINFO info;
13323 int main()
13324 {
13325         info.prefix = prefix_cb;
13326 }
13327 #endif
13328 EOCP
13329         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13330                 if $contains warning try.out >>/dev/null 2>&1 ; then
13331                         db_prefixtype='int'
13332                 else
13333                         db_prefixtype='size_t'
13334                 fi
13335         else
13336                 db_prefixtype='size_t'
13337                 : XXX Maybe we should just give up here.
13338                 $cat try.out >&4
13339                 echo "Help:  I can't seem to compile the db test program." >&4
13340                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13341         fi
13342         $rm -f try.*
13343         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13344         ;;
13345 *)      db_prefixtype='size_t'
13346         ;;
13347 esac
13348
13349
13350 : How can we generate normalized random numbers ?
13351 echo " "
13352 echo "Looking for a random number function..." >&4
13353 case "$randfunc" in
13354 '')
13355         if set drand48 val -f; eval $csym; $val; then
13356                 dflt="drand48"
13357                 echo "Good, found drand48()." >&4
13358         elif set random val -f; eval $csym; $val; then
13359                 dflt="random"
13360                 echo "OK, found random()." >&4
13361         else
13362                 dflt="rand"
13363                 echo "Yick, looks like I have to use rand()." >&4
13364         fi
13365         echo " "
13366         ;;
13367 *)
13368         dflt="$randfunc"
13369         ;;
13370 esac
13371 cont=true
13372
13373 case "$ccflags" in
13374 *-Dmy_rand=*|*-Dmy_srand=*)
13375         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13376         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13377         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13378         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13379         ;;
13380 esac
13381
13382 while $test "$cont"; do
13383         rp="Use which function to generate random numbers?"
13384         . ./myread
13385         if $test "$ans" = "$dflt"; then
13386                 : null
13387         else
13388                 randbits=''
13389         fi
13390         randfunc="$ans"
13391         if set $ans val -f; eval $csym; $val; then
13392                 cont=''
13393         else
13394                 dflt=y
13395                 rp="I cannot find function $ans. Use that name anyway?"
13396                 . ./myread
13397                 dflt=rand
13398                 case "$ans" in
13399                         [yY]*) cont='';;
13400                 esac
13401         fi
13402         case "$cont" in
13403         '')
13404                 case "$randfunc" in
13405                 drand48)
13406                         drand01="drand48()"
13407                         seedfunc="srand48"
13408                         randbits=48
13409                         randseedtype=long
13410                         ;;
13411                 rand|random)
13412                         case "$randbits" in
13413                         '')
13414 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13415                                 $cat >try.c <<EOCP
13416 #$i_unistd I_UNISTD
13417 #$i_stdlib I_STDLIB
13418 #include <stdio.h>
13419 #ifdef I_UNISTD
13420 #  include <unistd.h>
13421 #endif
13422 #ifdef I_STDLIB
13423 #  include <stdlib.h>
13424 #endif
13425 int main()
13426 {
13427         register int i;
13428         register unsigned long tmp;
13429         register unsigned long max = 0L;
13430
13431         for (i = 1000; i; i--) {
13432                 tmp = (unsigned long) $randfunc();
13433                 if (tmp > max) max = tmp;
13434         }
13435         for (i = 0; max; i++)
13436                 max /= 2;
13437         printf("%d\n",i);
13438 }
13439 EOCP
13440                                 set try
13441                                 if eval $compile_ok; then
13442                                         dflt=`try`
13443                                 else
13444                                         dflt='?'
13445                                         echo "(I can't seem to compile the test program...)"
13446                                 fi
13447                                 ;;
13448                         *)
13449                                 dflt="$randbits"
13450                                 ;;
13451                         esac
13452                         rp="How many bits does your $randfunc() function produce?"
13453                         . ./myread
13454                         randbits="$ans"
13455                         $rm -f try.c try
13456                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13457                         seedfunc="s$randfunc"
13458                         randseedtype=unsigned
13459                         ;;
13460                 *)
13461                         dflt="31"
13462                         rp="How many bits does your $randfunc() function produce?"
13463                         . ./myread
13464                         randbits="$ans"
13465                         seedfunc="s$randfunc"
13466                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13467                         if set $seedfunc val -f; eval $csym; $val; then
13468                                 echo "(Using $seedfunc() to seed random generator)"
13469                         else
13470                                 echo "(Warning: no $seedfunc() to seed random generator)"
13471                                 seedfunc=rand
13472                         fi
13473                         randseedtype=unsigned
13474                         ;;
13475                 esac
13476                 ;;
13477         esac
13478 done
13479
13480 echo " "
13481 echo "Determining whether or not we are on an EBCDIC system..." >&4
13482 $cat >tebcdic.c <<'EOM'
13483 int main()
13484 {
13485   if ('M'==0xd4) return 0;
13486   return 1;
13487 }
13488 EOM
13489
13490 val=$undef
13491 set tebcdic
13492 if eval $compile_ok; then
13493         if ./tebcdic; then
13494                 echo "You seem to speak EBCDIC." >&4
13495                 val="$define"
13496         else
13497                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13498         fi
13499 else
13500         echo "I'm unable to compile the test program." >&4
13501         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13502 fi
13503 $rm -f tebcdic.c tebcdic
13504 set ebcdic
13505 eval $setvar
13506
13507 echo " "
13508 $cat >&4 <<EOM
13509 Checking how to flush all pending stdio output...
13510 EOM
13511 # I only know how to find the first 32 possibly open files on SunOS.
13512 # See also hints/sunos_4_1.sh and util.c  --AD
13513 case "$osname" in
13514 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13515 esac
13516 $cat >>try.c <<EOCP
13517 #include <stdio.h>
13518 #$i_unistd I_UNISTD
13519 #ifdef I_UNISTD
13520 # include <unistd.h>
13521 #endif
13522 #$d_sysconf HAS_SYSCONF
13523 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13524 #ifdef HAS_STDIO_STREAM_ARRAY
13525 # define STDIO_STREAM_ARRAY $stdio_stream_array
13526 #endif
13527 int main() {
13528   FILE* p = fopen("try.out", "w");
13529 #ifdef TRY_FPUTC
13530   fputc('x', p);
13531 #else
13532 # ifdef TRY_FPRINTF
13533   fprintf(p, "x");
13534 # endif
13535 #endif
13536 #ifdef TRY_FFLUSH_NULL
13537   fflush(NULL);
13538 #endif
13539 #ifdef TRY_FFLUSH_ALL
13540   {
13541     long open_max = -1;
13542 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13543     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13544 # else
13545 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13546     open_max = sysconf(_SC_OPEN_MAX);
13547 #  else
13548 #   ifdef FOPEN_MAX
13549     open_max = FOPEN_MAX;
13550 #   else
13551 #    ifdef OPEN_MAX
13552     open_max = OPEN_MAX;
13553 #    else
13554 #     ifdef _NFILE
13555     open_max = _NFILE;
13556 #     endif
13557 #    endif
13558 #   endif
13559 #  endif
13560 # endif 
13561 # ifdef HAS_STDIO_STREAM_ARRAY
13562     if (open_max > 0) {
13563       long i;
13564       for (i = 0; i < open_max; i++)
13565             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13566                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13567                 STDIO_STREAM_ARRAY[i]._flag)
13568                 fflush(&STDIO_STREAM_ARRAY[i]);
13569     }   
13570   }
13571 # endif
13572 #endif
13573   _exit(42);
13574 }
13575 EOCP
13576 : first we have to find out how _not_ to flush
13577 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13578     output=''
13579     set try -DTRY_FPUTC
13580     if eval $compile; then
13581             $rm -f try.out
13582             ./try$exe_ext 2>/dev/null
13583             if $test ! -s try.out -a "X$?" = X42; then
13584                 output=-DTRY_FPUTC
13585             fi
13586     fi
13587     case "$output" in
13588     '')
13589             set try -DTRY_FPRINTF
13590             $rm -f try.out
13591             if eval $compile; then
13592                     $rm -f try.out
13593                     ./try$exe_ext 2>/dev/null
13594                     if $test ! -s try.out -a "X$?" = X42; then
13595                         output=-DTRY_FPRINTF
13596                     fi
13597             fi
13598         ;;
13599     esac
13600 fi
13601 : check for fflush NULL behaviour
13602 case "$fflushNULL" in
13603 '')     set try -DTRY_FFLUSH_NULL $output
13604         if eval $compile; then
13605                 $rm -f try.out
13606                 ./try$exe_ext 2>/dev/null
13607                 code="$?"
13608                 if $test -s try.out -a "X$code" = X42; then
13609                         fflushNULL="`$cat try.out`"
13610                 else
13611                         if $test "X$code" != X42; then
13612                                 $cat >&4 <<EOM
13613 (If this test failed, don't worry, we'll try another method shortly.)
13614 EOM
13615                         fi
13616                 fi
13617         fi
13618         $rm -f core try.core core.try.*
13619         case "$fflushNULL" in
13620         x)      $cat >&4 <<EOM
13621 Your fflush(NULL) works okay for output streams.
13622 Let's see if it clobbers input pipes...
13623 EOM
13624 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13625 # bug that improperly flushes the input end of pipes.  So we avoid the
13626 # autoflush on fork/system/exec support for now. :-(
13627 $cat >tryp.c <<EOCP
13628 #include <stdio.h>
13629 int
13630 main(int argc, char **argv)
13631 {
13632     char buf[1024];
13633     int i;
13634     char *bp = buf;
13635     while (1) {
13636         while ((i = getc(stdin)) != -1
13637                && (*bp++ = i) != '\n'
13638                && bp < &buf[1024])
13639         /* DO NOTHING */ ;
13640         *bp = '\0';
13641         fprintf(stdout, "%s", buf);
13642         fflush(NULL);
13643         if (i == -1)
13644             return 0;
13645         bp = buf;
13646     }
13647 }
13648 EOCP
13649                 fflushNULL="$define"
13650                 set tryp
13651                 if eval $compile; then
13652                     $rm -f tryp.out
13653                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13654                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13655                        $cat >&4 <<EOM
13656 fflush(NULL) seems to behave okay with input streams.
13657 EOM
13658                         fflushNULL="$define"
13659                     else
13660                         $cat >&4 <<EOM
13661 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13662 EOM
13663                         fflushNULL="$undef"
13664                     fi
13665                 fi
13666                 $rm -f core tryp.c tryp.core core.tryp.*
13667                 ;;
13668         '')     $cat >&4 <<EOM
13669 Your fflush(NULL) isn't working (contrary to ANSI C).
13670 EOM
13671                 fflushNULL="$undef"
13672                 ;;
13673         *)      $cat >&4 <<EOM
13674 Cannot figure out whether your fflush(NULL) works or not.
13675 I'm assuming it doesn't (contrary to ANSI C).
13676 EOM
13677                 fflushNULL="$undef"
13678                 ;;
13679         esac
13680         ;;
13681 $define|true|[yY]*)
13682         fflushNULL="$define"
13683         ;;
13684 *)
13685         fflushNULL="$undef"
13686         ;;
13687 esac
13688 : check explicit looping only if NULL did not work, and if the pipe
13689 : bug does not show up on an explicit flush too
13690 case "$fflushNULL" in
13691 "$undef")
13692         $cat >tryp.c <<EOCP
13693 #include <stdio.h>
13694 int
13695 main(int argc, char **argv)
13696 {
13697     char buf[1024];
13698     int i;
13699     char *bp = buf;
13700     while (1) {
13701         while ((i = getc(stdin)) != -1
13702                && (*bp++ = i) != '\n'
13703                && bp < &buf[1024])
13704         /* DO NOTHING */ ;
13705         *bp = '\0';
13706         fprintf(stdout, "%s", buf);
13707         fflush(stdin);
13708         if (i == -1)
13709             return 0;
13710         bp = buf;
13711     }
13712 }
13713 EOCP
13714         set tryp
13715         if eval $compile; then
13716             $rm -f tryp.out
13717             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13718             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13719                $cat >&4 <<EOM
13720 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13721 EOM
13722                 : now check for fflushall behaviour
13723                 case "$fflushall" in
13724                 '')     set try -DTRY_FFLUSH_ALL $output
13725                         if eval $compile; then
13726                                 $cat >&4 <<EOM
13727 (Now testing the other method--but note that this also may fail.)
13728 EOM
13729                                 $rm -f try.out
13730                                 ./try$exe_ext 2>/dev/null
13731                                 if $test -s try.out -a "X$?" = X42; then
13732                                         fflushall="`$cat try.out`"
13733                                 fi
13734                         fi
13735                         $rm -f core try.core core.try.*
13736                         case "$fflushall" in
13737                         x)      $cat >&4 <<EOM
13738 Whew. Flushing explicitly all the stdio streams works.
13739 EOM
13740                                 fflushall="$define"
13741                                 ;;
13742                         '')     $cat >&4 <<EOM
13743 Sigh. Flushing explicitly all the stdio streams doesn't work.
13744 EOM
13745                                 fflushall="$undef"
13746                                 ;;
13747                         *)      $cat >&4 <<EOM
13748 Cannot figure out whether flushing stdio streams explicitly works or not.
13749 I'm assuming it doesn't.
13750 EOM
13751                                 fflushall="$undef"
13752                                 ;;
13753                         esac
13754                         ;;
13755                 "$define"|true|[yY]*)
13756                         fflushall="$define"
13757                         ;;
13758                 *)
13759                         fflushall="$undef"
13760                         ;;
13761                 esac
13762             else
13763                 $cat >&4 <<EOM
13764 All is futile.  Even fflush(stdin) clobbers input pipes!
13765 EOM
13766                 fflushall="$undef"
13767             fi
13768         else
13769             fflushall="$undef"
13770         fi
13771         $rm -f core tryp.c tryp.core core.tryp.*
13772         ;;
13773 *)      fflushall="$undef"
13774         ;;
13775 esac
13776
13777 case "$fflushNULL$fflushall" in
13778 undefundef)
13779         $cat <<EOM
13780 OK, I give up.  I cannot figure out how to flush pending stdio output.
13781 We won't be flushing handles at all before fork/exec/popen.
13782 EOM
13783         ;;
13784 esac
13785 $rm -f try.* try$exe_ext
13786
13787 : Store the full pathname to the ar program for use in the C program
13788 : Respect a hint or command line value for full_ar.
13789 case "$full_ar" in
13790 '') full_ar=$ar ;;
13791 esac
13792
13793 : Store the full pathname to the sed program for use in the C program
13794 full_sed=$sed
13795
13796 : see what type gids are declared as in the kernel
13797 echo " "
13798 echo "Looking for the type for group ids returned by getgid()."
13799 set gid_t gidtype xxx stdio.h sys/types.h
13800 eval $typedef
13801 case "$gidtype" in
13802 xxx)
13803         xxx=`./findhdr sys/user.h`
13804         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13805         case $1 in
13806         unsigned) dflt="$1 $2" ;;
13807         *) dflt="$1" ;;
13808         esac
13809         ;;
13810 *) dflt="$gidtype";;
13811 esac
13812 case "$gidtype" in
13813 gid_t) echo "gid_t found." ;;
13814 *)      rp="What is the type for group ids returned by getgid()?"
13815         . ./myread
13816         gidtype="$ans"
13817         ;;
13818 esac
13819
13820 echo " "
13821 case "$gidtype" in
13822 *_t) zzz="$gidtype"     ;;
13823 *)   zzz="gid"          ;;
13824 esac
13825 echo "Checking the size of $zzz..." >&4 
13826 cat > try.c <<EOCP
13827 #include <sys/types.h>
13828 #include <stdio.h>
13829 int main() {
13830     printf("%d\n", (int)sizeof($gidtype));
13831     exit(0);
13832 }
13833 EOCP
13834 set try
13835 if eval $compile_ok; then
13836         yyy=`./try`
13837         case "$yyy" in
13838         '')     gidsize=4
13839                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13840                 ;;
13841         *)      gidsize=$yyy
13842                 echo "Your $zzz is $gidsize bytes long."
13843                 ;;
13844         esac
13845 else
13846         gidsize=4
13847         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13848 fi
13849
13850
13851 echo " "
13852 case "$gidtype" in
13853 *_t) zzz="$gidtype"     ;;
13854 *)   zzz="gid"          ;;
13855 esac
13856 echo "Checking the sign of $zzz..." >&4 
13857 cat > try.c <<EOCP
13858 #include <sys/types.h>
13859 #include <stdio.h>
13860 int main() {
13861         $gidtype foo = -1;
13862         if (foo < 0)
13863                 printf("-1\n");
13864         else
13865                 printf("1\n");
13866 }
13867 EOCP
13868 set try
13869 if eval $compile; then
13870         yyy=`./try`
13871         case "$yyy" in
13872         '')     gidsign=1
13873                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13874                 ;;
13875         *)      gidsign=$yyy
13876                 case "$gidsign" in
13877                  1) echo "Your $zzz is unsigned." ;;
13878                 -1) echo "Your $zzz is signed."   ;;
13879                 esac
13880                 ;;
13881         esac
13882 else
13883         gidsign=1
13884         echo "(I can't compile the test program--guessing unsigned.)" >&4
13885 fi
13886
13887
13888 echo " "
13889
13890 if $test X"$quadtype" != X; then
13891
13892 echo "Checking how to print 64-bit integers..." >&4
13893
13894 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13895         $cat >try.c <<'EOCP'
13896 #include <sys/types.h>
13897 #include <stdio.h>
13898 int main() {
13899   int q = 12345678901;
13900   printf("%ld\n", q);
13901 }
13902 EOCP
13903         set try
13904         if eval $compile; then
13905                 yyy=`./try$exe_ext`
13906                 case "$yyy" in
13907                 12345678901)
13908                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13909                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13910                         echo "We will use %d."
13911                         ;;
13912                 esac
13913         fi
13914 fi
13915
13916 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13917         $cat >try.c <<'EOCP'
13918 #include <sys/types.h>
13919 #include <stdio.h>
13920 int main() {
13921   long q = 12345678901;
13922   printf("%ld\n", q);
13923 }
13924 EOCP
13925         set try
13926         if eval $compile; then
13927                 yyy=`./try$exe_ext`
13928                 case "$yyy" in
13929                 12345678901)
13930                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13931                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13932                         echo "We will use %ld."
13933                         ;;
13934                 esac
13935         fi
13936 fi
13937
13938 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13939         $cat >try.c <<'EOCP'
13940 #include <sys/types.h>
13941 #include <inttypes.h>
13942 #include <stdio.h>
13943 int main() {
13944   int64_t q = 12345678901;
13945   printf("%" PRId64 "\n", q);
13946 }
13947 EOCP
13948         set try
13949         if eval $compile; then
13950                 yyy=`./try$exe_ext`
13951                 case "$yyy" in
13952                 12345678901)
13953                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13954                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13955                         echo "We will use the C9X style."
13956                         ;;
13957                 esac
13958         fi
13959 fi
13960
13961 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13962         $cat >try.c <<EOCP
13963 #include <sys/types.h>
13964 #include <stdio.h>
13965 int main() {
13966   $quadtype q = 12345678901;
13967   printf("%Ld\n", q);
13968 }
13969 EOCP
13970         set try
13971         if eval $compile; then
13972                 yyy=`./try$exe_ext`
13973                 case "$yyy" in
13974                 12345678901)
13975                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13976                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13977                         echo "We will use %Ld."
13978                         ;;
13979                 esac
13980         fi
13981 fi
13982
13983 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13984         $cat >try.c <<'EOCP'
13985 #include <sys/types.h>
13986 #include <stdio.h>
13987 int main() {
13988   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13989   printf("%lld\n", q);
13990 }
13991 EOCP
13992         set try
13993         if eval $compile; then
13994                 yyy=`./try$exe_ext`
13995                 case "$yyy" in
13996                 12345678901)
13997                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13998                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13999                         echo "We will use the %lld style."
14000                         ;;
14001                 esac
14002         fi
14003 fi
14004
14005 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14006         $cat >try.c <<EOCP
14007 #include <sys/types.h>
14008 #include <stdio.h>
14009 int main() {
14010   $quadtype q = 12345678901;
14011   printf("%qd\n", q);
14012 }
14013 EOCP
14014         set try
14015         if eval $compile; then
14016                 yyy=`./try$exe_ext`
14017                 case "$yyy" in
14018                 12345678901)
14019                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14020                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14021                         echo "We will use %qd."
14022                         ;;
14023                 esac
14024         fi
14025 fi
14026
14027 if $test X"$sPRId64" = X; then
14028         echo "Cannot figure out how to print 64-bit integers." >&4
14029 fi
14030
14031 $rm -f try try.*
14032
14033 fi
14034
14035 case "$sPRId64" in
14036 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
14037         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
14038         ;;
14039 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
14040         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
14041         ;;
14042 esac
14043
14044
14045 echo " "
14046 $echo "Checking the format strings to be used for Perl's internal types..." >&4
14047
14048 if $test X"$ivsize" = X8; then
14049         ivdformat="$sPRId64"
14050         uvuformat="$sPRIu64"
14051         uvoformat="$sPRIo64"
14052         uvxformat="$sPRIx64"
14053         uvXUformat="$sPRIXU64"
14054 else
14055         if $test X"$ivsize" = X"$longsize"; then
14056                 ivdformat='"ld"'
14057                 uvuformat='"lu"'
14058                 uvoformat='"lo"'
14059                 uvxformat='"lx"'
14060                 uvXUformat='"lX"'
14061         else
14062                 if $test X"$ivsize" = X"$intsize"; then
14063                         ivdformat='"d"'
14064                         uvuformat='"u"'
14065                         uvoformat='"o"'
14066                         uvxformat='"x"'
14067                         uvXUformat='"X"'
14068                 else
14069                         : far out
14070                         if $test X"$ivsize" = X"$shortsize"; then
14071                                 ivdformat='"hd"'
14072                                 uvuformat='"hu"'
14073                                 uvoformat='"ho"'
14074                                 uvxformat='"hx"'
14075                                 uvXUformat='"hX"'
14076                         fi
14077                 fi
14078         fi
14079 fi
14080
14081 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14082         nveformat="$sPRIeldbl"
14083         nvfformat="$sPRIfldbl"
14084         nvgformat="$sPRIgldbl"
14085         nvEUformat="$sPRIEUldbl"
14086         nvFUformat="$sPRIFUldbl"
14087         nvGUformat="$sPRIGUldbl"
14088 else
14089         nveformat='"e"'
14090         nvfformat='"f"'
14091         nvgformat='"g"'
14092         nvEUformat='"E"'
14093         nvFUformat='"F"'
14094         nvGUformat='"G"'
14095 fi
14096
14097 case "$ivdformat" in
14098 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14099     exit 1
14100     ;;
14101 esac
14102
14103
14104 echo " "
14105 $echo "Checking the format string to be used for gids..." >&4
14106
14107 case "$gidsign" in
14108 -1)     if $test X"$gidsize" = X"$ivsize"; then
14109                 gidformat="$ivdformat"
14110         else
14111                 if $test X"$gidsize" = X"$longsize"; then
14112                         gidformat='"ld"'
14113                 else
14114                         if $test X"$gidsize" = X"$intsize"; then
14115                                 gidformat='"d"'
14116                         else
14117                                 if $test X"$gidsize" = X"$shortsize"; then
14118                                         gidformat='"hd"'
14119                                 fi
14120                         fi
14121                 fi
14122         fi
14123         ;;
14124 *)      if $test X"$gidsize" = X"$uvsize"; then
14125                 gidformat="$uvuformat"
14126         else
14127                 if $test X"$gidsize" = X"$longsize"; then
14128                         gidformat='"lu"'
14129                 else
14130                         if $test X"$gidsize" = X"$intsize"; then
14131                                 gidformat='"u"'
14132                         else
14133                                 if $test X"$gidsize" = X"$shortsize"; then
14134                                         gidformat='"hu"'
14135                                 fi
14136                         fi
14137                 fi
14138         fi
14139         ;;
14140 esac
14141
14142 : see if getgroups exists
14143 set getgroups d_getgrps
14144 eval $inlibc
14145
14146 : see if setgroups exists
14147 set setgroups d_setgrps
14148 eval $inlibc
14149
14150
14151 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14152 echo " "
14153 case "$d_getgrps$d_setgrps" in
14154 *define*)
14155         case "$groupstype" in
14156         '') dflt="$gidtype" ;;
14157         *)  dflt="$groupstype" ;;
14158         esac
14159         $cat <<EOM
14160 What type of pointer is the second argument to getgroups() and setgroups()?
14161 Usually this is the same as group ids, $gidtype, but not always.
14162
14163 EOM
14164         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14165         . ./myread
14166         groupstype="$ans"
14167         ;;
14168 *)  groupstype="$gidtype";;
14169 esac
14170
14171 echo " "
14172 echo "Checking if your $make program sets \$(MAKE)..." >&4
14173 case "$make_set_make" in
14174 '')
14175         $sed 's/^X //' > testmake.mak << 'EOF'
14176 Xall:
14177 X       @echo 'maketemp="$(MAKE)"'
14178 EOF
14179         case "`$make -f testmake.mak 2>/dev/null`" in
14180         *maketemp=*) make_set_make='#' ;;
14181         *)      make_set_make="MAKE=$make" ;;
14182         esac
14183         $rm -f testmake.mak
14184         ;;
14185 esac
14186 case "$make_set_make" in
14187 '#') echo "Yup, it does.";;
14188 *) echo "Nope, it doesn't.";;
14189 esac
14190
14191 : see what type is used for mode_t
14192 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14193 set mode_t modetype int stdio.h sys/types.h
14194 eval $typedef_ask
14195
14196 : see if stdarg is available
14197 echo " "
14198 if $test `./findhdr stdarg.h`; then
14199         echo "<stdarg.h> found." >&4
14200         valstd="$define"
14201 else
14202         echo "<stdarg.h> NOT found." >&4
14203         valstd="$undef"
14204 fi
14205
14206 : see if varags is available
14207 echo " "
14208 if $test `./findhdr varargs.h`; then
14209         echo "<varargs.h> found." >&4
14210 else
14211         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14212 fi
14213
14214 : set up the varargs testing programs
14215 $cat > varargs.c <<EOP
14216 #ifdef I_STDARG
14217 #include <stdarg.h>
14218 #endif
14219 #ifdef I_VARARGS
14220 #include <varargs.h>
14221 #endif
14222
14223 #ifdef I_STDARG
14224 int f(char *p, ...)
14225 #else
14226 int f(va_alist)
14227 va_dcl
14228 #endif
14229 {
14230         va_list ap;
14231 #ifndef I_STDARG
14232         char *p;
14233 #endif
14234 #ifdef I_STDARG
14235         va_start(ap,p);
14236 #else
14237         va_start(ap);
14238         p = va_arg(ap, char *);
14239 #endif
14240         va_end(ap);
14241 }
14242 EOP
14243 $cat > varargs <<EOP
14244 $startsh
14245 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14246         echo "true"
14247 else
14248         echo "false"
14249 fi
14250 $rm -f varargs$_o
14251 EOP
14252 chmod +x varargs
14253
14254 : now check which varargs header should be included
14255 echo " "
14256 i_varhdr=''
14257 case "$valstd" in
14258 "$define")
14259         if `./varargs I_STDARG`; then
14260                 val='stdarg.h'
14261         elif `./varargs I_VARARGS`; then
14262                 val='varargs.h'
14263         fi
14264         ;;
14265 *)
14266         if `./varargs I_VARARGS`; then
14267                 val='varargs.h'
14268         fi
14269         ;;
14270 esac
14271 case "$val" in
14272 '')
14273 echo "I could not find the definition for va_dcl... You have problems..." >&4
14274         val="$undef"; set i_stdarg; eval $setvar
14275         val="$undef"; set i_varargs; eval $setvar
14276         ;;
14277 *) 
14278         set i_varhdr
14279         eval $setvar
14280         case "$i_varhdr" in
14281         stdarg.h)
14282                 val="$define"; set i_stdarg; eval $setvar
14283                 val="$undef"; set i_varargs; eval $setvar
14284                 ;;
14285         varargs.h)
14286                 val="$undef"; set i_stdarg; eval $setvar
14287                 val="$define"; set i_varargs; eval $setvar
14288                 ;;
14289         esac
14290         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14291 esac
14292 $rm -f varargs*
14293
14294 : see if we need va_copy
14295 echo " "
14296 case "$i_stdarg" in
14297 "$define")
14298         $cat >try.c <<EOCP
14299 #include <stdarg.h>
14300 #include <stdio.h>
14301 #$i_stdlib I_STDLIB
14302 #ifdef I_STDLIB
14303 #include <stdlib.h>
14304 #endif
14305 #include <signal.h>
14306
14307 int
14308 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14309 {
14310   return vfprintf(f, fmt, *valp);
14311 }
14312  
14313 int    
14314 myvfprintf(FILE *f, const  char *fmt, va_list val)
14315 {
14316   return ivfprintf(f, fmt, &val);
14317 }
14318       
14319 int
14320 myprintf(char *fmt, ...) 
14321 {
14322   va_list val;
14323   va_start(val, fmt);
14324   return myvfprintf(stdout, fmt, val); 
14325 }         
14326
14327 int
14328 main(int ac, char **av)
14329 {
14330   signal(SIGSEGV, exit);
14331
14332   myprintf("%s%cs all right, then\n", "that", '\'');                            
14333   exit(0);      
14334 }
14335 EOCP
14336         set try
14337         if eval $compile && ./try 2>&1 >/dev/null; then
14338                 case "`./try`" in
14339                 "that's all right, then")
14340                         okay=yes
14341                         ;;
14342                 esac
14343         fi
14344         case "$okay" in
14345         yes)    echo "It seems that you don't need va_copy()." >&4
14346                 need_va_copy="$undef"
14347                 ;;
14348         *)      echo "It seems that va_copy() or similar will be needed." >&4
14349                 need_va_copy="$define"
14350                 ;;
14351         esac
14352         $rm -f try.* core core.* *.core *.core.*
14353         ;;
14354 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14355         ;;
14356 esac
14357
14358 : define a fucntion to check prototypes
14359 $cat > protochk <<EOSH
14360 $startsh
14361 cc="$cc"
14362 optimize="$optimize"
14363 ccflags="$ccflags"
14364 prototype="$prototype"
14365 define="$define"
14366 rm=$rm
14367 EOSH
14368
14369 $cat >> protochk <<'EOSH'
14370
14371 $rm -f try.c
14372 foo="$1"
14373 shift
14374 while test $# -ge 2; do
14375         case "$1" in
14376                 $define) echo "#include <$2>" >> try.c ;;
14377                 literal) echo "$2" >> try.c ;;
14378         esac
14379     shift 2
14380 done
14381 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14382 cat >> try.c <<'EOCP'
14383 #ifdef CAN_PROTOTYPE
14384 #define _(args) args
14385 #else
14386 #define _(args) ()
14387 #endif
14388 EOCP
14389 echo "$foo" >> try.c
14390 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14391 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14392 status=$?
14393 $rm -f try.[co]
14394 exit $status
14395 EOSH
14396 chmod +x protochk
14397 $eunicefix protochk
14398
14399 : see what type is used for size_t
14400 rp="What is the type used for the length parameter for string functions?"
14401 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14402 eval $typedef_ask
14403
14404 : check for type of arguments to gethostbyaddr. 
14405 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14406         case "$d_gethbyaddr" in
14407         $define)
14408                 $cat <<EOM
14409
14410 Checking to see what type of arguments are accepted by gethostbyaddr().
14411 EOM
14412                 hdrs="$define sys/types.h
14413                         $d_socket sys/socket.h 
14414                         $i_niin netinet/in.h 
14415                         $i_netdb netdb.h
14416                         $i_unistd unistd.h"
14417                 : The first arg can 'char *' or 'void *'
14418                 : The second arg is some of integral type
14419                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14420                         for yyy in size_t long int; do
14421                                 case "$netdb_host_type" in
14422                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14423                                         if ./protochk "$try" $hdrs; then
14424                                                 echo "Your system accepts $xxx for the first arg."
14425                                                 echo "...and $yyy for the second arg."
14426                                                 netdb_host_type="$xxx"
14427                                                 netdb_hlen_type="$yyy"
14428                                         fi
14429                                         ;;
14430                                 esac
14431                         done
14432                 done
14433                 : In case none of those worked, prompt the user.
14434                 case "$netdb_host_type" in
14435                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14436                         dflt='char *'
14437                         . ./myread
14438                         netdb_host_type=$ans
14439                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14440                         dflt="$sizetype"
14441                         . ./myread
14442                         netdb_hlen_type=$ans
14443                         ;;
14444                 esac
14445                 ;;
14446         *)      : no gethostbyaddr, so pick harmless defaults
14447                 netdb_host_type='char *'
14448                 netdb_hlen_type="$sizetype"
14449                 ;;
14450         esac
14451         # Remove the "const" if needed. -- but then we'll have a 
14452         # prototype clash!
14453         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14454 fi
14455
14456 : check for type of argument to gethostbyname. 
14457 if test "X$netdb_name_type" = X ; then
14458         case "$d_gethbyname" in
14459         $define)
14460                 $cat <<EOM
14461
14462 Checking to see what type of argument is accepted by gethostbyname().
14463 EOM
14464                 hdrs="$define sys/types.h
14465                         $d_socket sys/socket.h 
14466                         $i_niin netinet/in.h 
14467                         $i_netdb netdb.h
14468                         $i_unistd unistd.h"
14469                 for xxx in "const char *" "char *"; do
14470                         case "$netdb_name_type" in
14471                         '')     try="extern struct hostent *gethostbyname($xxx);"
14472                                 if ./protochk "$try" $hdrs; then
14473                                         echo "Your system accepts $xxx."
14474                                         netdb_name_type="$xxx"
14475                                 fi
14476                                 ;;
14477                         esac
14478                 done
14479                 : In case none of those worked, prompt the user.
14480                 case "$netdb_name_type" in
14481                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14482                         dflt='char *'
14483                         . ./myread
14484                         netdb_name_type=$ans
14485                         ;;
14486                 esac
14487                 ;;
14488         *)      : no gethostbyname, so pick harmless default
14489                 netdb_name_type='char *'
14490                 ;;
14491         esac
14492 fi
14493
14494 : check for type of 1st argument to getnetbyaddr. 
14495 if test "X$netdb_net_type" = X ; then
14496         case "$d_getnbyaddr" in
14497         $define)
14498                 $cat <<EOM
14499
14500 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14501 EOM
14502                 hdrs="$define sys/types.h
14503                         $d_socket sys/socket.h 
14504                         $i_niin netinet/in.h 
14505                         $i_netdb netdb.h
14506                         $i_unistd unistd.h"
14507                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14508                         case "$netdb_net_type" in
14509                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14510                                 if ./protochk "$try" $hdrs; then
14511                                         echo "Your system accepts $xxx."
14512                                         netdb_net_type="$xxx"
14513                                 fi
14514                                 ;;
14515                         esac
14516                 done
14517                 : In case none of those worked, prompt the user.
14518                 case "$netdb_net_type" in
14519                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14520                         dflt='long'
14521                         . ./myread
14522                         netdb_net_type=$ans
14523                         ;;
14524                 esac
14525                 ;;
14526         *)      : no getnetbyaddr, so pick harmless default
14527                 netdb_net_type='long'
14528                 ;;
14529         esac
14530 fi
14531 : locate the preferred pager for this system
14532 case "$pager" in
14533 '')
14534         dflt=''
14535         case "$pg" in
14536         /*) dflt=$pg;;
14537         [a-zA-Z]:/*) dflt=$pg;;
14538         esac
14539         case "$more" in
14540         /*) dflt=$more;;
14541         [a-zA-Z]:/*) dflt=$more;;
14542         esac
14543         case "$less" in
14544         /*) dflt=$less;;
14545         [a-zA-Z]:/*) dflt=$less;;
14546         esac
14547         case "$dflt" in
14548         '') dflt=/usr/ucb/more;;
14549         esac
14550         ;;
14551 *) dflt="$pager";;
14552 esac
14553 echo " "
14554 fn=f/
14555 rp='What pager is used on your system?'
14556 . ./getfile
14557 pager="$ans"
14558
14559 : see what type pids are declared as in the kernel
14560 rp="What is the type of process ids on this system?"
14561 set pid_t pidtype int stdio.h sys/types.h
14562 eval $typedef_ask
14563
14564 : Find earliest binary compatible site_perl subdirectory perl can use.
14565 case "$bincompat5005" in
14566 "$define") xs_apiversion='5.005' ;;
14567 *) xs_apiversion=$version ;;   # The current site_perl version.
14568 esac
14569 : Find earliest pure perl site_perl subdirectory perl can use.
14570 : The versioned directories started at 5.005.
14571 pm_apiversion='5.005'
14572
14573 : see if ar generates random libraries by itself
14574 echo " "
14575 echo "Checking how to generate random libraries on your machine..." >&4
14576 echo 'int bar1() { return bar2(); }' > bar1.c
14577 echo 'int bar2() { return 2; }' > bar2.c
14578 $cat > foo.c <<'EOP'
14579 int main() { printf("%d\n", bar1()); exit(0); }
14580 EOP
14581 $cc $ccflags -c bar1.c >/dev/null 2>&1
14582 $cc $ccflags -c bar2.c >/dev/null 2>&1
14583 $cc $ccflags -c foo.c >/dev/null 2>&1
14584 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14585 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14586         ./foobar >/dev/null 2>&1; then
14587         echo "$ar appears to generate random libraries itself."
14588         orderlib=false
14589         ranlib=":"
14590 elif $ar ts bar$_a >/dev/null 2>&1 &&
14591         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14592         ./foobar >/dev/null 2>&1; then
14593                 echo "a table of contents needs to be added with '$ar ts'."
14594                 orderlib=false
14595                 ranlib="$ar ts"
14596 else
14597         case "$ranlib" in
14598         :) ranlib='';;
14599         '')
14600                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14601                 $test -f $ranlib || ranlib=''
14602                 ;;
14603         esac
14604         if $test -n "$ranlib"; then
14605                 echo "your system has '$ranlib'; we'll use that."
14606                 orderlib=false
14607         else
14608                 echo "your system doesn't seem to support random libraries"
14609                 echo "so we'll use lorder and tsort to order the libraries."
14610                 orderlib=true
14611                 ranlib=":"
14612         fi
14613 fi
14614 $rm -f foo* bar* 
14615
14616 : check for type of arguments to select. 
14617 case "$selecttype" in
14618 '') case "$d_select" in
14619         $define)
14620                 echo " "
14621                 $cat <<EOM
14622 Checking to see what type of arguments are accepted by select().
14623 EOM
14624                 hdrs="$define sys/types.h
14625                         $i_systime sys/time.h 
14626                         $i_sysselct sys/select.h
14627                         $d_socket sys/socket.h"
14628                 : The first arg can be int, unsigned, or size_t
14629                 : The last arg may or may not be 'const'
14630                 val=''
14631                 : void pointer has been seen but using that
14632                 : breaks the selectminbits test
14633                 for xxx in 'fd_set *' 'int *'; do
14634                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14635                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14636                                         case "$val" in
14637                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14638                                                 if ./protochk "$try" $hdrs; then
14639                                                         echo "Your system accepts $xxx."
14640                                                         val="$xxx"
14641                                                 fi
14642                                                 ;;
14643                                         esac
14644                                 done
14645                         done
14646                 done
14647                 case "$val" in
14648                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14649                         case "$d_fd_set" in
14650                                 $define) dflt="fd_set *" ;;
14651                                 *)              dflt="int *" ;;
14652                         esac
14653                         . ./myread
14654                         val=$ans
14655                         ;;
14656                 esac
14657                 selecttype="$val"
14658                 ;;
14659         *)      : no select, so pick a harmless default
14660                 selecttype='int *'
14661                 ;;
14662         esac
14663         ;;
14664 esac
14665
14666 : check for the select 'width'
14667 case "$selectminbits" in
14668 '') case "$d_select" in
14669         $define)
14670                 $cat <<EOM
14671
14672 Checking to see on how many bits at a time your select() operates...
14673 EOM
14674                 $cat >try.c <<EOCP
14675 #include <sys/types.h>
14676 #$i_time I_TIME
14677 #$i_systime I_SYS_TIME
14678 #$i_systimek I_SYS_TIME_KERNEL
14679 #ifdef I_TIME
14680 #   include <time.h>
14681 #endif
14682 #ifdef I_SYS_TIME
14683 #   ifdef I_SYS_TIME_KERNEL
14684 #       define KERNEL
14685 #   endif
14686 #   include <sys/time.h>
14687 #   ifdef I_SYS_TIME_KERNEL
14688 #       undef KERNEL
14689 #   endif
14690 #endif
14691 #$i_sysselct I_SYS_SELECT
14692 #ifdef I_SYS_SELECT
14693 #include <sys/select.h>
14694 #endif
14695 #$d_socket HAS_SOCKET
14696 #ifdef HAS_SOCKET
14697 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14698 #endif
14699 #include <stdio.h>
14700 $selecttype b;
14701 #define S sizeof(*(b))
14702 #define MINBITS 64
14703 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14704 #define NBITS  (NBYTES * 8)
14705 int main() {
14706     char s[NBYTES];
14707     struct timeval t;
14708     int i;
14709     FILE* fp;
14710     int fd;
14711
14712     fclose(stdin);
14713     fp = fopen("try.c", "r");
14714     if (fp == 0)
14715       exit(1);
14716     fd = fileno(fp);
14717     if (fd < 0)
14718       exit(2);
14719     b = ($selecttype)s;
14720     for (i = 0; i < NBITS; i++)
14721         FD_SET(i, b);
14722     t.tv_sec  = 0;
14723     t.tv_usec = 0;
14724     select(fd + 1, b, 0, 0, &t);
14725     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14726     printf("%d\n", i + 1);
14727     return 0;
14728 }
14729 EOCP
14730                 set try
14731                 if eval $compile_ok; then
14732                         selectminbits=`./try`
14733                         case "$selectminbits" in
14734                         '')     cat >&4 <<EOM
14735 Cannot figure out on how many bits at a time your select() operates.
14736 I'll play safe and guess it is 32 bits.
14737 EOM
14738                                 selectminbits=32
14739                                 bits="32 bits"
14740                                 ;;
14741                         1)      bits="1 bit" ;;
14742                         *)      bits="$selectminbits bits" ;;
14743                         esac
14744                         echo "Your select() operates on $bits at a time." >&4
14745                 else
14746                         rp='What is the minimum number of bits your select() operates on?'
14747                         case "$byteorder" in
14748                         1234|12345678)  dflt=32 ;;
14749                         *)              dflt=1  ;;
14750                         esac
14751                         . ./myread
14752                         val=$ans
14753                         selectminbits="$val"
14754                 fi
14755                 $rm -f try.* try
14756                 ;;
14757         *)      : no select, so pick a harmless default
14758                 selectminbits='32'
14759                 ;;
14760         esac
14761         ;;
14762 esac
14763
14764 : Trace out the files included by signal.h, then look for SIGxxx names.
14765 : Remove SIGARRAYSIZE used by HPUX.
14766 : Remove SIGSTKSIZE used by Linux.
14767 : Remove SIGSTKSZ used by Posix.
14768 : Remove SIGTYP void lines used by OS2.
14769 : Some cpps, like os390, dont give the file name anywhere
14770 if [ "X$fieldn" = X ]; then
14771         : Just make some guesses.  We check them later.
14772         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14773 else
14774         xxx=`echo '#include <signal.h>' |
14775         $cppstdin $cppminus $cppflags 2>/dev/null |
14776         $grep '^[       ]*#.*include' | 
14777         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
14778 fi
14779 : Check this list of files to be sure we have parsed the cpp output ok.
14780 : This will also avoid potentially non-existent files, such 
14781 : as ../foo/bar.h
14782 xxxfiles=''
14783 for xx in $xxx /dev/null ; do
14784         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14785 done
14786 : If we have found no files, at least try signal.h
14787 case "$xxxfiles" in
14788 '')     xxxfiles=`./findhdr signal.h` ;;
14789 esac
14790 xxx=`awk '
14791 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14792         print substr($2, 4, 20)
14793 }
14794 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14795         print substr($3, 4, 20)
14796 }' $xxxfiles`
14797 : Append some common names just in case the awk scan failed.
14798 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14799 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14800 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14801 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14802 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14803
14804 : generate a few handy files for later
14805 $cat > signal.c <<'EOCP'
14806 #include <sys/types.h>
14807 #include <signal.h>
14808 #include <stdio.h>
14809 int main() {
14810
14811 /* Strange style to avoid deeply-nested #if/#else/#endif */
14812 #ifndef NSIG
14813 #  ifdef _NSIG
14814 #    define NSIG (_NSIG)
14815 #  endif
14816 #endif
14817
14818 #ifndef NSIG
14819 #  ifdef SIGMAX
14820 #    define NSIG (SIGMAX+1)
14821 #  endif
14822 #endif
14823
14824 #ifndef NSIG
14825 #  ifdef SIG_MAX
14826 #    define NSIG (SIG_MAX+1)
14827 #  endif
14828 #endif
14829
14830 #ifndef NSIG
14831 #  ifdef MAXSIG
14832 #    define NSIG (MAXSIG+1)
14833 #  endif
14834 #endif
14835
14836 #ifndef NSIG
14837 #  ifdef MAX_SIG
14838 #    define NSIG (MAX_SIG+1)
14839 #  endif
14840 #endif
14841
14842 #ifndef NSIG
14843 #  ifdef SIGARRAYSIZE
14844 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14845 #  endif
14846 #endif
14847
14848 #ifndef NSIG
14849 #  ifdef _sys_nsig
14850 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14851 #  endif
14852 #endif
14853
14854 /* Default to some arbitrary number that's big enough to get most
14855    of the common signals.
14856 */
14857 #ifndef NSIG
14858 #    define NSIG 50
14859 #endif
14860
14861 printf("NSIG %d\n", NSIG);
14862
14863 #ifndef JUST_NSIG
14864
14865 EOCP
14866
14867 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14868 {
14869         printf "#ifdef SIG"; printf $1; printf "\n"
14870         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14871         printf $1; printf ");\n"
14872         printf "#endif\n"
14873 }
14874 END {
14875         printf "#endif /* JUST_NSIG */\n";
14876         printf "exit(0);\n}\n";
14877 }
14878 ' >>signal.c
14879 $cat >signal.awk <<'EOP'
14880 BEGIN { ndups = 0 }
14881 $1 ~ /^NSIG$/ { nsig = $2 }
14882 ($1 !~ /^NSIG$/) && (NF == 2) {
14883     if ($2 > maxsig) { maxsig = $2 }
14884     if (sig_name[$2]) {
14885         dup_name[ndups] = $1
14886         dup_num[ndups] = $2
14887         ndups++ 
14888     }
14889     else {
14890         sig_name[$2] = $1
14891         sig_num[$2] = $2
14892     }
14893 }
14894 END { 
14895     if (nsig == 0) {
14896         nsig = maxsig + 1
14897     }
14898     printf("NSIG %d\n", nsig);
14899     for (n = 1; n < nsig; n++) {
14900         if (sig_name[n]) {
14901             printf("%s %d\n", sig_name[n], sig_num[n])
14902         }
14903         else {
14904             printf("NUM%d %d\n", n, n) 
14905         }
14906     }
14907     for (n = 0; n < ndups; n++) {
14908         printf("%s %d\n", dup_name[n], dup_num[n])
14909     }
14910 }
14911 EOP
14912 $cat >signal_cmd <<EOS
14913 $startsh
14914 if $test -s signal.lst; then
14915     echo "Using your existing signal.lst file"
14916         exit 0
14917 fi
14918 xxx="$xxx"
14919 EOS
14920 $cat >>signal_cmd <<'EOS'
14921
14922 set signal
14923 if eval $compile_ok; then
14924         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14925 else
14926         echo "(I can't seem be able to compile the whole test program)" >&4
14927         echo "(I'll try it in little pieces.)" >&4
14928         set signal -DJUST_NSIG
14929         if eval $compile_ok; then
14930                 ./signal$_exe > signal.nsg
14931                 $cat signal.nsg
14932         else
14933                 echo "I can't seem to figure out how many signals you have." >&4
14934                 echo "Guessing 50." >&4
14935                 echo 'NSIG 50' > signal.nsg
14936         fi
14937         : Now look at all the signal names, one at a time.
14938         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14939                 $cat > signal.c <<EOCP
14940 #include <sys/types.h>
14941 #include <signal.h>
14942 #include <stdio.h>
14943 int main() {
14944 printf("$xx %d\n", SIG${xx});
14945 return 0;
14946 }
14947 EOCP
14948                 set signal
14949                 if eval $compile; then
14950                         echo "SIG${xx} found."
14951                         ./signal$_exe  >> signal.ls1
14952                 else
14953                         echo "SIG${xx} NOT found."
14954                 fi
14955         done
14956         if $test -s signal.ls1; then
14957                 $cat signal.nsg signal.ls1 |
14958                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14959         fi
14960
14961 fi
14962 if $test -s signal.lst; then
14963         :
14964 else
14965         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14966         echo 'kill -l' >signal
14967         set X `csh -f <signal`
14968         $rm -f signal
14969         shift
14970         case $# in
14971         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14972         esac
14973         echo $@ | $tr ' ' $trnl | \
14974             $awk '{ printf "%s %d\n", $1, ++s; }
14975                   END { printf "NSIG %d\n", ++s }' >signal.lst
14976 fi
14977 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14978 EOS
14979 chmod a+x signal_cmd
14980 $eunicefix signal_cmd
14981
14982 : generate list of signal names
14983 echo " "
14984 case "$sig_name_init" in
14985 '') doinit=yes ;;
14986 *)  case "$sig_num_init" in
14987     ''|*,*) doinit=yes ;;
14988     esac ;;
14989 esac
14990 case "$doinit" in
14991 yes)
14992         echo "Generating a list of signal names and numbers..." >&4
14993         . ./signal_cmd
14994         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14995         sig_name=`$awk 'BEGIN { printf "ZERO " }
14996                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14997         sig_num=`$awk  'BEGIN { printf "0 " }
14998                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14999         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
15000                              !/^NSIG/   { printf "\"%s\", ", $1 }
15001                              END        { printf "0\n" }' signal.lst`
15002         sig_num_init=`$awk  'BEGIN      { printf "0, " }
15003                              !/^NSIG/   { printf "%d, ", $2}
15004                              END        { printf "0\n"}' signal.lst`
15005         ;;
15006 esac
15007 echo "The following $sig_count signals are available:"
15008 echo " "
15009 echo $sig_name | $awk \
15010 'BEGIN { linelen = 0 }
15011 {
15012         for (i = 1; i <= NF; i++) {
15013                 name = "SIG" $i " "
15014                 linelen = linelen + length(name)
15015                 if (linelen > 70) {
15016                         printf "\n"
15017                         linelen = length(name)
15018                 }
15019                 printf "%s", name
15020         }
15021         printf "\n"
15022 }'
15023 sig_size=`echo $sig_name | awk '{print NF}'`
15024 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
15025
15026 echo " "
15027 case "$sizetype" in
15028 *_t) zzz="$sizetype"    ;;
15029 *)   zzz="filesize"     ;;
15030 esac
15031 echo "Checking the size of $zzz..." >&4 
15032 cat > try.c <<EOCP
15033 #include <sys/types.h>
15034 #include <stdio.h>
15035 int main() {
15036     printf("%d\n", (int)sizeof($sizetype));
15037     exit(0);
15038 }
15039 EOCP
15040 set try
15041 if eval $compile_ok; then
15042         yyy=`./try`
15043         case "$yyy" in
15044         '')     sizesize=4
15045                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15046                 ;;
15047         *)      sizesize=$yyy
15048                 echo "Your $zzz size is $sizesize bytes."
15049                 ;;
15050         esac
15051 else
15052         sizesize=4
15053         echo "(I can't compile the test program--guessing $sizesize.)" >&4
15054 fi
15055
15056
15057 : check for socklen_t
15058 echo " "
15059 echo "Checking to see if you have socklen_t..." >&4
15060 $cat >try.c <<EOCP
15061 #include <sys/types.h>
15062 #$d_socket HAS_SOCKET
15063 #ifdef HAS_SOCKET
15064 #include <sys/socket.h>
15065 #endif
15066 int main() { socklen_t x = 16; }
15067 EOCP
15068 set try
15069 if eval $compile; then
15070         val="$define"
15071         echo "You have socklen_t."
15072 else
15073         val="$undef"
15074         echo "You do not have socklen_t."
15075         case "$sizetype" in
15076         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15077         esac
15078 fi
15079 $rm -f try try.*
15080 set d_socklen_t
15081 eval $setvar
15082
15083 : see if this is a socks.h system
15084 set socks.h i_socks
15085 eval $inhdr
15086
15087 : check for type of the size argument to socket calls
15088 case "$d_socket" in
15089 "$define")
15090         $cat <<EOM
15091
15092 Checking to see what type is the last argument of accept().
15093 EOM
15094         yyy=''
15095         case "$d_socklen_t" in
15096         "$define") yyy="$yyy socklen_t"
15097         esac
15098         yyy="$yyy $sizetype int long unsigned"
15099         for xxx in $yyy; do
15100                 case "$socksizetype" in
15101                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
15102                         case "$usesocks" in
15103                         "$define")
15104                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15105                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15106                                         socksizetype="$xxx"
15107                                 fi
15108                                 ;;
15109                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
15110                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15111                                         socksizetype="$xxx"
15112                                 fi
15113                                 ;;
15114                         esac
15115                         ;;
15116                 esac
15117         done
15118 : In case none of those worked, prompt the user.
15119         case "$socksizetype" in
15120         '')     rp='What is the type for socket address structure sizes?'
15121                 dflt='int'
15122                 . ./myread
15123                 socksizetype=$ans
15124                 ;;
15125         esac
15126         ;;
15127 *)      : no sockets, so pick relatively harmless default
15128         socksizetype='int'
15129         ;;
15130 esac
15131
15132 : see what type is used for signed size_t
15133 set ssize_t ssizetype int stdio.h sys/types.h
15134 eval $typedef
15135 dflt="$ssizetype"
15136 $cat > ssize.c <<EOM
15137 #include <stdio.h>
15138 #include <sys/types.h>
15139 #define Size_t $sizetype
15140 #define SSize_t $dflt
15141 int main()
15142 {
15143         if (sizeof(Size_t) == sizeof(SSize_t))
15144                 printf("$dflt\n");
15145         else if (sizeof(Size_t) == sizeof(int))
15146                 printf("int\n");
15147         else 
15148                 printf("long\n");
15149         exit(0);
15150 }
15151 EOM
15152 echo " "
15153 set ssize
15154 if eval $compile_ok && ./ssize > /dev/null; then
15155         ssizetype=`./ssize`
15156         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15157 else
15158         $cat >&4 <<EOM
15159 Help! I can't compile and run the ssize_t test program: please enlighten me!
15160 (This is probably a misconfiguration in your system or libraries, and
15161 you really ought to fix it.  Still, I'll try anyway.)
15162
15163 I need a type that is the same size as $sizetype, but is guaranteed to
15164 be signed.  Common values are ssize_t, int and long.
15165
15166 EOM
15167         rp="What signed type is the same size as $sizetype?"
15168         . ./myread
15169         ssizetype="$ans"
15170 fi
15171 $rm -f ssize ssize.*
15172
15173 : see what type of char stdio uses.
15174 echo " "
15175 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15176 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15177         echo "Your stdio uses unsigned chars." >&4
15178         stdchar="unsigned char"
15179 else
15180         echo "Your stdio uses signed chars." >&4
15181         stdchar="char"
15182 fi
15183 $rm -f stdioh
15184
15185
15186
15187 : see if time exists
15188 echo " "
15189 if test "X$d_time" = X -o X"$timetype" = X; then
15190     if set time val -f d_time; eval $csym; $val; then
15191                 echo 'time() found.' >&4
15192                 val="$define"
15193                 rp="What is the type returned by time() on this system?"
15194                 set time_t timetype long stdio.h sys/types.h
15195                 eval $typedef_ask
15196     else
15197                 echo 'time() not found, hope that will do.' >&4
15198                 val="$undef"
15199                 timetype='int';
15200     fi
15201     set d_time
15202     eval $setvar
15203 fi
15204
15205 : see what type uids are declared as in the kernel
15206 echo " "
15207 echo "Looking for the type for user ids returned by getuid()."
15208 set uid_t uidtype xxx stdio.h sys/types.h
15209 eval $typedef
15210 case "$uidtype" in
15211 xxx)
15212         xxx=`./findhdr sys/user.h`
15213         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15214         case $1 in
15215         unsigned) dflt="$1 $2" ;;
15216         *) dflt="$1" ;;
15217         esac
15218         ;;
15219 *) dflt="$uidtype";;
15220 esac
15221 case "$uidtype" in
15222 uid_t)  echo "uid_t found." ;;
15223 *)      rp="What is the type for user ids returned by getuid()?"
15224         . ./myread
15225         uidtype="$ans"
15226         ;;
15227 esac
15228
15229 echo " "
15230 case "$uidtype" in
15231 *_t) zzz="$uidtype"     ;;
15232 *)   zzz="uid"          ;;
15233 esac
15234 echo "Checking the size of $zzz..." >&4 
15235 cat > try.c <<EOCP
15236 #include <sys/types.h>
15237 #include <stdio.h>
15238 int main() {
15239     printf("%d\n", (int)sizeof($uidtype));
15240     exit(0);
15241 }
15242 EOCP
15243 set try
15244 if eval $compile_ok; then
15245         yyy=`./try`
15246         case "$yyy" in
15247         '')     uidsize=4
15248                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15249                 ;;
15250         *)      uidsize=$yyy
15251                 echo "Your $zzz is $uidsize bytes long."
15252                 ;;
15253         esac
15254 else
15255         uidsize=4
15256         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15257 fi
15258
15259 echo " "
15260 case "$uidtype" in
15261 *_t) zzz="$uidtype"     ;;
15262 *)   zzz="uid"          ;;
15263 esac
15264 echo "Checking the sign of $zzz..." >&4
15265 cat > try.c <<EOCP
15266 #include <sys/types.h>
15267 #include <stdio.h>
15268 int main() {
15269         $uidtype foo = -1;
15270         if (foo < 0)
15271                 printf("-1\n");
15272         else
15273                 printf("1\n");
15274 }
15275 EOCP
15276 set try
15277 if eval $compile; then
15278         yyy=`./try`
15279         case "$yyy" in
15280         '')     uidsign=1
15281                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15282                 ;;
15283         *)      uidsign=$yyy
15284                 case "$uidsign" in
15285                  1) echo "Your $zzz is unsigned." ;;
15286                 -1) echo "Your $zzz is signed."   ;;
15287                 esac
15288                 ;;
15289         esac
15290 else
15291         uidsign=1
15292         echo "(I can't compile the test program--guessing unsigned.)" >&4
15293 fi
15294
15295
15296
15297 echo " "
15298 $echo "Checking the format string to be used for uids..." >&4
15299
15300 case "$uidsign" in
15301 -1)     if $test X"$uidsize" = X"$ivsize"; then
15302                 uidformat="$ivdformat"
15303         else
15304                 if $test X"$uidsize" = X"$longsize"; then
15305                         uidformat='"ld"'
15306                 else
15307                         if $test X"$uidsize" = X"$intsize"; then
15308                                 uidformat='"d"'
15309                         else
15310                                 if $test X"$uidsize" = X"$shortsize"; then
15311                                         uidformat='"hd"'
15312                                 fi
15313                         fi
15314                 fi
15315         fi
15316         ;;
15317 *)      if $test X"$uidsize" = X"$uvsize"; then
15318                 uidformat="$uvuformat"
15319         else
15320                 if $test X"$uidsize" = X"$longsize"; then
15321                         uidformat='"lu"'
15322                 else
15323                         if $test X"$uidsize" = X"$intsize"; then
15324                                 uidformat='"u"'
15325                         else
15326                                 if $test X"$uidsize" = X"$shortsize"; then
15327                                         uidformat='"hu"'
15328                                 fi
15329                         fi
15330                 fi
15331         fi
15332         ;;
15333 esac
15334
15335 : determine compiler compiler
15336 case "$yacc" in
15337 '')
15338         dflt=yacc;;
15339 *)
15340         dflt="$yacc";;
15341 esac
15342 echo " "
15343 comp='yacc'
15344 if $test -f "$byacc"; then
15345         dflt="$byacc"
15346         comp="byacc or $comp"
15347 fi
15348 if $test -f "$bison"; then
15349         comp="$comp or bison -y"
15350 fi
15351 rp="Which compiler compiler ($comp) shall I use?"
15352 . ./myread
15353 yacc="$ans"
15354 case "$yacc" in
15355 *bis*)
15356         case "$yacc" in
15357         *-y*) ;;
15358         *)
15359                 yacc="$yacc -y"
15360                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15361                 ;;
15362         esac
15363         ;;
15364 esac
15365
15366 : see if fcntl.h is there
15367 val=''
15368 set fcntl.h val
15369 eval $inhdr
15370
15371 : see if we can include fcntl.h
15372 case "$val" in
15373 "$define")
15374         echo " "
15375         if $h_fcntl; then
15376                 val="$define"
15377                 echo "We'll be including <fcntl.h>." >&4
15378         else
15379                 val="$undef"
15380                 if $h_sysfile; then
15381         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15382                 else
15383                         echo "We won't be including <fcntl.h>." >&4
15384                 fi
15385         fi
15386         ;;
15387 *)
15388         h_fcntl=false
15389         val="$undef"
15390         ;;
15391 esac
15392 set i_fcntl
15393 eval $setvar
15394
15395 : see if this is a iconv.h system
15396 set iconv.h i_iconv
15397 eval $inhdr
15398
15399 : see if this is a ieeefp.h system
15400 set ieeefp.h i_ieeefp
15401 eval $inhdr
15402
15403 : see if this is a libutil.h system
15404 set libutil.h i_libutil
15405 eval $inhdr
15406
15407 : see if locale.h is available
15408 set locale.h i_locale
15409 eval $inhdr
15410
15411 : see if mach cthreads are available
15412 if test "X$usethreads" = "X$define"; then
15413         set mach/cthreads.h i_machcthr
15414         eval $inhdr
15415 else
15416         i_machcthr="$undef"
15417 fi
15418
15419
15420
15421 : see if this is a math.h system
15422 set math.h i_math
15423 eval $inhdr
15424
15425 : see if this is a mntent.h system
15426 set mntent.h i_mntent
15427 eval $inhdr
15428
15429 : see if ndbm.h is available
15430 set ndbm.h t_ndbm
15431 eval $inhdr
15432 case "$t_ndbm" in
15433 $define)
15434         : see if dbm_open exists
15435         set dbm_open d_dbm_open
15436         eval $inlibc
15437         case "$d_dbm_open" in
15438         $undef)
15439                 t_ndbm="$undef"
15440                 echo "We won't be including <ndbm.h>"
15441                 ;;
15442         esac
15443         ;;
15444 esac
15445 val="$t_ndbm"
15446 set i_ndbm
15447 eval $setvar
15448
15449 : see if net/errno.h is available
15450 val=''
15451 set net/errno.h val
15452 eval $inhdr
15453
15454 : Unfortunately, it causes problems on some systems.  Arrgh.
15455 case "$val" in
15456 $define)
15457         cat > try.c <<'EOM'
15458 #include <stdio.h>
15459 #include <errno.h>
15460 #include <net/errno.h>
15461 int func()
15462 {
15463         return ENOTSOCK;
15464 }
15465 EOM
15466         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15467                 echo "We'll be including <net/errno.h>." >&4
15468         else
15469                 echo "We won't be including <net/errno.h>." >&4
15470                 val="$undef"
15471         fi
15472         $rm -f try.* try
15473         ;;
15474 esac
15475 set i_neterrno
15476 eval $setvar
15477
15478 : see if netinet/tcp.h is available
15479 set netinet/tcp.h i_netinettcp
15480 eval $inhdr
15481
15482 : see if this is a poll.h system
15483 set poll.h i_poll
15484 eval $inhdr
15485
15486 : see if this is a prot.h system
15487 set prot.h i_prot
15488 eval $inhdr
15489
15490 echo " "
15491 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15492 $cat <<'EOSH' > Cppsym.know
15493 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15494 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15495 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15496 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15497 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15498 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15499 bull c cadmus clipper CMU COFF COMPILER_VERSION
15500 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15501 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15502 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15503 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15504 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15505 H3050R H3050RX hbullx20 hcx host_mips
15506 hp200 hp300 hp700 HP700 hp800 hp9000
15507 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15508 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15509 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15510 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15511 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15512 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15513 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15514 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15515 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15516 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15517 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15518 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15519 MATH_HAS_NO_SIDE_EFFECTS
15520 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15521 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15522 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15523 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15524 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15525 NetBSD news1500 news1700 news1800 news1900 news3700
15526 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15527 ns32016 ns32332 ns32k nsc32000
15528 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15529 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15530 pc532 pdp11 PGC PIC plexus PORTAR posix
15531 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15532 POSIX_C_SOURCE POSIX_SOURCE POWER
15533 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15534 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15535 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15536 sony sony_news sonyrisc sparc sparclite spectrum
15537 stardent stdc STDC_EXT stratos sun sun3 sun386
15538 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15539 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15540 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15541 sysV68 sysV88 Tek4132 Tek4300 titan
15542 TM3200 TM5400 TM5600
15543 tower tower32 tower32_200 tower32_600 tower32_700
15544 tower32_800 tower32_850 tss
15545 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15546 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15547 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15548 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15549 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15550 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15551 z8000
15552 EOSH
15553 # Maybe put other stuff here too.
15554 cat <<EOSH >>Cppsym.know
15555 $osname
15556 EOSH
15557 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15558 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15559 $cat Cppsym.know > Cppsym.c
15560 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15561 $rm -f Cppsym.a Cppsym.b Cppsym.c
15562 cat <<EOSH > Cppsym
15563 $startsh
15564 if $test \$# -gt 0; then
15565     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15566     if $test -s Cppsym.got; then
15567         $rm -f Cppsym.got
15568         exit 0
15569     fi
15570     $rm -f Cppsym.got
15571     exit 1
15572 else
15573     $tr " " "$trnl" | ./Cppsym.try
15574     exit 0
15575 fi
15576 EOSH
15577 chmod +x Cppsym
15578 $eunicefix Cppsym
15579 cat <<EOSH > Cppsym.try
15580 $startsh
15581 cat <<'EOCP' > try.c
15582 #include <stdio.h>
15583 int main() {
15584 EOCP
15585 $awk \\
15586 EOSH
15587 cat <<'EOSH' >> Cppsym.try
15588 'length($1) > 0 {
15589     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15590     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15591     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15592     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15593 }'       >> try.c
15594 echo 'return 0;}' >> try.c
15595 EOSH
15596 cat <<EOSH >> Cppsym.try
15597 ccflags="$ccflags"
15598 case "$osname-$gccversion" in
15599 irix-) ccflags="\$ccflags -woff 1178" ;;
15600 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15601 esac
15602 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15603 EOSH
15604 chmod +x Cppsym.try
15605 $eunicefix Cppsym.try
15606 ./Cppsym < Cppsym.know > Cppsym.true
15607 : now check the C compiler for additional symbols
15608 postprocess_cc_v=''
15609 case "$osname" in
15610 aix) postprocess_cc_v="|$tr , ' '" ;;
15611 esac
15612 $cat >ccsym <<EOS
15613 $startsh
15614 $cat >tmp.c <<EOF
15615 extern int foo;
15616 EOF
15617 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15618 do
15619         case "\$i" in
15620         -D*) echo "\$i" | $sed 's/^-D//';;
15621         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15622         esac
15623 done
15624 $rm -f try.c
15625 EOS
15626 postprocess_cc_v=''
15627 chmod +x ccsym
15628 $eunicefix ccsym
15629 ./ccsym > ccsym1.raw
15630 if $test -s ccsym1.raw; then
15631        $sort ccsym1.raw | $uniq >ccsym.raw
15632 else
15633        mv ccsym1.raw ccsym.raw
15634 fi
15635
15636 $awk '/\=/ { print $0; next }
15637         { print $0"=1" }' ccsym.raw >ccsym.list
15638 $awk '/\=/ { print $0; next }
15639         { print $0"=1" }' Cppsym.true >ccsym.true
15640 $comm -13 ccsym.true ccsym.list >ccsym.own
15641 $comm -12 ccsym.true ccsym.list >ccsym.com
15642 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15643 also=''
15644 if $test -z ccsym.raw; then
15645         echo "Your C compiler doesn't seem to define any symbols!" >&4
15646         echo " "
15647         echo "However, your C preprocessor defines the following symbols:"
15648         $cat Cppsym.true
15649         ccsymbols=''
15650         cppsymbols=`$cat Cppsym.true`
15651         cppsymbols=`echo $cppsymbols`
15652         cppccsymbols="$cppsymbols"
15653 else
15654         if $test -s ccsym.com; then
15655                 echo "Your C compiler and pre-processor define these symbols:"
15656                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15657                 also='also '
15658                 symbols='ones'
15659                 cppccsymbols=`$cat ccsym.com`
15660                 cppccsymbols=`echo $cppccsymbols`
15661                 $test "$silent" || sleep 1
15662         fi
15663         if $test -s ccsym.cpp; then
15664                 $test "$also" && echo " "
15665                 echo "Your C pre-processor ${also}defines the following symbols:"
15666                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15667                 also='further '
15668                 cppsymbols=`$cat ccsym.cpp`
15669                 cppsymbols=`echo $cppsymbols`
15670                 $test "$silent" || sleep 1
15671         fi
15672         if $test -s ccsym.own; then
15673                 $test "$also" && echo " "
15674                 echo "Your C compiler ${also}defines the following cpp symbols:"
15675                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15676                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15677                 ccsymbols=`$cat ccsym.own`
15678                 ccsymbols=`echo $ccsymbols`
15679                 $test "$silent" || sleep 1
15680         fi
15681 fi
15682 $rm -f ccsym* Cppsym.*
15683
15684 : see if this is a termio system
15685 val="$undef"
15686 val2="$undef"
15687 val3="$undef"
15688 if $test `./findhdr termios.h`; then
15689         set tcsetattr i_termios
15690         eval $inlibc
15691         val3="$i_termios"
15692 fi
15693 echo " "
15694 case "$val3" in
15695 "$define") echo "You have POSIX termios.h... good!" >&4;;
15696 *) if ./Cppsym pyr; then
15697                 case "`/bin/universe`" in
15698                 ucb) if $test `./findhdr sgtty.h`; then
15699                                 val2="$define"
15700                                 echo "<sgtty.h> found." >&4
15701                         else
15702                                 echo "System is pyramid with BSD universe."
15703                                 echo "<sgtty.h> not found--you could have problems." >&4
15704                         fi;;
15705                 *) if $test `./findhdr termio.h`; then
15706                                 val="$define"
15707                                 echo "<termio.h> found." >&4
15708                         else
15709                                 echo "System is pyramid with USG universe."
15710                                 echo "<termio.h> not found--you could have problems." >&4
15711                         fi;;
15712                 esac
15713         elif ./usg; then
15714                 if $test `./findhdr termio.h`; then
15715                         echo "<termio.h> found." >&4
15716                         val="$define"
15717                 elif $test `./findhdr sgtty.h`; then
15718                         echo "<sgtty.h> found." >&4
15719                         val2="$define"
15720                 else
15721 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15722                 fi
15723         else
15724                 if $test `./findhdr sgtty.h`; then
15725                         echo "<sgtty.h> found." >&4
15726                         val2="$define"
15727                 elif $test `./findhdr termio.h`; then
15728                         echo "<termio.h> found." >&4
15729                         val="$define"
15730                 else
15731 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15732                 fi
15733         fi;;
15734 esac
15735 set i_termio; eval $setvar
15736 val=$val2; set i_sgtty; eval $setvar
15737 val=$val3; set i_termios; eval $setvar
15738
15739 : see if this is a shadow.h system
15740 set shadow.h i_shadow
15741 eval $inhdr
15742
15743 : see if stddef is available
15744 set stddef.h i_stddef
15745 eval $inhdr
15746
15747 : see if this is a sunmath.h system
15748 set sunmath.h i_sunmath
15749 eval $inhdr
15750
15751 : see if sys/access.h is available
15752 set sys/access.h i_sysaccess
15753 eval $inhdr
15754
15755 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15756 set sys/filio.h i_sysfilio
15757 eval $inhdr
15758 echo " "
15759 if $test `./findhdr sys/ioctl.h`; then
15760         val="$define"
15761         echo '<sys/ioctl.h> found.' >&4
15762 else
15763         val="$undef"
15764         if $test $i_sysfilio = "$define"; then
15765             echo '<sys/ioctl.h> NOT found.' >&4
15766         else
15767                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15768                 $test $i_termio = "$define" && xxx="termio.h"
15769                 $test $i_termios = "$define" && xxx="termios.h"
15770 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15771         fi
15772 fi
15773 set i_sysioctl
15774 eval $setvar
15775
15776 : see if socket ioctl defs are in sys/sockio.h
15777 echo " "
15778 xxx=`./findhdr sys/sockio.h`
15779 if $test "$xxx"; then
15780         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15781                 val="$define"
15782                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15783         else
15784                 val="$undef"
15785                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15786         fi
15787 else
15788         val="$undef"
15789         $cat <<EOM
15790 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15791 EOM
15792 fi
15793 set i_syssockio
15794 eval $setvar
15795
15796
15797 : see if this is a syslog.h system
15798 set syslog.h i_syslog
15799 eval $inhdr
15800
15801
15802 : see if this is a sys/mode.h system
15803 set sys/mode.h i_sysmode
15804 eval $inhdr
15805
15806 : see if sys/resource.h has to be included
15807 set sys/resource.h i_sysresrc
15808 eval $inhdr
15809
15810 : see if sys/security.h is available
15811 set sys/security.h i_syssecrt
15812 eval $inhdr
15813
15814 : see if this is a sys/statvfs.h system
15815 set sys/statvfs.h i_sysstatvfs
15816 eval $inhdr
15817
15818 : see if this is a sys/un.h system
15819 set sys/un.h i_sysun
15820 eval $inhdr
15821
15822
15823 : see if this is a sys/utsname.h system
15824 set sys/utsname.h i_sysutsname
15825 eval $inhdr
15826
15827 : see if this is a syswait system
15828 set sys/wait.h i_syswait
15829 eval $inhdr
15830
15831 : see if this is a ustat.h system
15832 set ustat.h i_ustat
15833 eval $inhdr
15834
15835 : see if this is an utime system
15836 set utime.h i_utime
15837 eval $inhdr
15838
15839 : see if this is a values.h system
15840 set values.h i_values
15841 eval $inhdr
15842
15843 : see if this is a vfork system
15844 case "$d_vfork" in
15845 "$define")
15846         set vfork.h i_vfork
15847         eval $inhdr
15848         ;;
15849 *)
15850         i_vfork="$undef"
15851         ;;
15852 esac
15853
15854 : see if gdbm.h is available
15855 set gdbm.h t_gdbm
15856 eval $inhdr
15857 case "$t_gdbm" in
15858 $define)
15859         : see if gdbm_open exists
15860         set gdbm_open d_gdbm_open
15861         eval $inlibc
15862         case "$d_gdbm_open" in
15863         $undef)
15864                 t_gdbm="$undef"
15865                 echo "We won't be including <gdbm.h>"
15866                 ;;
15867         esac
15868         ;;
15869 esac
15870 val="$t_gdbm"
15871 set i_gdbm
15872 eval $setvar
15873
15874 echo " "
15875 echo "Looking for extensions..." >&4
15876 : If we are using the old config.sh, known_extensions may contain
15877 : old or inaccurate or duplicate values.
15878 known_extensions=''
15879 nonxs_extensions=''
15880 : We do not use find because it might not be available.
15881 : We do not just use MANIFEST because the user may have dropped
15882 : some additional extensions into the source tree and expect them
15883 : to be built.
15884
15885 : Function to recursively find available extensions, ignoring DynaLoader
15886 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15887 find_extensions='
15888     for xxx in *; do
15889        case "$xxx" in
15890            DynaLoader|dynaload) ;;
15891            *)
15892            if $test -f $xxx/$xxx.xs; then
15893                known_extensions="$known_extensions $1$xxx";
15894            elif $test -f $xxx/Makefile.PL; then
15895                nonxs_extensions="$nonxs_extensions $1$xxx";
15896            else
15897                if $test -d $xxx -a $# -lt 10; then
15898                    set $1$xxx/ $*;
15899                    cd $xxx;
15900                    eval $find_extensions;
15901                    cd ..;
15902                    shift;
15903                fi;
15904            fi
15905            ;;
15906        esac;
15907     done'
15908 tdir=`pwd`
15909 cd $rsrc/ext
15910 set X
15911 shift
15912 eval $find_extensions
15913 set X $nonxs_extensions
15914 shift
15915 nonxs_extensions="$*"
15916 set X $known_extensions
15917 shift
15918 known_extensions="$*"
15919 cd $tdir
15920
15921 : Now see which are supported on this system.
15922 avail_ext=''
15923 for xxx in $known_extensions ; do
15924         case "$xxx" in
15925         DB_File|db_file)
15926                 case "$i_db" in
15927                 $define) avail_ext="$avail_ext $xxx" ;;
15928                 esac
15929                 ;;
15930         GDBM_File|gdbm_fil)
15931                 case "$i_gdbm" in 
15932                 $define) avail_ext="$avail_ext $xxx" ;;
15933                 esac
15934                 ;;
15935         NDBM_File|ndbm_fil)
15936                 case "$i_ndbm" in
15937                 $define)
15938                     case "$osname-$use64bitint" in
15939                     hpux-define)
15940                         case "$libs" in
15941                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15942                         esac
15943                         ;;
15944                     *) avail_ext="$avail_ext $xxx" ;;
15945                     esac
15946                     ;;
15947                 esac
15948                 ;;
15949         ODBM_File|odbm_fil) 
15950                 case "${i_dbm}${i_rpcsvcdbm}" in
15951                 *"${define}"*)
15952                     case "$osname-$use64bitint" in
15953                     hpux-define)
15954                         case "$libs" in
15955                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15956                         esac
15957                         ;;
15958                     *) avail_ext="$avail_ext $xxx" ;;
15959                     esac
15960                     ;;
15961                 esac
15962                 ;;
15963         POSIX|posix)
15964                 case "$useposix" in
15965                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15966                 esac
15967                 ;;
15968         Opcode|opcode)
15969                 case "$useopcode" in
15970                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15971                 esac
15972                 ;;
15973         Socket|socket)
15974                 case "$d_socket" in 
15975                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15976                 esac
15977                 ;;
15978         Sys/Syslog|sys/syslog)
15979                 : XXX syslog requires socket
15980                 case "$d_socket" in 
15981                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15982                 esac
15983                 ;;
15984         Thread|thread)
15985                 case "$usethreads" in 
15986                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15987                 esac
15988                 ;;
15989         IPC/SysV|ipc/sysv)
15990                 : XXX Do we need a useipcsysv variable here
15991                 case "${d_msg}${d_sem}${d_shm}" in 
15992                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15993                 esac
15994                 ;;
15995         *)      avail_ext="$avail_ext $xxx"
15996                 ;;
15997         esac
15998 done
15999
16000 set X $avail_ext
16001 shift
16002 avail_ext="$*"
16003
16004 : Now see which nonxs extensions are supported on this system.
16005 : For now assume all are.
16006 nonxs_ext=''
16007 for xxx in $nonxs_extensions ; do
16008         case "$xxx" in
16009         *)      nonxs_ext="$nonxs_ext $xxx"
16010                 ;;
16011         esac
16012 done
16013
16014 set X $nonxs_ext
16015 shift
16016 nonxs_ext="$*"
16017
16018 case $usedl in
16019 $define)
16020         $cat <<EOM
16021 A number of extensions are supplied with $package.  You may choose to
16022 compile these extensions for dynamic loading (the default), compile
16023 them into the $package executable (static loading), or not include
16024 them at all.  Answer "none" to include no extensions.
16025 Note that DynaLoader is always built and need not be mentioned here.
16026
16027 EOM
16028         case "$dynamic_ext" in
16029         '') dflt="$avail_ext" ;;
16030         *)      dflt="$dynamic_ext"
16031                 # Perhaps we are reusing an old out-of-date config.sh.
16032                 case "$hint" in
16033                 previous)
16034                         if test X"$dynamic_ext" != X"$avail_ext"; then
16035                                 $cat <<EOM
16036 NOTICE:  Your previous config.sh list may be incorrect. 
16037 The extensions now available to you are 
16038         ${avail_ext}
16039 but the default list from your previous config.sh is
16040         ${dynamic_ext} 
16041
16042 EOM
16043                         fi
16044                         ;;
16045                 esac
16046                 ;;
16047         esac
16048         case "$dflt" in
16049         '')     dflt=none;;
16050         esac
16051         rp="What extensions do you wish to load dynamically?"
16052         . ./myread
16053         case "$ans" in
16054         none) dynamic_ext=' ' ;;
16055         *) dynamic_ext="$ans" ;;
16056         esac
16057
16058         case "$static_ext" in
16059         '')
16060                 : Exclude those already listed in dynamic linking
16061                 dflt=''
16062                 for xxx in $avail_ext; do
16063                         case " $dynamic_ext " in
16064                         *" $xxx "*) ;;
16065                         *) dflt="$dflt $xxx" ;;
16066                         esac
16067                 done
16068                 set X $dflt
16069                 shift
16070                 dflt="$*"
16071                 ;;
16072         *)  dflt="$static_ext" 
16073                 ;;
16074         esac
16075
16076         case "$dflt" in
16077         '')     dflt=none;;
16078         esac
16079         rp="What extensions do you wish to load statically?"
16080         . ./myread
16081         case "$ans" in
16082         none) static_ext=' ' ;;
16083         *) static_ext="$ans" ;;
16084         esac
16085         ;;
16086 *)
16087         $cat <<EOM
16088 A number of extensions are supplied with $package.  Answer "none" 
16089 to include no extensions. 
16090 Note that DynaLoader is always built and need not be mentioned here.
16091
16092 EOM
16093         case "$static_ext" in
16094         '') dflt="$avail_ext" ;;
16095         *)      dflt="$static_ext"
16096                 # Perhaps we are reusing an old out-of-date config.sh.
16097                 case "$hint" in
16098                 previous)
16099                         if test X"$static_ext" != X"$avail_ext"; then
16100                                 $cat <<EOM
16101 NOTICE:  Your previous config.sh list may be incorrect. 
16102 The extensions now available to you are 
16103         ${avail_ext}
16104 but the default list from your previous config.sh is
16105         ${static_ext} 
16106
16107 EOM
16108                         fi
16109                         ;;
16110                 esac
16111                 ;;
16112         esac
16113         : Exclude those that are not xs extensions
16114         case "$dflt" in
16115         '')     dflt=none;;
16116         esac
16117         rp="What extensions do you wish to include?"
16118         . ./myread
16119         case "$ans" in
16120         none) static_ext=' ' ;;
16121         *) static_ext="$ans" ;;
16122         esac
16123         ;;
16124 esac
16125
16126 set X $dynamic_ext $static_ext $nonxs_ext
16127 shift
16128 extensions="$*"
16129
16130 : Remove libraries needed only for extensions
16131 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16132 : The exception is SunOS 4.x, which needs them.
16133 case "${osname}X${osvers}" in
16134 sunos*X4*)
16135     perllibs="$libs"
16136     ;;
16137 *) case "$usedl" in
16138     $define|true|[yY]*)
16139             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16140             shift
16141             perllibs="$*"
16142             ;;
16143     *)  perllibs="$libs"
16144             ;;
16145     esac
16146     ;;
16147 esac
16148
16149 : Remove build directory name from cppstdin so it can be used from
16150 : either the present location or the final installed location.
16151 echo " "
16152 : Get out of the UU directory to get correct path name.
16153 cd ..
16154 case "$cppstdin" in
16155 `pwd`/cppstdin)
16156         echo "Stripping down cppstdin path name"
16157         cppstdin=cppstdin
16158         ;;
16159 esac
16160 cd UU
16161
16162 : end of configuration questions
16163 echo " "
16164 echo "End of configuration questions."
16165 echo " "
16166
16167 : back to where it started
16168 if test -d ../UU; then
16169         cd ..
16170 fi
16171
16172 : configuration may be patched via a 'config.over' file
16173 if $test -f config.over; then
16174         echo " "
16175         dflt=y
16176         rp='I see a config.over file.  Do you wish to load it?'
16177         . UU/myread
16178         case "$ans" in
16179         n*) echo "OK, I'll ignore it.";;
16180         *)      . ./config.over
16181                 echo "Configuration override changes have been loaded."
16182                 ;;
16183         esac
16184 fi
16185
16186 : in case they want portability, strip down executable paths
16187 case "$d_portable" in
16188 "$define")
16189         echo " "
16190         echo "Stripping down executable paths..." >&4
16191         for file in $loclist $trylist; do
16192                 eval temp=\$$file
16193                 eval $file=`basename $temp`
16194         done
16195         ;;
16196 esac
16197
16198 : create config.sh file
16199 echo " "
16200 echo "Creating config.sh..." >&4
16201 $spitshell <<EOT >config.sh
16202 $startsh
16203 #
16204 # This file was produced by running the Configure script. It holds all the
16205 # definitions figured out by Configure. Should you modify one of these values,
16206 # do not forget to propagate your changes by running "Configure -der". You may
16207 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16208 #
16209
16210 # Package name      : $package
16211 # Source directory  : $src
16212 # Configuration time: $cf_time
16213 # Configured by     : $cf_by
16214 # Target system     : $myuname
16215
16216 Author='$Author'
16217 Date='$Date'
16218 Header='$Header'
16219 Id='$Id'
16220 Locker='$Locker'
16221 Log='$Log'
16222 Mcc='$Mcc'
16223 RCSfile='$RCSfile'
16224 Revision='$Revision'
16225 Source='$Source'
16226 State='$State'
16227 _a='$_a'
16228 _exe='$_exe'
16229 _o='$_o'
16230 afs='$afs'
16231 afsroot='$afsroot'
16232 alignbytes='$alignbytes'
16233 ansi2knr='$ansi2knr'
16234 aphostname='$aphostname'
16235 api_revision='$api_revision'
16236 api_subversion='$api_subversion'
16237 api_version='$api_version'
16238 api_versionstring='$api_versionstring'
16239 ar='$ar'
16240 archlib='$archlib'
16241 archlibexp='$archlibexp'
16242 archname64='$archname64'
16243 archname='$archname'
16244 archobjs='$archobjs'
16245 awk='$awk'
16246 baserev='$baserev'
16247 bash='$bash'
16248 bin='$bin'
16249 bincompat5005='$bincompat5005'
16250 binexp='$binexp'
16251 bison='$bison'
16252 byacc='$byacc'
16253 byteorder='$byteorder'
16254 c='$c'
16255 castflags='$castflags'
16256 cat='$cat'
16257 cc='$cc'
16258 cccdlflags='$cccdlflags'
16259 ccdlflags='$ccdlflags'
16260 ccflags='$ccflags'
16261 ccflags_uselargefiles='$ccflags_uselargefiles'
16262 ccname='$ccname'
16263 ccsymbols='$ccsymbols'
16264 ccversion='$ccversion'
16265 cf_by='$cf_by'
16266 cf_email='$cf_email'
16267 cf_time='$cf_time'
16268 charsize='$charsize'
16269 chgrp='$chgrp'
16270 chmod='$chmod'
16271 chown='$chown'
16272 clocktype='$clocktype'
16273 comm='$comm'
16274 compress='$compress'
16275 contains='$contains'
16276 cp='$cp'
16277 cpio='$cpio'
16278 cpp='$cpp'
16279 cpp_stuff='$cpp_stuff'
16280 cppccsymbols='$cppccsymbols'
16281 cppflags='$cppflags'
16282 cpplast='$cpplast'
16283 cppminus='$cppminus'
16284 cpprun='$cpprun'
16285 cppstdin='$cppstdin'
16286 cppsymbols='$cppsymbols'
16287 crosscompile='$crosscompile'
16288 cryptlib='$cryptlib'
16289 csh='$csh'
16290 d_Gconvert='$d_Gconvert'
16291 d_PRIEUldbl='$d_PRIEUldbl'
16292 d_PRIFUldbl='$d_PRIFUldbl'
16293 d_PRIGUldbl='$d_PRIGUldbl'
16294 d_PRIXU64='$d_PRIXU64'
16295 d_PRId64='$d_PRId64'
16296 d_PRIeldbl='$d_PRIeldbl'
16297 d_PRIfldbl='$d_PRIfldbl'
16298 d_PRIgldbl='$d_PRIgldbl'
16299 d_PRIi64='$d_PRIi64'
16300 d_PRIo64='$d_PRIo64'
16301 d_PRIu64='$d_PRIu64'
16302 d_PRIx64='$d_PRIx64'
16303 d_SCNfldbl='$d_SCNfldbl'
16304 d__fwalk='$d__fwalk'
16305 d_access='$d_access'
16306 d_accessx='$d_accessx'
16307 d_alarm='$d_alarm'
16308 d_archlib='$d_archlib'
16309 d_atolf='$d_atolf'
16310 d_atoll='$d_atoll'
16311 d_attribut='$d_attribut'
16312 d_bcmp='$d_bcmp'
16313 d_bcopy='$d_bcopy'
16314 d_bincompat5005='$d_bincompat5005'
16315 d_bsd='$d_bsd'
16316 d_bsdgetpgrp='$d_bsdgetpgrp'
16317 d_bsdsetpgrp='$d_bsdsetpgrp'
16318 d_bzero='$d_bzero'
16319 d_casti32='$d_casti32'
16320 d_castneg='$d_castneg'
16321 d_charvspr='$d_charvspr'
16322 d_chown='$d_chown'
16323 d_chroot='$d_chroot'
16324 d_chsize='$d_chsize'
16325 d_closedir='$d_closedir'
16326 d_cmsghdr_s='$d_cmsghdr_s'
16327 d_const='$d_const'
16328 d_crypt='$d_crypt'
16329 d_csh='$d_csh'
16330 d_cuserid='$d_cuserid'
16331 d_dbl_dig='$d_dbl_dig'
16332 d_dbminitproto='$d_dbminitproto'
16333 d_difftime='$d_difftime'
16334 d_dirnamlen='$d_dirnamlen'
16335 d_dlerror='$d_dlerror'
16336 d_dlopen='$d_dlopen'
16337 d_dlsymun='$d_dlsymun'
16338 d_dosuid='$d_dosuid'
16339 d_drand48proto='$d_drand48proto'
16340 d_dup2='$d_dup2'
16341 d_eaccess='$d_eaccess'
16342 d_endgrent='$d_endgrent'
16343 d_endhent='$d_endhent'
16344 d_endnent='$d_endnent'
16345 d_endpent='$d_endpent'
16346 d_endpwent='$d_endpwent'
16347 d_endsent='$d_endsent'
16348 d_eofnblk='$d_eofnblk'
16349 d_eunice='$d_eunice'
16350 d_fchmod='$d_fchmod'
16351 d_fchown='$d_fchown'
16352 d_fcntl='$d_fcntl'
16353 d_fcntl_can_lock='$d_fcntl_can_lock'
16354 d_fd_macros='$d_fd_macros'
16355 d_fd_set='$d_fd_set'
16356 d_fds_bits='$d_fds_bits'
16357 d_fgetpos='$d_fgetpos'
16358 d_flexfnam='$d_flexfnam'
16359 d_flock='$d_flock'
16360 d_flockproto='$d_flockproto'
16361 d_fork='$d_fork'
16362 d_fpathconf='$d_fpathconf'
16363 d_fpos64_t='$d_fpos64_t'
16364 d_frexpl='$d_frexpl'
16365 d_fs_data_s='$d_fs_data_s'
16366 d_fseeko='$d_fseeko'
16367 d_fsetpos='$d_fsetpos'
16368 d_fstatfs='$d_fstatfs'
16369 d_fstatvfs='$d_fstatvfs'
16370 d_fsync='$d_fsync'
16371 d_ftello='$d_ftello'
16372 d_ftime='$d_ftime'
16373 d_getcwd='$d_getcwd'
16374 d_getespwnam='$d_getespwnam'
16375 d_getfsstat='$d_getfsstat'
16376 d_getgrent='$d_getgrent'
16377 d_getgrps='$d_getgrps'
16378 d_gethbyaddr='$d_gethbyaddr'
16379 d_gethbyname='$d_gethbyname'
16380 d_gethent='$d_gethent'
16381 d_gethname='$d_gethname'
16382 d_gethostprotos='$d_gethostprotos'
16383 d_getitimer='$d_getitimer'
16384 d_getlogin='$d_getlogin'
16385 d_getmnt='$d_getmnt'
16386 d_getmntent='$d_getmntent'
16387 d_getnbyaddr='$d_getnbyaddr'
16388 d_getnbyname='$d_getnbyname'
16389 d_getnent='$d_getnent'
16390 d_getnetprotos='$d_getnetprotos'
16391 d_getpagsz='$d_getpagsz'
16392 d_getpbyname='$d_getpbyname'
16393 d_getpbynumber='$d_getpbynumber'
16394 d_getpent='$d_getpent'
16395 d_getpgid='$d_getpgid'
16396 d_getpgrp2='$d_getpgrp2'
16397 d_getpgrp='$d_getpgrp'
16398 d_getppid='$d_getppid'
16399 d_getprior='$d_getprior'
16400 d_getprotoprotos='$d_getprotoprotos'
16401 d_getprpwnam='$d_getprpwnam'
16402 d_getpwent='$d_getpwent'
16403 d_getsbyname='$d_getsbyname'
16404 d_getsbyport='$d_getsbyport'
16405 d_getsent='$d_getsent'
16406 d_getservprotos='$d_getservprotos'
16407 d_getspnam='$d_getspnam'
16408 d_gettimeod='$d_gettimeod'
16409 d_gnulibc='$d_gnulibc'
16410 d_grpasswd='$d_grpasswd'
16411 d_hasmntopt='$d_hasmntopt'
16412 d_htonl='$d_htonl'
16413 d_iconv='$d_iconv'
16414 d_index='$d_index'
16415 d_inetaton='$d_inetaton'
16416 d_int64_t='$d_int64_t'
16417 d_isascii='$d_isascii'
16418 d_isnan='$d_isnan'
16419 d_isnanl='$d_isnanl'
16420 d_killpg='$d_killpg'
16421 d_lchown='$d_lchown'
16422 d_ldbl_dig='$d_ldbl_dig'
16423 d_link='$d_link'
16424 d_locconv='$d_locconv'
16425 d_lockf='$d_lockf'
16426 d_longdbl='$d_longdbl'
16427 d_longlong='$d_longlong'
16428 d_lseekproto='$d_lseekproto'
16429 d_lstat='$d_lstat'
16430 d_madvise='$d_madvise'
16431 d_mblen='$d_mblen'
16432 d_mbstowcs='$d_mbstowcs'
16433 d_mbtowc='$d_mbtowc'
16434 d_memchr='$d_memchr'
16435 d_memcmp='$d_memcmp'
16436 d_memcpy='$d_memcpy'
16437 d_memmove='$d_memmove'
16438 d_memset='$d_memset'
16439 d_mkdir='$d_mkdir'
16440 d_mkdtemp='$d_mkdtemp'
16441 d_mkfifo='$d_mkfifo'
16442 d_mkstemp='$d_mkstemp'
16443 d_mkstemps='$d_mkstemps'
16444 d_mktime='$d_mktime'
16445 d_mmap='$d_mmap'
16446 d_modfl='$d_modfl'
16447 d_mprotect='$d_mprotect'
16448 d_msg='$d_msg'
16449 d_msg_ctrunc='$d_msg_ctrunc'
16450 d_msg_dontroute='$d_msg_dontroute'
16451 d_msg_oob='$d_msg_oob'
16452 d_msg_peek='$d_msg_peek'
16453 d_msg_proxy='$d_msg_proxy'
16454 d_msgctl='$d_msgctl'
16455 d_msgget='$d_msgget'
16456 d_msghdr_s='$d_msghdr_s'
16457 d_msgrcv='$d_msgrcv'
16458 d_msgsnd='$d_msgsnd'
16459 d_msync='$d_msync'
16460 d_munmap='$d_munmap'
16461 d_mymalloc='$d_mymalloc'
16462 d_nice='$d_nice'
16463 d_nv_preserves_uv='$d_nv_preserves_uv'
16464 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16465 d_off64_t='$d_off64_t'
16466 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16467 d_oldpthreads='$d_oldpthreads'
16468 d_oldsock='$d_oldsock'
16469 d_open3='$d_open3'
16470 d_pathconf='$d_pathconf'
16471 d_pause='$d_pause'
16472 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16473 d_phostname='$d_phostname'
16474 d_pipe='$d_pipe'
16475 d_poll='$d_poll'
16476 d_portable='$d_portable'
16477 d_pthread_yield='$d_pthread_yield'
16478 d_pwage='$d_pwage'
16479 d_pwchange='$d_pwchange'
16480 d_pwclass='$d_pwclass'
16481 d_pwcomment='$d_pwcomment'
16482 d_pwexpire='$d_pwexpire'
16483 d_pwgecos='$d_pwgecos'
16484 d_pwpasswd='$d_pwpasswd'
16485 d_pwquota='$d_pwquota'
16486 d_qgcvt='$d_qgcvt'
16487 d_quad='$d_quad'
16488 d_readdir='$d_readdir'
16489 d_readlink='$d_readlink'
16490 d_readv='$d_readv'
16491 d_realpath='$d_realpath'
16492 d_recvmsg='$d_recvmsg'
16493 d_rename='$d_rename'
16494 d_rewinddir='$d_rewinddir'
16495 d_rmdir='$d_rmdir'
16496 d_safebcpy='$d_safebcpy'
16497 d_safemcpy='$d_safemcpy'
16498 d_sanemcmp='$d_sanemcmp'
16499 d_sbrkproto='$d_sbrkproto'
16500 d_sched_yield='$d_sched_yield'
16501 d_scm_rights='$d_scm_rights'
16502 d_seekdir='$d_seekdir'
16503 d_select='$d_select'
16504 d_sem='$d_sem'
16505 d_semctl='$d_semctl'
16506 d_semctl_semid_ds='$d_semctl_semid_ds'
16507 d_semctl_semun='$d_semctl_semun'
16508 d_semget='$d_semget'
16509 d_semop='$d_semop'
16510 d_sendmsg='$d_sendmsg'
16511 d_setegid='$d_setegid'
16512 d_seteuid='$d_seteuid'
16513 d_setgrent='$d_setgrent'
16514 d_setgrps='$d_setgrps'
16515 d_sethent='$d_sethent'
16516 d_setitimer='$d_setitimer'
16517 d_setlinebuf='$d_setlinebuf'
16518 d_setlocale='$d_setlocale'
16519 d_setnent='$d_setnent'
16520 d_setpent='$d_setpent'
16521 d_setpgid='$d_setpgid'
16522 d_setpgrp2='$d_setpgrp2'
16523 d_setpgrp='$d_setpgrp'
16524 d_setprior='$d_setprior'
16525 d_setproctitle='$d_setproctitle'
16526 d_setpwent='$d_setpwent'
16527 d_setregid='$d_setregid'
16528 d_setresgid='$d_setresgid'
16529 d_setresuid='$d_setresuid'
16530 d_setreuid='$d_setreuid'
16531 d_setrgid='$d_setrgid'
16532 d_setruid='$d_setruid'
16533 d_setsent='$d_setsent'
16534 d_setsid='$d_setsid'
16535 d_setvbuf='$d_setvbuf'
16536 d_sfio='$d_sfio'
16537 d_shm='$d_shm'
16538 d_shmat='$d_shmat'
16539 d_shmatprototype='$d_shmatprototype'
16540 d_shmctl='$d_shmctl'
16541 d_shmdt='$d_shmdt'
16542 d_shmget='$d_shmget'
16543 d_sigaction='$d_sigaction'
16544 d_sigprocmask='$d_sigprocmask'
16545 d_sigsetjmp='$d_sigsetjmp'
16546 d_sockatmark='$d_sockatmark'
16547 d_sockatmarkproto='$d_sockatmarkproto'
16548 d_socket='$d_socket'
16549 d_socklen_t='$d_socklen_t'
16550 d_sockpair='$d_sockpair'
16551 d_socks5_init='$d_socks5_init'
16552 d_sqrtl='$d_sqrtl'
16553 d_sresgproto='$d_sresgproto'
16554 d_sresuproto='$d_sresuproto'
16555 d_statblks='$d_statblks'
16556 d_statfs_f_flags='$d_statfs_f_flags'
16557 d_statfs_s='$d_statfs_s'
16558 d_statvfs='$d_statvfs'
16559 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16560 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16561 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16562 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16563 d_stdio_stream_array='$d_stdio_stream_array'
16564 d_stdiobase='$d_stdiobase'
16565 d_stdstdio='$d_stdstdio'
16566 d_strchr='$d_strchr'
16567 d_strcoll='$d_strcoll'
16568 d_strctcpy='$d_strctcpy'
16569 d_strerrm='$d_strerrm'
16570 d_strerror='$d_strerror'
16571 d_strftime='$d_strftime'
16572 d_strtod='$d_strtod'
16573 d_strtol='$d_strtol'
16574 d_strtold='$d_strtold'
16575 d_strtoll='$d_strtoll'
16576 d_strtoq='$d_strtoq'
16577 d_strtoul='$d_strtoul'
16578 d_strtoull='$d_strtoull'
16579 d_strtouq='$d_strtouq'
16580 d_strxfrm='$d_strxfrm'
16581 d_suidsafe='$d_suidsafe'
16582 d_symlink='$d_symlink'
16583 d_syscall='$d_syscall'
16584 d_syscallproto='$d_syscallproto'
16585 d_sysconf='$d_sysconf'
16586 d_sysernlst='$d_sysernlst'
16587 d_syserrlst='$d_syserrlst'
16588 d_system='$d_system'
16589 d_tcgetpgrp='$d_tcgetpgrp'
16590 d_tcsetpgrp='$d_tcsetpgrp'
16591 d_telldir='$d_telldir'
16592 d_telldirproto='$d_telldirproto'
16593 d_time='$d_time'
16594 d_times='$d_times'
16595 d_truncate='$d_truncate'
16596 d_tzname='$d_tzname'
16597 d_u32align='$d_u32align'
16598 d_ualarm='$d_ualarm'
16599 d_umask='$d_umask'
16600 d_uname='$d_uname'
16601 d_union_semun='$d_union_semun'
16602 d_usleep='$d_usleep'
16603 d_usleepproto='$d_usleepproto'
16604 d_ustat='$d_ustat'
16605 d_vendorarch='$d_vendorarch'
16606 d_vendorbin='$d_vendorbin'
16607 d_vendorlib='$d_vendorlib'
16608 d_vfork='$d_vfork'
16609 d_void_closedir='$d_void_closedir'
16610 d_voidsig='$d_voidsig'
16611 d_voidtty='$d_voidtty'
16612 d_volatile='$d_volatile'
16613 d_vprintf='$d_vprintf'
16614 d_wait4='$d_wait4'
16615 d_waitpid='$d_waitpid'
16616 d_wcstombs='$d_wcstombs'
16617 d_wctomb='$d_wctomb'
16618 d_writev='$d_writev'
16619 d_xenix='$d_xenix'
16620 date='$date'
16621 db_hashtype='$db_hashtype'
16622 db_prefixtype='$db_prefixtype'
16623 db_version_major='$db_version_major'
16624 db_version_minor='$db_version_minor'
16625 db_version_patch='$db_version_patch'
16626 defvoidused='$defvoidused'
16627 direntrytype='$direntrytype'
16628 dlext='$dlext'
16629 dlsrc='$dlsrc'
16630 doublesize='$doublesize'
16631 drand01='$drand01'
16632 dynamic_ext='$dynamic_ext'
16633 eagain='$eagain'
16634 ebcdic='$ebcdic'
16635 echo='$echo'
16636 egrep='$egrep'
16637 emacs='$emacs'
16638 eunicefix='$eunicefix'
16639 exe_ext='$exe_ext'
16640 expr='$expr'
16641 extensions='$extensions'
16642 fflushNULL='$fflushNULL'
16643 fflushall='$fflushall'
16644 find='$find'
16645 firstmakefile='$firstmakefile'
16646 flex='$flex'
16647 fpossize='$fpossize'
16648 fpostype='$fpostype'
16649 freetype='$freetype'
16650 full_ar='$full_ar'
16651 full_csh='$full_csh'
16652 full_sed='$full_sed'
16653 gccosandvers='$gccosandvers'
16654 gccversion='$gccversion'
16655 gidformat='$gidformat'
16656 gidsign='$gidsign'
16657 gidsize='$gidsize'
16658 gidtype='$gidtype'
16659 glibpth='$glibpth'
16660 grep='$grep'
16661 groupcat='$groupcat'
16662 groupstype='$groupstype'
16663 gzip='$gzip'
16664 h_fcntl='$h_fcntl'
16665 h_sysfile='$h_sysfile'
16666 hint='$hint'
16667 hostcat='$hostcat'
16668 i16size='$i16size'
16669 i16type='$i16type'
16670 i32size='$i32size'
16671 i32type='$i32type'
16672 i64size='$i64size'
16673 i64type='$i64type'
16674 i8size='$i8size'
16675 i8type='$i8type'
16676 i_arpainet='$i_arpainet'
16677 i_bsdioctl='$i_bsdioctl'
16678 i_db='$i_db'
16679 i_dbm='$i_dbm'
16680 i_dirent='$i_dirent'
16681 i_dld='$i_dld'
16682 i_dlfcn='$i_dlfcn'
16683 i_fcntl='$i_fcntl'
16684 i_float='$i_float'
16685 i_gdbm='$i_gdbm'
16686 i_grp='$i_grp'
16687 i_iconv='$i_iconv'
16688 i_ieeefp='$i_ieeefp'
16689 i_inttypes='$i_inttypes'
16690 i_libutil='$i_libutil'
16691 i_limits='$i_limits'
16692 i_locale='$i_locale'
16693 i_machcthr='$i_machcthr'
16694 i_malloc='$i_malloc'
16695 i_math='$i_math'
16696 i_memory='$i_memory'
16697 i_mntent='$i_mntent'
16698 i_ndbm='$i_ndbm'
16699 i_netdb='$i_netdb'
16700 i_neterrno='$i_neterrno'
16701 i_netinettcp='$i_netinettcp'
16702 i_niin='$i_niin'
16703 i_poll='$i_poll'
16704 i_prot='$i_prot'
16705 i_pthread='$i_pthread'
16706 i_pwd='$i_pwd'
16707 i_rpcsvcdbm='$i_rpcsvcdbm'
16708 i_sfio='$i_sfio'
16709 i_sgtty='$i_sgtty'
16710 i_shadow='$i_shadow'
16711 i_socks='$i_socks'
16712 i_stdarg='$i_stdarg'
16713 i_stddef='$i_stddef'
16714 i_stdlib='$i_stdlib'
16715 i_string='$i_string'
16716 i_sunmath='$i_sunmath'
16717 i_sysaccess='$i_sysaccess'
16718 i_sysdir='$i_sysdir'
16719 i_sysfile='$i_sysfile'
16720 i_sysfilio='$i_sysfilio'
16721 i_sysin='$i_sysin'
16722 i_sysioctl='$i_sysioctl'
16723 i_syslog='$i_syslog'
16724 i_sysmman='$i_sysmman'
16725 i_sysmode='$i_sysmode'
16726 i_sysmount='$i_sysmount'
16727 i_sysndir='$i_sysndir'
16728 i_sysparam='$i_sysparam'
16729 i_sysresrc='$i_sysresrc'
16730 i_syssecrt='$i_syssecrt'
16731 i_sysselct='$i_sysselct'
16732 i_syssockio='$i_syssockio'
16733 i_sysstat='$i_sysstat'
16734 i_sysstatfs='$i_sysstatfs'
16735 i_sysstatvfs='$i_sysstatvfs'
16736 i_systime='$i_systime'
16737 i_systimek='$i_systimek'
16738 i_systimes='$i_systimes'
16739 i_systypes='$i_systypes'
16740 i_sysuio='$i_sysuio'
16741 i_sysun='$i_sysun'
16742 i_sysutsname='$i_sysutsname'
16743 i_sysvfs='$i_sysvfs'
16744 i_syswait='$i_syswait'
16745 i_termio='$i_termio'
16746 i_termios='$i_termios'
16747 i_time='$i_time'
16748 i_unistd='$i_unistd'
16749 i_ustat='$i_ustat'
16750 i_utime='$i_utime'
16751 i_values='$i_values'
16752 i_varargs='$i_varargs'
16753 i_varhdr='$i_varhdr'
16754 i_vfork='$i_vfork'
16755 ignore_versioned_solibs='$ignore_versioned_solibs'
16756 inc_version_list='$inc_version_list'
16757 inc_version_list_init='$inc_version_list_init'
16758 incpath='$incpath'
16759 inews='$inews'
16760 installarchlib='$installarchlib'
16761 installbin='$installbin'
16762 installman1dir='$installman1dir'
16763 installman3dir='$installman3dir'
16764 installprefix='$installprefix'
16765 installprefixexp='$installprefixexp'
16766 installprivlib='$installprivlib'
16767 installscript='$installscript'
16768 installsitearch='$installsitearch'
16769 installsitebin='$installsitebin'
16770 installsitelib='$installsitelib'
16771 installstyle='$installstyle'
16772 installusrbinperl='$installusrbinperl'
16773 installvendorarch='$installvendorarch'
16774 installvendorbin='$installvendorbin'
16775 installvendorlib='$installvendorlib'
16776 intsize='$intsize'
16777 issymlink='$issymlink'
16778 ivdformat='$ivdformat'
16779 ivsize='$ivsize'
16780 ivtype='$ivtype'
16781 known_extensions='$known_extensions'
16782 ksh='$ksh'
16783 ld='$ld'
16784 lddlflags='$lddlflags'
16785 ldflags='$ldflags'
16786 ldflags_uselargefiles='$ldflags_uselargefiles'
16787 ldlibpthname='$ldlibpthname'
16788 less='$less'
16789 lib_ext='$lib_ext'
16790 libc='$libc'
16791 libperl='$libperl'
16792 libpth='$libpth'
16793 libs='$libs'
16794 libsdirs='$libsdirs'
16795 libsfiles='$libsfiles'
16796 libsfound='$libsfound'
16797 libspath='$libspath'
16798 libswanted='$libswanted'
16799 libswanted_uselargefiles='$libswanted_uselargefiles'
16800 line='$line'
16801 lint='$lint'
16802 lkflags='$lkflags'
16803 ln='$ln'
16804 lns='$lns'
16805 locincpth='$locincpth'
16806 loclibpth='$loclibpth'
16807 longdblsize='$longdblsize'
16808 longlongsize='$longlongsize'
16809 longsize='$longsize'
16810 lp='$lp'
16811 lpr='$lpr'
16812 ls='$ls'
16813 lseeksize='$lseeksize'
16814 lseektype='$lseektype'
16815 mail='$mail'
16816 mailx='$mailx'
16817 make='$make'
16818 make_set_make='$make_set_make'
16819 mallocobj='$mallocobj'
16820 mallocsrc='$mallocsrc'
16821 malloctype='$malloctype'
16822 man1dir='$man1dir'
16823 man1direxp='$man1direxp'
16824 man1ext='$man1ext'
16825 man3dir='$man3dir'
16826 man3direxp='$man3direxp'
16827 man3ext='$man3ext'
16828 mips_type='$mips_type'
16829 mkdir='$mkdir'
16830 mmaptype='$mmaptype'
16831 modetype='$modetype'
16832 more='$more'
16833 multiarch='$multiarch'
16834 mv='$mv'
16835 myarchname='$myarchname'
16836 mydomain='$mydomain'
16837 myhostname='$myhostname'
16838 myuname='$myuname'
16839 n='$n'
16840 need_va_copy='$need_va_copy'
16841 netdb_hlen_type='$netdb_hlen_type'
16842 netdb_host_type='$netdb_host_type'
16843 netdb_name_type='$netdb_name_type'
16844 netdb_net_type='$netdb_net_type'
16845 nm='$nm'
16846 nm_opt='$nm_opt'
16847 nm_so_opt='$nm_so_opt'
16848 nonxs_ext='$nonxs_ext'
16849 nroff='$nroff'
16850 nvEUformat='$nvEUformat'
16851 nvFUformat='$nvFUformat'
16852 nvGUformat='$nvGUformat'
16853 nveformat='$nveformat'
16854 nvfformat='$nvfformat'
16855 nvgformat='$nvgformat'
16856 nvsize='$nvsize'
16857 nvtype='$nvtype'
16858 o_nonblock='$o_nonblock'
16859 obj_ext='$obj_ext'
16860 old_pthread_create_joinable='$old_pthread_create_joinable'
16861 optimize='$optimize'
16862 orderlib='$orderlib'
16863 osname='$osname'
16864 osvers='$osvers'
16865 otherlibdirs='$otherlibdirs'
16866 package='$package'
16867 pager='$pager'
16868 passcat='$passcat'
16869 patchlevel='$patchlevel'
16870 path_sep='$path_sep'
16871 perl5='$perl5'
16872 perl='$perl'
16873 perl_patchlevel='$perl_patchlevel'
16874 perladmin='$perladmin'
16875 perllibs='$perllibs'
16876 perlpath='$perlpath'
16877 pg='$pg'
16878 phostname='$phostname'
16879 pidtype='$pidtype'
16880 plibpth='$plibpth'
16881 pm_apiversion='$pm_apiversion'
16882 pmake='$pmake'
16883 pr='$pr'
16884 prefix='$prefix'
16885 prefixexp='$prefixexp'
16886 privlib='$privlib'
16887 privlibexp='$privlibexp'
16888 prototype='$prototype'
16889 ptrsize='$ptrsize'
16890 quadkind='$quadkind'
16891 quadtype='$quadtype'
16892 randbits='$randbits'
16893 randfunc='$randfunc'
16894 randseedtype='$randseedtype'
16895 ranlib='$ranlib'
16896 rd_nodata='$rd_nodata'
16897 revision='$revision'
16898 rm='$rm'
16899 rmail='$rmail'
16900 runnm='$runnm'
16901 sPRIEUldbl='$sPRIEUldbl'
16902 sPRIFUldbl='$sPRIFUldbl'
16903 sPRIGUldbl='$sPRIGUldbl'
16904 sPRIXU64='$sPRIXU64'
16905 sPRId64='$sPRId64'
16906 sPRIeldbl='$sPRIeldbl'
16907 sPRIfldbl='$sPRIfldbl'
16908 sPRIgldbl='$sPRIgldbl'
16909 sPRIi64='$sPRIi64'
16910 sPRIo64='$sPRIo64'
16911 sPRIu64='$sPRIu64'
16912 sPRIx64='$sPRIx64'
16913 sSCNfldbl='$sSCNfldbl'
16914 sched_yield='$sched_yield'
16915 scriptdir='$scriptdir'
16916 scriptdirexp='$scriptdirexp'
16917 sed='$sed'
16918 seedfunc='$seedfunc'
16919 selectminbits='$selectminbits'
16920 selecttype='$selecttype'
16921 sendmail='$sendmail'
16922 sh='$sh'
16923 shar='$shar'
16924 sharpbang='$sharpbang'
16925 shmattype='$shmattype'
16926 shortsize='$shortsize'
16927 shrpenv='$shrpenv'
16928 shsharp='$shsharp'
16929 sig_count='$sig_count'
16930 sig_name='$sig_name'
16931 sig_name_init='$sig_name_init'
16932 sig_num='$sig_num'
16933 sig_num_init='$sig_num_init'
16934 sig_size='$sig_size'
16935 signal_t='$signal_t'
16936 sitearch='$sitearch'
16937 sitearchexp='$sitearchexp'
16938 sitebin='$sitebin'
16939 sitebinexp='$sitebinexp'
16940 sitelib='$sitelib'
16941 sitelib_stem='$sitelib_stem'
16942 sitelibexp='$sitelibexp'
16943 siteprefix='$siteprefix'
16944 siteprefixexp='$siteprefixexp'
16945 sizesize='$sizesize'
16946 sizetype='$sizetype'
16947 sleep='$sleep'
16948 smail='$smail'
16949 so='$so'
16950 sockethdr='$sockethdr'
16951 socketlib='$socketlib'
16952 socksizetype='$socksizetype'
16953 sort='$sort'
16954 spackage='$spackage'
16955 spitshell='$spitshell'
16956 src='$src'
16957 ssizetype='$ssizetype'
16958 startperl='$startperl'
16959 startsh='$startsh'
16960 static_ext='$static_ext'
16961 stdchar='$stdchar'
16962 stdio_base='$stdio_base'
16963 stdio_bufsiz='$stdio_bufsiz'
16964 stdio_cnt='$stdio_cnt'
16965 stdio_filbuf='$stdio_filbuf'
16966 stdio_ptr='$stdio_ptr'
16967 stdio_stream_array='$stdio_stream_array'
16968 strings='$strings'
16969 submit='$submit'
16970 subversion='$subversion'
16971 sysman='$sysman'
16972 tail='$tail'
16973 tar='$tar'
16974 tbl='$tbl'
16975 tee='$tee'
16976 test='$test'
16977 timeincl='$timeincl'
16978 timetype='$timetype'
16979 touch='$touch'
16980 tr='$tr'
16981 trnl='$trnl'
16982 troff='$troff'
16983 u16size='$u16size'
16984 u16type='$u16type'
16985 u32size='$u32size'
16986 u32type='$u32type'
16987 u64size='$u64size'
16988 u64type='$u64type'
16989 u8size='$u8size'
16990 u8type='$u8type'
16991 uidformat='$uidformat'
16992 uidsign='$uidsign'
16993 uidsize='$uidsize'
16994 uidtype='$uidtype'
16995 uname='$uname'
16996 uniq='$uniq'
16997 uquadtype='$uquadtype'
16998 use5005threads='$use5005threads'
16999 use64bitall='$use64bitall'
17000 use64bitint='$use64bitint'
17001 usedl='$usedl'
17002 useithreads='$useithreads'
17003 uselargefiles='$uselargefiles'
17004 uselongdouble='$uselongdouble'
17005 usemorebits='$usemorebits'
17006 usemultiplicity='$usemultiplicity'
17007 usemymalloc='$usemymalloc'
17008 usenm='$usenm'
17009 useopcode='$useopcode'
17010 useperlio='$useperlio'
17011 useposix='$useposix'
17012 usesfio='$usesfio'
17013 useshrplib='$useshrplib'
17014 usesocks='$usesocks'
17015 usethreads='$usethreads'
17016 usevendorprefix='$usevendorprefix'
17017 usevfork='$usevfork'
17018 usrinc='$usrinc'
17019 uuname='$uuname'
17020 uvXUformat='$uvXUformat'
17021 uvoformat='$uvoformat'
17022 uvsize='$uvsize'
17023 uvtype='$uvtype'
17024 uvuformat='$uvuformat'
17025 uvxformat='$uvxformat'
17026 vendorarch='$vendorarch'
17027 vendorarchexp='$vendorarchexp'
17028 vendorbin='$vendorbin'
17029 vendorbinexp='$vendorbinexp'
17030 vendorlib='$vendorlib'
17031 vendorlib_stem='$vendorlib_stem'
17032 vendorlibexp='$vendorlibexp'
17033 vendorprefix='$vendorprefix'
17034 vendorprefixexp='$vendorprefixexp'
17035 version='$version'
17036 versiononly='$versiononly'
17037 vi='$vi'
17038 voidflags='$voidflags'
17039 xlibpth='$xlibpth'
17040 xs_apiversion='$xs_apiversion'
17041 yacc='$yacc'
17042 yaccflags='$yaccflags'
17043 zcat='$zcat'
17044 zip='$zip'
17045 EOT
17046
17047 : Add in command line options if available
17048 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17049
17050 : add special variables
17051 $test -f $src/patchlevel.h && \
17052 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
17053 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
17054 echo "PERL_CONFIG_SH=true" >>config.sh
17055
17056 : propagate old symbols
17057 if $test -f UU/config.sh; then
17058         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
17059         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
17060         $sort | $uniq -u >UU/oldsyms
17061         set X `cat UU/oldsyms`
17062         shift
17063         case $# in
17064         0) ;;
17065         *)
17066                 cat <<EOM
17067 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17068 EOM
17069                 echo "# Variables propagated from previous config.sh file." >>config.sh
17070                 for sym in `cat UU/oldsyms`; do
17071                         echo "    Propagating $hint variable "'$'"$sym..."
17072                         eval 'tmp="$'"${sym}"'"'
17073                         echo "$tmp" | \
17074                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17075                 done
17076                 ;;
17077         esac
17078 fi
17079
17080 : Finish up by extracting the .SH files
17081 case "$alldone" in
17082 exit)
17083         $rm -rf UU
17084         echo "Extraction done."
17085         exit 0
17086         ;;
17087 cont)
17088         ;;
17089 '')
17090         dflt=''
17091         nostick=true
17092         $cat <<EOM
17093
17094 If you'd like to make any changes to the config.sh file before I begin
17095 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17096
17097 EOM
17098         rp="Press return or use a shell escape to edit config.sh:"
17099         . UU/myread
17100         nostick=''
17101         case "$ans" in
17102         '') ;;
17103         *) : in case they cannot read
17104                 sh 1>&4 -c "$ans";;
17105         esac
17106         ;;
17107 esac
17108
17109 : if this fails, just run all the .SH files by hand
17110 . ./config.sh
17111
17112 echo " "
17113 exec 1>&4
17114 . ./UU/extract
17115
17116 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17117         dflt=y
17118         case "$silent" in
17119         true) ;;
17120         *)
17121                 $cat <<EOM
17122
17123 Now you need to generate make dependencies by running "$make depend".
17124 You might prefer to run it in background: "$make depend > makedepend.out &"
17125 It can take a while, so you might not want to run it right now.
17126
17127 EOM
17128                 ;;
17129         esac
17130         rp="Run $make depend now?"
17131         . UU/myread
17132         case "$ans" in
17133         y*)
17134                 $make depend && echo "Now you must run '$make'."
17135                 ;;
17136         *)
17137                 echo "You must run '$make depend' then '$make'."
17138                 ;;
17139         esac
17140 elif test -f [Mm]akefile; then
17141         echo " "
17142         echo "Now you must run a $make."
17143 else
17144         echo "Configure done."
17145 fi
17146
17147 if $test -f Policy.sh; then
17148     $cat <<EOM
17149
17150 If you compile $package on a different machine or from a different object
17151 directory, copy the Policy.sh file from this object directory to the
17152 new one before you run Configure -- this will help you with most of
17153 the policy defaults.
17154
17155 EOM
17156 fi
17157 if $test -f config.msg; then
17158     echo "Hmm.  I also noted the following information while running:"
17159     echo " "
17160     $cat config.msg >&4
17161     $rm -f config.msg
17162 fi
17163 $rm -f kit*isdone ark*isdone
17164 $rm -rf UU
17165
17166 : End of Configure
17167