typo in vars.pm that leads to cryptic message (from Piotr Piatkowski
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Wed Mar 22 19:13:31 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fpos64_t=''
358 d_fs_data_s=''
359 d_fseeko=''
360 d_fsetpos=''
361 d_fstatfs=''
362 d_ftello=''
363 d_ftime=''
364 d_gettimeod=''
365 d_Gconvert=''
366 d_getcwd=''
367 d_getfsstat=''
368 d_getgrent=''
369 d_getgrps=''
370 d_gethbyaddr=''
371 d_gethbyname=''
372 d_gethent=''
373 aphostname=''
374 d_gethname=''
375 d_phostname=''
376 d_uname=''
377 d_gethostprotos=''
378 d_getlogin=''
379 d_getmnt=''
380 d_getmntent=''
381 d_getnbyaddr=''
382 d_getnbyname=''
383 d_getnent=''
384 d_getnetprotos=''
385 d_getpent=''
386 d_getpgid=''
387 d_getpgrp2=''
388 d_bsdgetpgrp=''
389 d_getpgrp=''
390 d_getppid=''
391 d_getprior=''
392 d_getpbyname=''
393 d_getpbynumber=''
394 d_getprotoprotos=''
395 d_getpwent=''
396 d_getsent=''
397 d_getservprotos=''
398 d_getspent=''
399 d_getspnam=''
400 d_getsbyname=''
401 d_getsbyport=''
402 d_gnulibc=''
403 d_hasmntopt=''
404 d_htonl=''
405 d_iconv=''
406 d_inetaton=''
407 d_int64_t=''
408 d_isascii=''
409 d_killpg=''
410 d_lchown=''
411 d_ldbl_dig=''
412 d_link=''
413 d_locconv=''
414 d_lockf=''
415 d_longdbl=''
416 longdblsize=''
417 d_longlong=''
418 longlongsize=''
419 d_lseekproto=''
420 d_lstat=''
421 d_madvise=''
422 d_mblen=''
423 d_mbstowcs=''
424 d_mbtowc=''
425 d_memchr=''
426 d_memcmp=''
427 d_memcpy=''
428 d_memmove=''
429 d_memset=''
430 d_mkdir=''
431 d_mkdtemp=''
432 d_mkfifo=''
433 d_mkstemp=''
434 d_mkstemps=''
435 d_mktime=''
436 d_mmap=''
437 mmaptype=''
438 d_mprotect=''
439 d_msg=''
440 d_msgctl=''
441 d_msgget=''
442 d_msgrcv=''
443 d_msgsnd=''
444 d_msync=''
445 d_munmap=''
446 d_nice=''
447 d_off64_t=''
448 d_open3=''
449 d_fpathconf=''
450 d_pathconf=''
451 d_pause=''
452 d_pipe=''
453 d_poll=''
454 d_portable=''
455 d_old_pthread_create_joinable=''
456 old_pthread_create_joinable=''
457 d_pthread_yield=''
458 d_sched_yield=''
459 sched_yield=''
460 d_qgcvt=''
461 d_readdir=''
462 d_rewinddir=''
463 d_seekdir=''
464 d_telldir=''
465 d_readlink=''
466 d_rename=''
467 d_rmdir=''
468 d_safebcpy=''
469 d_safemcpy=''
470 d_sanemcmp=''
471 d_select=''
472 d_sem=''
473 d_semctl=''
474 d_semget=''
475 d_semop=''
476 d_setegid=''
477 d_seteuid=''
478 d_setgrent=''
479 d_setgrps=''
480 d_sethent=''
481 d_setlinebuf=''
482 d_setlocale=''
483 d_setnent=''
484 d_setpent=''
485 d_setpgid=''
486 d_setpgrp2=''
487 d_bsdsetpgrp=''
488 d_setpgrp=''
489 d_setprior=''
490 d_setpwent=''
491 d_setregid=''
492 d_setresgid=''
493 d_setresuid=''
494 d_setreuid=''
495 d_setrgid=''
496 d_setruid=''
497 d_setsent=''
498 d_setsid=''
499 d_setspent=''
500 d_setvbuf=''
501 d_sfio=''
502 usesfio=''
503 d_shm=''
504 d_shmat=''
505 d_shmatprototype=''
506 shmattype=''
507 d_shmctl=''
508 d_shmdt=''
509 d_shmget=''
510 d_sigaction=''
511 d_sigsetjmp=''
512 d_msg_ctrunc=''
513 d_msg_dontroute=''
514 d_msg_oob=''
515 d_msg_peek=''
516 d_msg_proxy=''
517 d_oldsock=''
518 d_scm_rights=''
519 d_socket=''
520 d_sockpair=''
521 sockethdr=''
522 socketlib=''
523 d_socklen_t=''
524 d_sqrtl=''
525 d_statblks=''
526 d_statfs_f_flags=''
527 d_statfs_s=''
528 d_fstatvfs=''
529 d_statvfs=''
530 d_stdio_cnt_lval=''
531 d_stdio_ptr_lval=''
532 d_stdiobase=''
533 d_stdstdio=''
534 stdio_base=''
535 stdio_bufsiz=''
536 stdio_cnt=''
537 stdio_filbuf=''
538 stdio_ptr=''
539 d_index=''
540 d_strchr=''
541 d_strcoll=''
542 d_strctcpy=''
543 d_strerrm=''
544 d_strerror=''
545 d_sysernlst=''
546 d_syserrlst=''
547 d_strtod=''
548 d_strtol=''
549 d_strtold=''
550 d_strtoll=''
551 d_strtoul=''
552 d_strtoull=''
553 d_strtouq=''
554 d_strxfrm=''
555 d_symlink=''
556 d_syscall=''
557 d_sysconf=''
558 d_system=''
559 d_tcgetpgrp=''
560 d_tcsetpgrp=''
561 d_telldirproto=''
562 d_time=''
563 timetype=''
564 clocktype=''
565 d_times=''
566 d_truncate=''
567 d_tzname=''
568 d_umask=''
569 d_semctl_semid_ds=''
570 d_semctl_semun=''
571 d_union_semun=''
572 d_ustat=''
573 d_vfork=''
574 usevfork=''
575 d_voidsig=''
576 signal_t=''
577 d_volatile=''
578 d_charvspr=''
579 d_vprintf=''
580 d_wait4=''
581 d_waitpid=''
582 d_wcstombs=''
583 d_wctomb=''
584 dlext=''
585 cccdlflags=''
586 ccdlflags=''
587 dlsrc=''
588 ld=''
589 lddlflags=''
590 usedl=''
591 doublesize=''
592 ebcdic=''
593 fflushNULL=''
594 fflushall=''
595 fpossize=''
596 fpostype=''
597 gidformat=''
598 gidsign=''
599 gidsize=''
600 gidtype=''
601 groupstype=''
602 h_fcntl=''
603 h_sysfile=''
604 i_arpainet=''
605 db_hashtype=''
606 db_prefixtype=''
607 i_db=''
608 i_dbm=''
609 i_rpcsvcdbm=''
610 d_dirnamlen=''
611 direntrytype=''
612 i_dirent=''
613 i_dld=''
614 i_dlfcn=''
615 i_fcntl=''
616 i_float=''
617 i_gdbm=''
618 d_grpasswd=''
619 i_grp=''
620 i_iconv=''
621 i_ieeefp=''
622 i_inttypes=''
623 i_limits=''
624 i_locale=''
625 i_machcthr=''
626 i_malloc=''
627 i_math=''
628 i_memory=''
629 i_mntent=''
630 i_ndbm=''
631 i_netdb=''
632 i_neterrno=''
633 i_netinettcp=''
634 i_niin=''
635 i_sysin=''
636 i_poll=''
637 i_pthread=''
638 d_pwage=''
639 d_pwchange=''
640 d_pwclass=''
641 d_pwcomment=''
642 d_pwexpire=''
643 d_pwgecos=''
644 d_pwpasswd=''
645 d_pwquota=''
646 i_pwd=''
647 i_sfio=''
648 i_shadow=''
649 i_socks=''
650 i_stddef=''
651 i_stdlib=''
652 i_string=''
653 strings=''
654 i_sunmath=''
655 i_sysaccess=''
656 i_sysdir=''
657 i_sysfile=''
658 d_voidtty=''
659 i_bsdioctl=''
660 i_sysfilio=''
661 i_sysioctl=''
662 i_syssockio=''
663 i_syslog=''
664 i_sysmman=''
665 i_sysmode=''
666 i_sysmount=''
667 i_sysndir=''
668 i_sysparam=''
669 i_sysresrc=''
670 i_syssecrt=''
671 i_sysselct=''
672 i_sysstat=''
673 i_sysstatfs=''
674 i_sysstatvfs=''
675 i_systimes=''
676 i_systypes=''
677 i_sysuio=''
678 i_sysun=''
679 i_sysutsname=''
680 i_sysvfs=''
681 i_syswait=''
682 i_sgtty=''
683 i_termio=''
684 i_termios=''
685 i_systime=''
686 i_systimek=''
687 i_time=''
688 timeincl=''
689 i_unistd=''
690 i_ustat=''
691 i_utime=''
692 i_values=''
693 i_stdarg=''
694 i_varargs=''
695 i_varhdr=''
696 i_vfork=''
697 inc_version_list=''
698 inc_version_list_init=''
699 installprefix=''
700 installprefixexp=''
701 installstyle=''
702 installusrbinperl=''
703 intsize=''
704 longsize=''
705 shortsize=''
706 libc=''
707 ldlibpthname=''
708 libperl=''
709 shrpenv=''
710 useshrplib=''
711 glibpth=''
712 libpth=''
713 loclibpth=''
714 plibpth=''
715 xlibpth=''
716 ignore_versioned_solibs=''
717 libs=''
718 libsdirs=''
719 libsfiles=''
720 libsfound=''
721 libspath=''
722 lns=''
723 d_PRIEldbl=''
724 d_PRIFldbl=''
725 d_PRIGldbl=''
726 d_PRIeldbl=''
727 d_PRIfldbl=''
728 d_PRIgldbl=''
729 sPRIEldbl=''
730 sPRIFldbl=''
731 sPRIGldbl=''
732 sPRIeldbl=''
733 sPRIfldbl=''
734 sPRIgldbl=''
735 lseeksize=''
736 lseektype=''
737 make_set_make=''
738 d_mymalloc=''
739 freetype=''
740 mallocobj=''
741 mallocsrc=''
742 malloctype=''
743 usemymalloc=''
744 installman1dir=''
745 man1dir=''
746 man1direxp=''
747 man1ext=''
748 installman3dir=''
749 man3dir=''
750 man3direxp=''
751 man3ext=''
752 huge=''
753 large=''
754 medium=''
755 models=''
756 small=''
757 split=''
758 modetype=''
759 multiarch=''
760 mydomain=''
761 myhostname=''
762 phostname=''
763 c=''
764 n=''
765 d_eofnblk=''
766 eagain=''
767 o_nonblock=''
768 rd_nodata=''
769 netdb_hlen_type=''
770 netdb_host_type=''
771 netdb_name_type=''
772 netdb_net_type=''
773 groupcat=''
774 hostcat=''
775 passcat=''
776 orderlib=''
777 ranlib=''
778 package=''
779 spackage=''
780 pager=''
781 api_revision=''
782 api_subversion=''
783 api_version=''
784 api_versionstring=''
785 patchlevel=''
786 revision=''
787 subversion=''
788 version=''
789 perl5=''
790 perladmin=''
791 perlpath=''
792 d_nv_preserves_uv=''
793 i16size=''
794 i16type=''
795 i32size=''
796 i32type=''
797 i64size=''
798 i64type=''
799 i8size=''
800 i8type=''
801 ivsize=''
802 ivtype=''
803 nvsize=''
804 nvtype=''
805 u16size=''
806 u16type=''
807 u32size=''
808 u32type=''
809 u64size=''
810 u64type=''
811 u8size=''
812 u8type=''
813 uvsize=''
814 uvtype=''
815 ivdformat=''
816 uvoformat=''
817 uvuformat=''
818 uvxformat=''
819 pidtype=''
820 prefix=''
821 prefixexp=''
822 installprivlib=''
823 privlib=''
824 privlibexp=''
825 prototype=''
826 ptrsize=''
827 d_PRIX64=''
828 d_PRId64=''
829 d_PRIi64=''
830 d_PRIo64=''
831 d_PRIu64=''
832 d_PRIx64=''
833 sPRIX64=''
834 sPRId64=''
835 sPRIi64=''
836 sPRIo64=''
837 sPRIu64=''
838 sPRIx64=''
839 d_quad=''
840 quadkind=''
841 quadtype=''
842 uquadtype=''
843 drand01=''
844 randbits=''
845 randfunc=''
846 randseedtype=''
847 seedfunc=''
848 installscript=''
849 scriptdir=''
850 scriptdirexp=''
851 selectminbits=''
852 selecttype=''
853 sh=''
854 sig_count=''
855 sig_name=''
856 sig_name_init=''
857 sig_num=''
858 sig_num_init=''
859 installsitearch=''
860 sitearch=''
861 sitearchexp=''
862 installsitebin=''
863 sitebin=''
864 sitebinexp=''
865 installsitelib=''
866 sitelib=''
867 sitelib_stem=''
868 sitelibexp=''
869 siteprefix=''
870 siteprefixexp=''
871 sizesize=''
872 sizetype=''
873 so=''
874 socksizetype=''
875 sharpbang=''
876 shsharp=''
877 spitshell=''
878 src=''
879 ssizetype=''
880 startperl=''
881 startsh=''
882 stdchar=''
883 d_stdio_stream_array=''
884 stdio_stream_array=''
885 sysman=''
886 trnl=''
887 uidformat=''
888 uidsign=''
889 uidsize=''
890 uidtype=''
891 archname64=''
892 use64bitall=''
893 use64bitint=''
894 uselargefiles=''
895 uselongdouble=''
896 usemorebits=''
897 usemultiplicity=''
898 nm_opt=''
899 nm_so_opt=''
900 runnm=''
901 usenm=''
902 useperlio=''
903 usesocks=''
904 d_oldpthreads=''
905 use5005threads=''
906 useithreads=''
907 usethreads=''
908 incpath=''
909 mips_type=''
910 usrinc=''
911 d_vendorarch=''
912 installvendorarch=''
913 vendorarch=''
914 vendorarchexp=''
915 d_vendorbin=''
916 installvendorbin=''
917 vendorbin=''
918 vendorbinexp=''
919 d_vendorlib=''
920 installvendorlib=''
921 vendorlib=''
922 vendorlib_stem=''
923 vendorlibexp=''
924 usevendorprefix=''
925 vendorprefix=''
926 vendorprefixexp=''
927 defvoidused=''
928 voidflags=''
929 pm_apiversion=''
930 xs_apiversion=''
931 CONFIG=''
932
933 define='define'
934 undef='undef'
935 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
936 rmlist=''
937
938 : We must find out about Eunice early
939 eunicefix=':'
940 if test -f /etc/unixtovms; then
941         eunicefix=/etc/unixtovms
942 fi
943 if test -f /etc/unixtovms.exe; then
944         eunicefix=/etc/unixtovms.exe
945 fi
946
947 i_whoami=''
948 : set useposix=false in your hint file to disable the POSIX extension.
949 useposix=true
950 : set useopcode=false in your hint file to disable the Opcode extension.
951 useopcode=true
952 : Trailing extension.  Override this in a hint file, if needed.
953 _exe=''
954 : Extra object files, if any, needed on this platform.
955 archobjs=''
956 : Possible local include directories to search.
957 : Set locincpth to "" in a hint file to defeat local include searches.
958 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
959 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
960 :
961 : no include file wanted by default
962 inclwanted=''
963
964 groupstype=''
965 : change the next line if compiling for Xenix/286 on Xenix/386
966 xlibpth='/usr/lib/386 /lib/386'
967 : Possible local library directories to search.
968 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
969 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
970
971 : general looking path for locating libraries
972 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
973 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
974 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
975 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
976 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
977
978 : Private path used by Configure to find libraries.  Its value
979 : is prepended to libpth. This variable takes care of special
980 : machines, like the mips.  Usually, it should be empty.
981 plibpth=''
982
983 : default library list
984 libswanted=''
985 : some systems want to use only the non-versioned libso:s
986 ignore_versioned_solibs=''
987 : set usemultiplicity on the Configure command line to enable multiplicity.
988 : set usesocks on the Configure command line to enable socks.
989 : set usethreads on the Configure command line to enable threads.
990 : full support for void wanted by default
991 defvoidused=15
992
993 : List of libraries we want.
994 : If anyone needs -lnet, put it in a hint file.
995 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
996 libswanted="$libswanted dld ld sun m c cposix posix"
997 libswanted="$libswanted ndir dir crypt sec"
998 libswanted="$libswanted ucb bsd BSD PW x iconv"
999 : We probably want to search /usr/shlib before most other libraries.
1000 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1001 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1002 glibpth="/usr/shlib $glibpth"
1003 : Do not use vfork unless overridden by a hint file.
1004 usevfork=false
1005
1006 : Find the basic shell for Bourne shell scripts
1007 case "$sh" in
1008 '')
1009         case "$SYSTYPE" in
1010         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1011         *) xxx='/bin/sh';;
1012         esac
1013         if test -f "$xxx"; then
1014                 sh="$xxx"
1015         else
1016                 : Build up a list and do a single loop so we can 'break' out.
1017                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1018                 for xxx in sh bash ksh pdksh ash; do
1019                         for p in $pth; do
1020                                 try="$try ${p}/${xxx}"
1021                         done
1022                 done
1023                 for xxx in $try; do
1024                         if test -f "$xxx"; then
1025                                 sh="$xxx";
1026                                 break
1027                         elif test -f "$xxx.exe"; then
1028                                 sh="$xxx";
1029                                 break
1030                         fi
1031                 done
1032         fi
1033         ;;
1034 esac
1035
1036 case "$sh" in
1037 '')     cat <<EOM >&2
1038 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1039
1040 Usually it's in /bin/sh.  How did you even get this far?
1041 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1042 we'll try to straighten this all out.
1043 EOM
1044         exit 1
1045         ;;
1046 esac
1047
1048 : see if sh knows # comments
1049 if `$sh -c '#' >/dev/null 2>&1`; then
1050         shsharp=true
1051         spitshell=cat
1052         xcat=/bin/cat
1053         test -f $xcat || xcat=/usr/bin/cat
1054         echo "#!$xcat" >try
1055         $eunicefix try
1056         chmod +x try
1057         ./try > today
1058         if test -s today; then
1059                 sharpbang='#!'
1060         else
1061                 echo "#! $xcat" > try
1062                 $eunicefix try
1063                 chmod +x try
1064                 ./try > today
1065                 if test -s today; then
1066                         sharpbang='#! '
1067                 else
1068                         sharpbang=': use '
1069                 fi
1070         fi
1071 else
1072         echo " "
1073         echo "Your $sh doesn't grok # comments--I will strip them later on."
1074         shsharp=false
1075         cd ..
1076         echo "exec grep -v '^[  ]*#'" >spitshell
1077         chmod +x spitshell
1078         $eunicefix spitshell
1079         spitshell=`pwd`/spitshell
1080         cd UU
1081         echo "I presume that if # doesn't work, #! won't work either!"
1082         sharpbang=': use '
1083 fi
1084 rm -f try today
1085
1086 : figure out how to guarantee sh startup
1087 case "$startsh" in
1088 '') startsh=${sharpbang}${sh} ;;
1089 *)
1090 esac
1091 cat >try <<EOSS
1092 $startsh
1093 set abc
1094 test "$?abc" != 1
1095 EOSS
1096
1097 chmod +x try
1098 $eunicefix try
1099 if ./try; then
1100         : echo "Yup, it does."
1101 else
1102         echo "Hmm... '$startsh' does not guarantee sh startup..."
1103         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1104 fi
1105 rm -f try
1106
1107
1108 : Save command line options in file UU/cmdline.opt for later use in
1109 : generating config.sh.
1110 cat > cmdline.opt <<EOSH
1111 # Configure command line arguments.
1112 config_arg0='$0'
1113 config_args='$*'
1114 config_argc=$#
1115 EOSH
1116 argn=1
1117 for arg in "$@"; do
1118         cat >>cmdline.opt <<EOSH
1119 config_arg$argn='$arg'
1120 EOSH
1121         argn=`expr $argn + 1`
1122 done
1123
1124 : produce awk script to parse command line options
1125 cat >options.awk <<'EOF'
1126 BEGIN {
1127         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1128
1129         len = length(optstr);
1130         for (i = 1; i <= len; i++) {
1131                 c = substr(optstr, i, 1);
1132                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1133                 if (a == ":") {
1134                         arg[c] = 1;
1135                         i++;
1136                 }
1137                 opt[c] = 1;
1138         }
1139 }
1140 {
1141         expect = 0;
1142         str = $0;
1143         if (substr(str, 1, 1) != "-") {
1144                 printf("'%s'\n", str);
1145                 next;
1146         }
1147         len = length($0);
1148         for (i = 2; i <= len; i++) {
1149                 c = substr(str, i, 1);
1150                 if (!opt[c]) {
1151                         printf("-%s\n", substr(str, i));
1152                         next;
1153                 }
1154                 printf("-%s\n", c);
1155                 if (arg[c]) {
1156                         if (i < len)
1157                                 printf("'%s'\n", substr(str, i + 1));
1158                         else
1159                                 expect = 1;
1160                         next;
1161                 }
1162         }
1163 }
1164 END {
1165         if (expect)
1166                 print "?";
1167 }
1168 EOF
1169
1170 : process the command line options
1171 set X `for arg in "$@"; do echo "X$arg"; done |
1172         sed -e s/X// | awk -f options.awk`
1173 eval "set $*"
1174 shift
1175 rm -f options.awk
1176
1177 : set up default values
1178 fastread=''
1179 reuseval=false
1180 config_sh=''
1181 alldone=''
1182 error=''
1183 silent=''
1184 extractsh=''
1185 override=''
1186 knowitall=''
1187 rm -f optdef.sh posthint.sh
1188 cat >optdef.sh <<EOS
1189 $startsh
1190 EOS
1191
1192
1193 : option parsing
1194 while test $# -gt 0; do
1195         case "$1" in
1196         -d) shift; fastread=yes;;
1197         -e) shift; alldone=cont;;
1198         -f)
1199                 shift
1200                 cd ..
1201                 if test -r "$1"; then
1202                         config_sh="$1"
1203                 else
1204                         echo "$me: cannot read config file $1." >&2
1205                         error=true
1206                 fi
1207                 cd UU
1208                 shift;;
1209         -h) shift; error=true;;
1210         -r) shift; reuseval=true;;
1211         -s) shift; silent=true; realsilent=true;;
1212         -E) shift; alldone=exit;;
1213         -K) shift; knowitall=true;;
1214         -O) shift; override=true;;
1215         -S) shift; silent=true; extractsh=true;;
1216         -D)
1217                 shift
1218                 case "$1" in
1219                 *=)
1220                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1221                         echo "$me: ignoring -D $1" >&2
1222                         ;;
1223                 *=*) echo "$1" | \
1224                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1225                 *) echo "$1='define'" >> optdef.sh;;
1226                 esac
1227                 shift
1228                 ;;
1229         -U)
1230                 shift
1231                 case "$1" in
1232                 *=) echo "$1" >> optdef.sh;;
1233                 *=*)
1234                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1235                         echo "$me: ignoring -U $1" >&2
1236                         ;;
1237                 *) echo "$1='undef'" >> optdef.sh;;
1238                 esac
1239                 shift
1240                 ;;
1241         -A)
1242             shift
1243             xxx=''
1244             yyy="$1"
1245             zzz=''
1246             uuu=undef
1247             case "$yyy" in
1248             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1249                  case "$zzz" in
1250                  *:*) zzz='' ;;
1251                  *)   xxx=append
1252                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1253                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1254                  esac
1255                  ;;
1256             esac
1257             case "$xxx" in
1258             '')  case "$yyy" in
1259                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1260                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1261                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1262                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1263                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1264                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1265                  esac
1266                  ;;       
1267             esac
1268             case "$xxx" in
1269             append)
1270                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1271             clear)
1272                 echo "$yyy=''"                  >> posthint.sh ;;
1273             define)
1274                 case "$zzz" in
1275                 '') zzz=define ;;
1276                 esac
1277                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1278             eval)
1279                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1280             prepend)
1281                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1282             undef)
1283                 case "$zzz" in
1284                 '') zzz="$uuu" ;;
1285                 esac
1286                 echo "$yyy=$zzz"                >> posthint.sh ;;
1287             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1288             esac
1289             shift
1290             ;;
1291         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1292             exit 0;;
1293         --) break;;
1294         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1295         *) break;;
1296         esac
1297 done
1298
1299 case "$error" in
1300 true)
1301         cat >&2 <<EOM
1302 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1303                  [-U symbol] [-U symbol=] [-A command:symbol...]
1304   -d : use defaults for all answers.
1305   -e : go on without questioning past the production of config.sh.
1306   -f : specify an alternate default configuration file.
1307   -h : print this help message and exit (with an error status).
1308   -r : reuse C symbols value if possible (skips costly nm extraction).
1309   -s : silent mode, only echoes questions and essential information.
1310   -D : define symbol to have some value:
1311          -D symbol         symbol gets the value 'define'
1312          -D symbol=value   symbol gets the value 'value'
1313   -E : stop at the end of questions, after having produced config.sh.
1314   -K : do not use unless you know what you are doing.
1315   -O : let -D and -U override definitions from loaded configuration file.
1316   -S : perform variable substitutions on all .SH files (can mix with -f)
1317   -U : undefine symbol:
1318          -U symbol    symbol gets the value 'undef'
1319          -U symbol=   symbol gets completely empty
1320   -A : manipulate symbol after the platform specific hints have been applied:
1321          -A symbol=value                append " "value to symbol
1322          -A append:symbol=value         append value to symbol
1323          -A define:symbol=value         define symbol to have value
1324          -A clear:symbol                define symbol to be ''
1325          -A define:symbol               define symbol to be 'define'
1326          -A eval:symbol=value           define symbol to be eval of value
1327          -A prepend:symbol=value        prepend value to symbol
1328          -A undef:symbol                define symbol to be 'undef'
1329          -A undef:symbol=               define symbol to be ''
1330   -V : print version number and exit (with a zero status).
1331 EOM
1332         exit 1
1333         ;;
1334 esac
1335
1336 : Sanity checks
1337 case "$fastread$alldone" in
1338 yescont|yesexit) ;;
1339 *)
1340         if test ! -t 0; then
1341                 echo "Say 'sh Configure', not 'sh <Configure'"
1342                 exit 1
1343         fi
1344         ;;
1345 esac
1346
1347 exec 4>&1
1348 case "$silent" in
1349 true) exec 1>/dev/null;;
1350 esac
1351
1352 : run the defines and the undefines, if any, but leave the file out there...
1353 touch optdef.sh
1354 . ./optdef.sh
1355 : create the posthint manipulation script and leave the file out there...
1356 touch posthint.sh
1357
1358 : set package name
1359 package=perl5
1360 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1361 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1362 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1363 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1364 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1365 esac
1366
1367 : Some greps do not return status, grrr.
1368 echo "grimblepritz" >grimble
1369 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1370         contains=contains
1371 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1372         contains=grep
1373 else
1374         contains=contains
1375 fi
1376 rm -f grimble
1377 : the following should work in any shell
1378 case "$contains" in
1379 contains*)
1380         echo " "
1381         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1382         cat >contains <<'EOSS'
1383 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1384 EOSS
1385 chmod +x contains
1386 esac
1387
1388 : Find the path to the source tree
1389 case "$src" in
1390 '') case "$0" in
1391     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1392          case "$src" in
1393          /*)    ;;
1394          *)     src=`cd ../$src && pwd` ;;
1395          esac
1396          ;;
1397     *)   src='.';;
1398     esac;;
1399 esac
1400 case "$src" in
1401 '')     src=/
1402         rsrc=/
1403         ;;
1404 /*) rsrc="$src";;
1405 *) rsrc="../$src";;
1406 esac
1407 if test -f $rsrc/Configure && \
1408         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1409 then
1410    : found it, so we are ok.
1411 else
1412         rsrc=''
1413         for src in . .. ../.. ../../.. ../../../..; do
1414                 if test -f ../$src/Configure && \
1415                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1416                 then
1417                         rsrc=../$src
1418                         break
1419                 fi
1420         done
1421 fi
1422 case "$rsrc" in
1423 '')
1424         cat <<EOM >&4
1425
1426 Sorry, I can't seem to locate the source dir for $package.  Please start
1427 Configure with an explicit path -- i.e. /some/path/Configure.
1428
1429 EOM
1430         exit 1
1431         ;;
1432 ../.)   rsrc='..';;
1433 *)
1434         echo " "
1435         echo "Sources for $package found in \"$src\"." >&4
1436         ;;
1437 esac
1438
1439 : script used to extract .SH files with variable substitutions
1440 cat >extract <<'EOS'
1441 CONFIGDOTSH=true
1442 echo "Doing variable substitutions on .SH files..."
1443 if test -f $src/MANIFEST; then
1444         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1445 else
1446         echo "(Looking for .SH files under the source directory.)"
1447         set x `(cd $src; find . -name "*.SH" -print)`
1448 fi
1449 shift
1450 case $# in
1451 0) set x `(cd $src; echo *.SH)`; shift;;
1452 esac
1453 if test ! -f $src/$1; then
1454         shift
1455 fi
1456 mkdir_p='
1457 name=$1;
1458 create="";
1459 while test $name; do
1460         if test ! -d "$name"; then
1461                 create="$name $create";
1462                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1463                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1464         else
1465                 name="";
1466         fi;
1467 done;
1468 for file in $create; do
1469         mkdir $file;
1470 done
1471 '
1472 for file in $*; do
1473         case "$src" in
1474         ".")
1475                 case "$file" in
1476                 */*)
1477                         dir=`expr X$file : 'X\(.*\)/'`
1478                         file=`expr X$file : 'X.*/\(.*\)'`
1479                         (cd $dir && . ./$file)
1480                         ;;
1481                 *)
1482                         . ./$file
1483                         ;;
1484                 esac
1485                 ;;
1486         *)
1487                 case "$file" in
1488                 */*)
1489                         dir=`expr X$file : 'X\(.*\)/'`
1490                         file=`expr X$file : 'X.*/\(.*\)'`
1491                         (set x $dir; shift; eval $mkdir_p)
1492                         sh <$src/$dir/$file
1493                         ;;
1494                 *)
1495                         sh <$src/$file
1496                         ;;
1497                 esac
1498                 ;;
1499         esac
1500 done
1501 if test -f $src/config_h.SH; then
1502         if test ! -f config.h; then
1503         : oops, they left it out of MANIFEST, probably, so do it anyway.
1504         . $src/config_h.SH
1505         fi
1506 fi
1507 EOS
1508
1509 : extract files and exit if asked to do so
1510 case "$extractsh" in
1511 true)
1512         case "$realsilent" in
1513         true) ;;
1514         *) exec 1>&4;;
1515         esac
1516         case "$config_sh" in
1517         '') config_sh='config.sh';;
1518         esac
1519         echo " "
1520         echo "Fetching answers from $config_sh..."
1521         cd ..
1522         . $config_sh
1523         test "$override" && . ./optdef.sh
1524         echo " "
1525         . UU/extract
1526         rm -rf UU
1527         echo "Done."
1528         exit 0
1529         ;;
1530 esac
1531
1532 : Eunice requires " " instead of "", can you believe it
1533 echo " "
1534 : Here we go...
1535 echo "Beginning of configuration questions for $package."
1536
1537 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1538
1539 : first determine how to suppress newline on echo command
1540 echo " "
1541 echo "Checking echo to see how to suppress newlines..."
1542 (echo "hi there\c" ; echo " ") >.echotmp
1543 if $contains c .echotmp >/dev/null 2>&1 ; then
1544         echo "...using -n."
1545         n='-n'
1546         c=''
1547 else
1548         cat <<'EOM'
1549 ...using \c
1550 EOM
1551         n=''
1552         c='\c'
1553 fi
1554 echo $n "The star should be here-->$c"
1555 echo '*'
1556 rm -f .echotmp
1557
1558 : Now test for existence of everything in MANIFEST
1559 echo " "
1560 if test -f $rsrc/MANIFEST; then
1561         echo "First let's make sure your kit is complete.  Checking..." >&4
1562         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1563         rm -f missing
1564         tmppwd=`pwd`
1565         for filelist in x??; do
1566                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1567         done
1568         if test -s missing; then
1569                 cat missing >&4
1570                 cat >&4 <<'EOM'
1571
1572 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1573
1574 You have the option of continuing the configuration process, despite the
1575 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1576 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1577 and contact the author (perlbug@perl.com).
1578
1579 EOM
1580                 echo $n "Continue? [n] $c" >&4
1581                 read ans
1582                 case "$ans" in
1583                 y*)
1584                         echo "Continuing..." >&4
1585                         rm -f missing
1586                         ;;
1587                 *)
1588                         echo "ABORTING..." >&4
1589                         kill $$
1590                         ;;
1591                 esac
1592         else
1593                 echo "Looks good..."
1594         fi
1595 else
1596         echo "There is no MANIFEST file.  I hope your kit is complete !"
1597 fi
1598 rm -f missing x??
1599
1600 echo " "
1601 : Find the appropriate value for a newline for tr
1602 if test -n "$DJGPP"; then
1603        trnl='\012'
1604 fi
1605 if test X"$trnl" = X; then
1606         case "`echo foo|tr '\n' x 2>/dev/null`" in
1607         foox) trnl='\n' ;;
1608         esac
1609 fi
1610 if test X"$trnl" = X; then
1611         case "`echo foo|tr '\012' x 2>/dev/null`" in
1612         foox) trnl='\012' ;;
1613         esac
1614 fi
1615 if test X"$trnl" = X; then
1616         cat <<EOM >&2
1617
1618 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1619
1620 EOM
1621         exit 1
1622 fi
1623
1624 : compute the number of columns on the terminal for proper question formatting
1625 case "$COLUMNS" in
1626 '') COLUMNS='80';;
1627 esac
1628
1629 : set up the echo used in my read
1630 myecho="case \"\$xxxm\" in
1631 '') echo $n \"\$rp $c\" >&4;;
1632 *) case \"\$rp\" in
1633         '') echo $n \"[\$xxxm] $c\";;
1634         *)
1635                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1636                         echo \"\$rp\" >&4
1637                         echo $n \"[\$xxxm] $c\" >&4
1638                 else
1639                         echo $n \"\$rp [\$xxxm] $c\" >&4
1640                 fi
1641                 ;;
1642         esac;;
1643 esac"
1644
1645 : now set up to do reads with possible shell escape and default assignment
1646 cat <<EOSC >myread
1647 $startsh
1648 xxxm=\$dflt
1649 $myecho
1650 ans='!'
1651 case "\$fastread" in
1652 yes) case "\$dflt" in
1653         '') ;;
1654         *) ans='';
1655                 case "\$silent-\$rp" in
1656                 true-) ;;
1657                 *) echo " " >&4;;
1658                 esac;;
1659         esac;;
1660 *) case "\$silent" in
1661         true) case "\$rp" in
1662                 '') ans='';;
1663                 esac;;
1664         esac;;
1665 esac
1666 while expr "X\$ans" : "X!" >/dev/null; do
1667         read answ
1668         set x \$xxxm
1669         shift
1670         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1671         case  "\$answ" in
1672         "!")
1673                 sh 1>&4
1674                 echo " "
1675                 $myecho
1676                 ;;
1677         !*)
1678                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1679                 shift
1680                 sh 1>&4 -c "\$*"
1681                 echo " "
1682                 $myecho
1683                 ;;
1684         "\$ans")
1685                 case "\$ans" in
1686                 \\&*)
1687                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1688                         shift
1689                         case "\$1" in
1690                         -d)
1691                                 fastread=yes
1692                                 echo "(OK, I'll run with -d after this question.)" >&4
1693                                 ;;
1694                         -*)
1695                                 echo "*** Sorry, \$1 not supported yet." >&4
1696                                 ;;
1697                         esac
1698                         $myecho
1699                         ans=!
1700                         ;;
1701                 esac;;
1702         *)
1703                 case "\$aok" in
1704                 y)
1705                         echo "*** Substitution done -- please confirm."
1706                         xxxm="\$ans"
1707                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1708                         xxxm="\$ans"
1709                         ans=!
1710                         ;;
1711                 *)
1712                         echo "*** Error -- try again."
1713                         ans=!
1714                         ;;
1715                 esac
1716                 $myecho
1717                 ;;
1718         esac
1719         case "\$ans\$xxxm\$nostick" in
1720         '')
1721                 ans=!
1722                 $myecho
1723                 ;;
1724         esac
1725 done
1726 case "\$ans" in
1727 '') ans="\$xxxm";;
1728 esac
1729 EOSC
1730
1731 : create .config dir to save info across Configure sessions
1732 test -d ../.config || mkdir ../.config
1733 cat >../.config/README <<EOF
1734 This directory created by Configure to save information that should
1735 persist across sessions for $package.
1736
1737 You may safely delete it if you wish.
1738 EOF
1739
1740 : general instructions
1741 needman=true
1742 firsttime=true
1743 user=`(logname) 2>/dev/null`
1744 case "$user" in
1745 '') user=`whoami 2>&1`;;
1746 esac
1747 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1748         firsttime=false
1749         echo " "
1750         rp='Would you like to see the instructions?'
1751         dflt=n
1752         . ./myread
1753         case "$ans" in
1754         [yY]*) ;;
1755         *) needman=false;;
1756         esac
1757 fi
1758 if $needman; then
1759         cat <<EOH
1760
1761 This installation shell script will examine your system and ask you questions
1762 to determine how the perl5 package should be installed. If you get
1763 stuck on a question, you may use a ! shell escape to start a subshell or
1764 execute a command.  Many of the questions will have default answers in square
1765 brackets; typing carriage return will give you the default.
1766
1767 On some of the questions which ask for file or directory names you are allowed
1768 to use the ~name construct to specify the login directory belonging to "name",
1769 even if you don't have a shell which knows about that.  Questions where this is
1770 allowed will be marked "(~name ok)".
1771
1772 EOH
1773         rp=''
1774         dflt='Type carriage return to continue'
1775         . ./myread
1776         cat <<'EOH'
1777
1778 The prompter used in this script allows you to use shell variables and
1779 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1780 in the default answer, as if the default line was a set of arguments given to a
1781 script shell.  This means you may also use $* to repeat the whole default line,
1782 so you do not have to re-type everything to add something to the default.
1783
1784 Everytime there is a substitution, you will have to confirm.  If there is an
1785 error (e.g. an unmatched backtick), the default answer will remain unchanged
1786 and you will be prompted again.
1787
1788 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1789 the questions and use the computed defaults (or the previous answers if there
1790 was already a config.sh file). Type 'Configure -h' for a list of options.
1791 You may also start interactively and then answer '& -d' at any prompt to turn
1792 on the non-interactive behaviour for the remainder of the execution.
1793
1794 EOH
1795         . ./myread
1796         cat <<EOH
1797
1798 Much effort has been expended to ensure that this shell script will run on any
1799 Unix system.  If despite that it blows up on yours, your best bet is to edit
1800 Configure and run it again.  If you can't run Configure for some reason,
1801 you'll have to generate a config.sh file by hand.  Whatever problems you
1802 have, let me (perlbug@perl.com) know how I blew it.
1803
1804 This installation script affects things in two ways:
1805
1806 1) it may do direct variable substitutions on some of the files included
1807    in this kit.
1808 2) it builds a config.h file for inclusion in C programs.  You may edit
1809    any of these files as the need arises after running this script.
1810
1811 If you make a mistake on a question, there is no easy way to back up to it
1812 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1813 files.  Configure will offer to let you do this before it runs the SH files.
1814
1815 EOH
1816         dflt='Type carriage return to continue'
1817         . ./myread
1818         case "$firsttime" in
1819         true) echo $user >>../.config/instruct;;
1820         esac
1821 fi
1822
1823 : find out where common programs are
1824 echo " "
1825 echo "Locating common programs..." >&4
1826 cat <<EOSC >loc
1827 $startsh
1828 case \$# in
1829 0) exit 1;;
1830 esac
1831 thing=\$1
1832 shift
1833 dflt=\$1
1834 shift
1835 for dir in \$*; do
1836         case "\$thing" in
1837         .)
1838         if test -d \$dir/\$thing; then
1839                 echo \$dir
1840                 exit 0
1841         fi
1842         ;;
1843         *)
1844         for thisthing in \$dir/\$thing; do
1845                 : just loop through to pick last item
1846         done
1847         if test -f \$thisthing; then
1848                 echo \$thisthing
1849                 exit 0
1850         elif test -f \$dir/\$thing.exe; then
1851                 if test -n "$DJGPP"; then
1852                         echo \$dir/\$thing.exe
1853                 else
1854                         : on Eunice apparently
1855                         echo \$dir/\$thing
1856                 fi
1857                 exit 0
1858         fi
1859         ;;
1860         esac
1861 done
1862 echo \$dflt
1863 exit 1
1864 EOSC
1865 chmod +x loc
1866 $eunicefix loc
1867 loclist="
1868 awk
1869 cat
1870 comm
1871 cp
1872 echo
1873 expr
1874 grep
1875 ls
1876 make
1877 mkdir
1878 rm
1879 sed
1880 sort
1881 touch
1882 tr
1883 uniq
1884 "
1885 trylist="
1886 Mcc
1887 ar
1888 byacc
1889 cpp
1890 csh
1891 date
1892 egrep
1893 gzip
1894 less
1895 ln
1896 more
1897 nm
1898 nroff
1899 pg
1900 test
1901 uname
1902 zip
1903 "
1904 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1905 pth="$pth /lib /usr/lib"
1906 for file in $loclist; do
1907         eval xxx=\$$file
1908         case "$xxx" in
1909         /*|?:[\\/]*)
1910                 if test -f "$xxx"; then
1911                         : ok
1912                 else
1913                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1914                         xxx=`./loc $file $file $pth`
1915                 fi
1916                 ;;
1917         '') xxx=`./loc $file $file $pth`;;
1918         *) xxx=`./loc $xxx $xxx $pth`;;
1919         esac
1920         eval $file=$xxx
1921         eval _$file=$xxx
1922         case "$xxx" in
1923         /*)
1924                 echo $file is in $xxx.
1925                 ;;
1926         ?:[\\/]*)
1927                 echo $file is in $xxx.
1928                 ;;
1929         *)
1930                 echo "I don't know where '$file' is, and my life depends on it." >&4
1931                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1932                 exit 1
1933                 ;;
1934         esac
1935 done
1936 echo " "
1937 echo "Don't worry if any of the following aren't found..."
1938 say=offhand
1939 for file in $trylist; do
1940         eval xxx=\$$file
1941         case "$xxx" in
1942         /*|?:[\\/]*)
1943                 if test -f "$xxx"; then
1944                         : ok
1945                 else
1946                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1947                         xxx=`./loc $file $file $pth`
1948                 fi
1949                 ;;
1950         '') xxx=`./loc $file $file $pth`;;
1951         *) xxx=`./loc $xxx $xxx $pth`;;
1952         esac
1953         eval $file=$xxx
1954         eval _$file=$xxx
1955         case "$xxx" in
1956         /*)
1957                 echo $file is in $xxx.
1958                 ;;
1959         ?:[\\/]*)
1960                 echo $file is in $xxx.
1961                 ;;
1962         *)
1963                 echo "I don't see $file out there, $say."
1964                 say=either
1965                 ;;
1966         esac
1967 done
1968 case "$egrep" in
1969 egrep)
1970         echo "Substituting grep for egrep."
1971         egrep=$grep
1972         ;;
1973 esac
1974 case "$ln" in
1975 ln)
1976         echo "Substituting cp for ln."
1977         ln=$cp
1978         ;;
1979 esac
1980 case "$test" in
1981 test)
1982         echo "Hopefully test is built into your sh."
1983         ;;
1984 *)
1985         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1986                 echo "Using the test built into your sh."
1987                 test=test
1988                 _test=test
1989         fi
1990         ;;
1991 esac
1992 case "$echo" in
1993 echo)
1994         echo "Hopefully echo is built into your sh."
1995         ;;
1996 '') ;;
1997 *)
1998         echo " "
1999 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2000         $echo $n "hi there$c" >foo1
2001         echo $n "hi there$c" >foo2
2002         if cmp foo1 foo2 >/dev/null 2>&1; then
2003                 echo "They are compatible.  In fact, they may be identical."
2004         else
2005                 case "$n" in
2006                 '-n') n='' c='\c';;
2007                 *) n='-n' c='';;
2008                 esac
2009                 cat <<FOO
2010 They are not compatible!  You are probably running ksh on a non-USG system.
2011 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2012 have echo built in and we may have to run some Bourne shell scripts.  That
2013 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2014
2015 FOO
2016                 $echo $n "The star should be here-->$c"
2017                 $echo "*"
2018         fi
2019         $rm -f foo1 foo2
2020         ;;
2021 esac
2022
2023 : determine whether symbolic links are supported
2024 echo " "
2025 $touch blurfl
2026 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2027         echo "Symbolic links are supported." >&4
2028         lns="$ln -s"
2029 else
2030         echo "Symbolic links are NOT supported." >&4
2031         lns="$ln"
2032 fi
2033 $rm -f blurfl sym
2034
2035 : see whether [:lower:] and [:upper:] are supported character classes
2036 echo " "
2037 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2038 ABYZ)
2039         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2040         up='[:upper:]'
2041         low='[:lower:]'
2042         ;;
2043 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2044         # (0xc9 and 0xd1), therefore that is a nice testing point.
2045         if test "X$up" = X -o "X$low" = X; then
2046             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2047             ij) up='[A-Z]'
2048                 low='[a-z]'
2049                 ;;
2050             esac
2051         fi
2052         if test "X$up" = X -o "X$low" = X; then
2053             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2054             ij) up='A-Z'
2055                 low='a-z'
2056                 ;;
2057             esac
2058         fi
2059         if test "X$up" = X -o "X$low" = X; then
2060             case "`echo IJ | od -x 2>/dev/null`" in
2061             *C9D1*|*c9d1*)
2062                 echo "Hey, this might be EBCDIC." >&4
2063                 if test "X$up" = X -o "X$low" = X; then
2064                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2065                     ij) up='[A-IJ-RS-Z]'
2066                         low='[a-ij-rs-z]'
2067                         ;;
2068                     esac
2069                 fi
2070                 if test "X$up" = X -o "X$low" = X; then
2071                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2072                     ij) up='A-IJ-RS-Z'
2073                         low='a-ij-rs-z'
2074                         ;;
2075                     esac
2076                 fi
2077                 ;;
2078             esac
2079         fi
2080 esac
2081 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2082 ij)
2083     echo "Using $up and $low to convert case." >&4
2084     ;;
2085 *)
2086     echo "I don't know how to translate letters from upper to lower case." >&4
2087     echo "Your tr is not acting any way I know of." >&4
2088     exit 1
2089     ;;
2090 esac
2091 : set up the translation script tr, must be called with ./tr of course
2092 cat >tr <<EOSC
2093 $startsh
2094 case "\$1\$2" in
2095 '[A-Z][a-z]') exec $tr '$up' '$low';;
2096 '[a-z][A-Z]') exec $tr '$low' '$up';;
2097 esac
2098 exec $tr "\$@"
2099 EOSC
2100 chmod +x tr
2101 $eunicefix tr
2102
2103 : Try to determine whether config.sh was made on this system
2104 case "$config_sh" in
2105 '')
2106 myuname=`$uname -a 2>/dev/null`
2107 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2108 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2109 # because the A-Z/a-z are not consecutive.
2110 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2111         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2112 newmyuname="$myuname"
2113 dflt=n
2114 case "$knowitall" in
2115 '')
2116         if test -f ../config.sh; then
2117                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2118                         eval "`grep myuname= ../config.sh`"
2119                 fi
2120                 if test "X$myuname" = "X$newmyuname"; then
2121                         dflt=y
2122                 fi
2123         fi
2124         ;;
2125 *) dflt=y;;
2126 esac
2127
2128 : Get old answers from old config file if Configure was run on the
2129 : same system, otherwise use the hints.
2130 hint=default
2131 cd ..
2132 if test -f config.sh; then
2133         echo " "
2134         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2135         . UU/myread
2136         case "$ans" in
2137         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2138         *)  echo "Fetching default answers from your old config.sh file..." >&4
2139                 tmp_n="$n"
2140                 tmp_c="$c"
2141                 tmp_sh="$sh"
2142                 . ./config.sh
2143                 cp config.sh UU
2144                 n="$tmp_n"
2145                 c="$tmp_c"
2146                 : Older versions did not always set $sh.  Catch re-use of such
2147                 : an old config.sh.
2148                 case "$sh" in
2149                 '') sh="$tmp_sh" ;;
2150                 esac
2151                 hint=previous
2152                 ;;
2153         esac
2154 fi
2155 if test ! -f config.sh; then
2156         $cat <<EOM
2157
2158 First time through, eh?  I have some defaults handy for some systems
2159 that need some extra help getting the Configure answers right:
2160
2161 EOM
2162         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2163         dflt=''
2164         : Half the following guesses are probably wrong... If you have better
2165         : tests or hints, please send them to perlbug@perl.com
2166         : The metaconfig authors would also appreciate a copy...
2167         $test -f /irix && osname=irix
2168         $test -f /xenix && osname=sco_xenix
2169         $test -f /dynix && osname=dynix
2170         $test -f /dnix && osname=dnix
2171         $test -f /lynx.os && osname=lynxos
2172         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2173         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2174         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2175         $test -f /bin/mips && /bin/mips && osname=mips
2176         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2177                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2178         $test -d /usr/apollo/bin && osname=apollo
2179         $test -f /etc/saf/_sactab && osname=svr4
2180         $test -d /usr/include/minix && osname=minix
2181         if $test -d /MachTen -o -d /MachTen_Folder; then
2182                 osname=machten
2183                 if $test -x /sbin/version; then
2184                         osvers=`/sbin/version | $awk '{print $2}' |
2185                         $sed -e 's/[A-Za-z]$//'`
2186                 elif $test -x /usr/etc/version; then
2187                         osvers=`/usr/etc/version | $awk '{print $2}' |
2188                         $sed -e 's/[A-Za-z]$//'`
2189                 else
2190                         osvers="$2.$3"
2191                 fi
2192         fi
2193
2194         $test -f /sys/posix.dll &&
2195                 $test -f /usr/bin/what &&
2196                 set X `/usr/bin/what /sys/posix.dll` &&
2197                 $test "$3" = UWIN &&
2198                 osname=uwin &&
2199                 osvers="$5"
2200
2201         if $test -f $uname; then
2202                 set X $myuname
2203                 shift
2204
2205                 case "$5" in
2206                 fps*) osname=fps ;;
2207                 mips*)
2208                         case "$4" in
2209                         umips) osname=umips ;;
2210                         *) osname=mips ;;
2211                         esac;;
2212                 [23]100) osname=mips ;;
2213                 next*) osname=next ;;
2214                 i386*)
2215                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2216                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2217                                 osname='sco'
2218                                 osvers=$tmp
2219                         elif $test -f /etc/kconfig; then
2220                                 osname=isc
2221                                 if test "$lns" = "$ln -s"; then
2222                                         osvers=4
2223                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2224                                         osvers=3
2225                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2226                                         osvers=2
2227                                 fi
2228                         fi
2229                         tmp=''
2230                         ;;
2231                 pc*)
2232                         if test -n "$DJGPP"; then
2233                                 osname=dos
2234                                 osvers=djgpp
2235                         fi
2236                         ;;
2237                 esac
2238
2239                 case "$1" in
2240                 aix) osname=aix
2241                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2242                         case "$tmp" in
2243                         'not found') osvers="$4"."$3" ;;
2244                         '<3240'|'<>3240') osvers=3.2.0 ;;
2245                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2246                         '=3250'|'>3250') osvers=3.2.5 ;;
2247                         *) osvers=$tmp;;
2248                         esac
2249                         ;;
2250                 bsd386) osname=bsd386
2251                         osvers=`$uname -r`
2252                         ;;
2253                 cygwin*) osname=cygwin
2254                         osvers="$3"
2255                         ;;
2256                 *dc.osx) osname=dcosx
2257                         osvers="$3"
2258                         ;;
2259                 dnix) osname=dnix
2260                         osvers="$3"
2261                         ;;
2262                 domainos) osname=apollo
2263                         osvers="$3"
2264                         ;;
2265                 dgux) osname=dgux 
2266                         osvers="$3"
2267                         ;;
2268                 dynixptx*) osname=dynixptx
2269                         osvers=`echo "$4"|sed 's/^v//'`
2270                         ;;
2271                 freebsd) osname=freebsd 
2272                         osvers="$3" ;;
2273                 genix) osname=genix ;;
2274                 hp*) osname=hpux 
2275                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2276                         ;;
2277                 irix*) osname=irix
2278                         case "$3" in
2279                         4*) osvers=4 ;;
2280                         5*) osvers=5 ;;
2281                         *)      osvers="$3" ;;
2282                         esac
2283                         ;;
2284                 linux) osname=linux
2285                         case "$3" in
2286                         *)      osvers="$3" ;;
2287                         esac
2288                         ;;
2289                 MiNT) osname=mint
2290                         ;;
2291                 netbsd*) osname=netbsd
2292                         osvers="$3"
2293                         ;;
2294                 news-os) osvers="$3"
2295                         case "$3" in
2296                         4*) osname=newsos4 ;;
2297                         *) osname=newsos ;;
2298                         esac
2299                         ;;
2300                 next*) osname=next ;;
2301                 POSIX-BC | posix-bc ) osname=posix-bc
2302                         osvers="$3"
2303                         ;;
2304                 powerux | power_ux | powermax_os | powermaxos | \
2305                 powerunix | power_unix) osname=powerux
2306                         osvers="$3"
2307                         ;;
2308                 qnx) osname=qnx
2309                         osvers="$4"
2310                         ;;
2311                 solaris) osname=solaris
2312                         case "$3" in
2313                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2314                         *)      osvers="$3" ;;
2315                         esac
2316                         ;;
2317                 sunos) osname=sunos
2318                         case "$3" in
2319                         5*) osname=solaris
2320                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2321                         *)      osvers="$3" ;;
2322                         esac
2323                         ;;
2324                 titanos) osname=titanos
2325                         case "$3" in
2326                         1*) osvers=1 ;;
2327                         2*) osvers=2 ;;
2328                         3*) osvers=3 ;;
2329                         4*) osvers=4 ;;
2330                         *)      osvers="$3" ;;
2331                         esac
2332                         ;;
2333                 ultrix) osname=ultrix
2334                         osvers="$3"
2335                         ;;
2336                 osf1|mls+)      case "$5" in
2337                                 alpha)
2338                                         osname=dec_osf
2339                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2340                                         ;;
2341                         hp*)    osname=hp_osf1  ;;
2342                         mips)   osname=mips_osf1 ;;
2343                         esac
2344                         ;;
2345                 unixware) osname=svr5
2346                         osvers="$4"
2347                         ;;
2348                 uts) osname=uts
2349                         osvers="$3"
2350                         ;;
2351                 $2) case "$osname" in
2352                         *isc*) ;;
2353                         *freebsd*) ;;
2354                         svr*)
2355                                 : svr4.x or possibly later
2356                                 case "svr$3" in 
2357                                 ${osname}*)
2358                                         osname=svr$3
2359                                         osvers=$4
2360                                         ;;
2361                                 esac
2362                                 case "$osname" in
2363                                 svr4.0)
2364                                         : Check for ESIX
2365                                         if test -f /stand/boot ; then
2366                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2367                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2368                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2369                                                         if test -n "$isesix"; then
2370                                                                 osname=esix4
2371                                                         fi
2372                                                 fi
2373                                         fi
2374                                         ;;
2375                                 esac
2376                                 ;;
2377                         *)      if test -f /etc/systemid; then
2378                                         osname=sco
2379                                         set `echo $3 | $sed 's/\./ /g'` $4
2380                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2381                                                 osvers=$1.$2.$3
2382                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2383                                                 osvers=$1.$2
2384                                         elif $test -f $src/hints/sco_$1.sh; then
2385                                                 osvers=$1
2386                                         fi
2387                                 else
2388                                         case "$osname" in
2389                                         '') : Still unknown.  Probably a generic Sys V.
2390                                                 osname="sysv"
2391                                                 osvers="$3"
2392                                                 ;;
2393                                         esac
2394                                 fi
2395                                 ;;
2396                         esac
2397                         ;;
2398                 *)      case "$osname" in
2399                         '') : Still unknown.  Probably a generic BSD.
2400                                 osname="$1"
2401                                 osvers="$3"
2402                                 ;;
2403                         esac
2404                         ;;
2405                 esac
2406         else
2407                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2408                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2409                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2410                                 osname=news_os
2411                         fi
2412                         $rm -f UU/kernel.what
2413                 elif test -d c:/.; then
2414                         set X $myuname
2415                         osname=os2
2416                         osvers="$5"
2417                 fi
2418         fi
2419         
2420         : Now look for a hint file osname_osvers, unless one has been
2421         : specified already.
2422         case "$hintfile" in
2423         ''|' ')
2424                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2425                 : Also try without trailing minor version numbers.
2426                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2427                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2428                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2429                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2430                 case "$file" in
2431                 '') dflt=none ;;
2432                 *)  case "$osvers" in
2433                         '') dflt=$file
2434                                 ;;
2435                         *)  if $test -f $src/hints/$file.sh ; then
2436                                         dflt=$file
2437                                 elif $test -f $src/hints/$xfile.sh ; then
2438                                         dflt=$xfile
2439                                 elif $test -f $src/hints/$xxfile.sh ; then
2440                                         dflt=$xxfile
2441                                 elif $test -f $src/hints/$xxxfile.sh ; then
2442                                         dflt=$xxxfile
2443                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2444                                         dflt=$xxxxfile
2445                                 elif $test -f "$src/hints/${osname}.sh" ; then
2446                                         dflt="${osname}"
2447                                 else
2448                                         dflt=none
2449                                 fi
2450                                 ;;
2451                         esac
2452                         ;;
2453                 esac
2454                 if $test -f Policy.sh ; then
2455                         case "$dflt" in
2456                         *Policy*) ;;
2457                         none) dflt="Policy" ;;
2458                         *) dflt="Policy $dflt" ;;
2459                         esac
2460                 fi
2461                 ;;
2462         *)
2463                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2464                 ;;
2465         esac
2466
2467         if $test -f Policy.sh ; then
2468                 $cat <<EOM
2469
2470 There's also a Policy hint file available, which should make the
2471 site-specific (policy) questions easier to answer.
2472 EOM
2473
2474         fi
2475
2476         $cat <<EOM
2477
2478 You may give one or more space-separated answers, or "none" if appropriate.
2479 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2480 is a good thing.  DO NOT give a wrong version or a wrong OS.
2481
2482 EOM
2483
2484         rp="Which of these apply, if any?"
2485         . UU/myread
2486         tans=$ans
2487         for file in $tans; do
2488                 if $test X$file = XPolicy -a -f Policy.sh; then
2489                         . Policy.sh
2490                         $cat Policy.sh >> UU/config.sh
2491                 elif $test -f $src/hints/$file.sh; then
2492                         . $src/hints/$file.sh
2493                         $cat $src/hints/$file.sh >> UU/config.sh
2494                 elif $test X$tans = X -o X$tans = Xnone ; then
2495                         : nothing
2496                 else
2497                         : Give one chance to correct a possible typo.
2498                         echo "$file.sh does not exist"
2499                         dflt=$file
2500                         rp="hint to use instead?"
2501                         . UU/myread
2502                         for file in $ans; do
2503                                 if $test -f "$src/hints/$file.sh"; then
2504                                         . $src/hints/$file.sh
2505                                         $cat $src/hints/$file.sh >> UU/config.sh
2506                                 elif $test X$ans = X -o X$ans = Xnone ; then
2507                                         : nothing
2508                                 else
2509                                         echo "$file.sh does not exist -- ignored."
2510                                 fi
2511                         done
2512                 fi
2513         done
2514
2515         hint=recommended
2516         : Remember our hint file for later.
2517         if $test -f "$src/hints/$file.sh" ; then
2518                 hintfile="$file"
2519         else
2520                 hintfile=''
2521         fi
2522 fi
2523 cd UU
2524 ;;
2525 *)
2526         echo " "
2527         echo "Fetching default answers from $config_sh..." >&4
2528         tmp_n="$n"
2529         tmp_c="$c"
2530         cd ..
2531         cp $config_sh config.sh 2>/dev/null
2532         chmod +w config.sh
2533         . ./config.sh
2534         cd UU
2535         cp ../config.sh .
2536         n="$tmp_n"
2537         c="$tmp_c"
2538         hint=previous
2539         ;;
2540 esac
2541 test "$override" && . ./optdef.sh
2542 myuname="$newmyuname"
2543
2544 : Restore computed paths
2545 for file in $loclist $trylist; do
2546         eval $file="\$_$file"
2547 done
2548
2549 cat << EOM
2550
2551 Configure uses the operating system name and version to set some defaults.
2552 The default value is probably right if the name rings a bell. Otherwise,
2553 since spelling matters for me, either accept the default or answer "none"
2554 to leave it blank.
2555
2556 EOM
2557 case "$osname" in
2558         ''|' ')
2559                 case "$hintfile" in
2560                 ''|' '|none) dflt=none ;;
2561                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2562                 esac
2563                 ;;
2564         *) dflt="$osname" ;;
2565 esac
2566 rp="Operating system name?"
2567 . ./myread
2568 case "$ans" in
2569 none)  osname='' ;;
2570 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2571 esac
2572 echo " "
2573 case "$osvers" in
2574         ''|' ')
2575                 case "$hintfile" in
2576                 ''|' '|none) dflt=none ;;
2577                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2578                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2579                         case "$dflt" in
2580                         ''|' ') dflt=none ;;
2581                         esac
2582                         ;;
2583                 esac
2584                 ;;
2585         *) dflt="$osvers" ;;
2586 esac
2587 rp="Operating system version?"
2588 . ./myread
2589 case "$ans" in
2590 none)  osvers='' ;;
2591 *) osvers="$ans" ;;
2592 esac
2593
2594
2595 . ./posthint.sh
2596
2597 : who configured the system
2598 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2599 cf_by=`(logname) 2>/dev/null`
2600 case "$cf_by" in
2601 "")
2602         cf_by=`(whoami) 2>/dev/null`
2603         case "$cf_by" in
2604         "") cf_by=unknown ;;
2605         esac ;;
2606 esac
2607
2608 : set up the script used to warn in case of inconsistency
2609 cat <<EOS >whoa
2610 $startsh
2611 EOS
2612 cat <<'EOSC' >>whoa
2613 dflt=y
2614 echo " "
2615 echo "*** WHOA THERE!!! ***" >&4
2616 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2617 rp="    Keep the $hint value?"
2618 . ./myread
2619 case "$ans" in
2620 y) td=$was; tu=$was;;
2621 esac
2622 EOSC
2623
2624 : function used to set $1 to $val
2625 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2626 case "$val$was" in
2627 $define$undef) . ./whoa; eval "$var=\$td";;
2628 $undef$define) . ./whoa; eval "$var=\$tu";;
2629 *) eval "$var=$val";;
2630 esac'
2631
2632 case "$usethreads" in
2633 $define|true|[yY]*)     dflt='y';;
2634 *) dflt='n';;
2635 esac
2636 cat <<EOM
2637
2638 Perl can be built to take advantage of threads on some systems.
2639 To do so, Configure can be run with -Dusethreads.
2640
2641 Note that threading is a highly experimental feature, and
2642 some known race conditions still remain.  If you choose to try
2643 it, be very sure to not actually deploy it for production
2644 purposes.  README.threads has more details, and is required
2645 reading if you enable threads.
2646
2647 If this doesn't make any sense to you, just accept the default '$dflt'.
2648 EOM
2649 rp='Build a threading Perl?'
2650 . ./myread
2651 case "$ans" in
2652 y|Y)    val="$define" ;;
2653 *)      val="$undef" ;;
2654 esac
2655 set usethreads
2656 eval $setvar
2657
2658 case "$usethreads" in
2659 $define)
2660         $cat <<EOM
2661
2662 As of 5.5.640, Perl has two different internal threading implementations,
2663 the 5.005 version (5005threads) and an interpreter-based version
2664 (ithreads) that has one interpreter per thread.  Both are very 
2665 experimental.  This arrangement exists to help developers work out
2666 which one is better.
2667
2668 If you're a casual user, you probably don't want interpreter-threads
2669 at this time.  There doesn't yet exist a way to create threads from
2670 within Perl in this model, i.e., "use Thread;" will NOT work.
2671 EOM
2672         : Default to ithreads unless overridden on command line or with
2673         : old config.sh
2674         dflt='y'
2675         case "$use5005threads" in
2676                 $define|true|[yY]*) dflt='n';;
2677         esac
2678         case "$useithreads" in
2679                 $undef|false|[nN]*) dflt='n';;
2680         esac
2681         rp='Use interpreter-based ithreads?'
2682         . ./myread
2683         case "$ans" in
2684         y|Y)    val="$define" ;;
2685         *)      val="$undef" ;;
2686         esac
2687         set useithreads
2688         eval $setvar
2689         : Now set use5005threads to the opposite value.
2690         case "$useithreads" in
2691         $define) val="$undef" ;;
2692         *) val="$define" ;;
2693         esac
2694         set use5005threads
2695         eval $setvar
2696         ;;
2697 *)
2698         useithreads="$undef"
2699         use5005threads="$undef"
2700         ;;
2701 esac
2702
2703 case "$d_oldpthreads" in
2704 '')     : Configure tests would be welcome here.  For now, assume undef.
2705         val="$undef" ;;
2706 *)      val="$d_oldpthreads" ;;
2707 esac
2708 set d_oldpthreads
2709 eval $setvar
2710
2711
2712 case "$usethreads" in
2713 "$define"|true|[yY]*)
2714 : Look for a hint-file generated 'call-back-unit'.  If the
2715 : user has specified that a threading perl is to be built,
2716 : we may need to set or change some other defaults.
2717         if $test -f usethreads.cbu; then
2718                 echo "Your platform has some specific hints for threaded builds, using them..."
2719                 . ./usethreads.cbu
2720         else
2721                 $cat <<EOM
2722 (Your platform doesn't have any specific hints for threaded builds.
2723  Assuming POSIX threads, then.)
2724 EOM
2725         fi
2726         ;;
2727 esac
2728
2729 cat <<EOM
2730
2731 Perl can be built so that multiple Perl interpreters can coexist
2732 within the same Perl executable.
2733 EOM
2734
2735 case "$useithreads" in
2736 $define)
2737         cat <<EOM
2738 This multiple interpreter support is required for interpreter-based threads.
2739 EOM
2740         val="$define"
2741         ;;
2742 *)      case "$usemultiplicity" in
2743         $define|true|[yY]*)     dflt='y';;
2744         *) dflt='n';;
2745         esac
2746         echo " "
2747         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2748         rp='Build Perl for multiplicity?'
2749         . ./myread
2750         case "$ans" in
2751         y|Y)    val="$define" ;;
2752         *)      val="$undef" ;;
2753         esac
2754         ;;
2755 esac
2756 set usemultiplicity
2757 eval $setvar
2758
2759 : determine where manual pages are on this system
2760 echo " "
2761 case "$sysman" in
2762 '') 
2763         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2764         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2765         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2766         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2767         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2768         sysman=`./loc . /usr/man/man1 $syspath`
2769         ;;
2770 esac
2771 if $test -d "$sysman"; then
2772         echo "System manual is in $sysman." >&4
2773 else
2774         echo "Could not find manual pages in source form." >&4
2775 fi
2776
2777 : see what memory models we can support
2778 case "$models" in
2779 '')
2780         $cat >pdp11.c <<'EOP'
2781 int main() {
2782 #ifdef pdp11
2783         exit(0);
2784 #else
2785         exit(1);
2786 #endif
2787 }
2788 EOP
2789         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2790         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2791                 dflt='unsplit split'
2792         else
2793                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2794                 case "$tans" in
2795                 X) dflt='none';;
2796                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2797                                 dflt='small'
2798                         else
2799                                 dflt=''
2800                         fi
2801                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2802                                 dflt="$dflt medium"
2803                         fi
2804                         if $test -d /lib/large || $test -d /usr/lib/large; then
2805                                 dflt="$dflt large"
2806                         fi
2807                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2808                                 dflt="$dflt huge"
2809                         fi
2810                 esac
2811         fi;;
2812 *) dflt="$models";;
2813 esac
2814 $cat <<EOM
2815  
2816 Some systems have different model sizes.  On most systems they are called
2817 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2818 split.  If your system doesn't support different memory models, say "none".
2819 If you wish to force everything to one memory model, say "none" here and
2820 put the appropriate flags later when it asks you for other cc and ld flags.
2821 Venix systems may wish to put "none" and let the compiler figure things out.
2822 (In the following question multiple model names should be space separated.)
2823
2824 The default for most systems is "none".
2825
2826 EOM
2827 rp="Which memory models are supported?"
2828 . ./myread
2829 models="$ans"
2830
2831 case "$models" in
2832 none)
2833         small=''
2834         medium=''
2835         large=''
2836         huge=''
2837         unsplit=''
2838         split=''
2839         ;;
2840 *split)
2841         case "$split" in
2842         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2843                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2844                         dflt='-i'
2845                 else
2846                         dflt='none'
2847                 fi;;
2848         *) dflt="$split";;
2849         esac
2850         rp="What flag indicates separate I and D space?"
2851         . ./myread
2852         tans="$ans"
2853         case "$tans" in
2854         none) tans='';;
2855         esac
2856         split="$tans"
2857         unsplit='';;
2858 *large*|*small*|*medium*|*huge*)
2859         case "$models" in
2860         *large*)
2861                 case "$large" in
2862                 '') dflt='-Ml';;
2863                 *) dflt="$large";;
2864                 esac
2865         rp="What flag indicates large model?"
2866         . ./myread
2867         tans="$ans"
2868         case "$tans" in
2869         none) tans='';
2870         esac
2871         large="$tans";;
2872         *) large='';;
2873         esac
2874         case "$models" in
2875         *huge*) case "$huge" in
2876                 '') dflt='-Mh';;
2877                 *) dflt="$huge";;
2878                 esac
2879                 rp="What flag indicates huge model?"
2880                 . ./myread
2881                 tans="$ans"
2882                 case "$tans" in
2883                 none) tans='';
2884                 esac
2885                 huge="$tans";;
2886         *) huge="$large";;
2887         esac
2888         case "$models" in
2889         *medium*) case "$medium" in
2890                 '') dflt='-Mm';;
2891                 *) dflt="$medium";;
2892                 esac
2893                 rp="What flag indicates medium model?"
2894                 . ./myread
2895                 tans="$ans"
2896                 case "$tans" in
2897                 none) tans='';
2898                 esac
2899                 medium="$tans";;
2900         *) medium="$large";;
2901         esac
2902         case "$models" in
2903         *small*) case "$small" in
2904                 '') dflt='none';;
2905                 *) dflt="$small";;
2906                 esac
2907                 rp="What flag indicates small model?"
2908                 . ./myread
2909                 tans="$ans"
2910                 case "$tans" in
2911                 none) tans='';
2912                 esac
2913                 small="$tans";;
2914         *) small='';;
2915         esac
2916         ;;
2917 *)
2918         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2919         ;;
2920 esac
2921 $rm -f pdp11.* pdp11
2922
2923 : make some quick guesses about what we are up against
2924 echo " "
2925 $echo $n "Hmm...  $c"
2926 echo exit 1 >bsd
2927 echo exit 1 >usg
2928 echo exit 1 >v7
2929 echo exit 1 >osf1
2930 echo exit 1 >eunice
2931 echo exit 1 >xenix
2932 echo exit 1 >venix
2933 echo exit 1 >os2
2934 d_bsd="$undef"
2935 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2936 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2937 then
2938         echo "Looks kind of like an OSF/1 system, but we'll see..."
2939         echo exit 0 >osf1
2940 elif test `echo abc | tr a-z A-Z` = Abc ; then
2941         xxx=`./loc addbib blurfl $pth`
2942         if $test -f $xxx; then
2943         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2944                 echo exit 0 >bsd
2945                 echo exit 0 >usg
2946         else
2947                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2948                         echo "Looks kind of like an extended USG system, but we'll see..."
2949                 else
2950                         echo "Looks kind of like a USG system, but we'll see..."
2951                 fi
2952                 echo exit 0 >usg
2953         fi
2954 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2955         echo "Looks kind of like a BSD system, but we'll see..."
2956         d_bsd="$define"
2957         echo exit 0 >bsd
2958 else
2959         echo "Looks kind of like a Version 7 system, but we'll see..."
2960         echo exit 0 >v7
2961 fi
2962 case "$eunicefix" in
2963 *unixtovms*)
2964         $cat <<'EOI'
2965 There is, however, a strange, musty smell in the air that reminds me of
2966 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2967 EOI
2968         echo exit 0 >eunice
2969         d_eunice="$define"
2970 : it so happens the Eunice I know will not run shell scripts in Unix format
2971         ;;
2972 *)
2973         echo " "
2974         echo "Congratulations.  You aren't running Eunice."
2975         d_eunice="$undef"
2976         ;;
2977 esac
2978 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2979 case "$p_" in
2980 :) ;;
2981 *)
2982         $cat <<'EOI'
2983 I have the feeling something is not exactly right, however...don't tell me...
2984 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2985 EOI
2986         echo exit 0 >os2
2987         ;;
2988 esac
2989 if test -f /xenix; then
2990         echo "Actually, this looks more like a XENIX system..."
2991         echo exit 0 >xenix
2992         d_xenix="$define"
2993 else
2994         echo " "
2995         echo "It's not Xenix..."
2996         d_xenix="$undef"
2997 fi
2998 chmod +x xenix
2999 $eunicefix xenix
3000 if test -f /venix; then
3001         echo "Actually, this looks more like a VENIX system..."
3002         echo exit 0 >venix
3003 else
3004         echo " "
3005         if ./xenix; then
3006                 : null
3007         else
3008                 echo "Nor is it Venix..."
3009         fi
3010 fi
3011 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3012 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3013 $rm -f foo
3014
3015 : see if we need a special compiler
3016 echo " "
3017 if ./usg; then
3018         case "$cc" in
3019         '') case "$Mcc" in
3020                 /*) dflt='Mcc';;
3021                 *) case "$large" in
3022                         -M*) dflt='cc';;
3023                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3024                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3025                                                 dflt='cc'
3026                                         else
3027                                                 dflt='cc -M'
3028                                         fi
3029                                 else
3030                                         dflt='cc'
3031                                 fi;;
3032                         esac;;
3033                 esac;;
3034         *)  dflt="$cc";;
3035         esac
3036         case "$dflt" in
3037         *M*)    $cat <<'EOM'
3038 On some older systems the default C compiler will not resolve multiple global
3039 references that happen to have the same name.  On some such systems the "Mcc"
3040 command may be used to force these to be resolved.  On other systems a "cc -M"
3041 command is required.  (Note that the -M flag on other systems indicates a
3042 memory model to use!) If you have the Gnu C compiler, you might wish to use
3043 that instead.
3044
3045 EOM
3046         ;;
3047         esac
3048         rp="Use which C compiler?"
3049         . ./myread
3050         cc="$ans"
3051 else
3052         case "$cc" in
3053         '') dflt=cc;;
3054         *) dflt="$cc";;
3055         esac
3056         rp="Use which C compiler?"
3057         . ./myread
3058         cc="$ans"
3059 fi
3060 : Look for a hint-file generated 'call-back-unit'.  Now that the
3061 : user has specified the compiler, we may need to set or change some
3062 : other defaults.
3063 if $test -f cc.cbu; then
3064     . ./cc.cbu
3065 fi
3066 echo " "
3067 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3068 $cat >gccvers.c <<EOM
3069 #include <stdio.h>
3070 int main() {
3071 #ifdef __GNUC__
3072 #ifdef __VERSION__
3073         printf("%s\n", __VERSION__);
3074 #else
3075         printf("%s\n", "1");
3076 #endif
3077 #endif
3078         exit(0);
3079 }
3080 EOM
3081 if $cc $ldflags -o gccvers gccvers.c; then
3082         gccversion=`./gccvers`
3083         case "$gccversion" in
3084         '') echo "You are not using GNU cc." ;;
3085         *)  echo "You are using GNU cc $gccversion."
3086             ;;
3087         esac
3088 else
3089         echo " "
3090         echo "*** WHOA THERE!!! ***" >&4
3091         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3092         case "$knowitall" in
3093         '')
3094         echo "    You'd better start hunting for one and let me know about it." >&4
3095                 exit 1
3096                 ;;
3097         esac
3098 fi
3099 $rm -f gccvers*
3100 case "$gccversion" in
3101 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3102 esac
3103
3104 : decide how portable to be.  Allow command line overrides.
3105 case "$d_portable" in
3106 "$undef") ;;
3107 *)      d_portable="$define" ;;
3108 esac
3109
3110 : set up shell script to do ~ expansion
3111 cat >filexp <<EOSS
3112 $startsh
3113 : expand filename
3114 case "\$1" in
3115  ~/*|~)
3116         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3117         ;;
3118  ~*)
3119         if $test -f /bin/csh; then
3120                 /bin/csh -f -c "glob \$1"
3121                 failed=\$?
3122                 echo ""
3123                 exit \$failed
3124         else
3125                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3126                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3127                 if $test ! -d "\$dir"; then
3128                         me=\`basename \$0\`
3129                         echo "\$me: can't locate home directory for: \$name" >&2
3130                         exit 1
3131                 fi
3132                 case "\$1" in
3133                 */*)
3134                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3135                         ;;
3136                 *)
3137                         echo \$dir
3138                         ;;
3139                 esac
3140         fi
3141         ;;
3142 *)
3143         echo \$1
3144         ;;
3145 esac
3146 EOSS
3147 chmod +x filexp
3148 $eunicefix filexp
3149
3150 : now set up to get a file name
3151 cat <<EOS >getfile
3152 $startsh
3153 EOS
3154 cat <<'EOSC' >>getfile
3155 tilde=''
3156 fullpath=''
3157 already=''
3158 skip=''
3159 none_ok=''
3160 exp_file=''
3161 nopath_ok=''
3162 orig_rp="$rp"
3163 orig_dflt="$dflt"
3164 case "$gfpth" in
3165 '') gfpth='.' ;;
3166 esac
3167
3168 case "$fn" in
3169 *\(*)
3170         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3171         fn=`echo $fn | sed 's/(.*)//'`
3172         ;;
3173 esac
3174
3175 case "$fn" in
3176 *:*)
3177         loc_file=`expr $fn : '.*:\(.*\)'`
3178         fn=`expr $fn : '\(.*\):.*'`
3179         ;;
3180 esac
3181
3182 case "$fn" in
3183 *~*) tilde=true;;
3184 esac
3185 case "$fn" in
3186 */*) fullpath=true;;
3187 esac
3188 case "$fn" in
3189 *+*) skip=true;;
3190 esac
3191 case "$fn" in
3192 *n*) none_ok=true;;
3193 esac
3194 case "$fn" in
3195 *e*) exp_file=true;;
3196 esac
3197 case "$fn" in
3198 *p*) nopath_ok=true;;
3199 esac
3200
3201 case "$fn" in
3202 *f*) type='File';;
3203 *d*) type='Directory';;
3204 *l*) type='Locate';;
3205 esac
3206
3207 what="$type"
3208 case "$what" in
3209 Locate) what='File';;
3210 esac
3211
3212 case "$exp_file" in
3213 '')
3214         case "$d_portable" in
3215         "$define") ;;
3216         *) exp_file=true;;
3217         esac
3218         ;;
3219 esac
3220
3221 cd ..
3222 while test "$type"; do
3223         redo=''
3224         rp="$orig_rp"
3225         dflt="$orig_dflt"
3226         case "$tilde" in
3227         true) rp="$rp (~name ok)";;
3228         esac
3229         . UU/myread
3230         if test -f UU/getfile.ok && \
3231                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3232         then
3233                 value="$ans"
3234                 ansexp="$ans"
3235                 break
3236         fi
3237         case "$ans" in
3238         none)
3239                 value=''
3240                 ansexp=''
3241                 case "$none_ok" in
3242                 true) type='';;
3243                 esac
3244                 ;;
3245         *)
3246                 case "$tilde" in
3247                 '') value="$ans"
3248                         ansexp="$ans";;
3249                 *)
3250                         value=`UU/filexp $ans`
3251                         case $? in
3252                         0)
3253                                 if test "$ans" != "$value"; then
3254                                         echo "(That expands to $value on this system.)"
3255                                 fi
3256                                 ;;
3257                         *) value="$ans";;
3258                         esac
3259                         ansexp="$value"
3260                         case "$exp_file" in
3261                         '') value="$ans";;
3262                         esac
3263                         ;;
3264                 esac
3265                 case "$fullpath" in
3266                 true)
3267                         case "$ansexp" in
3268                         /*) value="$ansexp" ;;
3269                         *)
3270                                 redo=true
3271                                 case "$already" in
3272                                 true)
3273                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3274                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3275                                         ;;
3276                                 *)
3277                                 echo "Please give a full path name, starting with slash." >&4
3278                                         case "$tilde" in
3279                                         true)
3280                                 echo "Note that using ~name is ok provided it expands well." >&4
3281                                                 already=true
3282                                                 ;;
3283                                         esac
3284                                 esac
3285                                 ;;
3286                         esac
3287                         ;;
3288                 esac
3289                 case "$redo" in
3290                 '')
3291                         case "$type" in
3292                         File)
3293                                 for fp in $gfpth; do
3294                                         if test "X$fp" = X.; then
3295                                             pf="$ansexp"
3296                                         else    
3297                                             pf="$fp/$ansexp"
3298                                         fi
3299                                         if test -f "$pf"; then
3300                                                 type=''
3301                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3302                                         then
3303                                                 echo "($value is not a plain file, but that's ok.)"
3304                                                 type=''
3305                                         fi
3306                                         if test X"$type" = X; then
3307                                             value="$pf"
3308                                             break
3309                                         fi
3310                                 done
3311                                 ;;
3312                         Directory)
3313                                 for fp in $gfpth; do
3314                                         if test "X$fp" = X.; then
3315                                             dir="$ans"
3316                                             direxp="$ansexp"
3317                                         else    
3318                                             dir="$fp/$ansexp"
3319                                             direxp="$fp/$ansexp"
3320                                         fi
3321                                         if test -d "$direxp"; then
3322                                                 type=''
3323                                                 value="$dir"
3324                                                 break
3325                                         fi
3326                                 done
3327                                 ;;
3328                         Locate)
3329                                 if test -d "$ansexp"; then
3330                                         echo "(Looking for $loc_file in directory $value.)"
3331                                         value="$value/$loc_file"
3332                                         ansexp="$ansexp/$loc_file"
3333                                 fi
3334                                 if test -f "$ansexp"; then
3335                                         type=''
3336                                 fi
3337                                 case "$nopath_ok" in
3338                                 true)   case "$value" in
3339                                         */*) ;;
3340                                         *)      echo "Assuming $value will be in people's path."
3341                                                 type=''
3342                                                 ;;
3343                                         esac
3344                                         ;;
3345                                 esac
3346                                 ;;
3347                         esac
3348
3349                         case "$skip" in
3350                         true) type='';
3351                         esac
3352
3353                         case "$type" in
3354                         '') ;;
3355                         *)
3356                                 if test "$fastread" = yes; then
3357                                         dflt=y
3358                                 else
3359                                         dflt=n
3360                                 fi
3361                                 rp="$what $value doesn't exist.  Use that name anyway?"
3362                                 . UU/myread
3363                                 dflt=''
3364                                 case "$ans" in
3365                                 y*) type='';;
3366                                 *) echo " ";;
3367                                 esac
3368                                 ;;
3369                         esac
3370                         ;;
3371                 esac
3372                 ;;
3373         esac
3374 done
3375 cd UU
3376 ans="$value"
3377 rp="$orig_rp"
3378 dflt="$orig_dflt"
3379 rm -f getfile.ok
3380 test "X$gfpthkeep" != Xy && gfpth=""
3381 EOSC
3382
3383 : What should the include directory be ?
3384 echo " "
3385 $echo $n "Hmm...  $c"
3386 dflt='/usr/include'
3387 incpath=''
3388 mips_type=''
3389 if $test -f /bin/mips && /bin/mips; then
3390         echo "Looks like a MIPS system..."
3391         $cat >usr.c <<'EOCP'
3392 #ifdef SYSTYPE_BSD43
3393 /bsd43
3394 #endif
3395 EOCP
3396         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3397                 dflt='/bsd43/usr/include'
3398                 incpath='/bsd43'
3399                 mips_type='BSD 4.3'
3400         else
3401                 mips_type='System V'
3402         fi
3403         $rm -f usr.c usr.out
3404         echo "and you're compiling with the $mips_type compiler and libraries."
3405         xxx_prompt=y
3406         echo "exit 0" >mips
3407 else
3408         echo "Doesn't look like a MIPS system."
3409         xxx_prompt=n
3410         echo "exit 1" >mips
3411 fi
3412 chmod +x mips
3413 $eunicefix mips
3414 case "$usrinc" in
3415 '') ;;
3416 *) dflt="$usrinc";;
3417 esac
3418 case "$xxx_prompt" in
3419 y)      fn=d/
3420         echo " "
3421         rp='Where are the include files you want to use?'
3422         . ./getfile
3423         usrinc="$ans"
3424         ;;
3425 *)      usrinc="$dflt"
3426         ;;
3427 esac
3428
3429 : see how we invoke the C preprocessor
3430 echo " "
3431 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3432 cat <<'EOT' >testcpp.c
3433 #define ABC abc
3434 #define XYZ xyz
3435 ABC.XYZ
3436 EOT
3437 cd ..
3438 if test ! -f cppstdin; then
3439         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3440                 # AIX cc -E doesn't show the absolute headerfile
3441                 # locations but we'll cheat by using the -M flag.
3442                 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
3443         else
3444                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3445         fi
3446 else
3447         echo "Keeping your $hint cppstdin wrapper."
3448 fi
3449 chmod 755 cppstdin
3450 wrapper=`pwd`/cppstdin
3451 ok='false'
3452 cd UU
3453
3454 if $test "X$cppstdin" != "X" && \
3455         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3456         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3457 then
3458         echo "You used to use $cppstdin $cppminus so we'll use that again."
3459         case "$cpprun" in
3460         '') echo "But let's see if we can live without a wrapper..." ;;
3461         *)
3462                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3463                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3464                 then
3465                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3466                         ok='true'
3467                 else
3468                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3469                 fi
3470                 ;;
3471         esac
3472 else
3473         case "$cppstdin" in
3474         '') ;;
3475         *)
3476                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3477                 ;;
3478         esac
3479 fi
3480
3481 if $ok; then
3482         : nothing
3483 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3484         $cc -E <testcpp.c >testcpp.out 2>&1; \
3485         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3486         echo "Yup, it does."
3487         x_cpp="$cc -E"
3488         x_minus='';
3489 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3490         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3491         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3492         echo "Yup, it does."
3493         x_cpp="$cc -E"
3494         x_minus='-';
3495 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3496         $cc -P <testcpp.c >testcpp.out 2>&1; \
3497         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3498         echo "Yipee, that works!"
3499         x_cpp="$cc -P"
3500         x_minus='';
3501 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3502         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3503         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3504         echo "At long last!"
3505         x_cpp="$cc -P"
3506         x_minus='-';
3507 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3508         $cpp <testcpp.c >testcpp.out 2>&1; \
3509         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3510         echo "It works!"
3511         x_cpp="$cpp"
3512         x_minus='';
3513 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3514         $cpp - <testcpp.c >testcpp.out 2>&1; \
3515         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3516         echo "Hooray, it works!  I was beginning to wonder."
3517         x_cpp="$cpp"
3518         x_minus='-';
3519 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3520         $wrapper <testcpp.c >testcpp.out 2>&1; \
3521         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3522         x_cpp="$wrapper"
3523         x_minus=''
3524         echo "Eureka!"
3525 else
3526         dflt=''
3527         rp="No dice.  I can't find a C preprocessor.  Name one:"
3528         . ./myread
3529         x_cpp="$ans"
3530         x_minus=''
3531         $x_cpp <testcpp.c >testcpp.out 2>&1
3532         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3533                 echo "OK, that will do." >&4
3534         else
3535 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3536                 exit 1
3537         fi
3538 fi
3539
3540 case "$ok" in
3541 false)
3542         cppstdin="$x_cpp"
3543         cppminus="$x_minus"
3544         cpprun="$x_cpp"
3545         cpplast="$x_minus"
3546         set X $x_cpp
3547         shift
3548         case "$1" in
3549         "$cpp")
3550                 echo "Perhaps can we force $cc -E using a wrapper..."
3551                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3552                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3553                 then
3554                         echo "Yup, we can."
3555                         cppstdin="$wrapper"
3556                         cppminus='';
3557                 else
3558                         echo "Nope, we'll have to live without it..."
3559                 fi
3560                 ;;
3561         esac
3562         case "$cpprun" in
3563         "$wrapper")
3564                 cpprun=''
3565                 cpplast=''
3566                 ;;
3567         esac
3568         ;;
3569 esac
3570
3571 case "$cppstdin" in
3572 "$wrapper"|'cppstdin') ;;
3573 *) $rm -f $wrapper;;
3574 esac
3575 $rm -f testcpp.c testcpp.out
3576
3577 : Set private lib path
3578 case "$plibpth" in
3579 '') if ./mips; then
3580                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3581         fi;;
3582 esac
3583 case "$libpth" in
3584 ' ') dlist='';;
3585 '') dlist="$loclibpth $plibpth $glibpth";;
3586 *) dlist="$libpth";;
3587 esac
3588
3589 : Now check and see which directories actually exist, avoiding duplicates
3590 libpth=''
3591 for xxx in $dlist
3592 do
3593     if $test -d $xxx; then
3594                 case " $libpth " in
3595                 *" $xxx "*) ;;
3596                 *) libpth="$libpth $xxx";;
3597                 esac
3598     fi
3599 done
3600 $cat <<'EOM'
3601
3602 Some systems have incompatible or broken versions of libraries.  Among
3603 the directories listed in the question below, please remove any you
3604 know not to be holding relevant libraries, and add any that are needed.
3605 Say "none" for none.
3606
3607 EOM
3608 case "$libpth" in
3609 '') dflt='none';;
3610 *)
3611         set X $libpth
3612         shift
3613         dflt=${1+"$@"}
3614         ;;
3615 esac
3616 rp="Directories to use for library searches?"
3617 . ./myread
3618 case "$ans" in
3619 none) libpth=' ';;
3620 *) libpth="$ans";;
3621 esac
3622
3623 : compute shared library extension
3624 case "$so" in
3625 '')
3626         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3627                 dflt='sl'
3628         else
3629                 dflt='so'
3630         fi
3631         ;;
3632 *) dflt="$so";;
3633 esac
3634 $cat <<EOM
3635
3636 On some systems, shared libraries may be available.  Answer 'none' if
3637 you want to suppress searching of shared libraries for the remainder
3638 of this configuration.
3639
3640 EOM
3641 rp='What is the file extension used for shared libraries?'
3642 . ./myread
3643 so="$ans"
3644
3645 : Define several unixisms.
3646 : Hints files or command line option can be used to override them.
3647 : The convoluted testing is in case hints files set either the old
3648 : or the new name.
3649 case "$_exe" in
3650 '')     case "$exe_ext" in
3651     '') ;;
3652         *)      _exe="$exe_ext" ;;
3653         esac
3654         ;;
3655 esac
3656 case "$_a" in
3657 '')     case "$lib_ext" in
3658     '') _a='.a';;
3659         *)      _a="$lib_ext" ;;
3660         esac
3661         ;;
3662 esac
3663 case "$_o" in
3664 '') case "$obj_ext" in
3665         '')     _o='.o';;
3666         *)      _o="$obj_ext";;
3667         esac
3668         ;;
3669 esac
3670 case "$p_" in
3671 '') case "$path_sep" in
3672         '')     p_=':';;
3673         *)      p_="$path_sep";;
3674         esac
3675         ;;
3676 esac
3677 exe_ext=$_exe
3678 lib_ext=$_a
3679 obj_ext=$_o
3680 path_sep=$p_
3681
3682 : Which makefile gets called first.  This is used by make depend.
3683 case "$firstmakefile" in
3684 '') firstmakefile='makefile';;
3685 esac
3686
3687 case "$usesocks" in
3688 $define|true|[yY]*)     dflt='y';;
3689 *) dflt='n';;
3690 esac
3691 cat <<EOM
3692
3693 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3694 Configure must be run with -Dusesocks.
3695
3696 If this doesn't make any sense to you, just accept the default '$dflt'.
3697 EOM
3698 rp='Build Perl for SOCKS?'
3699 . ./myread
3700 case "$ans" in
3701 y|Y)    val="$define" ;;     
3702 *)      val="$undef" ;;
3703 esac
3704 set usesocks
3705 eval $setvar
3706
3707 : Looking for optional libraries
3708 echo " "
3709 echo "Checking for optional libraries..." >&4
3710 case "$libs" in
3711 ' '|'') dflt='';;
3712 *) dflt="$libs";;
3713 esac
3714 case "$libswanted" in
3715 '') libswanted='c_s';;
3716 esac
3717 case "$usesocks" in
3718 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3719 esac
3720 libsfound=''
3721 libsfiles=''
3722 libsdirs=''
3723 libspath=''
3724 for thisdir in $libpth $xlibpth; do
3725   test -d $thisdir && libspath="$libspath $thisdir"
3726 done
3727 for thislib in $libswanted; do
3728         for thisdir in $libspath; do
3729             xxx=''
3730             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3731                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3732                 $test -f "$xxx" && eval $libscheck
3733                 $test -f "$xxx" && libstyle=shared
3734             fi
3735             if test ! -f "$xxx"; then
3736                 xxx=$thisdir/lib$thislib.$so
3737                 $test -f "$xxx" && eval $libscheck
3738                 $test -f "$xxx" && libstyle=shared
3739             fi  
3740             if test ! -f "$xxx"; then
3741                 xxx=$thisdir/lib$thislib$_a
3742                 $test -f "$xxx" && eval $libscheck
3743                 $test -f "$xxx" && libstyle=static
3744             fi
3745             if test ! -f "$xxx"; then
3746                 xxx=$thisdir/$thislib$_a
3747                 $test -f "$xxx" && eval $libscheck
3748                 $test -f "$xxx" && libstyle=static
3749             fi
3750             if test ! -f "$xxx"; then
3751                 xxx=$thisdir/lib${thislib}_s$_a
3752                 $test -f "$xxx" && eval $libscheck
3753                 $test -f "$xxx" && libstyle=static
3754                 $test -f "$xxx" && thislib=${thislib}_s
3755             fi
3756             if test ! -f "$xxx"; then
3757                 xxx=$thisdir/Slib$thislib$_a
3758                 $test -f "$xxx" && eval $libscheck
3759                 $test -f "$xxx" && libstyle=static
3760             fi
3761             if $test -f "$xxx"; then
3762                 case "$libstyle" in
3763                 shared) echo "Found -l$thislib (shared)." ;;
3764                 static) echo "Found -l$thislib." ;;
3765                 *)      echo "Found -l$thislib ($libstyle)." ;;
3766                 esac
3767                 case " $dflt " in
3768                 *"-l$thislib "*);;
3769                 *) dflt="$dflt -l$thislib"
3770                    libsfound="$libsfound $xxx"
3771                    yyy=`basename $xxx`
3772                    libsfiles="$libsfiles $yyy"
3773                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3774                    case " $libsdirs " in
3775                    *" $yyy "*) ;;
3776                    *) libsdirs="$libsdirs $yyy" ;;
3777                    esac
3778                    ;;
3779                 esac
3780                 break
3781             fi  
3782         done
3783         if $test ! -f "$xxx"; then
3784             echo "No -l$thislib."
3785         fi
3786 done
3787 set X $dflt
3788 shift
3789 dflt="$*"
3790 case "$libs" in
3791 '') dflt="$dflt";;
3792 *) dflt="$libs";;
3793 esac
3794 case "$dflt" in
3795 ' '|'') dflt='none';;
3796 esac
3797
3798 $cat <<EOM
3799
3800 In order to compile $package on your machine, a number of libraries
3801 are usually needed.  Include any other special libraries here as well.
3802 Say "none" for none.  The default list is almost always right.
3803 EOM
3804
3805 echo " "
3806 rp="What libraries to use?"
3807 . ./myread
3808 case "$ans" in
3809 none) libs=' ';;
3810 *) libs="$ans";;
3811 esac
3812
3813 : determine optimization, if desired, or use for debug flag also
3814 case "$optimize" in
3815 ' '|$undef) dflt='none';;
3816 '') dflt='-O';;
3817 *) dflt="$optimize";;
3818 esac
3819 $cat <<EOH
3820
3821 By default, $package compiles with the -O flag to use the optimizer.
3822 Alternately, you might want to use the symbolic debugger, which uses
3823 the -g flag (on traditional Unix systems).  Either flag can be
3824 specified here.  To use neither flag, specify the word "none".
3825
3826 EOH
3827 rp="What optimizer/debugger flag should be used?"
3828 . ./myread
3829 optimize="$ans"
3830 case "$optimize" in
3831 'none') optimize=" ";;
3832 esac
3833
3834 dflt=''
3835 : We will not override a previous value, but we might want to
3836 : augment a hint file
3837 case "$hint" in
3838 default|recommended)
3839         case "$gccversion" in
3840         1*) dflt='-fpcc-struct-return' ;;
3841         esac
3842         case "$optimize" in
3843         *-g*) dflt="$dflt -DDEBUGGING";;
3844         esac
3845         case "$gccversion" in
3846         2*) if test -d /etc/conf/kconfig.d &&
3847                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3848                 then
3849                         dflt="$dflt -posix"
3850                 fi
3851                 ;;
3852         esac
3853         case "$gccversion" in
3854         1*) ;;
3855         2.[0-8]*) ;;
3856         ?*)     echo " "
3857                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3858                 echo 'int main(void) { return 0; }' > gcctest.c
3859                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3860                         echo "Yes, it does." 2>&1
3861                         case "$ccflags" in
3862                         *strict-aliasing*) 
3863                                 echo "Leaving current flags $ccflags alone." 2>&1
3864                                 ;;
3865                         *) dflt="$dflt -fno-strict-aliasing" ;;
3866                         esac
3867                 else
3868                         echo "Nope, it doesn't, but that's ok." 2>&1
3869                 fi
3870                 ;;
3871         esac
3872         ;;
3873 esac
3874
3875 case "$mips_type" in
3876 *BSD*|'') inclwanted="$locincpth $usrinc";;
3877 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3878 esac
3879 for thisincl in $inclwanted; do
3880         if $test -d $thisincl; then
3881                 if $test x$thisincl != x$usrinc; then
3882                         case "$dflt" in
3883                         *$thisincl*);;
3884                         *) dflt="$dflt -I$thisincl";;
3885                         esac
3886                 fi
3887         fi
3888 done
3889
3890 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3891         xxx=true;
3892 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3893         xxx=true;
3894 else
3895         xxx=false;
3896 fi;
3897 if $xxx; then
3898         case "$dflt" in
3899         *$2*);;
3900         *) dflt="$dflt -D$2";;
3901         esac;
3902 fi'
3903
3904 set signal.h LANGUAGE_C; eval $inctest
3905
3906 case "$usesocks" in
3907 $define)
3908         ccflags="$ccflags -DSOCKS"
3909         ;;
3910 esac
3911
3912 case "$hint" in
3913 default|recommended) dflt="$ccflags $dflt" ;;
3914 *) dflt="$ccflags";;
3915 esac
3916
3917 case "$dflt" in
3918 ''|' ') dflt=none;;
3919 esac
3920 $cat <<EOH
3921
3922 Your C compiler may want other flags.  For this question you should include
3923 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3924 but you should NOT include libraries or ld flags like -lwhatever.  If you
3925 want $package to honor its debug switch, you should include -DDEBUGGING here.
3926 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3927
3928 To use no flags, specify the word "none".
3929
3930 EOH
3931 set X $dflt
3932 shift
3933 dflt=${1+"$@"}
3934 rp="Any additional cc flags?"
3935 . ./myread
3936 case "$ans" in
3937 none) ccflags='';;
3938 *) ccflags="$ans";;
3939 esac
3940
3941 : the following weeds options from ccflags that are of no interest to cpp
3942 cppflags="$ccflags"
3943 case "$gccversion" in
3944 1*) cppflags="$cppflags -D__GNUC__"
3945 esac
3946 case "$mips_type" in
3947 '');;
3948 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3949 esac
3950 case "$cppflags" in
3951 '');;
3952 *)
3953         echo " "
3954         echo "Let me guess what the preprocessor flags are..." >&4
3955         set X $cppflags
3956         shift
3957         cppflags=''
3958         $cat >cpp.c <<'EOM'
3959 #define BLURFL foo
3960
3961 BLURFL xx LFRULB
3962 EOM
3963         previous=''
3964         for flag in $*
3965         do
3966                 case "$flag" in
3967                 -*) ftry="$flag";;
3968                 *) ftry="$previous $flag";;
3969                 esac
3970                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3971                         >cpp1.out 2>/dev/null && \
3972                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3973                         >cpp2.out 2>/dev/null && \
3974                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3975                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3976                 then
3977                         cppflags="$cppflags $ftry"
3978                         previous=''
3979                 else
3980                         previous="$flag"
3981                 fi
3982         done
3983         set X $cppflags
3984         shift
3985         cppflags=${1+"$@"}
3986         case "$cppflags" in
3987         *-*)  echo "They appear to be: $cppflags";;
3988         esac
3989         $rm -f cpp.c cpp?.out
3990         ;;
3991 esac
3992
3993 : flags used in final linking phase
3994 case "$ldflags" in
3995 '') if ./venix; then
3996                 dflt='-i -z'
3997         else
3998                 dflt=''
3999         fi
4000         case "$ccflags" in
4001         *-posix*) dflt="$dflt -posix" ;;
4002         esac
4003         ;;
4004 *) dflt="$ldflags";;
4005 esac
4006
4007 : Try to guess additional flags to pick up local libraries.
4008 for thislibdir in $libpth; do
4009         case " $loclibpth " in
4010         *" $thislibdir "*)
4011                 case "$dflt " in 
4012                 *"-L$thislibdir "*) ;;
4013                 *)  dflt="$dflt -L$thislibdir" ;;
4014                 esac
4015                 ;;
4016         esac
4017 done
4018
4019 case "$dflt" in
4020 '') dflt='none' ;;
4021 esac
4022
4023 $cat <<EOH
4024
4025 Your C linker may need flags.  For this question you should
4026 include -L/whatever and any other flags used by the C linker, but you
4027 should NOT include libraries like -lwhatever.
4028
4029 Make sure you include the appropriate -L/path flags if your C linker
4030 does not normally search all of the directories you specified above,
4031 namely
4032         $libpth
4033 To use no flags, specify the word "none".
4034
4035 EOH
4036
4037 rp="Any additional ld flags (NOT including libraries)?"
4038 . ./myread
4039 case "$ans" in
4040 none) ldflags='';;
4041 *) ldflags="$ans";;
4042 esac
4043 rmlist="$rmlist pdp11"
4044
4045 : coherency check
4046 echo " "
4047 echo "Checking your choice of C compiler and flags for coherency..." >&4
4048 $cat > try.c <<'EOF'
4049 #include <stdio.h>
4050 int main() { printf("Ok\n"); exit(0); }
4051 EOF
4052 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4053 shift
4054 $cat >try.msg <<'EOM'
4055 I've tried to compile and run the following simple program:
4056
4057 EOM
4058 $cat try.c >> try.msg
4059
4060 $cat >> try.msg <<EOM
4061
4062 I used the command:
4063
4064         $*
4065         ./try
4066
4067 and I got the following output:
4068
4069 EOM
4070 dflt=y
4071 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4072         if sh -c './try' >>try.msg 2>&1; then
4073                 xxx=`./try`
4074                 case "$xxx" in
4075                 "Ok") dflt=n ;;
4076                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4077                         case " $libs " in
4078                         *" -lsfio "*)
4079                                 cat >> try.msg <<'EOQS'
4080 If $libs contains -lsfio, and sfio is mis-configured, then it
4081 sometimes (apparently) runs and exits with a 0 status, but with no
4082 output!  It may have to do with sfio's use of _exit vs. exit.
4083
4084 EOQS
4085                                 rp="You have a big problem.  Shall I abort Configure"
4086                                 dflt=y
4087                                 ;;
4088                         esac
4089                         ;;
4090                 esac
4091         else
4092                 echo "The program compiled OK, but exited with status $?." >>try.msg
4093                 rp="You have a problem.  Shall I abort Configure"
4094                 dflt=y
4095         fi
4096 else
4097         echo "I can't compile the test program." >>try.msg
4098         rp="You have a BIG problem.  Shall I abort Configure"
4099         dflt=y
4100 fi
4101 case "$dflt" in
4102 y)
4103         $cat try.msg >&4
4104         case "$knowitall" in
4105         '')
4106                 echo "(The supplied flags or libraries might be incorrect.)"
4107                 ;;
4108         *) dflt=n;;
4109         esac
4110         echo " "
4111         . ./myread
4112         case "$ans" in
4113         n*|N*) ;;
4114         *)      echo "Ok.  Stopping Configure." >&4
4115                 exit 1
4116                 ;;
4117         esac
4118         ;;
4119 n) echo "OK, that should do.";;
4120 esac
4121 $rm -f try try.* core
4122
4123 : define an is-a-typedef? function
4124 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4125 case "$inclist" in
4126 "") inclist="sys/types.h";;
4127 esac;
4128 eval "varval=\$$var";
4129 case "$varval" in
4130 "")
4131         $rm -f temp.c;
4132         for inc in $inclist; do
4133                 echo "#include <$inc>" >>temp.c;
4134         done;
4135         echo "#ifdef $type" >> temp.c;
4136         echo "printf(\"We have $type\");" >> temp.c;
4137         echo "#endif" >> temp.c;
4138         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4139         if $contains $type temp.E >/dev/null 2>&1; then
4140                 eval "$var=\$type";
4141         else
4142                 eval "$var=\$def";
4143         fi;
4144         $rm -f temp.?;;
4145 *) eval "$var=\$varval";;
4146 esac'
4147
4148 : define an is-a-typedef? function that prompts if the type is not available.
4149 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4150 case "$inclist" in
4151 "") inclist="sys/types.h";;
4152 esac;
4153 eval "varval=\$$var";
4154 case "$varval" in
4155 "")
4156         $rm -f temp.c;
4157         for inc in $inclist; do
4158                 echo "#include <$inc>" >>temp.c;
4159         done;
4160         echo "#ifdef $type" >> temp.c;
4161         echo "printf(\"We have $type\");" >> temp.c;
4162         echo "#endif" >> temp.c;
4163         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4164         echo " " ;
4165         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4166         if $contains $type temp.E >/dev/null 2>&1; then
4167                 echo "$type found." >&4;
4168                 eval "$var=\$type";
4169         else
4170                 echo "$type NOT found." >&4;
4171                 dflt="$def";
4172                 . ./myread ;
4173                 eval "$var=\$ans";
4174         fi;
4175         $rm -f temp.?;;
4176 *) eval "$var=\$varval";;
4177 esac'
4178
4179 : define a shorthand compile call
4180 compile='
4181 mc_file=$1;
4182 shift;
4183 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4184 : define a shorthand compile call for compilations that should be ok.
4185 compile_ok='
4186 mc_file=$1;
4187 shift;
4188 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4189
4190 : check for lengths of integral types
4191 echo " "
4192 case "$intsize" in
4193 '')
4194         echo "Checking to see how big your integers are..." >&4
4195         $cat >intsize.c <<'EOCP'
4196 #include <stdio.h>
4197 int main()
4198 {
4199         printf("intsize=%d;\n", (int)sizeof(int));
4200         printf("longsize=%d;\n", (int)sizeof(long));
4201         printf("shortsize=%d;\n", (int)sizeof(short));
4202         exit(0);
4203 }
4204 EOCP
4205         set intsize
4206         if eval $compile_ok && ./intsize > /dev/null; then
4207                 eval `./intsize`
4208                 echo "Your integers are $intsize bytes long."
4209                 echo "Your long integers are $longsize bytes long."
4210                 echo "Your short integers are $shortsize bytes long."
4211         else
4212                 $cat >&4 <<EOM
4213 !
4214 Help! I can't compile and run the intsize test program: please enlighten me!
4215 (This is probably a misconfiguration in your system or libraries, and
4216 you really ought to fix it.  Still, I'll try anyway.)
4217 !
4218 EOM
4219                 dflt=4
4220                 rp="What is the size of an integer (in bytes)?"
4221                 . ./myread
4222                 intsize="$ans"
4223                 dflt=$intsize
4224                 rp="What is the size of a long integer (in bytes)?"
4225                 . ./myread
4226                 longsize="$ans"
4227                 dflt=2
4228                 rp="What is the size of a short integer (in bytes)?"
4229                 . ./myread
4230                 shortsize="$ans"
4231         fi
4232         ;;
4233 esac
4234 $rm -f intsize intsize.*
4235
4236 : see what type lseek is declared as in the kernel
4237 rp="What is the type used for lseek's offset on this system?"
4238 set off_t lseektype long stdio.h sys/types.h
4239 eval $typedef_ask
4240
4241 echo " "
4242 echo "Checking to see how big your file offsets are..." >&4
4243 $cat >try.c <<EOCP
4244 #include <sys/types.h>
4245 #include <stdio.h>
4246 int main()
4247 {
4248     printf("%d\n", (int)sizeof($lseektype));
4249     return(0); 
4250 }
4251 EOCP
4252 set try
4253 if eval $compile_ok; then
4254         lseeksize=`./try`
4255         echo "Your file offsets are $lseeksize bytes long."
4256 else
4257         dflt=$longsize
4258         echo " "
4259         echo "(I can't seem to compile the test program.  Guessing...)"
4260         rp="What is the size of your file offsets (in bytes)?"
4261         . ./myread
4262         lseeksize="$ans"
4263 fi
4264 $rm -f try.c try
4265
4266 : see what type file positions are declared as in the library
4267 rp="What is the type for file position used by fsetpos()?"
4268 set fpos_t fpostype long stdio.h sys/types.h
4269 eval $typedef_ask
4270
4271 echo " "
4272 case "$fpostype" in
4273 *_t) zzz="$fpostype"    ;;
4274 *)   zzz="fpos_t"       ;;
4275 esac
4276 echo "Checking the size of $zzz..." >&4 
4277 cat > try.c <<EOCP
4278 #include <sys/types.h>
4279 #include <stdio.h>
4280 int main() {
4281     printf("%d\n", (int)sizeof($fpostype));
4282     exit(0);
4283 }
4284 EOCP
4285 set try
4286 if eval $compile_ok; then
4287         yyy=`./try`
4288         case "$yyy" in
4289         '')     fpossize=4
4290                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4291                 ;;
4292         *)      fpossize=$yyy
4293                 echo "Your $zzz is $fpossize bytes long."
4294                 ;;
4295         esac
4296 else
4297         dflt="$longsize"
4298         echo " " >&4
4299         echo "(I can't compile the test program.  Guessing...)" >&4
4300         rp="What is the size of your file positions (in bytes)?"
4301         . ./myread
4302         fpossize="$ans"
4303 fi
4304
4305
4306
4307 # Backward compatibility (uselfs is deprecated).
4308 case "$uselfs" in
4309 "$define"|true|[yY]*)
4310         cat <<EOM >&4
4311
4312 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4313 EOM
4314         uselargefiles="$define"
4315         ;;
4316 esac                          
4317
4318 case "$lseeksize:$fpossize" in
4319 8:8) cat <<EOM
4320
4321 You can have files larger than 2 gigabytes.
4322 EOM
4323    val="$define" ;;
4324 *)    case "$uselargefiles" in
4325    "$undef"|false|[nN]*) dflt='n' ;;
4326    *)   dflt='y' ;;
4327    esac
4328    cat <<EOM
4329
4330 Perl can be built to understand large files (files larger than 2 gigabytes)
4331 on some systems.  To do so, Configure can be run with -Duselargefiles.
4332
4333 If this doesn't make any sense to you, just accept the default '$dflt'.
4334 EOM
4335    rp='Try to understand large files, if available?'
4336    . ./myread
4337    case "$ans" in
4338    y|Y)         val="$define" ;;
4339    *)           val="$undef"  ;;
4340    esac
4341    ;;
4342 esac
4343 set uselargefiles
4344 eval $setvar
4345 case "$uselargefiles" in
4346 "$define")
4347 : Look for a hint-file generated 'call-back-unit'.  If the
4348 : user has specified that a large files perl is to be built,
4349 : we may need to set or change some other defaults.
4350         if $test -f uselargefiles.cbu; then
4351                 echo "Your platform has some specific hints for large file builds, using them..."
4352                 . ./uselargefiles.cbu
4353                 echo " "
4354                 echo "Rechecking to see how big your file offsets are..." >&4
4355                 $cat >try.c <<EOCP
4356 #include <sys/types.h>
4357 #include <stdio.h>
4358 int main()
4359 {
4360     printf("%d\n", (int)sizeof($lseektype));
4361     return(0); 
4362 }
4363 EOCP
4364                 set try
4365                 if eval $compile_ok; then
4366                         lseeksize=`./try`
4367                         $echo "Your file offsets are now $lseeksize bytes long."
4368                 else
4369                         dflt="$lseeksize"
4370                         echo " "
4371                         echo "(I can't seem to compile the test program.  Guessing...)"
4372                         rp="What is the size of your file offsets (in bytes)?"
4373                         . ./myread
4374                         lseeksize="$ans"
4375                 fi
4376                 case "$fpostype" in
4377                 *_t) zzz="$fpostype"    ;;
4378                 *)   zzz="fpos_t"       ;;
4379                 esac
4380                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4381                 $cat > try.c <<EOCP
4382 #include <sys/types.h>
4383 #include <stdio.h>
4384 int main() {
4385     printf("%d\n", (int)sizeof($fpostype));
4386     exit(0);
4387 }
4388 EOCP
4389                 set try
4390                 if eval $compile_ok; then
4391                         yyy=`./try`
4392                         dflt="$lseeksize"
4393                         case "$yyy" in
4394                         '')     echo " "
4395                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4396                                 ;;
4397                         *)      fpossize=$yyy
4398                                 echo " $fpossize bytes." >&4
4399                                 ;;
4400                         esac
4401                 else
4402                         dflt="$fpossize"
4403                         echo " "
4404                         echo "(I can't compile the test program.  Guessing...)" >&4
4405                         rp="What is the size of your file positions (in bytes)?"
4406                         . ./myread
4407                         fpossize="$ans"
4408                 fi
4409                 $rm -f try.c try
4410         fi
4411         ;;
4412 esac
4413
4414
4415 case "$usemorebits" in
4416 "$define"|true|[yY]*)
4417         use64bitint="$define"
4418         uselongdouble="$define"
4419         usemorebits="$define"
4420         ;;
4421 *)      usemorebits="$undef"
4422         ;;
4423 esac
4424
4425
4426 case "$uselonglong" in
4427 "$define"|true|[yY]*)
4428         cat <<EOM >&4
4429
4430 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4431 EOM
4432         use64bitint="$define"
4433         ;;
4434 esac                          
4435 case "$use64bits" in
4436 "$define"|true|[yY]*)
4437         cat <<EOM >&4
4438
4439 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4440 EOM
4441         use64bitint="$define"
4442         ;;
4443 esac                          
4444 case "$use64bitints" in
4445 "$define"|true|[yY]*)
4446         cat <<EOM >&4
4447
4448 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4449 EOM
4450         use64bitint="$define"
4451         ;;
4452 esac                          
4453 case "$use64bitsint" in
4454 "$define"|true|[yY]*)
4455         cat <<EOM >&4
4456
4457 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4458 EOM
4459         use64bitint="$define"
4460         ;;
4461 esac                          
4462 case "$uselonglongs" in
4463 "$define"|true|[yY]*)
4464         cat <<EOM >&4
4465
4466 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4467 EOM
4468         use64bitint="$define"
4469         ;;
4470 esac                          
4471 case "$use64bitsall" in
4472 "$define"|true|[yY]*)
4473         cat <<EOM >&4
4474
4475 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4476 EOM
4477         use64bitall="$define"
4478         ;;
4479 esac                          
4480
4481 case "$ccflags" in
4482 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4483 esac
4484 case "$use64bitall" in
4485 "$define"|true|[yY]*) use64bitint="$define" ;;
4486 esac
4487
4488 case "$longsize" in
4489 8) cat <<EOM
4490
4491 You have natively 64-bit long integers.
4492 EOM
4493    val="$define"
4494    ;;
4495 *) case "$use64bitint" in
4496    "$define"|true|[yY]*) dflt='y';;
4497    *) dflt='n';;
4498    esac
4499    cat <<EOM
4500
4501 Perl can be built to take advantage of 64-bit integer types
4502 on some systems.  To do so, Configure can be run with -Duse64bitint.
4503 Choosing this option will most probably introduce binary incompatibilities.
4504
4505 If this doesn't make any sense to you, just accept the default '$dflt'.
4506 EOM
4507    rp='Try to use 64-bit integers, if available?'
4508    . ./myread
4509    case "$ans" in
4510    [yY]*) val="$define" ;;
4511    *)     val="$undef"  ;;
4512    esac
4513    ;;
4514 esac
4515 set use64bitint
4516 eval $setvar
4517
4518 case "$use64bitall" in
4519 "$define"|true|[yY]*) dflt='y' ;;
4520 *) case "$longsize" in
4521    8) dflt='y' ;;
4522    *) dflt='n' ;;
4523    esac
4524    ;;
4525 esac    
4526 cat <<EOM
4527
4528 You may also choose to try maximal 64-bitness.  It means using as much
4529 64-bitness as possible on the platform.  This in turn means even more
4530 binary incompatibilities.  On the other hand, your platform may not
4531 have any more 64-bitness available than what you already have chosen.
4532
4533 If this doesn't make any sense to you, just accept the default '$dflt'.
4534 EOM
4535 rp='Try to use maximal 64-bit support, if available?'
4536 . ./myread
4537 case "$ans" in
4538 [yY]*) val="$define" ;;
4539 *)     val="$undef"  ;;
4540 esac
4541 set use64bitall
4542 eval $setvar
4543 case "$use64bitall" in
4544 "$define")
4545         case "$use64bitint" in
4546         "$undef")
4547                 cat <<EOM
4548
4549 Since you have chosen a maximally 64-bit build, I'm also turning on
4550 the use of 64-bit integers.
4551 EOM
4552                 use64bitint="$define" ;;
4553         esac
4554         ;;
4555 esac
4556
4557 case "$use64bitint" in
4558 "$define"|true|[yY]*)
4559 : Look for a hint-file generated 'call-back-unit'.  If the
4560 : user has specified that a 64-bit perl is to be built,
4561 : we may need to set or change some other defaults.
4562         if $test -f use64bitint.cbu; then
4563                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4564                 . ./use64bitint.cbu
4565         fi
4566         case "$longsize" in
4567         4) case "$archname64" in
4568            '') archname64=64int ;;
4569            esac
4570            ;;
4571         esac
4572         ;;
4573 esac
4574
4575 case "$use64bitall" in
4576 "$define"|true|[yY]*)
4577 : Look for a hint-file generated 'call-back-unit'.  If the
4578 : user has specified that a maximally 64-bit perl is to be built,
4579 : we may need to set or change some other defaults.
4580         if $test -f use64bitall.cbu; then
4581                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4582                 . ./use64bitall.cbu
4583         fi
4584         case "$longsize" in
4585         4) case "$archname64" in
4586            ''|64int) archname64=64all ;;
4587            esac
4588            ;;
4589         esac
4590         ;;
4591 esac
4592
4593 : determine the architecture name
4594 echo " "
4595 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4596         tarch=`arch`"-$osname"
4597 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4598         if uname -m > tmparch 2>&1 ; then
4599                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4600                         -e 's/$/'"-$osname/" tmparch`
4601         else
4602                 tarch="$osname"
4603         fi
4604         $rm -f tmparch
4605 else
4606         tarch="$osname"
4607 fi
4608 case "$myarchname" in
4609 ''|"$tarch") ;;
4610 *)
4611         echo "(Your architecture name used to be $myarchname.)"
4612         archname=''
4613         ;;
4614 esac
4615 myarchname="$tarch"
4616 case "$archname" in
4617 '') dflt="$tarch";;
4618 *) dflt="$archname";;
4619 esac
4620 rp='What is your architecture name'
4621 . ./myread
4622 archname="$ans"
4623 case "$usethreads" in
4624 $define)
4625         echo "Threads selected." >&4
4626         case "$archname" in
4627         *-thread*) echo "...and architecture name already has -thread." >&4
4628                 ;;
4629         *)      archname="$archname-thread"
4630                 echo "...setting architecture name to $archname." >&4
4631                 ;;
4632         esac
4633         ;;
4634 esac
4635 case "$usemultiplicity" in
4636 $define)
4637         echo "Multiplicity selected." >&4
4638         case "$archname" in
4639         *-multi*) echo "...and architecture name already has -multi." >&4
4640                 ;;
4641         *)      archname="$archname-multi"
4642                 echo "...setting architecture name to $archname." >&4
4643                 ;;
4644         esac
4645         ;;
4646 esac
4647 case "$use64bitint" in
4648 $define)
4649         case "$archname64" in
4650         '')
4651                 ;;
4652         *)
4653                 case "$archname" in
4654                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4655                         ;;
4656                 *)      archname="$archname-$archname64"
4657                         echo "...setting architecture name to $archname." >&4
4658                         ;;
4659                 esac
4660                 ;;
4661         esac
4662 esac
4663
4664 : determine root of directory hierarchy where package will be installed.
4665 case "$prefix" in
4666 '')
4667         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4668         ;;
4669 *)
4670         dflt="$prefix"
4671         ;;
4672 esac
4673 $cat <<EOM
4674
4675 By default, $package will be installed in $dflt/bin, manual pages
4676 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4677 installation directories. Typically this is something like /usr/local.
4678 If you wish to have binaries under /usr/bin but other parts of the
4679 installation under /usr/local, that's ok: you will be prompted
4680 separately for each of the installation directories, the prefix being
4681 only used to set the defaults.
4682
4683 EOM
4684 fn=d~
4685 rp='Installation prefix to use?'
4686 . ./getfile
4687 oldprefix=''
4688 case "$prefix" in
4689 '') ;;
4690 *)
4691         case "$ans" in
4692         "$prefix") ;;
4693         *) oldprefix="$prefix";;
4694         esac
4695         ;;
4696 esac
4697 prefix="$ans"
4698 prefixexp="$ansexp"
4699
4700 : is AFS running?
4701 echo " "
4702 case "$afs" in
4703 $define|true)   afs=true ;;
4704 $undef|false)   afs=false ;;
4705 *)      if test -d /afs; then
4706                 afs=true
4707         else
4708                 afs=false
4709         fi
4710         ;;
4711 esac
4712 if $afs; then
4713         echo "AFS may be running... I'll be extra cautious then..." >&4
4714 else
4715         echo "AFS does not seem to be running..." >&4
4716 fi
4717
4718 : determine installation prefix for where package is to be installed.
4719 if $afs; then 
4720 $cat <<EOM
4721
4722 Since you are running AFS, I need to distinguish the directory in which
4723 files will reside from the directory in which they are installed (and from
4724 which they are presumably copied to the former directory by occult means).
4725
4726 EOM
4727         case "$installprefix" in
4728         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4729         *) dflt="$installprefix";;
4730         esac
4731 else
4732 $cat <<EOM
4733
4734 In some special cases, particularly when building $package for distribution,
4735 it is convenient to distinguish between the directory in which files should 
4736 be installed from the directory ($prefix) in which they 
4737 will eventually reside.  For most users, these two directories are the same.
4738
4739 EOM
4740         case "$installprefix" in
4741         '') dflt=$prefix ;;
4742         *) dflt=$installprefix;;
4743         esac
4744 fi
4745 fn=d~
4746 rp='What installation prefix should I use for installing files?'
4747 . ./getfile
4748 installprefix="$ans"
4749 installprefixexp="$ansexp"
4750
4751 : set the prefixit variable, to compute a suitable default value
4752 prefixit='case "$3" in
4753 ""|none)
4754         case "$oldprefix" in
4755         "") eval "$1=\"\$$2\"";;
4756         *)
4757                 case "$3" in
4758                 "") eval "$1=";;
4759                 none)
4760                         eval "tp=\"\$$2\"";
4761                         case "$tp" in
4762                         ""|" ") eval "$1=\"\$$2\"";;
4763                         *) eval "$1=";;
4764                         esac;;
4765                 esac;;
4766         esac;;
4767 *)
4768         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4769         case "$tp" in
4770         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4771         /*-$oldprefix/*|\~*-$oldprefix/*)
4772                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4773         *) eval "$1=\"\$$2\"";;
4774         esac;;
4775 esac'
4776
4777
4778 : get the patchlevel
4779 echo " "
4780 echo "Getting the current patchlevel..." >&4
4781 if $test -r $rsrc/patchlevel.h;then
4782         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4783         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4784         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4785         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4786         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4787         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4788 else
4789         revision=0
4790         patchlevel=0
4791         subversion=0
4792         api_revision=0
4793         api_version=0
4794         api_subversion=0
4795 fi
4796 $echo $n "(You have $package revision $revision" $c
4797 $echo $n " patchlevel $patchlevel" $c
4798 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4799 echo ".)"
4800 case "$osname" in
4801 dos|vms)
4802         : XXX Should be a Configure test for double-dots in filenames.
4803         version=`echo $revision $patchlevel $subversion | \
4804                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4805         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4806                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4807         ;;
4808 *)
4809         version=`echo $revision $patchlevel $subversion | \
4810                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4811         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4812                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4813         ;;
4814 esac
4815 : Special case the 5.005_xx maintenance series, which used 5.005
4816 : without any subversion label as a subdirectory in $sitelib
4817 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4818         api_versionstring='5.005'
4819 fi
4820
4821 : determine installation style
4822 : For now, try to deduce it from prefix unless it is already set.
4823 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4824 case "$installstyle" in
4825 '')     case "$prefix" in
4826                 *perl*) dflt='lib';;
4827                 *) dflt='lib/perl5' ;;
4828         esac
4829         ;;
4830 *)      dflt="$installstyle" ;;
4831 esac
4832 : Probably not worth prompting for this since we prompt for all
4833 : the directories individually, and the prompt would be too long and
4834 : confusing anyway.
4835 installstyle=$dflt
4836
4837 : determine where private library files go
4838 : Usual default is /usr/local/lib/perl5/$version.
4839 : Also allow things like /opt/perl/lib/$version, since 
4840 : /opt/perl/lib/perl5... would be redundant.
4841 : The default "style" setting is made in installstyle.U
4842 case "$installstyle" in
4843 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4844 *)       set dflt privlib lib/$version ;;
4845 esac
4846 eval $prefixit
4847 $cat <<EOM
4848
4849 There are some auxiliary files for $package that need to be put into a
4850 private library directory that is accessible by everyone.
4851
4852 EOM
4853 fn=d~+
4854 rp='Pathname where the private library files will reside?'
4855 . ./getfile
4856 privlib="$ans"
4857 privlibexp="$ansexp"
4858 : Change installation prefix, if necessary.
4859 if $test X"$prefix" != X"$installprefix"; then
4860         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4861 else
4862         installprivlib="$privlibexp"
4863 fi
4864
4865 : set the prefixup variable, to restore leading tilda escape
4866 prefixup='case "$prefixexp" in
4867 "$prefix") ;;
4868 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4869 esac'
4870
4871 : determine where public architecture dependent libraries go
4872 set archlib archlib
4873 eval $prefixit
4874 : privlib default is /usr/local/lib/$package/$version
4875 : archlib default is /usr/local/lib/$package/$version/$archname
4876 : privlib may have an optional trailing /share.
4877 tdflt=`echo $privlib | $sed 's,/share$,,'`
4878 tdflt=$tdflt/$archname
4879 case "$archlib" in
4880 '')     dflt=$tdflt
4881         ;;
4882 *)      dflt="$archlib"
4883     ;;
4884 esac
4885 $cat <<EOM
4886
4887 $spackage contains architecture-dependent library files.  If you are
4888 sharing libraries in a heterogeneous environment, you might store
4889 these files in a separate location.  Otherwise, you can just include
4890 them with the rest of the public library files.
4891
4892 EOM
4893 fn=d+~
4894 rp='Where do you want to put the public architecture-dependent libraries?'
4895 . ./getfile
4896 archlib="$ans"
4897 archlibexp="$ansexp"
4898 if $test X"$archlib" = X"$privlib"; then
4899         d_archlib="$undef"
4900 else
4901         d_archlib="$define"
4902 fi
4903 : Change installation prefix, if necessary.
4904 if $test X"$prefix" != X"$installprefix"; then
4905         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4906 else
4907         installarchlib="$archlibexp"
4908 fi
4909
4910
4911 : Binary compatibility with 5.005 is not possible for builds
4912 : with advanced features
4913 case "$usethreads$usemultiplicity" in
4914 *define*)
4915         bincompat5005="$undef"
4916         d_bincompat5005="$undef"
4917         ;;
4918 *)      $cat <<EOM
4919
4920 This version of Perl can be compiled for binary compatibility with 5.005.
4921 If you decide to do so, you will be able to continue using most of the
4922 extensions that were compiled for Perl 5.005.
4923
4924 EOM
4925         case "$bincompat5005$d_bincompat5005" in
4926         *"$undef"*) dflt=n ;;
4927         *) dflt=y ;;
4928         esac
4929         rp='Binary compatibility with Perl 5.005?'
4930         . ./myread
4931         case "$ans" in
4932         y*) val="$define" ;;
4933         *)  val="$undef" ;;
4934         esac
4935         set d_bincompat5005
4936         eval $setvar
4937         case "$d_bincompat5005" in
4938         "$define")
4939                 bincompat5005="$define"
4940                 ;;
4941         *)      bincompat5005="$undef"
4942                 d_bincompat5005="$undef"
4943                 ;;
4944         esac
4945         ;;
4946 esac
4947
4948
4949 : see if setuid scripts can be secure
4950 $cat <<EOM
4951
4952 Some kernels have a bug that prevents setuid #! scripts from being
4953 secure.  Some sites have disabled setuid #! scripts because of this.
4954
4955 First let's decide if your kernel supports secure setuid #! scripts.
4956 (If setuid #! scripts would be secure but have been disabled anyway,
4957 don't say that they are secure if asked.)
4958
4959 EOM
4960
4961 val="$undef"
4962 if $test -d /dev/fd; then
4963         echo "#!$ls" >reflect
4964         chmod +x,u+s reflect
4965         ./reflect >flect 2>&1
4966         if $contains "/dev/fd" flect >/dev/null; then
4967                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4968                 val="$define"
4969         else
4970                 $cat <<EOM
4971 If you are not sure if they are secure, I can check but I'll need a
4972 username and password different from the one you are using right now.
4973 If you don't have such a username or don't want me to test, simply
4974 enter 'none'.
4975
4976 EOM
4977                 rp='Other username to test security of setuid scripts with?'
4978                 dflt='none'
4979                 . ./myread
4980                 case "$ans" in
4981                 n|none)
4982                         case "$d_suidsafe" in
4983                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4984                                 dflt=n;;
4985                         "$undef")
4986                                 echo "Well, the $hint value is *not* secure." >&4
4987                                 dflt=n;;
4988                         *)      echo "Well, the $hint value *is* secure." >&4
4989                                 dflt=y;;
4990                         esac
4991                         ;;
4992                 *)
4993                         $rm -f reflect flect
4994                         echo "#!$ls" >reflect
4995                         chmod +x,u+s reflect
4996                         echo >flect
4997                         chmod a+w flect
4998                         echo '"su" will (probably) prompt you for '"$ans's password."
4999                         su $ans -c './reflect >flect'
5000                         if $contains "/dev/fd" flect >/dev/null; then
5001                                 echo "Okay, it looks like setuid scripts are secure." >&4
5002                                 dflt=y
5003                         else
5004                                 echo "I don't think setuid scripts are secure." >&4
5005                                 dflt=n
5006                         fi
5007                         ;;
5008                 esac
5009                 rp='Does your kernel have *secure* setuid scripts?'
5010                 . ./myread
5011                 case "$ans" in
5012                 [yY]*)  val="$define";;
5013                 *)      val="$undef";;
5014                 esac
5015         fi
5016 else
5017         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5018         echo "(That's for file descriptors, not floppy disks.)"
5019         val="$undef"
5020 fi
5021 set d_suidsafe
5022 eval $setvar
5023
5024 $rm -f reflect flect
5025
5026 : now see if they want to do setuid emulation
5027 echo " "
5028 val="$undef"
5029 case "$d_suidsafe" in
5030 "$define")
5031         val="$undef"
5032         echo "No need to emulate SUID scripts since they are secure here." >& 4
5033         ;;
5034 *)
5035         $cat <<EOM
5036 Some systems have disabled setuid scripts, especially systems where
5037 setuid scripts cannot be secure.  On systems where setuid scripts have
5038 been disabled, the setuid/setgid bits on scripts are currently
5039 useless.  It is possible for $package to detect those bits and emulate
5040 setuid/setgid in a secure fashion.  This emulation will only work if
5041 setuid scripts have been disabled in your kernel.
5042
5043 EOM
5044         case "$d_dosuid" in
5045         "$define") dflt=y ;;
5046         *) dflt=n ;;
5047         esac
5048         rp="Do you want to do setuid/setgid emulation?"
5049         . ./myread
5050         case "$ans" in
5051         [yY]*)  val="$define";;
5052         *)      val="$undef";;
5053         esac
5054         ;;
5055 esac
5056 set d_dosuid
5057 eval $setvar
5058
5059 : determine filename position in cpp output
5060 echo " "
5061 echo "Computing filename position in cpp output for #include directives..." >&4
5062 echo '#include <stdio.h>' > foo.c
5063 $cat >fieldn <<EOF
5064 $startsh
5065 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5066 $grep '^[       ]*#.*stdio\.h' | \
5067 while read cline; do
5068         pos=1
5069         set \$cline
5070         while $test \$# -gt 0; do
5071                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5072                         echo "\$pos"
5073                         exit 0
5074                 fi
5075                 shift
5076                 pos=\`expr \$pos + 1\`
5077         done
5078 done
5079 EOF
5080 chmod +x fieldn
5081 fieldn=`./fieldn`
5082 $rm -f foo.c fieldn
5083 case $fieldn in
5084 '') pos='???';;
5085 1) pos=first;;
5086 2) pos=second;;
5087 3) pos=third;;
5088 *) pos="${fieldn}th";;
5089 esac
5090 echo "Your cpp writes the filename in the $pos field of the line."
5091
5092 : locate header file
5093 $cat >findhdr <<EOF
5094 $startsh
5095 wanted=\$1
5096 name=''
5097 for usrincdir in $usrinc
5098 do
5099         if test -f \$usrincdir/\$wanted; then
5100                 echo "\$usrincdir/\$wanted"
5101                 exit 0
5102         fi
5103 done
5104 awkprg='{ print \$$fieldn }'
5105 echo "#include <\$wanted>" > foo\$\$.c
5106 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5107 $grep "^[       ]*#.*\$wanted" | \
5108 while read cline; do
5109         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5110         case "\$name" in
5111         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5112         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5113         *) exit 2;;
5114         esac;
5115 done;
5116 #
5117 # status = 0: grep returned 0 lines, case statement not executed
5118 # status = 1: headerfile found
5119 # status = 2: while loop executed, no headerfile found
5120 #
5121 status=\$?
5122 $rm -f foo\$\$.c;
5123 if test \$status -eq 1; then
5124         exit 0;
5125 fi
5126 exit 1
5127 EOF
5128 chmod +x findhdr
5129
5130 : define an alternate in-header-list? function
5131 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5132 cont=true; xxf="echo \"<\$1> found.\" >&4";
5133 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5134 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5135 esac;
5136 case $# in 4) instead=instead;; *) instead="at last";; esac;
5137 while $test "$cont"; do
5138         xxx=`./findhdr $1`
5139         var=$2; eval "was=\$$2";
5140         if $test "$xxx" && $test -r "$xxx";
5141         then eval $xxf;
5142         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5143                 cont="";
5144         else eval $xxnf;
5145         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5146         set $yyy; shift; shift; yyy=$@;
5147         case $# in 0) cont="";;
5148         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5149                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5150         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5151                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5152         esac;
5153 done;
5154 while $test "$yyy";
5155 do set $yyy; var=$2; eval "was=\$$2";
5156         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5157         set $yyy; shift; shift; yyy=$@;
5158 done'
5159
5160 : see if this is a malloc.h system
5161 set malloc.h i_malloc
5162 eval $inhdr
5163
5164 : see if stdlib is available
5165 set stdlib.h i_stdlib
5166 eval $inhdr
5167
5168 : determine which malloc to compile in
5169 echo " "
5170 case "$usemymalloc" in
5171 ''|[yY]*|true|$define)  dflt='y' ;;
5172 *)      dflt='n' ;;
5173 esac
5174 rp="Do you wish to attempt to use the malloc that comes with $package?"
5175 . ./myread
5176 usemymalloc="$ans"
5177 case "$ans" in
5178 y*|true)
5179         usemymalloc='y'
5180         mallocsrc='malloc.c'
5181         mallocobj="malloc$_o"
5182         d_mymalloc="$define"
5183         case "$libs" in
5184         *-lmalloc*)
5185                 : Remove malloc from list of libraries to use
5186                 echo "Removing unneeded -lmalloc from library list" >&4
5187                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5188                 shift
5189                 libs="$*"
5190                 echo "libs = $libs" >&4
5191                 ;;
5192         esac
5193         ;;
5194 *)
5195         usemymalloc='n'
5196         mallocsrc=''
5197         mallocobj=''
5198         d_mymalloc="$undef"
5199         ;;
5200 esac
5201
5202 : compute the return types of malloc and free
5203 echo " "
5204 $cat >malloc.c <<END
5205 #$i_malloc I_MALLOC
5206 #$i_stdlib I_STDLIB
5207 #include <stdio.h>
5208 #include <sys/types.h>
5209 #ifdef I_MALLOC
5210 #include <malloc.h>
5211 #endif
5212 #ifdef I_STDLIB
5213 #include <stdlib.h>
5214 #endif
5215 #ifdef TRY_MALLOC
5216 void *malloc();
5217 #endif
5218 #ifdef TRY_FREE
5219 void free();
5220 #endif
5221 END
5222 case "$malloctype" in
5223 '')
5224         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5225                 malloctype='void *'
5226         else
5227                 malloctype='char *'
5228         fi
5229         ;;
5230 esac
5231 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5232
5233 case "$freetype" in
5234 '')
5235         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5236                 freetype='void'
5237         else
5238                 freetype='int'
5239         fi
5240         ;;
5241 esac
5242 echo "Your system uses $freetype free(), it would seem." >&4
5243 $rm -f malloc.[co]
5244 $cat <<EOM
5245
5246 The installation process will also create a directory for
5247 vendor-supplied add-ons.  Vendors who supply perl with their system
5248 may find it convenient to place all vendor-supplied files in this
5249 directory rather than in the main distribution directory.  This will
5250 ease upgrades between binary-compatible maintenance versions of perl.
5251
5252 Of course you may also use these directories in whatever way you see
5253 fit.  For example, you might use them to access modules shared over a
5254 company-wide network.
5255
5256 The default answer should be fine for most people.
5257 This causes further questions about vendor add-ons to be skipped
5258 and no vendor-specific directories will be configured for perl.
5259
5260 EOM
5261 rp='Do you want to configure vendor-specific add-on directories?'
5262 case "$usevendorprefix" in
5263 define|true|[yY]*) dflt=y ;;
5264 *)      : User may have set vendorprefix directly on Configure command line.
5265         case "$vendorprefix" in
5266         ''|' ') dflt=n ;;
5267         *)      dflt=y ;;
5268         esac
5269         ;;
5270 esac
5271 . ./myread
5272 case "$ans" in
5273 [yY]*)  fn=d~+
5274         rp='Installation prefix to use for vendor-supplied add-ons?'
5275         case "$vendorprefix" in
5276         '') dflt='' ;;
5277         *)  dflt=$vendorprefix ;;
5278         esac
5279         . ./getfile
5280         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5281         oldvendorprefix=''
5282         case "$vendorprefix" in
5283         '') ;;
5284         *)      case "$ans" in
5285                 "$prefix") ;;
5286                 *) oldvendorprefix="$prefix";;
5287                 esac
5288                 ;;
5289         esac
5290         usevendorprefix="$define"
5291         vendorprefix="$ans"
5292         vendorprefixexp="$ansexp"
5293         ;;
5294 *)      usevendorprefix="$undef"
5295         vendorprefix=''
5296         vendorprefixexp=''
5297         ;;
5298 esac
5299
5300 case "$vendorprefix" in
5301 '')     d_vendorlib="$undef"
5302         vendorlib=''
5303         vendorlibexp=''
5304         ;;
5305 *)      d_vendorlib="$define"
5306         : determine where vendor-supplied modules go.
5307         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5308         case "$vendorlib" in
5309         '')
5310                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5311                 case "$installstyle" in
5312                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5313                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5314                 esac
5315                 ;;
5316         *)      dflt="$vendorlib"
5317                 ;;
5318         esac
5319         fn=d~+
5320         rp='Pathname for the vendor-supplied library files?'
5321         . ./getfile
5322         vendorlib="$ans"
5323         vendorlibexp="$ansexp"
5324         ;;
5325 esac
5326 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5327 : Change installation prefix, if necessary.
5328 if $test X"$prefix" != X"$installprefix"; then
5329         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5330 else
5331         installvendorlib="$vendorlibexp"
5332 fi
5333
5334 case "$vendorprefix" in
5335 '')     d_vendorarch="$undef"
5336         vendorarch=''
5337         vendorarchexp=''
5338         ;;
5339 *)      d_vendorarch="$define"
5340         : determine where vendor-supplied architecture-dependent libraries go.
5341         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5342         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5343         : vendorlib may have an optional trailing /share.
5344         case "$vendorarch" in
5345         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5346                 dflt="$dflt/$archname"
5347                 ;;
5348         *)      dflt="$vendorarch" ;;
5349         esac
5350         fn=d~+
5351         rp='Pathname for vendor-supplied architecture-dependent files?'
5352         . ./getfile
5353         vendorarch="$ans"
5354         vendorarchexp="$ansexp"
5355         ;;
5356 esac
5357 : Change installation prefix, if necessary.
5358 if $test X"$prefix" != X"$installprefix"; then
5359         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5360 else
5361         installvendorarch="$vendorarchexp"
5362 fi
5363
5364 : Cruising for prototypes
5365 echo " "
5366 echo "Checking out function prototypes..." >&4
5367 $cat >prototype.c <<'EOCP'
5368 int main(int argc, char *argv[]) {
5369         exit(0);}
5370 EOCP
5371 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5372         echo "Your C compiler appears to support function prototypes."
5373         val="$define"
5374 else
5375         echo "Your C compiler doesn't seem to understand function prototypes."
5376         val="$undef"
5377 fi
5378 set prototype
5379 eval $setvar
5380 $rm -f prototype*
5381
5382 case "$prototype" in
5383 "$define") ;;
5384 *)      ansi2knr='ansi2knr'
5385         echo " "
5386         cat <<EOM >&4
5387
5388 $me:  FATAL ERROR:
5389 This version of $package can only be compiled by a compiler that 
5390 understands function prototypes.  Unfortunately, your C compiler 
5391         $cc $ccflags
5392 doesn't seem to understand them.  Sorry about that.
5393
5394 If GNU cc is available for your system, perhaps you could try that instead.  
5395
5396 Eventually, we hope to support building Perl with pre-ANSI compilers.
5397 If you would like to help in that effort, please contact <perlbug@perl.org>.
5398
5399 Aborting Configure now.
5400 EOM
5401         exit 2
5402         ;;
5403 esac
5404
5405 : determine where public executables go
5406 echo " "
5407 set dflt bin bin
5408 eval $prefixit
5409 fn=d~
5410 rp='Pathname where the public executables will reside?'
5411 . ./getfile
5412 if $test "X$ansexp" != "X$binexp"; then
5413         installbin=''
5414 fi
5415 bin="$ans"
5416 binexp="$ansexp"
5417 : Change installation prefix, if necessary.
5418 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5419 if $test X"$prefix" != X"$installprefix"; then
5420         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5421 else
5422         installbin="$binexp"
5423 fi
5424
5425 : Find perl5.005 or later.
5426 echo "Looking for a previously installed perl5.005 or later... "
5427 case "$perl5" in
5428 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5429                 : Check if this perl is recent and can load a simple module
5430                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5431                         perl5=$tdir/perl
5432                         break;
5433                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5434                         perl5=$tdir/perl
5435                         break;
5436                 fi
5437         done
5438         ;;
5439 *)      perl5="$perl5"
5440         ;;
5441 esac
5442 case "$perl5" in
5443 '')     echo "None found.  That's ok.";;
5444 *)      echo "Using $perl5." ;;
5445 esac
5446
5447 $cat <<EOM
5448
5449 After $package is installed, you may wish to install various
5450 add-on modules and utilities.  Typically, these add-ons will
5451 be installed under $prefix with the rest
5452 of this package.  However, you may wish to install such add-ons
5453 elsewhere under a different prefix.
5454
5455 If you do not wish to put everything under a single prefix, that's
5456 ok.  You will be prompted for the individual locations; this siteprefix
5457 is only used to suggest the defaults.
5458
5459 The default should be fine for most people.
5460
5461 EOM
5462 fn=d~+
5463 rp='Installation prefix to use for add-on modules and utilities?'
5464 : XXX Here might be another good place for an installstyle setting.
5465 case "$siteprefix" in
5466 '') dflt=$prefix ;;
5467 *)  dflt=$siteprefix ;;
5468 esac
5469 . ./getfile
5470 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5471 oldsiteprefix=''
5472 case "$siteprefix" in
5473 '') ;;
5474 *)      case "$ans" in
5475         "$prefix") ;;
5476         *) oldsiteprefix="$prefix";;
5477         esac
5478         ;;
5479 esac
5480 siteprefix="$ans"
5481 siteprefixexp="$ansexp"
5482
5483 : determine where site specific libraries go.
5484 : Usual default is /usr/local/lib/perl5/site_perl/$version
5485 : The default "style" setting is made in installstyle.U
5486 : XXX No longer works with Prefixit stuff.
5487 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5488 case "$sitelib" in
5489 '') case "$installstyle" in
5490         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5491         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5492         esac
5493         ;;
5494 *)      dflt="$sitelib"
5495         ;;
5496 esac
5497 $cat <<EOM
5498
5499 The installation process will create a directory for
5500 site-specific extensions and modules.  Most users find it convenient
5501 to place all site-specific files in this directory rather than in the
5502 main distribution directory.
5503
5504 EOM
5505 fn=d~+
5506 rp='Pathname for the site-specific library files?'
5507 . ./getfile
5508 sitelib="$ans"
5509 sitelibexp="$ansexp"
5510 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5511 : Change installation prefix, if necessary.
5512 if $test X"$prefix" != X"$installprefix"; then
5513         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5514 else
5515         installsitelib="$sitelibexp"
5516 fi
5517
5518 : Determine list of previous versions to include in @INC
5519 $cat > getverlist <<EOPL
5520 #!$perl5 -w
5521 use File::Basename;
5522 \$api_versionstring = "$api_versionstring";
5523 \$version = "$version";
5524 \$stem = "$sitelib_stem";
5525 \$archname = "$archname";
5526 EOPL
5527         $cat >> getverlist <<'EOPL'
5528 # Can't have leading @ because metaconfig interprets it as a command!
5529 ;@inc_version_list=();
5530 # XXX Redo to do opendir/readdir? 
5531 if (-d $stem) {
5532     chdir($stem);
5533     ;@candidates = glob("5.*");
5534 }
5535 else {
5536     ;@candidates = ();
5537 }
5538
5539 # XXX ToDo:  These comparisons must be reworked when two-digit
5540 # subversions come along, so that 5.7.10 compares as greater than
5541 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5542 # widespread that we can use the built-in version vectors rather
5543 # than reinventing them here.  For 5.6.0, however, we must
5544 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5545 foreach $d (@candidates) {
5546     if ($d lt $version) {
5547         if ($d ge $api_versionstring) {
5548             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
5549         }
5550         elsif ($d ge "5.005") {
5551             unshift(@inc_version_list, grep { -d } $d);
5552         }
5553     }
5554     else {
5555         # Skip newer version.  I.e. don't look in
5556         # 5.7.0 if we're installing 5.6.1.
5557     }
5558 }
5559
5560 if (@inc_version_list) {
5561     print join(' ', @inc_version_list);
5562 }
5563 else {
5564     # Blank space to preserve value for next Configure run.
5565     print " ";
5566 }
5567 EOPL
5568 chmod +x getverlist
5569 case "$inc_version_list" in
5570 '')     if test -x "$perl5"; then
5571                 dflt=`$perl5 getverlist`
5572         else
5573                 dflt='none'
5574         fi
5575         ;;
5576 $undef) dflt='none' ;;
5577 *)  dflt="$inc_version_list" ;;
5578 esac
5579 case "$dflt" in
5580 ''|' ') dflt=none ;;
5581 esac
5582 $cat <<'EOM'
5583
5584 In order to ease the process of upgrading, this version of perl 
5585 can be configured to use modules built and installed with earlier 
5586 versions of perl that were installed under $prefix.  Specify here
5587 the list of earlier versions that this version of perl should check.
5588 If Configure detected no earlier versions of perl installed under
5589 $prefix, then the list will be empty.  Answer 'none' to tell perl
5590 to not search earlier versions.
5591
5592 The default should almost always be sensible, so if you're not sure,
5593 just accept the default.
5594 EOM
5595
5596 rp='List of earlier versions to include in @INC?'
5597 . ./myread
5598 case "$ans" in
5599 [Nn]one|''|' ') inc_version_list=' ' ;;
5600 *) inc_version_list="$ans" ;;
5601 esac
5602 case "$inc_version_list" in
5603 ''|' ') 
5604         inc_version_list_init='0';;
5605 *)      inc_version_list_init=`echo $inc_version_list |
5606                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5607         ;;
5608 esac
5609 $rm -f getverlist
5610
5611 : determine whether to install perl also as /usr/bin/perl
5612
5613 echo " "
5614 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5615         $cat <<EOM
5616 Many scripts expect perl to be installed as /usr/bin/perl.
5617 I can install the perl you are about to compile also as /usr/bin/perl
5618 (in addition to $installbin/perl).
5619 EOM
5620         case "$installusrbinperl" in
5621         "$undef"|[nN]*) dflt='n';;
5622         *)              dflt='y';;
5623         esac
5624         rp="Do you want to install perl as /usr/bin/perl?"
5625         . ./myread
5626         case "$ans" in
5627         [yY]*)  val="$define";;
5628         *)      val="$undef" ;;
5629         esac
5630 else
5631         val="$undef"
5632 fi
5633 set installusrbinperl
5634 eval $setvar
5635
5636 echo " "
5637 echo "Checking for GNU C Library..." >&4
5638 cat >gnulibc.c <<EOM
5639 #include <stdio.h>
5640 int main()
5641 {
5642 #ifdef __GLIBC__
5643     exit(0);
5644 #else
5645     exit(1);
5646 #endif
5647 }
5648 EOM
5649 set gnulibc
5650 if eval $compile_ok && ./gnulibc; then
5651         val="$define"
5652         echo "You are using the GNU C Library"
5653 else
5654         val="$undef"
5655         echo "You are not using the GNU C Library"
5656 fi
5657 $rm -f gnulibc*
5658 set d_gnulibc
5659 eval $setvar
5660
5661 : see if nm is to be used to determine whether a symbol is defined or not
5662 case "$usenm" in
5663 '')
5664         dflt=''
5665         case "$d_gnulibc" in
5666         "$define")
5667                 echo " "
5668                 echo "nm probably won't work on the GNU C Library." >&4
5669                 dflt=n
5670                 ;;
5671         esac
5672         case "$dflt" in
5673         '') 
5674                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5675                         echo " "
5676                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5677                         echo "'nm' won't be sufficient on this sytem." >&4
5678                         dflt=n
5679                 fi
5680                 ;;
5681         esac
5682         case "$dflt" in
5683         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5684                 if $test $dflt -gt 20; then
5685                         dflt=y
5686                 else
5687                         dflt=n
5688                 fi
5689                 ;;
5690         esac
5691         ;;
5692 *)
5693         case "$usenm" in
5694         true|$define) dflt=y;;
5695         *) dflt=n;;
5696         esac
5697         ;;
5698 esac
5699 $cat <<EOM
5700
5701 I can use $nm to extract the symbols from your C libraries. This
5702 is a time consuming task which may generate huge output on the disk (up
5703 to 3 megabytes) but that should make the symbols extraction faster. The
5704 alternative is to skip the 'nm' extraction part and to compile a small
5705 test program instead to determine whether each symbol is present. If
5706 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5707 this may be the best solution.
5708
5709 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5710
5711 EOM
5712 rp="Shall I use $nm to extract C symbols from the libraries?"
5713 . ./myread
5714 case "$ans" in
5715 [Nn]*) usenm=false;;
5716 *) usenm=true;;
5717 esac
5718
5719 runnm=$usenm
5720 case "$reuseval" in
5721 true) runnm=false;;
5722 esac
5723
5724 : nm options which may be necessary
5725 case "$nm_opt" in
5726 '') if $test -f /mach_boot; then
5727                 nm_opt=''       # Mach
5728         elif $test -d /usr/ccs/lib; then
5729                 nm_opt='-p'     # Solaris (and SunOS?)
5730         elif $test -f /dgux; then
5731                 nm_opt='-p'     # DG-UX
5732         elif $test -f /lib64/rld; then
5733                 nm_opt='-p'     # 64-bit Irix
5734         else
5735                 nm_opt=''
5736         fi;;
5737 esac
5738
5739 : nm options which may be necessary for shared libraries but illegal
5740 : for archive libraries.  Thank you, Linux.
5741 case "$nm_so_opt" in
5742 '')     case "$myuname" in
5743         *linux*)
5744                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5745                         nm_so_opt='--dynamic'
5746                 fi
5747                 ;;
5748         esac
5749         ;;
5750 esac
5751
5752 case "$runnm" in
5753 true)
5754 : get list of predefined functions in a handy place
5755 echo " "
5756 case "$libc" in
5757 '') libc=unknown
5758         case "$libs" in
5759         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5760         esac
5761         ;;
5762 esac
5763 libnames='';
5764 case "$libs" in
5765 '') ;;
5766 *)  for thislib in $libs; do
5767         case "$thislib" in
5768         -lc|-lc_s)
5769                 : Handle C library specially below.
5770                 ;;
5771         -l*)
5772                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5773                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5774                         :
5775                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5776                         :
5777                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5778                         :
5779                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5780                         :
5781                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5782                         :
5783                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5784                         :
5785                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5786                         :
5787                 else
5788                         try=''
5789                 fi
5790                 libnames="$libnames $try"
5791                 ;;
5792         *) libnames="$libnames $thislib" ;;
5793         esac
5794         done
5795         ;;
5796 esac
5797 xxx=normal
5798 case "$libc" in
5799 unknown)
5800         set /lib/libc.$so
5801         for xxx in $libpth; do
5802                 $test -r $1 || set $xxx/libc.$so
5803                 : The messy sed command sorts on library version numbers.
5804                 $test -r $1 || \
5805                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5806                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5807                                 h
5808                                 s/[0-9][0-9]*/0000&/g
5809                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5810                                 G
5811                                 s/\n/ /' | \
5812                          sort | $sed -e 's/^.* //'`
5813                 eval set \$$#
5814         done
5815         $test -r $1 || set /usr/ccs/lib/libc.$so
5816         $test -r $1 || set /lib/libsys_s$_a
5817         ;;
5818 *)
5819         set blurfl
5820         ;;
5821 esac
5822 if $test -r "$1"; then
5823         echo "Your (shared) C library seems to be in $1."
5824         libc="$1"
5825 elif $test -r /lib/libc && $test -r /lib/clib; then
5826         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5827         xxx=apollo
5828         libc='/lib/clib /lib/libc'
5829         if $test -r /lib/syslib; then
5830                 echo "(Your math library is in /lib/syslib.)"
5831                 libc="$libc /lib/syslib"
5832         fi
5833 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5834         echo "Your C library seems to be in $libc, as you said before."
5835 elif $test -r $incpath/usr/lib/libc$_a; then
5836         libc=$incpath/usr/lib/libc$_a;
5837         echo "Your C library seems to be in $libc.  That's fine."
5838 elif $test -r /lib/libc$_a; then
5839         libc=/lib/libc$_a;
5840         echo "Your C library seems to be in $libc.  You're normal."
5841 else
5842         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5843                 :
5844         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5845                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5846         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5847                 :
5848         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5849                 :
5850         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5851                 :
5852         else
5853                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5854         fi
5855         if $test -r "$tans"; then
5856                 echo "Your C library seems to be in $tans, of all places."
5857                 libc=$tans
5858         else
5859                 libc='blurfl'
5860         fi
5861 fi
5862 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5863         dflt="$libc"
5864         cat <<EOM
5865
5866 If the guess above is wrong (which it might be if you're using a strange
5867 compiler, or your machine supports multiple models), you can override it here.
5868
5869 EOM
5870 else
5871         dflt=''
5872         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5873         cat >&4 <<EOM
5874 I can't seem to find your C library.  I've looked in the following places:
5875
5876 EOM
5877         $sed 's/^/      /' libpath
5878         cat <<EOM
5879
5880 None of these seems to contain your C library. I need to get its name...
5881
5882 EOM
5883 fi
5884 fn=f
5885 rp='Where is your C library?'
5886 . ./getfile
5887 libc="$ans"
5888
5889 echo " "
5890 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5891 set X `cat libnames`
5892 shift
5893 xxx=files
5894 case $# in 1) xxx=file; esac
5895 echo "Extracting names from the following $xxx for later perusal:" >&4
5896 echo " "
5897 $sed 's/^/      /' libnames >&4
5898 echo " "
5899 $echo $n "This may take a while...$c" >&4
5900
5901 for file in $*; do
5902         case $file in
5903         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5904         *) $nm $nm_opt $file 2>/dev/null;;
5905         esac
5906 done >libc.tmp
5907
5908 $echo $n ".$c"
5909 $grep fprintf libc.tmp > libc.ptf
5910 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5911 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5912 xxx='[ADTSIW]'
5913 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5914         eval $xscan;\
5915         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5916                 eval $xrun
5917 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5918         eval $xscan;\
5919         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5920                 eval $xrun
5921 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5922         eval $xscan;\
5923         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5924                 eval $xrun
5925 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5926         eval $xscan;\
5927         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5928                 eval $xrun
5929 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5930         eval $xscan;\
5931         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5932                 eval $xrun
5933 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5934         eval $xscan;\
5935         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5936                 eval $xrun
5937 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5938                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5939         eval $xscan;\
5940         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5941                 eval $xrun
5942 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5943         eval $xscan;\
5944         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5945                 eval $xrun
5946 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5947         eval $xscan;\
5948         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5949                 eval $xrun
5950 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5951         eval $xscan;\
5952         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5953                 eval $xrun
5954 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5955         eval $xscan;\
5956         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5957                 eval $xrun
5958 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5959         eval $xscan;\
5960         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5961                 eval $xrun
5962 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5963         eval $xscan;\
5964         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5965                 eval $xrun
5966 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5967         eval $xscan;\
5968         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5969                 eval $xrun
5970 else
5971         $nm -p $* 2>/dev/null >libc.tmp
5972         $grep fprintf libc.tmp > libc.ptf
5973         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5974                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5975         then
5976                 nm_opt='-p'
5977                 eval $xrun
5978         else
5979                 echo " "
5980                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5981                 com=''
5982                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5983                         for thisname in $libnames $libc; do
5984                                 $ar t $thisname >>libc.tmp
5985                         done
5986                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5987                         echo "Ok." >&4
5988                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5989                         # Repeat libc to extract forwarders to DLL entries too
5990                         for thisname in $libnames $libc; do
5991                                 $ar tv $thisname >>libc.tmp
5992                                 # Revision 50 of EMX has bug in $ar.
5993                                 # it will not extract forwarders to DLL entries
5994                                 # Use emximp which will extract exactly them.
5995                                 emximp -o tmp.imp $thisname \
5996                                     2>/dev/null && \
5997                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5998                                     < tmp.imp >>libc.tmp
5999                                 $rm tmp.imp
6000                         done
6001                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6002                         echo "Ok." >&4
6003                 else
6004                         echo "$ar didn't seem to work right." >&4
6005                         echo "Maybe this is a Cray...trying bld instead..." >&4
6006                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6007                         then
6008                                 for thisname in $libnames; do
6009                                         bld t $libnames | \
6010                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6011                                         $ar t $thisname >>libc.tmp
6012                                 done
6013                                 echo "Ok." >&4
6014                         else
6015                                 echo "That didn't work either.  Giving up." >&4
6016                                 exit 1
6017                         fi
6018                 fi
6019         fi
6020 fi
6021 nm_extract="$com"
6022 if $test -f /lib/syscalls.exp; then
6023         echo " "
6024         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6025         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6026 fi
6027 ;;
6028 esac
6029 $rm -f libnames libpath
6030
6031 : see if dld is available
6032 set dld.h i_dld
6033 eval $inhdr
6034
6035 : is a C symbol defined?
6036 csym='tlook=$1;
6037 case "$3" in
6038 -v) tf=libc.tmp; tc=""; tdc="";;
6039 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6040 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6041 esac;
6042 tx=yes;
6043 case "$reuseval-$4" in
6044 true-) ;;
6045 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6046 esac;
6047 case "$tx" in
6048 yes)
6049         case "$runnm" in
6050         true)
6051                 if $contains $tlook $tf >/dev/null 2>&1;
6052                 then tval=true;
6053                 else tval=false;
6054                 fi;;
6055         *)
6056                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6057                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6058                 then tval=true;
6059                 else tval=false;
6060                 fi;
6061                 $rm -f t t.c;;
6062         esac;;
6063 *)
6064         case "$tval" in
6065         $define) tval=true;;
6066         *) tval=false;;
6067         esac;;
6068 esac;
6069 eval "$2=$tval"'
6070
6071 : define an is-in-libc? function
6072 inlibc='echo " "; td=$define; tu=$undef;
6073 sym=$1; var=$2; eval "was=\$$2";
6074 tx=yes;
6075 case "$reuseval$was" in
6076 true) ;;
6077 true*) tx=no;;
6078 esac;
6079 case "$tx" in
6080 yes)
6081         set $sym tres -f;
6082         eval $csym;
6083         case "$tres" in
6084         true)
6085                 echo "$sym() found." >&4;
6086                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6087         *)
6088                 echo "$sym() NOT found." >&4;
6089                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6090         esac;;
6091 *)
6092         case "$was" in
6093         $define) echo "$sym() found." >&4;;
6094         *) echo "$sym() NOT found." >&4;;
6095         esac;;
6096 esac'
6097
6098 : see if dlopen exists
6099 xxx_runnm="$runnm"
6100 runnm=false
6101 set dlopen d_dlopen
6102 eval $inlibc
6103 runnm="$xxx_runnm"
6104
6105 : determine which dynamic loading, if any, to compile in
6106 echo " "
6107 dldir="ext/DynaLoader"
6108 case "$usedl" in
6109 $define|y|true)
6110         dflt='y'
6111         usedl="$define"
6112         ;;
6113 $undef|n|false)
6114         dflt='n'
6115         usedl="$undef"
6116         ;;
6117 *) 
6118         dflt='n'
6119         case "$d_dlopen" in
6120             $define) dflt='y' ;;
6121         esac
6122         case "$i_dld" in
6123             $define) dflt='y' ;;
6124         esac
6125         : Does a dl_xxx.xs file exist for this operating system
6126         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6127         ;;
6128 esac
6129 rp="Do you wish to use dynamic loading?"
6130 . ./myread
6131 usedl="$ans"
6132 case "$ans" in
6133 y*) usedl="$define"
6134         case "$dlsrc" in
6135         '')
6136                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6137                         dflt="$dldir/dl_${osname}.xs"
6138                 elif $test "$d_dlopen" = "$define" ; then
6139                         dflt="$dldir/dl_dlopen.xs"
6140                 elif $test "$i_dld" = "$define" ; then
6141                         dflt="$dldir/dl_dld.xs"
6142                 else
6143                         dflt=''
6144                 fi
6145                 ;;
6146         *)      dflt="$dldir/$dlsrc"
6147                 ;;
6148         esac
6149     echo "The following dynamic loading files are available:"
6150         : Can not go over to $dldir because getfile has path hard-coded in.
6151         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6152         rp="Source file to use for dynamic loading"
6153         fn="fne"
6154         gfpth="$src"
6155         . ./getfile
6156         usedl="$define"
6157         : emulate basename
6158         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6159
6160         $cat << EOM
6161
6162 Some systems may require passing special flags to $cc -c to
6163 compile modules that will be used to create a shared library.
6164 To use no flags, say "none".
6165
6166 EOM
6167     case "$cccdlflags" in
6168     '') case "$gccversion" in
6169                 '') case "$osname" in
6170                         hpux)   dflt='+z' ;;
6171                         next)   dflt='none' ;;
6172                         irix*)  dflt='-KPIC' ;;
6173                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6174                         sunos)  dflt='-pic' ;;
6175                         *)      dflt='none' ;;
6176                     esac
6177                         ;;
6178                 *)  case "$osname" in
6179                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6180                         *)      dflt='-fpic' ;;
6181                     esac ;;
6182             esac ;;
6183         ' ') dflt='none' ;;
6184     *)  dflt="$cccdlflags" ;;
6185     esac
6186     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6187     . ./myread
6188     case "$ans" in
6189     none) cccdlflags=' ' ;;
6190     *) cccdlflags="$ans" ;;
6191     esac
6192
6193     cat << EOM
6194
6195 Some systems use ld to create libraries that can be dynamically loaded,
6196 while other systems (such as those using ELF) use $cc.
6197
6198 EOM
6199         case "$ld" in
6200         '')     $cat >try.c <<'EOM'
6201 /* Test for whether ELF binaries are produced */
6202 #include <fcntl.h>
6203 #include <stdlib.h>
6204 int main() {
6205         char b[4];
6206         int i = open("a.out",O_RDONLY);
6207         if(i == -1) 
6208                 exit(1); /* fail */
6209         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6210                 exit(0); /* succeed (yes, it's ELF) */
6211         else
6212                 exit(1); /* fail */
6213 }
6214 EOM
6215                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6216                         cat <<EOM
6217 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6218 EOM
6219                         dflt="$cc"
6220                 else
6221                         echo "I'll use ld to build dynamic libraries."
6222                         dflt='ld'
6223                 fi
6224                 rm -f try.c a.out
6225                 ;;
6226         *)      dflt="$ld"
6227                 ;;
6228         esac
6229
6230     rp="What command should be used to create dynamic libraries?"
6231     . ./myread
6232         ld="$ans"
6233
6234     cat << EOM
6235
6236 Some systems may require passing special flags to $ld to create a
6237 library that can be dynamically loaded.  If your ld flags include
6238 -L/other/path options to locate libraries outside your loader's normal
6239 search path, you may need to specify those -L options here as well.  To
6240 use no flags, say "none".
6241
6242 EOM
6243     case "$lddlflags" in
6244     '') case "$osname" in
6245                         beos) dflt='-nostart' ;;
6246                         hpux) dflt='-b';
6247                               case "$gccversion" in
6248                               '') dflt="$dflt +vnocompatwarnings" ;;
6249                               esac
6250                               ;;        
6251                         linux|irix*)    dflt='-shared' ;;
6252                         next)  dflt='none' ;;
6253                         solaris) dflt='-G' ;;
6254                         sunos) dflt='-assert nodefinitions' ;;
6255                         svr4*|esix*) dflt="-G $ldflags" ;;
6256                 *)     dflt='none' ;;
6257                         esac
6258                         ;;
6259     *) dflt="$lddlflags" ;;
6260     esac
6261
6262         : Try to guess additional flags to pick up local libraries.
6263         : Be careful not to append to a plain 'none'
6264         case "$dflt" in
6265         none) dflt='' ;;
6266         esac
6267         for thisflag in $ldflags; do
6268                 case "$thisflag" in
6269                 -L*)
6270                         case " $dflt " in
6271                         *" $thisflag "*) ;;
6272                         *) dflt="$dflt $thisflag" ;;
6273                         esac
6274                         ;;
6275                 esac
6276         done
6277
6278         case "$dflt" in
6279         ''|' ') dflt='none' ;;
6280         esac
6281
6282     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6283     . ./myread
6284     case "$ans" in
6285     none) lddlflags=' ' ;;
6286     *) lddlflags="$ans" ;;
6287     esac
6288
6289         cat <<EOM
6290
6291 Some systems may require passing special flags to $cc to indicate that
6292 the resulting executable will use dynamic linking.  To use no flags,
6293 say "none".
6294
6295 EOM
6296     case "$ccdlflags" in
6297     '') case "$osname" in
6298                 hpux)   dflt='-Wl,-E' ;;
6299                 linux)  dflt='-rdynamic' ;;
6300                 next)   dflt='none' ;;
6301                 sunos)  dflt='none' ;;
6302                 *)      dflt='none' ;;
6303             esac ;;
6304     ' ')  dflt='none' ;;
6305     *)  dflt="$ccdlflags" ;;
6306     esac
6307     rp="Any special flags to pass to $cc to use dynamic linking?"
6308     . ./myread
6309     case "$ans" in
6310     none) ccdlflags=' ' ;;
6311     *) ccdlflags="$ans" ;;
6312     esac
6313     ;;
6314 *)  usedl="$undef"
6315         ld='ld'
6316     dlsrc='dl_none.xs'
6317     lddlflags=''
6318     ccdlflags=''
6319     ;;
6320 esac
6321
6322 also=''
6323 case "$usedl" in
6324 $undef)
6325         # No dynamic loading being used, so don't bother even to prompt.
6326         useshrplib='false'
6327         ;;
6328 *)      case "$useshrplib" in
6329         '')     case "$osname" in
6330                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6331                         dflt=y
6332                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6333                         ;;
6334                 next*)
6335                         case "$osvers" in
6336                         4*)     dflt=y
6337                                 also='Building a shared libperl is needed for MAB support.'
6338                                 ;;
6339                         *)      dflt=n
6340                                 ;;
6341                         esac
6342                         ;;
6343                 *)      dflt=n
6344                         ;;
6345                 esac
6346                 ;;
6347         $define|true|[Yy]*)
6348                 dflt=y
6349                 ;;
6350         *)      dflt=n
6351                 ;;
6352         esac
6353         $cat << EOM
6354
6355 The perl executable is normally obtained by linking perlmain.c with
6356 libperl${_a}, any static extensions (usually just DynaLoader), and
6357 any other libraries needed on this system (such as -lm, etc.).  Since
6358 your system supports dynamic loading, it is probably possible to build
6359 a shared libperl.$so.  If you will have more than one executable linked
6360 to libperl.$so, this will significantly reduce the size of each
6361 executable, but it may have a noticeable affect on performance.  The
6362 default is probably sensible for your system.
6363 $also
6364
6365 EOM
6366         rp="Build a shared libperl.$so (y/n)"
6367         . ./myread
6368         case "$ans" in
6369         true|$define|[Yy]*)
6370                 useshrplib='true'  ;;
6371         *)      useshrplib='false' ;;
6372         esac
6373         ;;
6374 esac
6375
6376 case "$useshrplib" in
6377 true)
6378         case "$libperl" in
6379         '')
6380                 # Figure out a good name for libperl.so.  Since it gets stored in
6381                 # a version-specific architecture-dependent library, the version
6382                 # number isn't really that important, except for making cc/ld happy.
6383                 #
6384                 # A name such as libperl.so.3.1
6385                 majmin="libperl.$so.$patchlevel.$subversion"
6386                 # A name such as libperl.so.301
6387                 majonly=`echo $patchlevel $subversion |
6388                         $awk '{printf "%d%02d", $1, $2}'`
6389                 majonly=libperl.$so.$majonly
6390                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6391                 # rely on figuring it out from the naming of libc.
6392                 case "${osname}${osvers}" in
6393                 next4*)
6394                         dflt=libperl.5.$so
6395                         # XXX How handle the --version stuff for MAB?
6396                         ;;
6397                 linux*)  # ld won't link with a bare -lperl otherwise.
6398                         dflt=libperl.$so
6399                         ;;
6400                 cygwin*) # include version
6401                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6402                         ;;
6403                 *)      # Try to guess based on whether libc has major.minor.
6404                         case "$libc" in
6405                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6406                         *libc.$so.[0-9]*) dflt=$majonly ;;
6407                         *)      dflt=libperl.$so ;;
6408                         esac
6409                         ;;
6410                 esac
6411                 ;;
6412         *)      dflt=$libperl
6413                 ;;
6414         esac
6415         cat << EOM
6416
6417 I need to select a good name for the shared libperl.  If your system uses
6418 library names with major and minor numbers, then you might want something
6419 like $majmin.  Alternatively, if your system uses a single version
6420 number for shared libraries, then you might want to use $majonly.
6421 Or, your system might be quite happy with a simple libperl.$so.
6422
6423 Since the shared libperl will get installed into a version-specific
6424 architecture-dependent directory, the version number of the shared perl
6425 library probably isn't important, so the default should be o.k.
6426
6427 EOM
6428         rp='What name do you want to give to the shared libperl?'
6429         . ./myread
6430         libperl=$ans
6431         echo "Ok, I'll use $libperl"
6432         ;;
6433 *)
6434         libperl="libperl${_a}"
6435         ;;
6436 esac
6437
6438 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6439 case "$shrpdir" in
6440 '') ;;
6441 *)      $cat >&4 <<EOM
6442 WARNING:  Use of the shrpdir variable for the installation location of
6443 the shared $libperl is not supported.  It was never documented and
6444 will not work in this version.  Let me (perlbug@perl.com)
6445 know of any problems this may cause.
6446
6447 EOM
6448         case "$shrpdir" in
6449         "$archlibexp/CORE")
6450                 $cat >&4 <<EOM
6451 But your current setting of $shrpdir is
6452 the default anyway, so it's harmless.
6453 EOM
6454                 ;;
6455         *)
6456                 $cat >&4 <<EOM
6457 Further, your current attempted setting of $shrpdir
6458 conflicts with the value of $archlibexp/CORE
6459 that installperl will use.
6460 EOM
6461                 ;;
6462         esac
6463         ;;
6464 esac
6465
6466 # How will the perl executable find the installed shared $libperl?
6467 # Add $xxx to ccdlflags.
6468 # If we can't figure out a command-line option, use $shrpenv to
6469 # set env LD_RUN_PATH.  The main perl makefile uses this.
6470 shrpdir=$archlibexp/CORE
6471 xxx=''
6472 tmp_shrpenv=''
6473 if "$useshrplib"; then
6474     case "$osname" in 
6475         aix)
6476                 # We'll set it in Makefile.SH...
6477                 ;;
6478         solaris|netbsd)
6479                 xxx="-R $shrpdir"
6480                 ;;
6481         freebsd)
6482                 xxx="-Wl,-R$shrpdir"
6483                 ;;
6484         linux|irix*|dec_osf)
6485                 xxx="-Wl,-rpath,$shrpdir"
6486                 ;;
6487         next)
6488                 # next doesn't like the default...
6489                 ;;
6490         beos)
6491                 # beos doesn't like the default, either.
6492                 ;;
6493         hpux*)
6494                 # hpux doesn't like the default, either.
6495                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6496                 ;;
6497         *)
6498                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6499                 ;;
6500         esac
6501         case "$xxx" in
6502         '') ;;
6503         *)      
6504                 # Only add $xxx if it isn't already in ccdlflags.
6505                 case " $ccdlflags " in
6506                 *" $xxx "*)     ;;
6507                 *)      ccdlflags="$ccdlflags $xxx"
6508                         cat <<EOM >&4
6509
6510 Adding $xxx to the flags
6511 passed to $ld so that the perl executable will find the 
6512 installed shared $libperl.
6513
6514 EOM
6515                         ;;
6516                 esac
6517                 ;;
6518         esac
6519 fi
6520 # Fix ccdlflags in AIX for building external extensions.
6521 # (For building Perl itself bare -bE:perl.exp is needed,
6522 #  Makefile.SH takes care of this.)
6523 case "$osname" in
6524 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6525 esac
6526 # Respect a hint or command-line value.
6527 case "$shrpenv" in
6528 '') shrpenv="$tmp_shrpenv" ;;
6529 esac
6530 case "$ldlibpthname" in
6531 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6532 none)   ldlibpthname='' ;;
6533 esac
6534
6535 : determine where manual pages go
6536 set man1dir man1dir none
6537 eval $prefixit
6538 $cat <<EOM
6539
6540 $spackage has manual pages available in source form.
6541 EOM
6542 case "$nroff" in
6543 nroff)
6544         echo "However, you don't have nroff, so they're probably useless to you."
6545         case "$man1dir" in
6546         '') man1dir="none";;
6547         esac;;
6548 esac
6549 echo "If you don't want the manual sources installed, answer 'none'."
6550 case "$man1dir" in
6551 ' ') dflt=none
6552         ;;
6553 '')
6554         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6555         lookpath="$lookpath $prefixexp/man/p_man/man1"
6556         lookpath="$lookpath $prefixexp/man/u_man/man1"
6557         lookpath="$lookpath $prefixexp/man/man.1"
6558         case "$sysman" in
6559         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6560         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6561         esac
6562         set dflt
6563         eval $prefixup
6564         ;;
6565 *)  dflt="$man1dir"
6566         ;;
6567 esac
6568 echo " "
6569 fn=dn+~
6570 rp="Where do the main $spackage manual pages (source) go?"
6571 . ./getfile
6572 if $test "X$man1direxp" != "X$ansexp"; then
6573         installman1dir=''
6574 fi
6575 man1dir="$ans"
6576 man1direxp="$ansexp"
6577 case "$man1dir" in
6578 '')     man1dir=' '
6579         installman1dir='';;
6580 esac
6581
6582 : Change installation prefix, if necessary.
6583 if $test X"$prefix" != X"$installprefix"; then
6584         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6585 else
6586         installman1dir="$man1direxp"
6587 fi
6588
6589 : What suffix to use on installed man pages
6590
6591 case "$man1dir" in
6592 ' ')
6593         man1ext='0'
6594         ;;
6595 *)
6596         rp="What suffix should be used for the main $spackage man pages?"
6597         case "$man1ext" in
6598         '')     case "$man1dir" in
6599                 *1)  dflt=1 ;;
6600                 *1p) dflt=1p ;;
6601                 *1pm) dflt=1pm ;;
6602                 *l) dflt=l;;
6603                 *n) dflt=n;;
6604                 *o) dflt=o;;
6605                 *p) dflt=p;;
6606                 *C) dflt=C;;
6607                 *L) dflt=L;;
6608                 *L1) dflt=L1;;
6609                 *) dflt=1;;
6610                 esac
6611                 ;;
6612         *)      dflt="$man1ext";;
6613         esac
6614         . ./myread
6615         man1ext="$ans"
6616         ;;
6617 esac
6618
6619 : see if we can have long filenames
6620 echo " "
6621 first=123456789abcdef
6622 $rm -f $first
6623 if (echo hi >$first) 2>/dev/null; then
6624         if $test -f 123456789abcde; then
6625                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6626                 val="$undef"
6627         else
6628                 echo 'You can have filenames longer than 14 characters.'>&4
6629                 val="$define"
6630         fi
6631 else
6632         $cat <<'EOM'
6633 You can't have filenames longer than 14 chars.
6634 You can't even think about them!
6635 EOM
6636         val="$undef"
6637 fi 
6638 set d_flexfnam
6639 eval $setvar
6640 $rm -rf 123456789abcde*
6641
6642 : determine where library module manual pages go
6643 set man3dir man3dir none
6644 eval $prefixit
6645 $cat <<EOM
6646
6647 $spackage has manual pages for many of the library modules.
6648 EOM
6649
6650 case "$nroff" in
6651 nroff)
6652         $cat <<'EOM'
6653 However, you don't have nroff, so they're probably useless to you.
6654 EOM
6655         case "$man3dir" in
6656         '') man3dir="none";;
6657         esac;;
6658 esac
6659
6660 case "$d_flexfnam" in
6661 undef)
6662         $cat <<'EOM'
6663 However, your system can't handle the long file names like File::Basename.3. 
6664 EOM
6665         case "$man3dir" in
6666         '') man3dir="none";;
6667         esac;;
6668 esac
6669
6670 echo "If you don't want the manual sources installed, answer 'none'."
6671 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6672 case "$man3dir" in
6673 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6674         if $test -d "$privlib/man/man3"; then
6675                 cat <<EOM >&4
6676
6677 WARNING:  Previous versions of perl installed man3 pages into
6678 $privlib/man/man3.  This version will suggest a 
6679 new default of $dflt.  
6680 EOM
6681                 tdflt=$dflt
6682                 dflt='n'
6683                 rp='Do you wish to preserve the old behavior?(y/n)'
6684                 . ./myread
6685                 case "$ans" in
6686                 y*) dflt="$privlib/man/man3" ;;
6687                 *)  dflt=$tdflt ;;
6688                 esac
6689     fi
6690         ;;
6691 *)      dflt="$man3dir" ;;
6692 esac
6693 case "$dflt" in
6694 ' ') dflt=none ;;
6695 esac
6696 echo " "
6697 fn=dn+~
6698 rp="Where do the $package library man pages (source) go?"
6699 . ./getfile
6700 man3dir="$ans"
6701 man3direxp="$ansexp"
6702 case "$man3dir" in
6703 '')     man3dir=' '
6704         installman3dir='';;
6705 esac
6706
6707 : Change installation prefix, if necessary.
6708 if $test X"$prefix" != X"$installprefix"; then
6709         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6710 else
6711         installman3dir="$man3direxp"
6712 fi
6713
6714 : What suffix to use on installed man pages
6715 case "$man3dir" in
6716 ' ')
6717         man3ext='0'
6718         ;;
6719 *)
6720         rp="What suffix should be used for the $package library man pages?"
6721         case "$man3ext" in
6722         '')     case "$man3dir" in
6723                 *3)  dflt=3 ;;
6724                 *3p) dflt=3p ;;
6725                 *3pm) dflt=3pm ;;
6726                 *l) dflt=l;;
6727                 *n) dflt=n;;
6728                 *o) dflt=o;;
6729                 *p) dflt=p;;
6730                 *C) dflt=C;;
6731                 *L) dflt=L;;
6732                 *L3) dflt=L3;;
6733                 *) dflt=3;;
6734                 esac
6735                 ;;
6736         *)      dflt="$man3ext";;
6737         esac
6738         . ./myread
6739         man3ext="$ans"
6740         ;;
6741 esac
6742
6743 : see if we have to deal with yellow pages, now NIS.
6744 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6745         if $test -f /usr/etc/nibindd; then
6746                 echo " "
6747                 echo "I'm fairly confident you're on a NeXT."
6748                 echo " "
6749                 rp='Do you get the hosts file via NetInfo?'
6750                 dflt=y
6751                 case "$hostcat" in
6752                 nidump*) ;;
6753                 '') ;;
6754                 *) dflt=n;;
6755                 esac
6756                 . ./myread
6757                 case "$ans" in
6758                 y*) hostcat='nidump hosts .';;
6759                 *)      case "$hostcat" in
6760                         nidump*) hostcat='';;
6761                         esac
6762                         ;;
6763                 esac
6764         fi
6765         case "$hostcat" in
6766         nidump*) ;;
6767         *)
6768                 case "$hostcat" in
6769                 *ypcat*) dflt=y;;
6770                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6771                                 dflt=y
6772                         else
6773                                 dflt=n
6774                         fi;;
6775                 *) dflt=n;;
6776                 esac
6777                 echo " "
6778                 rp='Are you getting the hosts file via yellow pages?'
6779                 . ./myread
6780                 case "$ans" in
6781                 y*) hostcat='ypcat hosts';;
6782                 *) hostcat='cat /etc/hosts';;
6783                 esac
6784                 ;;
6785         esac
6786 fi
6787 case "$hostcat" in
6788 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6789 esac
6790 case "$groupcat" in
6791 '') test -f /etc/group && groupcat='cat /etc/group';;
6792 esac
6793 case "$passcat" in
6794 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6795 esac
6796
6797 : now get the host name
6798 echo " "
6799 echo "Figuring out host name..." >&4
6800 case "$myhostname" in
6801 '') cont=true
6802         echo 'Maybe "hostname" will work...'
6803         if tans=`sh -c hostname 2>&1` ; then
6804                 myhostname=$tans
6805                 phostname=hostname
6806                 cont=''
6807         fi
6808         ;;
6809 *) cont='';;
6810 esac
6811 if $test "$cont"; then
6812         if ./xenix; then
6813                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6814                 if tans=`cat /etc/systemid 2>&1` ; then
6815                         myhostname=$tans
6816                         phostname='cat /etc/systemid'
6817                         echo "Whadyaknow.  Xenix always was a bit strange..."
6818                         cont=''
6819                 fi
6820         elif $test -r /etc/systemid; then
6821                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6822         fi
6823 fi
6824 if $test "$cont"; then
6825         echo 'No, maybe "uuname -l" will work...'
6826         if tans=`sh -c 'uuname -l' 2>&1` ; then
6827                 myhostname=$tans
6828                 phostname='uuname -l'
6829         else
6830                 echo 'Strange.  Maybe "uname -n" will work...'
6831                 if tans=`sh -c 'uname -n' 2>&1` ; then
6832                         myhostname=$tans
6833                         phostname='uname -n'
6834                 else
6835                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6836                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6837                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6838                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6839                         else
6840                                 case "$myhostname" in
6841                                 '') echo "Does this machine have an identity crisis or something?"
6842                                         phostname='';;
6843                                 *)
6844                                         echo "Well, you said $myhostname before..."
6845                                         phostname='echo $myhostname';;
6846                                 esac
6847                         fi
6848                 fi
6849         fi
6850 fi
6851 : you do not want to know about this
6852 set $myhostname
6853 myhostname=$1
6854
6855 : verify guess
6856 if $test "$myhostname" ; then
6857         dflt=y
6858         rp='Your host name appears to be "'$myhostname'".'" Right?"
6859         . ./myread
6860         case "$ans" in
6861         y*) ;;
6862         *) myhostname='';;
6863         esac
6864 fi
6865
6866 : bad guess or no guess
6867 while $test "X$myhostname" = X ; do
6868         dflt=''
6869         rp="Please type the (one word) name of your host:"
6870         . ./myread
6871         myhostname="$ans"
6872 done
6873
6874 : translate upper to lower if necessary
6875 case "$myhostname" in
6876 *[A-Z]*)
6877         echo "(Normalizing case in your host name)"
6878         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6879         ;;
6880 esac
6881
6882 case "$myhostname" in
6883 *.*)
6884         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6885         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6886         echo "(Trimming domain name from host name--host name is now $myhostname)"
6887         ;;
6888 *) case "$mydomain" in
6889         '')
6890                 {
6891                         test "X$hostcat" = "Xypcat hosts" &&
6892                         ypmatch "$myhostname" hosts 2>/dev/null |\
6893                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6894                         $test -s hosts
6895                 } || {
6896                         test "X$hostcat" != "X" &&
6897                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6898                                         /[       ]$myhostname[  . ]/p" > hosts
6899                 }
6900                 tmp_re="[       . ]"
6901                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6902                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6903                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6904                         hosts | $sort | $uniq | \
6905                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6906                 case `$echo X$dflt` in
6907                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6908                         dflt=.
6909                         ;;
6910                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6911                         ;;
6912                 esac
6913                 case "$dflt" in
6914                 .)
6915                         tans=`./loc resolv.conf X /etc /usr/etc`
6916                         if $test -f "$tans"; then
6917                                 echo "(Attempting domain name extraction from $tans)"
6918                                 dflt=.`$sed -n -e 's/   / /g' \
6919                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6920                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6921                                 case "$dflt" in
6922                                 .) dflt=.`$sed -n -e 's/        / /g' \
6923                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6924                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6925                                         ;;
6926                                 esac
6927                         fi
6928                         ;;
6929                 esac
6930                 case "$dflt" in
6931                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6932                         dflt=.`sh -c domainname 2>/dev/null`
6933                         case "$dflt" in
6934                         '') dflt='.';;
6935                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6936                         esac
6937                         ;;
6938                 esac
6939                 case "$dflt" in
6940                 .) echo "(Lost all hope -- silly guess then)"
6941                         dflt='.uucp'
6942                         ;;
6943                 esac
6944                 $rm -f hosts
6945                 ;;
6946         *) dflt="$mydomain";;
6947         esac;;
6948 esac
6949 echo " "
6950 rp="What is your domain name?"
6951 . ./myread
6952 tans="$ans"
6953 case "$ans" in
6954 '') ;;
6955 .*) ;;
6956 *) tans=".$tans";;
6957 esac
6958 mydomain="$tans"
6959
6960 : translate upper to lower if necessary
6961 case "$mydomain" in
6962 *[A-Z]*)
6963         echo "(Normalizing case in your domain name)"
6964         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6965         ;;
6966 esac
6967
6968 : a little sanity check here
6969 case "$phostname" in
6970 '') ;;
6971 *)
6972         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6973         $myhostname$mydomain|$myhostname) ;;
6974         *)
6975                 case "$phostname" in
6976                 sed*)
6977                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6978                         ;;
6979                 *)
6980                         echo "(That doesn't agree with your $phostname command, by the way.)"
6981                         ;;
6982                 esac
6983         ;;
6984         esac
6985         ;;
6986 esac
6987
6988 $cat <<EOM
6989
6990 I need to get your e-mail address in Internet format if possible, i.e.
6991 something like user@host.domain. Please answer accurately since I have
6992 no easy means to double check it. The default value provided below
6993 is most probably close to reality but may not be valid from outside
6994 your organization...
6995
6996 EOM
6997 cont=x
6998 while test "$cont"; do
6999         case "$cf_email" in
7000         '') dflt="$cf_by@$myhostname$mydomain";;
7001         *) dflt="$cf_email";;
7002         esac
7003         rp='What is your e-mail address?'
7004         . ./myread
7005         cf_email="$ans"
7006         case "$cf_email" in
7007         *@*.*) cont='' ;;
7008         *)
7009                 rp='Address does not look like an Internet one.  Use it anyway?'
7010                 case "$fastread" in
7011                 yes) dflt=y ;;
7012                 *) dflt=n ;;
7013                 esac
7014                 . ./myread
7015                 case "$ans" in
7016                 y*) cont='' ;;
7017                 *) echo " " ;;
7018                 esac
7019                 ;;
7020         esac
7021 done
7022
7023 $cat <<EOM
7024
7025 If you or somebody else will be maintaining perl at your site, please
7026 fill in the correct e-mail address here so that they may be contacted
7027 if necessary. Currently, the "perlbug" program included with perl
7028 will send mail to this address in addition to perlbug@perl.com. You may
7029 enter "none" for no administrator.
7030
7031 EOM
7032 case "$perladmin" in
7033 '') dflt="$cf_email";;
7034 *) dflt="$perladmin";;
7035 esac
7036 rp='Perl administrator e-mail address'
7037 . ./myread
7038 perladmin="$ans"
7039
7040 : figure out how to guarantee perl startup
7041 case "$startperl" in
7042 '')
7043         case "$sharpbang" in
7044         *!)
7045                 $cat <<EOH
7046
7047 I can use the #! construct to start perl on your system. This will
7048 make startup of perl scripts faster, but may cause problems if you
7049 want to share those scripts and perl is not in a standard place
7050 ($binexp/perl) on all your platforms. The alternative is to force
7051 a shell by starting the script with a single ':' character.
7052
7053 EOH
7054                 dflt="$binexp/perl"
7055                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7056                 . ./myread
7057                 case "$ans" in
7058                 none)   startperl=": # use perl";;
7059                 *)      startperl="#!$ans"
7060                         if $test 30 -lt `echo "$ans" | wc -c`; then
7061                                 $cat >&4 <<EOM
7062
7063 WARNING:  Some systems limit the #! command to 32 characters.
7064 If you experience difficulty running Perl scripts with #!, try
7065 installing Perl in a directory with a shorter pathname.
7066
7067 EOM
7068                         fi ;;
7069                 esac
7070                 ;;
7071         *) startperl=": # use perl"
7072                 ;;
7073         esac
7074         ;;
7075 esac
7076 echo "I'll use $startperl to start perl scripts."
7077
7078 : figure best path for perl in scripts
7079 case "$perlpath" in
7080 '')
7081         perlpath="$binexp/perl"
7082         case "$startperl" in
7083         *!*) ;;
7084         *)
7085                 $cat <<EOH
7086
7087 I will use the "eval 'exec'" idiom to start Perl on your system.
7088 I can use the full path of your Perl binary for this purpose, but
7089 doing so may cause problems if you want to share those scripts and
7090 Perl is not always in a standard place ($binexp/perl).
7091
7092 EOH
7093                 dflt="$binexp/perl"
7094                 rp="What path shall I use in \"eval 'exec'\"?"
7095                 . ./myread
7096                 perlpath="$ans"
7097                 ;;
7098         esac
7099         ;;
7100 esac
7101 case "$startperl" in
7102 *!*)    ;;
7103 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7104 esac
7105
7106 : determine where public executable scripts go
7107 set scriptdir scriptdir
7108 eval $prefixit
7109 case "$scriptdir" in
7110 '')
7111         dflt="$bin"
7112         : guess some guesses
7113         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7114         $test -d /usr/share/bin     && dflt=/usr/share/bin
7115         $test -d /usr/local/script  && dflt=/usr/local/script
7116         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7117         $test -d $prefixexp/script  && dflt=$prefixexp/script
7118         set dflt
7119         eval $prefixup
7120         ;;
7121 *)  dflt="$scriptdir"
7122         ;;
7123 esac
7124 $cat <<EOM
7125  
7126 Some installations have a separate directory just for executable scripts so
7127 that they can mount it across multiple architectures but keep the scripts in
7128 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7129 Or you might just lump your scripts in with all your other executables.
7130  
7131 EOM
7132 fn=d~
7133 rp='Where do you keep publicly executable scripts?'
7134 . ./getfile
7135 if $test "X$ansexp" != "X$scriptdirexp"; then
7136         installscript=''
7137 fi
7138 scriptdir="$ans"
7139 scriptdirexp="$ansexp"
7140 : Change installation prefix, if necessary.
7141 if $test X"$prefix" != X"$installprefix"; then
7142         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7143 else
7144         installscript="$scriptdirexp"
7145 fi
7146
7147 : determine where site specific architecture-dependent libraries go.
7148 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7149 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7150 : sitelib may have an optional trailing /share.
7151 case "$sitearch" in
7152 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7153         dflt="$dflt/$archname"
7154         ;;
7155 *)      dflt="$sitearch"
7156         ;;
7157 esac
7158 set sitearch sitearch none
7159 eval $prefixit
7160 $cat <<EOM
7161
7162 The installation process will also create a directory for
7163 architecture-dependent site-specific extensions and modules.
7164
7165 EOM
7166 fn=d~+
7167 rp='Pathname for the site-specific architecture-dependent library files?'
7168 . ./getfile
7169 sitearch="$ans"
7170 sitearchexp="$ansexp"
7171 : Change installation prefix, if necessary.
7172 if $test X"$prefix" != X"$installprefix"; then
7173         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7174 else
7175         installsitearch="$sitearchexp"
7176 fi
7177
7178 : determine where add-on public executables go
7179 case "$sitebin" in
7180 '')     dflt=$siteprefix/bin ;;
7181 *)      dflt=$sitebin ;;
7182 esac
7183 fn=d~
7184 rp='Pathname where the add-on public executables should be installed?'
7185 . ./getfile
7186 sitebin="$ans"
7187 sitebinexp="$ansexp"
7188 : Change installation prefix, if necessary.
7189 if $test X"$prefix" != X"$installprefix"; then
7190         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7191 else
7192         installsitebin="$sitebinexp"
7193 fi
7194
7195 : see if sqrtl exists
7196 set sqrtl d_sqrtl
7197 eval $inlibc
7198
7199 case "$ccflags" in
7200 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7201 esac
7202
7203 case "$uselongdouble" in
7204 $define|true|[yY]*)     dflt='y';;
7205 *) dflt='n';;
7206 esac
7207 cat <<EOM
7208
7209 Perl can be built to take advantage of long doubles which
7210 (if available) may give more accuracy and range for floating point numbers.
7211
7212 If this doesn't make any sense to you, just accept the default '$dflt'.
7213 EOM
7214 rp='Try to use long doubles if available?'
7215 . ./myread
7216 case "$ans" in
7217 y|Y)    val="$define"   ;;
7218 *)      val="$undef"    ;;
7219 esac
7220 set uselongdouble
7221 eval $setvar
7222
7223 case "$uselongdouble" in
7224 true|[yY]*) uselongdouble="$define" ;;
7225 esac
7226
7227 case "$uselongdouble" in
7228 $define)
7229 : Look for a hint-file generated 'call-back-unit'.  If the
7230 : user has specified that long doubles should be used,
7231 : we may need to set or change some other defaults.
7232         if $test -f uselongdouble.cbu; then
7233                 echo "Your platform has some specific hints for long doubles, using them..."
7234                 . ./uselongdouble.cbu
7235         else
7236                 $cat <<EOM
7237 (Your platform doesn't have any specific hints for long doubles.)
7238 EOM
7239         fi
7240         ;;
7241 esac
7242
7243 case "$uselongdouble:$d_sqrtl" in
7244 $define:$undef)
7245                 $cat <<EOM >&4
7246
7247 *** You requested the use of long doubles but you do not seem to have
7248 *** the mathematic functions for long doubles.  I'm disabling the use
7249 *** of long doubles.
7250
7251 EOM
7252         uselongdouble=$undef
7253         ;;
7254 esac
7255
7256 case "$useperlio" in
7257 $define|true|[yY]*)     dflt='y';;
7258 *) dflt='n';;
7259 esac
7260 cat <<EOM
7261
7262 Previous version of $package used the standard IO mechanisms as defined
7263 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7264 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7265 the default.  This abstraction layer can use AT&T's sfio (if you already
7266 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7267 problems with some extension modules.  Using PerlIO with stdio is safe,
7268 but it is slower than plain stdio and therefore is not the default.
7269
7270 If this doesn't make any sense to you, just accept the default '$dflt'.
7271 EOM
7272 rp='Use the experimental PerlIO abstraction layer?'
7273 . ./myread
7274 case "$ans" in
7275 y|Y) 
7276         val="$define"
7277         ;;     
7278 *)      
7279         echo "Ok, doing things the stdio way"
7280         val="$undef"
7281         ;;
7282 esac
7283 set useperlio
7284 eval $setvar 
7285
7286 case "$vendorprefix" in
7287 '')     d_vendorbin="$undef"
7288         vendorbin=''
7289         vendorbinexp=''
7290         ;;
7291 *)      d_vendorbin="$define"
7292         : determine where vendor-supplied executables go.
7293         case "$vendorbin" in
7294         '') dflt=$vendorprefix/bin ;;
7295         *)      dflt="$vendorbin" ;;
7296         esac
7297         fn=d~+
7298         rp='Pathname for the vendor-supplied executables directory?'
7299         . ./getfile
7300         vendorbin="$ans"
7301         vendorbinexp="$ansexp"
7302         ;;
7303 esac
7304 : Change installation prefix, if necessary.
7305 if $test X"$prefix" != X"$installprefix"; then
7306         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7307 else
7308         installvendorbin="$vendorbinexp"
7309 fi
7310
7311 : see if qgcvt exists
7312 set qgcvt d_qgcvt
7313 eval $inlibc
7314
7315 : check for length of double
7316 echo " "
7317 case "$doublesize" in
7318 '')
7319         echo "Checking to see how big your double precision numbers are..." >&4
7320         $cat >try.c <<'EOCP'
7321 #include <stdio.h>
7322 int main()
7323 {
7324     printf("%d\n", (int)sizeof(double));
7325     exit(0);
7326 }
7327 EOCP
7328         set try
7329         if eval $compile_ok; then
7330                 doublesize=`./try`
7331                 echo "Your double is $doublesize bytes long."
7332         else
7333                 dflt='8'
7334                 echo "(I can't seem to compile the test program.  Guessing...)"
7335                 rp="What is the size of a double precision number (in bytes)?"
7336                 . ./myread
7337                 doublesize="$ans"
7338         fi
7339         ;;
7340 esac
7341 $rm -f try.c try
7342
7343 : check for long doubles
7344 echo " "
7345 echo "Checking to see if you have long double..." >&4
7346 echo 'int main() { long double x = 7.0; }' > try.c
7347 set try
7348 if eval $compile; then
7349         val="$define"
7350         echo "You have long double."
7351 else
7352         val="$undef"
7353         echo "You do not have long double."
7354 fi
7355 $rm try.*
7356 set d_longdbl
7357 eval $setvar
7358
7359 : check for length of long double
7360 case "${d_longdbl}${longdblsize}" in
7361 $define)
7362         echo " "
7363         echo "Checking to see how big your long doubles are..." >&4
7364         $cat >try.c <<'EOCP'
7365 #include <stdio.h>
7366 int main()
7367 {
7368         printf("%d\n", sizeof(long double));
7369 }
7370 EOCP
7371         set try
7372         set try
7373         if eval $compile; then
7374                 longdblsize=`./try$exe_ext`
7375                 echo "Your long doubles are $longdblsize bytes long."
7376         else
7377                 dflt='8'
7378                 echo " "
7379                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7380                 rp="What is the size of a long double (in bytes)?"
7381                 . ./myread
7382                 longdblsize="$ans"
7383         fi
7384         if $test "X$doublesize" = "X$longdblsize"; then
7385                 echo "(That isn't any different from an ordinary double.)"
7386         fi      
7387         ;;
7388 esac
7389 $rm -f try.* try
7390
7391 echo " "
7392
7393 if $test X"$d_longdbl" = X"$define"; then
7394
7395 echo "Checking how to print long doubles..." >&4
7396
7397 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7398         $cat >try.c <<'EOCP'
7399 #include <sys/types.h>
7400 #include <stdio.h>
7401 int main() {
7402   double d = 123.456;
7403   printf("%.3f\n", d);
7404 }
7405 EOCP
7406         set try
7407         if eval $compile; then
7408                 yyy=`./try$exe_ext`
7409                 case "$yyy" in
7410                 123.456)
7411                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7412                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7413                         echo "We will use %f."
7414                         ;;
7415                 esac
7416         fi
7417 fi
7418
7419 if $test X"$sPRIfldbl" = X; then
7420         $cat >try.c <<'EOCP'
7421 #include <sys/types.h>
7422 #include <stdio.h>
7423 int main() {
7424   long double d = 123.456;
7425   printf("%.3llf\n", d);
7426 }
7427 EOCP
7428         set try
7429         if eval $compile; then
7430                 yyy=`./try$exe_ext`
7431                 case "$yyy" in
7432                 123.456)
7433                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7434                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7435                         echo "We will use %llf."
7436                         ;;
7437                 esac
7438         fi
7439 fi
7440
7441 if $test X"$sPRIfldbl" = X; then
7442         $cat >try.c <<'EOCP'
7443 #include <sys/types.h>
7444 #include <stdio.h>
7445 int main() {
7446   long double d = 123.456;
7447   printf("%.3Lf\n", d);
7448 }
7449 EOCP
7450         set try
7451         if eval $compile; then
7452                 yyy=`./try$exe_ext`
7453                 case "$yyy" in
7454                 123.456)
7455                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7456                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7457                         echo "We will use %Lf."
7458                         ;;
7459                 esac
7460         fi
7461 fi
7462
7463 if $test X"$sPRIfldbl" = X; then
7464         $cat >try.c <<'EOCP'
7465 #include <sys/types.h>
7466 #include <stdio.h>
7467 int main() {
7468   long double d = 123.456;
7469   printf("%.3lf\n", d);
7470 }
7471 EOCP
7472         set try
7473         if eval $compile; then
7474                 yyy=`./try$exe_ext`
7475                 case "$yyy" in
7476                 123.456)
7477                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7478                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7479                         echo "We will use %lf."
7480                         ;;
7481                 esac
7482         fi
7483 fi
7484
7485 if $test X"$sPRIfldbl" = X; then
7486         echo "Cannot figure out how to print long doubles." >&4
7487 fi
7488
7489 $rm -f try try.*
7490
7491 fi # d_longdbl
7492
7493 case "$sPRIfldbl" in
7494 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7495         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7496         ;;
7497 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7498         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7499         ;;
7500 esac
7501
7502 : Check how to convert floats to strings.
7503 if test "X$d_Gconvert" = X; then
7504         echo " "
7505         echo "Checking for an efficient way to convert floats to strings."
7506         echo " " > try.c
7507         case "$uselongdouble" in
7508         "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7509         esac
7510         case "$d_longdbl" in
7511         "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7512         esac
7513         case "$d_PRIgldbl" in
7514         "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7515         esac
7516         $cat >>try.c <<EOP
7517 #ifdef TRY_gconvert
7518 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7519 char *myname = "gconvert";
7520 #endif
7521 #ifdef TRY_gcvt
7522 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7523 char *myname = "gcvt";
7524 #endif
7525 #ifdef TRY_qgcvt
7526 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7527 char *myname = "qgcvt";
7528 #define DOUBLETYPE long double
7529 #endif
7530 #ifdef TRY_sprintf
7531 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7532 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7533 #else
7534 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7535 #endif
7536 char *myname = "sprintf";
7537 #endif
7538
7539 #ifndef DOUBLETYPE
7540 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7541 #define DOUBLETYPE long double
7542 #else
7543 #define DOUBLETYPE double
7544 #endif
7545 #endif
7546
7547 #include <stdio.h>
7548
7549 #define I_STDLIB $i_stdlib
7550 #ifdef I_STDLIB
7551 #include <stdlib.h>
7552 #endif
7553
7554 int
7555 checkit(expect, got)
7556 char *expect;
7557 char *got;
7558 {
7559     if (strcmp(expect, got)) {
7560                 printf("%s oddity:  Expected %s, got %s\n",
7561                         myname, expect, got);
7562                 exit(1);
7563         }
7564 }
7565
7566 int main()
7567
7568         char buf[64]; 
7569         buf[63] = '\0';
7570
7571         /* This must be 1st test on (which?) platform */
7572         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7573         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7574         checkit("0.1", buf);
7575
7576         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7577         checkit("1", buf);
7578
7579         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7580         checkit("1.1", buf);
7581
7582         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7583         checkit("1.01", buf);
7584
7585         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7586         checkit("1.001", buf);
7587
7588         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7589         checkit("1.0001", buf);
7590
7591         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7592         checkit("1.00001", buf);
7593
7594         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7595         checkit("1.000001", buf);
7596
7597         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7598         checkit("0", buf);
7599
7600         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7601         checkit("-1", buf);
7602
7603         /* Some Linux gcvt's give 1.e+5 here. */
7604         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7605         checkit("100000", buf);
7606         
7607         /* Some Linux gcvt's give -1.e+5 here. */
7608         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7609         checkit("-100000", buf);
7610
7611         exit(0);
7612 }
7613 EOP
7614         case "$d_Gconvert" in
7615         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7616         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7617         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7618         *) xxx_list='gconvert gcvt sprintf' ;;
7619         esac
7620
7621         case "$d_longdbl$uselongdouble$d_qgcvt" in
7622         "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7623         esac
7624
7625         for xxx_convert in $xxx_list; do
7626                 echo "Trying $xxx_convert..."
7627                 $rm -f try try$_o
7628                 set try -DTRY_$xxx_convert
7629                 if eval $compile; then
7630                         echo "$xxx_convert() found." >&4
7631                         if ./try; then
7632                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7633                                 break;
7634                         else
7635                                 echo "...But $xxx_convert didn't work as I expected."
7636                         fi
7637                 else
7638                         echo "$xxx_convert NOT found." >&4
7639                 fi
7640         done
7641                 
7642         case "$xxx_convert" in
7643         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7644         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7645         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7646         *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7647            "$define$define$define")
7648               d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7649            *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7650            esac
7651            ;;  
7652         esac
7653 fi
7654
7655 : Initialize h_fcntl
7656 h_fcntl=false
7657
7658 : Initialize h_sysfile
7659 h_sysfile=false
7660
7661 : access call always available on UNIX
7662 set access d_access
7663 eval $inlibc
7664
7665 : locate the flags for 'access()'
7666 case "$d_access" in
7667 "$define")
7668         echo " "
7669         $cat >access.c <<'EOCP'
7670 #include <sys/types.h>
7671 #ifdef I_FCNTL
7672 #include <fcntl.h>
7673 #endif
7674 #ifdef I_SYS_FILE
7675 #include <sys/file.h>
7676 #endif
7677 #ifdef I_UNISTD
7678 #include <unistd.h>
7679 #endif
7680 int main() {
7681         exit(R_OK);
7682 }
7683 EOCP
7684         : check sys/file.h first, no particular reason here
7685         if $test `./findhdr sys/file.h` && \
7686                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7687                 h_sysfile=true;
7688                 echo "<sys/file.h> defines the *_OK access constants." >&4
7689         elif $test `./findhdr fcntl.h` && \
7690                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7691                 h_fcntl=true;
7692                 echo "<fcntl.h> defines the *_OK access constants." >&4
7693         elif $test `./findhdr unistd.h` && \
7694                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7695                 echo "<unistd.h> defines the *_OK access constants." >&4
7696         else
7697                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7698         fi
7699         ;;
7700 esac
7701 $rm -f access*
7702
7703 : see if accessx exists
7704 set accessx d_accessx
7705 eval $inlibc
7706
7707 : see if alarm exists
7708 set alarm d_alarm
7709 eval $inlibc
7710
7711 : see if atolf exists
7712 set atolf d_atolf
7713 eval $inlibc
7714
7715 : see if atoll exists
7716 set atoll d_atoll
7717 eval $inlibc
7718
7719 : Look for GNU-cc style attribute checking
7720 echo " "
7721 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7722 $cat >attrib.c <<'EOCP'
7723 #include <stdio.h>
7724 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7725 EOCP
7726 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7727         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7728                 echo "Your C compiler doesn't fully support __attribute__."
7729                 val="$undef"
7730         else
7731                 echo "Your C compiler supports __attribute__."
7732                 val="$define"
7733         fi
7734 else
7735         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7736         val="$undef"
7737 fi
7738 set d_attribut
7739 eval $setvar
7740 $rm -f attrib*
7741
7742 : see if bcmp exists
7743 set bcmp d_bcmp
7744 eval $inlibc
7745
7746 : see if bcopy exists
7747 set bcopy d_bcopy
7748 eval $inlibc
7749
7750 : see if this is a unistd.h system
7751 set unistd.h i_unistd
7752 eval $inhdr
7753
7754 : see if getpgrp exists
7755 set getpgrp d_getpgrp
7756 eval $inlibc
7757
7758 case "$d_getpgrp" in
7759 "$define")
7760         echo " "
7761         echo "Checking to see which flavor of getpgrp is in use..."
7762         $cat >set.c <<EOP
7763 #$i_unistd I_UNISTD
7764 #include <sys/types.h>
7765 #ifdef I_UNISTD
7766 #  include <unistd.h>
7767 #endif
7768 int main()
7769 {
7770         if (getuid() == 0) {
7771                 printf("(I see you are running Configure as super-user...)\n");
7772                 setuid(1);
7773         }
7774 #ifdef TRY_BSD_PGRP
7775         if (getpgrp(1) == 0)
7776                 exit(0);
7777 #else
7778         if (getpgrp() > 0)
7779                 exit(0);
7780 #endif
7781         exit(1);
7782 }
7783 EOP
7784         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7785                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7786                 val="$define"
7787         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7788                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7789                 val="$undef"
7790         else
7791                 echo "I can't seem to compile and run the test program."
7792                 if ./usg; then
7793                         xxx="a USG one, i.e. you use getpgrp()."
7794                 else
7795                         # SVR4 systems can appear rather BSD-ish.
7796                         case "$i_unistd" in
7797                         $undef)
7798                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7799                                 val="$define"
7800                                 ;;
7801                         $define)
7802                                 xxx="probably a USG one, i.e. you use getpgrp()."
7803                                 val="$undef"
7804                                 ;;
7805                         esac
7806                 fi
7807                 echo "Assuming your getpgrp is $xxx" >&4
7808         fi
7809         ;;
7810 *) val="$undef";;
7811 esac
7812 set d_bsdgetpgrp
7813 eval $setvar
7814 $rm -f set set.c
7815
7816 : see if setpgrp exists
7817 set setpgrp d_setpgrp
7818 eval $inlibc
7819
7820 case "$d_setpgrp" in
7821 "$define")
7822         echo " "
7823         echo "Checking to see which flavor of setpgrp is in use..."
7824         $cat >set.c <<EOP
7825 #$i_unistd I_UNISTD
7826 #include <sys/types.h>
7827 #ifdef I_UNISTD
7828 #  include <unistd.h>
7829 #endif
7830 int main()
7831 {
7832         if (getuid() == 0) {
7833                 printf("(I see you are running Configure as super-user...)\n");
7834                 setuid(1);
7835         }
7836 #ifdef TRY_BSD_PGRP
7837         if (-1 == setpgrp(1, 1))
7838                 exit(0);
7839 #else
7840         if (setpgrp() != -1)
7841                 exit(0);
7842 #endif
7843         exit(1);
7844 }
7845 EOP
7846         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7847                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7848                 val="$define"
7849         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7850                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7851                 val="$undef"
7852         else
7853                 echo "(I can't seem to compile and run the test program.)"
7854                 if ./usg; then
7855                         xxx="a USG one, i.e. you use setpgrp()."
7856                 else
7857                         # SVR4 systems can appear rather BSD-ish.
7858                         case "$i_unistd" in
7859                         $undef)
7860                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7861                                 val="$define"
7862                                 ;;
7863                         $define)
7864                                 xxx="probably a USG one, i.e. you use setpgrp()."
7865                                 val="$undef"
7866                                 ;;
7867                         esac
7868                 fi
7869                 echo "Assuming your setpgrp is $xxx" >&4
7870         fi
7871         ;;
7872 *) val="$undef";;
7873 esac
7874 set d_bsdsetpgrp
7875 eval $setvar
7876 $rm -f set set.c
7877 : see if bzero exists
7878 set bzero d_bzero
7879 eval $inlibc
7880
7881 : see if signal is declared as pointer to function returning int or void
7882 echo " "
7883 xxx=`./findhdr signal.h`
7884 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7885 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7886         echo "You have int (*signal())() instead of void." >&4
7887         val="$undef"
7888 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7889         echo "You have void (*signal())()." >&4
7890         val="$define"
7891 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7892         echo "You have int (*signal())() instead of void." >&4
7893         val="$undef"
7894 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7895         echo "You have void (*signal())()." >&4
7896         val="$define"
7897 else
7898         case "$d_voidsig" in
7899         '')
7900         echo "I can't determine whether signal handler returns void or int..." >&4
7901                 dflt=void
7902                 rp="What type does your signal handler return?"
7903                 . ./myread
7904                 case "$ans" in
7905                 v*) val="$define";;
7906                 *) val="$undef";;
7907                 esac;;
7908         "$define")
7909                 echo "As you already told me, signal handler returns void." >&4
7910                 val="$define"
7911                 ;;
7912         *)      echo "As you already told me, signal handler returns int." >&4
7913                 val="$undef"
7914                 ;;
7915         esac
7916 fi
7917 set d_voidsig
7918 eval $setvar
7919 case "$d_voidsig" in
7920 "$define") signal_t="void";;
7921 *) signal_t="int";;
7922 esac
7923 $rm -f $$.tmp
7924
7925 : check for ability to cast large floats to 32-bit ints.
7926 echo " "
7927 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7928 if $test "$intsize" -ge 4; then
7929         xxx=int
7930 else
7931         xxx=long
7932 fi
7933 $cat >try.c <<EOCP
7934 #include <stdio.h>
7935 #include <sys/types.h>
7936 #include <signal.h>
7937 $signal_t blech(s) int s; { exit(3); }
7938 int main()
7939 {
7940         $xxx i32;
7941         double f, g;
7942         int result = 0;
7943         char str[16];
7944         signal(SIGFPE, blech);
7945
7946         /* Don't let compiler optimize the test away.  Store the number 
7947            in a writable string for gcc to pass to sscanf under HP/UX.
7948         */
7949         sprintf(str, "2147483647");
7950         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7951         g = 10 * f;
7952         i32  = ($xxx) g;
7953
7954         /* x86 processors will probably give 0x8000 0000, which is a
7955        sign change.  We don't want that.  We want to mimic SPARC
7956            behavior here, which is to preserve the sign and give
7957            back 0x7fff ffff.
7958         */
7959         if (i32 != ($xxx) f)
7960                 result |= 1;
7961         exit(result);
7962 }
7963 EOCP
7964 set try
7965 if eval $compile_ok; then
7966         ./try
7967         yyy=$?
7968 else
7969         echo "(I can't seem to compile the test program--assuming it can't)"
7970         yyy=1
7971 fi
7972 case "$yyy" in
7973 0)      val="$define"
7974         echo "Yup, it can."
7975         ;;
7976 *)      val="$undef"
7977         echo "Nope, it can't."
7978         ;;
7979 esac
7980 set d_casti32
7981 eval $setvar
7982 $rm -f try try.*
7983
7984 : check for ability to cast negative floats to unsigned
7985 echo " "
7986 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7987 $cat >try.c <<EOCP
7988 #include <stdio.h>
7989 #include <sys/types.h>
7990 #include <signal.h>
7991 $signal_t blech(s) int s; { exit(7); }
7992 $signal_t blech_in_list(s) int s; { exit(4); }
7993 unsigned long dummy_long(p) unsigned long p; { return p; }
7994 unsigned int dummy_int(p) unsigned int p; { return p; }
7995 unsigned short dummy_short(p) unsigned short p; { return p; }
7996 int main()
7997 {
7998         double f;
7999         unsigned long along;
8000         unsigned int aint;
8001         unsigned short ashort;
8002         int result = 0;
8003         char str[16];
8004         
8005         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8006            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8007            optimized the whole file away
8008         */
8009         /* Store the number in a writable string for gcc to pass to 
8010            sscanf under HP/UX.
8011         */
8012         sprintf(str, "-123");
8013         sscanf(str, "%lf", &f);  /* f = -123.; */
8014
8015         signal(SIGFPE, blech);
8016         along = (unsigned long)f;
8017         aint = (unsigned int)f;
8018         ashort = (unsigned short)f;
8019         if (along != (unsigned long)-123)
8020                 result |= 1;
8021         if (aint != (unsigned int)-123)
8022                 result |= 1;
8023         if (ashort != (unsigned short)-123)
8024                 result |= 1;
8025         sprintf(str, "1073741824.");
8026         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8027         f = f + f;
8028         along = 0;
8029         along = (unsigned long)f;
8030         if (along != 0x80000000)
8031                 result |= 2;
8032         f -= 1.;
8033         along = 0;
8034         along = (unsigned long)f;
8035         if (along != 0x7fffffff)
8036                 result |= 1;
8037         f += 2.;
8038         along = 0;
8039         along = (unsigned long)f;
8040         if (along != 0x80000001)
8041                 result |= 2;
8042         if (result)
8043                 exit(result);
8044         signal(SIGFPE, blech_in_list);
8045         sprintf(str, "123.");
8046         sscanf(str, "%lf", &f);  /* f = 123.; */
8047         along = dummy_long((unsigned long)f);
8048         aint = dummy_int((unsigned int)f);
8049         ashort = dummy_short((unsigned short)f);
8050         if (along != (unsigned long)123)
8051                 result |= 4;
8052         if (aint != (unsigned int)123)
8053                 result |= 4;
8054         if (ashort != (unsigned short)123)
8055                 result |= 4;
8056         exit(result);
8057
8058 }
8059 EOCP
8060 set try
8061 if eval $compile_ok; then
8062         ./try
8063         castflags=$?
8064 else
8065         echo "(I can't seem to compile the test program--assuming it can't)"
8066         castflags=7
8067 fi
8068 case "$castflags" in
8069 0)      val="$define"
8070         echo "Yup, it can."
8071         ;;
8072 *)      val="$undef"
8073         echo "Nope, it can't."
8074         ;;
8075 esac
8076 set d_castneg
8077 eval $setvar
8078 $rm -f try.*
8079
8080 : see if vprintf exists
8081 echo " "
8082 if set vprintf val -f d_vprintf; eval $csym; $val; then
8083         echo 'vprintf() found.' >&4
8084         val="$define"
8085         $cat >vprintf.c <<'EOF'
8086 #include <varargs.h>
8087
8088 int main() { xxx("foo"); }
8089
8090 xxx(va_alist)
8091 va_dcl
8092 {
8093         va_list args;
8094         char buf[10];
8095
8096         va_start(args);
8097         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8098 }
8099 EOF
8100         set vprintf
8101         if eval $compile && ./vprintf; then
8102                 echo "Your vsprintf() returns (int)." >&4
8103                 val2="$undef"
8104         else
8105                 echo "Your vsprintf() returns (char*)." >&4
8106                 val2="$define"
8107         fi
8108 else
8109         echo 'vprintf() NOT found.' >&4
8110                 val="$undef"
8111                 val2="$undef"
8112 fi
8113 set d_vprintf
8114 eval $setvar
8115 val=$val2
8116 set d_charvspr
8117 eval $setvar
8118
8119 : see if chown exists
8120 set chown d_chown
8121 eval $inlibc
8122
8123 : see if chroot exists
8124 set chroot d_chroot
8125 eval $inlibc
8126
8127 : see if chsize exists
8128 set chsize d_chsize
8129 eval $inlibc
8130
8131 : check for const keyword
8132 echo " "
8133 echo 'Checking to see if your C compiler knows about "const"...' >&4
8134 $cat >const.c <<'EOCP'
8135 typedef struct spug { int drokk; } spug;
8136 int main()
8137 {
8138         const char *foo;
8139         const spug y;
8140 }
8141 EOCP
8142 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8143         val="$define"
8144         echo "Yup, it does."
8145 else
8146         val="$undef"
8147         echo "Nope, it doesn't."
8148 fi
8149 set d_const
8150 eval $setvar
8151
8152 : see if crypt exists
8153 echo " "
8154 if set crypt val -f d_crypt; eval $csym; $val; then
8155         echo 'crypt() found.' >&4
8156         val="$define"
8157         cryptlib=''
8158 else
8159         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8160         if $test -z "$cryptlib"; then
8161                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8162         else
8163                 cryptlib=-lcrypt
8164         fi
8165         if $test -z "$cryptlib"; then
8166                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8167         else
8168                 cryptlib=-lcrypt
8169         fi
8170         if $test -z "$cryptlib"; then
8171                 cryptlib=`./loc libcrypt$_a "" $libpth`
8172         else
8173                 cryptlib=-lcrypt
8174         fi
8175         if $test -z "$cryptlib"; then
8176                 echo 'crypt() NOT found.' >&4
8177                 val="$undef"
8178         else
8179                 val="$define"
8180         fi
8181 fi
8182 set d_crypt
8183 eval $setvar
8184
8185 : get csh whereabouts
8186 case "$csh" in
8187 'csh') val="$undef" ;;
8188 *) val="$define" ;;
8189 esac
8190 set d_csh
8191 eval $setvar
8192 : Respect a hint or command line value for full_csh.
8193 case "$full_csh" in
8194 '') full_csh=$csh ;;
8195 esac
8196
8197 : see if cuserid exists
8198 set cuserid d_cuserid
8199 eval $inlibc
8200
8201 : see if this is a limits.h system
8202 set limits.h i_limits
8203 eval $inhdr
8204
8205 : see if this is a float.h system
8206 set float.h i_float
8207 eval $inhdr
8208
8209 : See if number of significant digits in a double precision number is known
8210 echo " "
8211 $cat >dbl_dig.c <<EOM
8212 #$i_limits I_LIMITS
8213 #$i_float I_FLOAT
8214 #ifdef I_LIMITS
8215 #include <limits.h>
8216 #endif
8217 #ifdef I_FLOAT
8218 #include <float.h>
8219 #endif
8220 #ifdef DBL_DIG
8221 printf("Contains DBL_DIG");
8222 #endif
8223 EOM
8224 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8225 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8226         echo "DBL_DIG found." >&4
8227         val="$define"
8228 else
8229         echo "DBL_DIG NOT found." >&4
8230         val="$undef"
8231 fi
8232 $rm -f dbl_dig.?
8233 set d_dbl_dig
8234 eval $setvar
8235
8236 : see if difftime exists
8237 set difftime d_difftime
8238 eval $inlibc
8239
8240 : see if this is a dirent system
8241 echo " "
8242 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8243         val="$define"
8244         echo "<dirent.h> found." >&4
8245 else
8246         val="$undef"
8247         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8248                 echo "<sys/dir.h> found." >&4
8249                 echo " "
8250         else
8251                 xinc=`./findhdr sys/ndir.h`
8252         fi
8253         echo "<dirent.h> NOT found." >&4
8254 fi
8255 set i_dirent
8256 eval $setvar
8257
8258 : Look for type of directory structure.
8259 echo " "
8260 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8261
8262 case "$direntrytype" in
8263 ''|' ')
8264         case "$i_dirent" in
8265         $define) guess1='struct dirent' ;;
8266         *) guess1='struct direct'  ;;
8267         esac
8268         ;;
8269 *)      guess1="$direntrytype"
8270         ;;
8271 esac
8272
8273 case "$guess1" in
8274 'struct dirent') guess2='struct direct' ;;
8275 *) guess2='struct dirent' ;;
8276 esac
8277                 
8278 if $contains "$guess1" try.c >/dev/null 2>&1; then
8279         direntrytype="$guess1"
8280         echo "Your directory entries are $direntrytype." >&4
8281 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8282         direntrytype="$guess2"
8283         echo "Your directory entries seem to be $direntrytype." >&4
8284 else
8285         echo "I don't recognize your system's directory entries." >&4
8286         rp="What type is used for directory entries on this system?"
8287         dflt="$guess1"
8288         . ./myread
8289         direntrytype="$ans"
8290 fi
8291 $rm -f try.c
8292
8293
8294 : see if the directory entry stores field length
8295 echo " "
8296 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8297 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8298         echo "Good, your directory entry keeps length information in d_namlen." >&4
8299         val="$define"
8300 else
8301         echo "Your directory entry does not know about the d_namlen field." >&4
8302         val="$undef"
8303 fi
8304 set d_dirnamlen
8305 eval $setvar
8306 $rm -f try.c
8307
8308 : see if dlerror exists
8309 xxx_runnm="$runnm"
8310 runnm=false
8311 set dlerror d_dlerror
8312 eval $inlibc
8313 runnm="$xxx_runnm"
8314
8315 : see if dlfcn is available
8316 set dlfcn.h i_dlfcn
8317 eval $inhdr
8318
8319 case "$usedl" in
8320 $define|y|true)
8321         $cat << EOM
8322
8323 On a few systems, the dynamically loaded modules that perl generates and uses
8324 will need a different extension than shared libs. The default will probably
8325 be appropriate.
8326
8327 EOM
8328         case "$dlext" in
8329         '')     dflt="$so" ;;
8330         *)      dflt="$dlext" ;;
8331         esac
8332         rp='What is the extension of dynamically loaded modules'
8333         . ./myread
8334         dlext="$ans"
8335         ;;
8336 *)
8337         dlext="none"
8338         ;;
8339 esac
8340
8341 : Check if dlsym need a leading underscore
8342 echo " "
8343 val="$undef"
8344
8345 case "$dlsrc" in
8346 dl_dlopen.xs)
8347         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8348         $cat >dyna.c <<'EOM'
8349 fred () { }
8350 EOM
8351
8352 $cat >fred.c<<EOM
8353
8354 #include <stdio.h>
8355 #$i_dlfcn I_DLFCN
8356 #ifdef I_DLFCN
8357 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8358 #else
8359 #include <sys/types.h>
8360 #include <nlist.h>
8361 #include <link.h>
8362 #endif
8363
8364 extern int fred() ;
8365
8366 int main()
8367 {
8368     void * handle ;
8369     void * symbol ;
8370 #ifndef RTLD_LAZY
8371     int mode = 1 ;
8372 #else
8373     int mode = RTLD_LAZY ;
8374 #endif
8375     handle = dlopen("./dyna.$dlext", mode) ;
8376     if (handle == NULL) {
8377         printf ("1\n") ;
8378         fflush (stdout) ;
8379         exit(0);
8380     }
8381     symbol = dlsym(handle, "fred") ;
8382     if (symbol == NULL) {
8383         /* try putting a leading underscore */
8384         symbol = dlsym(handle, "_fred") ;
8385         if (symbol == NULL) {
8386             printf ("2\n") ;
8387             fflush (stdout) ;
8388             exit(0);
8389         }
8390         printf ("3\n") ;
8391     }
8392     else
8393         printf ("4\n") ;
8394     fflush (stdout) ;
8395     exit(0);
8396 }
8397 EOM
8398         : Call the object file tmp-dyna.o in case dlext=o.
8399         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8400                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8401                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8402                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8403                 xxx=`./fred`
8404                 case $xxx in
8405                 1)      echo "Test program failed using dlopen." >&4
8406                         echo "Perhaps you should not use dynamic loading." >&4;;
8407                 2)      echo "Test program failed using dlsym." >&4
8408                         echo "Perhaps you should not use dynamic loading." >&4;;
8409                 3)      echo "dlsym needs a leading underscore" >&4
8410                         val="$define" ;;
8411                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8412                 esac
8413         else
8414                 echo "I can't compile and run the test program." >&4
8415                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8416         fi
8417         ;;
8418 esac
8419                 
8420 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8421
8422 set d_dlsymun
8423 eval $setvar
8424
8425 hasproto='varname=$1; func=$2; shift; shift;
8426 while $test $# -ge 2; do
8427         case "$1" in
8428         $define) echo "#include <$2>";;
8429         esac ;
8430     shift 2;
8431 done > try.c;
8432 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8433 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8434         echo "$func() prototype found.";
8435         val="$define";
8436 else
8437         echo "$func() prototype NOT found.";
8438         val="$undef";
8439 fi;
8440 set $varname;
8441 eval $setvar;
8442 $rm -f try.c tryout.c'
8443
8444 : see if prototype for drand48 is available
8445 echo " "
8446 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8447 eval $hasproto
8448
8449 : see if dup2 exists
8450 set dup2 d_dup2
8451 eval $inlibc
8452
8453 : see if eaccess exists
8454 set eaccess d_eaccess
8455 eval $inlibc
8456
8457 : see if endgrent exists
8458 set endgrent d_endgrent
8459 eval $inlibc
8460
8461 : see if endhostent exists
8462 set endhostent d_endhent
8463 eval $inlibc
8464
8465 : see if endnetent exists
8466 set endnetent d_endnent
8467 eval $inlibc
8468
8469 : see if endprotoent exists
8470 set endprotoent d_endpent
8471 eval $inlibc
8472
8473 : see if endpwent exists
8474 set endpwent d_endpwent
8475 eval $inlibc
8476
8477 : see if endservent exists
8478 set endservent d_endsent
8479 eval $inlibc
8480
8481 : see if endspent exists
8482 set endspent d_endspent
8483 eval $inlibc
8484
8485 : Locate the flags for 'open()'
8486 echo " "
8487 $cat >open3.c <<'EOCP'
8488 #include <sys/types.h>
8489 #ifdef I_FCNTL
8490 #include <fcntl.h>
8491 #endif
8492 #ifdef I_SYS_FILE
8493 #include <sys/file.h>
8494 #endif
8495 int main() {
8496         if(O_RDONLY);
8497 #ifdef O_TRUNC
8498         exit(0);
8499 #else
8500         exit(1);
8501 #endif
8502 }
8503 EOCP
8504 : check sys/file.h first to get FREAD on Sun
8505 if $test `./findhdr sys/file.h` && \
8506                 set open3 -DI_SYS_FILE && eval $compile; then
8507         h_sysfile=true;
8508         echo "<sys/file.h> defines the O_* constants..." >&4
8509         if ./open3; then
8510                 echo "and you have the 3 argument form of open()." >&4
8511                 val="$define"
8512         else
8513                 echo "but not the 3 argument form of open().  Oh, well." >&4
8514                 val="$undef"
8515         fi
8516 elif $test `./findhdr fcntl.h` && \
8517                 set open3 -DI_FCNTL && eval $compile; then
8518         h_fcntl=true;
8519         echo "<fcntl.h> defines the O_* constants..." >&4
8520         if ./open3; then
8521                 echo "and you have the 3 argument form of open()." >&4
8522                 val="$define"
8523         else
8524                 echo "but not the 3 argument form of open().  Oh, well." >&4
8525                 val="$undef"
8526         fi
8527 else
8528         val="$undef"
8529         echo "I can't find the O_* constant definitions!  You got problems." >&4
8530 fi
8531 set d_open3
8532 eval $setvar
8533 $rm -f open3*
8534
8535 : see which of string.h or strings.h is needed
8536 echo " "
8537 strings=`./findhdr string.h`
8538 if $test "$strings" && $test -r "$strings"; then
8539         echo "Using <string.h> instead of <strings.h>." >&4
8540         val="$define"
8541 else
8542         val="$undef"
8543         strings=`./findhdr strings.h`
8544         if $test "$strings" && $test -r "$strings"; then
8545                 echo "Using <strings.h> instead of <string.h>." >&4
8546         else
8547                 echo "No string header found -- You'll surely have problems." >&4
8548         fi
8549 fi
8550 set i_string
8551 eval $setvar
8552 case "$i_string" in
8553 "$undef") strings=`./findhdr strings.h`;;
8554 *)        strings=`./findhdr string.h`;;
8555 esac
8556
8557 : check for non-blocking I/O stuff
8558 case "$h_sysfile" in
8559 true) echo "#include <sys/file.h>" > head.c;;
8560 *)
8561         case "$h_fcntl" in
8562         true) echo "#include <fcntl.h>" > head.c;;
8563         *) echo "#include <sys/fcntl.h>" > head.c;;
8564         esac
8565         ;;
8566 esac
8567 echo " "
8568 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8569 case "$o_nonblock" in
8570 '')
8571         $cat head.c > try.c
8572         $cat >>try.c <<'EOCP'
8573 #include <stdio.h>
8574 int main() {
8575 #ifdef O_NONBLOCK
8576         printf("O_NONBLOCK\n");
8577         exit(0);
8578 #endif
8579 #ifdef O_NDELAY
8580         printf("O_NDELAY\n");
8581         exit(0);
8582 #endif
8583 #ifdef FNDELAY
8584         printf("FNDELAY\n");
8585         exit(0);
8586 #endif
8587         exit(0);
8588 }
8589 EOCP
8590         set try
8591         if eval $compile_ok; then
8592                 o_nonblock=`./try`
8593                 case "$o_nonblock" in
8594                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8595                 *) echo "Seems like we can use $o_nonblock.";;
8596                 esac
8597         else
8598                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8599         fi
8600         ;;
8601 *) echo "Using $hint value $o_nonblock.";;
8602 esac
8603 $rm -f try try.* .out core
8604
8605 echo " "
8606 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8607 case "$eagain" in
8608 '')
8609         $cat head.c > try.c
8610         $cat >>try.c <<EOCP
8611 #include <errno.h>
8612 #include <sys/types.h>
8613 #include <signal.h>
8614 #include <stdio.h> 
8615 #define MY_O_NONBLOCK $o_nonblock
8616 #ifndef errno  /* XXX need better Configure test */
8617 extern int errno;
8618 #endif
8619 #$i_unistd I_UNISTD
8620 #ifdef I_UNISTD
8621 #include <unistd.h>
8622 #endif
8623 #$i_string I_STRING
8624 #ifdef I_STRING
8625 #include <string.h>
8626 #else
8627 #include <strings.h>
8628 #endif
8629 $signal_t blech(x) int x; { exit(3); }
8630 EOCP
8631         $cat >> try.c <<'EOCP'
8632 int main()
8633 {
8634         int pd[2];
8635         int pu[2];
8636         char buf[1];
8637         char string[100];
8638
8639         pipe(pd);       /* Down: child -> parent */
8640         pipe(pu);       /* Up: parent -> child */
8641         if (0 != fork()) {
8642                 int ret;
8643                 close(pd[1]);   /* Parent reads from pd[0] */
8644                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8645                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8646                         exit(1);
8647                 signal(SIGALRM, blech);
8648                 alarm(5);
8649                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8650                         exit(2);
8651                 sprintf(string, "%d\n", ret);
8652                 write(2, string, strlen(string));
8653                 alarm(0);
8654 #ifdef EAGAIN
8655                 if (errno == EAGAIN) {
8656                         printf("EAGAIN\n");
8657                         goto ok;
8658                 }
8659 #endif
8660 #ifdef EWOULDBLOCK
8661                 if (errno == EWOULDBLOCK)
8662                         printf("EWOULDBLOCK\n");
8663 #endif
8664         ok:
8665                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8666                 sleep(2);                               /* Give it time to close our pipe */
8667                 alarm(5);
8668                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8669                 alarm(0);
8670                 sprintf(string, "%d\n", ret);
8671                 write(3, string, strlen(string));
8672                 exit(0);
8673         }
8674
8675         close(pd[0]);                   /* We write to pd[1] */
8676         close(pu[1]);                   /* We read from pu[0] */
8677         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8678         close(pd[1]);                   /* Pipe pd is now fully closed! */
8679         exit(0);                                /* Bye bye, thank you for playing! */
8680 }
8681 EOCP
8682         set try
8683         if eval $compile_ok; then
8684                 echo "$startsh" >mtry
8685                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8686                 chmod +x mtry
8687                 ./mtry >/dev/null 2>&1
8688                 case $? in
8689                 0) eagain=`$cat try.out`;;
8690                 1) echo "Could not perform non-blocking setting!";;
8691                 2) echo "I did a successful read() for something that was not there!";;
8692                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8693                 *) echo "Something terribly wrong happened during testing.";;
8694                 esac
8695                 rd_nodata=`$cat try.ret`
8696                 echo "A read() system call with no data present returns $rd_nodata."
8697                 case "$rd_nodata" in
8698                 0|-1) ;;
8699                 *)
8700                         echo "(That's peculiar, fixing that to be -1.)"
8701                         rd_nodata=-1
8702                         ;;
8703                 esac
8704                 case "$eagain" in
8705                 '')
8706                         echo "Forcing errno EAGAIN on read() with no data available."
8707                         eagain=EAGAIN
8708                         ;;
8709                 *)
8710                         echo "Your read() sets errno to $eagain when no data is available."
8711                         ;;
8712                 esac
8713                 status=`$cat try.err`
8714                 case "$status" in
8715                 0) echo "And it correctly returns 0 to signal EOF.";;
8716                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8717                 *) echo "However, your read() returns '$status' on EOF??";;
8718                 esac
8719                 val="$define"
8720                 if test "$status" = "$rd_nodata"; then
8721                         echo "WARNING: you can't distinguish between EOF and no data!"
8722                         val="$undef"
8723                 fi
8724         else
8725                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8726                 eagain=EAGAIN
8727         fi
8728         set d_eofnblk
8729         eval $setvar
8730         ;;
8731 *)
8732         echo "Using $hint value $eagain."
8733         echo "Your read() returns $rd_nodata when no data is present."
8734         case "$d_eofnblk" in
8735         "$define") echo "And you can see EOF because read() returns 0.";;
8736         "$undef") echo "But you can't see EOF status from read() returned value.";;
8737         *)
8738                 echo "(Assuming you can't see EOF status from read anyway.)"
8739                 d_eofnblk=$undef
8740                 ;;
8741         esac
8742         ;;
8743 esac
8744 $rm -f try try.* .out core head.c mtry
8745
8746 : see if fchmod exists
8747 set fchmod d_fchmod
8748 eval $inlibc
8749
8750 : see if fchown exists
8751 set fchown d_fchown
8752 eval $inlibc
8753
8754 : see if this is an fcntl system
8755 set fcntl d_fcntl
8756 eval $inlibc
8757
8758 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8759 while $test $# -ge 2; do
8760         case "$1" in
8761         $define) echo "#include <$2>";;
8762         esac ;
8763     shift 2;
8764 done > try.c;
8765 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8766 set try;
8767 if eval $compile; then
8768         val="$define";
8769 else
8770         val="$undef";
8771 fi;
8772 set $varname;
8773 eval $setvar;
8774 $rm -f try.c try.o'
8775
8776 socketlib=''
8777 sockethdr=''
8778 : see whether socket exists
8779 echo " "
8780 $echo $n "Hmm... $c" >&4
8781 if set socket val -f d_socket; eval $csym; $val; then
8782         echo "Looks like you have Berkeley networking support." >&4
8783         d_socket="$define"
8784         if set setsockopt val -f; eval $csym; $val; then
8785                 d_oldsock="$undef"
8786         else
8787                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8788                 d_oldsock="$define"
8789         fi
8790 else
8791         if $contains socklib libc.list >/dev/null 2>&1; then
8792                 echo "Looks like you have Berkeley networking support." >&4
8793                 d_socket="$define"
8794                 : we will have to assume that it supports the 4.2 BSD interface
8795                 d_oldsock="$undef"
8796         else
8797                 echo "You don't have Berkeley networking in libc$_a..." >&4
8798                 if test "X$d_socket" = "X$define"; then
8799                    echo "...but you seem to believe that you have sockets." >&4
8800                 else
8801                         for net in net socket
8802                         do
8803                                 if test -f /usr/lib/lib$net$_a; then
8804                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8805                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8806                                         if $contains socket libc.list >/dev/null 2>&1; then
8807                                                 d_socket="$define"
8808                                                 socketlib="-l$net"
8809                                                 case "$net" in
8810                                                 net)
8811                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8812                                                         sockethdr="-I/usr/netinclude"
8813                                                         ;;
8814                                                 esac
8815                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8816                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8817                                                         d_oldsock="$undef"
8818                                                 else
8819                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8820                                                         d_oldsock="$define"
8821                                                 fi
8822                                                 break
8823                                         fi
8824                                 fi
8825                         done
8826                         if test "X$d_socket" != "X$define"; then
8827                            echo "or anywhere else I see." >&4
8828                            d_socket="$undef"
8829                            d_oldsock="$undef"
8830                         fi
8831                 fi
8832         fi
8833 fi
8834
8835 : see if socketpair exists
8836 set socketpair d_sockpair
8837 eval $inlibc
8838
8839
8840 echo " "
8841 echo "Checking the availability of certain socket constants..." >& 4
8842 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8843         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8844         $cat >try.c <<EOF
8845 #include <sys/types.h>
8846 #include <sys/socket.h>
8847 int main() {
8848     int i = $ENUM;
8849 }
8850 EOF
8851         val="$undef"
8852         set try; if eval $compile; then
8853                 val="$define"
8854         fi
8855         set d_${enum}; eval $setvar
8856         $rm -f try.c try
8857 done
8858
8859 : see if sys/select.h has to be included
8860 set sys/select.h i_sysselct
8861 eval $inhdr
8862
8863 : see if we should include time.h, sys/time.h, or both
8864 echo " "
8865 if test "X$timeincl" = X; then
8866         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8867         $echo $n "I'm now running the test program...$c"
8868         $cat >try.c <<'EOCP'
8869 #include <sys/types.h>
8870 #ifdef I_TIME
8871 #include <time.h>
8872 #endif
8873 #ifdef I_SYSTIME
8874 #ifdef SYSTIMEKERNEL
8875 #define KERNEL
8876 #endif
8877 #include <sys/time.h>
8878 #endif
8879 #ifdef I_SYSSELECT
8880 #include <sys/select.h>
8881 #endif
8882 int main()
8883 {
8884         struct tm foo;
8885 #ifdef S_TIMEVAL
8886         struct timeval bar;
8887 #endif
8888 #ifdef S_TIMEZONE
8889         struct timezone tzp;
8890 #endif
8891         if (foo.tm_sec == foo.tm_sec)
8892                 exit(0);
8893 #ifdef S_TIMEVAL
8894         if (bar.tv_sec == bar.tv_sec)
8895                 exit(0);
8896 #endif
8897         exit(1);
8898 }
8899 EOCP
8900         flags=''
8901         for s_timezone in '-DS_TIMEZONE' ''; do
8902         sysselect=''
8903         for s_timeval in '-DS_TIMEVAL' ''; do
8904         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8905         for i_time in '' '-DI_TIME'; do
8906         for i_systime in '-DI_SYSTIME' ''; do
8907                 case "$flags" in
8908                 '') $echo $n ".$c"
8909                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8910                         if eval $compile; then
8911                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8912                                 shift
8913                                 flags="$*"
8914                                 echo " "
8915                                 $echo $n "Succeeded with $flags$c"
8916                         fi
8917                         ;;
8918                 esac
8919         done
8920         done
8921         done
8922         done
8923         done
8924         timeincl=''
8925         echo " "
8926         case "$flags" in
8927         *SYSTIMEKERNEL*) i_systimek="$define"
8928                 timeincl=`./findhdr sys/time.h`
8929                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8930         *) i_systimek="$undef";;
8931         esac
8932         case "$flags" in
8933         *I_TIME*) i_time="$define"
8934                 timeincl=`./findhdr time.h`" $timeincl"
8935                 echo "We'll include <time.h>." >&4;;
8936         *) i_time="$undef";;
8937         esac
8938         case "$flags" in
8939         *I_SYSTIME*) i_systime="$define"
8940                 timeincl=`./findhdr sys/time.h`" $timeincl"
8941                 echo "We'll include <sys/time.h>." >&4;;
8942         *) i_systime="$undef";;
8943         esac
8944         $rm -f try.c try
8945 fi
8946
8947 : check for fd_set items
8948 $cat <<EOM
8949
8950 Checking to see how well your C compiler handles fd_set and friends ...
8951 EOM
8952 $cat >fd_set.c <<EOCP
8953 #$i_systime I_SYS_TIME
8954 #$i_sysselct I_SYS_SELECT
8955 #$d_socket HAS_SOCKET
8956 #include <sys/types.h>
8957 #ifdef HAS_SOCKET
8958 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8959 #endif
8960 #ifdef I_SYS_TIME
8961 #include <sys/time.h>
8962 #endif
8963 #ifdef I_SYS_SELECT
8964 #include <sys/select.h>
8965 #endif
8966 int main() {
8967         fd_set fds;
8968
8969 #ifdef TRYBITS
8970         if(fds.fds_bits);
8971 #endif
8972
8973 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8974         exit(0);
8975 #else
8976         exit(1);
8977 #endif
8978 }
8979 EOCP
8980 set fd_set -DTRYBITS
8981 if eval $compile; then
8982         d_fds_bits="$define"
8983         d_fd_set="$define"
8984         echo "Well, your system knows about the normal fd_set typedef..." >&4
8985         if ./fd_set; then
8986                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8987                 d_fd_macros="$define"
8988         else
8989                 $cat >&4 <<'EOM'
8990 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8991 EOM
8992                 d_fd_macros="$undef"
8993         fi
8994 else
8995         $cat <<'EOM'
8996 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8997 EOM
8998         set fd_set
8999         if eval $compile; then
9000                 d_fds_bits="$undef"
9001                 d_fd_set="$define"
9002                 echo "Well, your system has some sort of fd_set available..." >&4
9003                 if ./fd_set; then
9004                         echo "and you have the normal fd_set macros." >&4
9005                         d_fd_macros="$define"
9006                 else
9007                         $cat <<'EOM'
9008 but not the normal fd_set macros!  Gross!  More work for me...
9009 EOM
9010                         d_fd_macros="$undef"
9011                 fi
9012         else
9013         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9014                 d_fd_set="$undef"
9015                 d_fds_bits="$undef"
9016                 d_fd_macros="$undef"
9017         fi
9018 fi
9019 $rm -f fd_set*
9020
9021 : see if fgetpos exists
9022 set fgetpos d_fgetpos
9023 eval $inlibc
9024
9025 : see if flock exists
9026 set flock d_flock
9027 eval $inlibc
9028
9029 : see if fork exists
9030 set fork d_fork
9031 eval $inlibc
9032
9033 : see if pathconf exists
9034 set pathconf d_pathconf
9035 eval $inlibc
9036
9037 : see if fpathconf exists
9038 set fpathconf d_fpathconf
9039 eval $inlibc
9040
9041
9042 : check for fpos64_t
9043 echo " "
9044 echo "Checking to see if you have fpos64_t..." >&4
9045 $cat >try.c <<EOCP
9046 #include <stdio.h>
9047 int main() { fpos64_t x = 7; }
9048 EOCP
9049 set try
9050 if eval $compile; then
9051         val="$define"
9052         echo "You have fpos64_t."
9053 else
9054         val="$undef"
9055         echo "You do not have fpos64_t."
9056         case "$fpossize" in
9057         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9058         esac
9059 fi
9060 $rm -f try.* try
9061 set d_fpos64_t
9062 eval $setvar
9063
9064 hasstruct='varname=$1; struct=$2; shift; shift;
9065 while $test $# -ge 2; do
9066         case "$1" in
9067         $define) echo "#include <$2>";;
9068         esac ;
9069     shift 2;
9070 done > try.c;
9071 echo "int main () { struct $struct foo; }" >> try.c;
9072 set try;
9073 if eval $compile; then
9074         val="$define";
9075 else
9076         val="$undef";
9077 fi;
9078 set $varname;
9079 eval $setvar;
9080 $rm -f try.c try.o'
9081
9082 : see if this is a sys/param system
9083 set sys/param.h i_sysparam
9084 eval $inhdr
9085
9086 : see if this is a sys/mount.h system
9087 set sys/mount.h i_sysmount
9088 eval $inhdr
9089
9090 : see if sys/types.h has to be included
9091 set sys/types.h i_systypes
9092 eval $inhdr
9093
9094
9095 echo " "
9096 echo "Checking to see if your system supports struct fs_data..." >&4
9097 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9098 eval $hasstruct
9099 case "$d_fs_data_s" in
9100 "$define")      echo "Yes, it does."   ;;
9101 *)              echo "No, it doesn't." ;;
9102 esac
9103
9104 : see if fseeko exists
9105 set fseeko d_fseeko
9106 eval $inlibc
9107 case "$longsize" in
9108 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9109 esac
9110
9111 : see if fsetpos exists
9112 set fsetpos d_fsetpos
9113 eval $inlibc
9114
9115
9116 : see if fstatfs exists
9117 set fstatfs d_fstatfs
9118 eval $inlibc
9119
9120
9121 : see if statvfs exists
9122 set statvfs d_statvfs
9123 eval $inlibc
9124
9125 : see if fstatvfs exists
9126 set fstatvfs d_fstatvfs
9127 eval $inlibc
9128
9129
9130 : see if ftello exists
9131 set ftello d_ftello
9132 eval $inlibc
9133 case "$longsize" in
9134 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9135 esac
9136
9137 : see if getcwd exists
9138 set getcwd d_getcwd
9139 eval $inlibc
9140
9141
9142 : see if getfsstat exists
9143 set getfsstat d_getfsstat
9144 eval $inlibc
9145
9146 : see if getgrent exists
9147 set getgrent d_getgrent
9148 eval $inlibc
9149
9150 : see if gethostbyaddr exists
9151 set gethostbyaddr d_gethbyaddr
9152 eval $inlibc
9153
9154 : see if gethostbyname exists
9155 set gethostbyname d_gethbyname
9156 eval $inlibc
9157
9158 : see if gethostent exists
9159 set gethostent d_gethent
9160 eval $inlibc
9161
9162 : see how we will look up host name
9163 echo " "
9164 call=''
9165 if set gethostname val -f d_gethname; eval $csym; $val; then
9166         echo 'gethostname() found.' >&4
9167         d_gethname="$define"
9168         call=gethostname
9169 fi
9170 if set uname val -f d_uname; eval $csym; $val; then
9171         if ./xenix; then
9172                 $cat <<'EOM'
9173 uname() was found, but you're running xenix, and older versions of xenix
9174 have a broken uname(). If you don't really know whether your xenix is old
9175 enough to have a broken system call, use the default answer.
9176
9177 EOM
9178                 dflt=y
9179                 case "$d_uname" in
9180                 "$define") dflt=n;;
9181                 esac
9182                 rp='Is your uname() broken?'
9183                 . ./myread
9184                 case "$ans" in
9185                 n*) d_uname="$define"; call=uname;;
9186                 esac
9187         else
9188                 echo 'uname() found.' >&4
9189                 d_uname="$define"
9190                 case "$call" in
9191                 '') call=uname ;;
9192                 esac
9193         fi
9194 fi
9195 case "$d_gethname" in
9196 '') d_gethname="$undef";;
9197 esac
9198 case "$d_uname" in
9199 '') d_uname="$undef";;
9200 esac
9201 case "$d_uname$d_gethname" in
9202 *define*)
9203         dflt=n
9204         cat <<EOM
9205  
9206 Every now and then someone has a $call() that lies about the hostname
9207 but can't be fixed for political or economic reasons.  If you wish, I can
9208 pretend $call() isn't there and maybe compute hostname at run-time
9209 thanks to the '$phostname' command.
9210
9211 EOM
9212         rp="Shall I ignore $call() from now on?"
9213         . ./myread
9214         case "$ans" in
9215         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9216         esac;;
9217 esac
9218 case "$phostname" in
9219 '') aphostname='';;
9220 *) case "$aphostname" in
9221         /*) ;;
9222         *) set X $phostname
9223                 shift
9224                 file=$1
9225                 shift
9226                 file=`./loc $file $file $pth`
9227                 aphostname=`echo $file $*`
9228                 ;;
9229         esac
9230         ;;
9231 esac
9232 case "$d_uname$d_gethname" in
9233 *define*) ;;
9234 *)
9235         case "$phostname" in
9236         '')
9237                 echo "There will be no way for $package to get your hostname." >&4;;
9238         *)
9239         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9240                 ;;
9241         esac;;
9242 esac
9243 case "$d_phostname" in
9244 '') d_phostname="$undef";;
9245 esac
9246
9247 : see if this is a netdb.h system
9248 set netdb.h i_netdb
9249 eval $inhdr
9250
9251 : see if prototypes for various gethostxxx netdb.h functions are available
9252 echo " "
9253 set d_gethostprotos gethostent $i_netdb netdb.h
9254 eval $hasproto
9255
9256 : see if getlogin exists
9257 set getlogin d_getlogin
9258 eval $inlibc
9259
9260 : see if getmnt exists
9261 set getmnt d_getmnt
9262 eval $inlibc
9263
9264 : see if getmntent exists
9265 set getmntent d_getmntent
9266 eval $inlibc
9267
9268 : see if getnetbyaddr exists
9269 set getnetbyaddr d_getnbyaddr
9270 eval $inlibc
9271
9272 : see if getnetbyname exists
9273 set getnetbyname d_getnbyname
9274 eval $inlibc
9275
9276 : see if getnetent exists
9277 set getnetent d_getnent
9278 eval $inlibc
9279
9280 : see if prototypes for various getnetxxx netdb.h functions are available
9281 echo " "
9282 set d_getnetprotos getnetent $i_netdb netdb.h
9283 eval $hasproto
9284
9285
9286 : see if getprotobyname exists
9287 set getprotobyname d_getpbyname
9288 eval $inlibc
9289
9290 : see if getprotobynumber exists
9291 set getprotobynumber d_getpbynumber
9292 eval $inlibc
9293
9294 : see if getprotoent exists
9295 set getprotoent d_getpent
9296 eval $inlibc
9297
9298 : see if getpgid exists
9299 set getpgid d_getpgid
9300 eval $inlibc
9301
9302 : see if getpgrp2 exists
9303 set getpgrp2 d_getpgrp2
9304 eval $inlibc
9305
9306 : see if getppid exists
9307 set getppid d_getppid
9308 eval $inlibc
9309
9310 : see if getpriority exists
9311 set getpriority d_getprior
9312 eval $inlibc
9313
9314 : see if prototypes for various getprotoxxx netdb.h functions are available
9315 echo " "
9316 set d_getprotoprotos getprotoent $i_netdb netdb.h
9317 eval $hasproto
9318
9319 : see if getpwent exists
9320 set getpwent d_getpwent
9321 eval $inlibc
9322
9323
9324 : see if getservbyname exists
9325 set getservbyname d_getsbyname
9326 eval $inlibc
9327
9328 : see if getservbyport exists
9329 set getservbyport d_getsbyport
9330 eval $inlibc
9331
9332 : see if getservent exists
9333 set getservent d_getsent
9334 eval $inlibc
9335
9336 : see if prototypes for various getservxxx netdb.h functions are available
9337 echo " "
9338 set d_getservprotos getservent $i_netdb netdb.h
9339 eval $hasproto
9340
9341 : see if getspent exists
9342 set getspent d_getspent
9343 eval $inlibc
9344
9345 : see if getspnam exists
9346 set getspnam d_getspnam
9347 eval $inlibc
9348
9349 : see if gettimeofday or ftime exists
9350 set gettimeofday d_gettimeod
9351 eval $inlibc
9352 case "$d_gettimeod" in
9353 "$undef")
9354         set ftime d_ftime 
9355         eval $inlibc
9356         ;;
9357 *)
9358         val="$undef"; set d_ftime; eval $setvar
9359         ;;
9360 esac
9361 case "$d_gettimeod$d_ftime" in
9362 "$undef$undef")
9363         echo " "
9364         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9365         ;;
9366 esac
9367
9368 : see if this is an grp system
9369 set grp.h i_grp
9370 eval $inhdr
9371
9372 case "$i_grp" in
9373 $define)
9374         xxx=`./findhdr grp.h`
9375         $cppstdin $cppflags $cppminus < $xxx >$$.h
9376
9377         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9378                 val="$define"
9379         else
9380                 val="$undef"
9381         fi
9382         set d_grpasswd
9383         eval $setvar
9384
9385         $rm -f $$.h
9386         ;;
9387 *)
9388         val="$undef";
9389         set d_grpasswd; eval $setvar
9390         ;;
9391 esac
9392
9393 : see if hasmntopt exists
9394 set hasmntopt d_hasmntopt
9395 eval $inlibc
9396
9397 : see if this is a netinet/in.h or sys/in.h system
9398 set netinet/in.h i_niin sys/in.h i_sysin
9399 eval $inhdr
9400
9401 : see if arpa/inet.h has to be included
9402 set arpa/inet.h i_arpainet
9403 eval $inhdr
9404
9405 : see if htonl --and friends-- exists
9406 val=''
9407 set htonl val
9408 eval $inlibc
9409
9410 : Maybe they are macros.
9411 case "$val" in
9412 $undef)
9413         $cat >htonl.c <<EOM
9414 #include <stdio.h>
9415 #include <sys/types.h>
9416 #$i_niin I_NETINET_IN
9417 #$i_sysin I_SYS_IN
9418 #$i_arpainet I_ARPA_INET
9419 #ifdef I_NETINET_IN
9420 #include <netinet/in.h>
9421 #endif
9422 #ifdef I_SYS_IN
9423 #include <sys/in.h>
9424 #endif
9425 #ifdef I_ARPA_INET
9426 #include <arpa/inet.h>
9427 #endif
9428 #ifdef htonl
9429 printf("Defined as a macro.");
9430 #endif
9431 EOM
9432         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9433         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9434                 val="$define"
9435                 echo "But it seems to be defined as a macro." >&4
9436         fi
9437         $rm -f htonl.?
9438         ;;
9439 esac
9440 set d_htonl
9441 eval $setvar
9442
9443 : see if iconv exists
9444 set iconv d_iconv
9445 eval $inlibc
9446
9447 : index or strchr
9448 echo " "
9449 if set index val -f; eval $csym; $val; then
9450         if set strchr val -f d_strchr; eval $csym; $val; then
9451                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9452                         val="$define"
9453                         vali="$undef"
9454                         echo "strchr() found." >&4
9455                 else
9456                         val="$undef"
9457                         vali="$define"
9458                         echo "index() found." >&4
9459                 fi
9460         else
9461                 val="$undef"
9462                 vali="$define"
9463                 echo "index() found." >&4
9464         fi
9465 else
9466         if set strchr val -f d_strchr; eval $csym; $val; then
9467                 val="$define"
9468                 vali="$undef"
9469                 echo "strchr() found." >&4
9470         else
9471                 echo "No index() or strchr() found!" >&4
9472                 val="$undef"
9473                 vali="$undef"
9474         fi
9475 fi
9476 set d_strchr; eval $setvar
9477 val="$vali"
9478 set d_index; eval $setvar
9479
9480 : check whether inet_aton exists
9481 set inet_aton d_inetaton
9482 eval $inlibc
9483
9484 : see if inttypes.h is available
9485 : we want a real compile instead of Inhdr because some systems
9486 : have an inttypes.h which includes non-existent headers
9487 echo " "
9488 $cat >try.c <<EOCP
9489 #include <inttypes.h>
9490 int main() {
9491         static int32_t foo32 = 0x12345678;
9492 }
9493 EOCP
9494 set try
9495 if eval $compile; then
9496         echo "<inttypes.h> found." >&4
9497         val="$define"
9498 else
9499         echo "<inttypes.h> NOT found." >&4
9500         val="$undef"
9501 fi
9502 $rm -f try.c try
9503 set i_inttypes
9504 eval $setvar
9505
9506 : check for int64_t
9507 echo " "
9508 echo "Checking to see if you have int64_t..." >&4
9509 $cat >try.c <<EOCP
9510 #include <sys/types.h>
9511 #$i_inttypes I_INTTYPES
9512 #ifdef I_INTTYPES
9513 #include <inttypes.h>
9514 #endif
9515 int main() { int64_t x = 7; }
9516 EOCP
9517 set try
9518 if eval $compile; then
9519         val="$define"
9520         echo "You have int64_t."
9521 else
9522         val="$undef"
9523         echo "You do not have int64_t."
9524 fi
9525 $rm -f try try.*
9526 set d_int64_t
9527 eval $setvar
9528
9529 : Look for isascii
9530 echo " "
9531 $cat >isascii.c <<'EOCP'
9532 #include <stdio.h>
9533 #include <ctype.h>
9534 int main() {
9535         int c = 'A';
9536         if (isascii(c))
9537                 exit(0);
9538         else
9539                 exit(1);
9540 }
9541 EOCP
9542 set isascii
9543 if eval $compile; then
9544         echo "isascii() found." >&4
9545         val="$define"
9546 else
9547         echo "isascii() NOT found." >&4
9548         val="$undef"
9549 fi
9550 set d_isascii
9551 eval $setvar
9552 $rm -f isascii*
9553
9554 : see if killpg exists
9555 set killpg d_killpg
9556 eval $inlibc
9557
9558 : see if lchown exists
9559 echo " "
9560 $cat > try.c <<'EOCP'
9561 /* System header to define __stub macros and hopefully few prototypes,
9562     which can conflict with char lchown(); below.  */
9563 #include <assert.h>
9564 /* Override any gcc2 internal prototype to avoid an error.  */
9565 /* We use char because int might match the return type of a gcc2
9566    builtin and then its argument prototype would still apply.  */
9567 char lchown();
9568 int main() {
9569     /*  The GNU C library defines this for functions which it implements
9570         to always fail with ENOSYS.  Some functions are actually named
9571         something starting with __ and the normal name is an alias.  */
9572 #if defined (__stub_lchown) || defined (__stub___lchown)
9573 choke me
9574 #else
9575 lchown();
9576 #endif
9577 ; return 0; }
9578 EOCP
9579 set try
9580 if eval $compile; then
9581     $echo "lchown() found." >&4
9582     val="$define"
9583 else
9584     $echo "lchown() NOT found." >&4
9585     val="$undef"
9586 fi
9587 set d_lchown
9588 eval $setvar
9589
9590 : See if number of significant digits in a double precision number is known
9591 echo " "
9592 $cat >ldbl_dig.c <<EOM
9593 #$i_limits I_LIMITS
9594 #$i_float I_FLOAT
9595 #ifdef I_LIMITS
9596 #include <limits.h>
9597 #endif
9598 #ifdef I_FLOAT
9599 #include <float.h>
9600 #endif
9601 #ifdef LDBL_DIG
9602 printf("Contains LDBL_DIG");
9603 #endif
9604 EOM
9605 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9606 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9607         echo "LDBL_DIG found." >&4
9608         val="$define"
9609 else
9610         echo "LDBL_DIG NOT found." >&4
9611         val="$undef"
9612 fi
9613 $rm -f ldbl_dig.?
9614 set d_ldbl_dig
9615 eval $setvar
9616
9617 : see if link exists
9618 set link d_link
9619 eval $inlibc
9620
9621 : see if localeconv exists
9622 set localeconv d_locconv
9623 eval $inlibc
9624
9625 : see if lockf exists
9626 set lockf d_lockf
9627 eval $inlibc
9628
9629 : check for long long
9630 echo " "
9631 echo "Checking to see if you have long long..." >&4
9632 echo 'int main() { long long x = 7; return 0; }' > try.c
9633 set try
9634 if eval $compile; then
9635         val="$define"
9636         echo "You have have long long."
9637 else
9638         val="$undef"
9639         echo "You do not have long long."
9640 fi
9641 $rm try.*
9642 set d_longlong
9643 eval $setvar
9644
9645 : check for length of long long
9646 case "${d_longlong}${longlongsize}" in
9647 $define)
9648         echo " "
9649         echo "Checking to see how big your long longs are..." >&4
9650         $cat >try.c <<'EOCP'
9651 #include <stdio.h>
9652 int main()
9653 {
9654     printf("%d\n", (int)sizeof(long long));
9655     return(0);
9656 }
9657 EOCP
9658         set try
9659         if eval $compile_ok; then
9660                 longlongsize=`./try$exe_ext`
9661                 echo "Your long longs are $longlongsize bytes long."
9662         else
9663                 dflt='8'
9664                 echo " "
9665                 echo "(I can't seem to compile the test program.  Guessing...)"
9666                 rp="What is the size of a long long (in bytes)?"
9667                 . ./myread
9668                 longlongsize="$ans"
9669         fi
9670         if $test "X$longsize" = "X$longlongsize"; then
9671                 echo "(That isn't any different from an ordinary long.)"
9672         fi      
9673         ;;
9674 esac
9675 $rm -f try.* try
9676
9677 : see if prototype for lseek is available
9678 echo " "
9679 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9680 eval $hasproto
9681
9682 : see if lstat exists
9683 set lstat d_lstat
9684 eval $inlibc
9685
9686 : see if madvise exists
9687 set madvise d_madvise
9688 eval $inlibc
9689
9690 : see if mblen exists
9691 set mblen d_mblen
9692 eval $inlibc
9693
9694 : see if mbstowcs exists
9695 set mbstowcs d_mbstowcs
9696 eval $inlibc
9697
9698 : see if mbtowc exists
9699 set mbtowc d_mbtowc
9700 eval $inlibc
9701
9702 : see if memchr exists
9703 set memchr d_memchr
9704 eval $inlibc
9705
9706 : see if memcmp exists
9707 set memcmp d_memcmp
9708 eval $inlibc
9709
9710 : see if memcpy exists
9711 set memcpy d_memcpy
9712 eval $inlibc
9713
9714 : see if memmove exists
9715 set memmove d_memmove
9716 eval $inlibc
9717
9718 : see if memset exists
9719 set memset d_memset
9720 eval $inlibc
9721
9722 : see if mkdir exists
9723 set mkdir d_mkdir
9724 eval $inlibc
9725
9726 : see if mkdtemp exists
9727 set mkdtemp d_mkdtemp
9728 eval $inlibc
9729
9730 : see if mkfifo exists
9731 set mkfifo d_mkfifo
9732 eval $inlibc
9733
9734 : see if mkstemp exists
9735 set mkstemp d_mkstemp
9736 eval $inlibc
9737
9738 : see if mkstemps exists
9739 set mkstemps d_mkstemps
9740 eval $inlibc
9741
9742 : see if mktime exists
9743 set mktime d_mktime
9744 eval $inlibc
9745
9746 : see if this is a sys/mman.h system
9747 set sys/mman.h i_sysmman
9748 eval $inhdr
9749
9750 : see if mmap exists
9751 set mmap d_mmap
9752 eval $inlibc
9753 : see what shmat returns
9754 : default to something harmless
9755 mmaptype='void *'
9756 case "$i_sysmman$d_mmap" in
9757 "$define$define")
9758         $cat >mmap.c <<'END'
9759 #include <sys/mman.h>
9760 void *mmap();
9761 END
9762         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9763                 mmaptype='void *'
9764         else
9765                 mmaptype='caddr_t'
9766         fi
9767         echo "and it returns ($mmaptype)." >&4
9768         ;;
9769 esac
9770
9771
9772
9773 : see if mprotect exists
9774 set mprotect d_mprotect
9775 eval $inlibc
9776
9777 : see if msgctl exists
9778 set msgctl d_msgctl
9779 eval $inlibc
9780
9781 : see if msgget exists
9782 set msgget d_msgget
9783 eval $inlibc
9784
9785 : see if msgsnd exists
9786 set msgsnd d_msgsnd
9787 eval $inlibc
9788
9789 : see if msgrcv exists
9790 set msgrcv d_msgrcv
9791 eval $inlibc
9792
9793 : see how much of the 'msg*(2)' library is present.
9794 h_msg=true
9795 echo " "
9796 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9797 *"$undef"*) h_msg=false;;
9798 esac
9799 case "$osname" in
9800 freebsd)
9801     case "`ipcs 2>&1`" in
9802     "SVID messages"*"not configured"*)
9803         echo "Your $osname does not have the msg*(2) configured." >&4
9804         h_msg=false
9805         val="$undef"
9806         set msgctl d_msgctl
9807         eval $setvar
9808         set msgget d_msgget
9809         eval $setvar
9810         set msgsnd d_msgsnd
9811         eval $setvar
9812         set msgrcv d_msgrcv
9813         eval $setvar
9814         ;;
9815     esac
9816     ;;
9817 esac
9818 : we could also check for sys/ipc.h ...
9819 if $h_msg && $test `./findhdr sys/msg.h`; then
9820         echo "You have the full msg*(2) library." >&4
9821         val="$define"
9822 else
9823         echo "You don't have the full msg*(2) library." >&4
9824         val="$undef"
9825 fi
9826 set d_msg
9827 eval $setvar
9828
9829 : see if msync exists
9830 set msync d_msync
9831 eval $inlibc
9832
9833 : see if munmap exists
9834 set munmap d_munmap
9835 eval $inlibc
9836
9837 : see if nice exists
9838 set nice d_nice
9839 eval $inlibc
9840
9841
9842 echo " "
9843 echo "Checking which 64-bit integer type we could use..." >&4
9844
9845 case "$intsize" in
9846 8) val=int
9847    set quadtype
9848    eval $setvar
9849    val='"unsigned int"'
9850    set uquadtype
9851    eval $setvar
9852    quadkind=1
9853    ;;
9854 *) case "$longsize" in
9855    8) val=long
9856       set quadtype
9857       eval $setvar
9858       val='"unsigned long"'
9859       set uquadtype
9860       eval $setvar
9861       quadkind=2
9862       ;;
9863    *) case "$d_longlong:$longlongsize" in
9864       define:8)
9865         val='"long long"'
9866         set quadtype
9867         eval $setvar
9868         val='"unsigned long long"'
9869         set uquadtype
9870         eval $setvar
9871         quadkind=3
9872         ;;
9873       *) case "$d_int64_t" in
9874          define)
9875            val=int64_t
9876            set quadtype
9877            eval $setvar
9878            val=uint64_t
9879            set uquadtype
9880            eval $setvar
9881            quadkind=4
9882            ;;
9883          esac
9884          ;;
9885       esac
9886       ;;
9887    esac
9888    ;;
9889 esac
9890
9891 case "$quadtype" in
9892 '')     echo "Alas, no 64-bit integer types in sight." >&4
9893         d_quad="$undef"
9894         ;;
9895 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
9896             verb="will"
9897         else
9898             verb="could"
9899         fi
9900         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9901         d_quad="$define"
9902         ;;
9903 esac
9904
9905 : check for length of character
9906 echo " "
9907 case "$charsize" in
9908 '')
9909         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9910         $cat >try.c <<'EOCP'
9911 #include <stdio.h>
9912 int main()
9913 {
9914     printf("%d\n", (int)sizeof(char));
9915     exit(0);
9916 }
9917 EOCP
9918         set try
9919         if eval $compile_ok; then
9920                 dflt=`./try`
9921         else
9922                 dflt='1'
9923                 echo "(I can't seem to compile the test program.  Guessing...)"
9924         fi
9925         ;;
9926 *)
9927         dflt="$charsize"
9928         ;;
9929 esac
9930 rp="What is the size of a character (in bytes)?"
9931 . ./myread
9932 charsize="$ans"
9933 $rm -f try.c try
9934
9935
9936 echo " "
9937 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9938
9939 case "$use64bitint:$d_quad:$quadtype" in
9940 define:define:?*)
9941         ivtype="$quadtype"
9942         uvtype="$uquadtype"
9943         ivsize=8
9944         uvsize=8
9945         ;;
9946 *)      ivtype="long"
9947         uvtype="unsigned long"
9948         ivsize=$longsize
9949         uvsize=$longsize
9950         ;;
9951 esac
9952
9953 case "$uselongdouble:$d_longdbl" in
9954 define:define)
9955         nvtype="long double"
9956         nvsize=$longdblsize
9957         ;;
9958 *)      nvtype=double
9959         nvsize=$doublesize
9960         ;;
9961 esac
9962
9963 $echo "(IV will be "$ivtype", $ivsize bytes)"
9964 $echo "(UV will be "$uvtype", $uvsize bytes)"
9965 $echo "(NV will be "$nvtype", $nvsize bytes)"
9966
9967 $cat >try.c <<EOCP
9968 #$i_inttypes I_INTTYPES
9969 #ifdef I_INTTYPES
9970 #include <inttypes.h>
9971 #endif
9972 #include <stdio.h>
9973 int main() {
9974 #ifdef INT8
9975    int8_t i =  INT8_MAX;
9976   uint8_t u = UINT8_MAX;
9977   printf("int8_t\n");
9978 #endif
9979 #ifdef INT16
9980    int16_t i =  INT16_MAX;
9981   uint16_t i = UINT16_MAX;
9982   printf("int16_t\n");
9983 #endif
9984 #ifdef INT32
9985    int32_t i =  INT32_MAX;
9986   uint32_t u = UINT32_MAX;
9987   printf("int32_t\n");
9988 #endif
9989 }
9990 EOCP
9991
9992 case "$i8type" in
9993 '')     case "$charsize" in
9994         1)      i8type=char
9995                 u8type="unsigned char"
9996                 i8size=$charsize
9997                 u8size=$charsize
9998                 ;;
9999         esac
10000         ;;
10001 esac
10002 case "$i8type" in
10003 '')     set try -DINT8
10004         if eval $compile; then
10005                 case "`./try$exe_ext`" in
10006                 int8_t) i8type=int8_t
10007                         u8type=uint8_t
10008                         i8size=1
10009                         u8size=1
10010                         ;;
10011                 esac
10012         fi
10013         ;;
10014 esac
10015 case "$i8type" in
10016 '')     if $test $charsize -ge 1; then
10017                 i8type=char
10018                 u8type="unsigned char"
10019                 i8size=$charsize
10020                 u8size=$charsize
10021         fi
10022         ;;
10023 esac
10024
10025 case "$i16type" in
10026 '')     case "$shortsize" in
10027         2)      i16type=short
10028                 u16type="unsigned short"
10029                 i16size=$shortsize
10030                 u16size=$shortsize
10031                 ;;
10032         esac
10033         ;;
10034 esac
10035 case "$i16type" in
10036 '')     set try -DINT16
10037         if eval $compile; then
10038                 case "`./try$exe_ext`" in
10039                 int16_t)
10040                         i16type=int16_t
10041                         u16type=uint16_t
10042                         i16size=2
10043                         u16size=2
10044                         ;;
10045                 esac
10046         fi
10047         ;;
10048 esac
10049 case "$i16type" in
10050 '')     if $test $shortsize -ge 2; then
10051                 i16type=short
10052                 u16type="unsigned short"
10053                 i16size=$shortsize
10054                 u16size=$shortsize
10055         fi
10056         ;;
10057 esac
10058
10059 case "$i32type" in
10060 '')     case "$longsize" in
10061         4)      i32type=long
10062                 u32type="unsigned long"
10063                 i32size=$longsize
10064                 u32size=$longsize
10065                 ;;
10066         *)      case "$intsize" in
10067                 4)      i32type=int
10068                         u32type="unsigned int"
10069                         i32size=$intsize
10070                         u32size=$intsize
10071                         ;;
10072                 esac
10073                 ;;
10074         esac
10075         ;;
10076 esac
10077 case "$i32type" in
10078 '')     set try -DINT32
10079         if eval $compile; then
10080                 case "`./try$exe_ext`" in
10081                 int32_t)
10082                         i32type=int32_t
10083                         u32type=uint32_t
10084                         i32size=4
10085                         u32size=4
10086                         ;;
10087                 esac
10088         fi
10089         ;;
10090 esac
10091 case "$i32type" in
10092 '')     if $test $intsize -ge 4; then
10093                 i32type=int
10094                 u32type="unsigned int"
10095                 i32size=$intsize
10096                 u32size=$intsize
10097         fi
10098         ;;
10099 esac
10100
10101 case "$i64type" in
10102 '')     case "$d_quad:$quadtype" in
10103         define:?*)
10104                 i64type="$quadtype"
10105                 u64type="$uquadtype"
10106                 i64size=8
10107                 u64size=8
10108                 ;;
10109         esac
10110         ;;
10111 esac
10112
10113 $echo "Checking whether your NVs can preserve your UVs..." >&4
10114 $cat <<EOP >try.c
10115 #include <stdio.h>
10116 int main() {
10117     $uvtype k = ($uvtype)~0, l;
10118     $nvtype d;
10119     l = k;
10120     d = ($nvtype)l;
10121     l = ($uvtype)d;
10122     if (l == k)
10123        printf("preserve\n");
10124     exit(0);
10125 }
10126 EOP
10127 set try
10128 if eval $compile; then
10129         case "`./try$exe_ext`" in
10130         preserve) d_nv_preserves_uv="$define" ;;
10131         esac
10132 fi      
10133 case "$d_nv_preserves_uv" in
10134 $define) $echo "Yes, they can."  2>&1 ;;
10135 *)       $echo "No, they can't." 2>&1
10136          d_nv_preserves_uv="$undef"
10137          ;;
10138 esac
10139
10140 $rm -f try.* try
10141
10142
10143 : check for off64_t
10144 echo " "
10145 echo "Checking to see if you have off64_t..." >&4
10146 $cat >try.c <<EOCP
10147 #include <sys/types.h>
10148 #include <unistd.h>
10149 int main() { off64_t x = 7; }
10150 EOCP
10151 set try
10152 if eval $compile; then
10153         val="$define"
10154         echo "You have off64_t."
10155 else
10156         val="$undef"
10157         echo "You do not have off64_t."
10158         case "$lseeksize" in
10159         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10160         esac
10161 fi
10162 $rm -f try.* try
10163 set d_off64_t
10164 eval $setvar
10165
10166 : see if POSIX threads are available
10167 set pthread.h i_pthread
10168 eval $inhdr
10169
10170
10171
10172
10173 : how to create joinable pthreads
10174 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10175         echo " "
10176         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10177         $cat >try.c <<'EOCP'
10178 #include <pthread.h>
10179 int main() {
10180     int detachstate = JOINABLE;
10181 }
10182 EOCP
10183         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10184         if eval $compile; then
10185                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10186                 val="$undef" # Yes, undef.
10187                 set d_old_pthread_create_joinable
10188                 eval $setvar
10189                 val=""
10190                 set old_pthread_create_joinable
10191                 eval $setvar
10192         else
10193                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10194                 if eval $compile; then
10195                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10196                         val="$define"
10197                         set d_old_pthread_create_joinable
10198                         eval $setvar
10199                         val=PTHREAD_CREATE_UNDETACHED
10200                         set old_pthread_create_joinable
10201                         eval $setvar
10202                 else            
10203                         set try -DJOINABLE=__UNDETACHED
10204                         if eval $compile; then
10205                                 echo "You seem to use __UNDETACHED." >&4
10206                                 val="$define"
10207                                 set d_old_pthread_create_joinable
10208                                 eval $setvar
10209                                 val=__UNDETACHED
10210                                 set old_pthread_create_joinable
10211                                 eval $setvar
10212                         else
10213                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10214                                 val="$define"
10215                                 set d_old_pthread_create_joinable
10216                                 eval $setvar
10217                                 val=0
10218                                 set old_pthread_create_joinable
10219                                 eval $setvar
10220                         fi
10221                 fi
10222         fi
10223         $rm -f try try.*
10224 else
10225     d_old_pthread_create_joinable="$undef"
10226     old_pthread_create_joinable=""
10227 fi
10228
10229 : see if pause exists
10230 set pause d_pause
10231 eval $inlibc
10232
10233 : see if pipe exists
10234 set pipe d_pipe
10235 eval $inlibc
10236
10237 : see if poll exists
10238 set poll d_poll
10239 eval $inlibc
10240
10241
10242 : see whether the various POSIXish _yields exist
10243 $cat >try.c <<EOP
10244 #include <pthread.h>
10245 #include <stdio.h>
10246 int main() {
10247 #ifdef SCHED_YIELD
10248         sched_yield();
10249 #else
10250 #ifdef PTHREAD_YIELD
10251         pthread_yield();
10252 #else
10253 #ifdef PTHREAD_YIELD_NULL
10254         pthread_yield(NULL);
10255 #endif
10256 #endif
10257 #endif
10258 }
10259 EOP
10260 : see if sched_yield exists
10261 set try -DSCHED_YIELD
10262 if eval $compile; then
10263     val="$define"
10264     sched_yield='sched_yield()'
10265 else
10266     val="$undef"
10267 fi
10268 case "$usethreads" in
10269 $define)
10270         case "$val" in
10271         $define) echo 'sched_yield() found.' >&4        ;;
10272         *)       echo 'sched_yield() NOT found.' >&4    ;;
10273         esac
10274 esac
10275 set d_sched_yield
10276 eval $setvar
10277
10278 : see if pthread_yield exists
10279 set try -DPTHREAD_YIELD
10280 if eval $compile; then
10281     val="$define"
10282     case "$sched_yield" in
10283     '') sched_yield='pthread_yield()' ;;
10284     esac
10285 else
10286     set try -DPTHREAD_YIELD_NULL
10287     if eval $compile; then
10288         val="$define"
10289         case "$sched_yield" in
10290         '') sched_yield='pthread_yield(NULL)' ;;
10291         esac
10292     else
10293         val="$undef"
10294     fi
10295 fi
10296 case "$usethreads" in
10297 $define)
10298         case "$val" in
10299         $define) echo 'pthread_yield() found.' >&4      ;;
10300         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10301         esac
10302         ;;
10303 esac
10304 set d_pthread_yield
10305 eval $setvar
10306
10307 case "$sched_yield" in
10308 '') sched_yield=undef ;;
10309 esac
10310
10311 $rm -f try try.*
10312
10313 : see if this is a pwd.h system
10314 set pwd.h i_pwd
10315 eval $inhdr
10316
10317 case "$i_pwd" in
10318 $define)
10319         xxx=`./findhdr pwd.h`
10320         $cppstdin $cppflags $cppminus < $xxx >$$.h
10321
10322         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10323                 val="$define"
10324         else
10325                 val="$undef"
10326         fi
10327         set d_pwquota
10328         eval $setvar
10329
10330         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10331                 val="$define"
10332         else
10333                 val="$undef"
10334         fi
10335         set d_pwage
10336         eval $setvar
10337
10338         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10339                 val="$define"
10340         else
10341                 val="$undef"
10342         fi
10343         set d_pwchange
10344         eval $setvar
10345
10346         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10347                 val="$define"
10348         else
10349                 val="$undef"
10350         fi
10351         set d_pwclass
10352         eval $setvar
10353
10354         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10355                 val="$define"
10356         else
10357                 val="$undef"
10358         fi
10359         set d_pwexpire
10360         eval $setvar
10361
10362         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10363                 val="$define"
10364         else
10365                 val="$undef"
10366         fi
10367         set d_pwcomment
10368         eval $setvar
10369
10370         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10371                 val="$define"
10372         else
10373                 val="$undef"
10374         fi
10375         set d_pwgecos
10376         eval $setvar
10377
10378         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10379                 val="$define"
10380         else
10381                 val="$undef"
10382         fi
10383         set d_pwpasswd
10384         eval $setvar
10385
10386         $rm -f $$.h
10387         ;;
10388 *)
10389         val="$undef"; 
10390         set d_pwquota; eval $setvar
10391         set d_pwage; eval $setvar
10392         set d_pwchange; eval $setvar
10393         set d_pwclass; eval $setvar
10394         set d_pwexpire; eval $setvar
10395         set d_pwcomment; eval $setvar
10396         set d_pwgecos; eval $setvar
10397         set d_pwpasswd; eval $setvar
10398         ;;
10399 esac
10400
10401 : see if readdir and friends exist
10402 set readdir d_readdir
10403 eval $inlibc
10404 set seekdir d_seekdir
10405 eval $inlibc
10406 set telldir d_telldir
10407 eval $inlibc
10408 set rewinddir d_rewinddir
10409 eval $inlibc
10410
10411 : see if readlink exists
10412 set readlink d_readlink
10413 eval $inlibc
10414
10415 : see if rename exists
10416 set rename d_rename
10417 eval $inlibc
10418
10419 : see if rmdir exists
10420 set rmdir d_rmdir
10421 eval $inlibc
10422
10423 : see if memory.h is available.
10424 val=''
10425 set memory.h val
10426 eval $inhdr
10427
10428 : See if it conflicts with string.h
10429 case "$val" in
10430 $define)
10431         case "$strings" in
10432         '') ;;
10433         *)
10434                 $cppstdin $cppflags $cppminus < $strings > mem.h
10435                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10436                         echo " "
10437                         echo "We won't be including <memory.h>."
10438                         val="$undef"
10439                 fi
10440                 $rm -f mem.h
10441                 ;;
10442         esac
10443 esac
10444 set i_memory
10445 eval $setvar
10446
10447 : can bcopy handle overlapping blocks?
10448 val="$undef"
10449 case "$d_bcopy" in
10450 "$define")
10451         echo " "
10452         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10453         $cat >try.c <<EOCP
10454 #$i_memory I_MEMORY
10455 #$i_stdlib I_STDLIB
10456 #$i_string I_STRING
10457 #$i_unistd I_UNISTD
10458 EOCP
10459         $cat >>try.c <<'EOCP'
10460 #include <stdio.h>
10461 #ifdef I_MEMORY
10462 #  include <memory.h>
10463 #endif
10464 #ifdef I_STDLIB
10465 #  include <stdlib.h>
10466 #endif
10467 #ifdef I_STRING
10468 #  include <string.h>
10469 #else
10470 #  include <strings.h>
10471 #endif
10472 #ifdef I_UNISTD
10473 #  include <unistd.h>  /* Needed for NetBSD */
10474 #endif
10475 int main()
10476 {
10477 char buf[128], abc[128];
10478 char *b;
10479 int len;
10480 int off;
10481 int align;
10482
10483 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10484
10485 for (align = 7; align >= 0; align--) {
10486         for (len = 36; len; len--) {
10487                 b = buf+align;
10488                 bcopy(abc, b, len);
10489                 for (off = 1; off <= len; off++) {
10490                         bcopy(b, b+off, len);
10491                         bcopy(b+off, b, len);
10492                         if (bcmp(b, abc, len))
10493                                 exit(1);
10494                 }
10495         }
10496 }
10497 exit(0);
10498 }
10499 EOCP
10500         set try
10501         if eval $compile_ok; then
10502                 if ./try 2>/dev/null; then
10503                         echo "Yes, it can."
10504                         val="$define"
10505                 else
10506                         echo "It can't, sorry."
10507                         case "$d_memmove" in
10508                         "$define") echo "But that's Ok since you have memmove()." ;;
10509                         esac
10510                 fi
10511         else
10512                 echo "(I can't compile the test program, so we'll assume not...)"
10513                 case "$d_memmove" in
10514                 "$define") echo "But that's Ok since you have memmove()." ;;
10515                 esac
10516         fi
10517         ;;
10518 esac
10519 $rm -f try.* try core
10520 set d_safebcpy
10521 eval $setvar
10522
10523 : can memcpy handle overlapping blocks?
10524 val="$undef"
10525 case "$d_memcpy" in
10526 "$define")
10527         echo " "
10528         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10529         $cat >try.c <<EOCP
10530 #$i_memory I_MEMORY
10531 #$i_stdlib I_STDLIB
10532 #$i_string I_STRING
10533 #$i_unistd I_UNISTD
10534 EOCP
10535         $cat >>try.c <<'EOCP'
10536 #include <stdio.h>
10537 #ifdef I_MEMORY
10538 #  include <memory.h>
10539 #endif
10540 #ifdef I_STDLIB
10541 #  include <stdlib.h>
10542 #endif
10543 #ifdef I_STRING
10544 #  include <string.h>
10545 #else
10546 #  include <strings.h>
10547 #endif
10548 #ifdef I_UNISTD
10549 #  include <unistd.h>  /* Needed for NetBSD */
10550 #endif
10551 int main()
10552 {
10553 char buf[128], abc[128];
10554 char *b;
10555 int len;
10556 int off;
10557 int align;
10558
10559 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10560    try to store the string in read-only memory. */
10561 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10562
10563 for (align = 7; align >= 0; align--) {
10564         for (len = 36; len; len--) {
10565                 b = buf+align;
10566                 memcpy(b, abc, len);
10567                 for (off = 1; off <= len; off++) {
10568                         memcpy(b+off, b, len);
10569                         memcpy(b, b+off, len);
10570                         if (memcmp(b, abc, len))
10571                                 exit(1);
10572                 }
10573         }
10574 }
10575 exit(0);
10576 }
10577 EOCP
10578         set try
10579         if eval $compile_ok; then
10580                 if ./try 2>/dev/null; then
10581                         echo "Yes, it can."
10582                         val="$define"
10583                 else
10584                         echo "It can't, sorry."
10585                         case "$d_memmove" in
10586                         "$define") echo "But that's Ok since you have memmove()." ;;
10587                         esac
10588                 fi
10589         else
10590                 echo "(I can't compile the test program, so we'll assume not...)"
10591                 case "$d_memmove" in
10592                 "$define") echo "But that's Ok since you have memmove()." ;;
10593                 esac
10594         fi
10595         ;;
10596 esac
10597 $rm -f try.* try core
10598 set d_safemcpy
10599 eval $setvar
10600
10601 : can memcmp be trusted to compare relative magnitude?
10602 val="$undef"
10603 case "$d_memcmp" in
10604 "$define")
10605         echo " "
10606         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10607         $cat >try.c <<EOCP
10608 #$i_memory I_MEMORY
10609 #$i_stdlib I_STDLIB
10610 #$i_string I_STRING
10611 #$i_unistd I_UNISTD
10612 EOCP
10613         $cat >>try.c <<'EOCP'
10614 #include <stdio.h>
10615 #ifdef I_MEMORY
10616 #  include <memory.h>
10617 #endif
10618 #ifdef I_STDLIB
10619 #  include <stdlib.h>
10620 #endif
10621 #ifdef I_STRING
10622 #  include <string.h>
10623 #else
10624 #  include <strings.h>
10625 #endif
10626 #ifdef I_UNISTD
10627 #  include <unistd.h>  /* Needed for NetBSD */
10628 #endif
10629 int main()
10630 {
10631 char a = -1;
10632 char b = 0;
10633 if ((a < b) && memcmp(&a, &b, 1) < 0)
10634         exit(1);
10635 exit(0);
10636 }
10637 EOCP
10638         set try
10639         if eval $compile_ok; then
10640                 if ./try 2>/dev/null; then
10641                         echo "Yes, it can."
10642                         val="$define"
10643                 else
10644                         echo "No, it can't (it uses signed chars)."
10645                 fi
10646         else
10647                 echo "(I can't compile the test program, so we'll assume not...)"
10648         fi
10649         ;;
10650 esac
10651 $rm -f try.* try core
10652 set d_sanemcmp
10653 eval $setvar
10654
10655 : see if select exists
10656 set select d_select
10657 eval $inlibc
10658
10659 : see if semctl exists
10660 set semctl d_semctl
10661 eval $inlibc
10662
10663 : see if semget exists
10664 set semget d_semget
10665 eval $inlibc
10666
10667 : see if semop exists
10668 set semop d_semop
10669 eval $inlibc
10670
10671 : see how much of the 'sem*(2)' library is present.
10672 h_sem=true
10673 echo " "
10674 case "$d_semctl$d_semget$d_semop" in
10675 *"$undef"*) h_sem=false;;
10676 esac
10677 case "$osname" in
10678 freebsd)
10679     case "`ipcs 2>&1`" in
10680     "SVID messages"*"not configured"*)
10681         echo "Your $osname does not have the sem*(2) configured." >&4
10682         h_sem=false
10683         val="$undef"
10684         set semctl d_semctl
10685         eval $setvar
10686         set semget d_semget
10687         eval $setvar
10688         set semop d_semop
10689         eval $setvar
10690         ;;
10691     esac
10692     ;;
10693 esac
10694 : we could also check for sys/ipc.h ...
10695 if $h_sem && $test `./findhdr sys/sem.h`; then
10696         echo "You have the full sem*(2) library." >&4
10697         val="$define"
10698 else
10699         echo "You don't have the full sem*(2) library." >&4
10700         val="$undef"
10701 fi
10702 set d_sem
10703 eval $setvar
10704
10705 : see whether sys/sem.h defines union semun
10706 echo " "
10707 $cat > try.c <<'END'
10708 #include <sys/types.h>
10709 #include <sys/ipc.h>
10710 #include <sys/sem.h>
10711 int main () { union semun semun; semun.buf = 0; }
10712 END
10713 set try
10714 if eval $compile; then
10715     echo "You have union semun in <sys/sem.h>." >&4
10716     val="$define"
10717 else
10718     echo "You do not have union semun in <sys/sem.h>." >&4
10719     val="$undef"
10720 fi
10721 $rm -f try try.c try.h
10722 set d_union_semun
10723 eval $setvar
10724
10725 : see how to do semctl IPC_STAT
10726 case "$d_sem" in
10727 $define)
10728     : see whether semctl IPC_STAT can use union semun
10729     echo " "
10730     $cat > try.h <<END
10731 #ifndef S_IRUSR
10732 #   ifdef S_IREAD
10733 #       define S_IRUSR S_IREAD
10734 #       define S_IWUSR S_IWRITE
10735 #       define S_IXUSR S_IEXEC
10736 #   else
10737 #       define S_IRUSR 0400
10738 #       define S_IWUSR 0200
10739 #       define S_IXUSR 0100
10740 #   endif
10741 #   define S_IRGRP (S_IRUSR>>3)
10742 #   define S_IWGRP (S_IWUSR>>3)
10743 #   define S_IXGRP (S_IXUSR>>3)
10744 #   define S_IROTH (S_IRUSR>>6)
10745 #   define S_IWOTH (S_IWUSR>>6)
10746 #   define S_IXOTH (S_IXUSR>>6)
10747 #endif
10748 #ifndef S_IRWXU
10749 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10750 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10751 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10752 #endif
10753 END
10754
10755     $cat > try.c <<END
10756 #include <sys/types.h>
10757 #include <sys/ipc.h>
10758 #include <sys/sem.h>
10759 #include <sys/stat.h>
10760 #include <stdio.h>
10761 #include <errno.h>
10762 #include "try.h"
10763 #ifndef errno
10764 extern int errno;
10765 #endif
10766 #$d_union_semun HAS_UNION_SEMUN
10767 int main() {
10768     union semun
10769 #ifndef HAS_UNION_SEMUN
10770     {
10771         int val;
10772         struct semid_ds *buf;
10773         unsigned short *array;
10774     }
10775 #endif
10776     arg;
10777     int sem, st;
10778
10779 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10780     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10781     if (sem > -1) {
10782         struct semid_ds argbuf;
10783         arg.buf = &argbuf;
10784 #       ifdef IPC_STAT
10785         st = semctl(sem, 0, IPC_STAT, arg);
10786         if (st == 0)
10787             printf("semun\n");
10788         else
10789 #       endif /* IPC_STAT */
10790             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10791 #       ifdef IPC_RMID
10792         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10793 #       endif /* IPC_RMID */
10794             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10795     } else
10796 #endif /* IPC_PRIVATE && ... */
10797         printf("semget failed: errno = %d\n", errno);
10798   return 0;
10799 }
10800 END
10801     val="$undef"
10802     set try
10803     if eval $compile; then
10804         xxx=`./try`
10805         case "$xxx" in
10806         semun) val="$define" ;;
10807         esac
10808     fi
10809     $rm -f try try.c
10810     set d_semctl_semun
10811     eval $setvar
10812     case "$d_semctl_semun" in
10813     $define)
10814         echo "You can use union semun for semctl IPC_STAT." >&4
10815         also='also'
10816         ;;
10817     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10818         also=''
10819         ;;
10820     esac
10821
10822     : see whether semctl IPC_STAT can use struct semid_ds pointer
10823     $cat > try.c <<'END'
10824 #include <sys/types.h>
10825 #include <sys/ipc.h>
10826 #include <sys/sem.h>
10827 #include <sys/stat.h>
10828 #include "try.h"
10829 #include <stdio.h>
10830 #include <errno.h>
10831 #ifndef errno
10832 extern int errno;
10833 #endif
10834 int main() {
10835     struct semid_ds arg;
10836     int sem, st;
10837
10838 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10839     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10840     if (sem > -1) {
10841 #       ifdef IPC_STAT
10842         st = semctl(sem, 0, IPC_STAT, &arg);
10843         if (st == 0)
10844             printf("semid_ds\n");
10845         else
10846 #       endif /* IPC_STAT */
10847             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10848 #       ifdef IPC_RMID
10849         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10850 #       endif /* IPC_RMID */
10851             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10852     } else
10853 #endif /* IPC_PRIVATE && ... */
10854         printf("semget failed: errno = %d\n", errno);
10855
10856     return 0;
10857 }
10858 END
10859     val="$undef"
10860     set try
10861     if eval $compile; then
10862         xxx=`./try`
10863         case "$xxx" in
10864         semid_ds) val="$define" ;;
10865         esac
10866     fi
10867     $rm -f try try.c
10868     set d_semctl_semid_ds
10869     eval $setvar
10870     case "$d_semctl_semid_ds" in
10871     $define)
10872         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10873         ;;
10874     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10875         ;;
10876     esac
10877     $rm -f try.h
10878     ;;
10879 *)  val="$undef"
10880
10881     # We do not have the full sem*(2) library, so assume we can not
10882     # use either.
10883
10884     set d_semctl_semun
10885     eval $setvar
10886
10887     set d_semctl_semid_ds
10888     eval $setvar
10889     ;;
10890 esac
10891
10892 : see if setegid exists
10893 set setegid d_setegid
10894 eval $inlibc
10895
10896 : see if seteuid exists
10897 set seteuid d_seteuid
10898 eval $inlibc
10899
10900 : see if setgrent exists
10901 set setgrent d_setgrent
10902 eval $inlibc
10903
10904 : see if sethostent exists
10905 set sethostent d_sethent
10906 eval $inlibc
10907
10908 : see if setlinebuf exists
10909 set setlinebuf d_setlinebuf
10910 eval $inlibc
10911
10912 : see if setlocale exists
10913 set setlocale d_setlocale
10914 eval $inlibc
10915
10916 : see if setnetent exists
10917 set setnetent d_setnent
10918 eval $inlibc
10919
10920 : see if setprotoent exists
10921 set setprotoent d_setpent
10922 eval $inlibc
10923
10924 : see if setpgid exists
10925 set setpgid d_setpgid
10926 eval $inlibc
10927
10928 : see if setpgrp2 exists
10929 set setpgrp2 d_setpgrp2
10930 eval $inlibc
10931
10932 : see if setpriority exists
10933 set setpriority d_setprior
10934 eval $inlibc
10935
10936 : see if setpwent exists
10937 set setpwent d_setpwent
10938 eval $inlibc
10939
10940 : see if setregid exists
10941 set setregid d_setregid
10942 eval $inlibc
10943 set setresgid d_setresgid
10944 eval $inlibc
10945
10946 : see if setreuid exists
10947 set setreuid d_setreuid
10948 eval $inlibc
10949 set setresuid d_setresuid
10950 eval $inlibc
10951
10952 : see if setrgid exists
10953 set setrgid d_setrgid
10954 eval $inlibc
10955
10956 : see if setruid exists
10957 set setruid d_setruid
10958 eval $inlibc
10959
10960 : see if setservent exists
10961 set setservent d_setsent
10962 eval $inlibc
10963
10964 : see if setsid exists
10965 set setsid d_setsid
10966 eval $inlibc
10967
10968 : see if setspent exists
10969 set setspent d_setspent
10970 eval $inlibc
10971
10972 : see if setvbuf exists
10973 set setvbuf d_setvbuf
10974 eval $inlibc
10975
10976 : see if sfio.h is available
10977 set sfio.h i_sfio
10978 eval $inhdr
10979
10980
10981 : see if sfio library is available
10982 case "$i_sfio" in
10983 $define)
10984         val=''
10985         set sfreserve val
10986         eval $inlibc
10987         ;;
10988 *)
10989         val="$undef"
10990         ;;
10991 esac
10992 : Ok, but do we want to use it.
10993 case "$val" in
10994 $define)
10995         case "$usesfio" in
10996         true|$define|[yY]*) dflt='y';;
10997         *) dflt='n';;
10998         esac
10999         echo "$package can use the sfio library, but it is experimental."
11000         rp="You seem to have sfio available, do you want to try using it?"
11001         . ./myread
11002         case "$ans" in
11003         y|Y) ;;
11004         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11005                 val="$undef"
11006                 : Remove sfio from list of libraries to use
11007                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11008                 shift
11009                 libs="$*"
11010                 echo "libs = $libs" >&4
11011                 ;;
11012         esac
11013         ;;
11014 *)      case "$usesfio" in
11015         true|$define|[yY]*)
11016                 echo "Sorry, cannot find sfio on this machine" >&4
11017                 echo "Ignoring your setting of usesfio=$usesfio" >&4
11018                 ;;
11019         esac
11020         ;;
11021 esac
11022 set d_sfio
11023 eval $setvar
11024 case "$d_sfio" in
11025 $define) usesfio='true';;
11026 *) usesfio='false';;
11027 esac
11028
11029 : see if shmctl exists
11030 set shmctl d_shmctl
11031 eval $inlibc
11032
11033 : see if shmget exists
11034 set shmget d_shmget
11035 eval $inlibc
11036
11037 : see if shmat exists
11038 set shmat d_shmat
11039 eval $inlibc
11040 : see what shmat returns
11041 case "$d_shmat" in
11042 "$define")
11043         $cat >shmat.c <<'END'
11044 #include <sys/shm.h>
11045 void *shmat();
11046 END
11047         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11048                 shmattype='void *'
11049         else
11050                 shmattype='char *'
11051         fi
11052         echo "and it returns ($shmattype)." >&4
11053         : see if a prototype for shmat is available
11054         xxx=`./findhdr sys/shm.h`
11055         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11056         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11057                 val="$define"
11058         else
11059                 val="$undef"
11060         fi
11061         $rm -f shmat.[co]
11062         ;;
11063 *)
11064         val="$undef"
11065         ;;
11066 esac
11067 set d_shmatprototype
11068 eval $setvar
11069
11070 : see if shmdt exists
11071 set shmdt d_shmdt
11072 eval $inlibc
11073
11074 : see how much of the 'shm*(2)' library is present.
11075 h_shm=true
11076 echo " "
11077 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11078 *"$undef"*) h_shm=false;;
11079 esac
11080 case "$osname" in
11081 freebsd)
11082     case "`ipcs 2>&1`" in
11083     "SVID shared memory"*"not configured"*)
11084         echo "Your $osname does not have the shm*(2) configured." >&4
11085         h_shm=false
11086         val="$undef"
11087         set shmctl d_shmctl
11088         evat $setvar
11089         set shmget d_shmget
11090         evat $setvar
11091         set shmat d_shmat
11092         evat $setvar
11093         set shmdt d_shmdt
11094         evat $setvar
11095         ;;
11096     esac
11097     ;;
11098 esac
11099 : we could also check for sys/ipc.h ...
11100 if $h_shm && $test `./findhdr sys/shm.h`; then
11101         echo "You have the full shm*(2) library." >&4
11102         val="$define"
11103 else
11104         echo "You don't have the full shm*(2) library." >&4
11105         val="$undef"
11106 fi
11107 set d_shm
11108 eval $setvar
11109
11110 echo " "
11111 : see if we have sigaction
11112 if set sigaction val -f d_sigaction; eval $csym; $val; then
11113         echo 'sigaction() found.' >&4
11114         $cat > try.c <<'EOP'
11115 #include <stdio.h>
11116 #include <sys/types.h>
11117 #include <signal.h>
11118 int main()
11119 {
11120     struct sigaction act, oact;
11121     act.sa_flags = 0;
11122     oact.sa_handler = 0;
11123     /* so that act and oact are used */
11124     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11125 }
11126 EOP
11127         set try
11128         if eval $compile_ok; then
11129                 val="$define"
11130         else
11131                 echo "But you don't seem to have a useable struct sigaction." >&4
11132                 val="$undef"
11133         fi
11134 else
11135         echo 'sigaction NOT found.' >&4
11136         val="$undef"
11137 fi
11138 set d_sigaction; eval $setvar
11139 $rm -f try try$_o try.c
11140
11141 : see if sigsetjmp exists
11142 echo " "
11143 case "$d_sigsetjmp" in
11144 '')
11145         $cat >try.c <<'EOP'
11146 #include <setjmp.h>
11147 sigjmp_buf env;
11148 int set = 1;
11149 int main()
11150 {
11151         if (sigsetjmp(env,1))
11152                 exit(set);
11153         set = 0;
11154         siglongjmp(env, 1);
11155         exit(1);
11156 }
11157 EOP
11158         set try
11159         if eval $compile; then
11160                 if ./try >/dev/null 2>&1; then
11161                         echo "POSIX sigsetjmp found." >&4
11162                         val="$define"
11163                 else
11164                         $cat >&4 <<EOM
11165 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11166 I'll ignore them.
11167 EOM
11168                         val="$undef"
11169                 fi
11170         else
11171                 echo "sigsetjmp not found." >&4
11172                 val="$undef"
11173         fi
11174         ;;
11175 *) val="$d_sigsetjmp"
11176         case "$d_sigsetjmp" in
11177         $define) echo "POSIX sigsetjmp found." >&4;;
11178         $undef) echo "sigsetjmp not found." >&4;;
11179         esac
11180         ;;
11181 esac
11182 set d_sigsetjmp
11183 eval $setvar
11184 $rm -f try.c try
11185
11186 : see if sys/stat.h is available
11187 set sys/stat.h i_sysstat
11188 eval $inhdr
11189
11190
11191 : see if stat knows about block sizes
11192 echo " "
11193 echo "Checking to see if your struct stat has st_blocks field..." >&4
11194 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11195 eval $hasfield
11196
11197
11198 : see if this is a sys/vfs.h system
11199 set sys/vfs.h i_sysvfs
11200 eval $inhdr
11201
11202
11203 : see if this is a sys/statfs.h system
11204 set sys/statfs.h i_sysstatfs
11205 eval $inhdr
11206
11207
11208 echo " "
11209 echo "Checking to see if your system supports struct statfs..." >&4
11210 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
11211 eval $hasstruct
11212 case "$d_statfs_s" in
11213 "$define")      echo "Yes, it does."   ;;
11214 *)              echo "No, it doesn't." ;;
11215 esac
11216
11217
11218
11219 : see if struct statfs knows about f_flags
11220 case "$d_statfs_s" in
11221 define) 
11222         echo " "
11223         echo "Checking to see if your struct statfs has f_flags field..." >&4
11224         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
11225         eval $hasfield
11226         ;;
11227 *)      val="$undef"
11228         set d_statfs_f_flags
11229         eval $setvar
11230         ;;
11231 esac
11232 case "$d_statfs_f_flags" in
11233 "$define")      echo "Yes, it does."   ;;
11234 *)              echo "No, it doesn't." ;;
11235 esac
11236
11237 : see if _ptr and _cnt from stdio act std
11238 echo " "
11239 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11240         echo "(Looks like you have stdio.h from Linux.)"
11241         case "$stdio_ptr" in
11242         '') stdio_ptr='((fp)->_IO_read_ptr)'
11243                 ptr_lval=$define
11244                 ;;
11245         *)      ptr_lval=$d_stdio_ptr_lval;;
11246         esac
11247         case "$stdio_cnt" in
11248         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11249                 cnt_lval=$undef
11250                 ;;
11251         *)      cnt_lval=$d_stdio_cnt_lval;;
11252         esac
11253         case "$stdio_base" in
11254         '') stdio_base='((fp)->_IO_read_base)';;
11255         esac
11256         case "$stdio_bufsiz" in
11257         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11258         esac
11259 else
11260         case "$stdio_ptr" in
11261         '') stdio_ptr='((fp)->_ptr)'
11262                 ptr_lval=$define
11263                 ;;
11264         *)      ptr_lval=$d_stdio_ptr_lval;;
11265         esac
11266         case "$stdio_cnt" in
11267         '') stdio_cnt='((fp)->_cnt)'
11268                 cnt_lval=$define
11269                 ;;
11270         *)      cnt_lval=$d_stdio_cnt_lval;;
11271         esac
11272         case "$stdio_base" in
11273         '') stdio_base='((fp)->_base)';;
11274         esac
11275         case "$stdio_bufsiz" in
11276         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11277         esac
11278 fi
11279 : test whether _ptr and _cnt really work
11280 echo "Checking how std your stdio is..." >&4
11281 $cat >try.c <<EOP
11282 #include <stdio.h>
11283 #define FILE_ptr(fp)    $stdio_ptr
11284 #define FILE_cnt(fp)    $stdio_cnt
11285 int main() {
11286         FILE *fp = fopen("try.c", "r");
11287         char c = getc(fp);
11288         if (
11289                 18 <= FILE_cnt(fp) &&
11290                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11291         )
11292                 exit(0);
11293         exit(1);
11294 }
11295 EOP
11296 val="$undef"
11297 set try
11298 if eval $compile; then
11299         if ./try; then
11300                 echo "Your stdio acts pretty std."
11301                 val="$define"
11302         else
11303                 echo "Your stdio isn't very std."
11304         fi
11305 else
11306         echo "Your stdio doesn't appear very std."
11307 fi
11308 $rm -f try.c try
11309 set d_stdstdio
11310 eval $setvar
11311
11312 : Can _ptr be used as an lvalue?
11313 case "$d_stdstdio$ptr_lval" in
11314 $define$define) val=$define ;;
11315 *) val=$undef ;;
11316 esac
11317 set d_stdio_ptr_lval
11318 eval $setvar
11319
11320 : Can _cnt be used as an lvalue?
11321 case "$d_stdstdio$cnt_lval" in
11322 $define$define) val=$define ;;
11323 *) val=$undef ;;
11324 esac
11325 set d_stdio_cnt_lval
11326 eval $setvar
11327
11328 : see if _base is also standard
11329 val="$undef"
11330 case "$d_stdstdio" in
11331 $define)
11332         $cat >try.c <<EOP
11333 #include <stdio.h>
11334 #define FILE_base(fp)   $stdio_base
11335 #define FILE_bufsiz(fp) $stdio_bufsiz
11336 int main() {
11337         FILE *fp = fopen("try.c", "r");
11338         char c = getc(fp);
11339         if (
11340                 19 <= FILE_bufsiz(fp) &&
11341                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11342         )
11343                 exit(0);
11344         exit(1);
11345 }
11346 EOP
11347         set try
11348         if eval $compile; then
11349                 if ./try; then
11350                         echo "And its _base field acts std."
11351                         val="$define"
11352                 else
11353                         echo "But its _base field isn't std."
11354                 fi
11355         else
11356                 echo "However, it seems to be lacking the _base field."
11357         fi
11358         $rm -f try.c try
11359         ;;
11360 esac
11361 set d_stdiobase
11362 eval $setvar
11363
11364 $cat >&4 <<EOM
11365 Checking how to access stdio streams by file descriptor number...
11366 EOM
11367 case "$stdio_stream_array" in
11368 '')     $cat >try.c <<EOCP
11369 #include <stdio.h>
11370 int main() {
11371   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11372     printf("yes\n");
11373 }
11374 EOCP
11375         for s in _iob __iob __sF
11376         do
11377                 set try -DSTDIO_STREAM_ARRAY=$s
11378                 if eval $compile; then
11379                         case "`./try$exe_ext`" in
11380                         yes)    stdio_stream_array=$s; break ;;
11381                         esac
11382                 fi
11383         done
11384         $rm -f try.* try$exe_ext
11385 esac
11386 case "$stdio_stream_array" in
11387 '')     $cat >&4 <<EOM
11388 I can't figure out how to access stdio streams by file descriptor number.
11389 EOM
11390         d_stdio_stream_array="$undef"
11391         ;;
11392 *)      $cat >&4 <<EOM
11393 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11394 EOM
11395         d_stdio_stream_array="$define"
11396         ;;
11397 esac
11398
11399 : see if strcoll exists
11400 set strcoll d_strcoll
11401 eval $inlibc
11402
11403 : check for structure copying
11404 echo " "
11405 echo "Checking to see if your C compiler can copy structs..." >&4
11406 $cat >try.c <<'EOCP'
11407 int main()
11408 {
11409         struct blurfl {
11410                 int dyick;
11411         } foo, bar;
11412
11413         foo = bar;
11414 }
11415 EOCP
11416 if $cc -c try.c >/dev/null 2>&1 ; then
11417         val="$define"
11418         echo "Yup, it can."
11419 else
11420         val="$undef"
11421         echo "Nope, it can't."
11422 fi
11423 set d_strctcpy
11424 eval $setvar
11425 $rm -f try.*
11426
11427 : see if strerror and/or sys_errlist[] exist
11428 echo " "
11429 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11430     if set strerror val -f d_strerror; eval $csym; $val; then
11431                 echo 'strerror() found.' >&4
11432                 d_strerror="$define"
11433                 d_strerrm='strerror(e)'
11434                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11435                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11436                         d_syserrlst="$define"
11437                 else
11438                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11439                         d_syserrlst="$undef"
11440                 fi
11441     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11442                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11443                 echo 'strerror() found in string header.' >&4
11444                 d_strerror="$define"
11445                 d_strerrm='strerror(e)'
11446                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11447                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11448                                 d_syserrlst="$define"
11449                 else
11450                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11451                         d_syserrlst="$undef"
11452                 fi
11453     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11454                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11455                 d_strerror="$undef"
11456                 d_syserrlst="$define"
11457                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11458     else
11459                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11460                 d_strerror="$undef"
11461                 d_syserrlst="$undef"
11462                 d_strerrm='"unknown"'
11463     fi
11464 fi
11465
11466 : see if strtod exists
11467 set strtod d_strtod
11468 eval $inlibc
11469
11470 : see if strtol exists
11471 set strtol d_strtol
11472 eval $inlibc
11473
11474 : see if strtold exists
11475 set strtold d_strtold
11476 eval $inlibc
11477
11478 : see if strtoll exists
11479 set strtoll d_strtoll
11480 eval $inlibc
11481
11482 case "$d_longlong-$d_strtoll" in
11483 "$define-$define")
11484         $cat <<EOM
11485 Checking whether your strtoll() works okay...
11486 EOM
11487         $cat >try.c <<'EOCP'
11488 #include <errno.h>
11489 #ifdef __hpux
11490 #define strtoll __strtoll
11491 #endif
11492 #include <stdio.h>
11493 extern long long int strtoll(char *s, char **, int); 
11494 static int bad = 0;
11495 int check(char *s, long long ell, int een) {
11496         long long gll;
11497         errno = 0;
11498         gll = strtoll(s, 0, 10);
11499         if (!((gll == ell) && (errno == een)))
11500                 bad++;
11501 }
11502 int main() {
11503         check(" 1",                                      1LL, 0);
11504         check(" 0",                                      0LL, 0);
11505         check("-1",                                     -1LL, 0);
11506         check("-9223372036854775808", -9223372036854775808LL, 0);
11507         check("-9223372036854775808", -9223372036854775808LL, 0);
11508         check(" 9223372036854775807",  9223372036854775807LL, 0);
11509         check("-9223372036854775808", -9223372036854775808LL, 0);
11510         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11511         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11512         if (!bad)
11513                 printf("ok\n");
11514 }
11515 EOCP
11516         set try
11517         if eval $compile; then
11518                 case "`./try`" in
11519                 ok) echo "Your strtoll() seems to be working okay." ;;
11520                 *) cat <<EOM >&4
11521 Your strtoll() doesn't seem to be working okay.
11522 EOM
11523                    d_strtoll="$undef"
11524                    ;;
11525                 esac
11526         fi
11527         ;;
11528 esac
11529
11530 : see if strtoul exists
11531 set strtoul d_strtoul
11532 eval $inlibc
11533
11534 : see if strtoull exists
11535 set strtoull d_strtoull
11536 eval $inlibc
11537
11538 case "$d_longlong-$d_strtoull" in
11539 "$define-$define")
11540         $cat <<EOM
11541 Checking whether your strtoull() works okay...
11542 EOM
11543         $cat >try.c <<'EOCP'
11544 #include <errno.h>
11545 #ifdef __hpux
11546 #define strtoull __strtoull
11547 #endif
11548 #include <stdio.h>
11549 extern unsigned long long int strtoull(char *s, char **, int); 
11550 static int bad = 0;
11551 int check(char *s, long long eull, int een) {
11552         long long gull;
11553         errno = 0;
11554         gull = strtoull(s, 0, 10);
11555         if (!((gull == eull) && (errno == een)))
11556                 bad++;
11557 }
11558 int main() {
11559         check(" 1",                                       1LL, 0);
11560         check(" 0",                                       0LL, 0);
11561         check("18446744073709551615", 18446744073709551615ULL, 0);
11562         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11563         if (!bad)
11564                 printf("ok\n");
11565 }
11566 EOCP
11567         set try
11568         if eval $compile; then
11569                 case "`./try`" in
11570                 ok) echo "Your strtoull() seems to be working okay." ;;
11571                 *) cat <<EOM >&4
11572 Your strtoull() doesn't seem to be working okay.
11573 EOM
11574                    d_strtoull="$undef"
11575                    ;;
11576                 esac
11577         fi
11578         ;;
11579 esac
11580
11581 : see if strtouq exists
11582 set strtouq d_strtouq
11583 eval $inlibc
11584
11585 : see if strxfrm exists
11586 set strxfrm d_strxfrm
11587 eval $inlibc
11588
11589 : see if symlink exists
11590 set symlink d_symlink
11591 eval $inlibc
11592
11593 : see if syscall exists
11594 set syscall d_syscall
11595 eval $inlibc
11596
11597 : see if sysconf exists
11598 set sysconf d_sysconf
11599 eval $inlibc
11600
11601 : see if system exists
11602 set system d_system
11603 eval $inlibc
11604
11605 : see if tcgetpgrp exists
11606 set tcgetpgrp d_tcgetpgrp
11607 eval $inlibc
11608
11609 : see if tcsetpgrp exists
11610 set tcsetpgrp d_tcsetpgrp
11611 eval $inlibc
11612
11613 : see if prototype for telldir is available
11614 echo " "
11615 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11616 eval $hasproto
11617
11618 : see if this is a sys/times.h system
11619 set sys/times.h i_systimes
11620 eval $inhdr
11621
11622 : see if times exists
11623 echo " "
11624 if set times val -f d_times; eval $csym; $val; then
11625         echo 'times() found.' >&4
11626         d_times="$define"
11627         inc=''
11628         case "$i_systimes" in
11629         "$define") inc='sys/times.h';;
11630         esac
11631         rp="What is the type returned by times() on this system?"
11632         set clock_t clocktype long stdio.h sys/types.h $inc
11633         eval $typedef_ask
11634 else
11635         echo 'times() NOT found, hope that will do.' >&4
11636         d_times="$undef"
11637         clocktype='int'
11638 fi
11639
11640 : see if truncate exists
11641 set truncate d_truncate
11642 eval $inlibc
11643
11644 : see if tzname[] exists
11645 echo " "
11646 if set tzname val -a d_tzname; eval $csym; $val; then
11647         val="$define"
11648         echo 'tzname[] found.' >&4
11649 else
11650         val="$undef"
11651         echo 'tzname[] NOT found.' >&4
11652 fi
11653 set d_tzname
11654 eval $setvar
11655
11656 : see if umask exists
11657 set umask d_umask
11658 eval $inlibc
11659
11660 : see if ustat exists
11661 set ustat d_ustat
11662 eval $inlibc
11663
11664 : backward compatibility for d_hvfork
11665 if test X$d_hvfork != X; then
11666         d_vfork="$d_hvfork"
11667         d_hvfork=''
11668 fi
11669 : see if there is a vfork
11670 val=''
11671 set vfork val
11672 eval $inlibc
11673
11674 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11675 : perl on Solaris 2.x, and probably elsewhere.
11676 case "$val" in
11677 $define)
11678         echo " "
11679         case "$usevfork" in
11680         false) dflt='n';;
11681         *) dflt='y';;
11682         esac
11683         cat <<'EOM'
11684  
11685 Perl can only use a vfork() that doesn't suffer from strict
11686 restrictions on calling functions or modifying global data in
11687 the child.  For example, glibc-2.1 contains such a vfork()
11688 that is unsuitable.  If your system provides a proper fork()
11689 call, chances are that you do NOT want perl to use vfork().
11690
11691 EOM
11692         rp="Do you still want to use vfork()?"
11693         . ./myread
11694         case "$ans" in
11695         y|Y) ;;
11696         *)
11697                 echo "Ok, we won't use vfork()."
11698                 val="$undef"
11699                 ;;
11700         esac
11701         ;;
11702 esac
11703 set d_vfork
11704 eval $setvar
11705 case "$d_vfork" in
11706 $define) usevfork='true';;
11707 *) usevfork='false';;
11708 esac
11709
11710 : see if this is an sysdir system
11711 set sys/dir.h i_sysdir
11712 eval $inhdr
11713
11714 : see if this is an sysndir system
11715 set sys/ndir.h i_sysndir
11716 eval $inhdr
11717
11718 : see if closedir exists
11719 set closedir d_closedir
11720 eval $inlibc
11721
11722 case "$d_closedir" in
11723 "$define")
11724         echo " "
11725         echo "Checking whether closedir() returns a status..." >&4
11726         cat > closedir.c <<EOM
11727 #$i_dirent I_DIRENT             /**/
11728 #$i_sysdir I_SYS_DIR            /**/
11729 #$i_sysndir I_SYS_NDIR          /**/
11730 #$i_systypes I_SYS_TYPES        /**/
11731
11732 #if defined(I_SYS_TYPES)
11733 #include <sys/types.h>
11734 #endif
11735 #if defined(I_DIRENT)
11736 #include <dirent.h>
11737 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11738 #include <sys/dir.h>
11739 #endif
11740 #else
11741 #ifdef I_SYS_NDIR
11742 #include <sys/ndir.h>
11743 #else
11744 #ifdef I_SYS_DIR
11745 #ifdef hp9000s500
11746 #include <ndir.h>       /* may be wrong in the future */
11747 #else
11748 #include <sys/dir.h>
11749 #endif
11750 #endif
11751 #endif
11752 #endif 
11753 int main() { return closedir(opendir(".")); }
11754 EOM
11755         set closedir
11756         if eval $compile_ok; then
11757                 if ./closedir > /dev/null 2>&1 ; then
11758                         echo "Yes, it does."
11759                         val="$undef"
11760                 else
11761                         echo "No, it doesn't."
11762                         val="$define"
11763                 fi
11764         else
11765                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11766                 val="$define"
11767         fi
11768         ;;
11769 *)
11770         val="$undef";
11771         ;;
11772 esac
11773 set d_void_closedir
11774 eval $setvar
11775 $rm -f closedir*
11776 : check for volatile keyword
11777 echo " "
11778 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11779 $cat >try.c <<'EOCP'
11780 int main()
11781 {
11782         typedef struct _goo_struct goo_struct;
11783         goo_struct * volatile goo = ((goo_struct *)0);
11784         struct _goo_struct {
11785                 long long_int;
11786                 int reg_int;
11787                 char char_var;
11788         };
11789         typedef unsigned short foo_t;
11790         char *volatile foo;
11791         volatile int bar;
11792         volatile foo_t blech;
11793         foo = foo;
11794 }
11795 EOCP
11796 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11797         val="$define"
11798         echo "Yup, it does."
11799 else
11800         val="$undef"
11801         echo "Nope, it doesn't."
11802 fi
11803 set d_volatile
11804 eval $setvar
11805 $rm -f try.*
11806
11807 : see if there is a wait4
11808 set wait4 d_wait4
11809 eval $inlibc
11810
11811 : see if waitpid exists
11812 set waitpid d_waitpid
11813 eval $inlibc
11814
11815 : see if wcstombs exists
11816 set wcstombs d_wcstombs
11817 eval $inlibc
11818
11819 : see if wctomb exists
11820 set wctomb d_wctomb
11821 eval $inlibc
11822
11823 : preserve RCS keywords in files with variable substitution, grrr
11824 Date='$Date'
11825 Id='$Id'
11826 Log='$Log'
11827 RCSfile='$RCSfile'
11828 Revision='$Revision'
11829
11830 case "$crosscompile" in
11831 ''|[nN]*) crosscompile="$undef" ;;
11832 esac
11833
11834 case "$osname" in
11835 next|rhapsody|darwin) multiarch="$define" ;;
11836 esac
11837 case "$multiarch" in
11838 ''|[nN]*) multiarch="$undef" ;;
11839 esac
11840
11841 : check for alignment requirements
11842 echo " "
11843 case "$crosscompile$multiarch" in
11844 *$define*)
11845         $cat <<EOM
11846 You seem to be either cross-compiling or doing a multiarchitecture build,
11847 skipping the memory alignment check.
11848
11849 EOM
11850         case "$alignbytes" in
11851         '') alignbytes=8 ;;
11852         esac
11853         ;;
11854 *)
11855         case "$alignbytes" in
11856         '') echo "Checking alignment constraints..." >&4
11857                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11858                         $cat >try.c <<'EOCP'
11859 typedef long double NV;
11860 EOCP
11861                 else
11862                         $cat >try.c <<'EOCP'
11863 typedef double NV;
11864 EOCP
11865                 fi
11866                 $cat >>try.c <<'EOCP'
11867 #include <stdio.h>
11868 struct foobar {
11869         char foo;
11870         NV bar;
11871 } try_algn;
11872 int main()
11873 {
11874     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11875     return(0);
11876 }
11877 EOCP
11878                 set try
11879                 if eval $compile_ok; then
11880                         dflt=`./try`
11881                 else
11882                         dflt='8'
11883                         echo "(I can't seem to compile the test program...)"
11884                 fi
11885                 ;;
11886         *) dflt="$alignbytes"
11887                 ;;
11888         esac
11889         rp="Doubles must be aligned on a how-many-byte boundary?"
11890         . ./myread
11891         alignbytes="$ans"
11892         $rm -f try.c try
11893         ;;
11894 esac
11895
11896
11897 : set the base revision
11898 baserev=5.0
11899
11900 : check for ordering of bytes in a long
11901 echo " "
11902 case "$crosscompile$multiarch" in
11903 *$define*)
11904         $cat <<EOM
11905 You seem to be either cross-compiling or doing a multiarchitecture build,
11906 skipping the byteorder check.
11907
11908 EOM
11909         byteorder='0xffff'
11910         ;;
11911 *)
11912         case "$byteorder" in
11913         '')
11914                 $cat <<'EOM'
11915 In the following, larger digits indicate more significance.  A big-endian
11916 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11917 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11918 machines may have weird orders like 3412.  A Cray will report 87654321,
11919 an Alpha will report 12345678. If the test program works the default is
11920 probably right.
11921 I'm now running the test program...
11922 EOM
11923                 $cat >try.c <<'EOCP'
11924 #include <stdio.h>
11925 int main()
11926 {
11927         int i;
11928         union {
11929                 unsigned long l;
11930                 char c[sizeof(long)];
11931         } u;
11932
11933         if (sizeof(long) > 4)
11934                 u.l = (0x08070605L << 32) | 0x04030201L;
11935         else
11936                 u.l = 0x04030201L;
11937         for (i = 0; i < sizeof(long); i++)
11938                 printf("%c", u.c[i]+'0');
11939         printf("\n");
11940         exit(0);
11941 }
11942 EOCP
11943                 xxx_prompt=y
11944                 set try
11945                 if eval $compile && ./try > /dev/null; then
11946                         dflt=`./try`
11947                         case "$dflt" in
11948                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11949                                 echo "(The test program ran ok.)"
11950                                 echo "byteorder=$dflt"
11951                                 xxx_prompt=n
11952                         ;;
11953                         ????|????????) echo "(The test program ran ok.)" ;;
11954                         *) echo "(The test program didn't run right for some reason.)" ;;
11955                         esac
11956                 else
11957                         dflt='4321'
11958                         cat <<'EOM'
11959 (I can't seem to compile the test program.  Guessing big-endian...)
11960 EOM
11961                 fi
11962                 case "$xxx_prompt" in
11963                 y)
11964                         rp="What is the order of bytes in a long?"
11965                         . ./myread
11966                         byteorder="$ans"
11967                         ;;
11968                 *)      byteorder=$dflt
11969                         ;;
11970                 esac
11971                 ;;
11972         esac
11973         $rm -f try.c try
11974         ;;
11975 esac
11976
11977
11978 : how do we catenate cpp tokens here?
11979 echo " "
11980 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11981 $cat >cpp_stuff.c <<'EOCP'
11982 #define RCAT(a,b)a/**/b
11983 #define ACAT(a,b)a ## b
11984 RCAT(Rei,ser)
11985 ACAT(Cir,cus)
11986 EOCP
11987 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11988 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11989         echo "Oh!  Smells like ANSI's been here." >&4
11990         echo "We can catify or stringify, separately or together!"
11991         cpp_stuff=42
11992 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11993         echo "Ah, yes!  The good old days!" >&4
11994         echo "However, in the good old days we don't know how to stringify and"
11995         echo "catify at the same time."
11996         cpp_stuff=1
11997 else
11998         $cat >&4 <<EOM
11999 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12000 to have to edit the values of CAT[2-5] in config.h...
12001 EOM
12002         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12003 fi
12004 $rm -f cpp_stuff.*
12005
12006 : see if this is a db.h system
12007 set db.h i_db
12008 eval $inhdr
12009
12010 case "$i_db" in
12011 $define)
12012         : Check db version.
12013         echo " "
12014         echo "Checking Berkeley DB version ..." >&4
12015         $cat >try.c <<EOCP
12016 #$d_const HASCONST
12017 #ifndef HASCONST
12018 #define const
12019 #endif
12020 #include <sys/types.h>
12021 #include <stdio.h>
12022 #include <db.h>
12023 int main()
12024 {
12025 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12026     int Major, Minor, Patch ;
12027     unsigned long Version ;
12028     (void)db_version(&Major, &Minor, &Patch) ;
12029     printf("You have Berkeley DB Version 2 or greater\n");
12030
12031     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12032                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12033     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12034                 Major, Minor, Patch) ;
12035
12036     /* check that db.h & libdb are compatible */
12037     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12038         printf("db.h and libdb are incompatible\n") ;
12039         exit(3);        
12040     }
12041
12042     printf("db.h and libdb are compatible\n") ;
12043
12044     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12045                 + DB_VERSION_PATCH ;
12046
12047     /* needs to be >= 2.3.4 */
12048     if (Version < 2003004) {
12049     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12050         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12051         exit(2);        
12052     }
12053
12054     exit(0);
12055 #else
12056 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12057     printf("You have Berkeley DB Version 1\n");
12058     exit(0);    /* DB version < 2: the coast is clear. */
12059 #else
12060     exit(1);    /* <db.h> not Berkeley DB? */
12061 #endif
12062 #endif
12063 }
12064 EOCP
12065         set try
12066         if eval $compile_ok && ./try; then
12067                 echo 'Looks OK.' >&4
12068         else
12069                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12070                 i_db=$undef
12071                 case " $libs " in
12072                 *"-ldb "*)
12073                         : Remove db from list of libraries to use
12074                         echo "Removing unusable -ldb from library list" >&4
12075                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12076                         shift
12077                         libs="$*"
12078                         echo "libs = $libs" >&4
12079                         ;;
12080                 esac
12081         fi
12082         $rm -f try.*
12083         ;;
12084 esac
12085
12086 case "$i_db" in
12087 define)
12088         : Check the return type needed for hash 
12089         echo " "
12090         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12091         $cat >try.c <<EOCP
12092 #$d_const HASCONST
12093 #ifndef HASCONST
12094 #define const
12095 #endif
12096 #include <sys/types.h>
12097 #include <db.h>
12098
12099 #ifndef DB_VERSION_MAJOR
12100 u_int32_t hash_cb (ptr, size)
12101 const void *ptr;
12102 size_t size;
12103 {
12104 }
12105 HASHINFO info;
12106 int main()
12107 {
12108         info.hash = hash_cb;
12109 }
12110 #endif
12111 EOCP
12112         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12113                 if $contains warning try.out >>/dev/null 2>&1 ; then
12114                         db_hashtype='int'
12115                 else
12116                         db_hashtype='u_int32_t'
12117                 fi
12118         else
12119                 : XXX Maybe we should just give up here.
12120                 db_hashtype=u_int32_t
12121                 $cat try.out >&4
12122                 echo "Help:  I can't seem to compile the db test program." >&4
12123                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12124         fi
12125         $rm -f try.*
12126         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12127         ;;
12128 *)      db_hashtype=u_int32_t
12129         ;;
12130 esac
12131 case "$i_db" in
12132 define)
12133         : Check the return type needed for prefix 
12134         echo " "
12135         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12136         cat >try.c <<EOCP
12137 #$d_const HASCONST
12138 #ifndef HASCONST
12139 #define const
12140 #endif
12141 #include <sys/types.h>
12142 #include <db.h>
12143
12144 #ifndef DB_VERSION_MAJOR
12145 size_t prefix_cb (key1, key2)
12146 const DBT *key1;
12147 const DBT *key2;
12148 {
12149 }
12150 BTREEINFO info;
12151 int main()
12152 {
12153         info.prefix = prefix_cb;
12154 }
12155 #endif
12156 EOCP
12157         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12158                 if $contains warning try.out >>/dev/null 2>&1 ; then
12159                         db_prefixtype='int'
12160                 else
12161                         db_prefixtype='size_t'
12162                 fi
12163         else
12164                 db_prefixtype='size_t'
12165                 : XXX Maybe we should just give up here.
12166                 $cat try.out >&4
12167                 echo "Help:  I can't seem to compile the db test program." >&4
12168                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12169         fi
12170         $rm -f try.*
12171         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12172         ;;
12173 *)      db_prefixtype='size_t'
12174         ;;
12175 esac
12176
12177 : check for void type
12178 echo " "
12179 echo "Checking to see how well your C compiler groks the void type..." >&4
12180 case "$voidflags" in
12181 '')
12182         $cat >try.c <<'EOCP'
12183 #if TRY & 1
12184 void sub() {
12185 #else
12186 sub() {
12187 #endif
12188         extern void moo();      /* function returning void */
12189         void (*goo)();          /* ptr to func returning void */
12190 #if TRY & 8
12191         void *hue;              /* generic ptr */
12192 #endif
12193 #if TRY & 2
12194         void (*foo[10])();
12195 #endif
12196
12197 #if TRY & 4
12198         if(goo == moo) {
12199                 exit(0);
12200         }
12201 #endif
12202         exit(0);
12203 }
12204 int main() { sub(); }
12205 EOCP
12206         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12207                 voidflags=$defvoidused
12208         echo "Good.  It appears to support void to the level $package wants.">&4
12209                 if $contains warning .out >/dev/null 2>&1; then
12210                         echo "However, you might get some warnings that look like this:"
12211                         $cat .out
12212                 fi
12213         else
12214 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12215                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12216                         echo "It supports 1..."
12217                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12218                                 echo "It also supports 2..."
12219                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12220                                         voidflags=7
12221                                         echo "And it supports 4 but not 8 definitely."
12222                                 else
12223                                         echo "It doesn't support 4..."
12224                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12225                                                 voidflags=11
12226                                                 echo "But it supports 8."
12227                                         else
12228                                                 voidflags=3
12229                                                 echo "Neither does it support 8."
12230                                         fi
12231                                 fi
12232                         else
12233                                 echo "It does not support 2..."
12234                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12235                                         voidflags=13
12236                                         echo "But it supports 4 and 8."
12237                                 else
12238                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12239                                                 voidflags=5
12240                                                 echo "And it supports 4 but has not heard about 8."
12241                                         else
12242                                                 echo "However it supports 8 but not 4."
12243                                         fi
12244                                 fi
12245                         fi
12246                 else
12247                         echo "There is no support at all for void."
12248                         voidflags=0
12249                 fi
12250         fi
12251 esac
12252 case "$voidflags" in
12253 "$defvoidused") ;;
12254 *)      $cat >&4 <<'EOM'
12255   Support flag bits are:
12256     1: basic void declarations.
12257     2: arrays of pointers to functions returning void.
12258     4: operations between pointers to and addresses of void functions.
12259     8: generic void pointers.
12260 EOM
12261         dflt="$voidflags";
12262         rp="Your void support flags add up to what?"
12263         . ./myread
12264         voidflags="$ans"
12265         ;;
12266 esac
12267 $rm -f try.* .out
12268
12269
12270 : How can we generate normalized random numbers ?
12271 echo " "
12272 echo "Looking for a random number function..." >&4
12273 case "$randfunc" in
12274 '')
12275         if set drand48 val -f; eval $csym; $val; then
12276                 dflt="drand48"
12277                 echo "Good, found drand48()." >&4
12278         elif set random val -f; eval $csym; $val; then
12279                 dflt="random"
12280                 echo "OK, found random()." >&4
12281         else
12282                 dflt="rand"
12283                 echo "Yick, looks like I have to use rand()." >&4
12284         fi
12285         echo " "
12286         ;;
12287 *)
12288         dflt="$randfunc"
12289         ;;
12290 esac
12291 cont=true
12292
12293 case "$ccflags" in
12294 *-Dmy_rand=*|*-Dmy_srand=*)
12295         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12296         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12297         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12298         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12299         ;;
12300 esac
12301
12302 while $test "$cont"; do
12303         rp="Use which function to generate random numbers?"
12304         . ./myread
12305         if $test "$ans" = "$dflt"; then
12306                 : null
12307         else
12308                 randbits=''
12309         fi
12310         randfunc="$ans"
12311         if set $ans val -f; eval $csym; $val; then
12312                 cont=''
12313         else
12314                 dflt=y
12315                 rp="I cannot find function $ans. Use that name anyway?"
12316                 . ./myread
12317                 dflt=rand
12318                 case "$ans" in
12319                         [yY]*) cont='';;
12320                 esac
12321         fi
12322         case "$cont" in
12323         '')
12324                 case "$randfunc" in
12325                 drand48)
12326                         drand01="drand48()"
12327                         seedfunc="srand48"
12328                         randbits=48
12329                         randseedtype=long
12330                         ;;
12331                 rand|random)
12332                         case "$randbits" in
12333                         '')
12334 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12335                                 $cat >try.c <<EOCP
12336 #$i_unistd I_UNISTD
12337 #$i_stdlib I_STDLIB
12338 #include <stdio.h>
12339 #ifdef I_UNISTD
12340 #  include <unistd.h>
12341 #endif
12342 #ifdef I_STDLIB
12343 #  include <stdlib.h>
12344 #endif
12345 int main()
12346 {
12347         register int i;
12348         register unsigned long tmp;
12349         register unsigned long max = 0L;
12350
12351         for (i = 1000; i; i--) {
12352                 tmp = (unsigned long) $randfunc();
12353                 if (tmp > max) max = tmp;
12354         }
12355         for (i = 0; max; i++)
12356                 max /= 2;
12357         printf("%d\n",i);
12358 }
12359 EOCP
12360                                 set try
12361                                 if eval $compile_ok; then
12362                                         dflt=`try`
12363                                 else
12364                                         dflt='?'
12365                                         echo "(I can't seem to compile the test program...)"
12366                                 fi
12367                                 ;;
12368                         *)
12369                                 dflt="$randbits"
12370                                 ;;
12371                         esac
12372                         rp="How many bits does your $randfunc() function produce?"
12373                         . ./myread
12374                         randbits="$ans"
12375                         $rm -f try.c try
12376                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12377                         seedfunc="s$randfunc"
12378                         randseedtype=unsigned
12379                         ;;
12380                 *)
12381                         dflt="31"
12382                         rp="How many bits does your $randfunc() function produce?"
12383                         . ./myread
12384                         randbits="$ans"
12385                         seedfunc="s$randfunc"
12386                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12387                         if set $seedfunc val -f; eval $csym; $val; then
12388                                 echo "(Using $seedfunc() to seed random generator)"
12389                         else
12390                                 echo "(Warning: no $seedfunc() to seed random generator)"
12391                                 seedfunc=rand
12392                         fi
12393                         randseedtype=unsigned
12394                         ;;
12395                 esac
12396                 ;;
12397         esac
12398 done
12399
12400 echo " "
12401 echo "Determining whether or not we are on an EBCDIC system..." >&4
12402 $cat >tebcdic.c <<'EOM'
12403 int main()
12404 {
12405   if ('M'==0xd4) return 0;
12406   return 1;
12407 }
12408 EOM
12409
12410 val=$undef
12411 set tebcdic
12412 if eval $compile_ok; then
12413         if ./tebcdic; then
12414                 echo "You have EBCDIC." >&4
12415                 val="$define"
12416         else
12417                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12418         fi
12419 else
12420         echo "I'm unable to compile the test program." >&4
12421         echo "I'll assume ASCII or some ISO Latin." >&4
12422 fi
12423 $rm -f tebcdic.c tebcdic
12424 set ebcdic
12425 eval $setvar
12426
12427 echo " "
12428 $cat >&4 <<EOM
12429 Checking how to flush all pending stdio output...
12430 EOM
12431 # I only know how to find the first 32 possibly open files on SunOS.
12432 # See also hints/sunos_4_1.sh and util.c  --AD
12433 case "$osname" in
12434 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12435 esac
12436 $cat >>try.c <<EOCP
12437 #include <stdio.h>
12438 #$i_unistd I_UNISTD
12439 #ifdef I_UNISTD
12440 # include <unistd.h>
12441 #endif
12442 #$d_sysconf HAS_SYSCONF
12443 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12444 #ifdef HAS_STDIO_STREAM_ARRAY
12445 # define STDIO_STREAM_ARRAY $stdio_stream_array
12446 #endif
12447 int main() {
12448   FILE* p = fopen("try.out", "w");
12449 #ifdef TRY_FPUTC
12450   fputc('x', p);
12451 #else
12452 # ifdef TRY_FPRINTF
12453   fprintf(p, "x");
12454 # endif
12455 #endif
12456 #ifdef TRY_FFLUSH_NULL
12457   fflush(NULL);
12458 #endif
12459 #ifdef TRY_FFLUSH_ALL
12460   {
12461     long open_max = -1;
12462 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12463     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12464 # else
12465 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12466     open_max = sysconf(_SC_OPEN_MAX);
12467 #  else
12468 #   ifdef FOPEN_MAX
12469     open_max = FOPEN_MAX;
12470 #   else
12471 #    ifdef OPEN_MAX
12472     open_max = OPEN_MAX;
12473 #    else
12474 #     ifdef _NFILE
12475     open_max = _NFILE;
12476 #     endif
12477 #    endif
12478 #   endif
12479 #  endif
12480 # endif 
12481 # ifdef HAS_STDIO_STREAM_ARRAY
12482     if (open_max > 0) {
12483       long i;
12484       for (i = 0; i < open_max; i++)
12485             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12486                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12487                 STDIO_STREAM_ARRAY[i]._flag)
12488                 fflush(&STDIO_STREAM_ARRAY[i]);
12489     }   
12490   }
12491 # endif
12492 #endif
12493   _exit(42);
12494 }
12495 EOCP
12496 : first we have to find out how _not_ to flush
12497 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12498     output=''
12499     set try -DTRY_FPUTC
12500     if eval $compile; then
12501             $rm -f try.out
12502             ./try$exe_ext 2>/dev/null
12503             if $test ! -s try.out -a "X$?" = X42; then
12504                 output=-DTRY_FPUTC
12505             fi
12506     fi
12507     case "$output" in
12508     '')
12509             set try -DTRY_FPRINTF
12510             $rm -f try.out
12511             if eval $compile; then
12512                     $rm -f try.out
12513                     ./try$exe_ext 2>/dev/null
12514                     if $test ! -s try.out -a "X$?" = X42; then
12515                         output=-DTRY_FPRINTF
12516                     fi
12517             fi
12518         ;;
12519     esac
12520 fi
12521 : check for fflush NULL behaviour
12522 case "$fflushNULL" in
12523 '')     set try -DTRY_FFLUSH_NULL $output
12524         if eval $compile; then
12525                 $rm -f try.out
12526                 ./try$exe_ext 2>/dev/null
12527                 code="$?"
12528                 if $test -s try.out -a "X$code" = X42; then
12529                         fflushNULL="`$cat try.out`"
12530                 else
12531                         if $test "X$code" != X42; then
12532                                 $cat >&4 <<EOM
12533 (If this test failed, don't worry, we'll try another method shortly.)
12534 EOM
12535                         fi
12536                 fi
12537         fi
12538         $rm -f core try.core core.try.*
12539         case "$fflushNULL" in
12540         x)      $cat >&4 <<EOM
12541 Your fflush(NULL) works okay for output streams.
12542 Let's see if it clobbers input pipes...
12543 EOM
12544 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12545 # bug that improperly flushes the input end of pipes.  So we avoid the
12546 # autoflush on fork/system/exec support for now. :-(
12547 $cat >tryp.c <<EOCP
12548 #include <stdio.h>
12549 int
12550 main(int argc, char **argv)
12551 {
12552     char buf[1024];
12553     int i;
12554     char *bp = buf;
12555     while (1) {
12556         while ((i = getc(stdin)) != -1
12557                && (*bp++ = i) != '\n'
12558                && bp < &buf[1024])
12559         /* DO NOTHING */ ;
12560         *bp = '\0';
12561         fprintf(stdout, "%s", buf);
12562         fflush(NULL);
12563         if (i == -1)
12564             return 0;
12565         bp = buf;
12566     }
12567 }
12568 EOCP
12569                 fflushNULL="$define"
12570                 set tryp
12571                 if eval $compile; then
12572                     $rm -f tryp.out
12573                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12574                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12575                        $cat >&4 <<EOM
12576 fflush(NULL) seems to behave okay with input streams.
12577 EOM
12578                         fflushNULL="$define"
12579                     else
12580                         $cat >&4 <<EOM
12581 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12582 EOM
12583                         fflushNULL="$undef"
12584                     fi
12585                 fi
12586                 $rm -f core tryp.c tryp.core core.tryp.*
12587                 ;;
12588         '')     $cat >&4 <<EOM
12589 Your fflush(NULL) isn't working (contrary to ANSI C).
12590 EOM
12591                 fflushNULL="$undef"
12592                 ;;
12593         *)      $cat >&4 <<EOM
12594 Cannot figure out whether your fflush(NULL) works or not.
12595 I'm assuming it doesn't (contrary to ANSI C).
12596 EOM
12597                 fflushNULL="$undef"
12598                 ;;
12599         esac
12600         ;;
12601 $define|true|[yY]*)
12602         fflushNULL="$define"
12603         ;;
12604 *)
12605         fflushNULL="$undef"
12606         ;;
12607 esac
12608 : check explicit looping only if NULL did not work, and if the pipe
12609 : bug does not show up on an explicit flush too
12610 case "$fflushNULL" in
12611 "$undef")
12612         $cat >tryp.c <<EOCP
12613 #include <stdio.h>
12614 int
12615 main(int argc, char **argv)
12616 {
12617     char buf[1024];
12618     int i;
12619     char *bp = buf;
12620     while (1) {
12621         while ((i = getc(stdin)) != -1
12622                && (*bp++ = i) != '\n'
12623                && bp < &buf[1024])
12624         /* DO NOTHING */ ;
12625         *bp = '\0';
12626         fprintf(stdout, "%s", buf);
12627         fflush(stdin);
12628         if (i == -1)
12629             return 0;
12630         bp = buf;
12631     }
12632 }
12633 EOCP
12634         set tryp
12635         if eval $compile; then
12636             $rm -f tryp.out
12637             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12638             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12639                $cat >&4 <<EOM
12640 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12641 EOM
12642                 : now check for fflushall behaviour
12643                 case "$fflushall" in
12644                 '')     set try -DTRY_FFLUSH_ALL $output
12645                         if eval $compile; then
12646                                 $cat >&4 <<EOM
12647 (Now testing the other method--but note that this also may fail.)
12648 EOM
12649                                 $rm -f try.out
12650                                 ./try$exe_ext 2>/dev/null
12651                                 if $test -s try.out -a "X$?" = X42; then
12652                                         fflushall="`$cat try.out`"
12653                                 fi
12654                         fi
12655                         $rm -f core try.core core.try.*
12656                         case "$fflushall" in
12657                         x)      $cat >&4 <<EOM
12658 Whew. Flushing explicitly all the stdio streams works.
12659 EOM
12660                                 fflushall="$define"
12661                                 ;;
12662                         '')     $cat >&4 <<EOM
12663 Sigh. Flushing explicitly all the stdio streams doesn't work.
12664 EOM
12665                                 fflushall="$undef"
12666                                 ;;
12667                         *)      $cat >&4 <<EOM
12668 Cannot figure out whether flushing stdio streams explicitly works or not.
12669 I'm assuming it doesn't.
12670 EOM
12671                                 fflushall="$undef"
12672                                 ;;
12673                         esac
12674                         ;;
12675                 "$define"|true|[yY]*)
12676                         fflushall="$define"
12677                         ;;
12678                 *)
12679                         fflushall="$undef"
12680                         ;;
12681                 esac
12682             else
12683                 $cat >&4 <<EOM
12684 All is futile.  Even fflush(stdin) clobbers input pipes!
12685 EOM
12686                 fflushall="$undef"
12687             fi
12688         else
12689             fflushall="$undef"
12690         fi
12691         $rm -f core tryp.c tryp.core core.tryp.*
12692         ;;
12693 *)      fflushall="$undef"
12694         ;;
12695 esac
12696
12697 case "$fflushNULL$fflushall" in
12698 undefundef)
12699         $cat <<EOM
12700 OK, I give up.  I cannot figure out how to flush pending stdio output.
12701 We won't be flushing handles at all before fork/exec/popen.
12702 EOM
12703         ;;
12704 esac
12705 $rm -f try.* try$exe_ext
12706
12707 : Store the full pathname to the ar program for use in the C program
12708 : Respect a hint or command line value for full_ar.
12709 case "$full_ar" in
12710 '') full_ar=$ar ;;
12711 esac
12712
12713 : Store the full pathname to the sed program for use in the C program
12714 full_sed=$sed
12715
12716 : see what type gids are declared as in the kernel
12717 echo " "
12718 echo "Looking for the type for group ids returned by getgid()."
12719 set gid_t gidtype xxx stdio.h sys/types.h
12720 eval $typedef
12721 case "$gidtype" in
12722 xxx)
12723         xxx=`./findhdr sys/user.h`
12724         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12725         case $1 in
12726         unsigned) dflt="$1 $2" ;;
12727         *) dflt="$1" ;;
12728         esac
12729         ;;
12730 *) dflt="$gidtype";;
12731 esac
12732 case "$gidtype" in
12733 gid_t) echo "gid_t found." ;;
12734 *)      rp="What is the type for group ids returned by getgid()?"
12735         . ./myread
12736         gidtype="$ans"
12737         ;;
12738 esac
12739
12740 echo " "
12741 case "$gidtype" in
12742 *_t) zzz="$gidtype"     ;;
12743 *)   zzz="gid"          ;;
12744 esac
12745 echo "Checking the size of $zzz..." >&4 
12746 cat > try.c <<EOCP
12747 #include <sys/types.h>
12748 #include <stdio.h>
12749 int main() {
12750     printf("%d\n", (int)sizeof($gidtype));
12751     exit(0);
12752 }
12753 EOCP
12754 set try
12755 if eval $compile_ok; then
12756         yyy=`./try`
12757         case "$yyy" in
12758         '')     gidsize=4
12759                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12760                 ;;
12761         *)      gidsize=$yyy
12762                 echo "Your $zzz is $gidsize bytes long."
12763                 ;;
12764         esac
12765 else
12766         gidsize=4
12767         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12768 fi
12769
12770
12771 echo " "
12772 case "$gidtype" in
12773 *_t) zzz="$gidtype"     ;;
12774 *)   zzz="gid"          ;;
12775 esac
12776 echo "Checking the sign of $zzz..." >&4 
12777 cat > try.c <<EOCP
12778 #include <sys/types.h>
12779 #include <stdio.h>
12780 int main() {
12781         $gidtype foo = -1;
12782         if (foo < 0)
12783                 printf("-1\n");
12784         else
12785                 printf("1\n");
12786 }
12787 EOCP
12788 set try
12789 if eval $compile; then
12790         yyy=`./try`
12791         case "$yyy" in
12792         '')     gidsign=1
12793                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12794                 ;;
12795         *)      gidsign=$yyy
12796                 case "$gidsign" in
12797                  1) echo "Your $zzz is unsigned." ;;
12798                 -1) echo "Your $zzz is signed."   ;;
12799                 esac
12800                 ;;
12801         esac
12802 else
12803         gidsign=1
12804         echo "(I can't compile the test program--guessing unsigned.)" >&4
12805 fi
12806
12807
12808 echo " "
12809
12810 if $test X"$quadtype" != X; then
12811
12812 echo "Checking how to print 64-bit integers..." >&4
12813
12814 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12815         $cat >try.c <<'EOCP'
12816 #include <sys/types.h>
12817 #include <stdio.h>
12818 int main() {
12819   int q = 12345678901;
12820   printf("%ld\n", q);
12821 }
12822 EOCP
12823         set try
12824         if eval $compile; then
12825                 yyy=`./try$exe_ext`
12826                 case "$yyy" in
12827                 12345678901)
12828                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12829                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12830                         echo "We will use %d."
12831                         ;;
12832                 esac
12833         fi
12834 fi
12835
12836 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12837         $cat >try.c <<'EOCP'
12838 #include <sys/types.h>
12839 #include <stdio.h>
12840 int main() {
12841   long q = 12345678901;
12842   printf("%ld\n", q);
12843 }
12844 EOCP
12845         set try
12846         if eval $compile; then
12847                 yyy=`./try$exe_ext`
12848                 case "$yyy" in
12849                 12345678901)
12850                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12851                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12852                         echo "We will use %ld."
12853                         ;;
12854                 esac
12855         fi
12856 fi
12857
12858 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12859         $cat >try.c <<'EOCP'
12860 #include <sys/types.h>
12861 #include <inttypes.h>
12862 #include <stdio.h>
12863 int main() {
12864   int64_t q = 12345678901;
12865   printf("%" PRId64 "\n", q);
12866 }
12867 EOCP
12868         set try
12869         if eval $compile; then
12870                 yyy=`./try$exe_ext`
12871                 case "$yyy" in
12872                 12345678901)
12873                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12874                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12875                         echo "We will use the C9X style."
12876                         ;;
12877                 esac
12878         fi
12879 fi
12880
12881 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12882         $cat >try.c <<'EOCP'
12883 #include <sys/types.h>
12884 #include <stdio.h>
12885 int main() {
12886   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12887   printf("%lld\n", q);
12888 }
12889 EOCP
12890         set try
12891         if eval $compile; then
12892                 yyy=`./try$exe_ext`
12893                 case "$yyy" in
12894                 12345678901)
12895                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12896                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12897                         echo "We will use the %lld style."
12898                         ;;
12899                 esac
12900         fi
12901 fi
12902
12903 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12904         $cat >try.c <<EOCP
12905 #include <sys/types.h>
12906 #include <stdio.h>
12907 int main() {
12908   $quadtype q = 12345678901;
12909   printf("%Ld\n", q);
12910 }
12911 EOCP
12912         set try
12913         if eval $compile; then
12914                 yyy=`./try$exe_ext`
12915                 case "$yyy" in
12916                 12345678901)
12917                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12918                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12919                         echo "We will use %Ld."
12920                         ;;
12921                 esac
12922         fi
12923 fi
12924
12925 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12926         $cat >try.c <<EOCP
12927 #include <sys/types.h>
12928 #include <stdio.h>
12929 int main() {
12930   $quadtype q = 12345678901;
12931   printf("%qd\n", q);
12932 }
12933 EOCP
12934         set try
12935         if eval $compile; then
12936                 yyy=`./try$exe_ext`
12937                 case "$yyy" in
12938                 12345678901)
12939                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12940                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12941                         echo "We will use %qd."
12942                         ;;
12943                 esac
12944         fi
12945 fi
12946
12947 if $test X"$sPRId64" = X; then
12948         echo "Cannot figure out how to print 64-bit integers." >&4
12949 fi
12950
12951 $rm -f try try.*
12952
12953 fi
12954
12955 case "$sPRId64" in
12956 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12957         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12958         ;;
12959 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12960         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12961         ;;
12962 esac
12963
12964
12965 echo " "
12966 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12967
12968 if $test X"$ivsize" = X8; then
12969         ivdformat="$sPRId64"
12970         uvuformat="$sPRIu64"
12971         uvoformat="$sPRIo64"
12972         uvxformat="$sPRIx64"
12973 else
12974         if $test X"$ivsize" = X"$longsize"; then
12975                 ivdformat='"ld"'
12976                 uvuformat='"lu"'
12977                 uvoformat='"lo"'
12978                 uvxformat='"lx"'
12979         else
12980                 if $test X"$ivsize" = X"$intsize"; then
12981                         ivdformat='"d"'
12982                         uvuformat='"u"'
12983                         uvoformat='"o"'
12984                         uvxformat='"x"'
12985                 else
12986                         : far out
12987                         if $test X"$ivsize" = X"$shortsize"; then
12988                                 ivdformat='"hd"'
12989                                 uvuformat='"hu"'
12990                                 uvoformat='"ho"'
12991                                 uvxformat='"hx"'
12992                         fi
12993                 fi
12994         fi
12995 fi
12996
12997 case "$ivdformat" in
12998 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12999     exit 1
13000     ;;
13001 esac
13002
13003
13004 echo " "
13005 $echo "Checking the format string to be used for gids..." >&4
13006
13007 case "$gidsign" in
13008 -1)     if $test X"$gidsize" = X"$ivsize"; then
13009                 gidformat="$ivdformat"
13010         else
13011                 if $test X"$gidsize" = X"$longsize"; then
13012                         gidformat='"ld"'
13013                 else
13014                         if $test X"$gidsize" = X"$intsize"; then
13015                                 gidformat='"d"'
13016                         else
13017                                 if $test X"$gidsize" = X"$shortsize"; then
13018                                         gidformat='"hd"'
13019                                 fi
13020                         fi
13021                 fi
13022         fi
13023         ;;
13024 *)      if $test X"$gidsize" = X"$uvsize"; then
13025                 gidformat="$uvuformat"
13026         else
13027                 if $test X"$gidsize" = X"$longsize"; then
13028                         gidformat='"lu"'
13029                 else
13030                         if $test X"$gidsize" = X"$intsize"; then
13031                                 gidformat='"u"'
13032                         else
13033                                 if $test X"$gidsize" = X"$shortsize"; then
13034                                         gidformat='"hu"'
13035                                 fi
13036                         fi
13037                 fi
13038         fi
13039         ;;
13040 esac
13041
13042 : see if getgroups exists
13043 set getgroups d_getgrps
13044 eval $inlibc
13045
13046 : see if setgroups exists
13047 set setgroups d_setgrps
13048 eval $inlibc
13049
13050
13051 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13052 echo " "
13053 case "$d_getgrps$d_setgrps" in
13054 *define*)
13055         case "$groupstype" in
13056         '') dflt="$gidtype" ;;
13057         *)  dflt="$groupstype" ;;
13058         esac
13059         $cat <<EOM
13060 What type of pointer is the second argument to getgroups() and setgroups()?
13061 Usually this is the same as group ids, $gidtype, but not always.
13062
13063 EOM
13064         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13065         . ./myread
13066         groupstype="$ans"
13067         ;;
13068 *)  groupstype="$gidtype";;
13069 esac
13070
13071 echo " "
13072 echo "Checking if your $make program sets \$(MAKE)..." >&4
13073 case "$make_set_make" in
13074 '')
13075         $sed 's/^X //' > testmake.mak << 'EOF'
13076 Xall:
13077 X       @echo 'maketemp="$(MAKE)"'
13078 EOF
13079         case "`$make -f testmake.mak 2>/dev/null`" in
13080         *maketemp=*) make_set_make='#' ;;
13081         *)      make_set_make="MAKE=$make" ;;
13082         esac
13083         $rm -f testmake.mak
13084         ;;
13085 esac
13086 case "$make_set_make" in
13087 '#') echo "Yup, it does.";;
13088 *) echo "Nope, it doesn't.";;
13089 esac
13090
13091 : see what type is used for mode_t
13092 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13093 set mode_t modetype int stdio.h sys/types.h
13094 eval $typedef_ask
13095
13096 : define a fucntion to check prototypes
13097 $cat > protochk <<EOSH
13098 $startsh
13099 cc="$cc"
13100 optimize="$optimize"
13101 ccflags="$ccflags"
13102 prototype="$prototype"
13103 define="$define"
13104 rm=$rm
13105 EOSH
13106
13107 $cat >> protochk <<'EOSH'
13108
13109 $rm -f try.c
13110 foo="$1"
13111 shift
13112 while test $# -ge 2; do
13113         case "$1" in
13114                 $define) echo "#include <$2>" >> try.c ;;
13115                 literal) echo "$2" >> try.c ;;
13116         esac
13117     shift 2
13118 done
13119 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13120 cat >> try.c <<'EOCP'
13121 #ifdef CAN_PROTOTYPE
13122 #define _(args) args
13123 #else
13124 #define _(args) ()
13125 #endif
13126 EOCP
13127 echo "$foo" >> try.c
13128 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13129 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13130 status=$?
13131 $rm -f try.[co]
13132 exit $status
13133 EOSH
13134 chmod +x protochk
13135 $eunicefix protochk
13136
13137 : see what type is used for size_t
13138 rp="What is the type used for the length parameter for string functions?"
13139 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13140 eval $typedef_ask
13141
13142 : check for type of arguments to gethostbyaddr. 
13143 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13144         case "$d_gethbyaddr" in
13145         $define)
13146                 $cat <<EOM
13147
13148 Checking to see what type of arguments are accepted by gethostbyaddr().
13149 EOM
13150                 hdrs="$define sys/types.h
13151                         $d_socket sys/socket.h 
13152                         $i_niin netinet/in.h 
13153                         $i_netdb netdb.h
13154                         $i_unistd unistd.h"
13155                 : The first arg can 'char *' or 'void *'
13156                 : The second arg is some of integral type
13157                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13158                         for yyy in size_t long int; do
13159                                 case "$netdb_host_type" in
13160                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13161                                         if ./protochk "$try" $hdrs; then
13162                                                 echo "Your system accepts $xxx for the first arg."
13163                                                 echo "...and $yyy for the second arg."
13164                                                 netdb_host_type="$xxx"
13165                                                 netdb_hlen_type="$yyy"
13166                                         fi
13167                                         ;;
13168                                 esac
13169                         done
13170                 done
13171                 : In case none of those worked, prompt the user.
13172                 case "$netdb_host_type" in
13173                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13174                         dflt='char *'
13175                         . ./myread
13176                         netdb_host_type=$ans
13177                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13178                         dflt="$sizetype"
13179                         . ./myread
13180                         netdb_hlen_type=$ans
13181                         ;;
13182                 esac
13183                 ;;
13184         *)      : no gethostbyaddr, so pick harmless defaults
13185                 netdb_host_type='char *'
13186                 netdb_hlen_type="$sizetype"
13187                 ;;
13188         esac
13189         # Remove the "const" if needed. -- but then we'll have a 
13190         # prototype clash!
13191         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13192 fi
13193
13194 : check for type of argument to gethostbyname. 
13195 if test "X$netdb_name_type" = X ; then
13196         case "$d_gethbyname" in
13197         $define)
13198                 $cat <<EOM
13199
13200 Checking to see what type of argument is accepted by gethostbyname().
13201 EOM
13202                 hdrs="$define sys/types.h
13203                         $d_socket sys/socket.h 
13204                         $i_niin netinet/in.h 
13205                         $i_netdb netdb.h
13206                         $i_unistd unistd.h"
13207                 for xxx in "const char *" "char *"; do
13208                         case "$netdb_name_type" in
13209                         '')     try="extern struct hostent *gethostbyname($xxx);"
13210                                 if ./protochk "$try" $hdrs; then
13211                                         echo "Your system accepts $xxx."
13212                                         netdb_name_type="$xxx"
13213                                 fi
13214                                 ;;
13215                         esac
13216                 done
13217                 : In case none of those worked, prompt the user.
13218                 case "$netdb_name_type" in
13219                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13220                         dflt='char *'
13221                         . ./myread
13222                         netdb_name_type=$ans
13223                         ;;
13224                 esac
13225                 ;;
13226         *)      : no gethostbyname, so pick harmless default
13227                 netdb_name_type='char *'
13228                 ;;
13229         esac
13230 fi
13231
13232 : check for type of 1st argument to getnetbyaddr. 
13233 if test "X$netdb_net_type" = X ; then
13234         case "$d_getnbyaddr" in
13235         $define)
13236                 $cat <<EOM
13237
13238 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13239 EOM
13240                 hdrs="$define sys/types.h
13241                         $d_socket sys/socket.h 
13242                         $i_niin netinet/in.h 
13243                         $i_netdb netdb.h
13244                         $i_unistd unistd.h"
13245                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13246                         case "$netdb_net_type" in
13247                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13248                                 if ./protochk "$try" $hdrs; then
13249                                         echo "Your system accepts $xxx."
13250                                         netdb_net_type="$xxx"
13251                                 fi
13252                                 ;;
13253                         esac
13254                 done
13255                 : In case none of those worked, prompt the user.
13256                 case "$netdb_net_type" in
13257                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13258                         dflt='long'
13259                         . ./myread
13260                         netdb_net_type=$ans
13261                         ;;
13262                 esac
13263                 ;;
13264         *)      : no getnetbyaddr, so pick harmless default
13265                 netdb_net_type='long'
13266                 ;;
13267         esac
13268 fi
13269 : locate the preferred pager for this system
13270 case "$pager" in
13271 '')
13272         dflt=''
13273         case "$pg" in
13274         /*) dflt=$pg;;
13275         esac
13276         case "$more" in
13277         /*) dflt=$more;;
13278         esac
13279         case "$less" in
13280         /*) dflt=$less;;
13281         esac
13282         case "$dflt" in
13283         '') dflt=/usr/ucb/more;;
13284         esac
13285         ;;
13286 *) dflt="$pager";;
13287 esac
13288 echo " "
13289 fn=f/
13290 rp='What pager is used on your system?'
13291 . ./getfile
13292 pager="$ans"
13293
13294 : see what type pids are declared as in the kernel
13295 rp="What is the type of process ids on this system?"
13296 set pid_t pidtype int stdio.h sys/types.h
13297 eval $typedef_ask
13298
13299 : Find earliest binary compatible site_perl subdirectory perl can use.
13300 case "$bincompat5005" in
13301 "$define") xs_apiversion='5.005' ;;
13302 *) xs_apiversion=$version ;;   # The current site_perl version.
13303 esac
13304 : Find earliest pure perl site_perl subdirectory perl can use.
13305 : The versioned directories started at 5.005.
13306 pm_apiversion='5.005'
13307
13308 : check for length of pointer
13309 echo " "
13310 case "$ptrsize" in
13311 '')
13312         echo "Checking to see how big your pointers are..." >&4
13313         if test "$voidflags" -gt 7; then
13314                 echo '#define VOID_PTR char *' > try.c
13315         else
13316                 echo '#define VOID_PTR void *' > try.c
13317         fi
13318         $cat >>try.c <<'EOCP'
13319 #include <stdio.h>
13320 int main()
13321 {
13322     printf("%d\n", (int)sizeof(VOID_PTR));
13323     exit(0);
13324 }
13325 EOCP
13326         set try
13327         if eval $compile_ok; then
13328                 ptrsize=`./try`
13329                 echo "Your pointers are $ptrsize bytes long."
13330         else
13331                 dflt='4'
13332                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13333                 rp="What is the size of a pointer (in bytes)?"
13334                 . ./myread
13335                 ptrsize="$ans"
13336         fi
13337         ;;
13338 esac
13339 $rm -f try.c try
13340
13341 : see if ar generates random libraries by itself
13342 echo " "
13343 echo "Checking how to generate random libraries on your machine..." >&4
13344 echo 'int bar1() { return bar2(); }' > bar1.c
13345 echo 'int bar2() { return 2; }' > bar2.c
13346 $cat > foo.c <<'EOP'
13347 int main() { printf("%d\n", bar1()); exit(0); }
13348 EOP
13349 $cc $ccflags -c bar1.c >/dev/null 2>&1
13350 $cc $ccflags -c bar2.c >/dev/null 2>&1
13351 $cc $ccflags -c foo.c >/dev/null 2>&1
13352 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13353 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13354         ./foobar >/dev/null 2>&1; then
13355         echo "$ar appears to generate random libraries itself."
13356         orderlib=false
13357         ranlib=":"
13358 elif $ar ts bar$_a >/dev/null 2>&1 &&
13359         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13360         ./foobar >/dev/null 2>&1; then
13361                 echo "a table of contents needs to be added with '$ar ts'."
13362                 orderlib=false
13363                 ranlib="$ar ts"
13364 else
13365         case "$ranlib" in
13366         :) ranlib='';;
13367         '')
13368                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13369                 $test -f $ranlib || ranlib=''
13370                 ;;
13371         esac
13372         if $test -n "$ranlib"; then
13373                 echo "your system has '$ranlib'; we'll use that."
13374                 orderlib=false
13375         else
13376                 echo "your system doesn't seem to support random libraries"
13377                 echo "so we'll use lorder and tsort to order the libraries."
13378                 orderlib=true
13379                 ranlib=":"
13380         fi
13381 fi
13382 $rm -f foo* bar* 
13383
13384 : check for type of arguments to select. 
13385 case "$selecttype" in
13386 '') case "$d_select" in
13387         $define)
13388                 echo " "
13389                 $cat <<EOM
13390 Checking to see what type of arguments are accepted by select().
13391 EOM
13392                 hdrs="$define sys/types.h
13393                         $i_systime sys/time.h 
13394                         $i_sysselct sys/select.h
13395                         $d_socket sys/socket.h"
13396                 : The first arg can be int, unsigned, or size_t
13397                 : The last arg may or may not be 'const'
13398                 val=''
13399                 : void pointer has been seen but using that
13400                 : breaks the selectminbits test
13401                 for xxx in 'fd_set *' 'int *'; do
13402                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13403                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13404                                         case "$val" in
13405                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13406                                                 if ./protochk "$try" $hdrs; then
13407                                                         echo "Your system accepts $xxx."
13408                                                         val="$xxx"
13409                                                 fi
13410                                                 ;;
13411                                         esac
13412                                 done
13413                         done
13414                 done
13415                 case "$val" in
13416                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13417                         case "$d_fd_set" in
13418                                 $define) dflt="fd_set *" ;;
13419                                 *)              dflt="int *" ;;
13420                         esac
13421                         . ./myread
13422                         val=$ans
13423                         ;;
13424                 esac
13425                 selecttype="$val"
13426                 ;;
13427         *)      : no select, so pick a harmless default
13428                 selecttype='int *'
13429                 ;;
13430         esac
13431         ;;
13432 esac
13433
13434 : check for the select 'width'
13435 case "$selectminbits" in
13436 '') case "$d_select" in
13437         $define)
13438                 $cat <<EOM
13439
13440 Checking to see on how many bits at a time your select() operates...
13441 EOM
13442                 $cat >try.c <<EOCP
13443 #include <sys/types.h>
13444 #$i_time I_TIME
13445 #$i_systime I_SYS_TIME
13446 #$i_systimek I_SYS_TIME_KERNEL
13447 #ifdef I_TIME
13448 #   include <time.h>
13449 #endif
13450 #ifdef I_SYS_TIME
13451 #   ifdef I_SYS_TIME_KERNEL
13452 #       define KERNEL
13453 #   endif
13454 #   include <sys/time.h>
13455 #   ifdef I_SYS_TIME_KERNEL
13456 #       undef KERNEL
13457 #   endif
13458 #endif
13459 #$i_sysselct I_SYS_SELECT
13460 #ifdef I_SYS_SELECT
13461 #include <sys/select.h>
13462 #endif
13463 #$d_socket HAS_SOCKET
13464 #ifdef HAS_SOCKET
13465 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13466 #endif
13467 #include <stdio.h>
13468 $selecttype b;
13469 #define S sizeof(*(b))
13470 #define MINBITS 64
13471 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13472 #define NBITS  (NBYTES * 8)
13473 int main() {
13474     char s[NBYTES];
13475     struct timeval t;
13476     int i;
13477     FILE* fp;
13478     int fd;
13479
13480     fclose(stdin);
13481     fp = fopen("try.c", "r");
13482     if (fp == 0)
13483       exit(1);
13484     fd = fileno(fp);
13485     if (fd < 0)
13486       exit(2);
13487     b = ($selecttype)s;
13488     for (i = 0; i < NBITS; i++)
13489         FD_SET(i, b);
13490     t.tv_sec  = 0;
13491     t.tv_usec = 0;
13492     select(fd + 1, b, 0, 0, &t);
13493     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13494     printf("%d\n", i + 1);
13495     return 0;
13496 }
13497 EOCP
13498                 set try
13499                 if eval $compile_ok; then
13500                         selectminbits=`./try`
13501                         case "$selectminbits" in
13502                         '')     cat >&4 <<EOM
13503 Cannot figure out on how many bits at a time your select() operates.
13504 I'll play safe and guess it is 32 bits.
13505 EOM
13506                                 selectminbits=32
13507                                 bits="32 bits"
13508                                 ;;
13509                         1)      bits="1 bit" ;;
13510                         *)      bits="$selectminbits bits" ;;
13511                         esac
13512                         echo "Your select() operates on $bits at a time." >&4
13513                 else
13514                         rp='What is the minimum number of bits your select() operates on?'
13515                         case "$byteorder" in
13516                         1234|12345678)  dflt=32 ;;
13517                         *)              dflt=1  ;;
13518                         esac
13519                         . ./myread
13520                         val=$ans
13521                         selectminbits="$val"
13522                 fi
13523                 $rm -f try.* try
13524                 ;;
13525         *)      : no select, so pick a harmless default
13526                 selectminbits='32'
13527                 ;;
13528         esac
13529         ;;
13530 esac
13531
13532 : Trace out the files included by signal.h, then look for SIGxxx names.
13533 : Remove SIGARRAYSIZE used by HPUX.
13534 : Remove SIGSTKSIZE used by Linux.
13535 : Remove SIGSTKSZ used by Posix.
13536 : Remove SIGTYP void lines used by OS2.
13537 : Some cpps, like os390, dont give the file name anywhere
13538 if [ "X$fieldn" = X ]; then
13539         : Just make some guesses.  We check them later.
13540         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13541 else
13542         xxx=`echo '#include <signal.h>' |
13543         $cppstdin $cppminus $cppflags 2>/dev/null |
13544         $grep '^[       ]*#.*include' | 
13545         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13546 fi
13547 : Check this list of files to be sure we have parsed the cpp output ok.
13548 : This will also avoid potentially non-existent files, such 
13549 : as ../foo/bar.h
13550 xxxfiles=''
13551 for xx in $xxx /dev/null ; do
13552         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13553 done
13554 : If we have found no files, at least try signal.h
13555 case "$xxxfiles" in
13556 '')     xxxfiles=`./findhdr signal.h` ;;
13557 esac
13558 xxx=`awk '
13559 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13560         print substr($2, 4, 20)
13561 }
13562 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13563         print substr($3, 4, 20)
13564 }' $xxxfiles`
13565 : Append some common names just in case the awk scan failed.
13566 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13567 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13568 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13569 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13570 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13571
13572 : generate a few handy files for later
13573 $cat > signal.c <<'EOCP'
13574 #include <sys/types.h>
13575 #include <signal.h>
13576 #include <stdio.h>
13577 int main() {
13578
13579 /* Strange style to avoid deeply-nested #if/#else/#endif */
13580 #ifndef NSIG
13581 #  ifdef _NSIG
13582 #    define NSIG (_NSIG)
13583 #  endif
13584 #endif
13585
13586 #ifndef NSIG
13587 #  ifdef SIGMAX
13588 #    define NSIG (SIGMAX+1)
13589 #  endif
13590 #endif
13591
13592 #ifndef NSIG
13593 #  ifdef SIG_MAX
13594 #    define NSIG (SIG_MAX+1)
13595 #  endif
13596 #endif
13597
13598 #ifndef NSIG
13599 #  ifdef MAXSIG
13600 #    define NSIG (MAXSIG+1)
13601 #  endif
13602 #endif
13603
13604 #ifndef NSIG
13605 #  ifdef MAX_SIG
13606 #    define NSIG (MAX_SIG+1)
13607 #  endif
13608 #endif
13609
13610 #ifndef NSIG
13611 #  ifdef SIGARRAYSIZE
13612 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13613 #  endif
13614 #endif
13615
13616 #ifndef NSIG
13617 #  ifdef _sys_nsig
13618 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13619 #  endif
13620 #endif
13621
13622 /* Default to some arbitrary number that's big enough to get most
13623    of the common signals.
13624 */
13625 #ifndef NSIG
13626 #    define NSIG 50
13627 #endif
13628
13629 printf("NSIG %d\n", NSIG);
13630
13631 #ifndef JUST_NSIG
13632
13633 EOCP
13634
13635 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13636 {
13637         printf "#ifdef SIG"; printf $1; printf "\n"
13638         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13639         printf $1; printf ");\n"
13640         printf "#endif\n"
13641 }
13642 END {
13643         printf "#endif /* JUST_NSIG */\n";
13644         printf "exit(0);\n}\n";
13645 }
13646 ' >>signal.c
13647 $cat >signal.awk <<'EOP'
13648 BEGIN { ndups = 0 }
13649 $1 ~ /^NSIG$/ { nsig = $2 }
13650 ($1 !~ /^NSIG$/) && (NF == 2) {
13651     if ($2 > maxsig) { maxsig = $2 }
13652     if (sig_name[$2]) {
13653         dup_name[ndups] = $1
13654         dup_num[ndups] = $2
13655         ndups++ 
13656     }
13657     else {
13658         sig_name[$2] = $1
13659         sig_num[$2] = $2
13660     }
13661 }
13662 END { 
13663     if (nsig == 0) {
13664         nsig = maxsig + 1
13665     }
13666     printf("NSIG %d\n", nsig);
13667     for (n = 1; n < nsig; n++) {
13668         if (sig_name[n]) {
13669             printf("%s %d\n", sig_name[n], sig_num[n])
13670         }
13671         else {
13672             printf("NUM%d %d\n", n, n) 
13673         }
13674     }
13675     for (n = 0; n < ndups; n++) {
13676         printf("%s %d\n", dup_name[n], dup_num[n])
13677     }
13678 }
13679 EOP
13680 $cat >signal_cmd <<EOS
13681 $startsh
13682 if $test -s signal.lst; then
13683     echo "Using your existing signal.lst file"
13684         exit 0
13685 fi
13686 xxx="$xxx"
13687 EOS
13688 $cat >>signal_cmd <<'EOS'
13689
13690 set signal
13691 if eval $compile_ok; then
13692         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13693 else
13694         echo "(I can't seem be able to compile the whole test program)" >&4
13695         echo "(I'll try it in little pieces.)" >&4
13696         set signal -DJUST_NSIG
13697         if eval $compile_ok; then
13698                 ./signal$_exe > signal.nsg
13699                 $cat signal.nsg
13700         else
13701                 echo "I can't seem to figure out how many signals you have." >&4
13702                 echo "Guessing 50." >&4
13703                 echo 'NSIG 50' > signal.nsg
13704         fi
13705         : Now look at all the signal names, one at a time.
13706         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13707                 $cat > signal.c <<EOCP
13708 #include <sys/types.h>
13709 #include <signal.h>
13710 #include <stdio.h>
13711 int main() {
13712 printf("$xx %d\n", SIG${xx});
13713 return 0;
13714 }
13715 EOCP
13716                 set signal
13717                 if eval $compile; then
13718                         echo "SIG${xx} found."
13719                         ./signal$_exe  >> signal.ls1
13720                 else
13721                         echo "SIG${xx} NOT found."
13722                 fi
13723         done
13724         if $test -s signal.ls1; then
13725                 $cat signal.nsg signal.ls1 |
13726                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13727         fi
13728
13729 fi
13730 if $test -s signal.lst; then
13731         :
13732 else
13733         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13734         echo 'kill -l' >signal
13735         set X `csh -f <signal`
13736         $rm -f signal
13737         shift
13738         case $# in
13739         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13740         esac
13741         echo $@ | $tr ' ' $trnl | \
13742             $awk '{ printf "%s %d\n", $1, ++s; }
13743                   END { printf "NSIG %d\n", ++s }' >signal.lst
13744 fi
13745 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13746 EOS
13747 chmod a+x signal_cmd
13748 $eunicefix signal_cmd
13749
13750 : generate list of signal names
13751 echo " "
13752 case "$sig_name_init" in
13753 '') doinit=yes ;;
13754 *)  case "$sig_num_init" in
13755     ''|*,*) doinit=yes ;;
13756     esac ;;
13757 esac
13758 case "$doinit" in
13759 yes)
13760         echo "Generating a list of signal names and numbers..." >&4
13761         . ./signal_cmd
13762         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13763         sig_name=`$awk 'BEGIN { printf "ZERO " }
13764                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13765         sig_num=`$awk  'BEGIN { printf "0 " }
13766                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13767         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13768                              !/^NSIG/   { printf "\"%s\", ", $1 }
13769                              END        { printf "0\n" }' signal.lst`
13770         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13771                              !/^NSIG/   { printf "%d, ", $2}
13772                              END        { printf "0\n"}' signal.lst`
13773         ;;
13774 esac
13775 echo "The following $sig_count signals are available:"
13776 echo " "
13777 echo $sig_name | $awk \
13778 'BEGIN { linelen = 0 }
13779 {
13780         for (i = 1; i <= NF; i++) {
13781                 name = "SIG" $i " "
13782                 linelen = linelen + length(name)
13783                 if (linelen > 70) {
13784                         printf "\n"
13785                         linelen = length(name)
13786                 }
13787                 printf "%s", name
13788         }
13789         printf "\n"
13790 }'
13791 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13792
13793 echo " "
13794 case "$sizetype" in
13795 *_t) zzz="$sizetype"    ;;
13796 *)   zzz="filesize"     ;;
13797 esac
13798 echo "Checking the size of $zzz..." >&4 
13799 cat > try.c <<EOCP
13800 #include <sys/types.h>
13801 #include <stdio.h>
13802 int main() {
13803     printf("%d\n", (int)sizeof($sizetype));
13804     exit(0);
13805 }
13806 EOCP
13807 set try
13808 if eval $compile_ok; then
13809         yyy=`./try`
13810         case "$yyy" in
13811         '')     sizesize=4
13812                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
13813                 ;;
13814         *)      sizesize=$yyy
13815                 echo "Your $zzz size is $sizesize bytes."
13816                 ;;
13817         esac
13818 else
13819         sizesize=4
13820         echo "(I can't compile the test program--guessing $sizesize.)" >&4
13821 fi
13822
13823
13824 : check for socklen_t
13825 echo " "
13826 echo "Checking to see if you have socklen_t..." >&4
13827 $cat >try.c <<EOCP
13828 #include <sys/types.h>
13829 #$d_socket HAS_SOCKET
13830 #ifdef HAS_SOCKET
13831 #include <sys/socket.h>
13832 #endif
13833 int main() { socklen_t x = 16; }
13834 EOCP
13835 set try
13836 if eval $compile; then
13837         val="$define"
13838         echo "You have socklen_t."
13839 else
13840         val="$undef"
13841         echo "You do not have socklen_t."
13842         case "$sizetype" in
13843         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
13844         esac
13845 fi
13846 $rm -f try try.*
13847 set d_socklen_t
13848 eval $setvar
13849
13850 : check for type of the size argument to socket calls
13851 case "$d_socket" in
13852 "$define")
13853         $cat <<EOM
13854
13855 Checking to see what type is the last argument of accept().
13856 EOM
13857         hdrs="$define sys/types.h $d_socket sys/socket.h" 
13858         yyy=''
13859         case "$d_socklen_t" in
13860         "$define") yyy="$yyy socklen_t"
13861         esac
13862         yyy="$yyy $sizetype int long unsigned"
13863         for xxx in $yyy; do
13864                 case "$socksizetype" in
13865                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
13866                         if ./protochk "$try" $hdrs; then
13867                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
13868                                 socksizetype="$xxx"
13869                         fi
13870                         ;;
13871                 esac
13872         done
13873 : In case none of those worked, prompt the user.
13874         case "$socksizetype" in
13875         '')     rp='What is the type for socket address structure sizes?'
13876                 dflt='int'
13877                 . ./myread
13878                 socksizetype=$ans
13879                 ;;
13880         esac
13881         ;;
13882 *)      : no sockets, so pick relatively harmless default
13883         socksizetype='int'
13884         ;;
13885 esac
13886
13887 : see what type is used for signed size_t
13888 set ssize_t ssizetype int stdio.h sys/types.h
13889 eval $typedef
13890 dflt="$ssizetype"
13891 $cat > ssize.c <<EOM
13892 #include <stdio.h>
13893 #include <sys/types.h>
13894 #define Size_t $sizetype
13895 #define SSize_t $dflt
13896 int main()
13897 {
13898         if (sizeof(Size_t) == sizeof(SSize_t))
13899                 printf("$dflt\n");
13900         else if (sizeof(Size_t) == sizeof(int))
13901                 printf("int\n");
13902         else 
13903                 printf("long\n");
13904         exit(0);
13905 }
13906 EOM
13907 echo " "
13908 set ssize
13909 if eval $compile_ok && ./ssize > /dev/null; then
13910         ssizetype=`./ssize`
13911         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13912 else
13913         $cat >&4 <<EOM
13914 Help! I can't compile and run the ssize_t test program: please enlighten me!
13915 (This is probably a misconfiguration in your system or libraries, and
13916 you really ought to fix it.  Still, I'll try anyway.)
13917
13918 I need a type that is the same size as $sizetype, but is guaranteed to
13919 be signed.  Common values are ssize_t, int and long.
13920
13921 EOM
13922         rp="What signed type is the same size as $sizetype?"
13923         . ./myread
13924         ssizetype="$ans"
13925 fi
13926 $rm -f ssize ssize.*
13927
13928 : see what type of char stdio uses.
13929 echo " "
13930 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13931         echo "Your stdio uses unsigned chars." >&4
13932         stdchar="unsigned char"
13933 else
13934         echo "Your stdio uses signed chars." >&4
13935         stdchar="char"
13936 fi
13937
13938 : see if time exists
13939 echo " "
13940 if test "X$d_time" = X -o X"$timetype" = X; then
13941     if set time val -f d_time; eval $csym; $val; then
13942                 echo 'time() found.' >&4
13943                 val="$define"
13944                 rp="What is the type returned by time() on this system?"
13945                 set time_t timetype long stdio.h sys/types.h
13946                 eval $typedef_ask
13947     else
13948                 echo 'time() not found, hope that will do.' >&4
13949                 val="$undef"
13950                 timetype='int';
13951     fi
13952     set d_time
13953     eval $setvar
13954 fi
13955
13956 : see what type uids are declared as in the kernel
13957 echo " "
13958 echo "Looking for the type for user ids returned by getuid()."
13959 set uid_t uidtype xxx stdio.h sys/types.h
13960 eval $typedef
13961 case "$uidtype" in
13962 xxx)
13963         xxx=`./findhdr sys/user.h`
13964         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13965         case $1 in
13966         unsigned) dflt="$1 $2" ;;
13967         *) dflt="$1" ;;
13968         esac
13969         ;;
13970 *) dflt="$uidtype";;
13971 esac
13972 case "$uidtype" in
13973 uid_t)  echo "uid_t found." ;;
13974 *)      rp="What is the type for user ids returned by getuid()?"
13975         . ./myread
13976         uidtype="$ans"
13977         ;;
13978 esac
13979
13980 echo " "
13981 case "$uidtype" in
13982 *_t) zzz="$uidtype"     ;;
13983 *)   zzz="uid"          ;;
13984 esac
13985 echo "Checking the size of $zzz..." >&4 
13986 cat > try.c <<EOCP
13987 #include <sys/types.h>
13988 #include <stdio.h>
13989 int main() {
13990     printf("%d\n", (int)sizeof($uidtype));
13991     exit(0);
13992 }
13993 EOCP
13994 set try
13995 if eval $compile_ok; then
13996         yyy=`./try`
13997         case "$yyy" in
13998         '')     uidsize=4
13999                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14000                 ;;
14001         *)      uidsize=$yyy
14002                 echo "Your $zzz is $uidsize bytes long."
14003                 ;;
14004         esac
14005 else
14006         uidsize=4
14007         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14008 fi
14009
14010 echo " "
14011 case "$uidtype" in
14012 *_t) zzz="$uidtype"     ;;
14013 *)   zzz="uid"          ;;
14014 esac
14015 echo "Checking the sign of $zzz..." >&4
14016 cat > try.c <<EOCP
14017 #include <sys/types.h>
14018 #include <stdio.h>
14019 int main() {
14020         $uidtype foo = -1;
14021         if (foo < 0)
14022                 printf("-1\n");
14023         else
14024                 printf("1\n");
14025 }
14026 EOCP
14027 set try
14028 if eval $compile; then
14029         yyy=`./try`
14030         case "$yyy" in
14031         '')     uidsign=1
14032                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14033                 ;;
14034         *)      uidsign=$yyy
14035                 case "$uidsign" in
14036                  1) echo "Your $zzz is unsigned." ;;
14037                 -1) echo "Your $zzz is signed."   ;;
14038                 esac
14039                 ;;
14040         esac
14041 else
14042         uidsign=1
14043         echo "(I can't compile the test program--guessing unsigned.)" >&4
14044 fi
14045
14046
14047
14048 echo " "
14049 $echo "Checking the format string to be used for uids..." >&4
14050
14051 case "$uidsign" in
14052 -1)     if $test X"$uidsize" = X"$ivsize"; then
14053                 uidformat="$ivdformat"
14054         else
14055                 if $test X"$uidsize" = X"$longsize"; then
14056                         uidformat='"ld"'
14057                 else
14058                         if $test X"$uidsize" = X"$intsize"; then
14059                                 uidformat='"d"'
14060                         else
14061                                 if $test X"$uidsize" = X"$shortsize"; then
14062                                         uidformat='"hd"'
14063                                 fi
14064                         fi
14065                 fi
14066         fi
14067         ;;
14068 *)      if $test X"$uidsize" = X"$uvsize"; then
14069                 uidformat="$uvuformat"
14070         else
14071                 if $test X"$uidsize" = X"$longsize"; then
14072                         uidformat='"lu"'
14073                 else
14074                         if $test X"$uidsize" = X"$intsize"; then
14075                                 uidformat='"u"'
14076                         else
14077                                 if $test X"$uidsize" = X"$shortsize"; then
14078                                         uidformat='"hu"'
14079                                 fi
14080                         fi
14081                 fi
14082         fi
14083         ;;
14084 esac
14085
14086 : see if dbm.h is available
14087 : see if dbmclose exists
14088 set dbmclose d_dbmclose
14089 eval $inlibc
14090
14091 case "$d_dbmclose" in
14092 $define)
14093         set dbm.h i_dbm
14094         eval $inhdr
14095         case "$i_dbm" in
14096         $define)
14097                 val="$undef"
14098                 set i_rpcsvcdbm
14099                 eval $setvar
14100                 ;;
14101         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14102                 eval $inhdr
14103                 ;;
14104         esac
14105         ;;
14106 *)      echo "We won't be including <dbm.h>"
14107         val="$undef"
14108         set i_dbm
14109         eval $setvar
14110         val="$undef"
14111         set i_rpcsvcdbm
14112         eval $setvar
14113         ;;
14114 esac
14115
14116 : see if this is a sys/file.h system
14117 val=''
14118 set sys/file.h val
14119 eval $inhdr
14120
14121 : do we need to include sys/file.h ?
14122 case "$val" in
14123 "$define")
14124         echo " "
14125         if $h_sysfile; then
14126                 val="$define"
14127                 echo "We'll be including <sys/file.h>." >&4
14128         else
14129                 val="$undef"
14130                 echo "We won't be including <sys/file.h>." >&4
14131         fi
14132         ;;
14133 *)
14134         h_sysfile=false
14135         ;;
14136 esac
14137 set i_sysfile
14138 eval $setvar
14139
14140 : see if fcntl.h is there
14141 val=''
14142 set fcntl.h val
14143 eval $inhdr
14144
14145 : see if we can include fcntl.h
14146 case "$val" in
14147 "$define")
14148         echo " "
14149         if $h_fcntl; then
14150                 val="$define"
14151                 echo "We'll be including <fcntl.h>." >&4
14152         else
14153                 val="$undef"
14154                 if $h_sysfile; then
14155         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14156                 else
14157                         echo "We won't be including <fcntl.h>." >&4
14158                 fi
14159         fi
14160         ;;
14161 *)
14162         h_fcntl=false
14163         val="$undef"
14164         ;;
14165 esac
14166 set i_fcntl
14167 eval $setvar
14168
14169 : see if this is a iconv.h system
14170 set iconv.h i_iconv
14171 eval $inhdr
14172
14173 : see if this is a ieeefp.h system
14174 set ieeefp.h i_ieeefp
14175 eval $inhdr
14176
14177 : see if locale.h is available
14178 set locale.h i_locale
14179 eval $inhdr
14180
14181 : see if mach cthreads are available
14182 if test "X$usethreads" = "X$define"; then
14183         set mach/cthreads.h i_machcthr
14184         eval $inhdr
14185 else
14186         i_machcthr="$undef"
14187 fi
14188
14189
14190
14191 : see if this is a math.h system
14192 set math.h i_math
14193 eval $inhdr
14194
14195 : see if this is a mntent.h system
14196 set mntent.h i_mntent
14197 eval $inhdr
14198
14199 : see if ndbm.h is available
14200 set ndbm.h t_ndbm
14201 eval $inhdr
14202 case "$t_ndbm" in
14203 $define)
14204         : see if dbm_open exists
14205         set dbm_open d_dbm_open
14206         eval $inlibc
14207         case "$d_dbm_open" in
14208         $undef)
14209                 t_ndbm="$undef"
14210                 echo "We won't be including <ndbm.h>"
14211                 ;;
14212         esac
14213         ;;
14214 esac
14215 val="$t_ndbm"
14216 set i_ndbm
14217 eval $setvar
14218
14219 : see if net/errno.h is available
14220 val=''
14221 set net/errno.h val
14222 eval $inhdr
14223
14224 : Unfortunately, it causes problems on some systems.  Arrgh.
14225 case "$val" in
14226 $define)
14227         cat > try.c <<'EOM'
14228 #include <stdio.h>
14229 #include <errno.h>
14230 #include <net/errno.h>
14231 int func()
14232 {
14233         return ENOTSOCK;
14234 }
14235 EOM
14236         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14237                 echo "We'll be including <net/errno.h>." >&4
14238         else
14239                 echo "We won't be including <net/errno.h>." >&4
14240                 val="$undef"
14241         fi
14242         $rm -f try.* try
14243         ;;
14244 esac
14245 set i_neterrno
14246 eval $setvar
14247
14248 : see if netinet/tcp.h is available
14249 set netinet/tcp.h i_netinettcp
14250 eval $inhdr
14251
14252 : see if this is a poll.h system
14253 set poll.h i_poll
14254 eval $inhdr
14255
14256 echo " "
14257 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14258 $cat <<'EOSH' > Cppsym.know
14259 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14260 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14261 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14262 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14263 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14264 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14265 bull c cadmus clipper CMU COFF COMPILER_VERSION
14266 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14267 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14268 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14269 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14270 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14271 H3050R H3050RX hbullx20 hcx host_mips
14272 hp200 hp300 hp700 HP700 hp800 hp9000
14273 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14274 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14275 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14276 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14277 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14278 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14279 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14280 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14281 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14282 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14283 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14284 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14285 MATH_HAS_NO_SIDE_EFFECTS
14286 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14287 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14288 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14289 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14290 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14291 NetBSD news1500 news1700 news1800 news1900 news3700
14292 news700 news800 news900 NeXT NLS ns16000 ns32000
14293 ns32016 ns32332 ns32k nsc32000
14294 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14295 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14296 pc532 pdp11 PGC PIC plexus PORTAR posix
14297 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14298 POSIX_C_SOURCE POSIX_SOURCE POWER
14299 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14300 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14301 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14302 sony sony_news sonyrisc sparc sparclite spectrum
14303 stardent stdc STDC_EXT stratos sun sun3 sun386
14304 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14305 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14306 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14307 sysV68 sysV88 Tek4132 Tek4300 titan
14308 tower tower32 tower32_200 tower32_600 tower32_700
14309 tower32_800 tower32_850 tss
14310 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14311 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14312 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14313 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14314 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14315 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14316 z8000
14317 EOSH
14318 # Maybe put other stuff here too.
14319 cat <<EOSH >>Cppsym.know
14320 $osname
14321 EOSH
14322 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14323 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14324 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14325 $rm -f Cppsym.a Cppsym.b
14326 cat <<EOSH > Cppsym
14327 $startsh
14328 if $test \$# -gt 0; then
14329     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14330     if $test -s Cppsym.got; then
14331         $rm -f Cppsym.got
14332         exit 0
14333     fi
14334     $rm -f Cppsym.got
14335     exit 1
14336 else
14337     $tr " " "$trnl" | ./Cppsym.try
14338     exit 0
14339 fi
14340 EOSH
14341 chmod +x Cppsym
14342 $eunicefix Cppsym
14343 cat <<EOSH > Cppsym.try
14344 $startsh
14345 cat <<'EOCP' > try.c
14346 #include <stdio.h>
14347 int main() {
14348 EOCP
14349 $awk \\
14350 EOSH
14351 cat <<'EOSH' >> Cppsym.try
14352 'length($1) > 0 {
14353     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14354     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14355     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14356     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
14357 }'       >> try.c
14358 echo '}' >> try.c
14359 EOSH
14360 cat <<EOSH >> Cppsym.try
14361 ccflags="$ccflags"
14362 case "$osname-$gccversion" in
14363 irix-) ccflags="\$ccflags -woff 1178" ;;
14364 esac
14365 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14366 EOSH
14367 chmod +x Cppsym.try
14368 $eunicefix Cppsym.try
14369 ./Cppsym < Cppsym.know > Cppsym.true
14370 : now check the C compiler for additional symbols
14371 postprocess_cc_v=''
14372 case "$osname" in
14373 aix) postprocess_cc_v="|$tr , ' '" ;;
14374 esac
14375 $cat >ccsym <<EOS
14376 $startsh
14377 $cat >tmp.c <<EOF
14378 extern int foo;
14379 EOF
14380 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14381 do
14382         case "\$i" in
14383         -D*) echo "\$i" | $sed 's/^-D//';;
14384         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14385         esac
14386 done
14387 $rm -f try.c
14388 EOS
14389 postprocess_cc_v=''
14390 chmod +x ccsym
14391 $eunicefix ccsym
14392 ./ccsym > ccsym1.raw
14393 if $test -s ccsym1.raw; then
14394        $sort ccsym1.raw | $uniq >ccsym.raw
14395 else
14396        mv ccsym1.raw ccsym.raw
14397 fi
14398
14399 $awk '/\=/ { print $0; next }
14400         { print $0"=1" }' ccsym.raw >ccsym.list
14401 $awk '/\=/ { print $0; next }
14402         { print $0"=1" }' Cppsym.true >ccsym.true
14403 $comm -13 ccsym.true ccsym.list >ccsym.own
14404 $comm -12 ccsym.true ccsym.list >ccsym.com
14405 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14406 also=''
14407 if $test -z ccsym.raw; then
14408         echo "Your C compiler doesn't seem to define any symbols!" >&4
14409         echo " "
14410         echo "However, your C preprocessor defines the following symbols:"
14411         $cat Cppsym.true
14412         ccsymbols=''
14413         cppsymbols=`$cat Cppsym.true`
14414         cppsymbols=`echo $cppsymbols`
14415         cppccsymbols="$cppsymbols"
14416 else
14417         if $test -s ccsym.com; then
14418                 echo "Your C compiler and pre-processor define these symbols:"
14419                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14420                 also='also '
14421                 symbols='ones'
14422                 cppccsymbols=`$cat ccsym.com`
14423                 cppccsymbols=`echo $cppccsymbols`
14424                 $test "$silent" || sleep 1
14425         fi
14426         if $test -s ccsym.cpp; then
14427                 $test "$also" && echo " "
14428                 echo "Your C pre-processor ${also}defines the following symbols:"
14429                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14430                 also='further '
14431                 cppsymbols=`$cat ccsym.cpp`
14432                 cppsymbols=`echo $cppsymbols`
14433                 $test "$silent" || sleep 1
14434         fi
14435         if $test -s ccsym.own; then
14436                 $test "$also" && echo " "
14437                 echo "Your C compiler ${also}defines the following cpp symbols:"
14438                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14439                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14440                 ccsymbols=`$cat ccsym.own`
14441                 ccsymbols=`echo $ccsymbols`
14442                 $test "$silent" || sleep 1
14443         fi
14444 fi
14445 $rm -f ccsym*
14446
14447 : see if this is a termio system
14448 val="$undef"
14449 val2="$undef"
14450 val3="$undef"
14451 if $test `./findhdr termios.h`; then
14452         set tcsetattr i_termios
14453         eval $inlibc
14454         val3="$i_termios"
14455 fi
14456 echo " "
14457 case "$val3" in
14458 "$define") echo "You have POSIX termios.h... good!" >&4;;
14459 *) if ./Cppsym pyr; then
14460                 case "`/bin/universe`" in
14461                 ucb) if $test `./findhdr sgtty.h`; then
14462                                 val2="$define"
14463                                 echo "<sgtty.h> found." >&4
14464                         else
14465                                 echo "System is pyramid with BSD universe."
14466                                 echo "<sgtty.h> not found--you could have problems." >&4
14467                         fi;;
14468                 *) if $test `./findhdr termio.h`; then
14469                                 val="$define"
14470                                 echo "<termio.h> found." >&4
14471                         else
14472                                 echo "System is pyramid with USG universe."
14473                                 echo "<termio.h> not found--you could have problems." >&4
14474                         fi;;
14475                 esac
14476         elif ./usg; then
14477                 if $test `./findhdr termio.h`; then
14478                         echo "<termio.h> found." >&4
14479                         val="$define"
14480                 elif $test `./findhdr sgtty.h`; then
14481                         echo "<sgtty.h> found." >&4
14482                         val2="$define"
14483                 else
14484 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14485                 fi
14486         else
14487                 if $test `./findhdr sgtty.h`; then
14488                         echo "<sgtty.h> found." >&4
14489                         val2="$define"
14490                 elif $test `./findhdr termio.h`; then
14491                         echo "<termio.h> found." >&4
14492                         val="$define"
14493                 else
14494 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14495                 fi
14496         fi;;
14497 esac
14498 set i_termio; eval $setvar
14499 val=$val2; set i_sgtty; eval $setvar
14500 val=$val3; set i_termios; eval $setvar
14501
14502 : see if this is a shadow.h system
14503 set shadow.h i_shadow
14504 eval $inhdr
14505
14506 : see if this is a socks.h system
14507 set socks.h i_socks
14508 eval $inhdr
14509
14510 : see if stdarg is available
14511 echo " "
14512 if $test `./findhdr stdarg.h`; then
14513         echo "<stdarg.h> found." >&4
14514         valstd="$define"
14515 else
14516         echo "<stdarg.h> NOT found." >&4
14517         valstd="$undef"
14518 fi
14519
14520 : see if varags is available
14521 echo " "
14522 if $test `./findhdr varargs.h`; then
14523         echo "<varargs.h> found." >&4
14524 else
14525         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14526 fi
14527
14528 : set up the varargs testing programs
14529 $cat > varargs.c <<EOP
14530 #ifdef I_STDARG
14531 #include <stdarg.h>
14532 #endif
14533 #ifdef I_VARARGS
14534 #include <varargs.h>
14535 #endif
14536
14537 #ifdef I_STDARG
14538 int f(char *p, ...)
14539 #else
14540 int f(va_alist)
14541 va_dcl
14542 #endif
14543 {
14544         va_list ap;
14545 #ifndef I_STDARG
14546         char *p;
14547 #endif
14548 #ifdef I_STDARG
14549         va_start(ap,p);
14550 #else
14551         va_start(ap);
14552         p = va_arg(ap, char *);
14553 #endif
14554         va_end(ap);
14555 }
14556 EOP
14557 $cat > varargs <<EOP
14558 $startsh
14559 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14560         echo "true"
14561 else
14562         echo "false"
14563 fi
14564 $rm -f varargs$_o
14565 EOP
14566 chmod +x varargs
14567
14568 : now check which varargs header should be included
14569 echo " "
14570 i_varhdr=''
14571 case "$valstd" in
14572 "$define")
14573         if `./varargs I_STDARG`; then
14574                 val='stdarg.h'
14575         elif `./varargs I_VARARGS`; then
14576                 val='varargs.h'
14577         fi
14578         ;;
14579 *)
14580         if `./varargs I_VARARGS`; then
14581                 val='varargs.h'
14582         fi
14583         ;;
14584 esac
14585 case "$val" in
14586 '')
14587 echo "I could not find the definition for va_dcl... You have problems..." >&4
14588         val="$undef"; set i_stdarg; eval $setvar
14589         val="$undef"; set i_varargs; eval $setvar
14590         ;;
14591 *) 
14592         set i_varhdr
14593         eval $setvar
14594         case "$i_varhdr" in
14595         stdarg.h)
14596                 val="$define"; set i_stdarg; eval $setvar
14597                 val="$undef"; set i_varargs; eval $setvar
14598                 ;;
14599         varargs.h)
14600                 val="$undef"; set i_stdarg; eval $setvar
14601                 val="$define"; set i_varargs; eval $setvar
14602                 ;;
14603         esac
14604         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14605 esac
14606 $rm -f varargs*
14607
14608 : see if stddef is available
14609 set stddef.h i_stddef
14610 eval $inhdr
14611
14612 : see if this is a sunmath.h system
14613 set sunmath.h i_sunmath
14614 eval $inhdr
14615
14616 : see if sys/access.h is available
14617 set sys/access.h i_sysaccess
14618 eval $inhdr
14619
14620 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14621 set sys/filio.h i_sysfilio
14622 eval $inhdr
14623 echo " "
14624 if $test `./findhdr sys/ioctl.h`; then
14625         val="$define"
14626         echo '<sys/ioctl.h> found.' >&4
14627 else
14628         val="$undef"
14629         if $test $i_sysfilio = "$define"; then
14630             echo '<sys/ioctl.h> NOT found.' >&4
14631         else
14632                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14633                 $test $i_termio = "$define" && xxx="termio.h"
14634                 $test $i_termios = "$define" && xxx="termios.h"
14635 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14636         fi
14637 fi
14638 set i_sysioctl
14639 eval $setvar
14640
14641
14642 : see if this is a syslog.h system
14643 set syslog.h i_syslog
14644 eval $inhdr
14645
14646
14647 : see if this is a sys/mode.h system
14648 set sys/mode.h i_sysmode
14649 eval $inhdr
14650
14651 : see if sys/resource.h has to be included
14652 set sys/resource.h i_sysresrc
14653 eval $inhdr
14654
14655 : see if sys/security.h is available
14656 set sys/security.h i_syssecrt
14657 eval $inhdr
14658
14659 : see if this is a sys/statvfs.h system
14660 set sys/statvfs.h i_sysstatvfs
14661 eval $inhdr
14662
14663 : see if this is a sys/uio.h system
14664 set sys/uio.h i_sysuio
14665 eval $inhdr
14666
14667 : see if this is a sys/un.h system
14668 set sys/un.h i_sysun
14669 eval $inhdr
14670
14671
14672 : see if this is a sys/utsname.h system
14673 set sys/utsname.h i_sysutsname
14674 eval $inhdr
14675
14676 : see if this is a syswait system
14677 set sys/wait.h i_syswait
14678 eval $inhdr
14679
14680 : see if this is a ustat.h system
14681 set ustat.h i_ustat
14682 eval $inhdr
14683
14684 : see if this is an utime system
14685 set utime.h i_utime
14686 eval $inhdr
14687
14688 : see if this is a values.h system
14689 set values.h i_values
14690 eval $inhdr
14691
14692 : see if this is a vfork system
14693 case "$d_vfork" in
14694 "$define")
14695         set vfork.h i_vfork
14696         eval $inhdr
14697         ;;
14698 *)
14699         i_vfork="$undef"
14700         ;;
14701 esac
14702
14703 : see if gdbm.h is available
14704 set gdbm.h t_gdbm
14705 eval $inhdr
14706 case "$t_gdbm" in
14707 $define)
14708         : see if gdbm_open exists
14709         set gdbm_open d_gdbm_open
14710         eval $inlibc
14711         case "$d_gdbm_open" in
14712         $undef)
14713                 t_gdbm="$undef"
14714                 echo "We won't be including <gdbm.h>"
14715                 ;;
14716         esac
14717         ;;
14718 esac
14719 val="$t_gdbm"
14720 set i_gdbm
14721 eval $setvar
14722
14723 echo " "
14724 echo "Looking for extensions..." >&4
14725 : If we are using the old config.sh, known_extensions may contain
14726 : old or inaccurate or duplicate values.
14727 known_extensions=''
14728 nonxs_extensions=''
14729 : We do not use find because it might not be available.
14730 : We do not just use MANIFEST because the user may have dropped
14731 : some additional extensions into the source tree and expect them
14732 : to be built.
14733
14734 : Function to recursively find available extensions, ignoring DynaLoader
14735 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14736 find_extensions='
14737     for xxx in *; do
14738        case "$xxx" in
14739            DynaLoader|dynaload) ;;
14740            *)
14741            if $test -f $xxx/$xxx.xs; then
14742                known_extensions="$known_extensions $1$xxx";
14743            elif $test -f $xxx/Makefile.PL; then
14744                nonxs_extensions="$nonxs_extensions $1$xxx";
14745            else
14746                if $test -d $xxx -a $# -lt 10; then
14747                    set $1$xxx/ $*;
14748                    cd $xxx;
14749                    eval $find_extensions;
14750                    cd ..;
14751                    shift;
14752                fi;
14753            fi
14754            ;;
14755        esac;
14756     done'
14757 tdir=`pwd`
14758 cd $rsrc/ext
14759 set X
14760 shift
14761 eval $find_extensions
14762 set X $nonxs_extensions
14763 shift
14764 nonxs_extensions="$*"
14765 set X $known_extensions
14766 shift
14767 known_extensions="$*"
14768 cd $tdir
14769
14770 : Now see which are supported on this system.
14771 avail_ext=''
14772 for xxx in $known_extensions ; do
14773         case "$xxx" in
14774         DB_File|db_file)
14775                 case "$i_db" in
14776                 $define) avail_ext="$avail_ext $xxx" ;;
14777                 esac
14778                 ;;
14779         GDBM_File|gdbm_fil)
14780                 case "$i_gdbm" in 
14781                 $define) avail_ext="$avail_ext $xxx" ;;
14782                 esac
14783                 ;;
14784         NDBM_File|ndbm_fil)
14785                 case "$i_ndbm" in
14786                 $define)
14787                     case "$osname-$use64bitint" in
14788                     hpux-define)
14789                         case "$libs" in
14790                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14791                         esac
14792                         ;;
14793                     *) avail_ext="$avail_ext $xxx" ;;
14794                     esac
14795                     ;;
14796                 esac
14797                 ;;
14798         ODBM_File|odbm_fil) 
14799                 case "${i_dbm}${i_rpcsvcdbm}" in
14800                 *"${define}"*)
14801                     case "$osname-$use64bitint" in
14802                     hpux-define)
14803                         case "$libs" in
14804                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14805                         esac
14806                         ;;
14807                     *) avail_ext="$avail_ext $xxx" ;;
14808                     esac
14809                     ;;
14810                 esac
14811                 ;;
14812         POSIX|posix)
14813                 case "$useposix" in
14814                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14815                 esac
14816                 ;;
14817         Opcode|opcode)
14818                 case "$useopcode" in
14819                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14820                 esac
14821                 ;;
14822         Socket|socket)
14823                 case "$d_socket" in 
14824                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14825                 esac
14826                 ;;
14827         Thread|thread)
14828                 case "$usethreads" in 
14829                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14830                 esac
14831                 ;;
14832         IPC/SysV|ipc/sysv)
14833                 : XXX Do we need a useipcsysv variable here
14834                 case "${d_msg}${d_sem}${d_shm}" in 
14835                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14836                 esac
14837                 ;;
14838         *)      avail_ext="$avail_ext $xxx"
14839                 ;;
14840         esac
14841 done
14842
14843 set X $avail_ext
14844 shift
14845 avail_ext="$*"
14846
14847 : Now see which nonxs extensions are supported on this system.
14848 : For now assume all are.
14849 nonxs_ext=''
14850 for xxx in $nonxs_extensions ; do
14851         case "$xxx" in
14852         *)      nonxs_ext="$nonxs_ext $xxx"
14853                 ;;
14854         esac
14855 done
14856
14857 set X $nonxs_ext
14858 shift
14859 nonxs_ext="$*"
14860
14861 case $usedl in
14862 $define)
14863         $cat <<EOM
14864 A number of extensions are supplied with $package.  You may choose to
14865 compile these extensions for dynamic loading (the default), compile
14866 them into the $package executable (static loading), or not include
14867 them at all.  Answer "none" to include no extensions.
14868 Note that DynaLoader is always built and need not be mentioned here.
14869
14870 EOM
14871         case "$dynamic_ext" in
14872         '') dflt="$avail_ext" ;;
14873         *)      dflt="$dynamic_ext"
14874                 # Perhaps we are reusing an old out-of-date config.sh.
14875                 case "$hint" in
14876                 previous)
14877                         if test X"$dynamic_ext" != X"$avail_ext"; then
14878                                 $cat <<EOM
14879 NOTICE:  Your previous config.sh list may be incorrect. 
14880 The extensions now available to you are 
14881         ${avail_ext}
14882 but the default list from your previous config.sh is
14883         ${dynamic_ext} 
14884
14885 EOM
14886                         fi
14887                         ;;
14888                 esac
14889                 ;;
14890         esac
14891         case "$dflt" in
14892         '')     dflt=none;;
14893         esac
14894         rp="What extensions do you wish to load dynamically?"
14895         . ./myread
14896         case "$ans" in
14897         none) dynamic_ext=' ' ;;
14898         *) dynamic_ext="$ans" ;;
14899         esac
14900
14901         case "$static_ext" in
14902         '')
14903                 : Exclude those already listed in dynamic linking
14904                 dflt=''
14905                 for xxx in $avail_ext; do
14906                         case " $dynamic_ext " in
14907                         *" $xxx "*) ;;
14908                         *) dflt="$dflt $xxx" ;;
14909                         esac
14910                 done
14911                 set X $dflt
14912                 shift
14913                 dflt="$*"
14914                 ;;
14915         *)  dflt="$static_ext" 
14916                 ;;
14917         esac
14918
14919         case "$dflt" in
14920         '')     dflt=none;;
14921         esac
14922         rp="What extensions do you wish to load statically?"
14923         . ./myread
14924         case "$ans" in
14925         none) static_ext=' ' ;;
14926         *) static_ext="$ans" ;;
14927         esac
14928         ;;
14929 *)
14930         $cat <<EOM
14931 A number of extensions are supplied with $package.  Answer "none" 
14932 to include no extensions. 
14933 Note that DynaLoader is always built and need not be mentioned here.
14934
14935 EOM
14936         case "$static_ext" in
14937         '') dflt="$avail_ext" ;;
14938         *)      dflt="$static_ext"
14939                 # Perhaps we are reusing an old out-of-date config.sh.
14940                 case "$hint" in
14941                 previous)
14942                         if test X"$static_ext" != X"$avail_ext"; then
14943                                 $cat <<EOM
14944 NOTICE:  Your previous config.sh list may be incorrect. 
14945 The extensions now available to you are 
14946         ${avail_ext}
14947 but the default list from your previous config.sh is
14948         ${static_ext} 
14949
14950 EOM
14951                         fi
14952                         ;;
14953                 esac
14954                 ;;
14955         esac
14956         : Exclude those that are not xs extensions
14957         case "$dflt" in
14958         '')     dflt=none;;
14959         esac
14960         rp="What extensions do you wish to include?"
14961         . ./myread
14962         case "$ans" in
14963         none) static_ext=' ' ;;
14964         *) static_ext="$ans" ;;
14965         esac
14966         ;;
14967 esac
14968
14969 set X $dynamic_ext $static_ext $nonxs_ext
14970 shift
14971 extensions="$*"
14972
14973 : Remove build directory name from cppstdin so it can be used from
14974 : either the present location or the final installed location.
14975 echo " "
14976 : Get out of the UU directory to get correct path name.
14977 cd ..
14978 case "$cppstdin" in
14979 `pwd`/cppstdin)
14980         echo "Stripping down cppstdin path name"
14981         cppstdin=cppstdin
14982         ;;
14983 esac
14984 cd UU
14985
14986 : end of configuration questions
14987 echo " "
14988 echo "End of configuration questions."
14989 echo " "
14990
14991 : back to where it started
14992 if test -d ../UU; then
14993         cd ..
14994 fi
14995
14996 : configuration may be patched via a 'config.over' file
14997 if $test -f config.over; then
14998         echo " "
14999         dflt=y
15000         rp='I see a config.over file.  Do you wish to load it?'
15001         . UU/myread
15002         case "$ans" in
15003         n*) echo "OK, I'll ignore it.";;
15004         *)      . ./config.over
15005                 echo "Configuration override changes have been loaded."
15006                 ;;
15007         esac
15008 fi
15009
15010 : in case they want portability, strip down executable paths
15011 case "$d_portable" in
15012 "$define")
15013         echo " "
15014         echo "Stripping down executable paths..." >&4
15015         for file in $loclist $trylist; do
15016                 eval temp=\$$file
15017                 eval $file=`basename $temp`
15018         done
15019         ;;
15020 esac
15021
15022 : create config.sh file
15023 echo " "
15024 echo "Creating config.sh..." >&4
15025 $spitshell <<EOT >config.sh
15026 $startsh
15027 #
15028 # This file was produced by running the Configure script. It holds all the
15029 # definitions figured out by Configure. Should you modify one of these values,
15030 # do not forget to propagate your changes by running "Configure -der". You may
15031 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15032 #
15033
15034 # Package name      : $package
15035 # Source directory  : $src
15036 # Configuration time: $cf_time
15037 # Configured by     : $cf_by
15038 # Target system     : $myuname
15039
15040 Author='$Author'
15041 Date='$Date'
15042 Header='$Header'
15043 Id='$Id'
15044 Locker='$Locker'
15045 Log='$Log'
15046 Mcc='$Mcc'
15047 RCSfile='$RCSfile'
15048 Revision='$Revision'
15049 Source='$Source'
15050 State='$State'
15051 _a='$_a'
15052 _exe='$_exe'
15053 _o='$_o'
15054 afs='$afs'
15055 alignbytes='$alignbytes'
15056 ansi2knr='$ansi2knr'
15057 aphostname='$aphostname'
15058 api_revision='$api_revision'
15059 api_subversion='$api_subversion'
15060 api_version='$api_version'
15061 api_versionstring='$api_versionstring'
15062 ar='$ar'
15063 archlib='$archlib'
15064 archlibexp='$archlibexp'
15065 archname64='$archname64'
15066 archname='$archname'
15067 archobjs='$archobjs'
15068 awk='$awk'
15069 baserev='$baserev'
15070 bash='$bash'
15071 bin='$bin'
15072 bincompat5005='$bincompat5005'
15073 binexp='$binexp'
15074 bison='$bison'
15075 byacc='$byacc'
15076 byteorder='$byteorder'
15077 c='$c'
15078 castflags='$castflags'
15079 cat='$cat'
15080 cc='$cc'
15081 cccdlflags='$cccdlflags'
15082 ccdlflags='$ccdlflags'
15083 ccflags='$ccflags'
15084 ccsymbols='$ccsymbols'
15085 cf_by='$cf_by'
15086 cf_email='$cf_email'
15087 cf_time='$cf_time'
15088 charsize='$charsize'
15089 chgrp='$chgrp'
15090 chmod='$chmod'
15091 chown='$chown'
15092 clocktype='$clocktype'
15093 comm='$comm'
15094 compress='$compress'
15095 contains='$contains'
15096 cp='$cp'
15097 cpio='$cpio'
15098 cpp='$cpp'
15099 cpp_stuff='$cpp_stuff'
15100 cppccsymbols='$cppccsymbols'
15101 cppflags='$cppflags'
15102 cpplast='$cpplast'
15103 cppminus='$cppminus'
15104 cpprun='$cpprun'
15105 cppstdin='$cppstdin'
15106 cppsymbols='$cppsymbols'
15107 crosscompile='$crosscompile'
15108 cryptlib='$cryptlib'
15109 csh='$csh'
15110 d_Gconvert='$d_Gconvert'
15111 d_PRIEldbl='$d_PRIEldbl'
15112 d_PRIFldbl='$d_PRIFldbl'
15113 d_PRIGldbl='$d_PRIGldbl'
15114 d_PRIX64='$d_PRIX64'
15115 d_PRId64='$d_PRId64'
15116 d_PRIeldbl='$d_PRIeldbl'
15117 d_PRIfldbl='$d_PRIfldbl'
15118 d_PRIgldbl='$d_PRIgldbl'
15119 d_PRIi64='$d_PRIi64'
15120 d_PRIo64='$d_PRIo64'
15121 d_PRIu64='$d_PRIu64'
15122 d_PRIx64='$d_PRIx64'
15123 d_access='$d_access'
15124 d_accessx='$d_accessx'
15125 d_alarm='$d_alarm'
15126 d_archlib='$d_archlib'
15127 d_atolf='$d_atolf'
15128 d_atoll='$d_atoll'
15129 d_attribut='$d_attribut'
15130 d_bcmp='$d_bcmp'
15131 d_bcopy='$d_bcopy'
15132 d_bincompat5005='$d_bincompat5005'
15133 d_bsd='$d_bsd'
15134 d_bsdgetpgrp='$d_bsdgetpgrp'
15135 d_bsdsetpgrp='$d_bsdsetpgrp'
15136 d_bzero='$d_bzero'
15137 d_casti32='$d_casti32'
15138 d_castneg='$d_castneg'
15139 d_charvspr='$d_charvspr'
15140 d_chown='$d_chown'
15141 d_chroot='$d_chroot'
15142 d_chsize='$d_chsize'
15143 d_closedir='$d_closedir'
15144 d_const='$d_const'
15145 d_crypt='$d_crypt'
15146 d_csh='$d_csh'
15147 d_cuserid='$d_cuserid'
15148 d_dbl_dig='$d_dbl_dig'
15149 d_difftime='$d_difftime'
15150 d_dirnamlen='$d_dirnamlen'
15151 d_dlerror='$d_dlerror'
15152 d_dlopen='$d_dlopen'
15153 d_dlsymun='$d_dlsymun'
15154 d_dosuid='$d_dosuid'
15155 d_drand48proto='$d_drand48proto'
15156 d_dup2='$d_dup2'
15157 d_eaccess='$d_eaccess'
15158 d_endgrent='$d_endgrent'
15159 d_endhent='$d_endhent'
15160 d_endnent='$d_endnent'
15161 d_endpent='$d_endpent'
15162 d_endpwent='$d_endpwent'
15163 d_endsent='$d_endsent'
15164 d_endspent='$d_endspent'
15165 d_eofnblk='$d_eofnblk'
15166 d_eunice='$d_eunice'
15167 d_fchmod='$d_fchmod'
15168 d_fchown='$d_fchown'
15169 d_fcntl='$d_fcntl'
15170 d_fd_macros='$d_fd_macros'
15171 d_fd_set='$d_fd_set'
15172 d_fds_bits='$d_fds_bits'
15173 d_fgetpos='$d_fgetpos'
15174 d_flexfnam='$d_flexfnam'
15175 d_flock='$d_flock'
15176 d_fork='$d_fork'
15177 d_fpathconf='$d_fpathconf'
15178 d_fpos64_t='$d_fpos64_t'
15179 d_fs_data_s='$d_fs_data_s'
15180 d_fseeko='$d_fseeko'
15181 d_fsetpos='$d_fsetpos'
15182 d_fstatfs='$d_fstatfs'
15183 d_fstatvfs='$d_fstatvfs'
15184 d_ftello='$d_ftello'
15185 d_ftime='$d_ftime'
15186 d_getcwd='$d_getcwd'
15187 d_getfsstat='$d_getfsstat'
15188 d_getgrent='$d_getgrent'
15189 d_getgrps='$d_getgrps'
15190 d_gethbyaddr='$d_gethbyaddr'
15191 d_gethbyname='$d_gethbyname'
15192 d_gethent='$d_gethent'
15193 d_gethname='$d_gethname'
15194 d_gethostprotos='$d_gethostprotos'
15195 d_getlogin='$d_getlogin'
15196 d_getmnt='$d_getmnt'
15197 d_getmntent='$d_getmntent'
15198 d_getnbyaddr='$d_getnbyaddr'
15199 d_getnbyname='$d_getnbyname'
15200 d_getnent='$d_getnent'
15201 d_getnetprotos='$d_getnetprotos'
15202 d_getpbyname='$d_getpbyname'
15203 d_getpbynumber='$d_getpbynumber'
15204 d_getpent='$d_getpent'
15205 d_getpgid='$d_getpgid'
15206 d_getpgrp2='$d_getpgrp2'
15207 d_getpgrp='$d_getpgrp'
15208 d_getppid='$d_getppid'
15209 d_getprior='$d_getprior'
15210 d_getprotoprotos='$d_getprotoprotos'
15211 d_getpwent='$d_getpwent'
15212 d_getsbyname='$d_getsbyname'
15213 d_getsbyport='$d_getsbyport'
15214 d_getsent='$d_getsent'
15215 d_getservprotos='$d_getservprotos'
15216 d_getspent='$d_getspent'
15217 d_getspnam='$d_getspnam'
15218 d_gettimeod='$d_gettimeod'
15219 d_gnulibc='$d_gnulibc'
15220 d_grpasswd='$d_grpasswd'
15221 d_hasmntopt='$d_hasmntopt'
15222 d_htonl='$d_htonl'
15223 d_iconv='$d_iconv'
15224 d_index='$d_index'
15225 d_inetaton='$d_inetaton'
15226 d_int64_t='$d_int64_t'
15227 d_isascii='$d_isascii'
15228 d_killpg='$d_killpg'
15229 d_lchown='$d_lchown'
15230 d_ldbl_dig='$d_ldbl_dig'
15231 d_link='$d_link'
15232 d_locconv='$d_locconv'
15233 d_lockf='$d_lockf'
15234 d_longdbl='$d_longdbl'
15235 d_longlong='$d_longlong'
15236 d_lseekproto='$d_lseekproto'
15237 d_lstat='$d_lstat'
15238 d_madvise='$d_madvise'
15239 d_mblen='$d_mblen'
15240 d_mbstowcs='$d_mbstowcs'
15241 d_mbtowc='$d_mbtowc'
15242 d_memchr='$d_memchr'
15243 d_memcmp='$d_memcmp'
15244 d_memcpy='$d_memcpy'
15245 d_memmove='$d_memmove'
15246 d_memset='$d_memset'
15247 d_mkdir='$d_mkdir'
15248 d_mkdtemp='$d_mkdtemp'
15249 d_mkfifo='$d_mkfifo'
15250 d_mkstemp='$d_mkstemp'
15251 d_mkstemps='$d_mkstemps'
15252 d_mktime='$d_mktime'
15253 d_mmap='$d_mmap'
15254 d_mprotect='$d_mprotect'
15255 d_msg='$d_msg'
15256 d_msg_ctrunc='$d_msg_ctrunc'
15257 d_msg_dontroute='$d_msg_dontroute'
15258 d_msg_oob='$d_msg_oob'
15259 d_msg_peek='$d_msg_peek'
15260 d_msg_proxy='$d_msg_proxy'
15261 d_msgctl='$d_msgctl'
15262 d_msgget='$d_msgget'
15263 d_msgrcv='$d_msgrcv'
15264 d_msgsnd='$d_msgsnd'
15265 d_msync='$d_msync'
15266 d_munmap='$d_munmap'
15267 d_mymalloc='$d_mymalloc'
15268 d_nice='$d_nice'
15269 d_nv_preserves_uv='$d_nv_preserves_uv'
15270 d_off64_t='$d_off64_t'
15271 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15272 d_oldpthreads='$d_oldpthreads'
15273 d_oldsock='$d_oldsock'
15274 d_open3='$d_open3'
15275 d_pathconf='$d_pathconf'
15276 d_pause='$d_pause'
15277 d_phostname='$d_phostname'
15278 d_pipe='$d_pipe'
15279 d_poll='$d_poll'
15280 d_portable='$d_portable'
15281 d_pthread_yield='$d_pthread_yield'
15282 d_pwage='$d_pwage'
15283 d_pwchange='$d_pwchange'
15284 d_pwclass='$d_pwclass'
15285 d_pwcomment='$d_pwcomment'
15286 d_pwexpire='$d_pwexpire'
15287 d_pwgecos='$d_pwgecos'
15288 d_pwpasswd='$d_pwpasswd'
15289 d_pwquota='$d_pwquota'
15290 d_qgcvt='$d_qgcvt'
15291 d_quad='$d_quad'
15292 d_readdir='$d_readdir'
15293 d_readlink='$d_readlink'
15294 d_rename='$d_rename'
15295 d_rewinddir='$d_rewinddir'
15296 d_rmdir='$d_rmdir'
15297 d_safebcpy='$d_safebcpy'
15298 d_safemcpy='$d_safemcpy'
15299 d_sanemcmp='$d_sanemcmp'
15300 d_sched_yield='$d_sched_yield'
15301 d_scm_rights='$d_scm_rights'
15302 d_seekdir='$d_seekdir'
15303 d_select='$d_select'
15304 d_sem='$d_sem'
15305 d_semctl='$d_semctl'
15306 d_semctl_semid_ds='$d_semctl_semid_ds'
15307 d_semctl_semun='$d_semctl_semun'
15308 d_semget='$d_semget'
15309 d_semop='$d_semop'
15310 d_setegid='$d_setegid'
15311 d_seteuid='$d_seteuid'
15312 d_setgrent='$d_setgrent'
15313 d_setgrps='$d_setgrps'
15314 d_sethent='$d_sethent'
15315 d_setlinebuf='$d_setlinebuf'
15316 d_setlocale='$d_setlocale'
15317 d_setnent='$d_setnent'
15318 d_setpent='$d_setpent'
15319 d_setpgid='$d_setpgid'
15320 d_setpgrp2='$d_setpgrp2'
15321 d_setpgrp='$d_setpgrp'
15322 d_setprior='$d_setprior'
15323 d_setpwent='$d_setpwent'
15324 d_setregid='$d_setregid'
15325 d_setresgid='$d_setresgid'
15326 d_setresuid='$d_setresuid'
15327 d_setreuid='$d_setreuid'
15328 d_setrgid='$d_setrgid'
15329 d_setruid='$d_setruid'
15330 d_setsent='$d_setsent'
15331 d_setsid='$d_setsid'
15332 d_setspent='$d_setspent'
15333 d_setvbuf='$d_setvbuf'
15334 d_sfio='$d_sfio'
15335 d_shm='$d_shm'
15336 d_shmat='$d_shmat'
15337 d_shmatprototype='$d_shmatprototype'
15338 d_shmctl='$d_shmctl'
15339 d_shmdt='$d_shmdt'
15340 d_shmget='$d_shmget'
15341 d_sigaction='$d_sigaction'
15342 d_sigsetjmp='$d_sigsetjmp'
15343 d_socket='$d_socket'
15344 d_socklen_t='$d_socklen_t'
15345 d_sockpair='$d_sockpair'
15346 d_sqrtl='$d_sqrtl'
15347 d_statblks='$d_statblks'
15348 d_statfs_f_flags='$d_statfs_f_flags'
15349 d_statfs_s='$d_statfs_s'
15350 d_statvfs='$d_statvfs'
15351 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15352 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15353 d_stdio_stream_array='$d_stdio_stream_array'
15354 d_stdiobase='$d_stdiobase'
15355 d_stdstdio='$d_stdstdio'
15356 d_strchr='$d_strchr'
15357 d_strcoll='$d_strcoll'
15358 d_strctcpy='$d_strctcpy'
15359 d_strerrm='$d_strerrm'
15360 d_strerror='$d_strerror'
15361 d_strtod='$d_strtod'
15362 d_strtol='$d_strtol'
15363 d_strtold='$d_strtold'
15364 d_strtoll='$d_strtoll'
15365 d_strtoul='$d_strtoul'
15366 d_strtoull='$d_strtoull'
15367 d_strtouq='$d_strtouq'
15368 d_strxfrm='$d_strxfrm'
15369 d_suidsafe='$d_suidsafe'
15370 d_symlink='$d_symlink'
15371 d_syscall='$d_syscall'
15372 d_sysconf='$d_sysconf'
15373 d_sysernlst='$d_sysernlst'
15374 d_syserrlst='$d_syserrlst'
15375 d_system='$d_system'
15376 d_tcgetpgrp='$d_tcgetpgrp'
15377 d_tcsetpgrp='$d_tcsetpgrp'
15378 d_telldir='$d_telldir'
15379 d_telldirproto='$d_telldirproto'
15380 d_time='$d_time'
15381 d_times='$d_times'
15382 d_truncate='$d_truncate'
15383 d_tzname='$d_tzname'
15384 d_umask='$d_umask'
15385 d_uname='$d_uname'
15386 d_union_semun='$d_union_semun'
15387 d_ustat='$d_ustat'
15388 d_vendorarch='$d_vendorarch'
15389 d_vendorbin='$d_vendorbin'
15390 d_vendorlib='$d_vendorlib'
15391 d_vfork='$d_vfork'
15392 d_void_closedir='$d_void_closedir'
15393 d_voidsig='$d_voidsig'
15394 d_voidtty='$d_voidtty'
15395 d_volatile='$d_volatile'
15396 d_vprintf='$d_vprintf'
15397 d_wait4='$d_wait4'
15398 d_waitpid='$d_waitpid'
15399 d_wcstombs='$d_wcstombs'
15400 d_wctomb='$d_wctomb'
15401 d_xenix='$d_xenix'
15402 date='$date'
15403 db_hashtype='$db_hashtype'
15404 db_prefixtype='$db_prefixtype'
15405 defvoidused='$defvoidused'
15406 direntrytype='$direntrytype'
15407 dlext='$dlext'
15408 dlsrc='$dlsrc'
15409 doublesize='$doublesize'
15410 drand01='$drand01'
15411 dynamic_ext='$dynamic_ext'
15412 eagain='$eagain'
15413 ebcdic='$ebcdic'
15414 echo='$echo'
15415 egrep='$egrep'
15416 emacs='$emacs'
15417 eunicefix='$eunicefix'
15418 exe_ext='$exe_ext'
15419 expr='$expr'
15420 extensions='$extensions'
15421 fflushNULL='$fflushNULL'
15422 fflushall='$fflushall'
15423 find='$find'
15424 firstmakefile='$firstmakefile'
15425 flex='$flex'
15426 fpossize='$fpossize'
15427 fpostype='$fpostype'
15428 freetype='$freetype'
15429 full_ar='$full_ar'
15430 full_csh='$full_csh'
15431 full_sed='$full_sed'
15432 gccversion='$gccversion'
15433 gidformat='$gidformat'
15434 gidsign='$gidsign'
15435 gidsize='$gidsize'
15436 gidtype='$gidtype'
15437 glibpth='$glibpth'
15438 grep='$grep'
15439 groupcat='$groupcat'
15440 groupstype='$groupstype'
15441 gzip='$gzip'
15442 h_fcntl='$h_fcntl'
15443 h_sysfile='$h_sysfile'
15444 hint='$hint'
15445 hostcat='$hostcat'
15446 huge='$huge'
15447 i16size='$i16size'
15448 i16type='$i16type'
15449 i32size='$i32size'
15450 i32type='$i32type'
15451 i64size='$i64size'
15452 i64type='$i64type'
15453 i8size='$i8size'
15454 i8type='$i8type'
15455 i_arpainet='$i_arpainet'
15456 i_bsdioctl='$i_bsdioctl'
15457 i_db='$i_db'
15458 i_dbm='$i_dbm'
15459 i_dirent='$i_dirent'
15460 i_dld='$i_dld'
15461 i_dlfcn='$i_dlfcn'
15462 i_fcntl='$i_fcntl'
15463 i_float='$i_float'
15464 i_gdbm='$i_gdbm'
15465 i_grp='$i_grp'
15466 i_iconv='$i_iconv'
15467 i_ieeefp='$i_ieeefp'
15468 i_inttypes='$i_inttypes'
15469 i_limits='$i_limits'
15470 i_locale='$i_locale'
15471 i_machcthr='$i_machcthr'
15472 i_malloc='$i_malloc'
15473 i_math='$i_math'
15474 i_memory='$i_memory'
15475 i_mntent='$i_mntent'
15476 i_ndbm='$i_ndbm'
15477 i_netdb='$i_netdb'
15478 i_neterrno='$i_neterrno'
15479 i_netinettcp='$i_netinettcp'
15480 i_niin='$i_niin'
15481 i_poll='$i_poll'
15482 i_pthread='$i_pthread'
15483 i_pwd='$i_pwd'
15484 i_rpcsvcdbm='$i_rpcsvcdbm'
15485 i_sfio='$i_sfio'
15486 i_sgtty='$i_sgtty'
15487 i_shadow='$i_shadow'
15488 i_socks='$i_socks'
15489 i_stdarg='$i_stdarg'
15490 i_stddef='$i_stddef'
15491 i_stdlib='$i_stdlib'
15492 i_string='$i_string'
15493 i_sunmath='$i_sunmath'
15494 i_sysaccess='$i_sysaccess'
15495 i_sysdir='$i_sysdir'
15496 i_sysfile='$i_sysfile'
15497 i_sysfilio='$i_sysfilio'
15498 i_sysin='$i_sysin'
15499 i_sysioctl='$i_sysioctl'
15500 i_syslog='$i_syslog'
15501 i_sysmman='$i_sysmman'
15502 i_sysmode='$i_sysmode'
15503 i_sysmount='$i_sysmount'
15504 i_sysndir='$i_sysndir'
15505 i_sysparam='$i_sysparam'
15506 i_sysresrc='$i_sysresrc'
15507 i_syssecrt='$i_syssecrt'
15508 i_sysselct='$i_sysselct'
15509 i_syssockio='$i_syssockio'
15510 i_sysstat='$i_sysstat'
15511 i_sysstatfs='$i_sysstatfs'
15512 i_sysstatvfs='$i_sysstatvfs'
15513 i_systime='$i_systime'
15514 i_systimek='$i_systimek'
15515 i_systimes='$i_systimes'
15516 i_systypes='$i_systypes'
15517 i_sysuio='$i_sysuio'
15518 i_sysun='$i_sysun'
15519 i_sysutsname='$i_sysutsname'
15520 i_sysvfs='$i_sysvfs'
15521 i_syswait='$i_syswait'
15522 i_termio='$i_termio'
15523 i_termios='$i_termios'
15524 i_time='$i_time'
15525 i_unistd='$i_unistd'
15526 i_ustat='$i_ustat'
15527 i_utime='$i_utime'
15528 i_values='$i_values'
15529 i_varargs='$i_varargs'
15530 i_varhdr='$i_varhdr'
15531 i_vfork='$i_vfork'
15532 ignore_versioned_solibs='$ignore_versioned_solibs'
15533 inc_version_list='$inc_version_list'
15534 inc_version_list_init='$inc_version_list_init'
15535 incpath='$incpath'
15536 inews='$inews'
15537 installarchlib='$installarchlib'
15538 installbin='$installbin'
15539 installman1dir='$installman1dir'
15540 installman3dir='$installman3dir'
15541 installprefix='$installprefix'
15542 installprefixexp='$installprefixexp'
15543 installprivlib='$installprivlib'
15544 installscript='$installscript'
15545 installsitearch='$installsitearch'
15546 installsitebin='$installsitebin'
15547 installsitelib='$installsitelib'
15548 installstyle='$installstyle'
15549 installusrbinperl='$installusrbinperl'
15550 installvendorarch='$installvendorarch'
15551 installvendorbin='$installvendorbin'
15552 installvendorlib='$installvendorlib'
15553 intsize='$intsize'
15554 ivdformat='$ivdformat'
15555 ivsize='$ivsize'
15556 ivtype='$ivtype'
15557 known_extensions='$known_extensions'
15558 ksh='$ksh'
15559 large='$large'
15560 ld='$ld'
15561 lddlflags='$lddlflags'
15562 ldflags='$ldflags'
15563 ldlibpthname='$ldlibpthname'
15564 less='$less'
15565 lib_ext='$lib_ext'
15566 libc='$libc'
15567 libperl='$libperl'
15568 libpth='$libpth'
15569 libs='$libs'
15570 libsdirs='$libsdirs'
15571 libsfiles='$libsfiles'
15572 libsfound='$libsfound'
15573 libspath='$libspath'
15574 libswanted='$libswanted'
15575 line='$line'
15576 lint='$lint'
15577 lkflags='$lkflags'
15578 ln='$ln'
15579 lns='$lns'
15580 locincpth='$locincpth'
15581 loclibpth='$loclibpth'
15582 longdblsize='$longdblsize'
15583 longlongsize='$longlongsize'
15584 longsize='$longsize'
15585 lp='$lp'
15586 lpr='$lpr'
15587 ls='$ls'
15588 lseeksize='$lseeksize'
15589 lseektype='$lseektype'
15590 mail='$mail'
15591 mailx='$mailx'
15592 make='$make'
15593 make_set_make='$make_set_make'
15594 mallocobj='$mallocobj'
15595 mallocsrc='$mallocsrc'
15596 malloctype='$malloctype'
15597 man1dir='$man1dir'
15598 man1direxp='$man1direxp'
15599 man1ext='$man1ext'
15600 man3dir='$man3dir'
15601 man3direxp='$man3direxp'
15602 man3ext='$man3ext'
15603 medium='$medium'
15604 mips_type='$mips_type'
15605 mkdir='$mkdir'
15606 mmaptype='$mmaptype'
15607 models='$models'
15608 modetype='$modetype'
15609 more='$more'
15610 multiarch='$multiarch'
15611 mv='$mv'
15612 myarchname='$myarchname'
15613 mydomain='$mydomain'
15614 myhostname='$myhostname'
15615 myuname='$myuname'
15616 n='$n'
15617 netdb_hlen_type='$netdb_hlen_type'
15618 netdb_host_type='$netdb_host_type'
15619 netdb_name_type='$netdb_name_type'
15620 netdb_net_type='$netdb_net_type'
15621 nm='$nm'
15622 nm_opt='$nm_opt'
15623 nm_so_opt='$nm_so_opt'
15624 nonxs_ext='$nonxs_ext'
15625 nroff='$nroff'
15626 nvsize='$nvsize'
15627 nvtype='$nvtype'
15628 o_nonblock='$o_nonblock'
15629 obj_ext='$obj_ext'
15630 old_pthread_create_joinable='$old_pthread_create_joinable'
15631 optimize='$optimize'
15632 orderlib='$orderlib'
15633 osname='$osname'
15634 osvers='$osvers'
15635 package='$package'
15636 pager='$pager'
15637 passcat='$passcat'
15638 patchlevel='$patchlevel'
15639 path_sep='$path_sep'
15640 perl5='$perl5'
15641 perl='$perl'
15642 perladmin='$perladmin'
15643 perlpath='$perlpath'
15644 pg='$pg'
15645 phostname='$phostname'
15646 pidtype='$pidtype'
15647 plibpth='$plibpth'
15648 pm_apiversion='$pm_apiversion'
15649 pmake='$pmake'
15650 pr='$pr'
15651 prefix='$prefix'
15652 prefixexp='$prefixexp'
15653 privlib='$privlib'
15654 privlibexp='$privlibexp'
15655 prototype='$prototype'
15656 ptrsize='$ptrsize'
15657 quadkind='$quadkind'
15658 quadtype='$quadtype'
15659 randbits='$randbits'
15660 randfunc='$randfunc'
15661 randseedtype='$randseedtype'
15662 ranlib='$ranlib'
15663 rd_nodata='$rd_nodata'
15664 revision='$revision'
15665 rm='$rm'
15666 rmail='$rmail'
15667 runnm='$runnm'
15668 sPRIEldbl='$sPRIEldbl'
15669 sPRIFldbl='$sPRIFldbl'
15670 sPRIGldbl='$sPRIGldbl'
15671 sPRIX64='$sPRIX64'
15672 sPRId64='$sPRId64'
15673 sPRIeldbl='$sPRIeldbl'
15674 sPRIfldbl='$sPRIfldbl'
15675 sPRIgldbl='$sPRIgldbl'
15676 sPRIi64='$sPRIi64'
15677 sPRIo64='$sPRIo64'
15678 sPRIu64='$sPRIu64'
15679 sPRIx64='$sPRIx64'
15680 sched_yield='$sched_yield'
15681 scriptdir='$scriptdir'
15682 scriptdirexp='$scriptdirexp'
15683 sed='$sed'
15684 seedfunc='$seedfunc'
15685 selectminbits='$selectminbits'
15686 selecttype='$selecttype'
15687 sendmail='$sendmail'
15688 sh='$sh'
15689 shar='$shar'
15690 sharpbang='$sharpbang'
15691 shmattype='$shmattype'
15692 shortsize='$shortsize'
15693 shrpenv='$shrpenv'
15694 shsharp='$shsharp'
15695 sig_count='$sig_count'
15696 sig_name='$sig_name'
15697 sig_name_init='$sig_name_init'
15698 sig_num='$sig_num'
15699 sig_num_init='$sig_num_init'
15700 signal_t='$signal_t'
15701 sitearch='$sitearch'
15702 sitearchexp='$sitearchexp'
15703 sitebin='$sitebin'
15704 sitebinexp='$sitebinexp'
15705 sitelib='$sitelib'
15706 sitelib_stem='$sitelib_stem'
15707 sitelibexp='$sitelibexp'
15708 siteprefix='$siteprefix'
15709 siteprefixexp='$siteprefixexp'
15710 sizesize='$sizesize'
15711 sizetype='$sizetype'
15712 sleep='$sleep'
15713 smail='$smail'
15714 small='$small'
15715 so='$so'
15716 sockethdr='$sockethdr'
15717 socketlib='$socketlib'
15718 socksizetype='$socksizetype'
15719 sort='$sort'
15720 spackage='$spackage'
15721 spitshell='$spitshell'
15722 split='$split'
15723 src='$src'
15724 ssizetype='$ssizetype'
15725 startperl='$startperl'
15726 startsh='$startsh'
15727 static_ext='$static_ext'
15728 stdchar='$stdchar'
15729 stdio_base='$stdio_base'
15730 stdio_bufsiz='$stdio_bufsiz'
15731 stdio_cnt='$stdio_cnt'
15732 stdio_filbuf='$stdio_filbuf'
15733 stdio_ptr='$stdio_ptr'
15734 stdio_stream_array='$stdio_stream_array'
15735 strings='$strings'
15736 submit='$submit'
15737 subversion='$subversion'
15738 sysman='$sysman'
15739 tail='$tail'
15740 tar='$tar'
15741 tbl='$tbl'
15742 tee='$tee'
15743 test='$test'
15744 timeincl='$timeincl'
15745 timetype='$timetype'
15746 touch='$touch'
15747 tr='$tr'
15748 trnl='$trnl'
15749 troff='$troff'
15750 u16size='$u16size'
15751 u16type='$u16type'
15752 u32size='$u32size'
15753 u32type='$u32type'
15754 u64size='$u64size'
15755 u64type='$u64type'
15756 u8size='$u8size'
15757 u8type='$u8type'
15758 uidformat='$uidformat'
15759 uidsign='$uidsign'
15760 uidsize='$uidsize'
15761 uidtype='$uidtype'
15762 uname='$uname'
15763 uniq='$uniq'
15764 uquadtype='$uquadtype'
15765 use5005threads='$use5005threads'
15766 use64bitall='$use64bitall'
15767 use64bitint='$use64bitint'
15768 usedl='$usedl'
15769 useithreads='$useithreads'
15770 uselargefiles='$uselargefiles'
15771 uselongdouble='$uselongdouble'
15772 usemorebits='$usemorebits'
15773 usemultiplicity='$usemultiplicity'
15774 usemymalloc='$usemymalloc'
15775 usenm='$usenm'
15776 useopcode='$useopcode'
15777 useperlio='$useperlio'
15778 useposix='$useposix'
15779 usesfio='$usesfio'
15780 useshrplib='$useshrplib'
15781 usesocks='$usesocks'
15782 usethreads='$usethreads'
15783 usevendorprefix='$usevendorprefix'
15784 usevfork='$usevfork'
15785 usrinc='$usrinc'
15786 uuname='$uuname'
15787 uvoformat='$uvoformat'
15788 uvsize='$uvsize'
15789 uvtype='$uvtype'
15790 uvuformat='$uvuformat'
15791 uvxformat='$uvxformat'
15792 vendorarch='$vendorarch'
15793 vendorarchexp='$vendorarchexp'
15794 vendorbin='$vendorbin'
15795 vendorbinexp='$vendorbinexp'
15796 vendorlib='$vendorlib'
15797 vendorlib_stem='$vendorlib_stem'
15798 vendorlibexp='$vendorlibexp'
15799 vendorprefix='$vendorprefix'
15800 vendorprefixexp='$vendorprefixexp'
15801 version='$version'
15802 vi='$vi'
15803 voidflags='$voidflags'
15804 xlibpth='$xlibpth'
15805 xs_apiversion='$xs_apiversion'
15806 zcat='$zcat'
15807 zip='$zip'
15808 EOT
15809
15810 : Add in command line options if available
15811 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15812
15813 : add special variables
15814 $test -f $src/patchlevel.h && \
15815 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15816 echo "CONFIGDOTSH=true" >>config.sh
15817
15818 : propagate old symbols
15819 if $test -f UU/config.sh; then
15820         <UU/config.sh sort | uniq >UU/oldconfig.sh
15821         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15822         sort | uniq -u >UU/oldsyms
15823         set X `cat UU/oldsyms`
15824         shift
15825         case $# in
15826         0) ;;
15827         *)
15828                 cat <<EOM
15829 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15830 EOM
15831                 echo "# Variables propagated from previous config.sh file." >>config.sh
15832                 for sym in `cat UU/oldsyms`; do
15833                         echo "    Propagating $hint variable "'$'"$sym..."
15834                         eval 'tmp="$'"${sym}"'"'
15835                         echo "$tmp" | \
15836                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15837                 done
15838                 ;;
15839         esac
15840 fi
15841
15842 : Finish up by extracting the .SH files
15843 case "$alldone" in
15844 exit)
15845         $rm -rf UU
15846         echo "Done."
15847         exit 0
15848         ;;
15849 cont)
15850         ;;
15851 '')
15852         dflt=''
15853         nostick=true
15854         $cat <<EOM
15855
15856 If you'd like to make any changes to the config.sh file before I begin
15857 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15858
15859 EOM
15860         rp="Press return or use a shell escape to edit config.sh:"
15861         . UU/myread
15862         nostick=''
15863         case "$ans" in
15864         '') ;;
15865         *) : in case they cannot read
15866                 sh 1>&4 -c "$ans";;
15867         esac
15868         ;;
15869 esac
15870
15871 : if this fails, just run all the .SH files by hand
15872 . ./config.sh
15873
15874 echo " "
15875 exec 1>&4
15876 . ./UU/extract
15877
15878 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15879         dflt=y
15880         case "$silent" in
15881         true) ;;
15882         *)
15883                 $cat <<EOM
15884
15885 Now you need to generate make dependencies by running "$make depend".
15886 You might prefer to run it in background: "$make depend > makedepend.out &"
15887 It can take a while, so you might not want to run it right now.
15888
15889 EOM
15890                 ;;
15891         esac
15892         rp="Run $make depend now?"
15893         . UU/myread
15894         case "$ans" in
15895         y*)
15896                 $make depend && echo "Now you must run a $make."
15897                 ;;
15898         *)
15899                 echo "You must run '$make depend' then '$make'."
15900                 ;;
15901         esac
15902 elif test -f [Mm]akefile; then
15903         echo " "
15904         echo "Now you must run a $make."
15905 else
15906         echo "Done."
15907 fi
15908
15909 if $test -f Policy.sh; then
15910     $cat <<EOM
15911
15912 If you compile $package on a different machine or from a different object
15913 directory, copy the Policy.sh file from this object directory to the
15914 new one before you run Configure -- this will help you with most of
15915 the policy defaults.
15916
15917 EOM
15918 fi
15919 if $test -f config.msg; then
15920     echo "Hmm.  I also noted the following information while running:"
15921     echo " "
15922     $cat config.msg >&4
15923     $rm -f config.msg
15924 fi
15925 $rm -f kit*isdone ark*isdone
15926 $rm -rf UU
15927
15928 : End of Configure
15929