9538137d7ef8cab01d62ef4f5fde4188b2a21b35
[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 Mon Apr 24 23:59:43 EET DST 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_frexpl=''
359 d_fs_data_s=''
360 d_fseeko=''
361 d_fsetpos=''
362 d_fstatfs=''
363 d_ftello=''
364 d_ftime=''
365 d_gettimeod=''
366 d_Gconvert=''
367 d_getcwd=''
368 d_getfsstat=''
369 d_getgrent=''
370 d_getgrps=''
371 d_gethbyaddr=''
372 d_gethbyname=''
373 d_gethent=''
374 aphostname=''
375 d_gethname=''
376 d_phostname=''
377 d_uname=''
378 d_gethostprotos=''
379 d_getlogin=''
380 d_getmnt=''
381 d_getmntent=''
382 d_getnbyaddr=''
383 d_getnbyname=''
384 d_getnent=''
385 d_getnetprotos=''
386 d_getpent=''
387 d_getpgid=''
388 d_getpgrp2=''
389 d_bsdgetpgrp=''
390 d_getpgrp=''
391 d_getppid=''
392 d_getprior=''
393 d_getpbyname=''
394 d_getpbynumber=''
395 d_getprotoprotos=''
396 d_getpwent=''
397 d_getsent=''
398 d_getservprotos=''
399 d_getspent=''
400 d_getspnam=''
401 d_getsbyname=''
402 d_getsbyport=''
403 d_gnulibc=''
404 d_hasmntopt=''
405 d_htonl=''
406 d_iconv=''
407 d_inetaton=''
408 d_int64_t=''
409 d_isascii=''
410 d_isnan=''
411 d_isnanl=''
412 d_killpg=''
413 d_lchown=''
414 d_ldbl_dig=''
415 d_link=''
416 d_locconv=''
417 d_lockf=''
418 d_longdbl=''
419 longdblsize=''
420 d_longlong=''
421 longlongsize=''
422 d_lseekproto=''
423 d_lstat=''
424 d_madvise=''
425 d_mblen=''
426 d_mbstowcs=''
427 d_mbtowc=''
428 d_memchr=''
429 d_memcmp=''
430 d_memcpy=''
431 d_memmove=''
432 d_memset=''
433 d_mkdir=''
434 d_mkdtemp=''
435 d_mkfifo=''
436 d_mkstemp=''
437 d_mkstemps=''
438 d_mktime=''
439 d_mmap=''
440 mmaptype=''
441 d_modfl=''
442 d_mprotect=''
443 d_msg=''
444 d_msgctl=''
445 d_msgget=''
446 d_msgrcv=''
447 d_msgsnd=''
448 d_msync=''
449 d_munmap=''
450 d_nice=''
451 d_off64_t=''
452 d_open3=''
453 d_fpathconf=''
454 d_pathconf=''
455 d_pause=''
456 d_pipe=''
457 d_poll=''
458 d_portable=''
459 d_old_pthread_create_joinable=''
460 old_pthread_create_joinable=''
461 d_pthread_yield=''
462 d_sched_yield=''
463 sched_yield=''
464 d_qgcvt=''
465 d_readdir=''
466 d_rewinddir=''
467 d_seekdir=''
468 d_telldir=''
469 d_readlink=''
470 d_rename=''
471 d_rmdir=''
472 d_safebcpy=''
473 d_safemcpy=''
474 d_sanemcmp=''
475 d_select=''
476 d_sem=''
477 d_semctl=''
478 d_semget=''
479 d_semop=''
480 d_setegid=''
481 d_seteuid=''
482 d_setgrent=''
483 d_setgrps=''
484 d_sethent=''
485 d_setlinebuf=''
486 d_setlocale=''
487 d_setnent=''
488 d_setpent=''
489 d_setpgid=''
490 d_setpgrp2=''
491 d_bsdsetpgrp=''
492 d_setpgrp=''
493 d_setprior=''
494 d_setpwent=''
495 d_setregid=''
496 d_setresgid=''
497 d_setresuid=''
498 d_setreuid=''
499 d_setrgid=''
500 d_setruid=''
501 d_setsent=''
502 d_setsid=''
503 d_setspent=''
504 d_setvbuf=''
505 d_sfio=''
506 usesfio=''
507 d_shm=''
508 d_shmat=''
509 d_shmatprototype=''
510 shmattype=''
511 d_shmctl=''
512 d_shmdt=''
513 d_shmget=''
514 d_sigaction=''
515 d_sigsetjmp=''
516 d_msg_ctrunc=''
517 d_msg_dontroute=''
518 d_msg_oob=''
519 d_msg_peek=''
520 d_msg_proxy=''
521 d_oldsock=''
522 d_scm_rights=''
523 d_socket=''
524 d_sockpair=''
525 sockethdr=''
526 socketlib=''
527 d_socklen_t=''
528 d_sqrtl=''
529 d_statblks=''
530 d_statfs_f_flags=''
531 d_statfs_s=''
532 d_fstatvfs=''
533 d_statvfs=''
534 d_stdio_cnt_lval=''
535 d_stdio_ptr_lval=''
536 d_stdiobase=''
537 d_stdstdio=''
538 stdio_base=''
539 stdio_bufsiz=''
540 stdio_cnt=''
541 stdio_filbuf=''
542 stdio_ptr=''
543 d_index=''
544 d_strchr=''
545 d_strcoll=''
546 d_strctcpy=''
547 d_strerrm=''
548 d_strerror=''
549 d_sysernlst=''
550 d_syserrlst=''
551 d_strtod=''
552 d_strtol=''
553 d_strtold=''
554 d_strtoll=''
555 d_strtoul=''
556 d_strtoull=''
557 d_strtouq=''
558 d_strxfrm=''
559 d_symlink=''
560 d_syscall=''
561 d_sysconf=''
562 d_system=''
563 d_tcgetpgrp=''
564 d_tcsetpgrp=''
565 d_telldirproto=''
566 d_time=''
567 timetype=''
568 clocktype=''
569 d_times=''
570 d_truncate=''
571 d_tzname=''
572 d_umask=''
573 d_semctl_semid_ds=''
574 d_semctl_semun=''
575 d_union_semun=''
576 d_ustat=''
577 d_vfork=''
578 usevfork=''
579 d_voidsig=''
580 signal_t=''
581 d_volatile=''
582 d_charvspr=''
583 d_vprintf=''
584 d_wait4=''
585 d_waitpid=''
586 d_wcstombs=''
587 d_wctomb=''
588 dlext=''
589 cccdlflags=''
590 ccdlflags=''
591 dlsrc=''
592 ld=''
593 lddlflags=''
594 usedl=''
595 doublesize=''
596 ebcdic=''
597 fflushNULL=''
598 fflushall=''
599 fpossize=''
600 fpostype=''
601 gidformat=''
602 gidsign=''
603 gidsize=''
604 gidtype=''
605 groupstype=''
606 h_fcntl=''
607 h_sysfile=''
608 i_arpainet=''
609 db_hashtype=''
610 db_prefixtype=''
611 i_db=''
612 i_dbm=''
613 i_rpcsvcdbm=''
614 d_dirnamlen=''
615 direntrytype=''
616 i_dirent=''
617 i_dld=''
618 i_dlfcn=''
619 i_fcntl=''
620 i_float=''
621 i_gdbm=''
622 d_grpasswd=''
623 i_grp=''
624 i_iconv=''
625 i_ieeefp=''
626 i_inttypes=''
627 i_limits=''
628 i_locale=''
629 i_machcthr=''
630 i_malloc=''
631 i_math=''
632 i_memory=''
633 i_mntent=''
634 i_ndbm=''
635 i_netdb=''
636 i_neterrno=''
637 i_netinettcp=''
638 i_niin=''
639 i_sysin=''
640 i_poll=''
641 i_pthread=''
642 d_pwage=''
643 d_pwchange=''
644 d_pwclass=''
645 d_pwcomment=''
646 d_pwexpire=''
647 d_pwgecos=''
648 d_pwpasswd=''
649 d_pwquota=''
650 i_pwd=''
651 i_sfio=''
652 i_shadow=''
653 i_socks=''
654 i_stddef=''
655 i_stdlib=''
656 i_string=''
657 strings=''
658 i_sunmath=''
659 i_sysaccess=''
660 i_sysdir=''
661 i_sysfile=''
662 d_voidtty=''
663 i_bsdioctl=''
664 i_sysfilio=''
665 i_sysioctl=''
666 i_syssockio=''
667 i_syslog=''
668 i_sysmman=''
669 i_sysmode=''
670 i_sysmount=''
671 i_sysndir=''
672 i_sysparam=''
673 i_sysresrc=''
674 i_syssecrt=''
675 i_sysselct=''
676 i_sysstat=''
677 i_sysstatfs=''
678 i_sysstatvfs=''
679 i_systimes=''
680 i_systypes=''
681 i_sysuio=''
682 i_sysun=''
683 i_sysutsname=''
684 i_sysvfs=''
685 i_syswait=''
686 i_sgtty=''
687 i_termio=''
688 i_termios=''
689 i_systime=''
690 i_systimek=''
691 i_time=''
692 timeincl=''
693 i_unistd=''
694 i_ustat=''
695 i_utime=''
696 i_values=''
697 i_stdarg=''
698 i_varargs=''
699 i_varhdr=''
700 i_vfork=''
701 inc_version_list=''
702 inc_version_list_init=''
703 installprefix=''
704 installprefixexp=''
705 installstyle=''
706 installusrbinperl=''
707 intsize=''
708 longsize=''
709 shortsize=''
710 libc=''
711 ldlibpthname=''
712 libperl=''
713 shrpenv=''
714 useshrplib=''
715 glibpth=''
716 libpth=''
717 loclibpth=''
718 plibpth=''
719 xlibpth=''
720 ignore_versioned_solibs=''
721 libs=''
722 libsdirs=''
723 libsfiles=''
724 libsfound=''
725 libspath=''
726 lns=''
727 d_PRIEldbl=''
728 d_PRIFldbl=''
729 d_PRIGldbl=''
730 d_PRIeldbl=''
731 d_PRIfldbl=''
732 d_PRIgldbl=''
733 sPRIEldbl=''
734 sPRIFldbl=''
735 sPRIGldbl=''
736 sPRIeldbl=''
737 sPRIfldbl=''
738 sPRIgldbl=''
739 lseeksize=''
740 lseektype=''
741 make_set_make=''
742 d_mymalloc=''
743 freetype=''
744 mallocobj=''
745 mallocsrc=''
746 malloctype=''
747 usemymalloc=''
748 installman1dir=''
749 man1dir=''
750 man1direxp=''
751 man1ext=''
752 installman3dir=''
753 man3dir=''
754 man3direxp=''
755 man3ext=''
756 huge=''
757 large=''
758 medium=''
759 models=''
760 small=''
761 split=''
762 modetype=''
763 multiarch=''
764 mydomain=''
765 myhostname=''
766 phostname=''
767 c=''
768 n=''
769 d_eofnblk=''
770 eagain=''
771 o_nonblock=''
772 rd_nodata=''
773 netdb_hlen_type=''
774 netdb_host_type=''
775 netdb_name_type=''
776 netdb_net_type=''
777 groupcat=''
778 hostcat=''
779 passcat=''
780 orderlib=''
781 ranlib=''
782 package=''
783 spackage=''
784 pager=''
785 api_revision=''
786 api_subversion=''
787 api_version=''
788 api_versionstring=''
789 patchlevel=''
790 revision=''
791 subversion=''
792 version=''
793 perl5=''
794 perladmin=''
795 perlpath=''
796 d_nv_preserves_uv=''
797 i16size=''
798 i16type=''
799 i32size=''
800 i32type=''
801 i64size=''
802 i64type=''
803 i8size=''
804 i8type=''
805 ivsize=''
806 ivtype=''
807 nvsize=''
808 nvtype=''
809 u16size=''
810 u16type=''
811 u32size=''
812 u32type=''
813 u64size=''
814 u64type=''
815 u8size=''
816 u8type=''
817 uvsize=''
818 uvtype=''
819 ivdformat=''
820 uvoformat=''
821 uvuformat=''
822 uvxformat=''
823 pidtype=''
824 prefix=''
825 prefixexp=''
826 installprivlib=''
827 privlib=''
828 privlibexp=''
829 prototype=''
830 ptrsize=''
831 d_PRIX64=''
832 d_PRId64=''
833 d_PRIi64=''
834 d_PRIo64=''
835 d_PRIu64=''
836 d_PRIx64=''
837 sPRIX64=''
838 sPRId64=''
839 sPRIi64=''
840 sPRIo64=''
841 sPRIu64=''
842 sPRIx64=''
843 d_quad=''
844 quadkind=''
845 quadtype=''
846 uquadtype=''
847 drand01=''
848 randbits=''
849 randfunc=''
850 randseedtype=''
851 seedfunc=''
852 installscript=''
853 scriptdir=''
854 scriptdirexp=''
855 selectminbits=''
856 selecttype=''
857 sh=''
858 sig_count=''
859 sig_name=''
860 sig_name_init=''
861 sig_num=''
862 sig_num_init=''
863 installsitearch=''
864 sitearch=''
865 sitearchexp=''
866 installsitebin=''
867 sitebin=''
868 sitebinexp=''
869 installsitelib=''
870 sitelib=''
871 sitelib_stem=''
872 sitelibexp=''
873 siteprefix=''
874 siteprefixexp=''
875 sizesize=''
876 sizetype=''
877 so=''
878 socksizetype=''
879 sharpbang=''
880 shsharp=''
881 spitshell=''
882 src=''
883 ssizetype=''
884 startperl=''
885 startsh=''
886 stdchar=''
887 d_stdio_stream_array=''
888 stdio_stream_array=''
889 sysman=''
890 trnl=''
891 uidformat=''
892 uidsign=''
893 uidsize=''
894 uidtype=''
895 archname64=''
896 use64bitall=''
897 use64bitint=''
898 uselargefiles=''
899 uselongdouble=''
900 usemorebits=''
901 usemultiplicity=''
902 nm_opt=''
903 nm_so_opt=''
904 runnm=''
905 usenm=''
906 useperlio=''
907 usesocks=''
908 d_oldpthreads=''
909 use5005threads=''
910 useithreads=''
911 usethreads=''
912 incpath=''
913 mips_type=''
914 usrinc=''
915 d_vendorarch=''
916 installvendorarch=''
917 vendorarch=''
918 vendorarchexp=''
919 d_vendorbin=''
920 installvendorbin=''
921 vendorbin=''
922 vendorbinexp=''
923 d_vendorlib=''
924 installvendorlib=''
925 vendorlib=''
926 vendorlib_stem=''
927 vendorlibexp=''
928 usevendorprefix=''
929 vendorprefix=''
930 vendorprefixexp=''
931 defvoidused=''
932 voidflags=''
933 pm_apiversion=''
934 xs_apiversion=''
935 CONFIG=''
936
937 define='define'
938 undef='undef'
939 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
940 rmlist=''
941
942 : We must find out about Eunice early
943 eunicefix=':'
944 if test -f /etc/unixtovms; then
945         eunicefix=/etc/unixtovms
946 fi
947 if test -f /etc/unixtovms.exe; then
948         eunicefix=/etc/unixtovms.exe
949 fi
950
951 i_whoami=''
952 : set useposix=false in your hint file to disable the POSIX extension.
953 useposix=true
954 : set useopcode=false in your hint file to disable the Opcode extension.
955 useopcode=true
956 : Trailing extension.  Override this in a hint file, if needed.
957 _exe=''
958 : Extra object files, if any, needed on this platform.
959 archobjs=''
960 : Possible local include directories to search.
961 : Set locincpth to "" in a hint file to defeat local include searches.
962 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
963 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
964 :
965 : no include file wanted by default
966 inclwanted=''
967
968 groupstype=''
969 : change the next line if compiling for Xenix/286 on Xenix/386
970 xlibpth='/usr/lib/386 /lib/386'
971 : Possible local library directories to search.
972 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
973 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
974
975 : general looking path for locating libraries
976 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
977 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
978 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
979 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
980 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
981
982 : Private path used by Configure to find libraries.  Its value
983 : is prepended to libpth. This variable takes care of special
984 : machines, like the mips.  Usually, it should be empty.
985 plibpth=''
986
987 : default library list
988 libswanted=''
989 : some systems want to use only the non-versioned libso:s
990 ignore_versioned_solibs=''
991 : set usemultiplicity on the Configure command line to enable multiplicity.
992 : set usesocks on the Configure command line to enable socks.
993 : set usethreads on the Configure command line to enable threads.
994 : full support for void wanted by default
995 defvoidused=15
996
997 : List of libraries we want.
998 : If anyone needs -lnet, put it in a hint file.
999 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1000 libswanted="$libswanted dld ld sun m c cposix posix"
1001 libswanted="$libswanted ndir dir crypt sec"
1002 libswanted="$libswanted ucb bsd BSD PW x iconv"
1003 : We probably want to search /usr/shlib before most other libraries.
1004 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1005 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1006 glibpth="/usr/shlib $glibpth"
1007 : Do not use vfork unless overridden by a hint file.
1008 usevfork=false
1009
1010 : Find the basic shell for Bourne shell scripts
1011 case "$sh" in
1012 '')
1013         case "$SYSTYPE" in
1014         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1015         *) xxx='/bin/sh';;
1016         esac
1017         if test -f "$xxx"; then
1018                 sh="$xxx"
1019         else
1020                 : Build up a list and do a single loop so we can 'break' out.
1021                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1022                 for xxx in sh bash ksh pdksh ash; do
1023                         for p in $pth; do
1024                                 try="$try ${p}/${xxx}"
1025                         done
1026                 done
1027                 for xxx in $try; do
1028                         if test -f "$xxx"; then
1029                                 sh="$xxx";
1030                                 break
1031                         elif test -f "$xxx.exe"; then
1032                                 sh="$xxx";
1033                                 break
1034                         fi
1035                 done
1036         fi
1037         ;;
1038 esac
1039
1040 case "$sh" in
1041 '')     cat <<EOM >&2
1042 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1043
1044 Usually it's in /bin/sh.  How did you even get this far?
1045 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1046 we'll try to straighten this all out.
1047 EOM
1048         exit 1
1049         ;;
1050 esac
1051
1052 : see if sh knows # comments
1053 if `$sh -c '#' >/dev/null 2>&1`; then
1054         shsharp=true
1055         spitshell=cat
1056         xcat=/bin/cat
1057         test -f $xcat || xcat=/usr/bin/cat
1058         echo "#!$xcat" >try
1059         $eunicefix try
1060         chmod +x try
1061         ./try > today
1062         if test -s today; then
1063                 sharpbang='#!'
1064         else
1065                 echo "#! $xcat" > try
1066                 $eunicefix try
1067                 chmod +x try
1068                 ./try > today
1069                 if test -s today; then
1070                         sharpbang='#! '
1071                 else
1072                         sharpbang=': use '
1073                 fi
1074         fi
1075 else
1076         echo " "
1077         echo "Your $sh doesn't grok # comments--I will strip them later on."
1078         shsharp=false
1079         cd ..
1080         echo "exec grep -v '^[  ]*#'" >spitshell
1081         chmod +x spitshell
1082         $eunicefix spitshell
1083         spitshell=`pwd`/spitshell
1084         cd UU
1085         echo "I presume that if # doesn't work, #! won't work either!"
1086         sharpbang=': use '
1087 fi
1088 rm -f try today
1089
1090 : figure out how to guarantee sh startup
1091 case "$startsh" in
1092 '') startsh=${sharpbang}${sh} ;;
1093 *)
1094 esac
1095 cat >try <<EOSS
1096 $startsh
1097 set abc
1098 test "$?abc" != 1
1099 EOSS
1100
1101 chmod +x try
1102 $eunicefix try
1103 if ./try; then
1104         : echo "Yup, it does."
1105 else
1106         echo "Hmm... '$startsh' does not guarantee sh startup..."
1107         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1108 fi
1109 rm -f try
1110
1111
1112 : Save command line options in file UU/cmdline.opt for later use in
1113 : generating config.sh.
1114 cat > cmdline.opt <<EOSH
1115 # Configure command line arguments.
1116 config_arg0='$0'
1117 config_args='$*'
1118 config_argc=$#
1119 EOSH
1120 argn=1
1121 for arg in "$@"; do
1122         cat >>cmdline.opt <<EOSH
1123 config_arg$argn='$arg'
1124 EOSH
1125         argn=`expr $argn + 1`
1126 done
1127
1128 : produce awk script to parse command line options
1129 cat >options.awk <<'EOF'
1130 BEGIN {
1131         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1132
1133         len = length(optstr);
1134         for (i = 1; i <= len; i++) {
1135                 c = substr(optstr, i, 1);
1136                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1137                 if (a == ":") {
1138                         arg[c] = 1;
1139                         i++;
1140                 }
1141                 opt[c] = 1;
1142         }
1143 }
1144 {
1145         expect = 0;
1146         str = $0;
1147         if (substr(str, 1, 1) != "-") {
1148                 printf("'%s'\n", str);
1149                 next;
1150         }
1151         len = length($0);
1152         for (i = 2; i <= len; i++) {
1153                 c = substr(str, i, 1);
1154                 if (!opt[c]) {
1155                         printf("-%s\n", substr(str, i));
1156                         next;
1157                 }
1158                 printf("-%s\n", c);
1159                 if (arg[c]) {
1160                         if (i < len)
1161                                 printf("'%s'\n", substr(str, i + 1));
1162                         else
1163                                 expect = 1;
1164                         next;
1165                 }
1166         }
1167 }
1168 END {
1169         if (expect)
1170                 print "?";
1171 }
1172 EOF
1173
1174 : process the command line options
1175 set X `for arg in "$@"; do echo "X$arg"; done |
1176         sed -e s/X// | awk -f options.awk`
1177 eval "set $*"
1178 shift
1179 rm -f options.awk
1180
1181 : set up default values
1182 fastread=''
1183 reuseval=false
1184 config_sh=''
1185 alldone=''
1186 error=''
1187 silent=''
1188 extractsh=''
1189 override=''
1190 knowitall=''
1191 rm -f optdef.sh posthint.sh
1192 cat >optdef.sh <<EOS
1193 $startsh
1194 EOS
1195
1196
1197 : option parsing
1198 while test $# -gt 0; do
1199         case "$1" in
1200         -d) shift; fastread=yes;;
1201         -e) shift; alldone=cont;;
1202         -f)
1203                 shift
1204                 cd ..
1205                 if test -r "$1"; then
1206                         config_sh="$1"
1207                 else
1208                         echo "$me: cannot read config file $1." >&2
1209                         error=true
1210                 fi
1211                 cd UU
1212                 shift;;
1213         -h) shift; error=true;;
1214         -r) shift; reuseval=true;;
1215         -s) shift; silent=true; realsilent=true;;
1216         -E) shift; alldone=exit;;
1217         -K) shift; knowitall=true;;
1218         -O) shift; override=true;;
1219         -S) shift; silent=true; extractsh=true;;
1220         -D)
1221                 shift
1222                 case "$1" in
1223                 *=)
1224                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1225                         echo "$me: ignoring -D $1" >&2
1226                         ;;
1227                 *=*) echo "$1" | \
1228                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1229                 *) echo "$1='define'" >> optdef.sh;;
1230                 esac
1231                 shift
1232                 ;;
1233         -U)
1234                 shift
1235                 case "$1" in
1236                 *=) echo "$1" >> optdef.sh;;
1237                 *=*)
1238                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1239                         echo "$me: ignoring -U $1" >&2
1240                         ;;
1241                 *) echo "$1='undef'" >> optdef.sh;;
1242                 esac
1243                 shift
1244                 ;;
1245         -A)
1246             shift
1247             xxx=''
1248             yyy="$1"
1249             zzz=''
1250             uuu=undef
1251             case "$yyy" in
1252             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1253                  case "$zzz" in
1254                  *:*) zzz='' ;;
1255                  *)   xxx=append
1256                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1257                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1258                  esac
1259                  ;;
1260             esac
1261             case "$xxx" in
1262             '')  case "$yyy" in
1263                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1264                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1265                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1266                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1267                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1268                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1269                  esac
1270                  ;;       
1271             esac
1272             case "$xxx" in
1273             append)
1274                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1275             clear)
1276                 echo "$yyy=''"                  >> posthint.sh ;;
1277             define)
1278                 case "$zzz" in
1279                 '') zzz=define ;;
1280                 esac
1281                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1282             eval)
1283                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1284             prepend)
1285                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1286             undef)
1287                 case "$zzz" in
1288                 '') zzz="$uuu" ;;
1289                 esac
1290                 echo "$yyy=$zzz"                >> posthint.sh ;;
1291             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1292             esac
1293             shift
1294             ;;
1295         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1296             exit 0;;
1297         --) break;;
1298         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1299         *) break;;
1300         esac
1301 done
1302
1303 case "$error" in
1304 true)
1305         cat >&2 <<EOM
1306 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1307                  [-U symbol] [-U symbol=] [-A command:symbol...]
1308   -d : use defaults for all answers.
1309   -e : go on without questioning past the production of config.sh.
1310   -f : specify an alternate default configuration file.
1311   -h : print this help message and exit (with an error status).
1312   -r : reuse C symbols value if possible (skips costly nm extraction).
1313   -s : silent mode, only echoes questions and essential information.
1314   -D : define symbol to have some value:
1315          -D symbol         symbol gets the value 'define'
1316          -D symbol=value   symbol gets the value 'value'
1317   -E : stop at the end of questions, after having produced config.sh.
1318   -K : do not use unless you know what you are doing.
1319   -O : let -D and -U override definitions from loaded configuration file.
1320   -S : perform variable substitutions on all .SH files (can mix with -f)
1321   -U : undefine symbol:
1322          -U symbol    symbol gets the value 'undef'
1323          -U symbol=   symbol gets completely empty
1324   -A : manipulate symbol after the platform specific hints have been applied:
1325          -A symbol=value                append " "value to symbol
1326          -A append:symbol=value         append value to symbol
1327          -A define:symbol=value         define symbol to have value
1328          -A clear:symbol                define symbol to be ''
1329          -A define:symbol               define symbol to be 'define'
1330          -A eval:symbol=value           define symbol to be eval of value
1331          -A prepend:symbol=value        prepend value to symbol
1332          -A undef:symbol                define symbol to be 'undef'
1333          -A undef:symbol=               define symbol to be ''
1334   -V : print version number and exit (with a zero status).
1335 EOM
1336         exit 1
1337         ;;
1338 esac
1339
1340 : Sanity checks
1341 case "$fastread$alldone" in
1342 yescont|yesexit) ;;
1343 *)
1344         if test ! -t 0; then
1345                 echo "Say 'sh Configure', not 'sh <Configure'"
1346                 exit 1
1347         fi
1348         ;;
1349 esac
1350
1351 exec 4>&1
1352 case "$silent" in
1353 true) exec 1>/dev/null;;
1354 esac
1355
1356 : run the defines and the undefines, if any, but leave the file out there...
1357 touch optdef.sh
1358 . ./optdef.sh
1359 : create the posthint manipulation script and leave the file out there...
1360 touch posthint.sh
1361
1362 : set package name
1363 package=perl5
1364 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1365 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1366 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1367 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1368 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1369 esac
1370
1371 : Some greps do not return status, grrr.
1372 echo "grimblepritz" >grimble
1373 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1374         contains=contains
1375 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1376         contains=grep
1377 else
1378         contains=contains
1379 fi
1380 rm -f grimble
1381 : the following should work in any shell
1382 case "$contains" in
1383 contains*)
1384         echo " "
1385         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1386         cat >contains <<'EOSS'
1387 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1388 EOSS
1389 chmod +x contains
1390 esac
1391
1392 : Find the path to the source tree
1393 case "$src" in
1394 '') case "$0" in
1395     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1396          case "$src" in
1397          /*)    ;;
1398          *)     src=`cd ../$src && pwd` ;;
1399          esac
1400          ;;
1401     *)   src='.';;
1402     esac;;
1403 esac
1404 case "$src" in
1405 '')     src=/
1406         rsrc=/
1407         ;;
1408 /*) rsrc="$src";;
1409 *) rsrc="../$src";;
1410 esac
1411 if test -f $rsrc/Configure && \
1412         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1413 then
1414    : found it, so we are ok.
1415 else
1416         rsrc=''
1417         for src in . .. ../.. ../../.. ../../../..; do
1418                 if test -f ../$src/Configure && \
1419                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1420                 then
1421                         rsrc=../$src
1422                         break
1423                 fi
1424         done
1425 fi
1426 case "$rsrc" in
1427 '')
1428         cat <<EOM >&4
1429
1430 Sorry, I can't seem to locate the source dir for $package.  Please start
1431 Configure with an explicit path -- i.e. /some/path/Configure.
1432
1433 EOM
1434         exit 1
1435         ;;
1436 ../.)   rsrc='..';;
1437 *)
1438         echo " "
1439         echo "Sources for $package found in \"$src\"." >&4
1440         ;;
1441 esac
1442
1443 : script used to extract .SH files with variable substitutions
1444 cat >extract <<'EOS'
1445 CONFIGDOTSH=true
1446 echo "Doing variable substitutions on .SH files..."
1447 if test -f $src/MANIFEST; then
1448         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1449 else
1450         echo "(Looking for .SH files under the source directory.)"
1451         set x `(cd $src; find . -name "*.SH" -print)`
1452 fi
1453 shift
1454 case $# in
1455 0) set x `(cd $src; echo *.SH)`; shift;;
1456 esac
1457 if test ! -f $src/$1; then
1458         shift
1459 fi
1460 mkdir_p='
1461 name=$1;
1462 create="";
1463 while test $name; do
1464         if test ! -d "$name"; then
1465                 create="$name $create";
1466                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1467                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1468         else
1469                 name="";
1470         fi;
1471 done;
1472 for file in $create; do
1473         mkdir $file;
1474 done
1475 '
1476 for file in $*; do
1477         case "$src" in
1478         ".")
1479                 case "$file" in
1480                 */*)
1481                         dir=`expr X$file : 'X\(.*\)/'`
1482                         file=`expr X$file : 'X.*/\(.*\)'`
1483                         (cd $dir && . ./$file)
1484                         ;;
1485                 *)
1486                         . ./$file
1487                         ;;
1488                 esac
1489                 ;;
1490         *)
1491                 case "$file" in
1492                 */*)
1493                         dir=`expr X$file : 'X\(.*\)/'`
1494                         file=`expr X$file : 'X.*/\(.*\)'`
1495                         (set x $dir; shift; eval $mkdir_p)
1496                         sh <$src/$dir/$file
1497                         ;;
1498                 *)
1499                         sh <$src/$file
1500                         ;;
1501                 esac
1502                 ;;
1503         esac
1504 done
1505 if test -f $src/config_h.SH; then
1506         if test ! -f config.h; then
1507         : oops, they left it out of MANIFEST, probably, so do it anyway.
1508         . $src/config_h.SH
1509         fi
1510 fi
1511 EOS
1512
1513 : extract files and exit if asked to do so
1514 case "$extractsh" in
1515 true)
1516         case "$realsilent" in
1517         true) ;;
1518         *) exec 1>&4;;
1519         esac
1520         case "$config_sh" in
1521         '') config_sh='config.sh';;
1522         esac
1523         echo " "
1524         echo "Fetching answers from $config_sh..."
1525         cd ..
1526         . $config_sh
1527         test "$override" && . ./optdef.sh
1528         echo " "
1529         . UU/extract
1530         rm -rf UU
1531         echo "Done."
1532         exit 0
1533         ;;
1534 esac
1535
1536 : Eunice requires " " instead of "", can you believe it
1537 echo " "
1538 : Here we go...
1539 echo "Beginning of configuration questions for $package."
1540
1541 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1542
1543 : first determine how to suppress newline on echo command
1544 echo " "
1545 echo "Checking echo to see how to suppress newlines..."
1546 (echo "hi there\c" ; echo " ") >.echotmp
1547 if $contains c .echotmp >/dev/null 2>&1 ; then
1548         echo "...using -n."
1549         n='-n'
1550         c=''
1551 else
1552         cat <<'EOM'
1553 ...using \c
1554 EOM
1555         n=''
1556         c='\c'
1557 fi
1558 echo $n "The star should be here-->$c"
1559 echo '*'
1560 rm -f .echotmp
1561
1562 : Now test for existence of everything in MANIFEST
1563 echo " "
1564 if test -f $rsrc/MANIFEST; then
1565         echo "First let's make sure your kit is complete.  Checking..." >&4
1566         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1567         rm -f missing
1568         tmppwd=`pwd`
1569         for filelist in x??; do
1570                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1571         done
1572         if test -s missing; then
1573                 cat missing >&4
1574                 cat >&4 <<'EOM'
1575
1576 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1577
1578 You have the option of continuing the configuration process, despite the
1579 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1580 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1581 and contact the author (perlbug@perl.com).
1582
1583 EOM
1584                 echo $n "Continue? [n] $c" >&4
1585                 read ans
1586                 case "$ans" in
1587                 y*)
1588                         echo "Continuing..." >&4
1589                         rm -f missing
1590                         ;;
1591                 *)
1592                         echo "ABORTING..." >&4
1593                         kill $$
1594                         ;;
1595                 esac
1596         else
1597                 echo "Looks good..."
1598         fi
1599 else
1600         echo "There is no MANIFEST file.  I hope your kit is complete !"
1601 fi
1602 rm -f missing x??
1603
1604 echo " "
1605 : Find the appropriate value for a newline for tr
1606 if test -n "$DJGPP"; then
1607        trnl='\012'
1608 fi
1609 if test X"$trnl" = X; then
1610         case "`echo foo|tr '\n' x 2>/dev/null`" in
1611         foox) trnl='\n' ;;
1612         esac
1613 fi
1614 if test X"$trnl" = X; then
1615         case "`echo foo|tr '\012' x 2>/dev/null`" in
1616         foox) trnl='\012' ;;
1617         esac
1618 fi
1619 if test X"$trnl" = X; then
1620         cat <<EOM >&2
1621
1622 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1623
1624 EOM
1625         exit 1
1626 fi
1627
1628 : compute the number of columns on the terminal for proper question formatting
1629 case "$COLUMNS" in
1630 '') COLUMNS='80';;
1631 esac
1632
1633 : set up the echo used in my read
1634 myecho="case \"\$xxxm\" in
1635 '') echo $n \"\$rp $c\" >&4;;
1636 *) case \"\$rp\" in
1637         '') echo $n \"[\$xxxm] $c\";;
1638         *)
1639                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1640                         echo \"\$rp\" >&4
1641                         echo $n \"[\$xxxm] $c\" >&4
1642                 else
1643                         echo $n \"\$rp [\$xxxm] $c\" >&4
1644                 fi
1645                 ;;
1646         esac;;
1647 esac"
1648
1649 : now set up to do reads with possible shell escape and default assignment
1650 cat <<EOSC >myread
1651 $startsh
1652 xxxm=\$dflt
1653 $myecho
1654 ans='!'
1655 case "\$fastread" in
1656 yes) case "\$dflt" in
1657         '') ;;
1658         *) ans='';
1659                 case "\$silent-\$rp" in
1660                 true-) ;;
1661                 *) echo " " >&4;;
1662                 esac;;
1663         esac;;
1664 *) case "\$silent" in
1665         true) case "\$rp" in
1666                 '') ans='';;
1667                 esac;;
1668         esac;;
1669 esac
1670 while expr "X\$ans" : "X!" >/dev/null; do
1671         read answ
1672         set x \$xxxm
1673         shift
1674         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1675         case  "\$answ" in
1676         "!")
1677                 sh 1>&4
1678                 echo " "
1679                 $myecho
1680                 ;;
1681         !*)
1682                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1683                 shift
1684                 sh 1>&4 -c "\$*"
1685                 echo " "
1686                 $myecho
1687                 ;;
1688         "\$ans")
1689                 case "\$ans" in
1690                 \\&*)
1691                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1692                         shift
1693                         case "\$1" in
1694                         -d)
1695                                 fastread=yes
1696                                 echo "(OK, I'll run with -d after this question.)" >&4
1697                                 ;;
1698                         -*)
1699                                 echo "*** Sorry, \$1 not supported yet." >&4
1700                                 ;;
1701                         esac
1702                         $myecho
1703                         ans=!
1704                         ;;
1705                 esac;;
1706         *)
1707                 case "\$aok" in
1708                 y)
1709                         echo "*** Substitution done -- please confirm."
1710                         xxxm="\$ans"
1711                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1712                         xxxm="\$ans"
1713                         ans=!
1714                         ;;
1715                 *)
1716                         echo "*** Error -- try again."
1717                         ans=!
1718                         ;;
1719                 esac
1720                 $myecho
1721                 ;;
1722         esac
1723         case "\$ans\$xxxm\$nostick" in
1724         '')
1725                 ans=!
1726                 $myecho
1727                 ;;
1728         esac
1729 done
1730 case "\$ans" in
1731 '') ans="\$xxxm";;
1732 esac
1733 EOSC
1734
1735 : create .config dir to save info across Configure sessions
1736 test -d ../.config || mkdir ../.config
1737 cat >../.config/README <<EOF
1738 This directory created by Configure to save information that should
1739 persist across sessions for $package.
1740
1741 You may safely delete it if you wish.
1742 EOF
1743
1744 : general instructions
1745 needman=true
1746 firsttime=true
1747 user=`(logname) 2>/dev/null`
1748 case "$user" in
1749 '') user=`whoami 2>&1`;;
1750 esac
1751 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1752         firsttime=false
1753         echo " "
1754         rp='Would you like to see the instructions?'
1755         dflt=n
1756         . ./myread
1757         case "$ans" in
1758         [yY]*) ;;
1759         *) needman=false;;
1760         esac
1761 fi
1762 if $needman; then
1763         cat <<EOH
1764
1765 This installation shell script will examine your system and ask you questions
1766 to determine how the perl5 package should be installed. If you get
1767 stuck on a question, you may use a ! shell escape to start a subshell or
1768 execute a command.  Many of the questions will have default answers in square
1769 brackets; typing carriage return will give you the default.
1770
1771 On some of the questions which ask for file or directory names you are allowed
1772 to use the ~name construct to specify the login directory belonging to "name",
1773 even if you don't have a shell which knows about that.  Questions where this is
1774 allowed will be marked "(~name ok)".
1775
1776 EOH
1777         rp=''
1778         dflt='Type carriage return to continue'
1779         . ./myread
1780         cat <<'EOH'
1781
1782 The prompter used in this script allows you to use shell variables and
1783 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1784 in the default answer, as if the default line was a set of arguments given to a
1785 script shell.  This means you may also use $* to repeat the whole default line,
1786 so you do not have to re-type everything to add something to the default.
1787
1788 Everytime there is a substitution, you will have to confirm.  If there is an
1789 error (e.g. an unmatched backtick), the default answer will remain unchanged
1790 and you will be prompted again.
1791
1792 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1793 the questions and use the computed defaults (or the previous answers if there
1794 was already a config.sh file). Type 'Configure -h' for a list of options.
1795 You may also start interactively and then answer '& -d' at any prompt to turn
1796 on the non-interactive behaviour for the remainder of the execution.
1797
1798 EOH
1799         . ./myread
1800         cat <<EOH
1801
1802 Much effort has been expended to ensure that this shell script will run on any
1803 Unix system.  If despite that it blows up on yours, your best bet is to edit
1804 Configure and run it again.  If you can't run Configure for some reason,
1805 you'll have to generate a config.sh file by hand.  Whatever problems you
1806 have, let me (perlbug@perl.com) know how I blew it.
1807
1808 This installation script affects things in two ways:
1809
1810 1) it may do direct variable substitutions on some of the files included
1811    in this kit.
1812 2) it builds a config.h file for inclusion in C programs.  You may edit
1813    any of these files as the need arises after running this script.
1814
1815 If you make a mistake on a question, there is no easy way to back up to it
1816 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1817 files.  Configure will offer to let you do this before it runs the SH files.
1818
1819 EOH
1820         dflt='Type carriage return to continue'
1821         . ./myread
1822         case "$firsttime" in
1823         true) echo $user >>../.config/instruct;;
1824         esac
1825 fi
1826
1827 : find out where common programs are
1828 echo " "
1829 echo "Locating common programs..." >&4
1830 cat <<EOSC >loc
1831 $startsh
1832 case \$# in
1833 0) exit 1;;
1834 esac
1835 thing=\$1
1836 shift
1837 dflt=\$1
1838 shift
1839 for dir in \$*; do
1840         case "\$thing" in
1841         .)
1842         if test -d \$dir/\$thing; then
1843                 echo \$dir
1844                 exit 0
1845         fi
1846         ;;
1847         *)
1848         for thisthing in \$dir/\$thing; do
1849                 : just loop through to pick last item
1850         done
1851         if test -f \$thisthing; then
1852                 echo \$thisthing
1853                 exit 0
1854         elif test -f \$dir/\$thing.exe; then
1855                 if test -n "$DJGPP"; then
1856                         echo \$dir/\$thing.exe
1857                 else
1858                         : on Eunice apparently
1859                         echo \$dir/\$thing
1860                 fi
1861                 exit 0
1862         fi
1863         ;;
1864         esac
1865 done
1866 echo \$dflt
1867 exit 1
1868 EOSC
1869 chmod +x loc
1870 $eunicefix loc
1871 loclist="
1872 awk
1873 cat
1874 comm
1875 cp
1876 echo
1877 expr
1878 grep
1879 ls
1880 make
1881 mkdir
1882 rm
1883 sed
1884 sort
1885 touch
1886 tr
1887 uniq
1888 "
1889 trylist="
1890 Mcc
1891 ar
1892 byacc
1893 cpp
1894 csh
1895 date
1896 egrep
1897 gzip
1898 less
1899 ln
1900 more
1901 nm
1902 nroff
1903 pg
1904 test
1905 uname
1906 zip
1907 "
1908 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1909 pth="$pth /lib /usr/lib"
1910 for file in $loclist; do
1911         eval xxx=\$$file
1912         case "$xxx" in
1913         /*|?:[\\/]*)
1914                 if test -f "$xxx"; then
1915                         : ok
1916                 else
1917                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1918                         xxx=`./loc $file $file $pth`
1919                 fi
1920                 ;;
1921         '') xxx=`./loc $file $file $pth`;;
1922         *) xxx=`./loc $xxx $xxx $pth`;;
1923         esac
1924         eval $file=$xxx
1925         eval _$file=$xxx
1926         case "$xxx" in
1927         /*)
1928                 echo $file is in $xxx.
1929                 ;;
1930         ?:[\\/]*)
1931                 echo $file is in $xxx.
1932                 ;;
1933         *)
1934                 echo "I don't know where '$file' is, and my life depends on it." >&4
1935                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1936                 exit 1
1937                 ;;
1938         esac
1939 done
1940 echo " "
1941 echo "Don't worry if any of the following aren't found..."
1942 say=offhand
1943 for file in $trylist; do
1944         eval xxx=\$$file
1945         case "$xxx" in
1946         /*|?:[\\/]*)
1947                 if test -f "$xxx"; then
1948                         : ok
1949                 else
1950                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1951                         xxx=`./loc $file $file $pth`
1952                 fi
1953                 ;;
1954         '') xxx=`./loc $file $file $pth`;;
1955         *) xxx=`./loc $xxx $xxx $pth`;;
1956         esac
1957         eval $file=$xxx
1958         eval _$file=$xxx
1959         case "$xxx" in
1960         /*)
1961                 echo $file is in $xxx.
1962                 ;;
1963         ?:[\\/]*)
1964                 echo $file is in $xxx.
1965                 ;;
1966         *)
1967                 echo "I don't see $file out there, $say."
1968                 say=either
1969                 ;;
1970         esac
1971 done
1972 case "$egrep" in
1973 egrep)
1974         echo "Substituting grep for egrep."
1975         egrep=$grep
1976         ;;
1977 esac
1978 case "$ln" in
1979 ln)
1980         echo "Substituting cp for ln."
1981         ln=$cp
1982         ;;
1983 esac
1984 case "$test" in
1985 test)
1986         echo "Hopefully test is built into your sh."
1987         ;;
1988 *)
1989         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1990                 echo "Using the test built into your sh."
1991                 test=test
1992                 _test=test
1993         fi
1994         ;;
1995 esac
1996 case "$echo" in
1997 echo)
1998         echo "Hopefully echo is built into your sh."
1999         ;;
2000 '') ;;
2001 *)
2002         echo " "
2003 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2004         $echo $n "hi there$c" >foo1
2005         echo $n "hi there$c" >foo2
2006         if cmp foo1 foo2 >/dev/null 2>&1; then
2007                 echo "They are compatible.  In fact, they may be identical."
2008         else
2009                 case "$n" in
2010                 '-n') n='' c='\c';;
2011                 *) n='-n' c='';;
2012                 esac
2013                 cat <<FOO
2014 They are not compatible!  You are probably running ksh on a non-USG system.
2015 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2016 have echo built in and we may have to run some Bourne shell scripts.  That
2017 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2018
2019 FOO
2020                 $echo $n "The star should be here-->$c"
2021                 $echo "*"
2022         fi
2023         $rm -f foo1 foo2
2024         ;;
2025 esac
2026
2027 : determine whether symbolic links are supported
2028 echo " "
2029 $touch blurfl
2030 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2031         echo "Symbolic links are supported." >&4
2032         lns="$ln -s"
2033 else
2034         echo "Symbolic links are NOT supported." >&4
2035         lns="$ln"
2036 fi
2037 $rm -f blurfl sym
2038
2039 : see whether [:lower:] and [:upper:] are supported character classes
2040 echo " "
2041 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2042 ABYZ)
2043         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2044         up='[:upper:]'
2045         low='[:lower:]'
2046         ;;
2047 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2048         # (0xc9 and 0xd1), therefore that is a nice testing point.
2049         if test "X$up" = X -o "X$low" = X; then
2050             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2051             ij) up='[A-Z]'
2052                 low='[a-z]'
2053                 ;;
2054             esac
2055         fi
2056         if test "X$up" = X -o "X$low" = X; then
2057             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2058             ij) up='A-Z'
2059                 low='a-z'
2060                 ;;
2061             esac
2062         fi
2063         if test "X$up" = X -o "X$low" = X; then
2064             case "`echo IJ | od -x 2>/dev/null`" in
2065             *C9D1*|*c9d1*)
2066                 echo "Hey, this might be EBCDIC." >&4
2067                 if test "X$up" = X -o "X$low" = X; then
2068                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2069                     ij) up='[A-IJ-RS-Z]'
2070                         low='[a-ij-rs-z]'
2071                         ;;
2072                     esac
2073                 fi
2074                 if test "X$up" = X -o "X$low" = X; then
2075                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2076                     ij) up='A-IJ-RS-Z'
2077                         low='a-ij-rs-z'
2078                         ;;
2079                     esac
2080                 fi
2081                 ;;
2082             esac
2083         fi
2084 esac
2085 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2086 ij)
2087     echo "Using $up and $low to convert case." >&4
2088     ;;
2089 *)
2090     echo "I don't know how to translate letters from upper to lower case." >&4
2091     echo "Your tr is not acting any way I know of." >&4
2092     exit 1
2093     ;;
2094 esac
2095 : set up the translation script tr, must be called with ./tr of course
2096 cat >tr <<EOSC
2097 $startsh
2098 case "\$1\$2" in
2099 '[A-Z][a-z]') exec $tr '$up' '$low';;
2100 '[a-z][A-Z]') exec $tr '$low' '$up';;
2101 esac
2102 exec $tr "\$@"
2103 EOSC
2104 chmod +x tr
2105 $eunicefix tr
2106
2107 : Try to determine whether config.sh was made on this system
2108 case "$config_sh" in
2109 '')
2110 myuname=`$uname -a 2>/dev/null`
2111 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2112 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2113 # because the A-Z/a-z are not consecutive.
2114 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2115         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2116 newmyuname="$myuname"
2117 dflt=n
2118 case "$knowitall" in
2119 '')
2120         if test -f ../config.sh; then
2121                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2122                         eval "`grep myuname= ../config.sh`"
2123                 fi
2124                 if test "X$myuname" = "X$newmyuname"; then
2125                         dflt=y
2126                 fi
2127         fi
2128         ;;
2129 *) dflt=y;;
2130 esac
2131
2132 : Get old answers from old config file if Configure was run on the
2133 : same system, otherwise use the hints.
2134 hint=default
2135 cd ..
2136 if test -f config.sh; then
2137         echo " "
2138         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2139         . UU/myread
2140         case "$ans" in
2141         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2142         *)  echo "Fetching default answers from your old config.sh file..." >&4
2143                 tmp_n="$n"
2144                 tmp_c="$c"
2145                 tmp_sh="$sh"
2146                 . ./config.sh
2147                 cp config.sh UU
2148                 n="$tmp_n"
2149                 c="$tmp_c"
2150                 : Older versions did not always set $sh.  Catch re-use of such
2151                 : an old config.sh.
2152                 case "$sh" in
2153                 '') sh="$tmp_sh" ;;
2154                 esac
2155                 hint=previous
2156                 ;;
2157         esac
2158 fi
2159 if test ! -f config.sh; then
2160         $cat <<EOM
2161
2162 First time through, eh?  I have some defaults handy for some systems
2163 that need some extra help getting the Configure answers right:
2164
2165 EOM
2166         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2167         dflt=''
2168         : Half the following guesses are probably wrong... If you have better
2169         : tests or hints, please send them to perlbug@perl.com
2170         : The metaconfig authors would also appreciate a copy...
2171         $test -f /irix && osname=irix
2172         $test -f /xenix && osname=sco_xenix
2173         $test -f /dynix && osname=dynix
2174         $test -f /dnix && osname=dnix
2175         $test -f /lynx.os && osname=lynxos
2176         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2177         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2178         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2179         $test -f /bin/mips && /bin/mips && osname=mips
2180         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2181                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2182         $test -d /usr/apollo/bin && osname=apollo
2183         $test -f /etc/saf/_sactab && osname=svr4
2184         $test -d /usr/include/minix && osname=minix
2185         if $test -d /MachTen -o -d /MachTen_Folder; then
2186                 osname=machten
2187                 if $test -x /sbin/version; then
2188                         osvers=`/sbin/version | $awk '{print $2}' |
2189                         $sed -e 's/[A-Za-z]$//'`
2190                 elif $test -x /usr/etc/version; then
2191                         osvers=`/usr/etc/version | $awk '{print $2}' |
2192                         $sed -e 's/[A-Za-z]$//'`
2193                 else
2194                         osvers="$2.$3"
2195                 fi
2196         fi
2197
2198         $test -f /sys/posix.dll &&
2199                 $test -f /usr/bin/what &&
2200                 set X `/usr/bin/what /sys/posix.dll` &&
2201                 $test "$3" = UWIN &&
2202                 osname=uwin &&
2203                 osvers="$5"
2204
2205         if $test -f $uname; then
2206                 set X $myuname
2207                 shift
2208
2209                 case "$5" in
2210                 fps*) osname=fps ;;
2211                 mips*)
2212                         case "$4" in
2213                         umips) osname=umips ;;
2214                         *) osname=mips ;;
2215                         esac;;
2216                 [23]100) osname=mips ;;
2217                 next*) osname=next ;;
2218                 i386*)
2219                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2220                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2221                                 osname='sco'
2222                                 osvers=$tmp
2223                         elif $test -f /etc/kconfig; then
2224                                 osname=isc
2225                                 if test "$lns" = "$ln -s"; then
2226                                         osvers=4
2227                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2228                                         osvers=3
2229                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2230                                         osvers=2
2231                                 fi
2232                         fi
2233                         tmp=''
2234                         ;;
2235                 pc*)
2236                         if test -n "$DJGPP"; then
2237                                 osname=dos
2238                                 osvers=djgpp
2239                         fi
2240                         ;;
2241                 esac
2242
2243                 case "$1" in
2244                 aix) osname=aix
2245                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2246                         case "$tmp" in
2247                         'not found') osvers="$4"."$3" ;;
2248                         '<3240'|'<>3240') osvers=3.2.0 ;;
2249                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2250                         '=3250'|'>3250') osvers=3.2.5 ;;
2251                         *) osvers=$tmp;;
2252                         esac
2253                         ;;
2254                 bsd386) osname=bsd386
2255                         osvers=`$uname -r`
2256                         ;;
2257                 cygwin*) osname=cygwin
2258                         osvers="$3"
2259                         ;;
2260                 *dc.osx) osname=dcosx
2261                         osvers="$3"
2262                         ;;
2263                 dnix) osname=dnix
2264                         osvers="$3"
2265                         ;;
2266                 domainos) osname=apollo
2267                         osvers="$3"
2268                         ;;
2269                 dgux) osname=dgux 
2270                         osvers="$3"
2271                         ;;
2272                 dynixptx*) osname=dynixptx
2273                         osvers=`echo "$4"|sed 's/^v//'`
2274                         ;;
2275                 freebsd) osname=freebsd 
2276                         osvers="$3" ;;
2277                 genix) osname=genix ;;
2278                 hp*) osname=hpux 
2279                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2280                         ;;
2281                 irix*) osname=irix
2282                         case "$3" in
2283                         4*) osvers=4 ;;
2284                         5*) osvers=5 ;;
2285                         *)      osvers="$3" ;;
2286                         esac
2287                         ;;
2288                 linux) osname=linux
2289                         case "$3" in
2290                         *)      osvers="$3" ;;
2291                         esac
2292                         ;;
2293                 MiNT) osname=mint
2294                         ;;
2295                 netbsd*) osname=netbsd
2296                         osvers="$3"
2297                         ;;
2298                 news-os) osvers="$3"
2299                         case "$3" in
2300                         4*) osname=newsos4 ;;
2301                         *) osname=newsos ;;
2302                         esac
2303                         ;;
2304                 next*) osname=next ;;
2305                 POSIX-BC | posix-bc ) osname=posix-bc
2306                         osvers="$3"
2307                         ;;
2308                 powerux | power_ux | powermax_os | powermaxos | \
2309                 powerunix | power_unix) osname=powerux
2310                         osvers="$3"
2311                         ;;
2312                 qnx) osname=qnx
2313                         osvers="$4"
2314                         ;;
2315                 solaris) osname=solaris
2316                         case "$3" in
2317                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2318                         *)      osvers="$3" ;;
2319                         esac
2320                         ;;
2321                 sunos) osname=sunos
2322                         case "$3" in
2323                         5*) osname=solaris
2324                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2325                         *)      osvers="$3" ;;
2326                         esac
2327                         ;;
2328                 titanos) osname=titanos
2329                         case "$3" in
2330                         1*) osvers=1 ;;
2331                         2*) osvers=2 ;;
2332                         3*) osvers=3 ;;
2333                         4*) osvers=4 ;;
2334                         *)      osvers="$3" ;;
2335                         esac
2336                         ;;
2337                 ultrix) osname=ultrix
2338                         osvers="$3"
2339                         ;;
2340                 osf1|mls+)      case "$5" in
2341                                 alpha)
2342                                         osname=dec_osf
2343                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2344                                         ;;
2345                         hp*)    osname=hp_osf1  ;;
2346                         mips)   osname=mips_osf1 ;;
2347                         esac
2348                         ;;
2349                 unixware) osname=svr5
2350                         osvers="$4"
2351                         ;;
2352                 uts) osname=uts
2353                         osvers="$3"
2354                         ;;
2355                 $2) case "$osname" in
2356                         *isc*) ;;
2357                         *freebsd*) ;;
2358                         svr*)
2359                                 : svr4.x or possibly later
2360                                 case "svr$3" in 
2361                                 ${osname}*)
2362                                         osname=svr$3
2363                                         osvers=$4
2364                                         ;;
2365                                 esac
2366                                 case "$osname" in
2367                                 svr4.0)
2368                                         : Check for ESIX
2369                                         if test -f /stand/boot ; then
2370                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2371                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2372                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2373                                                         if test -n "$isesix"; then
2374                                                                 osname=esix4
2375                                                         fi
2376                                                 fi
2377                                         fi
2378                                         ;;
2379                                 esac
2380                                 ;;
2381                         *)      if test -f /etc/systemid; then
2382                                         osname=sco
2383                                         set `echo $3 | $sed 's/\./ /g'` $4
2384                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2385                                                 osvers=$1.$2.$3
2386                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2387                                                 osvers=$1.$2
2388                                         elif $test -f $src/hints/sco_$1.sh; then
2389                                                 osvers=$1
2390                                         fi
2391                                 else
2392                                         case "$osname" in
2393                                         '') : Still unknown.  Probably a generic Sys V.
2394                                                 osname="sysv"
2395                                                 osvers="$3"
2396                                                 ;;
2397                                         esac
2398                                 fi
2399                                 ;;
2400                         esac
2401                         ;;
2402                 *)      case "$osname" in
2403                         '') : Still unknown.  Probably a generic BSD.
2404                                 osname="$1"
2405                                 osvers="$3"
2406                                 ;;
2407                         esac
2408                         ;;
2409                 esac
2410         else
2411                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2412                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2413                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2414                                 osname=news_os
2415                         fi
2416                         $rm -f UU/kernel.what
2417                 elif test -d c:/.; then
2418                         set X $myuname
2419                         osname=os2
2420                         osvers="$5"
2421                 fi
2422         fi
2423         
2424         : Now look for a hint file osname_osvers, unless one has been
2425         : specified already.
2426         case "$hintfile" in
2427         ''|' ')
2428                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2429                 : Also try without trailing minor version numbers.
2430                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2431                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2432                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2433                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2434                 case "$file" in
2435                 '') dflt=none ;;
2436                 *)  case "$osvers" in
2437                         '') dflt=$file
2438                                 ;;
2439                         *)  if $test -f $src/hints/$file.sh ; then
2440                                         dflt=$file
2441                                 elif $test -f $src/hints/$xfile.sh ; then
2442                                         dflt=$xfile
2443                                 elif $test -f $src/hints/$xxfile.sh ; then
2444                                         dflt=$xxfile
2445                                 elif $test -f $src/hints/$xxxfile.sh ; then
2446                                         dflt=$xxxfile
2447                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2448                                         dflt=$xxxxfile
2449                                 elif $test -f "$src/hints/${osname}.sh" ; then
2450                                         dflt="${osname}"
2451                                 else
2452                                         dflt=none
2453                                 fi
2454                                 ;;
2455                         esac
2456                         ;;
2457                 esac
2458                 if $test -f Policy.sh ; then
2459                         case "$dflt" in
2460                         *Policy*) ;;
2461                         none) dflt="Policy" ;;
2462                         *) dflt="Policy $dflt" ;;
2463                         esac
2464                 fi
2465                 ;;
2466         *)
2467                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2468                 ;;
2469         esac
2470
2471         if $test -f Policy.sh ; then
2472                 $cat <<EOM
2473
2474 There's also a Policy hint file available, which should make the
2475 site-specific (policy) questions easier to answer.
2476 EOM
2477
2478         fi
2479
2480         $cat <<EOM
2481
2482 You may give one or more space-separated answers, or "none" if appropriate.
2483 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2484 is a good thing.  DO NOT give a wrong version or a wrong OS.
2485
2486 EOM
2487
2488         rp="Which of these apply, if any?"
2489         . UU/myread
2490         tans=$ans
2491         for file in $tans; do
2492                 if $test X$file = XPolicy -a -f Policy.sh; then
2493                         . Policy.sh
2494                         $cat Policy.sh >> UU/config.sh
2495                 elif $test -f $src/hints/$file.sh; then
2496                         . $src/hints/$file.sh
2497                         $cat $src/hints/$file.sh >> UU/config.sh
2498                 elif $test X$tans = X -o X$tans = Xnone ; then
2499                         : nothing
2500                 else
2501                         : Give one chance to correct a possible typo.
2502                         echo "$file.sh does not exist"
2503                         dflt=$file
2504                         rp="hint to use instead?"
2505                         . UU/myread
2506                         for file in $ans; do
2507                                 if $test -f "$src/hints/$file.sh"; then
2508                                         . $src/hints/$file.sh
2509                                         $cat $src/hints/$file.sh >> UU/config.sh
2510                                 elif $test X$ans = X -o X$ans = Xnone ; then
2511                                         : nothing
2512                                 else
2513                                         echo "$file.sh does not exist -- ignored."
2514                                 fi
2515                         done
2516                 fi
2517         done
2518
2519         hint=recommended
2520         : Remember our hint file for later.
2521         if $test -f "$src/hints/$file.sh" ; then
2522                 hintfile="$file"
2523         else
2524                 hintfile=''
2525         fi
2526 fi
2527 cd UU
2528 ;;
2529 *)
2530         echo " "
2531         echo "Fetching default answers from $config_sh..." >&4
2532         tmp_n="$n"
2533         tmp_c="$c"
2534         cd ..
2535         cp $config_sh config.sh 2>/dev/null
2536         chmod +w config.sh
2537         . ./config.sh
2538         cd UU
2539         cp ../config.sh .
2540         n="$tmp_n"
2541         c="$tmp_c"
2542         hint=previous
2543         ;;
2544 esac
2545 test "$override" && . ./optdef.sh
2546 myuname="$newmyuname"
2547
2548 : Restore computed paths
2549 for file in $loclist $trylist; do
2550         eval $file="\$_$file"
2551 done
2552
2553 cat << EOM
2554
2555 Configure uses the operating system name and version to set some defaults.
2556 The default value is probably right if the name rings a bell. Otherwise,
2557 since spelling matters for me, either accept the default or answer "none"
2558 to leave it blank.
2559
2560 EOM
2561 case "$osname" in
2562         ''|' ')
2563                 case "$hintfile" in
2564                 ''|' '|none) dflt=none ;;
2565                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2566                 esac
2567                 ;;
2568         *) dflt="$osname" ;;
2569 esac
2570 rp="Operating system name?"
2571 . ./myread
2572 case "$ans" in
2573 none)  osname='' ;;
2574 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2575 esac
2576 echo " "
2577 case "$osvers" in
2578         ''|' ')
2579                 case "$hintfile" in
2580                 ''|' '|none) dflt=none ;;
2581                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2582                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2583                         case "$dflt" in
2584                         ''|' ') dflt=none ;;
2585                         esac
2586                         ;;
2587                 esac
2588                 ;;
2589         *) dflt="$osvers" ;;
2590 esac
2591 rp="Operating system version?"
2592 . ./myread
2593 case "$ans" in
2594 none)  osvers='' ;;
2595 *) osvers="$ans" ;;
2596 esac
2597
2598
2599 . ./posthint.sh
2600
2601 : who configured the system
2602 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2603 cf_by=`(logname) 2>/dev/null`
2604 case "$cf_by" in
2605 "")
2606         cf_by=`(whoami) 2>/dev/null`
2607         case "$cf_by" in
2608         "") cf_by=unknown ;;
2609         esac ;;
2610 esac
2611
2612 : set up the script used to warn in case of inconsistency
2613 cat <<EOS >whoa
2614 $startsh
2615 EOS
2616 cat <<'EOSC' >>whoa
2617 dflt=y
2618 echo " "
2619 echo "*** WHOA THERE!!! ***" >&4
2620 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2621 rp="    Keep the $hint value?"
2622 . ./myread
2623 case "$ans" in
2624 y) td=$was; tu=$was;;
2625 esac
2626 EOSC
2627
2628 : function used to set $1 to $val
2629 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2630 case "$val$was" in
2631 $define$undef) . ./whoa; eval "$var=\$td";;
2632 $undef$define) . ./whoa; eval "$var=\$tu";;
2633 *) eval "$var=$val";;
2634 esac'
2635
2636 case "$usethreads" in
2637 $define|true|[yY]*)     dflt='y';;
2638 *) dflt='n';;
2639 esac
2640 cat <<EOM
2641
2642 Perl can be built to take advantage of threads on some systems.
2643 To do so, Configure can be run with -Dusethreads.
2644
2645 Note that threading is a highly experimental feature, and
2646 some known race conditions still remain.  If you choose to try
2647 it, be very sure to not actually deploy it for production
2648 purposes.  README.threads has more details, and is required
2649 reading if you enable threads.
2650
2651 If this doesn't make any sense to you, just accept the default '$dflt'.
2652 EOM
2653 rp='Build a threading Perl?'
2654 . ./myread
2655 case "$ans" in
2656 y|Y)    val="$define" ;;
2657 *)      val="$undef" ;;
2658 esac
2659 set usethreads
2660 eval $setvar
2661
2662 case "$usethreads" in
2663 $define)
2664         $cat <<EOM
2665
2666 As of 5.5.640, Perl has two different internal threading implementations,
2667 the 5.005 version (5005threads) and an interpreter-based version
2668 (ithreads) that has one interpreter per thread.  Both are very 
2669 experimental.  This arrangement exists to help developers work out
2670 which one is better.
2671
2672 If you're a casual user, you probably don't want interpreter-threads
2673 at this time.  There doesn't yet exist a way to create threads from
2674 within Perl in this model, i.e., "use Thread;" will NOT work.
2675 EOM
2676         : Default to ithreads unless overridden on command line or with
2677         : old config.sh
2678         dflt='y'
2679         case "$use5005threads" in
2680                 $define|true|[yY]*) dflt='n';;
2681         esac
2682         case "$useithreads" in
2683                 $undef|false|[nN]*) dflt='n';;
2684         esac
2685         rp='Use interpreter-based ithreads?'
2686         . ./myread
2687         case "$ans" in
2688         y|Y)    val="$define" ;;
2689         *)      val="$undef" ;;
2690         esac
2691         set useithreads
2692         eval $setvar
2693         : Now set use5005threads to the opposite value.
2694         case "$useithreads" in
2695         $define) val="$undef" ;;
2696         *) val="$define" ;;
2697         esac
2698         set use5005threads
2699         eval $setvar
2700         ;;
2701 *)
2702         useithreads="$undef"
2703         use5005threads="$undef"
2704         ;;
2705 esac
2706
2707 case "$d_oldpthreads" in
2708 '')     : Configure tests would be welcome here.  For now, assume undef.
2709         val="$undef" ;;
2710 *)      val="$d_oldpthreads" ;;
2711 esac
2712 set d_oldpthreads
2713 eval $setvar
2714
2715
2716 case "$usethreads" in
2717 "$define"|true|[yY]*)
2718 : Look for a hint-file generated 'call-back-unit'.  If the
2719 : user has specified that a threading perl is to be built,
2720 : we may need to set or change some other defaults.
2721         if $test -f usethreads.cbu; then
2722                 echo "Your platform has some specific hints for threaded builds, using them..."
2723                 . ./usethreads.cbu
2724         else
2725                 $cat <<EOM
2726 (Your platform doesn't have any specific hints for threaded builds.
2727  Assuming POSIX threads, then.)
2728 EOM
2729         fi
2730         ;;
2731 esac
2732
2733 cat <<EOM
2734
2735 Perl can be built so that multiple Perl interpreters can coexist
2736 within the same Perl executable.
2737 EOM
2738
2739 case "$useithreads" in
2740 $define)
2741         cat <<EOM
2742 This multiple interpreter support is required for interpreter-based threads.
2743 EOM
2744         val="$define"
2745         ;;
2746 *)      case "$usemultiplicity" in
2747         $define|true|[yY]*)     dflt='y';;
2748         *) dflt='n';;
2749         esac
2750         echo " "
2751         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2752         rp='Build Perl for multiplicity?'
2753         . ./myread
2754         case "$ans" in
2755         y|Y)    val="$define" ;;
2756         *)      val="$undef" ;;
2757         esac
2758         ;;
2759 esac
2760 set usemultiplicity
2761 eval $setvar
2762
2763 : determine where manual pages are on this system
2764 echo " "
2765 case "$sysman" in
2766 '') 
2767         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2768         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2769         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2770         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2771         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2772         sysman=`./loc . /usr/man/man1 $syspath`
2773         ;;
2774 esac
2775 if $test -d "$sysman"; then
2776         echo "System manual is in $sysman." >&4
2777 else
2778         echo "Could not find manual pages in source form." >&4
2779 fi
2780
2781 : see what memory models we can support
2782 case "$models" in
2783 '')
2784         $cat >pdp11.c <<'EOP'
2785 int main() {
2786 #ifdef pdp11
2787         exit(0);
2788 #else
2789         exit(1);
2790 #endif
2791 }
2792 EOP
2793         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2794         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2795                 dflt='unsplit split'
2796         else
2797                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2798                 case "$tans" in
2799                 X) dflt='none';;
2800                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2801                                 dflt='small'
2802                         else
2803                                 dflt=''
2804                         fi
2805                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2806                                 dflt="$dflt medium"
2807                         fi
2808                         if $test -d /lib/large || $test -d /usr/lib/large; then
2809                                 dflt="$dflt large"
2810                         fi
2811                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2812                                 dflt="$dflt huge"
2813                         fi
2814                 esac
2815         fi;;
2816 *) dflt="$models";;
2817 esac
2818 $cat <<EOM
2819  
2820 Some systems have different model sizes.  On most systems they are called
2821 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2822 split.  If your system doesn't support different memory models, say "none".
2823 If you wish to force everything to one memory model, say "none" here and
2824 put the appropriate flags later when it asks you for other cc and ld flags.
2825 Venix systems may wish to put "none" and let the compiler figure things out.
2826 (In the following question multiple model names should be space separated.)
2827
2828 The default for most systems is "none".
2829
2830 EOM
2831 rp="Which memory models are supported?"
2832 . ./myread
2833 models="$ans"
2834
2835 case "$models" in
2836 none)
2837         small=''
2838         medium=''
2839         large=''
2840         huge=''
2841         unsplit=''
2842         split=''
2843         ;;
2844 *split)
2845         case "$split" in
2846         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2847                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2848                         dflt='-i'
2849                 else
2850                         dflt='none'
2851                 fi;;
2852         *) dflt="$split";;
2853         esac
2854         rp="What flag indicates separate I and D space?"
2855         . ./myread
2856         tans="$ans"
2857         case "$tans" in
2858         none) tans='';;
2859         esac
2860         split="$tans"
2861         unsplit='';;
2862 *large*|*small*|*medium*|*huge*)
2863         case "$models" in
2864         *large*)
2865                 case "$large" in
2866                 '') dflt='-Ml';;
2867                 *) dflt="$large";;
2868                 esac
2869         rp="What flag indicates large model?"
2870         . ./myread
2871         tans="$ans"
2872         case "$tans" in
2873         none) tans='';
2874         esac
2875         large="$tans";;
2876         *) large='';;
2877         esac
2878         case "$models" in
2879         *huge*) case "$huge" in
2880                 '') dflt='-Mh';;
2881                 *) dflt="$huge";;
2882                 esac
2883                 rp="What flag indicates huge model?"
2884                 . ./myread
2885                 tans="$ans"
2886                 case "$tans" in
2887                 none) tans='';
2888                 esac
2889                 huge="$tans";;
2890         *) huge="$large";;
2891         esac
2892         case "$models" in
2893         *medium*) case "$medium" in
2894                 '') dflt='-Mm';;
2895                 *) dflt="$medium";;
2896                 esac
2897                 rp="What flag indicates medium model?"
2898                 . ./myread
2899                 tans="$ans"
2900                 case "$tans" in
2901                 none) tans='';
2902                 esac
2903                 medium="$tans";;
2904         *) medium="$large";;
2905         esac
2906         case "$models" in
2907         *small*) case "$small" in
2908                 '') dflt='none';;
2909                 *) dflt="$small";;
2910                 esac
2911                 rp="What flag indicates small model?"
2912                 . ./myread
2913                 tans="$ans"
2914                 case "$tans" in
2915                 none) tans='';
2916                 esac
2917                 small="$tans";;
2918         *) small='';;
2919         esac
2920         ;;
2921 *)
2922         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2923         ;;
2924 esac
2925 $rm -f pdp11.* pdp11
2926
2927 : make some quick guesses about what we are up against
2928 echo " "
2929 $echo $n "Hmm...  $c"
2930 echo exit 1 >bsd
2931 echo exit 1 >usg
2932 echo exit 1 >v7
2933 echo exit 1 >osf1
2934 echo exit 1 >eunice
2935 echo exit 1 >xenix
2936 echo exit 1 >venix
2937 echo exit 1 >os2
2938 d_bsd="$undef"
2939 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2940 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2941 then
2942         echo "Looks kind of like an OSF/1 system, but we'll see..."
2943         echo exit 0 >osf1
2944 elif test `echo abc | tr a-z A-Z` = Abc ; then
2945         xxx=`./loc addbib blurfl $pth`
2946         if $test -f $xxx; then
2947         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2948                 echo exit 0 >bsd
2949                 echo exit 0 >usg
2950         else
2951                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2952                         echo "Looks kind of like an extended USG system, but we'll see..."
2953                 else
2954                         echo "Looks kind of like a USG system, but we'll see..."
2955                 fi
2956                 echo exit 0 >usg
2957         fi
2958 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2959         echo "Looks kind of like a BSD system, but we'll see..."
2960         d_bsd="$define"
2961         echo exit 0 >bsd
2962 else
2963         echo "Looks kind of like a Version 7 system, but we'll see..."
2964         echo exit 0 >v7
2965 fi
2966 case "$eunicefix" in
2967 *unixtovms*)
2968         $cat <<'EOI'
2969 There is, however, a strange, musty smell in the air that reminds me of
2970 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2971 EOI
2972         echo exit 0 >eunice
2973         d_eunice="$define"
2974 : it so happens the Eunice I know will not run shell scripts in Unix format
2975         ;;
2976 *)
2977         echo " "
2978         echo "Congratulations.  You aren't running Eunice."
2979         d_eunice="$undef"
2980         ;;
2981 esac
2982 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2983 case "$p_" in
2984 :) ;;
2985 *)
2986         $cat <<'EOI'
2987 I have the feeling something is not exactly right, however...don't tell me...
2988 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2989 EOI
2990         echo exit 0 >os2
2991         ;;
2992 esac
2993 if test -f /xenix; then
2994         echo "Actually, this looks more like a XENIX system..."
2995         echo exit 0 >xenix
2996         d_xenix="$define"
2997 else
2998         echo " "
2999         echo "It's not Xenix..."
3000         d_xenix="$undef"
3001 fi
3002 chmod +x xenix
3003 $eunicefix xenix
3004 if test -f /venix; then
3005         echo "Actually, this looks more like a VENIX system..."
3006         echo exit 0 >venix
3007 else
3008         echo " "
3009         if ./xenix; then
3010                 : null
3011         else
3012                 echo "Nor is it Venix..."
3013         fi
3014 fi
3015 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3016 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3017 $rm -f foo
3018
3019 : see if we need a special compiler
3020 echo " "
3021 if ./usg; then
3022         case "$cc" in
3023         '') case "$Mcc" in
3024                 /*) dflt='Mcc';;
3025                 *) case "$large" in
3026                         -M*) dflt='cc';;
3027                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3028                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3029                                                 dflt='cc'
3030                                         else
3031                                                 dflt='cc -M'
3032                                         fi
3033                                 else
3034                                         dflt='cc'
3035                                 fi;;
3036                         esac;;
3037                 esac;;
3038         *)  dflt="$cc";;
3039         esac
3040         case "$dflt" in
3041         *M*)    $cat <<'EOM'
3042 On some older systems the default C compiler will not resolve multiple global
3043 references that happen to have the same name.  On some such systems the "Mcc"
3044 command may be used to force these to be resolved.  On other systems a "cc -M"
3045 command is required.  (Note that the -M flag on other systems indicates a
3046 memory model to use!) If you have the Gnu C compiler, you might wish to use
3047 that instead.
3048
3049 EOM
3050         ;;
3051         esac
3052         rp="Use which C compiler?"
3053         . ./myread
3054         cc="$ans"
3055 else
3056         case "$cc" in
3057         '') dflt=cc;;
3058         *) dflt="$cc";;
3059         esac
3060         rp="Use which C compiler?"
3061         . ./myread
3062         cc="$ans"
3063 fi
3064 : Look for a hint-file generated 'call-back-unit'.  Now that the
3065 : user has specified the compiler, we may need to set or change some
3066 : other defaults.
3067 if $test -f cc.cbu; then
3068     . ./cc.cbu
3069 fi
3070 echo " "
3071 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3072 $cat >gccvers.c <<EOM
3073 #include <stdio.h>
3074 int main() {
3075 #ifdef __GNUC__
3076 #ifdef __VERSION__
3077         printf("%s\n", __VERSION__);
3078 #else
3079         printf("%s\n", "1");
3080 #endif
3081 #endif
3082         exit(0);
3083 }
3084 EOM
3085 if $cc $ldflags -o gccvers gccvers.c; then
3086         gccversion=`./gccvers`
3087         case "$gccversion" in
3088         '') echo "You are not using GNU cc." ;;
3089         *)  echo "You are using GNU cc $gccversion."
3090             ;;
3091         esac
3092 else
3093         echo " "
3094         echo "*** WHOA THERE!!! ***" >&4
3095         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3096         case "$knowitall" in
3097         '')
3098         echo "    You'd better start hunting for one and let me know about it." >&4
3099                 exit 1
3100                 ;;
3101         esac
3102 fi
3103 $rm -f gccvers*
3104 case "$gccversion" in
3105 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3106 esac
3107
3108 : decide how portable to be.  Allow command line overrides.
3109 case "$d_portable" in
3110 "$undef") ;;
3111 *)      d_portable="$define" ;;
3112 esac
3113
3114 : set up shell script to do ~ expansion
3115 cat >filexp <<EOSS
3116 $startsh
3117 : expand filename
3118 case "\$1" in
3119  ~/*|~)
3120         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3121         ;;
3122  ~*)
3123         if $test -f /bin/csh; then
3124                 /bin/csh -f -c "glob \$1"
3125                 failed=\$?
3126                 echo ""
3127                 exit \$failed
3128         else
3129                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3130                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3131                 if $test ! -d "\$dir"; then
3132                         me=\`basename \$0\`
3133                         echo "\$me: can't locate home directory for: \$name" >&2
3134                         exit 1
3135                 fi
3136                 case "\$1" in
3137                 */*)
3138                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3139                         ;;
3140                 *)
3141                         echo \$dir
3142                         ;;
3143                 esac
3144         fi
3145         ;;
3146 *)
3147         echo \$1
3148         ;;
3149 esac
3150 EOSS
3151 chmod +x filexp
3152 $eunicefix filexp
3153
3154 : now set up to get a file name
3155 cat <<EOS >getfile
3156 $startsh
3157 EOS
3158 cat <<'EOSC' >>getfile
3159 tilde=''
3160 fullpath=''
3161 already=''
3162 skip=''
3163 none_ok=''
3164 exp_file=''
3165 nopath_ok=''
3166 orig_rp="$rp"
3167 orig_dflt="$dflt"
3168 case "$gfpth" in
3169 '') gfpth='.' ;;
3170 esac
3171
3172 case "$fn" in
3173 *\(*)
3174         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3175         fn=`echo $fn | sed 's/(.*)//'`
3176         ;;
3177 esac
3178
3179 case "$fn" in
3180 *:*)
3181         loc_file=`expr $fn : '.*:\(.*\)'`
3182         fn=`expr $fn : '\(.*\):.*'`
3183         ;;
3184 esac
3185
3186 case "$fn" in
3187 *~*) tilde=true;;
3188 esac
3189 case "$fn" in
3190 */*) fullpath=true;;
3191 esac
3192 case "$fn" in
3193 *+*) skip=true;;
3194 esac
3195 case "$fn" in
3196 *n*) none_ok=true;;
3197 esac
3198 case "$fn" in
3199 *e*) exp_file=true;;
3200 esac
3201 case "$fn" in
3202 *p*) nopath_ok=true;;
3203 esac
3204
3205 case "$fn" in
3206 *f*) type='File';;
3207 *d*) type='Directory';;
3208 *l*) type='Locate';;
3209 esac
3210
3211 what="$type"
3212 case "$what" in
3213 Locate) what='File';;
3214 esac
3215
3216 case "$exp_file" in
3217 '')
3218         case "$d_portable" in
3219         "$define") ;;
3220         *) exp_file=true;;
3221         esac
3222         ;;
3223 esac
3224
3225 cd ..
3226 while test "$type"; do
3227         redo=''
3228         rp="$orig_rp"
3229         dflt="$orig_dflt"
3230         case "$tilde" in
3231         true) rp="$rp (~name ok)";;
3232         esac
3233         . UU/myread
3234         if test -f UU/getfile.ok && \
3235                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3236         then
3237                 value="$ans"
3238                 ansexp="$ans"
3239                 break
3240         fi
3241         case "$ans" in
3242         none)
3243                 value=''
3244                 ansexp=''
3245                 case "$none_ok" in
3246                 true) type='';;
3247                 esac
3248                 ;;
3249         *)
3250                 case "$tilde" in
3251                 '') value="$ans"
3252                         ansexp="$ans";;
3253                 *)
3254                         value=`UU/filexp $ans`
3255                         case $? in
3256                         0)
3257                                 if test "$ans" != "$value"; then
3258                                         echo "(That expands to $value on this system.)"
3259                                 fi
3260                                 ;;
3261                         *) value="$ans";;
3262                         esac
3263                         ansexp="$value"
3264                         case "$exp_file" in
3265                         '') value="$ans";;
3266                         esac
3267                         ;;
3268                 esac
3269                 case "$fullpath" in
3270                 true)
3271                         case "$ansexp" in
3272                         /*) value="$ansexp" ;;
3273                         *)
3274                                 redo=true
3275                                 case "$already" in
3276                                 true)
3277                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3278                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3279                                         ;;
3280                                 *)
3281                                 echo "Please give a full path name, starting with slash." >&4
3282                                         case "$tilde" in
3283                                         true)
3284                                 echo "Note that using ~name is ok provided it expands well." >&4
3285                                                 already=true
3286                                                 ;;
3287                                         esac
3288                                 esac
3289                                 ;;
3290                         esac
3291                         ;;
3292                 esac
3293                 case "$redo" in
3294                 '')
3295                         case "$type" in
3296                         File)
3297                                 for fp in $gfpth; do
3298                                         if test "X$fp" = X.; then
3299                                             pf="$ansexp"
3300                                         else    
3301                                             pf="$fp/$ansexp"
3302                                         fi
3303                                         if test -f "$pf"; then
3304                                                 type=''
3305                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3306                                         then
3307                                                 echo "($value is not a plain file, but that's ok.)"
3308                                                 type=''
3309                                         fi
3310                                         if test X"$type" = X; then
3311                                             value="$pf"
3312                                             break
3313                                         fi
3314                                 done
3315                                 ;;
3316                         Directory)
3317                                 for fp in $gfpth; do
3318                                         if test "X$fp" = X.; then
3319                                             dir="$ans"
3320                                             direxp="$ansexp"
3321                                         else    
3322                                             dir="$fp/$ansexp"
3323                                             direxp="$fp/$ansexp"
3324                                         fi
3325                                         if test -d "$direxp"; then
3326                                                 type=''
3327                                                 value="$dir"
3328                                                 break
3329                                         fi
3330                                 done
3331                                 ;;
3332                         Locate)
3333                                 if test -d "$ansexp"; then
3334                                         echo "(Looking for $loc_file in directory $value.)"
3335                                         value="$value/$loc_file"
3336                                         ansexp="$ansexp/$loc_file"
3337                                 fi
3338                                 if test -f "$ansexp"; then
3339                                         type=''
3340                                 fi
3341                                 case "$nopath_ok" in
3342                                 true)   case "$value" in
3343                                         */*) ;;
3344                                         *)      echo "Assuming $value will be in people's path."
3345                                                 type=''
3346                                                 ;;
3347                                         esac
3348                                         ;;
3349                                 esac
3350                                 ;;
3351                         esac
3352
3353                         case "$skip" in
3354                         true) type='';
3355                         esac
3356
3357                         case "$type" in
3358                         '') ;;
3359                         *)
3360                                 if test "$fastread" = yes; then
3361                                         dflt=y
3362                                 else
3363                                         dflt=n
3364                                 fi
3365                                 rp="$what $value doesn't exist.  Use that name anyway?"
3366                                 . UU/myread
3367                                 dflt=''
3368                                 case "$ans" in
3369                                 y*) type='';;
3370                                 *) echo " ";;
3371                                 esac
3372                                 ;;
3373                         esac
3374                         ;;
3375                 esac
3376                 ;;
3377         esac
3378 done
3379 cd UU
3380 ans="$value"
3381 rp="$orig_rp"
3382 dflt="$orig_dflt"
3383 rm -f getfile.ok
3384 test "X$gfpthkeep" != Xy && gfpth=""
3385 EOSC
3386
3387 : What should the include directory be ?
3388 echo " "
3389 $echo $n "Hmm...  $c"
3390 dflt='/usr/include'
3391 incpath=''
3392 mips_type=''
3393 if $test -f /bin/mips && /bin/mips; then
3394         echo "Looks like a MIPS system..."
3395         $cat >usr.c <<'EOCP'
3396 #ifdef SYSTYPE_BSD43
3397 /bsd43
3398 #endif
3399 EOCP
3400         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3401                 dflt='/bsd43/usr/include'
3402                 incpath='/bsd43'
3403                 mips_type='BSD 4.3'
3404         else
3405                 mips_type='System V'
3406         fi
3407         $rm -f usr.c usr.out
3408         echo "and you're compiling with the $mips_type compiler and libraries."
3409         xxx_prompt=y
3410         echo "exit 0" >mips
3411 else
3412         echo "Doesn't look like a MIPS system."
3413         xxx_prompt=n
3414         echo "exit 1" >mips
3415 fi
3416 chmod +x mips
3417 $eunicefix mips
3418 case "$usrinc" in
3419 '') ;;
3420 *) dflt="$usrinc";;
3421 esac
3422 case "$xxx_prompt" in
3423 y)      fn=d/
3424         echo " "
3425         rp='Where are the include files you want to use?'
3426         . ./getfile
3427         usrinc="$ans"
3428         ;;
3429 *)      usrinc="$dflt"
3430         ;;
3431 esac
3432
3433 : see how we invoke the C preprocessor
3434 echo " "
3435 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3436 cat <<'EOT' >testcpp.c
3437 #define ABC abc
3438 #define XYZ xyz
3439 ABC.XYZ
3440 EOT
3441 cd ..
3442 if test ! -f cppstdin; then
3443         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3444                 # AIX cc -E doesn't show the absolute headerfile
3445                 # locations but we'll cheat by using the -M flag.
3446                 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
3447         else
3448                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3449         fi
3450 else
3451         echo "Keeping your $hint cppstdin wrapper."
3452 fi
3453 chmod 755 cppstdin
3454 wrapper=`pwd`/cppstdin
3455 ok='false'
3456 cd UU
3457
3458 if $test "X$cppstdin" != "X" && \
3459         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3460         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3461 then
3462         echo "You used to use $cppstdin $cppminus so we'll use that again."
3463         case "$cpprun" in
3464         '') echo "But let's see if we can live without a wrapper..." ;;
3465         *)
3466                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3467                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3468                 then
3469                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3470                         ok='true'
3471                 else
3472                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3473                 fi
3474                 ;;
3475         esac
3476 else
3477         case "$cppstdin" in
3478         '') ;;
3479         *)
3480                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3481                 ;;
3482         esac
3483 fi
3484
3485 if $ok; then
3486         : nothing
3487 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3488         $cc -E <testcpp.c >testcpp.out 2>&1; \
3489         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3490         echo "Yup, it does."
3491         x_cpp="$cc -E"
3492         x_minus='';
3493 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3494         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3495         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3496         echo "Yup, it does."
3497         x_cpp="$cc -E"
3498         x_minus='-';
3499 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3500         $cc -P <testcpp.c >testcpp.out 2>&1; \
3501         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3502         echo "Yipee, that works!"
3503         x_cpp="$cc -P"
3504         x_minus='';
3505 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3506         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3507         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3508         echo "At long last!"
3509         x_cpp="$cc -P"
3510         x_minus='-';
3511 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3512         $cpp <testcpp.c >testcpp.out 2>&1; \
3513         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3514         echo "It works!"
3515         x_cpp="$cpp"
3516         x_minus='';
3517 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3518         $cpp - <testcpp.c >testcpp.out 2>&1; \
3519         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3520         echo "Hooray, it works!  I was beginning to wonder."
3521         x_cpp="$cpp"
3522         x_minus='-';
3523 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3524         $wrapper <testcpp.c >testcpp.out 2>&1; \
3525         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3526         x_cpp="$wrapper"
3527         x_minus=''
3528         echo "Eureka!"
3529 else
3530         dflt=''
3531         rp="No dice.  I can't find a C preprocessor.  Name one:"
3532         . ./myread
3533         x_cpp="$ans"
3534         x_minus=''
3535         $x_cpp <testcpp.c >testcpp.out 2>&1
3536         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3537                 echo "OK, that will do." >&4
3538         else
3539 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3540                 exit 1
3541         fi
3542 fi
3543
3544 case "$ok" in
3545 false)
3546         cppstdin="$x_cpp"
3547         cppminus="$x_minus"
3548         cpprun="$x_cpp"
3549         cpplast="$x_minus"
3550         set X $x_cpp
3551         shift
3552         case "$1" in
3553         "$cpp")
3554                 echo "Perhaps can we force $cc -E using a wrapper..."
3555                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3556                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3557                 then
3558                         echo "Yup, we can."
3559                         cppstdin="$wrapper"
3560                         cppminus='';
3561                 else
3562                         echo "Nope, we'll have to live without it..."
3563                 fi
3564                 ;;
3565         esac
3566         case "$cpprun" in
3567         "$wrapper")
3568                 cpprun=''
3569                 cpplast=''
3570                 ;;
3571         esac
3572         ;;
3573 esac
3574
3575 case "$cppstdin" in
3576 "$wrapper"|'cppstdin') ;;
3577 *) $rm -f $wrapper;;
3578 esac
3579 $rm -f testcpp.c testcpp.out
3580
3581 : Set private lib path
3582 case "$plibpth" in
3583 '') if ./mips; then
3584                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3585         fi;;
3586 esac
3587 case "$libpth" in
3588 ' ') dlist='';;
3589 '') dlist="$loclibpth $plibpth $glibpth";;
3590 *) dlist="$libpth";;
3591 esac
3592
3593 : Now check and see which directories actually exist, avoiding duplicates
3594 libpth=''
3595 for xxx in $dlist
3596 do
3597     if $test -d $xxx; then
3598                 case " $libpth " in
3599                 *" $xxx "*) ;;
3600                 *) libpth="$libpth $xxx";;
3601                 esac
3602     fi
3603 done
3604 $cat <<'EOM'
3605
3606 Some systems have incompatible or broken versions of libraries.  Among
3607 the directories listed in the question below, please remove any you
3608 know not to be holding relevant libraries, and add any that are needed.
3609 Say "none" for none.
3610
3611 EOM
3612 case "$libpth" in
3613 '') dflt='none';;
3614 *)
3615         set X $libpth
3616         shift
3617         dflt=${1+"$@"}
3618         ;;
3619 esac
3620 rp="Directories to use for library searches?"
3621 . ./myread
3622 case "$ans" in
3623 none) libpth=' ';;
3624 *) libpth="$ans";;
3625 esac
3626
3627 : compute shared library extension
3628 case "$so" in
3629 '')
3630         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3631                 dflt='sl'
3632         else
3633                 dflt='so'
3634         fi
3635         ;;
3636 *) dflt="$so";;
3637 esac
3638 $cat <<EOM
3639
3640 On some systems, shared libraries may be available.  Answer 'none' if
3641 you want to suppress searching of shared libraries for the remainder
3642 of this configuration.
3643
3644 EOM
3645 rp='What is the file extension used for shared libraries?'
3646 . ./myread
3647 so="$ans"
3648
3649 : Define several unixisms.
3650 : Hints files or command line option can be used to override them.
3651 : The convoluted testing is in case hints files set either the old
3652 : or the new name.
3653 case "$_exe" in
3654 '')     case "$exe_ext" in
3655     '') ;;
3656         *)      _exe="$exe_ext" ;;
3657         esac
3658         ;;
3659 esac
3660 case "$_a" in
3661 '')     case "$lib_ext" in
3662     '') _a='.a';;
3663         *)      _a="$lib_ext" ;;
3664         esac
3665         ;;
3666 esac
3667 case "$_o" in
3668 '') case "$obj_ext" in
3669         '')     _o='.o';;
3670         *)      _o="$obj_ext";;
3671         esac
3672         ;;
3673 esac
3674 case "$p_" in
3675 '') case "$path_sep" in
3676         '')     p_=':';;
3677         *)      p_="$path_sep";;
3678         esac
3679         ;;
3680 esac
3681 exe_ext=$_exe
3682 lib_ext=$_a
3683 obj_ext=$_o
3684 path_sep=$p_
3685
3686 : Which makefile gets called first.  This is used by make depend.
3687 case "$firstmakefile" in
3688 '') firstmakefile='makefile';;
3689 esac
3690
3691 case "$usesocks" in
3692 $define|true|[yY]*)     dflt='y';;
3693 *) dflt='n';;
3694 esac
3695 cat <<EOM
3696
3697 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3698 Configure must be run with -Dusesocks.
3699
3700 If this doesn't make any sense to you, just accept the default '$dflt'.
3701 EOM
3702 rp='Build Perl for SOCKS?'
3703 . ./myread
3704 case "$ans" in
3705 y|Y)    val="$define" ;;     
3706 *)      val="$undef" ;;
3707 esac
3708 set usesocks
3709 eval $setvar
3710
3711 : Looking for optional libraries
3712 echo " "
3713 echo "Checking for optional libraries..." >&4
3714 case "$libs" in
3715 ' '|'') dflt='';;
3716 *) dflt="$libs";;
3717 esac
3718 case "$libswanted" in
3719 '') libswanted='c_s';;
3720 esac
3721 case "$usesocks" in
3722 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3723 esac
3724 libsfound=''
3725 libsfiles=''
3726 libsdirs=''
3727 libspath=''
3728 for thisdir in $libpth $xlibpth; do
3729   test -d $thisdir && libspath="$libspath $thisdir"
3730 done
3731 for thislib in $libswanted; do
3732         for thisdir in $libspath; do
3733             xxx=''
3734             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3735                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3736                 $test -f "$xxx" && eval $libscheck
3737                 $test -f "$xxx" && libstyle=shared
3738             fi
3739             if test ! -f "$xxx"; then
3740                 xxx=$thisdir/lib$thislib.$so
3741                 $test -f "$xxx" && eval $libscheck
3742                 $test -f "$xxx" && libstyle=shared
3743             fi  
3744             if test ! -f "$xxx"; then
3745                 xxx=$thisdir/lib$thislib$_a
3746                 $test -f "$xxx" && eval $libscheck
3747                 $test -f "$xxx" && libstyle=static
3748             fi
3749             if test ! -f "$xxx"; then
3750                 xxx=$thisdir/$thislib$_a
3751                 $test -f "$xxx" && eval $libscheck
3752                 $test -f "$xxx" && libstyle=static
3753             fi
3754             if test ! -f "$xxx"; then
3755                 xxx=$thisdir/lib${thislib}_s$_a
3756                 $test -f "$xxx" && eval $libscheck
3757                 $test -f "$xxx" && libstyle=static
3758                 $test -f "$xxx" && thislib=${thislib}_s
3759             fi
3760             if test ! -f "$xxx"; then
3761                 xxx=$thisdir/Slib$thislib$_a
3762                 $test -f "$xxx" && eval $libscheck
3763                 $test -f "$xxx" && libstyle=static
3764             fi
3765             if $test -f "$xxx"; then
3766                 case "$libstyle" in
3767                 shared) echo "Found -l$thislib (shared)." ;;
3768                 static) echo "Found -l$thislib." ;;
3769                 *)      echo "Found -l$thislib ($libstyle)." ;;
3770                 esac
3771                 case " $dflt " in
3772                 *"-l$thislib "*);;
3773                 *) dflt="$dflt -l$thislib"
3774                    libsfound="$libsfound $xxx"
3775                    yyy=`basename $xxx`
3776                    libsfiles="$libsfiles $yyy"
3777                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3778                    case " $libsdirs " in
3779                    *" $yyy "*) ;;
3780                    *) libsdirs="$libsdirs $yyy" ;;
3781                    esac
3782                    ;;
3783                 esac
3784                 break
3785             fi  
3786         done
3787         if $test ! -f "$xxx"; then
3788             echo "No -l$thislib."
3789         fi
3790 done
3791 set X $dflt
3792 shift
3793 dflt="$*"
3794 case "$libs" in
3795 '') dflt="$dflt";;
3796 *) dflt="$libs";;
3797 esac
3798 case "$dflt" in
3799 ' '|'') dflt='none';;
3800 esac
3801
3802 $cat <<EOM
3803
3804 In order to compile $package on your machine, a number of libraries
3805 are usually needed.  Include any other special libraries here as well.
3806 Say "none" for none.  The default list is almost always right.
3807 EOM
3808
3809 echo " "
3810 rp="What libraries to use?"
3811 . ./myread
3812 case "$ans" in
3813 none) libs=' ';;
3814 *) libs="$ans";;
3815 esac
3816
3817 : determine optimization, if desired, or use for debug flag also
3818 case "$optimize" in
3819 ' '|$undef) dflt='none';;
3820 '') dflt='-O';;
3821 *) dflt="$optimize";;
3822 esac
3823 $cat <<EOH
3824
3825 By default, $package compiles with the -O flag to use the optimizer.
3826 Alternately, you might want to use the symbolic debugger, which uses
3827 the -g flag (on traditional Unix systems).  Either flag can be
3828 specified here.  To use neither flag, specify the word "none".
3829
3830 EOH
3831 rp="What optimizer/debugger flag should be used?"
3832 . ./myread
3833 optimize="$ans"
3834 case "$optimize" in
3835 'none') optimize=" ";;
3836 esac
3837
3838 dflt=''
3839 : We will not override a previous value, but we might want to
3840 : augment a hint file
3841 case "$hint" in
3842 default|recommended)
3843         case "$gccversion" in
3844         1*) dflt='-fpcc-struct-return' ;;
3845         esac
3846         case "$optimize" in
3847         *-g*) dflt="$dflt -DDEBUGGING";;
3848         esac
3849         case "$gccversion" in
3850         2*) if test -d /etc/conf/kconfig.d &&
3851                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3852                 then
3853                         dflt="$dflt -posix"
3854                 fi
3855                 ;;
3856         esac
3857         case "$gccversion" in
3858         1*) ;;
3859         2.[0-8]*) ;;
3860         ?*)     echo " "
3861                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3862                 echo 'int main(void) { return 0; }' > gcctest.c
3863                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3864                         echo "Yes, it does." 2>&1
3865                         case "$ccflags" in
3866                         *strict-aliasing*) 
3867                                 echo "Leaving current flags $ccflags alone." 2>&1
3868                                 ;;
3869                         *) dflt="$dflt -fno-strict-aliasing" ;;
3870                         esac
3871                 else
3872                         echo "Nope, it doesn't, but that's ok." 2>&1
3873                 fi
3874                 ;;
3875         esac
3876         ;;
3877 esac
3878
3879 case "$mips_type" in
3880 *BSD*|'') inclwanted="$locincpth $usrinc";;
3881 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3882 esac
3883 for thisincl in $inclwanted; do
3884         if $test -d $thisincl; then
3885                 if $test x$thisincl != x$usrinc; then
3886                         case "$dflt" in
3887                         *$thisincl*);;
3888                         *) dflt="$dflt -I$thisincl";;
3889                         esac
3890                 fi
3891         fi
3892 done
3893
3894 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3895         xxx=true;
3896 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3897         xxx=true;
3898 else
3899         xxx=false;
3900 fi;
3901 if $xxx; then
3902         case "$dflt" in
3903         *$2*);;
3904         *) dflt="$dflt -D$2";;
3905         esac;
3906 fi'
3907
3908 set signal.h LANGUAGE_C; eval $inctest
3909
3910 case "$usesocks" in
3911 $define)
3912         ccflags="$ccflags -DSOCKS"
3913         ;;
3914 esac
3915
3916 case "$hint" in
3917 default|recommended) dflt="$ccflags $dflt" ;;
3918 *) dflt="$ccflags";;
3919 esac
3920
3921 case "$dflt" in
3922 ''|' ') dflt=none;;
3923 esac
3924 $cat <<EOH
3925
3926 Your C compiler may want other flags.  For this question you should include
3927 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3928 but you should NOT include libraries or ld flags like -lwhatever.  If you
3929 want $package to honor its debug switch, you should include -DDEBUGGING here.
3930 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3931
3932 To use no flags, specify the word "none".
3933
3934 EOH
3935 set X $dflt
3936 shift
3937 dflt=${1+"$@"}
3938 rp="Any additional cc flags?"
3939 . ./myread
3940 case "$ans" in
3941 none) ccflags='';;
3942 *) ccflags="$ans";;
3943 esac
3944
3945 : the following weeds options from ccflags that are of no interest to cpp
3946 cppflags="$ccflags"
3947 case "$gccversion" in
3948 1*) cppflags="$cppflags -D__GNUC__"
3949 esac
3950 case "$mips_type" in
3951 '');;
3952 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3953 esac
3954 case "$cppflags" in
3955 '');;
3956 *)
3957         echo " "
3958         echo "Let me guess what the preprocessor flags are..." >&4
3959         set X $cppflags
3960         shift
3961         cppflags=''
3962         $cat >cpp.c <<'EOM'
3963 #define BLURFL foo
3964
3965 BLURFL xx LFRULB
3966 EOM
3967         previous=''
3968         for flag in $*
3969         do
3970                 case "$flag" in
3971                 -*) ftry="$flag";;
3972                 *) ftry="$previous $flag";;
3973                 esac
3974                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3975                         >cpp1.out 2>/dev/null && \
3976                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3977                         >cpp2.out 2>/dev/null && \
3978                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3979                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3980                 then
3981                         cppflags="$cppflags $ftry"
3982                         previous=''
3983                 else
3984                         previous="$flag"
3985                 fi
3986         done
3987         set X $cppflags
3988         shift
3989         cppflags=${1+"$@"}
3990         case "$cppflags" in
3991         *-*)  echo "They appear to be: $cppflags";;
3992         esac
3993         $rm -f cpp.c cpp?.out
3994         ;;
3995 esac
3996
3997 : flags used in final linking phase
3998 case "$ldflags" in
3999 '') if ./venix; then
4000                 dflt='-i -z'
4001         else
4002                 dflt=''
4003         fi
4004         case "$ccflags" in
4005         *-posix*) dflt="$dflt -posix" ;;
4006         esac
4007         ;;
4008 *) dflt="$ldflags";;
4009 esac
4010
4011 : Try to guess additional flags to pick up local libraries.
4012 for thislibdir in $libpth; do
4013         case " $loclibpth " in
4014         *" $thislibdir "*)
4015                 case "$dflt " in 
4016                 *"-L$thislibdir "*) ;;
4017                 *)  dflt="$dflt -L$thislibdir" ;;
4018                 esac
4019                 ;;
4020         esac
4021 done
4022
4023 case "$dflt" in
4024 '') dflt='none' ;;
4025 esac
4026
4027 $cat <<EOH
4028
4029 Your C linker may need flags.  For this question you should
4030 include -L/whatever and any other flags used by the C linker, but you
4031 should NOT include libraries like -lwhatever.
4032
4033 Make sure you include the appropriate -L/path flags if your C linker
4034 does not normally search all of the directories you specified above,
4035 namely
4036         $libpth
4037 To use no flags, specify the word "none".
4038
4039 EOH
4040
4041 rp="Any additional ld flags (NOT including libraries)?"
4042 . ./myread
4043 case "$ans" in
4044 none) ldflags='';;
4045 *) ldflags="$ans";;
4046 esac
4047 rmlist="$rmlist pdp11"
4048
4049 : coherency check
4050 echo " "
4051 echo "Checking your choice of C compiler and flags for coherency..." >&4
4052 $cat > try.c <<'EOF'
4053 #include <stdio.h>
4054 int main() { printf("Ok\n"); exit(0); }
4055 EOF
4056 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4057 shift
4058 $cat >try.msg <<'EOM'
4059 I've tried to compile and run the following simple program:
4060
4061 EOM
4062 $cat try.c >> try.msg
4063
4064 $cat >> try.msg <<EOM
4065
4066 I used the command:
4067
4068         $*
4069         ./try
4070
4071 and I got the following output:
4072
4073 EOM
4074 dflt=y
4075 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4076         if sh -c './try' >>try.msg 2>&1; then
4077                 xxx=`./try`
4078                 case "$xxx" in
4079                 "Ok") dflt=n ;;
4080                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4081                         case " $libs " in
4082                         *" -lsfio "*)
4083                                 cat >> try.msg <<'EOQS'
4084 If $libs contains -lsfio, and sfio is mis-configured, then it
4085 sometimes (apparently) runs and exits with a 0 status, but with no
4086 output!  It may have to do with sfio's use of _exit vs. exit.
4087
4088 EOQS
4089                                 rp="You have a big problem.  Shall I abort Configure"
4090                                 dflt=y
4091                                 ;;
4092                         esac
4093                         ;;
4094                 esac
4095         else
4096                 echo "The program compiled OK, but exited with status $?." >>try.msg
4097                 rp="You have a problem.  Shall I abort Configure"
4098                 dflt=y
4099         fi
4100 else
4101         echo "I can't compile the test program." >>try.msg
4102         rp="You have a BIG problem.  Shall I abort Configure"
4103         dflt=y
4104 fi
4105 case "$dflt" in
4106 y)
4107         $cat try.msg >&4
4108         case "$knowitall" in
4109         '')
4110                 echo "(The supplied flags or libraries might be incorrect.)"
4111                 ;;
4112         *) dflt=n;;
4113         esac
4114         echo " "
4115         . ./myread
4116         case "$ans" in
4117         n*|N*) ;;
4118         *)      echo "Ok.  Stopping Configure." >&4
4119                 exit 1
4120                 ;;
4121         esac
4122         ;;
4123 n) echo "OK, that should do.";;
4124 esac
4125 $rm -f try try.* core
4126
4127 : define an is-a-typedef? function
4128 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4129 case "$inclist" in
4130 "") inclist="sys/types.h";;
4131 esac;
4132 eval "varval=\$$var";
4133 case "$varval" in
4134 "")
4135         $rm -f temp.c;
4136         for inc in $inclist; do
4137                 echo "#include <$inc>" >>temp.c;
4138         done;
4139         echo "#ifdef $type" >> temp.c;
4140         echo "printf(\"We have $type\");" >> temp.c;
4141         echo "#endif" >> temp.c;
4142         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4143         if $contains $type temp.E >/dev/null 2>&1; then
4144                 eval "$var=\$type";
4145         else
4146                 eval "$var=\$def";
4147         fi;
4148         $rm -f temp.?;;
4149 *) eval "$var=\$varval";;
4150 esac'
4151
4152 : define an is-a-typedef? function that prompts if the type is not available.
4153 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4154 case "$inclist" in
4155 "") inclist="sys/types.h";;
4156 esac;
4157 eval "varval=\$$var";
4158 case "$varval" in
4159 "")
4160         $rm -f temp.c;
4161         for inc in $inclist; do
4162                 echo "#include <$inc>" >>temp.c;
4163         done;
4164         echo "#ifdef $type" >> temp.c;
4165         echo "printf(\"We have $type\");" >> temp.c;
4166         echo "#endif" >> temp.c;
4167         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4168         echo " " ;
4169         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4170         if $contains $type temp.E >/dev/null 2>&1; then
4171                 echo "$type found." >&4;
4172                 eval "$var=\$type";
4173         else
4174                 echo "$type NOT found." >&4;
4175                 dflt="$def";
4176                 . ./myread ;
4177                 eval "$var=\$ans";
4178         fi;
4179         $rm -f temp.?;;
4180 *) eval "$var=\$varval";;
4181 esac'
4182
4183 : define a shorthand compile call
4184 compile='
4185 mc_file=$1;
4186 shift;
4187 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4188 : define a shorthand compile call for compilations that should be ok.
4189 compile_ok='
4190 mc_file=$1;
4191 shift;
4192 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4193
4194 : check for lengths of integral types
4195 echo " "
4196 case "$intsize" in
4197 '')
4198         echo "Checking to see how big your integers are..." >&4
4199         $cat >intsize.c <<'EOCP'
4200 #include <stdio.h>
4201 int main()
4202 {
4203         printf("intsize=%d;\n", (int)sizeof(int));
4204         printf("longsize=%d;\n", (int)sizeof(long));
4205         printf("shortsize=%d;\n", (int)sizeof(short));
4206         exit(0);
4207 }
4208 EOCP
4209         set intsize
4210         if eval $compile_ok && ./intsize > /dev/null; then
4211                 eval `./intsize`
4212                 echo "Your integers are $intsize bytes long."
4213                 echo "Your long integers are $longsize bytes long."
4214                 echo "Your short integers are $shortsize bytes long."
4215         else
4216                 $cat >&4 <<EOM
4217 !
4218 Help! I can't compile and run the intsize test program: please enlighten me!
4219 (This is probably a misconfiguration in your system or libraries, and
4220 you really ought to fix it.  Still, I'll try anyway.)
4221 !
4222 EOM
4223                 dflt=4
4224                 rp="What is the size of an integer (in bytes)?"
4225                 . ./myread
4226                 intsize="$ans"
4227                 dflt=$intsize
4228                 rp="What is the size of a long integer (in bytes)?"
4229                 . ./myread
4230                 longsize="$ans"
4231                 dflt=2
4232                 rp="What is the size of a short integer (in bytes)?"
4233                 . ./myread
4234                 shortsize="$ans"
4235         fi
4236         ;;
4237 esac
4238 $rm -f intsize intsize.*
4239
4240 : see what type lseek is declared as in the kernel
4241 rp="What is the type used for lseek's offset on this system?"
4242 set off_t lseektype long stdio.h sys/types.h
4243 eval $typedef_ask
4244
4245 echo " "
4246 echo "Checking to see how big your file offsets are..." >&4
4247 $cat >try.c <<EOCP
4248 #include <sys/types.h>
4249 #include <stdio.h>
4250 int main()
4251 {
4252     printf("%d\n", (int)sizeof($lseektype));
4253     return(0); 
4254 }
4255 EOCP
4256 set try
4257 if eval $compile_ok; then
4258         lseeksize=`./try`
4259         echo "Your file offsets are $lseeksize bytes long."
4260 else
4261         dflt=$longsize
4262         echo " "
4263         echo "(I can't seem to compile the test program.  Guessing...)"
4264         rp="What is the size of your file offsets (in bytes)?"
4265         . ./myread
4266         lseeksize="$ans"
4267 fi
4268 $rm -f try.c try
4269
4270 : see what type file positions are declared as in the library
4271 rp="What is the type for file position used by fsetpos()?"
4272 set fpos_t fpostype long stdio.h sys/types.h
4273 eval $typedef_ask
4274
4275 echo " "
4276 case "$fpostype" in
4277 *_t) zzz="$fpostype"    ;;
4278 *)   zzz="fpos_t"       ;;
4279 esac
4280 echo "Checking the size of $zzz..." >&4 
4281 cat > try.c <<EOCP
4282 #include <sys/types.h>
4283 #include <stdio.h>
4284 int main() {
4285     printf("%d\n", (int)sizeof($fpostype));
4286     exit(0);
4287 }
4288 EOCP
4289 set try
4290 if eval $compile_ok; then
4291         yyy=`./try`
4292         case "$yyy" in
4293         '')     fpossize=4
4294                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4295                 ;;
4296         *)      fpossize=$yyy
4297                 echo "Your $zzz is $fpossize bytes long."
4298                 ;;
4299         esac
4300 else
4301         dflt="$longsize"
4302         echo " " >&4
4303         echo "(I can't compile the test program.  Guessing...)" >&4
4304         rp="What is the size of your file positions (in bytes)?"
4305         . ./myread
4306         fpossize="$ans"
4307 fi
4308
4309
4310
4311 # Backward compatibility (uselfs is deprecated).
4312 case "$uselfs" in
4313 "$define"|true|[yY]*)
4314         cat <<EOM >&4
4315
4316 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4317 EOM
4318         uselargefiles="$define"
4319         ;;
4320 esac                          
4321
4322 case "$lseeksize:$fpossize" in
4323 8:8) cat <<EOM
4324
4325 You can have files larger than 2 gigabytes.
4326 EOM
4327    val="$define" ;;
4328 *)    case "$uselargefiles" in
4329    "$undef"|false|[nN]*) dflt='n' ;;
4330    *)   dflt='y' ;;
4331    esac
4332    cat <<EOM
4333
4334 Perl can be built to understand large files (files larger than 2 gigabytes)
4335 on some systems.  To do so, Configure can be run with -Duselargefiles.
4336
4337 If this doesn't make any sense to you, just accept the default '$dflt'.
4338 EOM
4339    rp='Try to understand large files, if available?'
4340    . ./myread
4341    case "$ans" in
4342    y|Y)         val="$define" ;;
4343    *)           val="$undef"  ;;
4344    esac
4345    ;;
4346 esac
4347 set uselargefiles
4348 eval $setvar
4349 case "$uselargefiles" in
4350 "$define")
4351 : Look for a hint-file generated 'call-back-unit'.  If the
4352 : user has specified that a large files perl is to be built,
4353 : we may need to set or change some other defaults.
4354         if $test -f uselargefiles.cbu; then
4355                 echo "Your platform has some specific hints for large file builds, using them..."
4356                 . ./uselargefiles.cbu
4357                 echo " "
4358                 echo "Rechecking to see how big your file offsets are..." >&4
4359                 $cat >try.c <<EOCP
4360 #include <sys/types.h>
4361 #include <stdio.h>
4362 int main()
4363 {
4364     printf("%d\n", (int)sizeof($lseektype));
4365     return(0); 
4366 }
4367 EOCP
4368                 set try
4369                 if eval $compile_ok; then
4370                         lseeksize=`./try`
4371                         $echo "Your file offsets are now $lseeksize bytes long."
4372                 else
4373                         dflt="$lseeksize"
4374                         echo " "
4375                         echo "(I can't seem to compile the test program.  Guessing...)"
4376                         rp="What is the size of your file offsets (in bytes)?"
4377                         . ./myread
4378                         lseeksize="$ans"
4379                 fi
4380                 case "$fpostype" in
4381                 *_t) zzz="$fpostype"    ;;
4382                 *)   zzz="fpos_t"       ;;
4383                 esac
4384                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4385                 $cat > try.c <<EOCP
4386 #include <sys/types.h>
4387 #include <stdio.h>
4388 int main() {
4389     printf("%d\n", (int)sizeof($fpostype));
4390     exit(0);
4391 }
4392 EOCP
4393                 set try
4394                 if eval $compile_ok; then
4395                         yyy=`./try`
4396                         dflt="$lseeksize"
4397                         case "$yyy" in
4398                         '')     echo " "
4399                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4400                                 ;;
4401                         *)      fpossize=$yyy
4402                                 echo " $fpossize bytes." >&4
4403                                 ;;
4404                         esac
4405                 else
4406                         dflt="$fpossize"
4407                         echo " "
4408                         echo "(I can't compile the test program.  Guessing...)" >&4
4409                         rp="What is the size of your file positions (in bytes)?"
4410                         . ./myread
4411                         fpossize="$ans"
4412                 fi
4413                 $rm -f try.c try
4414         fi
4415         ;;
4416 esac
4417
4418
4419 case "$usemorebits" in
4420 "$define"|true|[yY]*)
4421         use64bitint="$define"
4422         uselongdouble="$define"
4423         usemorebits="$define"
4424         ;;
4425 *)      usemorebits="$undef"
4426         ;;
4427 esac
4428
4429
4430 case "$uselonglong" in
4431 "$define"|true|[yY]*)
4432         cat <<EOM >&4
4433
4434 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4435 EOM
4436         use64bitint="$define"
4437         ;;
4438 esac                          
4439 case "$use64bits" in
4440 "$define"|true|[yY]*)
4441         cat <<EOM >&4
4442
4443 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4444 EOM
4445         use64bitint="$define"
4446         ;;
4447 esac                          
4448 case "$use64bitints" in
4449 "$define"|true|[yY]*)
4450         cat <<EOM >&4
4451
4452 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4453 EOM
4454         use64bitint="$define"
4455         ;;
4456 esac                          
4457 case "$use64bitsint" in
4458 "$define"|true|[yY]*)
4459         cat <<EOM >&4
4460
4461 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4462 EOM
4463         use64bitint="$define"
4464         ;;
4465 esac                          
4466 case "$uselonglongs" in
4467 "$define"|true|[yY]*)
4468         cat <<EOM >&4
4469
4470 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4471 EOM
4472         use64bitint="$define"
4473         ;;
4474 esac                          
4475 case "$use64bitsall" in
4476 "$define"|true|[yY]*)
4477         cat <<EOM >&4
4478
4479 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4480 EOM
4481         use64bitall="$define"
4482         ;;
4483 esac                          
4484
4485 case "$ccflags" in
4486 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4487 esac
4488 case "$use64bitall" in
4489 "$define"|true|[yY]*) use64bitint="$define" ;;
4490 esac
4491
4492 case "$longsize" in
4493 8) cat <<EOM
4494
4495 You have natively 64-bit long integers.
4496 EOM
4497    val="$define"
4498    ;;
4499 *) case "$use64bitint" in
4500    "$define"|true|[yY]*) dflt='y';;
4501    *) dflt='n';;
4502    esac
4503    cat <<EOM
4504
4505 Perl can be built to take advantage of 64-bit integer types
4506 on some systems.  To do so, Configure can be run with -Duse64bitint.
4507 Choosing this option will most probably introduce binary incompatibilities.
4508
4509 If this doesn't make any sense to you, just accept the default '$dflt'.
4510 EOM
4511    rp='Try to use 64-bit integers, if available?'
4512    . ./myread
4513    case "$ans" in
4514    [yY]*) val="$define" ;;
4515    *)     val="$undef"  ;;
4516    esac
4517    ;;
4518 esac
4519 set use64bitint
4520 eval $setvar
4521
4522 case "$use64bitall" in
4523 "$define"|true|[yY]*) dflt='y' ;;
4524 *) case "$longsize" in
4525    8) dflt='y' ;;
4526    *) dflt='n' ;;
4527    esac
4528    ;;
4529 esac    
4530 cat <<EOM
4531
4532 You may also choose to try maximal 64-bitness.  It means using as much
4533 64-bitness as possible on the platform.  This in turn means even more
4534 binary incompatibilities.  On the other hand, your platform may not
4535 have any more 64-bitness available than what you already have chosen.
4536
4537 If this doesn't make any sense to you, just accept the default '$dflt'.
4538 EOM
4539 rp='Try to use maximal 64-bit support, if available?'
4540 . ./myread
4541 case "$ans" in
4542 [yY]*) val="$define" ;;
4543 *)     val="$undef"  ;;
4544 esac
4545 set use64bitall
4546 eval $setvar
4547 case "$use64bitall" in
4548 "$define")
4549         case "$use64bitint" in
4550         "$undef")
4551                 cat <<EOM
4552
4553 Since you have chosen a maximally 64-bit build, I'm also turning on
4554 the use of 64-bit integers.
4555 EOM
4556                 use64bitint="$define" ;;
4557         esac
4558         ;;
4559 esac
4560
4561 case "$use64bitint" in
4562 "$define"|true|[yY]*)
4563 : Look for a hint-file generated 'call-back-unit'.  If the
4564 : user has specified that a 64-bit perl is to be built,
4565 : we may need to set or change some other defaults.
4566         if $test -f use64bitint.cbu; then
4567                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4568                 . ./use64bitint.cbu
4569         fi
4570         case "$longsize" in
4571         4) case "$archname64" in
4572            '') archname64=64int ;;
4573            esac
4574            ;;
4575         esac
4576         ;;
4577 esac
4578
4579 case "$use64bitall" in
4580 "$define"|true|[yY]*)
4581 : Look for a hint-file generated 'call-back-unit'.  If the
4582 : user has specified that a maximally 64-bit perl is to be built,
4583 : we may need to set or change some other defaults.
4584         if $test -f use64bitall.cbu; then
4585                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4586                 . ./use64bitall.cbu
4587         fi
4588         case "$longsize" in
4589         4) case "$archname64" in
4590            ''|64int) archname64=64all ;;
4591            esac
4592            ;;
4593         esac
4594         ;;
4595 esac
4596
4597 : determine the architecture name
4598 echo " "
4599 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4600         tarch=`arch`"-$osname"
4601 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4602         if uname -m > tmparch 2>&1 ; then
4603                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4604                         -e 's/$/'"-$osname/" tmparch`
4605         else
4606                 tarch="$osname"
4607         fi
4608         $rm -f tmparch
4609 else
4610         tarch="$osname"
4611 fi
4612 case "$myarchname" in
4613 ''|"$tarch") ;;
4614 *)
4615         echo "(Your architecture name used to be $myarchname.)"
4616         archname=''
4617         ;;
4618 esac
4619 myarchname="$tarch"
4620 case "$archname" in
4621 '') dflt="$tarch";;
4622 *) dflt="$archname";;
4623 esac
4624 rp='What is your architecture name'
4625 . ./myread
4626 archname="$ans"
4627 case "$usethreads" in
4628 $define)
4629         echo "Threads selected." >&4
4630         case "$archname" in
4631         *-thread*) echo "...and architecture name already has -thread." >&4
4632                 ;;
4633         *)      archname="$archname-thread"
4634                 echo "...setting architecture name to $archname." >&4
4635                 ;;
4636         esac
4637         ;;
4638 esac
4639 case "$usemultiplicity" in
4640 $define)
4641         echo "Multiplicity selected." >&4
4642         case "$archname" in
4643         *-multi*) echo "...and architecture name already has -multi." >&4
4644                 ;;
4645         *)      archname="$archname-multi"
4646                 echo "...setting architecture name to $archname." >&4
4647                 ;;
4648         esac
4649         ;;
4650 esac
4651 case "$use64bitint" in
4652 $define)
4653         case "$archname64" in
4654         '')
4655                 ;;
4656         *)
4657                 case "$archname" in
4658                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4659                         ;;
4660                 *)      archname="$archname-$archname64"
4661                         echo "...setting architecture name to $archname." >&4
4662                         ;;
4663                 esac
4664                 ;;
4665         esac
4666 esac
4667
4668 : determine root of directory hierarchy where package will be installed.
4669 case "$prefix" in
4670 '')
4671         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4672         ;;
4673 *)
4674         dflt="$prefix"
4675         ;;
4676 esac
4677 $cat <<EOM
4678
4679 By default, $package will be installed in $dflt/bin, manual pages
4680 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4681 installation directories. Typically this is something like /usr/local.
4682 If you wish to have binaries under /usr/bin but other parts of the
4683 installation under /usr/local, that's ok: you will be prompted
4684 separately for each of the installation directories, the prefix being
4685 only used to set the defaults.
4686
4687 EOM
4688 fn=d~
4689 rp='Installation prefix to use?'
4690 . ./getfile
4691 oldprefix=''
4692 case "$prefix" in
4693 '') ;;
4694 *)
4695         case "$ans" in
4696         "$prefix") ;;
4697         *) oldprefix="$prefix";;
4698         esac
4699         ;;
4700 esac
4701 prefix="$ans"
4702 prefixexp="$ansexp"
4703
4704 : is AFS running?
4705 echo " "
4706 case "$afs" in
4707 $define|true)   afs=true ;;
4708 $undef|false)   afs=false ;;
4709 *)      if test -d /afs; then
4710                 afs=true
4711         else
4712                 afs=false
4713         fi
4714         ;;
4715 esac
4716 if $afs; then
4717         echo "AFS may be running... I'll be extra cautious then..." >&4
4718 else
4719         echo "AFS does not seem to be running..." >&4
4720 fi
4721
4722 : determine installation prefix for where package is to be installed.
4723 if $afs; then 
4724 $cat <<EOM
4725
4726 Since you are running AFS, I need to distinguish the directory in which
4727 files will reside from the directory in which they are installed (and from
4728 which they are presumably copied to the former directory by occult means).
4729
4730 EOM
4731         case "$installprefix" in
4732         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4733         *) dflt="$installprefix";;
4734         esac
4735 else
4736 $cat <<EOM
4737
4738 In some special cases, particularly when building $package for distribution,
4739 it is convenient to distinguish between the directory in which files should 
4740 be installed from the directory ($prefix) in which they 
4741 will eventually reside.  For most users, these two directories are the same.
4742
4743 EOM
4744         case "$installprefix" in
4745         '') dflt=$prefix ;;
4746         *) dflt=$installprefix;;
4747         esac
4748 fi
4749 fn=d~
4750 rp='What installation prefix should I use for installing files?'
4751 . ./getfile
4752 installprefix="$ans"
4753 installprefixexp="$ansexp"
4754
4755 : set the prefixit variable, to compute a suitable default value
4756 prefixit='case "$3" in
4757 ""|none)
4758         case "$oldprefix" in
4759         "") eval "$1=\"\$$2\"";;
4760         *)
4761                 case "$3" in
4762                 "") eval "$1=";;
4763                 none)
4764                         eval "tp=\"\$$2\"";
4765                         case "$tp" in
4766                         ""|" ") eval "$1=\"\$$2\"";;
4767                         *) eval "$1=";;
4768                         esac;;
4769                 esac;;
4770         esac;;
4771 *)
4772         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4773         case "$tp" in
4774         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4775         /*-$oldprefix/*|\~*-$oldprefix/*)
4776                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4777         *) eval "$1=\"\$$2\"";;
4778         esac;;
4779 esac'
4780
4781
4782 : get the patchlevel
4783 echo " "
4784 echo "Getting the current patchlevel..." >&4
4785 if $test -r $rsrc/patchlevel.h;then
4786         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4787         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4788         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4789         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4790         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4791         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4792 else
4793         revision=0
4794         patchlevel=0
4795         subversion=0
4796         api_revision=0
4797         api_version=0
4798         api_subversion=0
4799 fi
4800 $echo $n "(You have $package revision $revision" $c
4801 $echo $n " patchlevel $patchlevel" $c
4802 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4803 echo ".)"
4804 case "$osname" in
4805 dos|vms)
4806         : XXX Should be a Configure test for double-dots in filenames.
4807         version=`echo $revision $patchlevel $subversion | \
4808                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4809         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4810                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4811         ;;
4812 *)
4813         version=`echo $revision $patchlevel $subversion | \
4814                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4815         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4816                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4817         ;;
4818 esac
4819 : Special case the 5.005_xx maintenance series, which used 5.005
4820 : without any subversion label as a subdirectory in $sitelib
4821 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4822         api_versionstring='5.005'
4823 fi
4824
4825 : determine installation style
4826 : For now, try to deduce it from prefix unless it is already set.
4827 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4828 case "$installstyle" in
4829 '')     case "$prefix" in
4830                 *perl*) dflt='lib';;
4831                 *) dflt='lib/perl5' ;;
4832         esac
4833         ;;
4834 *)      dflt="$installstyle" ;;
4835 esac
4836 : Probably not worth prompting for this since we prompt for all
4837 : the directories individually, and the prompt would be too long and
4838 : confusing anyway.
4839 installstyle=$dflt
4840
4841 : determine where private library files go
4842 : Usual default is /usr/local/lib/perl5/$version.
4843 : Also allow things like /opt/perl/lib/$version, since 
4844 : /opt/perl/lib/perl5... would be redundant.
4845 : The default "style" setting is made in installstyle.U
4846 case "$installstyle" in
4847 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4848 *)       set dflt privlib lib/$version ;;
4849 esac
4850 eval $prefixit
4851 $cat <<EOM
4852
4853 There are some auxiliary files for $package that need to be put into a
4854 private library directory that is accessible by everyone.
4855
4856 EOM
4857 fn=d~+
4858 rp='Pathname where the private library files will reside?'
4859 . ./getfile
4860 privlib="$ans"
4861 privlibexp="$ansexp"
4862 : Change installation prefix, if necessary.
4863 if $test X"$prefix" != X"$installprefix"; then
4864         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4865 else
4866         installprivlib="$privlibexp"
4867 fi
4868
4869 : set the prefixup variable, to restore leading tilda escape
4870 prefixup='case "$prefixexp" in
4871 "$prefix") ;;
4872 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4873 esac'
4874
4875 : determine where public architecture dependent libraries go
4876 set archlib archlib
4877 eval $prefixit
4878 : privlib default is /usr/local/lib/$package/$version
4879 : archlib default is /usr/local/lib/$package/$version/$archname
4880 : privlib may have an optional trailing /share.
4881 tdflt=`echo $privlib | $sed 's,/share$,,'`
4882 tdflt=$tdflt/$archname
4883 case "$archlib" in
4884 '')     dflt=$tdflt
4885         ;;
4886 *)      dflt="$archlib"
4887     ;;
4888 esac
4889 $cat <<EOM
4890
4891 $spackage contains architecture-dependent library files.  If you are
4892 sharing libraries in a heterogeneous environment, you might store
4893 these files in a separate location.  Otherwise, you can just include
4894 them with the rest of the public library files.
4895
4896 EOM
4897 fn=d+~
4898 rp='Where do you want to put the public architecture-dependent libraries?'
4899 . ./getfile
4900 archlib="$ans"
4901 archlibexp="$ansexp"
4902 if $test X"$archlib" = X"$privlib"; then
4903         d_archlib="$undef"
4904 else
4905         d_archlib="$define"
4906 fi
4907 : Change installation prefix, if necessary.
4908 if $test X"$prefix" != X"$installprefix"; then
4909         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4910 else
4911         installarchlib="$archlibexp"
4912 fi
4913
4914
4915 : Binary compatibility with 5.005 is not possible for builds
4916 : with advanced features
4917 case "$usethreads$usemultiplicity" in
4918 *define*)
4919         bincompat5005="$undef"
4920         d_bincompat5005="$undef"
4921         ;;
4922 *)      $cat <<EOM
4923
4924 This version of Perl can be compiled for binary compatibility with 5.005.
4925 If you decide to do so, you will be able to continue using most of the
4926 extensions that were compiled for Perl 5.005.
4927
4928 EOM
4929         case "$bincompat5005$d_bincompat5005" in
4930         *"$undef"*) dflt=n ;;
4931         *) dflt=y ;;
4932         esac
4933         rp='Binary compatibility with Perl 5.005?'
4934         . ./myread
4935         case "$ans" in
4936         y*) val="$define" ;;
4937         *)  val="$undef" ;;
4938         esac
4939         set d_bincompat5005
4940         eval $setvar
4941         case "$d_bincompat5005" in
4942         "$define")
4943                 bincompat5005="$define"
4944                 ;;
4945         *)      bincompat5005="$undef"
4946                 d_bincompat5005="$undef"
4947                 ;;
4948         esac
4949         ;;
4950 esac
4951
4952
4953 : see if setuid scripts can be secure
4954 $cat <<EOM
4955
4956 Some kernels have a bug that prevents setuid #! scripts from being
4957 secure.  Some sites have disabled setuid #! scripts because of this.
4958
4959 First let's decide if your kernel supports secure setuid #! scripts.
4960 (If setuid #! scripts would be secure but have been disabled anyway,
4961 don't say that they are secure if asked.)
4962
4963 EOM
4964
4965 val="$undef"
4966 if $test -d /dev/fd; then
4967         echo "#!$ls" >reflect
4968         chmod +x,u+s reflect
4969         ./reflect >flect 2>&1
4970         if $contains "/dev/fd" flect >/dev/null; then
4971                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4972                 val="$define"
4973         else
4974                 $cat <<EOM
4975 If you are not sure if they are secure, I can check but I'll need a
4976 username and password different from the one you are using right now.
4977 If you don't have such a username or don't want me to test, simply
4978 enter 'none'.
4979
4980 EOM
4981                 rp='Other username to test security of setuid scripts with?'
4982                 dflt='none'
4983                 . ./myread
4984                 case "$ans" in
4985                 n|none)
4986                         case "$d_suidsafe" in
4987                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4988                                 dflt=n;;
4989                         "$undef")
4990                                 echo "Well, the $hint value is *not* secure." >&4
4991                                 dflt=n;;
4992                         *)      echo "Well, the $hint value *is* secure." >&4
4993                                 dflt=y;;
4994                         esac
4995                         ;;
4996                 *)
4997                         $rm -f reflect flect
4998                         echo "#!$ls" >reflect
4999                         chmod +x,u+s reflect
5000                         echo >flect
5001                         chmod a+w flect
5002                         echo '"su" will (probably) prompt you for '"$ans's password."
5003                         su $ans -c './reflect >flect'
5004                         if $contains "/dev/fd" flect >/dev/null; then
5005                                 echo "Okay, it looks like setuid scripts are secure." >&4
5006                                 dflt=y
5007                         else
5008                                 echo "I don't think setuid scripts are secure." >&4
5009                                 dflt=n
5010                         fi
5011                         ;;
5012                 esac
5013                 rp='Does your kernel have *secure* setuid scripts?'
5014                 . ./myread
5015                 case "$ans" in
5016                 [yY]*)  val="$define";;
5017                 *)      val="$undef";;
5018                 esac
5019         fi
5020 else
5021         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5022         echo "(That's for file descriptors, not floppy disks.)"
5023         val="$undef"
5024 fi
5025 set d_suidsafe
5026 eval $setvar
5027
5028 $rm -f reflect flect
5029
5030 : now see if they want to do setuid emulation
5031 echo " "
5032 val="$undef"
5033 case "$d_suidsafe" in
5034 "$define")
5035         val="$undef"
5036         echo "No need to emulate SUID scripts since they are secure here." >& 4
5037         ;;
5038 *)
5039         $cat <<EOM
5040 Some systems have disabled setuid scripts, especially systems where
5041 setuid scripts cannot be secure.  On systems where setuid scripts have
5042 been disabled, the setuid/setgid bits on scripts are currently
5043 useless.  It is possible for $package to detect those bits and emulate
5044 setuid/setgid in a secure fashion.  This emulation will only work if
5045 setuid scripts have been disabled in your kernel.
5046
5047 EOM
5048         case "$d_dosuid" in
5049         "$define") dflt=y ;;
5050         *) dflt=n ;;
5051         esac
5052         rp="Do you want to do setuid/setgid emulation?"
5053         . ./myread
5054         case "$ans" in
5055         [yY]*)  val="$define";;
5056         *)      val="$undef";;
5057         esac
5058         ;;
5059 esac
5060 set d_dosuid
5061 eval $setvar
5062
5063 : determine filename position in cpp output
5064 echo " "
5065 echo "Computing filename position in cpp output for #include directives..." >&4
5066 echo '#include <stdio.h>' > foo.c
5067 $cat >fieldn <<EOF
5068 $startsh
5069 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5070 $grep '^[       ]*#.*stdio\.h' | \
5071 while read cline; do
5072         pos=1
5073         set \$cline
5074         while $test \$# -gt 0; do
5075                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5076                         echo "\$pos"
5077                         exit 0
5078                 fi
5079                 shift
5080                 pos=\`expr \$pos + 1\`
5081         done
5082 done
5083 EOF
5084 chmod +x fieldn
5085 fieldn=`./fieldn`
5086 $rm -f foo.c fieldn
5087 case $fieldn in
5088 '') pos='???';;
5089 1) pos=first;;
5090 2) pos=second;;
5091 3) pos=third;;
5092 *) pos="${fieldn}th";;
5093 esac
5094 echo "Your cpp writes the filename in the $pos field of the line."
5095
5096 : locate header file
5097 $cat >findhdr <<EOF
5098 $startsh
5099 wanted=\$1
5100 name=''
5101 for usrincdir in $usrinc
5102 do
5103         if test -f \$usrincdir/\$wanted; then
5104                 echo "\$usrincdir/\$wanted"
5105                 exit 0
5106         fi
5107 done
5108 awkprg='{ print \$$fieldn }'
5109 echo "#include <\$wanted>" > foo\$\$.c
5110 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5111 $grep "^[       ]*#.*\$wanted" | \
5112 while read cline; do
5113         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5114         case "\$name" in
5115         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5116         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5117         *) exit 2;;
5118         esac;
5119 done;
5120 #
5121 # status = 0: grep returned 0 lines, case statement not executed
5122 # status = 1: headerfile found
5123 # status = 2: while loop executed, no headerfile found
5124 #
5125 status=\$?
5126 $rm -f foo\$\$.c;
5127 if test \$status -eq 1; then
5128         exit 0;
5129 fi
5130 exit 1
5131 EOF
5132 chmod +x findhdr
5133
5134 : define an alternate in-header-list? function
5135 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5136 cont=true; xxf="echo \"<\$1> found.\" >&4";
5137 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5138 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5139 esac;
5140 case $# in 4) instead=instead;; *) instead="at last";; esac;
5141 while $test "$cont"; do
5142         xxx=`./findhdr $1`
5143         var=$2; eval "was=\$$2";
5144         if $test "$xxx" && $test -r "$xxx";
5145         then eval $xxf;
5146         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5147                 cont="";
5148         else eval $xxnf;
5149         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5150         set $yyy; shift; shift; yyy=$@;
5151         case $# in 0) cont="";;
5152         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5153                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5154         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5155                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5156         esac;
5157 done;
5158 while $test "$yyy";
5159 do set $yyy; var=$2; eval "was=\$$2";
5160         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5161         set $yyy; shift; shift; yyy=$@;
5162 done'
5163
5164 : see if this is a malloc.h system
5165 set malloc.h i_malloc
5166 eval $inhdr
5167
5168 : see if stdlib is available
5169 set stdlib.h i_stdlib
5170 eval $inhdr
5171
5172 : determine which malloc to compile in
5173 echo " "
5174 case "$usemymalloc" in
5175 ''|[yY]*|true|$define)  dflt='y' ;;
5176 *)      dflt='n' ;;
5177 esac
5178 rp="Do you wish to attempt to use the malloc that comes with $package?"
5179 . ./myread
5180 usemymalloc="$ans"
5181 case "$ans" in
5182 y*|true)
5183         usemymalloc='y'
5184         mallocsrc='malloc.c'
5185         mallocobj="malloc$_o"
5186         d_mymalloc="$define"
5187         case "$libs" in
5188         *-lmalloc*)
5189                 : Remove malloc from list of libraries to use
5190                 echo "Removing unneeded -lmalloc from library list" >&4
5191                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5192                 shift
5193                 libs="$*"
5194                 echo "libs = $libs" >&4
5195                 ;;
5196         esac
5197         ;;
5198 *)
5199         usemymalloc='n'
5200         mallocsrc=''
5201         mallocobj=''
5202         d_mymalloc="$undef"
5203         ;;
5204 esac
5205
5206 : compute the return types of malloc and free
5207 echo " "
5208 $cat >malloc.c <<END
5209 #$i_malloc I_MALLOC
5210 #$i_stdlib I_STDLIB
5211 #include <stdio.h>
5212 #include <sys/types.h>
5213 #ifdef I_MALLOC
5214 #include <malloc.h>
5215 #endif
5216 #ifdef I_STDLIB
5217 #include <stdlib.h>
5218 #endif
5219 #ifdef TRY_MALLOC
5220 void *malloc();
5221 #endif
5222 #ifdef TRY_FREE
5223 void free();
5224 #endif
5225 END
5226 case "$malloctype" in
5227 '')
5228         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5229                 malloctype='void *'
5230         else
5231                 malloctype='char *'
5232         fi
5233         ;;
5234 esac
5235 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5236
5237 case "$freetype" in
5238 '')
5239         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5240                 freetype='void'
5241         else
5242                 freetype='int'
5243         fi
5244         ;;
5245 esac
5246 echo "Your system uses $freetype free(), it would seem." >&4
5247 $rm -f malloc.[co]
5248 $cat <<EOM
5249
5250 The installation process will also create a directory for
5251 vendor-supplied add-ons.  Vendors who supply perl with their system
5252 may find it convenient to place all vendor-supplied files in this
5253 directory rather than in the main distribution directory.  This will
5254 ease upgrades between binary-compatible maintenance versions of perl.
5255
5256 Of course you may also use these directories in whatever way you see
5257 fit.  For example, you might use them to access modules shared over a
5258 company-wide network.
5259
5260 The default answer should be fine for most people.
5261 This causes further questions about vendor add-ons to be skipped
5262 and no vendor-specific directories will be configured for perl.
5263
5264 EOM
5265 rp='Do you want to configure vendor-specific add-on directories?'
5266 case "$usevendorprefix" in
5267 define|true|[yY]*) dflt=y ;;
5268 *)      : User may have set vendorprefix directly on Configure command line.
5269         case "$vendorprefix" in
5270         ''|' ') dflt=n ;;
5271         *)      dflt=y ;;
5272         esac
5273         ;;
5274 esac
5275 . ./myread
5276 case "$ans" in
5277 [yY]*)  fn=d~+
5278         rp='Installation prefix to use for vendor-supplied add-ons?'
5279         case "$vendorprefix" in
5280         '') dflt='' ;;
5281         *)  dflt=$vendorprefix ;;
5282         esac
5283         . ./getfile
5284         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5285         oldvendorprefix=''
5286         case "$vendorprefix" in
5287         '') ;;
5288         *)      case "$ans" in
5289                 "$prefix") ;;
5290                 *) oldvendorprefix="$prefix";;
5291                 esac
5292                 ;;
5293         esac
5294         usevendorprefix="$define"
5295         vendorprefix="$ans"
5296         vendorprefixexp="$ansexp"
5297         ;;
5298 *)      usevendorprefix="$undef"
5299         vendorprefix=''
5300         vendorprefixexp=''
5301         ;;
5302 esac
5303
5304 case "$vendorprefix" in
5305 '')     d_vendorlib="$undef"
5306         vendorlib=''
5307         vendorlibexp=''
5308         ;;
5309 *)      d_vendorlib="$define"
5310         : determine where vendor-supplied modules go.
5311         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5312         case "$vendorlib" in
5313         '')
5314                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5315                 case "$installstyle" in
5316                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5317                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5318                 esac
5319                 ;;
5320         *)      dflt="$vendorlib"
5321                 ;;
5322         esac
5323         fn=d~+
5324         rp='Pathname for the vendor-supplied library files?'
5325         . ./getfile
5326         vendorlib="$ans"
5327         vendorlibexp="$ansexp"
5328         ;;
5329 esac
5330 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5331 : Change installation prefix, if necessary.
5332 if $test X"$prefix" != X"$installprefix"; then
5333         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5334 else
5335         installvendorlib="$vendorlibexp"
5336 fi
5337
5338 case "$vendorprefix" in
5339 '')     d_vendorarch="$undef"
5340         vendorarch=''
5341         vendorarchexp=''
5342         ;;
5343 *)      d_vendorarch="$define"
5344         : determine where vendor-supplied architecture-dependent libraries go.
5345         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5346         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5347         : vendorlib may have an optional trailing /share.
5348         case "$vendorarch" in
5349         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5350                 dflt="$dflt/$archname"
5351                 ;;
5352         *)      dflt="$vendorarch" ;;
5353         esac
5354         fn=d~+
5355         rp='Pathname for vendor-supplied architecture-dependent files?'
5356         . ./getfile
5357         vendorarch="$ans"
5358         vendorarchexp="$ansexp"
5359         ;;
5360 esac
5361 : Change installation prefix, if necessary.
5362 if $test X"$prefix" != X"$installprefix"; then
5363         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5364 else
5365         installvendorarch="$vendorarchexp"
5366 fi
5367
5368 : Cruising for prototypes
5369 echo " "
5370 echo "Checking out function prototypes..." >&4
5371 $cat >prototype.c <<'EOCP'
5372 int main(int argc, char *argv[]) {
5373         exit(0);}
5374 EOCP
5375 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5376         echo "Your C compiler appears to support function prototypes."
5377         val="$define"
5378 else
5379         echo "Your C compiler doesn't seem to understand function prototypes."
5380         val="$undef"
5381 fi
5382 set prototype
5383 eval $setvar
5384 $rm -f prototype*
5385
5386 case "$prototype" in
5387 "$define") ;;
5388 *)      ansi2knr='ansi2knr'
5389         echo " "
5390         cat <<EOM >&4
5391
5392 $me:  FATAL ERROR:
5393 This version of $package can only be compiled by a compiler that 
5394 understands function prototypes.  Unfortunately, your C compiler 
5395         $cc $ccflags
5396 doesn't seem to understand them.  Sorry about that.
5397
5398 If GNU cc is available for your system, perhaps you could try that instead.  
5399
5400 Eventually, we hope to support building Perl with pre-ANSI compilers.
5401 If you would like to help in that effort, please contact <perlbug@perl.org>.
5402
5403 Aborting Configure now.
5404 EOM
5405         exit 2
5406         ;;
5407 esac
5408
5409 : determine where public executables go
5410 echo " "
5411 set dflt bin bin
5412 eval $prefixit
5413 fn=d~
5414 rp='Pathname where the public executables will reside?'
5415 . ./getfile
5416 if $test "X$ansexp" != "X$binexp"; then
5417         installbin=''
5418 fi
5419 bin="$ans"
5420 binexp="$ansexp"
5421 : Change installation prefix, if necessary.
5422 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5423 if $test X"$prefix" != X"$installprefix"; then
5424         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5425 else
5426         installbin="$binexp"
5427 fi
5428
5429 : Find perl5.005 or later.
5430 echo "Looking for a previously installed perl5.005 or later... "
5431 case "$perl5" in
5432 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5433                 : Check if this perl is recent and can load a simple module
5434                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5435                         perl5=$tdir/perl
5436                         break;
5437                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5438                         perl5=$tdir/perl
5439                         break;
5440                 fi
5441         done
5442         ;;
5443 *)      perl5="$perl5"
5444         ;;
5445 esac
5446 case "$perl5" in
5447 '')     echo "None found.  That's ok.";;
5448 *)      echo "Using $perl5." ;;
5449 esac
5450
5451 $cat <<EOM
5452
5453 After $package is installed, you may wish to install various
5454 add-on modules and utilities.  Typically, these add-ons will
5455 be installed under $prefix with the rest
5456 of this package.  However, you may wish to install such add-ons
5457 elsewhere under a different prefix.
5458
5459 If you do not wish to put everything under a single prefix, that's
5460 ok.  You will be prompted for the individual locations; this siteprefix
5461 is only used to suggest the defaults.
5462
5463 The default should be fine for most people.
5464
5465 EOM
5466 fn=d~+
5467 rp='Installation prefix to use for add-on modules and utilities?'
5468 : XXX Here might be another good place for an installstyle setting.
5469 case "$siteprefix" in
5470 '') dflt=$prefix ;;
5471 *)  dflt=$siteprefix ;;
5472 esac
5473 . ./getfile
5474 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5475 oldsiteprefix=''
5476 case "$siteprefix" in
5477 '') ;;
5478 *)      case "$ans" in
5479         "$prefix") ;;
5480         *) oldsiteprefix="$prefix";;
5481         esac
5482         ;;
5483 esac
5484 siteprefix="$ans"
5485 siteprefixexp="$ansexp"
5486
5487 : determine where site specific libraries go.
5488 : Usual default is /usr/local/lib/perl5/site_perl/$version
5489 : The default "style" setting is made in installstyle.U
5490 : XXX No longer works with Prefixit stuff.
5491 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5492 case "$sitelib" in
5493 '') case "$installstyle" in
5494         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5495         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5496         esac
5497         ;;
5498 *)      dflt="$sitelib"
5499         ;;
5500 esac
5501 $cat <<EOM
5502
5503 The installation process will create a directory for
5504 site-specific extensions and modules.  Most users find it convenient
5505 to place all site-specific files in this directory rather than in the
5506 main distribution directory.
5507
5508 EOM
5509 fn=d~+
5510 rp='Pathname for the site-specific library files?'
5511 . ./getfile
5512 sitelib="$ans"
5513 sitelibexp="$ansexp"
5514 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5515 : Change installation prefix, if necessary.
5516 if $test X"$prefix" != X"$installprefix"; then
5517         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5518 else
5519         installsitelib="$sitelibexp"
5520 fi
5521
5522 : Determine list of previous versions to include in @INC
5523 $cat > getverlist <<EOPL
5524 #!$perl5 -w
5525 use File::Basename;
5526 \$api_versionstring = "$api_versionstring";
5527 \$version = "$version";
5528 \$stem = "$sitelib_stem";
5529 \$archname = "$archname";
5530 EOPL
5531         $cat >> getverlist <<'EOPL'
5532 # Can't have leading @ because metaconfig interprets it as a command!
5533 ;@inc_version_list=();
5534 # XXX Redo to do opendir/readdir? 
5535 if (-d $stem) {
5536     chdir($stem);
5537     ;@candidates = glob("5.*");
5538 }
5539 else {
5540     ;@candidates = ();
5541 }
5542
5543 # XXX ToDo:  These comparisons must be reworked when two-digit
5544 # subversions come along, so that 5.7.10 compares as greater than
5545 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5546 # widespread that we can use the built-in version vectors rather
5547 # than reinventing them here.  For 5.6.0, however, we must
5548 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5549 foreach $d (@candidates) {
5550     if ($d lt $version) {
5551         if ($d ge $api_versionstring) {
5552             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
5553         }
5554         elsif ($d ge "5.005") {
5555             unshift(@inc_version_list, grep { -d } $d);
5556         }
5557     }
5558     else {
5559         # Skip newer version.  I.e. don't look in
5560         # 5.7.0 if we're installing 5.6.1.
5561     }
5562 }
5563
5564 if (@inc_version_list) {
5565     print join(' ', @inc_version_list);
5566 }
5567 else {
5568     # Blank space to preserve value for next Configure run.
5569     print " ";
5570 }
5571 EOPL
5572 chmod +x getverlist
5573 case "$inc_version_list" in
5574 '')     if test -x "$perl5"; then
5575                 dflt=`$perl5 getverlist`
5576         else
5577                 dflt='none'
5578         fi
5579         ;;
5580 $undef) dflt='none' ;;
5581 *)  dflt="$inc_version_list" ;;
5582 esac
5583 case "$dflt" in
5584 ''|' ') dflt=none ;;
5585 esac
5586 $cat <<'EOM'
5587
5588 In order to ease the process of upgrading, this version of perl 
5589 can be configured to use modules built and installed with earlier 
5590 versions of perl that were installed under $prefix.  Specify here
5591 the list of earlier versions that this version of perl should check.
5592 If Configure detected no earlier versions of perl installed under
5593 $prefix, then the list will be empty.  Answer 'none' to tell perl
5594 to not search earlier versions.
5595
5596 The default should almost always be sensible, so if you're not sure,
5597 just accept the default.
5598 EOM
5599
5600 rp='List of earlier versions to include in @INC?'
5601 . ./myread
5602 case "$ans" in
5603 [Nn]one|''|' ') inc_version_list=' ' ;;
5604 *) inc_version_list="$ans" ;;
5605 esac
5606 case "$inc_version_list" in
5607 ''|' ') 
5608         inc_version_list_init='0';;
5609 *)      inc_version_list_init=`echo $inc_version_list |
5610                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5611         ;;
5612 esac
5613 $rm -f getverlist
5614
5615 : determine whether to install perl also as /usr/bin/perl
5616
5617 echo " "
5618 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5619         $cat <<EOM
5620 Many scripts expect perl to be installed as /usr/bin/perl.
5621 I can install the perl you are about to compile also as /usr/bin/perl
5622 (in addition to $installbin/perl).
5623 EOM
5624         case "$installusrbinperl" in
5625         "$undef"|[nN]*) dflt='n';;
5626         *)              dflt='y';;
5627         esac
5628         rp="Do you want to install perl as /usr/bin/perl?"
5629         . ./myread
5630         case "$ans" in
5631         [yY]*)  val="$define";;
5632         *)      val="$undef" ;;
5633         esac
5634 else
5635         val="$undef"
5636 fi
5637 set installusrbinperl
5638 eval $setvar
5639
5640 echo " "
5641 echo "Checking for GNU C Library..." >&4
5642 cat >gnulibc.c <<EOM
5643 #include <stdio.h>
5644 int main()
5645 {
5646 #ifdef __GLIBC__
5647     exit(0);
5648 #else
5649     exit(1);
5650 #endif
5651 }
5652 EOM
5653 set gnulibc
5654 if eval $compile_ok && ./gnulibc; then
5655         val="$define"
5656         echo "You are using the GNU C Library"
5657 else
5658         val="$undef"
5659         echo "You are not using the GNU C Library"
5660 fi
5661 $rm -f gnulibc*
5662 set d_gnulibc
5663 eval $setvar
5664
5665 : see if nm is to be used to determine whether a symbol is defined or not
5666 case "$usenm" in
5667 '')
5668         dflt=''
5669         case "$d_gnulibc" in
5670         "$define")
5671                 echo " "
5672                 echo "nm probably won't work on the GNU C Library." >&4
5673                 dflt=n
5674                 ;;
5675         esac
5676         case "$dflt" in
5677         '') 
5678                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5679                         echo " "
5680                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5681                         echo "'nm' won't be sufficient on this sytem." >&4
5682                         dflt=n
5683                 fi
5684                 ;;
5685         esac
5686         case "$dflt" in
5687         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5688                 if $test $dflt -gt 20; then
5689                         dflt=y
5690                 else
5691                         dflt=n
5692                 fi
5693                 ;;
5694         esac
5695         ;;
5696 *)
5697         case "$usenm" in
5698         true|$define) dflt=y;;
5699         *) dflt=n;;
5700         esac
5701         ;;
5702 esac
5703 $cat <<EOM
5704
5705 I can use $nm to extract the symbols from your C libraries. This
5706 is a time consuming task which may generate huge output on the disk (up
5707 to 3 megabytes) but that should make the symbols extraction faster. The
5708 alternative is to skip the 'nm' extraction part and to compile a small
5709 test program instead to determine whether each symbol is present. If
5710 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5711 this may be the best solution.
5712
5713 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5714
5715 EOM
5716 rp="Shall I use $nm to extract C symbols from the libraries?"
5717 . ./myread
5718 case "$ans" in
5719 [Nn]*) usenm=false;;
5720 *) usenm=true;;
5721 esac
5722
5723 runnm=$usenm
5724 case "$reuseval" in
5725 true) runnm=false;;
5726 esac
5727
5728 : nm options which may be necessary
5729 case "$nm_opt" in
5730 '') if $test -f /mach_boot; then
5731                 nm_opt=''       # Mach
5732         elif $test -d /usr/ccs/lib; then
5733                 nm_opt='-p'     # Solaris (and SunOS?)
5734         elif $test -f /dgux; then
5735                 nm_opt='-p'     # DG-UX
5736         elif $test -f /lib64/rld; then
5737                 nm_opt='-p'     # 64-bit Irix
5738         else
5739                 nm_opt=''
5740         fi;;
5741 esac
5742
5743 : nm options which may be necessary for shared libraries but illegal
5744 : for archive libraries.  Thank you, Linux.
5745 case "$nm_so_opt" in
5746 '')     case "$myuname" in
5747         *linux*)
5748                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5749                         nm_so_opt='--dynamic'
5750                 fi
5751                 ;;
5752         esac
5753         ;;
5754 esac
5755
5756 case "$runnm" in
5757 true)
5758 : get list of predefined functions in a handy place
5759 echo " "
5760 case "$libc" in
5761 '') libc=unknown
5762         case "$libs" in
5763         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5764         esac
5765         ;;
5766 esac
5767 libnames='';
5768 case "$libs" in
5769 '') ;;
5770 *)  for thislib in $libs; do
5771         case "$thislib" in
5772         -lc|-lc_s)
5773                 : Handle C library specially below.
5774                 ;;
5775         -l*)
5776                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5777                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5778                         :
5779                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5780                         :
5781                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5782                         :
5783                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5784                         :
5785                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5786                         :
5787                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5788                         :
5789                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5790                         :
5791                 else
5792                         try=''
5793                 fi
5794                 libnames="$libnames $try"
5795                 ;;
5796         *) libnames="$libnames $thislib" ;;
5797         esac
5798         done
5799         ;;
5800 esac
5801 xxx=normal
5802 case "$libc" in
5803 unknown)
5804         set /lib/libc.$so
5805         for xxx in $libpth; do
5806                 $test -r $1 || set $xxx/libc.$so
5807                 : The messy sed command sorts on library version numbers.
5808                 $test -r $1 || \
5809                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5810                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5811                                 h
5812                                 s/[0-9][0-9]*/0000&/g
5813                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5814                                 G
5815                                 s/\n/ /' | \
5816                          sort | $sed -e 's/^.* //'`
5817                 eval set \$$#
5818         done
5819         $test -r $1 || set /usr/ccs/lib/libc.$so
5820         $test -r $1 || set /lib/libsys_s$_a
5821         ;;
5822 *)
5823         set blurfl
5824         ;;
5825 esac
5826 if $test -r "$1"; then
5827         echo "Your (shared) C library seems to be in $1."
5828         libc="$1"
5829 elif $test -r /lib/libc && $test -r /lib/clib; then
5830         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5831         xxx=apollo
5832         libc='/lib/clib /lib/libc'
5833         if $test -r /lib/syslib; then
5834                 echo "(Your math library is in /lib/syslib.)"
5835                 libc="$libc /lib/syslib"
5836         fi
5837 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5838         echo "Your C library seems to be in $libc, as you said before."
5839 elif $test -r $incpath/usr/lib/libc$_a; then
5840         libc=$incpath/usr/lib/libc$_a;
5841         echo "Your C library seems to be in $libc.  That's fine."
5842 elif $test -r /lib/libc$_a; then
5843         libc=/lib/libc$_a;
5844         echo "Your C library seems to be in $libc.  You're normal."
5845 else
5846         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5847                 :
5848         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5849                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5850         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5851                 :
5852         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5853                 :
5854         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5855                 :
5856         else
5857                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5858         fi
5859         if $test -r "$tans"; then
5860                 echo "Your C library seems to be in $tans, of all places."
5861                 libc=$tans
5862         else
5863                 libc='blurfl'
5864         fi
5865 fi
5866 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5867         dflt="$libc"
5868         cat <<EOM
5869
5870 If the guess above is wrong (which it might be if you're using a strange
5871 compiler, or your machine supports multiple models), you can override it here.
5872
5873 EOM
5874 else
5875         dflt=''
5876         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5877         cat >&4 <<EOM
5878 I can't seem to find your C library.  I've looked in the following places:
5879
5880 EOM
5881         $sed 's/^/      /' libpath
5882         cat <<EOM
5883
5884 None of these seems to contain your C library. I need to get its name...
5885
5886 EOM
5887 fi
5888 fn=f
5889 rp='Where is your C library?'
5890 . ./getfile
5891 libc="$ans"
5892
5893 echo " "
5894 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5895 set X `cat libnames`
5896 shift
5897 xxx=files
5898 case $# in 1) xxx=file; esac
5899 echo "Extracting names from the following $xxx for later perusal:" >&4
5900 echo " "
5901 $sed 's/^/      /' libnames >&4
5902 echo " "
5903 $echo $n "This may take a while...$c" >&4
5904
5905 for file in $*; do
5906         case $file in
5907         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5908         *) $nm $nm_opt $file 2>/dev/null;;
5909         esac
5910 done >libc.tmp
5911
5912 $echo $n ".$c"
5913 $grep fprintf libc.tmp > libc.ptf
5914 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5915 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5916 xxx='[ADTSIW]'
5917 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5918         eval $xscan;\
5919         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5920                 eval $xrun
5921 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5922         eval $xscan;\
5923         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5924                 eval $xrun
5925 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5926         eval $xscan;\
5927         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5928                 eval $xrun
5929 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5930         eval $xscan;\
5931         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5932                 eval $xrun
5933 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5934         eval $xscan;\
5935         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5936                 eval $xrun
5937 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5938         eval $xscan;\
5939         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5940                 eval $xrun
5941 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5942                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5943         eval $xscan;\
5944         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5945                 eval $xrun
5946 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5947         eval $xscan;\
5948         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5949                 eval $xrun
5950 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5951         eval $xscan;\
5952         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5953                 eval $xrun
5954 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5955         eval $xscan;\
5956         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5957                 eval $xrun
5958 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\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/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5963         eval $xscan;\
5964         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5965                 eval $xrun
5966 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5967         eval $xscan;\
5968         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5969                 eval $xrun
5970 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5971         eval $xscan;\
5972         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5973                 eval $xrun
5974 else
5975         $nm -p $* 2>/dev/null >libc.tmp
5976         $grep fprintf libc.tmp > libc.ptf
5977         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5978                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5979         then
5980                 nm_opt='-p'
5981                 eval $xrun
5982         else
5983                 echo " "
5984                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5985                 com=''
5986                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5987                         for thisname in $libnames $libc; do
5988                                 $ar t $thisname >>libc.tmp
5989                         done
5990                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5991                         echo "Ok." >&4
5992                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5993                         # Repeat libc to extract forwarders to DLL entries too
5994                         for thisname in $libnames $libc; do
5995                                 $ar tv $thisname >>libc.tmp
5996                                 # Revision 50 of EMX has bug in $ar.
5997                                 # it will not extract forwarders to DLL entries
5998                                 # Use emximp which will extract exactly them.
5999                                 emximp -o tmp.imp $thisname \
6000                                     2>/dev/null && \
6001                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6002                                     < tmp.imp >>libc.tmp
6003                                 $rm tmp.imp
6004                         done
6005                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6006                         echo "Ok." >&4
6007                 else
6008                         echo "$ar didn't seem to work right." >&4
6009                         echo "Maybe this is a Cray...trying bld instead..." >&4
6010                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6011                         then
6012                                 for thisname in $libnames; do
6013                                         bld t $libnames | \
6014                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6015                                         $ar t $thisname >>libc.tmp
6016                                 done
6017                                 echo "Ok." >&4
6018                         else
6019                                 echo "That didn't work either.  Giving up." >&4
6020                                 exit 1
6021                         fi
6022                 fi
6023         fi
6024 fi
6025 nm_extract="$com"
6026 if $test -f /lib/syscalls.exp; then
6027         echo " "
6028         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6029         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6030 fi
6031 ;;
6032 esac
6033 $rm -f libnames libpath
6034
6035 : see if dld is available
6036 set dld.h i_dld
6037 eval $inhdr
6038
6039 : is a C symbol defined?
6040 csym='tlook=$1;
6041 case "$3" in
6042 -v) tf=libc.tmp; tc=""; tdc="";;
6043 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6044 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6045 esac;
6046 tx=yes;
6047 case "$reuseval-$4" in
6048 true-) ;;
6049 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6050 esac;
6051 case "$tx" in
6052 yes)
6053         case "$runnm" in
6054         true)
6055                 if $contains $tlook $tf >/dev/null 2>&1;
6056                 then tval=true;
6057                 else tval=false;
6058                 fi;;
6059         *)
6060                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6061                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6062                 then tval=true;
6063                 else tval=false;
6064                 fi;
6065                 $rm -f t t.c;;
6066         esac;;
6067 *)
6068         case "$tval" in
6069         $define) tval=true;;
6070         *) tval=false;;
6071         esac;;
6072 esac;
6073 eval "$2=$tval"'
6074
6075 : define an is-in-libc? function
6076 inlibc='echo " "; td=$define; tu=$undef;
6077 sym=$1; var=$2; eval "was=\$$2";
6078 tx=yes;
6079 case "$reuseval$was" in
6080 true) ;;
6081 true*) tx=no;;
6082 esac;
6083 case "$tx" in
6084 yes)
6085         set $sym tres -f;
6086         eval $csym;
6087         case "$tres" in
6088         true)
6089                 echo "$sym() found." >&4;
6090                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6091         *)
6092                 echo "$sym() NOT found." >&4;
6093                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6094         esac;;
6095 *)
6096         case "$was" in
6097         $define) echo "$sym() found." >&4;;
6098         *) echo "$sym() NOT found." >&4;;
6099         esac;;
6100 esac'
6101
6102 : see if dlopen exists
6103 xxx_runnm="$runnm"
6104 runnm=false
6105 set dlopen d_dlopen
6106 eval $inlibc
6107 runnm="$xxx_runnm"
6108
6109 : determine which dynamic loading, if any, to compile in
6110 echo " "
6111 dldir="ext/DynaLoader"
6112 case "$usedl" in
6113 $define|y|true)
6114         dflt='y'
6115         usedl="$define"
6116         ;;
6117 $undef|n|false)
6118         dflt='n'
6119         usedl="$undef"
6120         ;;
6121 *) 
6122         dflt='n'
6123         case "$d_dlopen" in
6124             $define) dflt='y' ;;
6125         esac
6126         case "$i_dld" in
6127             $define) dflt='y' ;;
6128         esac
6129         : Does a dl_xxx.xs file exist for this operating system
6130         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6131         ;;
6132 esac
6133 rp="Do you wish to use dynamic loading?"
6134 . ./myread
6135 usedl="$ans"
6136 case "$ans" in
6137 y*) usedl="$define"
6138         case "$dlsrc" in
6139         '')
6140                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6141                         dflt="$dldir/dl_${osname}.xs"
6142                 elif $test "$d_dlopen" = "$define" ; then
6143                         dflt="$dldir/dl_dlopen.xs"
6144                 elif $test "$i_dld" = "$define" ; then
6145                         dflt="$dldir/dl_dld.xs"
6146                 else
6147                         dflt=''
6148                 fi
6149                 ;;
6150         *)      dflt="$dldir/$dlsrc"
6151                 ;;
6152         esac
6153     echo "The following dynamic loading files are available:"
6154         : Can not go over to $dldir because getfile has path hard-coded in.
6155         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6156         rp="Source file to use for dynamic loading"
6157         fn="fne"
6158         gfpth="$src"
6159         . ./getfile
6160         usedl="$define"
6161         : emulate basename
6162         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6163
6164         $cat << EOM
6165
6166 Some systems may require passing special flags to $cc -c to
6167 compile modules that will be used to create a shared library.
6168 To use no flags, say "none".
6169
6170 EOM
6171     case "$cccdlflags" in
6172     '') case "$gccversion" in
6173                 '') case "$osname" in
6174                         hpux)   dflt='+z' ;;
6175                         next)   dflt='none' ;;
6176                         irix*)  dflt='-KPIC' ;;
6177                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6178                         sunos)  dflt='-pic' ;;
6179                         *)      dflt='none' ;;
6180                     esac
6181                         ;;
6182                 *)  case "$osname" in
6183                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6184                         *)      dflt='-fpic' ;;
6185                     esac ;;
6186             esac ;;
6187         ' ') dflt='none' ;;
6188     *)  dflt="$cccdlflags" ;;
6189     esac
6190     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6191     . ./myread
6192     case "$ans" in
6193     none) cccdlflags=' ' ;;
6194     *) cccdlflags="$ans" ;;
6195     esac
6196
6197     cat << EOM
6198
6199 Some systems use ld to create libraries that can be dynamically loaded,
6200 while other systems (such as those using ELF) use $cc.
6201
6202 EOM
6203         case "$ld" in
6204         '')     $cat >try.c <<'EOM'
6205 /* Test for whether ELF binaries are produced */
6206 #include <fcntl.h>
6207 #include <stdlib.h>
6208 int main() {
6209         char b[4];
6210         int i = open("a.out",O_RDONLY);
6211         if(i == -1) 
6212                 exit(1); /* fail */
6213         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6214                 exit(0); /* succeed (yes, it's ELF) */
6215         else
6216                 exit(1); /* fail */
6217 }
6218 EOM
6219                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6220                         cat <<EOM
6221 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6222 EOM
6223                         dflt="$cc"
6224                 else
6225                         echo "I'll use ld to build dynamic libraries."
6226                         dflt='ld'
6227                 fi
6228                 rm -f try.c a.out
6229                 ;;
6230         *)      dflt="$ld"
6231                 ;;
6232         esac
6233
6234     rp="What command should be used to create dynamic libraries?"
6235     . ./myread
6236         ld="$ans"
6237
6238     cat << EOM
6239
6240 Some systems may require passing special flags to $ld to create a
6241 library that can be dynamically loaded.  If your ld flags include
6242 -L/other/path options to locate libraries outside your loader's normal
6243 search path, you may need to specify those -L options here as well.  To
6244 use no flags, say "none".
6245
6246 EOM
6247     case "$lddlflags" in
6248     '') case "$osname" in
6249                         beos) dflt='-nostart' ;;
6250                         hpux) dflt='-b';
6251                               case "$gccversion" in
6252                               '') dflt="$dflt +vnocompatwarnings" ;;
6253                               esac
6254                               ;;        
6255                         linux|irix*)    dflt='-shared' ;;
6256                         next)  dflt='none' ;;
6257                         solaris) dflt='-G' ;;
6258                         sunos) dflt='-assert nodefinitions' ;;
6259                         svr4*|esix*) dflt="-G $ldflags" ;;
6260                 *)     dflt='none' ;;
6261                         esac
6262                         ;;
6263     *) dflt="$lddlflags" ;;
6264     esac
6265
6266         : Try to guess additional flags to pick up local libraries.
6267         : Be careful not to append to a plain 'none'
6268         case "$dflt" in
6269         none) dflt='' ;;
6270         esac
6271         for thisflag in $ldflags; do
6272                 case "$thisflag" in
6273                 -L*)
6274                         case " $dflt " in
6275                         *" $thisflag "*) ;;
6276                         *) dflt="$dflt $thisflag" ;;
6277                         esac
6278                         ;;
6279                 esac
6280         done
6281
6282         case "$dflt" in
6283         ''|' ') dflt='none' ;;
6284         esac
6285
6286     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6287     . ./myread
6288     case "$ans" in
6289     none) lddlflags=' ' ;;
6290     *) lddlflags="$ans" ;;
6291     esac
6292
6293         cat <<EOM
6294
6295 Some systems may require passing special flags to $cc to indicate that
6296 the resulting executable will use dynamic linking.  To use no flags,
6297 say "none".
6298
6299 EOM
6300     case "$ccdlflags" in
6301     '') case "$osname" in
6302                 hpux)   dflt='-Wl,-E' ;;
6303                 linux)  dflt='-rdynamic' ;;
6304                 next)   dflt='none' ;;
6305                 sunos)  dflt='none' ;;
6306                 *)      dflt='none' ;;
6307             esac ;;
6308     ' ')  dflt='none' ;;
6309     *)  dflt="$ccdlflags" ;;
6310     esac
6311     rp="Any special flags to pass to $cc to use dynamic linking?"
6312     . ./myread
6313     case "$ans" in
6314     none) ccdlflags=' ' ;;
6315     *) ccdlflags="$ans" ;;
6316     esac
6317     ;;
6318 *)  usedl="$undef"
6319         ld='ld'
6320     dlsrc='dl_none.xs'
6321     lddlflags=''
6322     ccdlflags=''
6323     ;;
6324 esac
6325
6326 also=''
6327 case "$usedl" in
6328 $undef)
6329         # No dynamic loading being used, so don't bother even to prompt.
6330         useshrplib='false'
6331         ;;
6332 *)      case "$useshrplib" in
6333         '')     case "$osname" in
6334                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6335                         dflt=y
6336                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6337                         ;;
6338                 next*)
6339                         case "$osvers" in
6340                         4*)     dflt=y
6341                                 also='Building a shared libperl is needed for MAB support.'
6342                                 ;;
6343                         *)      dflt=n
6344                                 ;;
6345                         esac
6346                         ;;
6347                 *)      dflt=n
6348                         ;;
6349                 esac
6350                 ;;
6351         $define|true|[Yy]*)
6352                 dflt=y
6353                 ;;
6354         *)      dflt=n
6355                 ;;
6356         esac
6357         $cat << EOM
6358
6359 The perl executable is normally obtained by linking perlmain.c with
6360 libperl${_a}, any static extensions (usually just DynaLoader), and
6361 any other libraries needed on this system (such as -lm, etc.).  Since
6362 your system supports dynamic loading, it is probably possible to build
6363 a shared libperl.$so.  If you will have more than one executable linked
6364 to libperl.$so, this will significantly reduce the size of each
6365 executable, but it may have a noticeable affect on performance.  The
6366 default is probably sensible for your system.
6367 $also
6368
6369 EOM
6370         rp="Build a shared libperl.$so (y/n)"
6371         . ./myread
6372         case "$ans" in
6373         true|$define|[Yy]*)
6374                 useshrplib='true'  ;;
6375         *)      useshrplib='false' ;;
6376         esac
6377         ;;
6378 esac
6379
6380 case "$useshrplib" in
6381 true)
6382         case "$libperl" in
6383         '')
6384                 # Figure out a good name for libperl.so.  Since it gets stored in
6385                 # a version-specific architecture-dependent library, the version
6386                 # number isn't really that important, except for making cc/ld happy.
6387                 #
6388                 # A name such as libperl.so.3.1
6389                 majmin="libperl.$so.$patchlevel.$subversion"
6390                 # A name such as libperl.so.301
6391                 majonly=`echo $patchlevel $subversion |
6392                         $awk '{printf "%d%02d", $1, $2}'`
6393                 majonly=libperl.$so.$majonly
6394                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6395                 # rely on figuring it out from the naming of libc.
6396                 case "${osname}${osvers}" in
6397                 next4*)
6398                         dflt=libperl.5.$so
6399                         # XXX How handle the --version stuff for MAB?
6400                         ;;
6401                 linux*)  # ld won't link with a bare -lperl otherwise.
6402                         dflt=libperl.$so
6403                         ;;
6404                 cygwin*) # include version
6405                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6406                         ;;
6407                 *)      # Try to guess based on whether libc has major.minor.
6408                         case "$libc" in
6409                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6410                         *libc.$so.[0-9]*) dflt=$majonly ;;
6411                         *)      dflt=libperl.$so ;;
6412                         esac
6413                         ;;
6414                 esac
6415                 ;;
6416         *)      dflt=$libperl
6417                 ;;
6418         esac
6419         cat << EOM
6420
6421 I need to select a good name for the shared libperl.  If your system uses
6422 library names with major and minor numbers, then you might want something
6423 like $majmin.  Alternatively, if your system uses a single version
6424 number for shared libraries, then you might want to use $majonly.
6425 Or, your system might be quite happy with a simple libperl.$so.
6426
6427 Since the shared libperl will get installed into a version-specific
6428 architecture-dependent directory, the version number of the shared perl
6429 library probably isn't important, so the default should be o.k.
6430
6431 EOM
6432         rp='What name do you want to give to the shared libperl?'
6433         . ./myread
6434         libperl=$ans
6435         echo "Ok, I'll use $libperl"
6436         ;;
6437 *)
6438         libperl="libperl${_a}"
6439         ;;
6440 esac
6441
6442 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6443 case "$shrpdir" in
6444 '') ;;
6445 *)      $cat >&4 <<EOM
6446 WARNING:  Use of the shrpdir variable for the installation location of
6447 the shared $libperl is not supported.  It was never documented and
6448 will not work in this version.  Let me (perlbug@perl.com)
6449 know of any problems this may cause.
6450
6451 EOM
6452         case "$shrpdir" in
6453         "$archlibexp/CORE")
6454                 $cat >&4 <<EOM
6455 But your current setting of $shrpdir is
6456 the default anyway, so it's harmless.
6457 EOM
6458                 ;;
6459         *)
6460                 $cat >&4 <<EOM
6461 Further, your current attempted setting of $shrpdir
6462 conflicts with the value of $archlibexp/CORE
6463 that installperl will use.
6464 EOM
6465                 ;;
6466         esac
6467         ;;
6468 esac
6469
6470 # How will the perl executable find the installed shared $libperl?
6471 # Add $xxx to ccdlflags.
6472 # If we can't figure out a command-line option, use $shrpenv to
6473 # set env LD_RUN_PATH.  The main perl makefile uses this.
6474 shrpdir=$archlibexp/CORE
6475 xxx=''
6476 tmp_shrpenv=''
6477 if "$useshrplib"; then
6478     case "$osname" in 
6479         aix)
6480                 # We'll set it in Makefile.SH...
6481                 ;;
6482         solaris|netbsd)
6483                 xxx="-R $shrpdir"
6484                 ;;
6485         freebsd)
6486                 xxx="-Wl,-R$shrpdir"
6487                 ;;
6488         linux|irix*|dec_osf)
6489                 xxx="-Wl,-rpath,$shrpdir"
6490                 ;;
6491         next)
6492                 # next doesn't like the default...
6493                 ;;
6494         beos)
6495                 # beos doesn't like the default, either.
6496                 ;;
6497         hpux*)
6498                 # hpux doesn't like the default, either.
6499                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6500                 ;;
6501         *)
6502                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6503                 ;;
6504         esac
6505         case "$xxx" in
6506         '') ;;
6507         *)      
6508                 # Only add $xxx if it isn't already in ccdlflags.
6509                 case " $ccdlflags " in
6510                 *" $xxx "*)     ;;
6511                 *)      ccdlflags="$ccdlflags $xxx"
6512                         cat <<EOM >&4
6513
6514 Adding $xxx to the flags
6515 passed to $ld so that the perl executable will find the 
6516 installed shared $libperl.
6517
6518 EOM
6519                         ;;
6520                 esac
6521                 ;;
6522         esac
6523 fi
6524 # Fix ccdlflags in AIX for building external extensions.
6525 # (For building Perl itself bare -bE:perl.exp is needed,
6526 #  Makefile.SH takes care of this.)
6527 case "$osname" in
6528 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6529 esac
6530 # Respect a hint or command-line value.
6531 case "$shrpenv" in
6532 '') shrpenv="$tmp_shrpenv" ;;
6533 esac
6534 case "$ldlibpthname" in
6535 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6536 none)   ldlibpthname='' ;;
6537 esac
6538
6539 : determine where manual pages go
6540 set man1dir man1dir none
6541 eval $prefixit
6542 $cat <<EOM
6543
6544 $spackage has manual pages available in source form.
6545 EOM
6546 case "$nroff" in
6547 nroff)
6548         echo "However, you don't have nroff, so they're probably useless to you."
6549         case "$man1dir" in
6550         '') man1dir="none";;
6551         esac;;
6552 esac
6553 echo "If you don't want the manual sources installed, answer 'none'."
6554 case "$man1dir" in
6555 ' ') dflt=none
6556         ;;
6557 '')
6558         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6559         lookpath="$lookpath $prefixexp/man/p_man/man1"
6560         lookpath="$lookpath $prefixexp/man/u_man/man1"
6561         lookpath="$lookpath $prefixexp/man/man.1"
6562         case "$sysman" in
6563         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6564         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6565         esac
6566         set dflt
6567         eval $prefixup
6568         ;;
6569 *)  dflt="$man1dir"
6570         ;;
6571 esac
6572 echo " "
6573 fn=dn+~
6574 rp="Where do the main $spackage manual pages (source) go?"
6575 . ./getfile
6576 if $test "X$man1direxp" != "X$ansexp"; then
6577         installman1dir=''
6578 fi
6579 man1dir="$ans"
6580 man1direxp="$ansexp"
6581 case "$man1dir" in
6582 '')     man1dir=' '
6583         installman1dir='';;
6584 esac
6585
6586 : Change installation prefix, if necessary.
6587 if $test X"$prefix" != X"$installprefix"; then
6588         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6589 else
6590         installman1dir="$man1direxp"
6591 fi
6592
6593 : What suffix to use on installed man pages
6594
6595 case "$man1dir" in
6596 ' ')
6597         man1ext='0'
6598         ;;
6599 *)
6600         rp="What suffix should be used for the main $spackage man pages?"
6601         case "$man1ext" in
6602         '')     case "$man1dir" in
6603                 *1)  dflt=1 ;;
6604                 *1p) dflt=1p ;;
6605                 *1pm) dflt=1pm ;;
6606                 *l) dflt=l;;
6607                 *n) dflt=n;;
6608                 *o) dflt=o;;
6609                 *p) dflt=p;;
6610                 *C) dflt=C;;
6611                 *L) dflt=L;;
6612                 *L1) dflt=L1;;
6613                 *) dflt=1;;
6614                 esac
6615                 ;;
6616         *)      dflt="$man1ext";;
6617         esac
6618         . ./myread
6619         man1ext="$ans"
6620         ;;
6621 esac
6622
6623 : see if we can have long filenames
6624 echo " "
6625 first=123456789abcdef
6626 $rm -f $first
6627 if (echo hi >$first) 2>/dev/null; then
6628         if $test -f 123456789abcde; then
6629                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6630                 val="$undef"
6631         else
6632                 echo 'You can have filenames longer than 14 characters.'>&4
6633                 val="$define"
6634         fi
6635 else
6636         $cat <<'EOM'
6637 You can't have filenames longer than 14 chars.
6638 You can't even think about them!
6639 EOM
6640         val="$undef"
6641 fi 
6642 set d_flexfnam
6643 eval $setvar
6644 $rm -rf 123456789abcde*
6645
6646 : determine where library module manual pages go
6647 set man3dir man3dir none
6648 eval $prefixit
6649 $cat <<EOM
6650
6651 $spackage has manual pages for many of the library modules.
6652 EOM
6653
6654 case "$nroff" in
6655 nroff)
6656         $cat <<'EOM'
6657 However, you don't have nroff, so they're probably useless to you.
6658 EOM
6659         case "$man3dir" in
6660         '') man3dir="none";;
6661         esac;;
6662 esac
6663
6664 case "$d_flexfnam" in
6665 undef)
6666         $cat <<'EOM'
6667 However, your system can't handle the long file names like File::Basename.3. 
6668 EOM
6669         case "$man3dir" in
6670         '') man3dir="none";;
6671         esac;;
6672 esac
6673
6674 echo "If you don't want the manual sources installed, answer 'none'."
6675 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6676 case "$man3dir" in
6677 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6678         if $test -d "$privlib/man/man3"; then
6679                 cat <<EOM >&4
6680
6681 WARNING:  Previous versions of perl installed man3 pages into
6682 $privlib/man/man3.  This version will suggest a 
6683 new default of $dflt.  
6684 EOM
6685                 tdflt=$dflt
6686                 dflt='n'
6687                 rp='Do you wish to preserve the old behavior?(y/n)'
6688                 . ./myread
6689                 case "$ans" in
6690                 y*) dflt="$privlib/man/man3" ;;
6691                 *)  dflt=$tdflt ;;
6692                 esac
6693     fi
6694         ;;
6695 *)      dflt="$man3dir" ;;
6696 esac
6697 case "$dflt" in
6698 ' ') dflt=none ;;
6699 esac
6700 echo " "
6701 fn=dn+~
6702 rp="Where do the $package library man pages (source) go?"
6703 . ./getfile
6704 man3dir="$ans"
6705 man3direxp="$ansexp"
6706 case "$man3dir" in
6707 '')     man3dir=' '
6708         installman3dir='';;
6709 esac
6710
6711 : Change installation prefix, if necessary.
6712 if $test X"$prefix" != X"$installprefix"; then
6713         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6714 else
6715         installman3dir="$man3direxp"
6716 fi
6717
6718 : What suffix to use on installed man pages
6719 case "$man3dir" in
6720 ' ')
6721         man3ext='0'
6722         ;;
6723 *)
6724         rp="What suffix should be used for the $package library man pages?"
6725         case "$man3ext" in
6726         '')     case "$man3dir" in
6727                 *3)  dflt=3 ;;
6728                 *3p) dflt=3p ;;
6729                 *3pm) dflt=3pm ;;
6730                 *l) dflt=l;;
6731                 *n) dflt=n;;
6732                 *o) dflt=o;;
6733                 *p) dflt=p;;
6734                 *C) dflt=C;;
6735                 *L) dflt=L;;
6736                 *L3) dflt=L3;;
6737                 *) dflt=3;;
6738                 esac
6739                 ;;
6740         *)      dflt="$man3ext";;
6741         esac
6742         . ./myread
6743         man3ext="$ans"
6744         ;;
6745 esac
6746
6747 : see if we have to deal with yellow pages, now NIS.
6748 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6749         if $test -f /usr/etc/nibindd; then
6750                 echo " "
6751                 echo "I'm fairly confident you're on a NeXT."
6752                 echo " "
6753                 rp='Do you get the hosts file via NetInfo?'
6754                 dflt=y
6755                 case "$hostcat" in
6756                 nidump*) ;;
6757                 '') ;;
6758                 *) dflt=n;;
6759                 esac
6760                 . ./myread
6761                 case "$ans" in
6762                 y*) hostcat='nidump hosts .';;
6763                 *)      case "$hostcat" in
6764                         nidump*) hostcat='';;
6765                         esac
6766                         ;;
6767                 esac
6768         fi
6769         case "$hostcat" in
6770         nidump*) ;;
6771         *)
6772                 case "$hostcat" in
6773                 *ypcat*) dflt=y;;
6774                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6775                                 dflt=y
6776                         else
6777                                 dflt=n
6778                         fi;;
6779                 *) dflt=n;;
6780                 esac
6781                 echo " "
6782                 rp='Are you getting the hosts file via yellow pages?'
6783                 . ./myread
6784                 case "$ans" in
6785                 y*) hostcat='ypcat hosts';;
6786                 *) hostcat='cat /etc/hosts';;
6787                 esac
6788                 ;;
6789         esac
6790 fi
6791 case "$hostcat" in
6792 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6793 esac
6794 case "$groupcat" in
6795 '') test -f /etc/group && groupcat='cat /etc/group';;
6796 esac
6797 case "$passcat" in
6798 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6799 esac
6800
6801 : now get the host name
6802 echo " "
6803 echo "Figuring out host name..." >&4
6804 case "$myhostname" in
6805 '') cont=true
6806         echo 'Maybe "hostname" will work...'
6807         if tans=`sh -c hostname 2>&1` ; then
6808                 myhostname=$tans
6809                 phostname=hostname
6810                 cont=''
6811         fi
6812         ;;
6813 *) cont='';;
6814 esac
6815 if $test "$cont"; then
6816         if ./xenix; then
6817                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6818                 if tans=`cat /etc/systemid 2>&1` ; then
6819                         myhostname=$tans
6820                         phostname='cat /etc/systemid'
6821                         echo "Whadyaknow.  Xenix always was a bit strange..."
6822                         cont=''
6823                 fi
6824         elif $test -r /etc/systemid; then
6825                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6826         fi
6827 fi
6828 if $test "$cont"; then
6829         echo 'No, maybe "uuname -l" will work...'
6830         if tans=`sh -c 'uuname -l' 2>&1` ; then
6831                 myhostname=$tans
6832                 phostname='uuname -l'
6833         else
6834                 echo 'Strange.  Maybe "uname -n" will work...'
6835                 if tans=`sh -c 'uname -n' 2>&1` ; then
6836                         myhostname=$tans
6837                         phostname='uname -n'
6838                 else
6839                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6840                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6841                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6842                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6843                         else
6844                                 case "$myhostname" in
6845                                 '') echo "Does this machine have an identity crisis or something?"
6846                                         phostname='';;
6847                                 *)
6848                                         echo "Well, you said $myhostname before..."
6849                                         phostname='echo $myhostname';;
6850                                 esac
6851                         fi
6852                 fi
6853         fi
6854 fi
6855 : you do not want to know about this
6856 set $myhostname
6857 myhostname=$1
6858
6859 : verify guess
6860 if $test "$myhostname" ; then
6861         dflt=y
6862         rp='Your host name appears to be "'$myhostname'".'" Right?"
6863         . ./myread
6864         case "$ans" in
6865         y*) ;;
6866         *) myhostname='';;
6867         esac
6868 fi
6869
6870 : bad guess or no guess
6871 while $test "X$myhostname" = X ; do
6872         dflt=''
6873         rp="Please type the (one word) name of your host:"
6874         . ./myread
6875         myhostname="$ans"
6876 done
6877
6878 : translate upper to lower if necessary
6879 case "$myhostname" in
6880 *[A-Z]*)
6881         echo "(Normalizing case in your host name)"
6882         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6883         ;;
6884 esac
6885
6886 case "$myhostname" in
6887 *.*)
6888         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6889         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6890         echo "(Trimming domain name from host name--host name is now $myhostname)"
6891         ;;
6892 *) case "$mydomain" in
6893         '')
6894                 {
6895                         test "X$hostcat" = "Xypcat hosts" &&
6896                         ypmatch "$myhostname" hosts 2>/dev/null |\
6897                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6898                         $test -s hosts
6899                 } || {
6900                         test "X$hostcat" != "X" &&
6901                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6902                                         /[       ]$myhostname[  . ]/p" > hosts
6903                 }
6904                 tmp_re="[       . ]"
6905                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6906                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6907                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6908                         hosts | $sort | $uniq | \
6909                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6910                 case `$echo X$dflt` in
6911                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6912                         dflt=.
6913                         ;;
6914                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6915                         ;;
6916                 esac
6917                 case "$dflt" in
6918                 .)
6919                         tans=`./loc resolv.conf X /etc /usr/etc`
6920                         if $test -f "$tans"; then
6921                                 echo "(Attempting domain name extraction from $tans)"
6922                                 dflt=.`$sed -n -e 's/   / /g' \
6923                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6924                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6925                                 case "$dflt" in
6926                                 .) dflt=.`$sed -n -e 's/        / /g' \
6927                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6928                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6929                                         ;;
6930                                 esac
6931                         fi
6932                         ;;
6933                 esac
6934                 case "$dflt" in
6935                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6936                         dflt=.`sh -c domainname 2>/dev/null`
6937                         case "$dflt" in
6938                         '') dflt='.';;
6939                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6940                         esac
6941                         ;;
6942                 esac
6943                 case "$dflt" in
6944                 .) echo "(Lost all hope -- silly guess then)"
6945                         dflt='.uucp'
6946                         ;;
6947                 esac
6948                 $rm -f hosts
6949                 ;;
6950         *) dflt="$mydomain";;
6951         esac;;
6952 esac
6953 echo " "
6954 rp="What is your domain name?"
6955 . ./myread
6956 tans="$ans"
6957 case "$ans" in
6958 '') ;;
6959 .*) ;;
6960 *) tans=".$tans";;
6961 esac
6962 mydomain="$tans"
6963
6964 : translate upper to lower if necessary
6965 case "$mydomain" in
6966 *[A-Z]*)
6967         echo "(Normalizing case in your domain name)"
6968         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6969         ;;
6970 esac
6971
6972 : a little sanity check here
6973 case "$phostname" in
6974 '') ;;
6975 *)
6976         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6977         $myhostname$mydomain|$myhostname) ;;
6978         *)
6979                 case "$phostname" in
6980                 sed*)
6981                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6982                         ;;
6983                 *)
6984                         echo "(That doesn't agree with your $phostname command, by the way.)"
6985                         ;;
6986                 esac
6987         ;;
6988         esac
6989         ;;
6990 esac
6991
6992 $cat <<EOM
6993
6994 I need to get your e-mail address in Internet format if possible, i.e.
6995 something like user@host.domain. Please answer accurately since I have
6996 no easy means to double check it. The default value provided below
6997 is most probably close to reality but may not be valid from outside
6998 your organization...
6999
7000 EOM
7001 cont=x
7002 while test "$cont"; do
7003         case "$cf_email" in
7004         '') dflt="$cf_by@$myhostname$mydomain";;
7005         *) dflt="$cf_email";;
7006         esac
7007         rp='What is your e-mail address?'
7008         . ./myread
7009         cf_email="$ans"
7010         case "$cf_email" in
7011         *@*.*) cont='' ;;
7012         *)
7013                 rp='Address does not look like an Internet one.  Use it anyway?'
7014                 case "$fastread" in
7015                 yes) dflt=y ;;
7016                 *) dflt=n ;;
7017                 esac
7018                 . ./myread
7019                 case "$ans" in
7020                 y*) cont='' ;;
7021                 *) echo " " ;;
7022                 esac
7023                 ;;
7024         esac
7025 done
7026
7027 $cat <<EOM
7028
7029 If you or somebody else will be maintaining perl at your site, please
7030 fill in the correct e-mail address here so that they may be contacted
7031 if necessary. Currently, the "perlbug" program included with perl
7032 will send mail to this address in addition to perlbug@perl.com. You may
7033 enter "none" for no administrator.
7034
7035 EOM
7036 case "$perladmin" in
7037 '') dflt="$cf_email";;
7038 *) dflt="$perladmin";;
7039 esac
7040 rp='Perl administrator e-mail address'
7041 . ./myread
7042 perladmin="$ans"
7043
7044 : figure out how to guarantee perl startup
7045 case "$startperl" in
7046 '')
7047         case "$sharpbang" in
7048         *!)
7049                 $cat <<EOH
7050
7051 I can use the #! construct to start perl on your system. This will
7052 make startup of perl scripts faster, but may cause problems if you
7053 want to share those scripts and perl is not in a standard place
7054 ($binexp/perl) on all your platforms. The alternative is to force
7055 a shell by starting the script with a single ':' character.
7056
7057 EOH
7058                 dflt="$binexp/perl"
7059                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7060                 . ./myread
7061                 case "$ans" in
7062                 none)   startperl=": # use perl";;
7063                 *)      startperl="#!$ans"
7064                         if $test 30 -lt `echo "$ans" | wc -c`; then
7065                                 $cat >&4 <<EOM
7066
7067 WARNING:  Some systems limit the #! command to 32 characters.
7068 If you experience difficulty running Perl scripts with #!, try
7069 installing Perl in a directory with a shorter pathname.
7070
7071 EOM
7072                         fi ;;
7073                 esac
7074                 ;;
7075         *) startperl=": # use perl"
7076                 ;;
7077         esac
7078         ;;
7079 esac
7080 echo "I'll use $startperl to start perl scripts."
7081
7082 : figure best path for perl in scripts
7083 case "$perlpath" in
7084 '')
7085         perlpath="$binexp/perl"
7086         case "$startperl" in
7087         *!*) ;;
7088         *)
7089                 $cat <<EOH
7090
7091 I will use the "eval 'exec'" idiom to start Perl on your system.
7092 I can use the full path of your Perl binary for this purpose, but
7093 doing so may cause problems if you want to share those scripts and
7094 Perl is not always in a standard place ($binexp/perl).
7095
7096 EOH
7097                 dflt="$binexp/perl"
7098                 rp="What path shall I use in \"eval 'exec'\"?"
7099                 . ./myread
7100                 perlpath="$ans"
7101                 ;;
7102         esac
7103         ;;
7104 esac
7105 case "$startperl" in
7106 *!*)    ;;
7107 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7108 esac
7109
7110 : determine where public executable scripts go
7111 set scriptdir scriptdir
7112 eval $prefixit
7113 case "$scriptdir" in
7114 '')
7115         dflt="$bin"
7116         : guess some guesses
7117         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7118         $test -d /usr/share/bin     && dflt=/usr/share/bin
7119         $test -d /usr/local/script  && dflt=/usr/local/script
7120         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7121         $test -d $prefixexp/script  && dflt=$prefixexp/script
7122         set dflt
7123         eval $prefixup
7124         ;;
7125 *)  dflt="$scriptdir"
7126         ;;
7127 esac
7128 $cat <<EOM
7129  
7130 Some installations have a separate directory just for executable scripts so
7131 that they can mount it across multiple architectures but keep the scripts in
7132 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7133 Or you might just lump your scripts in with all your other executables.
7134  
7135 EOM
7136 fn=d~
7137 rp='Where do you keep publicly executable scripts?'
7138 . ./getfile
7139 if $test "X$ansexp" != "X$scriptdirexp"; then
7140         installscript=''
7141 fi
7142 scriptdir="$ans"
7143 scriptdirexp="$ansexp"
7144 : Change installation prefix, if necessary.
7145 if $test X"$prefix" != X"$installprefix"; then
7146         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7147 else
7148         installscript="$scriptdirexp"
7149 fi
7150
7151 : determine where site specific architecture-dependent libraries go.
7152 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7153 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7154 : sitelib may have an optional trailing /share.
7155 case "$sitearch" in
7156 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7157         dflt="$dflt/$archname"
7158         ;;
7159 *)      dflt="$sitearch"
7160         ;;
7161 esac
7162 set sitearch sitearch none
7163 eval $prefixit
7164 $cat <<EOM
7165
7166 The installation process will also create a directory for
7167 architecture-dependent site-specific extensions and modules.
7168
7169 EOM
7170 fn=d~+
7171 rp='Pathname for the site-specific architecture-dependent library files?'
7172 . ./getfile
7173 sitearch="$ans"
7174 sitearchexp="$ansexp"
7175 : Change installation prefix, if necessary.
7176 if $test X"$prefix" != X"$installprefix"; then
7177         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7178 else
7179         installsitearch="$sitearchexp"
7180 fi
7181
7182 : determine where add-on public executables go
7183 case "$sitebin" in
7184 '')     dflt=$siteprefix/bin ;;
7185 *)      dflt=$sitebin ;;
7186 esac
7187 fn=d~
7188 rp='Pathname where the add-on public executables should be installed?'
7189 . ./getfile
7190 sitebin="$ans"
7191 sitebinexp="$ansexp"
7192 : Change installation prefix, if necessary.
7193 if $test X"$prefix" != X"$installprefix"; then
7194         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7195 else
7196         installsitebin="$sitebinexp"
7197 fi
7198
7199 : see if sqrtl exists
7200 set sqrtl d_sqrtl
7201 eval $inlibc
7202
7203 case "$ccflags" in
7204 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7205 esac
7206
7207 case "$uselongdouble" in
7208 $define|true|[yY]*)     dflt='y';;
7209 *) dflt='n';;
7210 esac
7211 cat <<EOM
7212
7213 Perl can be built to take advantage of long doubles which
7214 (if available) may give more accuracy and range for floating point numbers.
7215
7216 If this doesn't make any sense to you, just accept the default '$dflt'.
7217 EOM
7218 rp='Try to use long doubles if available?'
7219 . ./myread
7220 case "$ans" in
7221 y|Y)    val="$define"   ;;
7222 *)      val="$undef"    ;;
7223 esac
7224 set uselongdouble
7225 eval $setvar
7226
7227 case "$uselongdouble" in
7228 true|[yY]*) uselongdouble="$define" ;;
7229 esac
7230
7231 case "$uselongdouble" in
7232 $define)
7233 : Look for a hint-file generated 'call-back-unit'.  If the
7234 : user has specified that long doubles should be used,
7235 : we may need to set or change some other defaults.
7236         if $test -f uselongdouble.cbu; then
7237                 echo "Your platform has some specific hints for long doubles, using them..."
7238                 . ./uselongdouble.cbu
7239         else
7240                 $cat <<EOM
7241 (Your platform doesn't have any specific hints for long doubles.)
7242 EOM
7243         fi
7244         ;;
7245 esac
7246
7247 case "$uselongdouble:$d_sqrtl" in
7248 $define:$undef)
7249                 $cat <<EOM >&4
7250
7251 *** You requested the use of long doubles but you do not seem to have
7252 *** the mathematic functions for long doubles.  I'm disabling the use
7253 *** of long doubles.
7254
7255 EOM
7256         uselongdouble=$undef
7257         ;;
7258 esac
7259
7260 case "$useperlio" in
7261 $define|true|[yY]*)     dflt='y';;
7262 *) dflt='n';;
7263 esac
7264 cat <<EOM
7265
7266 Previous version of $package used the standard IO mechanisms as defined
7267 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7268 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7269 the default.  This abstraction layer can use AT&T's sfio (if you already
7270 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7271 problems with some extension modules.  Using PerlIO with stdio is safe,
7272 but it is slower than plain stdio and therefore is not the default.
7273
7274 If this doesn't make any sense to you, just accept the default '$dflt'.
7275 EOM
7276 rp='Use the experimental PerlIO abstraction layer?'
7277 . ./myread
7278 case "$ans" in
7279 y|Y) 
7280         val="$define"
7281         ;;     
7282 *)      
7283         echo "Ok, doing things the stdio way"
7284         val="$undef"
7285         ;;
7286 esac
7287 set useperlio
7288 eval $setvar 
7289
7290 case "$vendorprefix" in
7291 '')     d_vendorbin="$undef"
7292         vendorbin=''
7293         vendorbinexp=''
7294         ;;
7295 *)      d_vendorbin="$define"
7296         : determine where vendor-supplied executables go.
7297         case "$vendorbin" in
7298         '') dflt=$vendorprefix/bin ;;
7299         *)      dflt="$vendorbin" ;;
7300         esac
7301         fn=d~+
7302         rp='Pathname for the vendor-supplied executables directory?'
7303         . ./getfile
7304         vendorbin="$ans"
7305         vendorbinexp="$ansexp"
7306         ;;
7307 esac
7308 : Change installation prefix, if necessary.
7309 if $test X"$prefix" != X"$installprefix"; then
7310         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7311 else
7312         installvendorbin="$vendorbinexp"
7313 fi
7314
7315 : see if qgcvt exists
7316 set qgcvt d_qgcvt
7317 eval $inlibc
7318
7319 : check for length of double
7320 echo " "
7321 case "$doublesize" in
7322 '')
7323         echo "Checking to see how big your double precision numbers are..." >&4
7324         $cat >try.c <<'EOCP'
7325 #include <stdio.h>
7326 int main()
7327 {
7328     printf("%d\n", (int)sizeof(double));
7329     exit(0);
7330 }
7331 EOCP
7332         set try
7333         if eval $compile_ok; then
7334                 doublesize=`./try`
7335                 echo "Your double is $doublesize bytes long."
7336         else
7337                 dflt='8'
7338                 echo "(I can't seem to compile the test program.  Guessing...)"
7339                 rp="What is the size of a double precision number (in bytes)?"
7340                 . ./myread
7341                 doublesize="$ans"
7342         fi
7343         ;;
7344 esac
7345 $rm -f try.c try
7346
7347 : check for long doubles
7348 echo " "
7349 echo "Checking to see if you have long double..." >&4
7350 echo 'int main() { long double x = 7.0; }' > try.c
7351 set try
7352 if eval $compile; then
7353         val="$define"
7354         echo "You have long double."
7355 else
7356         val="$undef"
7357         echo "You do not have long double."
7358 fi
7359 $rm try.*
7360 set d_longdbl
7361 eval $setvar
7362
7363 : check for length of long double
7364 case "${d_longdbl}${longdblsize}" in
7365 $define)
7366         echo " "
7367         echo "Checking to see how big your long doubles are..." >&4
7368         $cat >try.c <<'EOCP'
7369 #include <stdio.h>
7370 int main()
7371 {
7372         printf("%d\n", sizeof(long double));
7373 }
7374 EOCP
7375         set try
7376         set try
7377         if eval $compile; then
7378                 longdblsize=`./try$exe_ext`
7379                 echo "Your long doubles are $longdblsize bytes long."
7380         else
7381                 dflt='8'
7382                 echo " "
7383                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7384                 rp="What is the size of a long double (in bytes)?"
7385                 . ./myread
7386                 longdblsize="$ans"
7387         fi
7388         if $test "X$doublesize" = "X$longdblsize"; then
7389                 echo "(That isn't any different from an ordinary double.)"
7390         fi      
7391         ;;
7392 esac
7393 $rm -f try.* try
7394
7395 echo " "
7396
7397 if $test X"$d_longdbl" = X"$define"; then
7398
7399 echo "Checking how to print long doubles..." >&4
7400
7401 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7402         $cat >try.c <<'EOCP'
7403 #include <sys/types.h>
7404 #include <stdio.h>
7405 int main() {
7406   double d = 123.456;
7407   printf("%.3f\n", d);
7408 }
7409 EOCP
7410         set try
7411         if eval $compile; then
7412                 yyy=`./try$exe_ext`
7413                 case "$yyy" in
7414                 123.456)
7415                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7416                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7417                         echo "We will use %f."
7418                         ;;
7419                 esac
7420         fi
7421 fi
7422
7423 if $test X"$sPRIfldbl" = X; then
7424         $cat >try.c <<'EOCP'
7425 #include <sys/types.h>
7426 #include <stdio.h>
7427 int main() {
7428   long double d = 123.456;
7429   printf("%.3llf\n", d);
7430 }
7431 EOCP
7432         set try
7433         if eval $compile; then
7434                 yyy=`./try$exe_ext`
7435                 case "$yyy" in
7436                 123.456)
7437                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7438                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7439                         echo "We will use %llf."
7440                         ;;
7441                 esac
7442         fi
7443 fi
7444
7445 if $test X"$sPRIfldbl" = X; then
7446         $cat >try.c <<'EOCP'
7447 #include <sys/types.h>
7448 #include <stdio.h>
7449 int main() {
7450   long double d = 123.456;
7451   printf("%.3Lf\n", d);
7452 }
7453 EOCP
7454         set try
7455         if eval $compile; then
7456                 yyy=`./try$exe_ext`
7457                 case "$yyy" in
7458                 123.456)
7459                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7460                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7461                         echo "We will use %Lf."
7462                         ;;
7463                 esac
7464         fi
7465 fi
7466
7467 if $test X"$sPRIfldbl" = X; then
7468         $cat >try.c <<'EOCP'
7469 #include <sys/types.h>
7470 #include <stdio.h>
7471 int main() {
7472   long double d = 123.456;
7473   printf("%.3lf\n", d);
7474 }
7475 EOCP
7476         set try
7477         if eval $compile; then
7478                 yyy=`./try$exe_ext`
7479                 case "$yyy" in
7480                 123.456)
7481                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7482                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7483                         echo "We will use %lf."
7484                         ;;
7485                 esac
7486         fi
7487 fi
7488
7489 if $test X"$sPRIfldbl" = X; then
7490         echo "Cannot figure out how to print long doubles." >&4
7491 fi
7492
7493 $rm -f try try.*
7494
7495 fi # d_longdbl
7496
7497 case "$sPRIfldbl" in
7498 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7499         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7500         ;;
7501 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7502         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7503         ;;
7504 esac
7505
7506 : Check how to convert floats to strings.
7507 if test "X$d_Gconvert" = X; then
7508         echo " "
7509         echo "Checking for an efficient way to convert floats to strings."
7510         echo " " > try.c
7511         case "$uselongdouble" in
7512         "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7513         esac
7514         case "$d_longdbl" in
7515         "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7516         esac
7517         case "$d_PRIgldbl" in
7518         "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7519         esac
7520         $cat >>try.c <<EOP
7521 #ifdef TRY_gconvert
7522 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7523 char *myname = "gconvert";
7524 #endif
7525 #ifdef TRY_gcvt
7526 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7527 char *myname = "gcvt";
7528 #endif
7529 #ifdef TRY_qgcvt
7530 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7531 char *myname = "qgcvt";
7532 #define DOUBLETYPE long double
7533 #endif
7534 #ifdef TRY_sprintf
7535 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7536 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7537 #else
7538 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7539 #endif
7540 char *myname = "sprintf";
7541 #endif
7542
7543 #ifndef DOUBLETYPE
7544 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7545 #define DOUBLETYPE long double
7546 #else
7547 #define DOUBLETYPE double
7548 #endif
7549 #endif
7550
7551 #include <stdio.h>
7552
7553 #define I_STDLIB $i_stdlib
7554 #ifdef I_STDLIB
7555 #include <stdlib.h>
7556 #endif
7557
7558 int
7559 checkit(expect, got)
7560 char *expect;
7561 char *got;
7562 {
7563     if (strcmp(expect, got)) {
7564                 printf("%s oddity:  Expected %s, got %s\n",
7565                         myname, expect, got);
7566                 exit(1);
7567         }
7568 }
7569
7570 int main()
7571
7572         char buf[64]; 
7573         buf[63] = '\0';
7574
7575         /* This must be 1st test on (which?) platform */
7576         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7577         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7578         checkit("0.1", buf);
7579
7580         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7581         checkit("1", buf);
7582
7583         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7584         checkit("1.1", buf);
7585
7586         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7587         checkit("1.01", buf);
7588
7589         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7590         checkit("1.001", buf);
7591
7592         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7593         checkit("1.0001", buf);
7594
7595         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7596         checkit("1.00001", buf);
7597
7598         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7599         checkit("1.000001", buf);
7600
7601         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7602         checkit("0", buf);
7603
7604         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7605         checkit("-1", 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         /* Some Linux gcvt's give -1.e+5 here. */
7612         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7613         checkit("-100000", buf);
7614
7615         exit(0);
7616 }
7617 EOP
7618         case "$d_Gconvert" in
7619         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7620         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7621         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7622         *) xxx_list='gconvert gcvt sprintf' ;;
7623         esac
7624
7625         case "$d_longdbl$uselongdouble$d_qgcvt" in
7626         "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7627         esac
7628
7629         for xxx_convert in $xxx_list; do
7630                 echo "Trying $xxx_convert..."
7631                 $rm -f try try$_o
7632                 set try -DTRY_$xxx_convert
7633                 if eval $compile; then
7634                         echo "$xxx_convert() found." >&4
7635                         if ./try; then
7636                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7637                                 break;
7638                         else
7639                                 echo "...But $xxx_convert didn't work as I expected."
7640                         fi
7641                 else
7642                         echo "$xxx_convert NOT found." >&4
7643                 fi
7644         done
7645                 
7646         case "$xxx_convert" in
7647         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7648         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7649         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7650         *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7651            "$define$define$define")
7652               d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7653            *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7654            esac
7655            ;;  
7656         esac
7657 fi
7658
7659 : Initialize h_fcntl
7660 h_fcntl=false
7661
7662 : Initialize h_sysfile
7663 h_sysfile=false
7664
7665 : access call always available on UNIX
7666 set access d_access
7667 eval $inlibc
7668
7669 : locate the flags for 'access()'
7670 case "$d_access" in
7671 "$define")
7672         echo " "
7673         $cat >access.c <<'EOCP'
7674 #include <sys/types.h>
7675 #ifdef I_FCNTL
7676 #include <fcntl.h>
7677 #endif
7678 #ifdef I_SYS_FILE
7679 #include <sys/file.h>
7680 #endif
7681 #ifdef I_UNISTD
7682 #include <unistd.h>
7683 #endif
7684 int main() {
7685         exit(R_OK);
7686 }
7687 EOCP
7688         : check sys/file.h first, no particular reason here
7689         if $test `./findhdr sys/file.h` && \
7690                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7691                 h_sysfile=true;
7692                 echo "<sys/file.h> defines the *_OK access constants." >&4
7693         elif $test `./findhdr fcntl.h` && \
7694                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7695                 h_fcntl=true;
7696                 echo "<fcntl.h> defines the *_OK access constants." >&4
7697         elif $test `./findhdr unistd.h` && \
7698                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7699                 echo "<unistd.h> defines the *_OK access constants." >&4
7700         else
7701                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7702         fi
7703         ;;
7704 esac
7705 $rm -f access*
7706
7707 : see if accessx exists
7708 set accessx d_accessx
7709 eval $inlibc
7710
7711 : see if alarm exists
7712 set alarm d_alarm
7713 eval $inlibc
7714
7715 : see if atolf exists
7716 set atolf d_atolf
7717 eval $inlibc
7718
7719 : see if atoll exists
7720 set atoll d_atoll
7721 eval $inlibc
7722
7723 : Look for GNU-cc style attribute checking
7724 echo " "
7725 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7726 $cat >attrib.c <<'EOCP'
7727 #include <stdio.h>
7728 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7729 EOCP
7730 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7731         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7732                 echo "Your C compiler doesn't fully support __attribute__."
7733                 val="$undef"
7734         else
7735                 echo "Your C compiler supports __attribute__."
7736                 val="$define"
7737         fi
7738 else
7739         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7740         val="$undef"
7741 fi
7742 set d_attribut
7743 eval $setvar
7744 $rm -f attrib*
7745
7746 : see if bcmp exists
7747 set bcmp d_bcmp
7748 eval $inlibc
7749
7750 : see if bcopy exists
7751 set bcopy d_bcopy
7752 eval $inlibc
7753
7754 : see if this is a unistd.h system
7755 set unistd.h i_unistd
7756 eval $inhdr
7757
7758 : see if getpgrp exists
7759 set getpgrp d_getpgrp
7760 eval $inlibc
7761
7762 case "$d_getpgrp" in
7763 "$define")
7764         echo " "
7765         echo "Checking to see which flavor of getpgrp is in use..."
7766         $cat >set.c <<EOP
7767 #$i_unistd I_UNISTD
7768 #include <sys/types.h>
7769 #ifdef I_UNISTD
7770 #  include <unistd.h>
7771 #endif
7772 int main()
7773 {
7774         if (getuid() == 0) {
7775                 printf("(I see you are running Configure as super-user...)\n");
7776                 setuid(1);
7777         }
7778 #ifdef TRY_BSD_PGRP
7779         if (getpgrp(1) == 0)
7780                 exit(0);
7781 #else
7782         if (getpgrp() > 0)
7783                 exit(0);
7784 #endif
7785         exit(1);
7786 }
7787 EOP
7788         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7789                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7790                 val="$define"
7791         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7792                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7793                 val="$undef"
7794         else
7795                 echo "I can't seem to compile and run the test program."
7796                 if ./usg; then
7797                         xxx="a USG one, i.e. you use getpgrp()."
7798                 else
7799                         # SVR4 systems can appear rather BSD-ish.
7800                         case "$i_unistd" in
7801                         $undef)
7802                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7803                                 val="$define"
7804                                 ;;
7805                         $define)
7806                                 xxx="probably a USG one, i.e. you use getpgrp()."
7807                                 val="$undef"
7808                                 ;;
7809                         esac
7810                 fi
7811                 echo "Assuming your getpgrp is $xxx" >&4
7812         fi
7813         ;;
7814 *) val="$undef";;
7815 esac
7816 set d_bsdgetpgrp
7817 eval $setvar
7818 $rm -f set set.c
7819
7820 : see if setpgrp exists
7821 set setpgrp d_setpgrp
7822 eval $inlibc
7823
7824 case "$d_setpgrp" in
7825 "$define")
7826         echo " "
7827         echo "Checking to see which flavor of setpgrp is in use..."
7828         $cat >set.c <<EOP
7829 #$i_unistd I_UNISTD
7830 #include <sys/types.h>
7831 #ifdef I_UNISTD
7832 #  include <unistd.h>
7833 #endif
7834 int main()
7835 {
7836         if (getuid() == 0) {
7837                 printf("(I see you are running Configure as super-user...)\n");
7838                 setuid(1);
7839         }
7840 #ifdef TRY_BSD_PGRP
7841         if (-1 == setpgrp(1, 1))
7842                 exit(0);
7843 #else
7844         if (setpgrp() != -1)
7845                 exit(0);
7846 #endif
7847         exit(1);
7848 }
7849 EOP
7850         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7851                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7852                 val="$define"
7853         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7854                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7855                 val="$undef"
7856         else
7857                 echo "(I can't seem to compile and run the test program.)"
7858                 if ./usg; then
7859                         xxx="a USG one, i.e. you use setpgrp()."
7860                 else
7861                         # SVR4 systems can appear rather BSD-ish.
7862                         case "$i_unistd" in
7863                         $undef)
7864                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7865                                 val="$define"
7866                                 ;;
7867                         $define)
7868                                 xxx="probably a USG one, i.e. you use setpgrp()."
7869                                 val="$undef"
7870                                 ;;
7871                         esac
7872                 fi
7873                 echo "Assuming your setpgrp is $xxx" >&4
7874         fi
7875         ;;
7876 *) val="$undef";;
7877 esac
7878 set d_bsdsetpgrp
7879 eval $setvar
7880 $rm -f set set.c
7881 : see if bzero exists
7882 set bzero d_bzero
7883 eval $inlibc
7884
7885 : see if signal is declared as pointer to function returning int or void
7886 echo " "
7887 xxx=`./findhdr signal.h`
7888 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7889 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7890         echo "You have int (*signal())() instead of void." >&4
7891         val="$undef"
7892 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7893         echo "You have void (*signal())()." >&4
7894         val="$define"
7895 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7896         echo "You have int (*signal())() instead of void." >&4
7897         val="$undef"
7898 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7899         echo "You have void (*signal())()." >&4
7900         val="$define"
7901 else
7902         case "$d_voidsig" in
7903         '')
7904         echo "I can't determine whether signal handler returns void or int..." >&4
7905                 dflt=void
7906                 rp="What type does your signal handler return?"
7907                 . ./myread
7908                 case "$ans" in
7909                 v*) val="$define";;
7910                 *) val="$undef";;
7911                 esac;;
7912         "$define")
7913                 echo "As you already told me, signal handler returns void." >&4
7914                 val="$define"
7915                 ;;
7916         *)      echo "As you already told me, signal handler returns int." >&4
7917                 val="$undef"
7918                 ;;
7919         esac
7920 fi
7921 set d_voidsig
7922 eval $setvar
7923 case "$d_voidsig" in
7924 "$define") signal_t="void";;
7925 *) signal_t="int";;
7926 esac
7927 $rm -f $$.tmp
7928
7929 : check for ability to cast large floats to 32-bit ints.
7930 echo " "
7931 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7932 if $test "$intsize" -ge 4; then
7933         xxx=int
7934 else
7935         xxx=long
7936 fi
7937 $cat >try.c <<EOCP
7938 #include <stdio.h>
7939 #include <sys/types.h>
7940 #include <signal.h>
7941 $signal_t blech(s) int s; { exit(3); }
7942 int main()
7943 {
7944         $xxx i32;
7945         double f, g;
7946         int result = 0;
7947         char str[16];
7948         signal(SIGFPE, blech);
7949
7950         /* Don't let compiler optimize the test away.  Store the number 
7951            in a writable string for gcc to pass to sscanf under HP/UX.
7952         */
7953         sprintf(str, "2147483647");
7954         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7955         g = 10 * f;
7956         i32  = ($xxx) g;
7957
7958         /* x86 processors will probably give 0x8000 0000, which is a
7959        sign change.  We don't want that.  We want to mimic SPARC
7960            behavior here, which is to preserve the sign and give
7961            back 0x7fff ffff.
7962         */
7963         if (i32 != ($xxx) f)
7964                 result |= 1;
7965         exit(result);
7966 }
7967 EOCP
7968 set try
7969 if eval $compile_ok; then
7970         ./try
7971         yyy=$?
7972 else
7973         echo "(I can't seem to compile the test program--assuming it can't)"
7974         yyy=1
7975 fi
7976 case "$yyy" in
7977 0)      val="$define"
7978         echo "Yup, it can."
7979         ;;
7980 *)      val="$undef"
7981         echo "Nope, it can't."
7982         ;;
7983 esac
7984 set d_casti32
7985 eval $setvar
7986 $rm -f try try.*
7987
7988 : check for ability to cast negative floats to unsigned
7989 echo " "
7990 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7991 $cat >try.c <<EOCP
7992 #include <stdio.h>
7993 #include <sys/types.h>
7994 #include <signal.h>
7995 $signal_t blech(s) int s; { exit(7); }
7996 $signal_t blech_in_list(s) int s; { exit(4); }
7997 unsigned long dummy_long(p) unsigned long p; { return p; }
7998 unsigned int dummy_int(p) unsigned int p; { return p; }
7999 unsigned short dummy_short(p) unsigned short p; { return p; }
8000 int main()
8001 {
8002         double f;
8003         unsigned long along;
8004         unsigned int aint;
8005         unsigned short ashort;
8006         int result = 0;
8007         char str[16];
8008         
8009         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8010            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8011            optimized the whole file away
8012         */
8013         /* Store the number in a writable string for gcc to pass to 
8014            sscanf under HP/UX.
8015         */
8016         sprintf(str, "-123");
8017         sscanf(str, "%lf", &f);  /* f = -123.; */
8018
8019         signal(SIGFPE, blech);
8020         along = (unsigned long)f;
8021         aint = (unsigned int)f;
8022         ashort = (unsigned short)f;
8023         if (along != (unsigned long)-123)
8024                 result |= 1;
8025         if (aint != (unsigned int)-123)
8026                 result |= 1;
8027         if (ashort != (unsigned short)-123)
8028                 result |= 1;
8029         sprintf(str, "1073741824.");
8030         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8031         f = f + f;
8032         along = 0;
8033         along = (unsigned long)f;
8034         if (along != 0x80000000)
8035                 result |= 2;
8036         f -= 1.;
8037         along = 0;
8038         along = (unsigned long)f;
8039         if (along != 0x7fffffff)
8040                 result |= 1;
8041         f += 2.;
8042         along = 0;
8043         along = (unsigned long)f;
8044         if (along != 0x80000001)
8045                 result |= 2;
8046         if (result)
8047                 exit(result);
8048         signal(SIGFPE, blech_in_list);
8049         sprintf(str, "123.");
8050         sscanf(str, "%lf", &f);  /* f = 123.; */
8051         along = dummy_long((unsigned long)f);
8052         aint = dummy_int((unsigned int)f);
8053         ashort = dummy_short((unsigned short)f);
8054         if (along != (unsigned long)123)
8055                 result |= 4;
8056         if (aint != (unsigned int)123)
8057                 result |= 4;
8058         if (ashort != (unsigned short)123)
8059                 result |= 4;
8060         exit(result);
8061
8062 }
8063 EOCP
8064 set try
8065 if eval $compile_ok; then
8066         ./try
8067         castflags=$?
8068 else
8069         echo "(I can't seem to compile the test program--assuming it can't)"
8070         castflags=7
8071 fi
8072 case "$castflags" in
8073 0)      val="$define"
8074         echo "Yup, it can."
8075         ;;
8076 *)      val="$undef"
8077         echo "Nope, it can't."
8078         ;;
8079 esac
8080 set d_castneg
8081 eval $setvar
8082 $rm -f try.*
8083
8084 : see if vprintf exists
8085 echo " "
8086 if set vprintf val -f d_vprintf; eval $csym; $val; then
8087         echo 'vprintf() found.' >&4
8088         val="$define"
8089         $cat >vprintf.c <<'EOF'
8090 #include <varargs.h>
8091
8092 int main() { xxx("foo"); }
8093
8094 xxx(va_alist)
8095 va_dcl
8096 {
8097         va_list args;
8098         char buf[10];
8099
8100         va_start(args);
8101         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8102 }
8103 EOF
8104         set vprintf
8105         if eval $compile && ./vprintf; then
8106                 echo "Your vsprintf() returns (int)." >&4
8107                 val2="$undef"
8108         else
8109                 echo "Your vsprintf() returns (char*)." >&4
8110                 val2="$define"
8111         fi
8112 else
8113         echo 'vprintf() NOT found.' >&4
8114                 val="$undef"
8115                 val2="$undef"
8116 fi
8117 set d_vprintf
8118 eval $setvar
8119 val=$val2
8120 set d_charvspr
8121 eval $setvar
8122
8123 : see if chown exists
8124 set chown d_chown
8125 eval $inlibc
8126
8127 : see if chroot exists
8128 set chroot d_chroot
8129 eval $inlibc
8130
8131 : see if chsize exists
8132 set chsize d_chsize
8133 eval $inlibc
8134
8135 : check for const keyword
8136 echo " "
8137 echo 'Checking to see if your C compiler knows about "const"...' >&4
8138 $cat >const.c <<'EOCP'
8139 typedef struct spug { int drokk; } spug;
8140 int main()
8141 {
8142         const char *foo;
8143         const spug y;
8144 }
8145 EOCP
8146 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8147         val="$define"
8148         echo "Yup, it does."
8149 else
8150         val="$undef"
8151         echo "Nope, it doesn't."
8152 fi
8153 set d_const
8154 eval $setvar
8155
8156 : see if crypt exists
8157 echo " "
8158 if set crypt val -f d_crypt; eval $csym; $val; then
8159         echo 'crypt() found.' >&4
8160         val="$define"
8161         cryptlib=''
8162 else
8163         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8164         if $test -z "$cryptlib"; then
8165                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8166         else
8167                 cryptlib=-lcrypt
8168         fi
8169         if $test -z "$cryptlib"; then
8170                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8171         else
8172                 cryptlib=-lcrypt
8173         fi
8174         if $test -z "$cryptlib"; then
8175                 cryptlib=`./loc libcrypt$_a "" $libpth`
8176         else
8177                 cryptlib=-lcrypt
8178         fi
8179         if $test -z "$cryptlib"; then
8180                 echo 'crypt() NOT found.' >&4
8181                 val="$undef"
8182         else
8183                 val="$define"
8184         fi
8185 fi
8186 set d_crypt
8187 eval $setvar
8188
8189 : get csh whereabouts
8190 case "$csh" in
8191 'csh') val="$undef" ;;
8192 *) val="$define" ;;
8193 esac
8194 set d_csh
8195 eval $setvar
8196 : Respect a hint or command line value for full_csh.
8197 case "$full_csh" in
8198 '') full_csh=$csh ;;
8199 esac
8200
8201 : see if cuserid exists
8202 set cuserid d_cuserid
8203 eval $inlibc
8204
8205 : see if this is a limits.h system
8206 set limits.h i_limits
8207 eval $inhdr
8208
8209 : see if this is a float.h system
8210 set float.h i_float
8211 eval $inhdr
8212
8213 : See if number of significant digits in a double precision number is known
8214 echo " "
8215 $cat >dbl_dig.c <<EOM
8216 #$i_limits I_LIMITS
8217 #$i_float I_FLOAT
8218 #ifdef I_LIMITS
8219 #include <limits.h>
8220 #endif
8221 #ifdef I_FLOAT
8222 #include <float.h>
8223 #endif
8224 #ifdef DBL_DIG
8225 printf("Contains DBL_DIG");
8226 #endif
8227 EOM
8228 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8229 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8230         echo "DBL_DIG found." >&4
8231         val="$define"
8232 else
8233         echo "DBL_DIG NOT found." >&4
8234         val="$undef"
8235 fi
8236 $rm -f dbl_dig.?
8237 set d_dbl_dig
8238 eval $setvar
8239
8240 : see if difftime exists
8241 set difftime d_difftime
8242 eval $inlibc
8243
8244 : see if this is a dirent system
8245 echo " "
8246 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8247         val="$define"
8248         echo "<dirent.h> found." >&4
8249 else
8250         val="$undef"
8251         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8252                 echo "<sys/dir.h> found." >&4
8253                 echo " "
8254         else
8255                 xinc=`./findhdr sys/ndir.h`
8256         fi
8257         echo "<dirent.h> NOT found." >&4
8258 fi
8259 set i_dirent
8260 eval $setvar
8261
8262 : Look for type of directory structure.
8263 echo " "
8264 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8265
8266 case "$direntrytype" in
8267 ''|' ')
8268         case "$i_dirent" in
8269         $define) guess1='struct dirent' ;;
8270         *) guess1='struct direct'  ;;
8271         esac
8272         ;;
8273 *)      guess1="$direntrytype"
8274         ;;
8275 esac
8276
8277 case "$guess1" in
8278 'struct dirent') guess2='struct direct' ;;
8279 *) guess2='struct dirent' ;;
8280 esac
8281                 
8282 if $contains "$guess1" try.c >/dev/null 2>&1; then
8283         direntrytype="$guess1"
8284         echo "Your directory entries are $direntrytype." >&4
8285 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8286         direntrytype="$guess2"
8287         echo "Your directory entries seem to be $direntrytype." >&4
8288 else
8289         echo "I don't recognize your system's directory entries." >&4
8290         rp="What type is used for directory entries on this system?"
8291         dflt="$guess1"
8292         . ./myread
8293         direntrytype="$ans"
8294 fi
8295 $rm -f try.c
8296
8297
8298 : see if the directory entry stores field length
8299 echo " "
8300 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8301 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8302         echo "Good, your directory entry keeps length information in d_namlen." >&4
8303         val="$define"
8304 else
8305         echo "Your directory entry does not know about the d_namlen field." >&4
8306         val="$undef"
8307 fi
8308 set d_dirnamlen
8309 eval $setvar
8310 $rm -f try.c
8311
8312 : see if dlerror exists
8313 xxx_runnm="$runnm"
8314 runnm=false
8315 set dlerror d_dlerror
8316 eval $inlibc
8317 runnm="$xxx_runnm"
8318
8319 : see if dlfcn is available
8320 set dlfcn.h i_dlfcn
8321 eval $inhdr
8322
8323 case "$usedl" in
8324 $define|y|true)
8325         $cat << EOM
8326
8327 On a few systems, the dynamically loaded modules that perl generates and uses
8328 will need a different extension than shared libs. The default will probably
8329 be appropriate.
8330
8331 EOM
8332         case "$dlext" in
8333         '')     dflt="$so" ;;
8334         *)      dflt="$dlext" ;;
8335         esac
8336         rp='What is the extension of dynamically loaded modules'
8337         . ./myread
8338         dlext="$ans"
8339         ;;
8340 *)
8341         dlext="none"
8342         ;;
8343 esac
8344
8345 : Check if dlsym need a leading underscore
8346 echo " "
8347 val="$undef"
8348
8349 case "$dlsrc" in
8350 dl_dlopen.xs)
8351         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8352         $cat >dyna.c <<'EOM'
8353 fred () { }
8354 EOM
8355
8356 $cat >fred.c<<EOM
8357
8358 #include <stdio.h>
8359 #$i_dlfcn I_DLFCN
8360 #ifdef I_DLFCN
8361 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8362 #else
8363 #include <sys/types.h>
8364 #include <nlist.h>
8365 #include <link.h>
8366 #endif
8367
8368 extern int fred() ;
8369
8370 int main()
8371 {
8372     void * handle ;
8373     void * symbol ;
8374 #ifndef RTLD_LAZY
8375     int mode = 1 ;
8376 #else
8377     int mode = RTLD_LAZY ;
8378 #endif
8379     handle = dlopen("./dyna.$dlext", mode) ;
8380     if (handle == NULL) {
8381         printf ("1\n") ;
8382         fflush (stdout) ;
8383         exit(0);
8384     }
8385     symbol = dlsym(handle, "fred") ;
8386     if (symbol == NULL) {
8387         /* try putting a leading underscore */
8388         symbol = dlsym(handle, "_fred") ;
8389         if (symbol == NULL) {
8390             printf ("2\n") ;
8391             fflush (stdout) ;
8392             exit(0);
8393         }
8394         printf ("3\n") ;
8395     }
8396     else
8397         printf ("4\n") ;
8398     fflush (stdout) ;
8399     exit(0);
8400 }
8401 EOM
8402         : Call the object file tmp-dyna.o in case dlext=o.
8403         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8404                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8405                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8406                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8407                 xxx=`./fred`
8408                 case $xxx in
8409                 1)      echo "Test program failed using dlopen." >&4
8410                         echo "Perhaps you should not use dynamic loading." >&4;;
8411                 2)      echo "Test program failed using dlsym." >&4
8412                         echo "Perhaps you should not use dynamic loading." >&4;;
8413                 3)      echo "dlsym needs a leading underscore" >&4
8414                         val="$define" ;;
8415                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8416                 esac
8417         else
8418                 echo "I can't compile and run the test program." >&4
8419                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8420         fi
8421         ;;
8422 esac
8423                 
8424 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8425
8426 set d_dlsymun
8427 eval $setvar
8428
8429 hasproto='varname=$1; func=$2; shift; shift;
8430 while $test $# -ge 2; do
8431         case "$1" in
8432         $define) echo "#include <$2>";;
8433         esac ;
8434     shift 2;
8435 done > try.c;
8436 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8437 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8438         echo "$func() prototype found.";
8439         val="$define";
8440 else
8441         echo "$func() prototype NOT found.";
8442         val="$undef";
8443 fi;
8444 set $varname;
8445 eval $setvar;
8446 $rm -f try.c tryout.c'
8447
8448 : see if prototype for drand48 is available
8449 echo " "
8450 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8451 eval $hasproto
8452
8453 : see if dup2 exists
8454 set dup2 d_dup2
8455 eval $inlibc
8456
8457 : see if eaccess exists
8458 set eaccess d_eaccess
8459 eval $inlibc
8460
8461 : see if endgrent exists
8462 set endgrent d_endgrent
8463 eval $inlibc
8464
8465 : see if endhostent exists
8466 set endhostent d_endhent
8467 eval $inlibc
8468
8469 : see if endnetent exists
8470 set endnetent d_endnent
8471 eval $inlibc
8472
8473 : see if endprotoent exists
8474 set endprotoent d_endpent
8475 eval $inlibc
8476
8477 : see if endpwent exists
8478 set endpwent d_endpwent
8479 eval $inlibc
8480
8481 : see if endservent exists
8482 set endservent d_endsent
8483 eval $inlibc
8484
8485 : see if endspent exists
8486 set endspent d_endspent
8487 eval $inlibc
8488
8489 : Locate the flags for 'open()'
8490 echo " "
8491 $cat >open3.c <<'EOCP'
8492 #include <sys/types.h>
8493 #ifdef I_FCNTL
8494 #include <fcntl.h>
8495 #endif
8496 #ifdef I_SYS_FILE
8497 #include <sys/file.h>
8498 #endif
8499 int main() {
8500         if(O_RDONLY);
8501 #ifdef O_TRUNC
8502         exit(0);
8503 #else
8504         exit(1);
8505 #endif
8506 }
8507 EOCP
8508 : check sys/file.h first to get FREAD on Sun
8509 if $test `./findhdr sys/file.h` && \
8510                 set open3 -DI_SYS_FILE && eval $compile; then
8511         h_sysfile=true;
8512         echo "<sys/file.h> defines the O_* constants..." >&4
8513         if ./open3; then
8514                 echo "and you have the 3 argument form of open()." >&4
8515                 val="$define"
8516         else
8517                 echo "but not the 3 argument form of open().  Oh, well." >&4
8518                 val="$undef"
8519         fi
8520 elif $test `./findhdr fcntl.h` && \
8521                 set open3 -DI_FCNTL && eval $compile; then
8522         h_fcntl=true;
8523         echo "<fcntl.h> defines the O_* constants..." >&4
8524         if ./open3; then
8525                 echo "and you have the 3 argument form of open()." >&4
8526                 val="$define"
8527         else
8528                 echo "but not the 3 argument form of open().  Oh, well." >&4
8529                 val="$undef"
8530         fi
8531 else
8532         val="$undef"
8533         echo "I can't find the O_* constant definitions!  You got problems." >&4
8534 fi
8535 set d_open3
8536 eval $setvar
8537 $rm -f open3*
8538
8539 : see which of string.h or strings.h is needed
8540 echo " "
8541 strings=`./findhdr string.h`
8542 if $test "$strings" && $test -r "$strings"; then
8543         echo "Using <string.h> instead of <strings.h>." >&4
8544         val="$define"
8545 else
8546         val="$undef"
8547         strings=`./findhdr strings.h`
8548         if $test "$strings" && $test -r "$strings"; then
8549                 echo "Using <strings.h> instead of <string.h>." >&4
8550         else
8551                 echo "No string header found -- You'll surely have problems." >&4
8552         fi
8553 fi
8554 set i_string
8555 eval $setvar
8556 case "$i_string" in
8557 "$undef") strings=`./findhdr strings.h`;;
8558 *)        strings=`./findhdr string.h`;;
8559 esac
8560
8561 : check for non-blocking I/O stuff
8562 case "$h_sysfile" in
8563 true) echo "#include <sys/file.h>" > head.c;;
8564 *)
8565         case "$h_fcntl" in
8566         true) echo "#include <fcntl.h>" > head.c;;
8567         *) echo "#include <sys/fcntl.h>" > head.c;;
8568         esac
8569         ;;
8570 esac
8571 echo " "
8572 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8573 case "$o_nonblock" in
8574 '')
8575         $cat head.c > try.c
8576         $cat >>try.c <<'EOCP'
8577 #include <stdio.h>
8578 int main() {
8579 #ifdef O_NONBLOCK
8580         printf("O_NONBLOCK\n");
8581         exit(0);
8582 #endif
8583 #ifdef O_NDELAY
8584         printf("O_NDELAY\n");
8585         exit(0);
8586 #endif
8587 #ifdef FNDELAY
8588         printf("FNDELAY\n");
8589         exit(0);
8590 #endif
8591         exit(0);
8592 }
8593 EOCP
8594         set try
8595         if eval $compile_ok; then
8596                 o_nonblock=`./try`
8597                 case "$o_nonblock" in
8598                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8599                 *) echo "Seems like we can use $o_nonblock.";;
8600                 esac
8601         else
8602                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8603         fi
8604         ;;
8605 *) echo "Using $hint value $o_nonblock.";;
8606 esac
8607 $rm -f try try.* .out core
8608
8609 echo " "
8610 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8611 case "$eagain" in
8612 '')
8613         $cat head.c > try.c
8614         $cat >>try.c <<EOCP
8615 #include <errno.h>
8616 #include <sys/types.h>
8617 #include <signal.h>
8618 #include <stdio.h> 
8619 #define MY_O_NONBLOCK $o_nonblock
8620 #ifndef errno  /* XXX need better Configure test */
8621 extern int errno;
8622 #endif
8623 #$i_unistd I_UNISTD
8624 #ifdef I_UNISTD
8625 #include <unistd.h>
8626 #endif
8627 #$i_string I_STRING
8628 #ifdef I_STRING
8629 #include <string.h>
8630 #else
8631 #include <strings.h>
8632 #endif
8633 $signal_t blech(x) int x; { exit(3); }
8634 EOCP
8635         $cat >> try.c <<'EOCP'
8636 int main()
8637 {
8638         int pd[2];
8639         int pu[2];
8640         char buf[1];
8641         char string[100];
8642
8643         pipe(pd);       /* Down: child -> parent */
8644         pipe(pu);       /* Up: parent -> child */
8645         if (0 != fork()) {
8646                 int ret;
8647                 close(pd[1]);   /* Parent reads from pd[0] */
8648                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8649                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8650                         exit(1);
8651                 signal(SIGALRM, blech);
8652                 alarm(5);
8653                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8654                         exit(2);
8655                 sprintf(string, "%d\n", ret);
8656                 write(2, string, strlen(string));
8657                 alarm(0);
8658 #ifdef EAGAIN
8659                 if (errno == EAGAIN) {
8660                         printf("EAGAIN\n");
8661                         goto ok;
8662                 }
8663 #endif
8664 #ifdef EWOULDBLOCK
8665                 if (errno == EWOULDBLOCK)
8666                         printf("EWOULDBLOCK\n");
8667 #endif
8668         ok:
8669                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8670                 sleep(2);                               /* Give it time to close our pipe */
8671                 alarm(5);
8672                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8673                 alarm(0);
8674                 sprintf(string, "%d\n", ret);
8675                 write(3, string, strlen(string));
8676                 exit(0);
8677         }
8678
8679         close(pd[0]);                   /* We write to pd[1] */
8680         close(pu[1]);                   /* We read from pu[0] */
8681         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8682         close(pd[1]);                   /* Pipe pd is now fully closed! */
8683         exit(0);                                /* Bye bye, thank you for playing! */
8684 }
8685 EOCP
8686         set try
8687         if eval $compile_ok; then
8688                 echo "$startsh" >mtry
8689                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8690                 chmod +x mtry
8691                 ./mtry >/dev/null 2>&1
8692                 case $? in
8693                 0) eagain=`$cat try.out`;;
8694                 1) echo "Could not perform non-blocking setting!";;
8695                 2) echo "I did a successful read() for something that was not there!";;
8696                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8697                 *) echo "Something terribly wrong happened during testing.";;
8698                 esac
8699                 rd_nodata=`$cat try.ret`
8700                 echo "A read() system call with no data present returns $rd_nodata."
8701                 case "$rd_nodata" in
8702                 0|-1) ;;
8703                 *)
8704                         echo "(That's peculiar, fixing that to be -1.)"
8705                         rd_nodata=-1
8706                         ;;
8707                 esac
8708                 case "$eagain" in
8709                 '')
8710                         echo "Forcing errno EAGAIN on read() with no data available."
8711                         eagain=EAGAIN
8712                         ;;
8713                 *)
8714                         echo "Your read() sets errno to $eagain when no data is available."
8715                         ;;
8716                 esac
8717                 status=`$cat try.err`
8718                 case "$status" in
8719                 0) echo "And it correctly returns 0 to signal EOF.";;
8720                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8721                 *) echo "However, your read() returns '$status' on EOF??";;
8722                 esac
8723                 val="$define"
8724                 if test "$status" = "$rd_nodata"; then
8725                         echo "WARNING: you can't distinguish between EOF and no data!"
8726                         val="$undef"
8727                 fi
8728         else
8729                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8730                 eagain=EAGAIN
8731         fi
8732         set d_eofnblk
8733         eval $setvar
8734         ;;
8735 *)
8736         echo "Using $hint value $eagain."
8737         echo "Your read() returns $rd_nodata when no data is present."
8738         case "$d_eofnblk" in
8739         "$define") echo "And you can see EOF because read() returns 0.";;
8740         "$undef") echo "But you can't see EOF status from read() returned value.";;
8741         *)
8742                 echo "(Assuming you can't see EOF status from read anyway.)"
8743                 d_eofnblk=$undef
8744                 ;;
8745         esac
8746         ;;
8747 esac
8748 $rm -f try try.* .out core head.c mtry
8749
8750 : see if fchmod exists
8751 set fchmod d_fchmod
8752 eval $inlibc
8753
8754 : see if fchown exists
8755 set fchown d_fchown
8756 eval $inlibc
8757
8758 : see if this is an fcntl system
8759 set fcntl d_fcntl
8760 eval $inlibc
8761
8762 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8763 while $test $# -ge 2; do
8764         case "$1" in
8765         $define) echo "#include <$2>";;
8766         esac ;
8767     shift 2;
8768 done > try.c;
8769 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8770 set try;
8771 if eval $compile; then
8772         val="$define";
8773 else
8774         val="$undef";
8775 fi;
8776 set $varname;
8777 eval $setvar;
8778 $rm -f try.c try.o'
8779
8780 socketlib=''
8781 sockethdr=''
8782 : see whether socket exists
8783 echo " "
8784 $echo $n "Hmm... $c" >&4
8785 if set socket val -f d_socket; eval $csym; $val; then
8786         echo "Looks like you have Berkeley networking support." >&4
8787         d_socket="$define"
8788         if set setsockopt val -f; eval $csym; $val; then
8789                 d_oldsock="$undef"
8790         else
8791                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8792                 d_oldsock="$define"
8793         fi
8794 else
8795         if $contains socklib libc.list >/dev/null 2>&1; then
8796                 echo "Looks like you have Berkeley networking support." >&4
8797                 d_socket="$define"
8798                 : we will have to assume that it supports the 4.2 BSD interface
8799                 d_oldsock="$undef"
8800         else
8801                 echo "You don't have Berkeley networking in libc$_a..." >&4
8802                 if test "X$d_socket" = "X$define"; then
8803                    echo "...but you seem to believe that you have sockets." >&4
8804                 else
8805                         for net in net socket
8806                         do
8807                                 if test -f /usr/lib/lib$net$_a; then
8808                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8809                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8810                                         if $contains socket libc.list >/dev/null 2>&1; then
8811                                                 d_socket="$define"
8812                                                 socketlib="-l$net"
8813                                                 case "$net" in
8814                                                 net)
8815                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8816                                                         sockethdr="-I/usr/netinclude"
8817                                                         ;;
8818                                                 esac
8819                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8820                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8821                                                         d_oldsock="$undef"
8822                                                 else
8823                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8824                                                         d_oldsock="$define"
8825                                                 fi
8826                                                 break
8827                                         fi
8828                                 fi
8829                         done
8830                         if test "X$d_socket" != "X$define"; then
8831                            echo "or anywhere else I see." >&4
8832                            d_socket="$undef"
8833                            d_oldsock="$undef"
8834                         fi
8835                 fi
8836         fi
8837 fi
8838
8839 : see if socketpair exists
8840 set socketpair d_sockpair
8841 eval $inlibc
8842
8843
8844 echo " "
8845 echo "Checking the availability of certain socket constants..." >& 4
8846 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8847         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8848         $cat >try.c <<EOF
8849 #include <sys/types.h>
8850 #include <sys/socket.h>
8851 int main() {
8852     int i = $ENUM;
8853 }
8854 EOF
8855         val="$undef"
8856         set try; if eval $compile; then
8857                 val="$define"
8858         fi
8859         set d_${enum}; eval $setvar
8860         $rm -f try.c try
8861 done
8862
8863 : see if sys/select.h has to be included
8864 set sys/select.h i_sysselct
8865 eval $inhdr
8866
8867 : see if we should include time.h, sys/time.h, or both
8868 echo " "
8869 if test "X$timeincl" = X; then
8870         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8871         $echo $n "I'm now running the test program...$c"
8872         $cat >try.c <<'EOCP'
8873 #include <sys/types.h>
8874 #ifdef I_TIME
8875 #include <time.h>
8876 #endif
8877 #ifdef I_SYSTIME
8878 #ifdef SYSTIMEKERNEL
8879 #define KERNEL
8880 #endif
8881 #include <sys/time.h>
8882 #endif
8883 #ifdef I_SYSSELECT
8884 #include <sys/select.h>
8885 #endif
8886 int main()
8887 {
8888         struct tm foo;
8889 #ifdef S_TIMEVAL
8890         struct timeval bar;
8891 #endif
8892 #ifdef S_TIMEZONE
8893         struct timezone tzp;
8894 #endif
8895         if (foo.tm_sec == foo.tm_sec)
8896                 exit(0);
8897 #ifdef S_TIMEVAL
8898         if (bar.tv_sec == bar.tv_sec)
8899                 exit(0);
8900 #endif
8901         exit(1);
8902 }
8903 EOCP
8904         flags=''
8905         for s_timezone in '-DS_TIMEZONE' ''; do
8906         sysselect=''
8907         for s_timeval in '-DS_TIMEVAL' ''; do
8908         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8909         for i_time in '' '-DI_TIME'; do
8910         for i_systime in '-DI_SYSTIME' ''; do
8911                 case "$flags" in
8912                 '') $echo $n ".$c"
8913                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8914                         if eval $compile; then
8915                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8916                                 shift
8917                                 flags="$*"
8918                                 echo " "
8919                                 $echo $n "Succeeded with $flags$c"
8920                         fi
8921                         ;;
8922                 esac
8923         done
8924         done
8925         done
8926         done
8927         done
8928         timeincl=''
8929         echo " "
8930         case "$flags" in
8931         *SYSTIMEKERNEL*) i_systimek="$define"
8932                 timeincl=`./findhdr sys/time.h`
8933                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8934         *) i_systimek="$undef";;
8935         esac
8936         case "$flags" in
8937         *I_TIME*) i_time="$define"
8938                 timeincl=`./findhdr time.h`" $timeincl"
8939                 echo "We'll include <time.h>." >&4;;
8940         *) i_time="$undef";;
8941         esac
8942         case "$flags" in
8943         *I_SYSTIME*) i_systime="$define"
8944                 timeincl=`./findhdr sys/time.h`" $timeincl"
8945                 echo "We'll include <sys/time.h>." >&4;;
8946         *) i_systime="$undef";;
8947         esac
8948         $rm -f try.c try
8949 fi
8950
8951 : check for fd_set items
8952 $cat <<EOM
8953
8954 Checking to see how well your C compiler handles fd_set and friends ...
8955 EOM
8956 $cat >fd_set.c <<EOCP
8957 #$i_systime I_SYS_TIME
8958 #$i_sysselct I_SYS_SELECT
8959 #$d_socket HAS_SOCKET
8960 #include <sys/types.h>
8961 #ifdef HAS_SOCKET
8962 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8963 #endif
8964 #ifdef I_SYS_TIME
8965 #include <sys/time.h>
8966 #endif
8967 #ifdef I_SYS_SELECT
8968 #include <sys/select.h>
8969 #endif
8970 int main() {
8971         fd_set fds;
8972
8973 #ifdef TRYBITS
8974         if(fds.fds_bits);
8975 #endif
8976
8977 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8978         exit(0);
8979 #else
8980         exit(1);
8981 #endif
8982 }
8983 EOCP
8984 set fd_set -DTRYBITS
8985 if eval $compile; then
8986         d_fds_bits="$define"
8987         d_fd_set="$define"
8988         echo "Well, your system knows about the normal fd_set typedef..." >&4
8989         if ./fd_set; then
8990                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8991                 d_fd_macros="$define"
8992         else
8993                 $cat >&4 <<'EOM'
8994 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8995 EOM
8996                 d_fd_macros="$undef"
8997         fi
8998 else
8999         $cat <<'EOM'
9000 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9001 EOM
9002         set fd_set
9003         if eval $compile; then
9004                 d_fds_bits="$undef"
9005                 d_fd_set="$define"
9006                 echo "Well, your system has some sort of fd_set available..." >&4
9007                 if ./fd_set; then
9008                         echo "and you have the normal fd_set macros." >&4
9009                         d_fd_macros="$define"
9010                 else
9011                         $cat <<'EOM'
9012 but not the normal fd_set macros!  Gross!  More work for me...
9013 EOM
9014                         d_fd_macros="$undef"
9015                 fi
9016         else
9017         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9018                 d_fd_set="$undef"
9019                 d_fds_bits="$undef"
9020                 d_fd_macros="$undef"
9021         fi
9022 fi
9023 $rm -f fd_set*
9024
9025 : see if fgetpos exists
9026 set fgetpos d_fgetpos
9027 eval $inlibc
9028
9029 : see if flock exists
9030 set flock d_flock
9031 eval $inlibc
9032
9033 : see if fork exists
9034 set fork d_fork
9035 eval $inlibc
9036
9037 : see if pathconf exists
9038 set pathconf d_pathconf
9039 eval $inlibc
9040
9041 : see if fpathconf exists
9042 set fpathconf d_fpathconf
9043 eval $inlibc
9044
9045
9046 : check for fpos64_t
9047 echo " "
9048 echo "Checking to see if you have fpos64_t..." >&4
9049 $cat >try.c <<EOCP
9050 #include <stdio.h>
9051 int main() { fpos64_t x = 7; }
9052 EOCP
9053 set try
9054 if eval $compile; then
9055         val="$define"
9056         echo "You have fpos64_t."
9057 else
9058         val="$undef"
9059         echo "You do not have fpos64_t."
9060         case "$fpossize" in
9061         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9062         esac
9063 fi
9064 $rm -f try.* try
9065 set d_fpos64_t
9066 eval $setvar
9067
9068 : see if frexpl exists
9069 set frexpl d_frexpl
9070 eval $inlibc
9071
9072 hasstruct='varname=$1; struct=$2; shift; shift;
9073 while $test $# -ge 2; do
9074         case "$1" in
9075         $define) echo "#include <$2>";;
9076         esac ;
9077     shift 2;
9078 done > try.c;
9079 echo "int main () { struct $struct foo; }" >> try.c;
9080 set try;
9081 if eval $compile; then
9082         val="$define";
9083 else
9084         val="$undef";
9085 fi;
9086 set $varname;
9087 eval $setvar;
9088 $rm -f try.c try.o'
9089
9090 : see if this is a sys/param system
9091 set sys/param.h i_sysparam
9092 eval $inhdr
9093
9094 : see if this is a sys/mount.h system
9095 set sys/mount.h i_sysmount
9096 eval $inhdr
9097
9098 : see if sys/types.h has to be included
9099 set sys/types.h i_systypes
9100 eval $inhdr
9101
9102
9103 echo " "
9104 echo "Checking to see if your system supports struct fs_data..." >&4
9105 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9106 eval $hasstruct
9107 case "$d_fs_data_s" in
9108 "$define")      echo "Yes, it does."   ;;
9109 *)              echo "No, it doesn't." ;;
9110 esac
9111
9112 : see if fseeko exists
9113 set fseeko d_fseeko
9114 eval $inlibc
9115 case "$longsize" in
9116 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9117 esac
9118
9119 : see if fsetpos exists
9120 set fsetpos d_fsetpos
9121 eval $inlibc
9122
9123
9124 : see if fstatfs exists
9125 set fstatfs d_fstatfs
9126 eval $inlibc
9127
9128
9129 : see if statvfs exists
9130 set statvfs d_statvfs
9131 eval $inlibc
9132
9133 : see if fstatvfs exists
9134 set fstatvfs d_fstatvfs
9135 eval $inlibc
9136
9137
9138 : see if ftello exists
9139 set ftello d_ftello
9140 eval $inlibc
9141 case "$longsize" in
9142 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9143 esac
9144
9145 : see if getcwd exists
9146 set getcwd d_getcwd
9147 eval $inlibc
9148
9149
9150 : see if getfsstat exists
9151 set getfsstat d_getfsstat
9152 eval $inlibc
9153
9154 : see if getgrent exists
9155 set getgrent d_getgrent
9156 eval $inlibc
9157
9158 : see if gethostbyaddr exists
9159 set gethostbyaddr d_gethbyaddr
9160 eval $inlibc
9161
9162 : see if gethostbyname exists
9163 set gethostbyname d_gethbyname
9164 eval $inlibc
9165
9166 : see if gethostent exists
9167 set gethostent d_gethent
9168 eval $inlibc
9169
9170 : see how we will look up host name
9171 echo " "
9172 call=''
9173 if set gethostname val -f d_gethname; eval $csym; $val; then
9174         echo 'gethostname() found.' >&4
9175         d_gethname="$define"
9176         call=gethostname
9177 fi
9178 if set uname val -f d_uname; eval $csym; $val; then
9179         if ./xenix; then
9180                 $cat <<'EOM'
9181 uname() was found, but you're running xenix, and older versions of xenix
9182 have a broken uname(). If you don't really know whether your xenix is old
9183 enough to have a broken system call, use the default answer.
9184
9185 EOM
9186                 dflt=y
9187                 case "$d_uname" in
9188                 "$define") dflt=n;;
9189                 esac
9190                 rp='Is your uname() broken?'
9191                 . ./myread
9192                 case "$ans" in
9193                 n*) d_uname="$define"; call=uname;;
9194                 esac
9195         else
9196                 echo 'uname() found.' >&4
9197                 d_uname="$define"
9198                 case "$call" in
9199                 '') call=uname ;;
9200                 esac
9201         fi
9202 fi
9203 case "$d_gethname" in
9204 '') d_gethname="$undef";;
9205 esac
9206 case "$d_uname" in
9207 '') d_uname="$undef";;
9208 esac
9209 case "$d_uname$d_gethname" in
9210 *define*)
9211         dflt=n
9212         cat <<EOM
9213  
9214 Every now and then someone has a $call() that lies about the hostname
9215 but can't be fixed for political or economic reasons.  If you wish, I can
9216 pretend $call() isn't there and maybe compute hostname at run-time
9217 thanks to the '$phostname' command.
9218
9219 EOM
9220         rp="Shall I ignore $call() from now on?"
9221         . ./myread
9222         case "$ans" in
9223         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9224         esac;;
9225 esac
9226 case "$phostname" in
9227 '') aphostname='';;
9228 *) case "$aphostname" in
9229         /*) ;;
9230         *) set X $phostname
9231                 shift
9232                 file=$1
9233                 shift
9234                 file=`./loc $file $file $pth`
9235                 aphostname=`echo $file $*`
9236                 ;;
9237         esac
9238         ;;
9239 esac
9240 case "$d_uname$d_gethname" in
9241 *define*) ;;
9242 *)
9243         case "$phostname" in
9244         '')
9245                 echo "There will be no way for $package to get your hostname." >&4;;
9246         *)
9247         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9248                 ;;
9249         esac;;
9250 esac
9251 case "$d_phostname" in
9252 '') d_phostname="$undef";;
9253 esac
9254
9255 : see if this is a netdb.h system
9256 set netdb.h i_netdb
9257 eval $inhdr
9258
9259 : see if prototypes for various gethostxxx netdb.h functions are available
9260 echo " "
9261 set d_gethostprotos gethostent $i_netdb netdb.h
9262 eval $hasproto
9263
9264 : see if getlogin exists
9265 set getlogin d_getlogin
9266 eval $inlibc
9267
9268 : see if getmnt exists
9269 set getmnt d_getmnt
9270 eval $inlibc
9271
9272 : see if getmntent exists
9273 set getmntent d_getmntent
9274 eval $inlibc
9275
9276 : see if getnetbyaddr exists
9277 set getnetbyaddr d_getnbyaddr
9278 eval $inlibc
9279
9280 : see if getnetbyname exists
9281 set getnetbyname d_getnbyname
9282 eval $inlibc
9283
9284 : see if getnetent exists
9285 set getnetent d_getnent
9286 eval $inlibc
9287
9288 : see if prototypes for various getnetxxx netdb.h functions are available
9289 echo " "
9290 set d_getnetprotos getnetent $i_netdb netdb.h
9291 eval $hasproto
9292
9293
9294 : see if getprotobyname exists
9295 set getprotobyname d_getpbyname
9296 eval $inlibc
9297
9298 : see if getprotobynumber exists
9299 set getprotobynumber d_getpbynumber
9300 eval $inlibc
9301
9302 : see if getprotoent exists
9303 set getprotoent d_getpent
9304 eval $inlibc
9305
9306 : see if getpgid exists
9307 set getpgid d_getpgid
9308 eval $inlibc
9309
9310 : see if getpgrp2 exists
9311 set getpgrp2 d_getpgrp2
9312 eval $inlibc
9313
9314 : see if getppid exists
9315 set getppid d_getppid
9316 eval $inlibc
9317
9318 : see if getpriority exists
9319 set getpriority d_getprior
9320 eval $inlibc
9321
9322 : see if prototypes for various getprotoxxx netdb.h functions are available
9323 echo " "
9324 set d_getprotoprotos getprotoent $i_netdb netdb.h
9325 eval $hasproto
9326
9327 : see if getpwent exists
9328 set getpwent d_getpwent
9329 eval $inlibc
9330
9331
9332 : see if getservbyname exists
9333 set getservbyname d_getsbyname
9334 eval $inlibc
9335
9336 : see if getservbyport exists
9337 set getservbyport d_getsbyport
9338 eval $inlibc
9339
9340 : see if getservent exists
9341 set getservent d_getsent
9342 eval $inlibc
9343
9344 : see if prototypes for various getservxxx netdb.h functions are available
9345 echo " "
9346 set d_getservprotos getservent $i_netdb netdb.h
9347 eval $hasproto
9348
9349 : see if getspent exists
9350 set getspent d_getspent
9351 eval $inlibc
9352
9353 : see if getspnam exists
9354 set getspnam d_getspnam
9355 eval $inlibc
9356
9357 : see if gettimeofday or ftime exists
9358 set gettimeofday d_gettimeod
9359 eval $inlibc
9360 case "$d_gettimeod" in
9361 "$undef")
9362         set ftime d_ftime 
9363         eval $inlibc
9364         ;;
9365 *)
9366         val="$undef"; set d_ftime; eval $setvar
9367         ;;
9368 esac
9369 case "$d_gettimeod$d_ftime" in
9370 "$undef$undef")
9371         echo " "
9372         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9373         ;;
9374 esac
9375
9376 : see if this is an grp system
9377 set grp.h i_grp
9378 eval $inhdr
9379
9380 case "$i_grp" in
9381 $define)
9382         xxx=`./findhdr grp.h`
9383         $cppstdin $cppflags $cppminus < $xxx >$$.h
9384
9385         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9386                 val="$define"
9387         else
9388                 val="$undef"
9389         fi
9390         set d_grpasswd
9391         eval $setvar
9392
9393         $rm -f $$.h
9394         ;;
9395 *)
9396         val="$undef";
9397         set d_grpasswd; eval $setvar
9398         ;;
9399 esac
9400
9401 : see if hasmntopt exists
9402 set hasmntopt d_hasmntopt
9403 eval $inlibc
9404
9405 : see if this is a netinet/in.h or sys/in.h system
9406 set netinet/in.h i_niin sys/in.h i_sysin
9407 eval $inhdr
9408
9409 : see if arpa/inet.h has to be included
9410 set arpa/inet.h i_arpainet
9411 eval $inhdr
9412
9413 : see if htonl --and friends-- exists
9414 val=''
9415 set htonl val
9416 eval $inlibc
9417
9418 : Maybe they are macros.
9419 case "$val" in
9420 $undef)
9421         $cat >htonl.c <<EOM
9422 #include <stdio.h>
9423 #include <sys/types.h>
9424 #$i_niin I_NETINET_IN
9425 #$i_sysin I_SYS_IN
9426 #$i_arpainet I_ARPA_INET
9427 #ifdef I_NETINET_IN
9428 #include <netinet/in.h>
9429 #endif
9430 #ifdef I_SYS_IN
9431 #include <sys/in.h>
9432 #endif
9433 #ifdef I_ARPA_INET
9434 #include <arpa/inet.h>
9435 #endif
9436 #ifdef htonl
9437 printf("Defined as a macro.");
9438 #endif
9439 EOM
9440         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9441         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9442                 val="$define"
9443                 echo "But it seems to be defined as a macro." >&4
9444         fi
9445         $rm -f htonl.?
9446         ;;
9447 esac
9448 set d_htonl
9449 eval $setvar
9450
9451 : see if iconv exists
9452 set iconv d_iconv
9453 eval $inlibc
9454
9455 : index or strchr
9456 echo " "
9457 if set index val -f; eval $csym; $val; then
9458         if set strchr val -f d_strchr; eval $csym; $val; then
9459                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9460                         val="$define"
9461                         vali="$undef"
9462                         echo "strchr() found." >&4
9463                 else
9464                         val="$undef"
9465                         vali="$define"
9466                         echo "index() found." >&4
9467                 fi
9468         else
9469                 val="$undef"
9470                 vali="$define"
9471                 echo "index() found." >&4
9472         fi
9473 else
9474         if set strchr val -f d_strchr; eval $csym; $val; then
9475                 val="$define"
9476                 vali="$undef"
9477                 echo "strchr() found." >&4
9478         else
9479                 echo "No index() or strchr() found!" >&4
9480                 val="$undef"
9481                 vali="$undef"
9482         fi
9483 fi
9484 set d_strchr; eval $setvar
9485 val="$vali"
9486 set d_index; eval $setvar
9487
9488 : check whether inet_aton exists
9489 set inet_aton d_inetaton
9490 eval $inlibc
9491
9492 : see if inttypes.h is available
9493 : we want a real compile instead of Inhdr because some systems
9494 : have an inttypes.h which includes non-existent headers
9495 echo " "
9496 $cat >try.c <<EOCP
9497 #include <inttypes.h>
9498 int main() {
9499         static int32_t foo32 = 0x12345678;
9500 }
9501 EOCP
9502 set try
9503 if eval $compile; then
9504         echo "<inttypes.h> found." >&4
9505         val="$define"
9506 else
9507         echo "<inttypes.h> NOT found." >&4
9508         val="$undef"
9509 fi
9510 $rm -f try.c try
9511 set i_inttypes
9512 eval $setvar
9513
9514 : check for int64_t
9515 echo " "
9516 echo "Checking to see if you have int64_t..." >&4
9517 $cat >try.c <<EOCP
9518 #include <sys/types.h>
9519 #$i_inttypes I_INTTYPES
9520 #ifdef I_INTTYPES
9521 #include <inttypes.h>
9522 #endif
9523 int main() { int64_t x = 7; }
9524 EOCP
9525 set try
9526 if eval $compile; then
9527         val="$define"
9528         echo "You have int64_t."
9529 else
9530         val="$undef"
9531         echo "You do not have int64_t."
9532 fi
9533 $rm -f try try.*
9534 set d_int64_t
9535 eval $setvar
9536
9537 : Look for isascii
9538 echo " "
9539 $cat >isascii.c <<'EOCP'
9540 #include <stdio.h>
9541 #include <ctype.h>
9542 int main() {
9543         int c = 'A';
9544         if (isascii(c))
9545                 exit(0);
9546         else
9547                 exit(1);
9548 }
9549 EOCP
9550 set isascii
9551 if eval $compile; then
9552         echo "isascii() found." >&4
9553         val="$define"
9554 else
9555         echo "isascii() NOT found." >&4
9556         val="$undef"
9557 fi
9558 set d_isascii
9559 eval $setvar
9560 $rm -f isascii*
9561
9562 : see if isnan exists
9563 set isnan d_isnan
9564 eval $inlibc
9565
9566 : see if isnanl exists
9567 set isnanl d_isnanl
9568 eval $inlibc
9569
9570 : see if killpg exists
9571 set killpg d_killpg
9572 eval $inlibc
9573
9574 : see if lchown exists
9575 echo " "
9576 $cat > try.c <<'EOCP'
9577 /* System header to define __stub macros and hopefully few prototypes,
9578     which can conflict with char lchown(); below.  */
9579 #include <assert.h>
9580 /* Override any gcc2 internal prototype to avoid an error.  */
9581 /* We use char because int might match the return type of a gcc2
9582    builtin and then its argument prototype would still apply.  */
9583 char lchown();
9584 int main() {
9585     /*  The GNU C library defines this for functions which it implements
9586         to always fail with ENOSYS.  Some functions are actually named
9587         something starting with __ and the normal name is an alias.  */
9588 #if defined (__stub_lchown) || defined (__stub___lchown)
9589 choke me
9590 #else
9591 lchown();
9592 #endif
9593 ; return 0; }
9594 EOCP
9595 set try
9596 if eval $compile; then
9597     $echo "lchown() found." >&4
9598     val="$define"
9599 else
9600     $echo "lchown() NOT found." >&4
9601     val="$undef"
9602 fi
9603 set d_lchown
9604 eval $setvar
9605
9606 : See if number of significant digits in a double precision number is known
9607 echo " "
9608 $cat >ldbl_dig.c <<EOM
9609 #$i_limits I_LIMITS
9610 #$i_float I_FLOAT
9611 #ifdef I_LIMITS
9612 #include <limits.h>
9613 #endif
9614 #ifdef I_FLOAT
9615 #include <float.h>
9616 #endif
9617 #ifdef LDBL_DIG
9618 printf("Contains LDBL_DIG");
9619 #endif
9620 EOM
9621 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9622 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9623         echo "LDBL_DIG found." >&4
9624         val="$define"
9625 else
9626         echo "LDBL_DIG NOT found." >&4
9627         val="$undef"
9628 fi
9629 $rm -f ldbl_dig.?
9630 set d_ldbl_dig
9631 eval $setvar
9632
9633 : see if link exists
9634 set link d_link
9635 eval $inlibc
9636
9637 : see if localeconv exists
9638 set localeconv d_locconv
9639 eval $inlibc
9640
9641 : see if lockf exists
9642 set lockf d_lockf
9643 eval $inlibc
9644
9645 : check for long long
9646 echo " "
9647 echo "Checking to see if you have long long..." >&4
9648 echo 'int main() { long long x = 7; return 0; }' > try.c
9649 set try
9650 if eval $compile; then
9651         val="$define"
9652         echo "You have have long long."
9653 else
9654         val="$undef"
9655         echo "You do not have long long."
9656 fi
9657 $rm try.*
9658 set d_longlong
9659 eval $setvar
9660
9661 : check for length of long long
9662 case "${d_longlong}${longlongsize}" in
9663 $define)
9664         echo " "
9665         echo "Checking to see how big your long longs are..." >&4
9666         $cat >try.c <<'EOCP'
9667 #include <stdio.h>
9668 int main()
9669 {
9670     printf("%d\n", (int)sizeof(long long));
9671     return(0);
9672 }
9673 EOCP
9674         set try
9675         if eval $compile_ok; then
9676                 longlongsize=`./try$exe_ext`
9677                 echo "Your long longs are $longlongsize bytes long."
9678         else
9679                 dflt='8'
9680                 echo " "
9681                 echo "(I can't seem to compile the test program.  Guessing...)"
9682                 rp="What is the size of a long long (in bytes)?"
9683                 . ./myread
9684                 longlongsize="$ans"
9685         fi
9686         if $test "X$longsize" = "X$longlongsize"; then
9687                 echo "(That isn't any different from an ordinary long.)"
9688         fi      
9689         ;;
9690 esac
9691 $rm -f try.* try
9692
9693 : see if prototype for lseek is available
9694 echo " "
9695 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9696 eval $hasproto
9697
9698 : see if lstat exists
9699 set lstat d_lstat
9700 eval $inlibc
9701
9702 : see if madvise exists
9703 set madvise d_madvise
9704 eval $inlibc
9705
9706 : see if mblen exists
9707 set mblen d_mblen
9708 eval $inlibc
9709
9710 : see if mbstowcs exists
9711 set mbstowcs d_mbstowcs
9712 eval $inlibc
9713
9714 : see if mbtowc exists
9715 set mbtowc d_mbtowc
9716 eval $inlibc
9717
9718 : see if memchr exists
9719 set memchr d_memchr
9720 eval $inlibc
9721
9722 : see if memcmp exists
9723 set memcmp d_memcmp
9724 eval $inlibc
9725
9726 : see if memcpy exists
9727 set memcpy d_memcpy
9728 eval $inlibc
9729
9730 : see if memmove exists
9731 set memmove d_memmove
9732 eval $inlibc
9733
9734 : see if memset exists
9735 set memset d_memset
9736 eval $inlibc
9737
9738 : see if mkdir exists
9739 set mkdir d_mkdir
9740 eval $inlibc
9741
9742 : see if mkdtemp exists
9743 set mkdtemp d_mkdtemp
9744 eval $inlibc
9745
9746 : see if mkfifo exists
9747 set mkfifo d_mkfifo
9748 eval $inlibc
9749
9750 : see if mkstemp exists
9751 set mkstemp d_mkstemp
9752 eval $inlibc
9753
9754 : see if mkstemps exists
9755 set mkstemps d_mkstemps
9756 eval $inlibc
9757
9758 : see if mktime exists
9759 set mktime d_mktime
9760 eval $inlibc
9761
9762 : see if this is a sys/mman.h system
9763 set sys/mman.h i_sysmman
9764 eval $inhdr
9765
9766 : see if mmap exists
9767 set mmap d_mmap
9768 eval $inlibc
9769 : see what shmat returns
9770 : default to something harmless
9771 mmaptype='void *'
9772 case "$i_sysmman$d_mmap" in
9773 "$define$define")
9774         $cat >mmap.c <<'END'
9775 #include <sys/mman.h>
9776 void *mmap();
9777 END
9778         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9779                 mmaptype='void *'
9780         else
9781                 mmaptype='caddr_t'
9782         fi
9783         echo "and it returns ($mmaptype)." >&4
9784         ;;
9785 esac
9786
9787
9788
9789 : see if modfl exists
9790 set modfl d_modfl
9791 eval $inlibc
9792
9793 : see if mprotect exists
9794 set mprotect d_mprotect
9795 eval $inlibc
9796
9797 : see if msgctl exists
9798 set msgctl d_msgctl
9799 eval $inlibc
9800
9801 : see if msgget exists
9802 set msgget d_msgget
9803 eval $inlibc
9804
9805 : see if msgsnd exists
9806 set msgsnd d_msgsnd
9807 eval $inlibc
9808
9809 : see if msgrcv exists
9810 set msgrcv d_msgrcv
9811 eval $inlibc
9812
9813 : see how much of the 'msg*(2)' library is present.
9814 h_msg=true
9815 echo " "
9816 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9817 *"$undef"*) h_msg=false;;
9818 esac
9819 case "$osname" in
9820 freebsd)
9821     case "`ipcs 2>&1`" in
9822     "SVID messages"*"not configured"*)
9823         echo "Your $osname does not have the msg*(2) configured." >&4
9824         h_msg=false
9825         val="$undef"
9826         set msgctl d_msgctl
9827         eval $setvar
9828         set msgget d_msgget
9829         eval $setvar
9830         set msgsnd d_msgsnd
9831         eval $setvar
9832         set msgrcv d_msgrcv
9833         eval $setvar
9834         ;;
9835     esac
9836     ;;
9837 esac
9838 : we could also check for sys/ipc.h ...
9839 if $h_msg && $test `./findhdr sys/msg.h`; then
9840         echo "You have the full msg*(2) library." >&4
9841         val="$define"
9842 else
9843         echo "You don't have the full msg*(2) library." >&4
9844         val="$undef"
9845 fi
9846 set d_msg
9847 eval $setvar
9848
9849 : see if msync exists
9850 set msync d_msync
9851 eval $inlibc
9852
9853 : see if munmap exists
9854 set munmap d_munmap
9855 eval $inlibc
9856
9857 : see if nice exists
9858 set nice d_nice
9859 eval $inlibc
9860
9861
9862 echo " "
9863 echo "Checking which 64-bit integer type we could use..." >&4
9864
9865 case "$intsize" in
9866 8) val=int
9867    set quadtype
9868    eval $setvar
9869    val='"unsigned int"'
9870    set uquadtype
9871    eval $setvar
9872    quadkind=1
9873    ;;
9874 *) case "$longsize" in
9875    8) val=long
9876       set quadtype
9877       eval $setvar
9878       val='"unsigned long"'
9879       set uquadtype
9880       eval $setvar
9881       quadkind=2
9882       ;;
9883    *) case "$d_longlong:$longlongsize" in
9884       define:8)
9885         val='"long long"'
9886         set quadtype
9887         eval $setvar
9888         val='"unsigned long long"'
9889         set uquadtype
9890         eval $setvar
9891         quadkind=3
9892         ;;
9893       *) case "$d_int64_t" in
9894          define)
9895            val=int64_t
9896            set quadtype
9897            eval $setvar
9898            val=uint64_t
9899            set uquadtype
9900            eval $setvar
9901            quadkind=4
9902            ;;
9903          esac
9904          ;;
9905       esac
9906       ;;
9907    esac
9908    ;;
9909 esac
9910
9911 case "$quadtype" in
9912 '')     echo "Alas, no 64-bit integer types in sight." >&4
9913         d_quad="$undef"
9914         ;;
9915 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
9916             verb="will"
9917         else
9918             verb="could"
9919         fi
9920         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9921         d_quad="$define"
9922         ;;
9923 esac
9924
9925 : check for length of character
9926 echo " "
9927 case "$charsize" in
9928 '')
9929         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9930         $cat >try.c <<'EOCP'
9931 #include <stdio.h>
9932 int main()
9933 {
9934     printf("%d\n", (int)sizeof(char));
9935     exit(0);
9936 }
9937 EOCP
9938         set try
9939         if eval $compile_ok; then
9940                 dflt=`./try`
9941         else
9942                 dflt='1'
9943                 echo "(I can't seem to compile the test program.  Guessing...)"
9944         fi
9945         ;;
9946 *)
9947         dflt="$charsize"
9948         ;;
9949 esac
9950 rp="What is the size of a character (in bytes)?"
9951 . ./myread
9952 charsize="$ans"
9953 $rm -f try.c try
9954
9955
9956 echo " "
9957 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9958
9959 case "$use64bitint:$d_quad:$quadtype" in
9960 define:define:?*)
9961         ivtype="$quadtype"
9962         uvtype="$uquadtype"
9963         ivsize=8
9964         uvsize=8
9965         ;;
9966 *)      ivtype="long"
9967         uvtype="unsigned long"
9968         ivsize=$longsize
9969         uvsize=$longsize
9970         ;;
9971 esac
9972
9973 case "$uselongdouble:$d_longdbl" in
9974 define:define)
9975         nvtype="long double"
9976         nvsize=$longdblsize
9977         ;;
9978 *)      nvtype=double
9979         nvsize=$doublesize
9980         ;;
9981 esac
9982
9983 $echo "(IV will be "$ivtype", $ivsize bytes)"
9984 $echo "(UV will be "$uvtype", $uvsize bytes)"
9985 $echo "(NV will be "$nvtype", $nvsize bytes)"
9986
9987 $cat >try.c <<EOCP
9988 #$i_inttypes I_INTTYPES
9989 #ifdef I_INTTYPES
9990 #include <inttypes.h>
9991 #endif
9992 #include <stdio.h>
9993 int main() {
9994 #ifdef INT8
9995    int8_t i =  INT8_MAX;
9996   uint8_t u = UINT8_MAX;
9997   printf("int8_t\n");
9998 #endif
9999 #ifdef INT16
10000    int16_t i =  INT16_MAX;
10001   uint16_t i = UINT16_MAX;
10002   printf("int16_t\n");
10003 #endif
10004 #ifdef INT32
10005    int32_t i =  INT32_MAX;
10006   uint32_t u = UINT32_MAX;
10007   printf("int32_t\n");
10008 #endif
10009 }
10010 EOCP
10011
10012 case "$i8type" in
10013 '')     case "$charsize" in
10014         1)      i8type=char
10015                 u8type="unsigned char"
10016                 i8size=$charsize
10017                 u8size=$charsize
10018                 ;;
10019         esac
10020         ;;
10021 esac
10022 case "$i8type" in
10023 '')     set try -DINT8
10024         if eval $compile; then
10025                 case "`./try$exe_ext`" in
10026                 int8_t) i8type=int8_t
10027                         u8type=uint8_t
10028                         i8size=1
10029                         u8size=1
10030                         ;;
10031                 esac
10032         fi
10033         ;;
10034 esac
10035 case "$i8type" in
10036 '')     if $test $charsize -ge 1; then
10037                 i8type=char
10038                 u8type="unsigned char"
10039                 i8size=$charsize
10040                 u8size=$charsize
10041         fi
10042         ;;
10043 esac
10044
10045 case "$i16type" in
10046 '')     case "$shortsize" in
10047         2)      i16type=short
10048                 u16type="unsigned short"
10049                 i16size=$shortsize
10050                 u16size=$shortsize
10051                 ;;
10052         esac
10053         ;;
10054 esac
10055 case "$i16type" in
10056 '')     set try -DINT16
10057         if eval $compile; then
10058                 case "`./try$exe_ext`" in
10059                 int16_t)
10060                         i16type=int16_t
10061                         u16type=uint16_t
10062                         i16size=2
10063                         u16size=2
10064                         ;;
10065                 esac
10066         fi
10067         ;;
10068 esac
10069 case "$i16type" in
10070 '')     if $test $shortsize -ge 2; then
10071                 i16type=short
10072                 u16type="unsigned short"
10073                 i16size=$shortsize
10074                 u16size=$shortsize
10075         fi
10076         ;;
10077 esac
10078
10079 case "$i32type" in
10080 '')     case "$longsize" in
10081         4)      i32type=long
10082                 u32type="unsigned long"
10083                 i32size=$longsize
10084                 u32size=$longsize
10085                 ;;
10086         *)      case "$intsize" in
10087                 4)      i32type=int
10088                         u32type="unsigned int"
10089                         i32size=$intsize
10090                         u32size=$intsize
10091                         ;;
10092                 esac
10093                 ;;
10094         esac
10095         ;;
10096 esac
10097 case "$i32type" in
10098 '')     set try -DINT32
10099         if eval $compile; then
10100                 case "`./try$exe_ext`" in
10101                 int32_t)
10102                         i32type=int32_t
10103                         u32type=uint32_t
10104                         i32size=4
10105                         u32size=4
10106                         ;;
10107                 esac
10108         fi
10109         ;;
10110 esac
10111 case "$i32type" in
10112 '')     if $test $intsize -ge 4; then
10113                 i32type=int
10114                 u32type="unsigned int"
10115                 i32size=$intsize
10116                 u32size=$intsize
10117         fi
10118         ;;
10119 esac
10120
10121 case "$i64type" in
10122 '')     case "$d_quad:$quadtype" in
10123         define:?*)
10124                 i64type="$quadtype"
10125                 u64type="$uquadtype"
10126                 i64size=8
10127                 u64size=8
10128                 ;;
10129         esac
10130         ;;
10131 esac
10132
10133 $echo "Checking whether your NVs can preserve your UVs..." >&4
10134 $cat <<EOP >try.c
10135 #include <stdio.h>
10136 int main() {
10137     $uvtype k = ($uvtype)~0, l;
10138     $nvtype d;
10139     l = k;
10140     d = ($nvtype)l;
10141     l = ($uvtype)d;
10142     if (l == k)
10143        printf("preserve\n");
10144     exit(0);
10145 }
10146 EOP
10147 set try
10148 if eval $compile; then
10149         case "`./try$exe_ext`" in
10150         preserve) d_nv_preserves_uv="$define" ;;
10151         esac
10152 fi      
10153 case "$d_nv_preserves_uv" in
10154 $define) $echo "Yes, they can."  2>&1 ;;
10155 *)       $echo "No, they can't." 2>&1
10156          d_nv_preserves_uv="$undef"
10157          ;;
10158 esac
10159
10160 $rm -f try.* try
10161
10162
10163 : check for off64_t
10164 echo " "
10165 echo "Checking to see if you have off64_t..." >&4
10166 $cat >try.c <<EOCP
10167 #include <sys/types.h>
10168 #include <unistd.h>
10169 int main() { off64_t x = 7; }
10170 EOCP
10171 set try
10172 if eval $compile; then
10173         val="$define"
10174         echo "You have off64_t."
10175 else
10176         val="$undef"
10177         echo "You do not have off64_t."
10178         case "$lseeksize" in
10179         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10180         esac
10181 fi
10182 $rm -f try.* try
10183 set d_off64_t
10184 eval $setvar
10185
10186 : see if POSIX threads are available
10187 set pthread.h i_pthread
10188 eval $inhdr
10189
10190
10191
10192
10193 : how to create joinable pthreads
10194 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10195         echo " "
10196         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10197         $cat >try.c <<'EOCP'
10198 #include <pthread.h>
10199 int main() {
10200     int detachstate = JOINABLE;
10201 }
10202 EOCP
10203         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10204         if eval $compile; then
10205                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10206                 val="$undef" # Yes, undef.
10207                 set d_old_pthread_create_joinable
10208                 eval $setvar
10209                 val=""
10210                 set old_pthread_create_joinable
10211                 eval $setvar
10212         else
10213                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10214                 if eval $compile; then
10215                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10216                         val="$define"
10217                         set d_old_pthread_create_joinable
10218                         eval $setvar
10219                         val=PTHREAD_CREATE_UNDETACHED
10220                         set old_pthread_create_joinable
10221                         eval $setvar
10222                 else            
10223                         set try -DJOINABLE=__UNDETACHED
10224                         if eval $compile; then
10225                                 echo "You seem to use __UNDETACHED." >&4
10226                                 val="$define"
10227                                 set d_old_pthread_create_joinable
10228                                 eval $setvar
10229                                 val=__UNDETACHED
10230                                 set old_pthread_create_joinable
10231                                 eval $setvar
10232                         else
10233                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10234                                 val="$define"
10235                                 set d_old_pthread_create_joinable
10236                                 eval $setvar
10237                                 val=0
10238                                 set old_pthread_create_joinable
10239                                 eval $setvar
10240                         fi
10241                 fi
10242         fi
10243         $rm -f try try.*
10244 else
10245     d_old_pthread_create_joinable="$undef"
10246     old_pthread_create_joinable=""
10247 fi
10248
10249 : see if pause exists
10250 set pause d_pause
10251 eval $inlibc
10252
10253 : see if pipe exists
10254 set pipe d_pipe
10255 eval $inlibc
10256
10257 : see if poll exists
10258 set poll d_poll
10259 eval $inlibc
10260
10261
10262 : see whether the various POSIXish _yields exist
10263 $cat >try.c <<EOP
10264 #include <pthread.h>
10265 #include <stdio.h>
10266 int main() {
10267 #ifdef SCHED_YIELD
10268         sched_yield();
10269 #else
10270 #ifdef PTHREAD_YIELD
10271         pthread_yield();
10272 #else
10273 #ifdef PTHREAD_YIELD_NULL
10274         pthread_yield(NULL);
10275 #endif
10276 #endif
10277 #endif
10278 }
10279 EOP
10280 : see if sched_yield exists
10281 set try -DSCHED_YIELD
10282 if eval $compile; then
10283     val="$define"
10284     sched_yield='sched_yield()'
10285 else
10286     val="$undef"
10287 fi
10288 case "$usethreads" in
10289 $define)
10290         case "$val" in
10291         $define) echo 'sched_yield() found.' >&4        ;;
10292         *)       echo 'sched_yield() NOT found.' >&4    ;;
10293         esac
10294 esac
10295 set d_sched_yield
10296 eval $setvar
10297
10298 : see if pthread_yield exists
10299 set try -DPTHREAD_YIELD
10300 if eval $compile; then
10301     val="$define"
10302     case "$sched_yield" in
10303     '') sched_yield='pthread_yield()' ;;
10304     esac
10305 else
10306     set try -DPTHREAD_YIELD_NULL
10307     if eval $compile; then
10308         val="$define"
10309         case "$sched_yield" in
10310         '') sched_yield='pthread_yield(NULL)' ;;
10311         esac
10312     else
10313         val="$undef"
10314     fi
10315 fi
10316 case "$usethreads" in
10317 $define)
10318         case "$val" in
10319         $define) echo 'pthread_yield() found.' >&4      ;;
10320         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10321         esac
10322         ;;
10323 esac
10324 set d_pthread_yield
10325 eval $setvar
10326
10327 case "$sched_yield" in
10328 '') sched_yield=undef ;;
10329 esac
10330
10331 $rm -f try try.*
10332
10333 : see if this is a pwd.h system
10334 set pwd.h i_pwd
10335 eval $inhdr
10336
10337 case "$i_pwd" in
10338 $define)
10339         xxx=`./findhdr pwd.h`
10340         $cppstdin $cppflags $cppminus < $xxx >$$.h
10341
10342         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10343                 val="$define"
10344         else
10345                 val="$undef"
10346         fi
10347         set d_pwquota
10348         eval $setvar
10349
10350         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10351                 val="$define"
10352         else
10353                 val="$undef"
10354         fi
10355         set d_pwage
10356         eval $setvar
10357
10358         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10359                 val="$define"
10360         else
10361                 val="$undef"
10362         fi
10363         set d_pwchange
10364         eval $setvar
10365
10366         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10367                 val="$define"
10368         else
10369                 val="$undef"
10370         fi
10371         set d_pwclass
10372         eval $setvar
10373
10374         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10375                 val="$define"
10376         else
10377                 val="$undef"
10378         fi
10379         set d_pwexpire
10380         eval $setvar
10381
10382         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10383                 val="$define"
10384         else
10385                 val="$undef"
10386         fi
10387         set d_pwcomment
10388         eval $setvar
10389
10390         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10391                 val="$define"
10392         else
10393                 val="$undef"
10394         fi
10395         set d_pwgecos
10396         eval $setvar
10397
10398         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10399                 val="$define"
10400         else
10401                 val="$undef"
10402         fi
10403         set d_pwpasswd
10404         eval $setvar
10405
10406         $rm -f $$.h
10407         ;;
10408 *)
10409         val="$undef"; 
10410         set d_pwquota; eval $setvar
10411         set d_pwage; eval $setvar
10412         set d_pwchange; eval $setvar
10413         set d_pwclass; eval $setvar
10414         set d_pwexpire; eval $setvar
10415         set d_pwcomment; eval $setvar
10416         set d_pwgecos; eval $setvar
10417         set d_pwpasswd; eval $setvar
10418         ;;
10419 esac
10420
10421 : see if readdir and friends exist
10422 set readdir d_readdir
10423 eval $inlibc
10424 set seekdir d_seekdir
10425 eval $inlibc
10426 set telldir d_telldir
10427 eval $inlibc
10428 set rewinddir d_rewinddir
10429 eval $inlibc
10430
10431 : see if readlink exists
10432 set readlink d_readlink
10433 eval $inlibc
10434
10435 : see if rename exists
10436 set rename d_rename
10437 eval $inlibc
10438
10439 : see if rmdir exists
10440 set rmdir d_rmdir
10441 eval $inlibc
10442
10443 : see if memory.h is available.
10444 val=''
10445 set memory.h val
10446 eval $inhdr
10447
10448 : See if it conflicts with string.h
10449 case "$val" in
10450 $define)
10451         case "$strings" in
10452         '') ;;
10453         *)
10454                 $cppstdin $cppflags $cppminus < $strings > mem.h
10455                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10456                         echo " "
10457                         echo "We won't be including <memory.h>."
10458                         val="$undef"
10459                 fi
10460                 $rm -f mem.h
10461                 ;;
10462         esac
10463 esac
10464 set i_memory
10465 eval $setvar
10466
10467 : can bcopy handle overlapping blocks?
10468 val="$undef"
10469 case "$d_bcopy" in
10470 "$define")
10471         echo " "
10472         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10473         $cat >try.c <<EOCP
10474 #$i_memory I_MEMORY
10475 #$i_stdlib I_STDLIB
10476 #$i_string I_STRING
10477 #$i_unistd I_UNISTD
10478 EOCP
10479         $cat >>try.c <<'EOCP'
10480 #include <stdio.h>
10481 #ifdef I_MEMORY
10482 #  include <memory.h>
10483 #endif
10484 #ifdef I_STDLIB
10485 #  include <stdlib.h>
10486 #endif
10487 #ifdef I_STRING
10488 #  include <string.h>
10489 #else
10490 #  include <strings.h>
10491 #endif
10492 #ifdef I_UNISTD
10493 #  include <unistd.h>  /* Needed for NetBSD */
10494 #endif
10495 int main()
10496 {
10497 char buf[128], abc[128];
10498 char *b;
10499 int len;
10500 int off;
10501 int align;
10502
10503 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10504
10505 for (align = 7; align >= 0; align--) {
10506         for (len = 36; len; len--) {
10507                 b = buf+align;
10508                 bcopy(abc, b, len);
10509                 for (off = 1; off <= len; off++) {
10510                         bcopy(b, b+off, len);
10511                         bcopy(b+off, b, len);
10512                         if (bcmp(b, abc, len))
10513                                 exit(1);
10514                 }
10515         }
10516 }
10517 exit(0);
10518 }
10519 EOCP
10520         set try
10521         if eval $compile_ok; then
10522                 if ./try 2>/dev/null; then
10523                         echo "Yes, it can."
10524                         val="$define"
10525                 else
10526                         echo "It can't, sorry."
10527                         case "$d_memmove" in
10528                         "$define") echo "But that's Ok since you have memmove()." ;;
10529                         esac
10530                 fi
10531         else
10532                 echo "(I can't compile the test program, so we'll assume not...)"
10533                 case "$d_memmove" in
10534                 "$define") echo "But that's Ok since you have memmove()." ;;
10535                 esac
10536         fi
10537         ;;
10538 esac
10539 $rm -f try.* try core
10540 set d_safebcpy
10541 eval $setvar
10542
10543 : can memcpy handle overlapping blocks?
10544 val="$undef"
10545 case "$d_memcpy" in
10546 "$define")
10547         echo " "
10548         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10549         $cat >try.c <<EOCP
10550 #$i_memory I_MEMORY
10551 #$i_stdlib I_STDLIB
10552 #$i_string I_STRING
10553 #$i_unistd I_UNISTD
10554 EOCP
10555         $cat >>try.c <<'EOCP'
10556 #include <stdio.h>
10557 #ifdef I_MEMORY
10558 #  include <memory.h>
10559 #endif
10560 #ifdef I_STDLIB
10561 #  include <stdlib.h>
10562 #endif
10563 #ifdef I_STRING
10564 #  include <string.h>
10565 #else
10566 #  include <strings.h>
10567 #endif
10568 #ifdef I_UNISTD
10569 #  include <unistd.h>  /* Needed for NetBSD */
10570 #endif
10571 int main()
10572 {
10573 char buf[128], abc[128];
10574 char *b;
10575 int len;
10576 int off;
10577 int align;
10578
10579 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10580    try to store the string in read-only memory. */
10581 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10582
10583 for (align = 7; align >= 0; align--) {
10584         for (len = 36; len; len--) {
10585                 b = buf+align;
10586                 memcpy(b, abc, len);
10587                 for (off = 1; off <= len; off++) {
10588                         memcpy(b+off, b, len);
10589                         memcpy(b, b+off, len);
10590                         if (memcmp(b, abc, len))
10591                                 exit(1);
10592                 }
10593         }
10594 }
10595 exit(0);
10596 }
10597 EOCP
10598         set try
10599         if eval $compile_ok; then
10600                 if ./try 2>/dev/null; then
10601                         echo "Yes, it can."
10602                         val="$define"
10603                 else
10604                         echo "It can't, sorry."
10605                         case "$d_memmove" in
10606                         "$define") echo "But that's Ok since you have memmove()." ;;
10607                         esac
10608                 fi
10609         else
10610                 echo "(I can't compile the test program, so we'll assume not...)"
10611                 case "$d_memmove" in
10612                 "$define") echo "But that's Ok since you have memmove()." ;;
10613                 esac
10614         fi
10615         ;;
10616 esac
10617 $rm -f try.* try core
10618 set d_safemcpy
10619 eval $setvar
10620
10621 : can memcmp be trusted to compare relative magnitude?
10622 val="$undef"
10623 case "$d_memcmp" in
10624 "$define")
10625         echo " "
10626         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10627         $cat >try.c <<EOCP
10628 #$i_memory I_MEMORY
10629 #$i_stdlib I_STDLIB
10630 #$i_string I_STRING
10631 #$i_unistd I_UNISTD
10632 EOCP
10633         $cat >>try.c <<'EOCP'
10634 #include <stdio.h>
10635 #ifdef I_MEMORY
10636 #  include <memory.h>
10637 #endif
10638 #ifdef I_STDLIB
10639 #  include <stdlib.h>
10640 #endif
10641 #ifdef I_STRING
10642 #  include <string.h>
10643 #else
10644 #  include <strings.h>
10645 #endif
10646 #ifdef I_UNISTD
10647 #  include <unistd.h>  /* Needed for NetBSD */
10648 #endif
10649 int main()
10650 {
10651 char a = -1;
10652 char b = 0;
10653 if ((a < b) && memcmp(&a, &b, 1) < 0)
10654         exit(1);
10655 exit(0);
10656 }
10657 EOCP
10658         set try
10659         if eval $compile_ok; then
10660                 if ./try 2>/dev/null; then
10661                         echo "Yes, it can."
10662                         val="$define"
10663                 else
10664                         echo "No, it can't (it uses signed chars)."
10665                 fi
10666         else
10667                 echo "(I can't compile the test program, so we'll assume not...)"
10668         fi
10669         ;;
10670 esac
10671 $rm -f try.* try core
10672 set d_sanemcmp
10673 eval $setvar
10674
10675 : see if select exists
10676 set select d_select
10677 eval $inlibc
10678
10679 : see if semctl exists
10680 set semctl d_semctl
10681 eval $inlibc
10682
10683 : see if semget exists
10684 set semget d_semget
10685 eval $inlibc
10686
10687 : see if semop exists
10688 set semop d_semop
10689 eval $inlibc
10690
10691 : see how much of the 'sem*(2)' library is present.
10692 h_sem=true
10693 echo " "
10694 case "$d_semctl$d_semget$d_semop" in
10695 *"$undef"*) h_sem=false;;
10696 esac
10697 case "$osname" in
10698 freebsd)
10699     case "`ipcs 2>&1`" in
10700     "SVID messages"*"not configured"*)
10701         echo "Your $osname does not have the sem*(2) configured." >&4
10702         h_sem=false
10703         val="$undef"
10704         set semctl d_semctl
10705         eval $setvar
10706         set semget d_semget
10707         eval $setvar
10708         set semop d_semop
10709         eval $setvar
10710         ;;
10711     esac
10712     ;;
10713 esac
10714 : we could also check for sys/ipc.h ...
10715 if $h_sem && $test `./findhdr sys/sem.h`; then
10716         echo "You have the full sem*(2) library." >&4
10717         val="$define"
10718 else
10719         echo "You don't have the full sem*(2) library." >&4
10720         val="$undef"
10721 fi
10722 set d_sem
10723 eval $setvar
10724
10725 : see whether sys/sem.h defines union semun
10726 echo " "
10727 $cat > try.c <<'END'
10728 #include <sys/types.h>
10729 #include <sys/ipc.h>
10730 #include <sys/sem.h>
10731 int main () { union semun semun; semun.buf = 0; }
10732 END
10733 set try
10734 if eval $compile; then
10735     echo "You have union semun in <sys/sem.h>." >&4
10736     val="$define"
10737 else
10738     echo "You do not have union semun in <sys/sem.h>." >&4
10739     val="$undef"
10740 fi
10741 $rm -f try try.c try.h
10742 set d_union_semun
10743 eval $setvar
10744
10745 : see how to do semctl IPC_STAT
10746 case "$d_sem" in
10747 $define)
10748     : see whether semctl IPC_STAT can use union semun
10749     echo " "
10750     $cat > try.h <<END
10751 #ifndef S_IRUSR
10752 #   ifdef S_IREAD
10753 #       define S_IRUSR S_IREAD
10754 #       define S_IWUSR S_IWRITE
10755 #       define S_IXUSR S_IEXEC
10756 #   else
10757 #       define S_IRUSR 0400
10758 #       define S_IWUSR 0200
10759 #       define S_IXUSR 0100
10760 #   endif
10761 #   define S_IRGRP (S_IRUSR>>3)
10762 #   define S_IWGRP (S_IWUSR>>3)
10763 #   define S_IXGRP (S_IXUSR>>3)
10764 #   define S_IROTH (S_IRUSR>>6)
10765 #   define S_IWOTH (S_IWUSR>>6)
10766 #   define S_IXOTH (S_IXUSR>>6)
10767 #endif
10768 #ifndef S_IRWXU
10769 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10770 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10771 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10772 #endif
10773 END
10774
10775     $cat > try.c <<END
10776 #include <sys/types.h>
10777 #include <sys/ipc.h>
10778 #include <sys/sem.h>
10779 #include <sys/stat.h>
10780 #include <stdio.h>
10781 #include <errno.h>
10782 #include "try.h"
10783 #ifndef errno
10784 extern int errno;
10785 #endif
10786 #$d_union_semun HAS_UNION_SEMUN
10787 int main() {
10788     union semun
10789 #ifndef HAS_UNION_SEMUN
10790     {
10791         int val;
10792         struct semid_ds *buf;
10793         unsigned short *array;
10794     }
10795 #endif
10796     arg;
10797     int sem, st;
10798
10799 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10800     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10801     if (sem > -1) {
10802         struct semid_ds argbuf;
10803         arg.buf = &argbuf;
10804 #       ifdef IPC_STAT
10805         st = semctl(sem, 0, IPC_STAT, arg);
10806         if (st == 0)
10807             printf("semun\n");
10808         else
10809 #       endif /* IPC_STAT */
10810             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10811 #       ifdef IPC_RMID
10812         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10813 #       endif /* IPC_RMID */
10814             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10815     } else
10816 #endif /* IPC_PRIVATE && ... */
10817         printf("semget failed: errno = %d\n", errno);
10818   return 0;
10819 }
10820 END
10821     val="$undef"
10822     set try
10823     if eval $compile; then
10824         xxx=`./try`
10825         case "$xxx" in
10826         semun) val="$define" ;;
10827         esac
10828     fi
10829     $rm -f try try.c
10830     set d_semctl_semun
10831     eval $setvar
10832     case "$d_semctl_semun" in
10833     $define)
10834         echo "You can use union semun for semctl IPC_STAT." >&4
10835         also='also'
10836         ;;
10837     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10838         also=''
10839         ;;
10840     esac
10841
10842     : see whether semctl IPC_STAT can use struct semid_ds pointer
10843     $cat > try.c <<'END'
10844 #include <sys/types.h>
10845 #include <sys/ipc.h>
10846 #include <sys/sem.h>
10847 #include <sys/stat.h>
10848 #include "try.h"
10849 #include <stdio.h>
10850 #include <errno.h>
10851 #ifndef errno
10852 extern int errno;
10853 #endif
10854 int main() {
10855     struct semid_ds arg;
10856     int sem, st;
10857
10858 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10859     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10860     if (sem > -1) {
10861 #       ifdef IPC_STAT
10862         st = semctl(sem, 0, IPC_STAT, &arg);
10863         if (st == 0)
10864             printf("semid_ds\n");
10865         else
10866 #       endif /* IPC_STAT */
10867             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10868 #       ifdef IPC_RMID
10869         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10870 #       endif /* IPC_RMID */
10871             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10872     } else
10873 #endif /* IPC_PRIVATE && ... */
10874         printf("semget failed: errno = %d\n", errno);
10875
10876     return 0;
10877 }
10878 END
10879     val="$undef"
10880     set try
10881     if eval $compile; then
10882         xxx=`./try`
10883         case "$xxx" in
10884         semid_ds) val="$define" ;;
10885         esac
10886     fi
10887     $rm -f try try.c
10888     set d_semctl_semid_ds
10889     eval $setvar
10890     case "$d_semctl_semid_ds" in
10891     $define)
10892         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10893         ;;
10894     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10895         ;;
10896     esac
10897     $rm -f try.h
10898     ;;
10899 *)  val="$undef"
10900
10901     # We do not have the full sem*(2) library, so assume we can not
10902     # use either.
10903
10904     set d_semctl_semun
10905     eval $setvar
10906
10907     set d_semctl_semid_ds
10908     eval $setvar
10909     ;;
10910 esac
10911
10912 : see if setegid exists
10913 set setegid d_setegid
10914 eval $inlibc
10915
10916 : see if seteuid exists
10917 set seteuid d_seteuid
10918 eval $inlibc
10919
10920 : see if setgrent exists
10921 set setgrent d_setgrent
10922 eval $inlibc
10923
10924 : see if sethostent exists
10925 set sethostent d_sethent
10926 eval $inlibc
10927
10928 : see if setlinebuf exists
10929 set setlinebuf d_setlinebuf
10930 eval $inlibc
10931
10932 : see if setlocale exists
10933 set setlocale d_setlocale
10934 eval $inlibc
10935
10936 : see if setnetent exists
10937 set setnetent d_setnent
10938 eval $inlibc
10939
10940 : see if setprotoent exists
10941 set setprotoent d_setpent
10942 eval $inlibc
10943
10944 : see if setpgid exists
10945 set setpgid d_setpgid
10946 eval $inlibc
10947
10948 : see if setpgrp2 exists
10949 set setpgrp2 d_setpgrp2
10950 eval $inlibc
10951
10952 : see if setpriority exists
10953 set setpriority d_setprior
10954 eval $inlibc
10955
10956 : see if setpwent exists
10957 set setpwent d_setpwent
10958 eval $inlibc
10959
10960 : see if setregid exists
10961 set setregid d_setregid
10962 eval $inlibc
10963 set setresgid d_setresgid
10964 eval $inlibc
10965
10966 : see if setreuid exists
10967 set setreuid d_setreuid
10968 eval $inlibc
10969 set setresuid d_setresuid
10970 eval $inlibc
10971
10972 : see if setrgid exists
10973 set setrgid d_setrgid
10974 eval $inlibc
10975
10976 : see if setruid exists
10977 set setruid d_setruid
10978 eval $inlibc
10979
10980 : see if setservent exists
10981 set setservent d_setsent
10982 eval $inlibc
10983
10984 : see if setsid exists
10985 set setsid d_setsid
10986 eval $inlibc
10987
10988 : see if setspent exists
10989 set setspent d_setspent
10990 eval $inlibc
10991
10992 : see if setvbuf exists
10993 set setvbuf d_setvbuf
10994 eval $inlibc
10995
10996 : see if sfio.h is available
10997 set sfio.h i_sfio
10998 eval $inhdr
10999
11000
11001 : see if sfio library is available
11002 case "$i_sfio" in
11003 $define)
11004         val=''
11005         set sfreserve val
11006         eval $inlibc
11007         ;;
11008 *)
11009         val="$undef"
11010         ;;
11011 esac
11012 : Ok, but do we want to use it.
11013 case "$val" in
11014 $define)
11015         case "$usesfio" in
11016         true|$define|[yY]*) dflt='y';;
11017         *) dflt='n';;
11018         esac
11019         echo "$package can use the sfio library, but it is experimental."
11020         rp="You seem to have sfio available, do you want to try using it?"
11021         . ./myread
11022         case "$ans" in
11023         y|Y) ;;
11024         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11025                 val="$undef"
11026                 : Remove sfio from list of libraries to use
11027                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11028                 shift
11029                 libs="$*"
11030                 echo "libs = $libs" >&4
11031                 ;;
11032         esac
11033         ;;
11034 *)      case "$usesfio" in
11035         true|$define|[yY]*)
11036                 echo "Sorry, cannot find sfio on this machine" >&4
11037                 echo "Ignoring your setting of usesfio=$usesfio" >&4
11038                 ;;
11039         esac
11040         ;;
11041 esac
11042 set d_sfio
11043 eval $setvar
11044 case "$d_sfio" in
11045 $define) usesfio='true';;
11046 *) usesfio='false';;
11047 esac
11048
11049 : see if shmctl exists
11050 set shmctl d_shmctl
11051 eval $inlibc
11052
11053 : see if shmget exists
11054 set shmget d_shmget
11055 eval $inlibc
11056
11057 : see if shmat exists
11058 set shmat d_shmat
11059 eval $inlibc
11060 : see what shmat returns
11061 case "$d_shmat" in
11062 "$define")
11063         $cat >shmat.c <<'END'
11064 #include <sys/shm.h>
11065 void *shmat();
11066 END
11067         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11068                 shmattype='void *'
11069         else
11070                 shmattype='char *'
11071         fi
11072         echo "and it returns ($shmattype)." >&4
11073         : see if a prototype for shmat is available
11074         xxx=`./findhdr sys/shm.h`
11075         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11076         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11077                 val="$define"
11078         else
11079                 val="$undef"
11080         fi
11081         $rm -f shmat.[co]
11082         ;;
11083 *)
11084         val="$undef"
11085         ;;
11086 esac
11087 set d_shmatprototype
11088 eval $setvar
11089
11090 : see if shmdt exists
11091 set shmdt d_shmdt
11092 eval $inlibc
11093
11094 : see how much of the 'shm*(2)' library is present.
11095 h_shm=true
11096 echo " "
11097 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11098 *"$undef"*) h_shm=false;;
11099 esac
11100 case "$osname" in
11101 freebsd)
11102     case "`ipcs 2>&1`" in
11103     "SVID shared memory"*"not configured"*)
11104         echo "Your $osname does not have the shm*(2) configured." >&4
11105         h_shm=false
11106         val="$undef"
11107         set shmctl d_shmctl
11108         evat $setvar
11109         set shmget d_shmget
11110         evat $setvar
11111         set shmat d_shmat
11112         evat $setvar
11113         set shmdt d_shmdt
11114         evat $setvar
11115         ;;
11116     esac
11117     ;;
11118 esac
11119 : we could also check for sys/ipc.h ...
11120 if $h_shm && $test `./findhdr sys/shm.h`; then
11121         echo "You have the full shm*(2) library." >&4
11122         val="$define"
11123 else
11124         echo "You don't have the full shm*(2) library." >&4
11125         val="$undef"
11126 fi
11127 set d_shm
11128 eval $setvar
11129
11130 echo " "
11131 : see if we have sigaction
11132 if set sigaction val -f d_sigaction; eval $csym; $val; then
11133         echo 'sigaction() found.' >&4
11134         $cat > try.c <<'EOP'
11135 #include <stdio.h>
11136 #include <sys/types.h>
11137 #include <signal.h>
11138 int main()
11139 {
11140     struct sigaction act, oact;
11141     act.sa_flags = 0;
11142     oact.sa_handler = 0;
11143     /* so that act and oact are used */
11144     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11145 }
11146 EOP
11147         set try
11148         if eval $compile_ok; then
11149                 val="$define"
11150         else
11151                 echo "But you don't seem to have a useable struct sigaction." >&4
11152                 val="$undef"
11153         fi
11154 else
11155         echo 'sigaction NOT found.' >&4
11156         val="$undef"
11157 fi
11158 set d_sigaction; eval $setvar
11159 $rm -f try try$_o try.c
11160
11161 : see if sigsetjmp exists
11162 echo " "
11163 case "$d_sigsetjmp" in
11164 '')
11165         $cat >try.c <<'EOP'
11166 #include <setjmp.h>
11167 sigjmp_buf env;
11168 int set = 1;
11169 int main()
11170 {
11171         if (sigsetjmp(env,1))
11172                 exit(set);
11173         set = 0;
11174         siglongjmp(env, 1);
11175         exit(1);
11176 }
11177 EOP
11178         set try
11179         if eval $compile; then
11180                 if ./try >/dev/null 2>&1; then
11181                         echo "POSIX sigsetjmp found." >&4
11182                         val="$define"
11183                 else
11184                         $cat >&4 <<EOM
11185 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11186 I'll ignore them.
11187 EOM
11188                         val="$undef"
11189                 fi
11190         else
11191                 echo "sigsetjmp not found." >&4
11192                 val="$undef"
11193         fi
11194         ;;
11195 *) val="$d_sigsetjmp"
11196         case "$d_sigsetjmp" in
11197         $define) echo "POSIX sigsetjmp found." >&4;;
11198         $undef) echo "sigsetjmp not found." >&4;;
11199         esac
11200         ;;
11201 esac
11202 set d_sigsetjmp
11203 eval $setvar
11204 $rm -f try.c try
11205
11206 : see if sys/stat.h is available
11207 set sys/stat.h i_sysstat
11208 eval $inhdr
11209
11210
11211 : see if stat knows about block sizes
11212 echo " "
11213 echo "Checking to see if your struct stat has st_blocks field..." >&4
11214 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11215 eval $hasfield
11216
11217
11218 : see if this is a sys/vfs.h system
11219 set sys/vfs.h i_sysvfs
11220 eval $inhdr
11221
11222
11223 : see if this is a sys/statfs.h system
11224 set sys/statfs.h i_sysstatfs
11225 eval $inhdr
11226
11227
11228 echo " "
11229 echo "Checking to see if your system supports struct statfs..." >&4
11230 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
11231 eval $hasstruct
11232 case "$d_statfs_s" in
11233 "$define")      echo "Yes, it does."   ;;
11234 *)              echo "No, it doesn't." ;;
11235 esac
11236
11237
11238
11239 : see if struct statfs knows about f_flags
11240 case "$d_statfs_s" in
11241 define) 
11242         echo " "
11243         echo "Checking to see if your struct statfs has f_flags field..." >&4
11244         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
11245         eval $hasfield
11246         ;;
11247 *)      val="$undef"
11248         set d_statfs_f_flags
11249         eval $setvar
11250         ;;
11251 esac
11252 case "$d_statfs_f_flags" in
11253 "$define")      echo "Yes, it does."   ;;
11254 *)              echo "No, it doesn't." ;;
11255 esac
11256
11257 : see if _ptr and _cnt from stdio act std
11258 echo " "
11259 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11260         echo "(Looks like you have stdio.h from Linux.)"
11261         case "$stdio_ptr" in
11262         '') stdio_ptr='((fp)->_IO_read_ptr)'
11263                 ptr_lval=$define
11264                 ;;
11265         *)      ptr_lval=$d_stdio_ptr_lval;;
11266         esac
11267         case "$stdio_cnt" in
11268         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11269                 cnt_lval=$undef
11270                 ;;
11271         *)      cnt_lval=$d_stdio_cnt_lval;;
11272         esac
11273         case "$stdio_base" in
11274         '') stdio_base='((fp)->_IO_read_base)';;
11275         esac
11276         case "$stdio_bufsiz" in
11277         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11278         esac
11279 else
11280         case "$stdio_ptr" in
11281         '') stdio_ptr='((fp)->_ptr)'
11282                 ptr_lval=$define
11283                 ;;
11284         *)      ptr_lval=$d_stdio_ptr_lval;;
11285         esac
11286         case "$stdio_cnt" in
11287         '') stdio_cnt='((fp)->_cnt)'
11288                 cnt_lval=$define
11289                 ;;
11290         *)      cnt_lval=$d_stdio_cnt_lval;;
11291         esac
11292         case "$stdio_base" in
11293         '') stdio_base='((fp)->_base)';;
11294         esac
11295         case "$stdio_bufsiz" in
11296         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11297         esac
11298 fi
11299 : test whether _ptr and _cnt really work
11300 echo "Checking how std your stdio is..." >&4
11301 $cat >try.c <<EOP
11302 #include <stdio.h>
11303 #define FILE_ptr(fp)    $stdio_ptr
11304 #define FILE_cnt(fp)    $stdio_cnt
11305 int main() {
11306         FILE *fp = fopen("try.c", "r");
11307         char c = getc(fp);
11308         if (
11309                 18 <= FILE_cnt(fp) &&
11310                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11311         )
11312                 exit(0);
11313         exit(1);
11314 }
11315 EOP
11316 val="$undef"
11317 set try
11318 if eval $compile; then
11319         if ./try; then
11320                 echo "Your stdio acts pretty std."
11321                 val="$define"
11322         else
11323                 echo "Your stdio isn't very std."
11324         fi
11325 else
11326         echo "Your stdio doesn't appear very std."
11327 fi
11328 $rm -f try.c try
11329 set d_stdstdio
11330 eval $setvar
11331
11332 : Can _ptr be used as an lvalue?
11333 case "$d_stdstdio$ptr_lval" in
11334 $define$define) val=$define ;;
11335 *) val=$undef ;;
11336 esac
11337 set d_stdio_ptr_lval
11338 eval $setvar
11339
11340 : Can _cnt be used as an lvalue?
11341 case "$d_stdstdio$cnt_lval" in
11342 $define$define) val=$define ;;
11343 *) val=$undef ;;
11344 esac
11345 set d_stdio_cnt_lval
11346 eval $setvar
11347
11348 : see if _base is also standard
11349 val="$undef"
11350 case "$d_stdstdio" in
11351 $define)
11352         $cat >try.c <<EOP
11353 #include <stdio.h>
11354 #define FILE_base(fp)   $stdio_base
11355 #define FILE_bufsiz(fp) $stdio_bufsiz
11356 int main() {
11357         FILE *fp = fopen("try.c", "r");
11358         char c = getc(fp);
11359         if (
11360                 19 <= FILE_bufsiz(fp) &&
11361                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11362         )
11363                 exit(0);
11364         exit(1);
11365 }
11366 EOP
11367         set try
11368         if eval $compile; then
11369                 if ./try; then
11370                         echo "And its _base field acts std."
11371                         val="$define"
11372                 else
11373                         echo "But its _base field isn't std."
11374                 fi
11375         else
11376                 echo "However, it seems to be lacking the _base field."
11377         fi
11378         $rm -f try.c try
11379         ;;
11380 esac
11381 set d_stdiobase
11382 eval $setvar
11383
11384 $cat >&4 <<EOM
11385 Checking how to access stdio streams by file descriptor number...
11386 EOM
11387 case "$stdio_stream_array" in
11388 '')     $cat >try.c <<EOCP
11389 #include <stdio.h>
11390 int main() {
11391   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11392     printf("yes\n");
11393 }
11394 EOCP
11395         for s in _iob __iob __sF
11396         do
11397                 set try -DSTDIO_STREAM_ARRAY=$s
11398                 if eval $compile; then
11399                         case "`./try$exe_ext`" in
11400                         yes)    stdio_stream_array=$s; break ;;
11401                         esac
11402                 fi
11403         done
11404         $rm -f try.* try$exe_ext
11405 esac
11406 case "$stdio_stream_array" in
11407 '')     $cat >&4 <<EOM
11408 I can't figure out how to access stdio streams by file descriptor number.
11409 EOM
11410         d_stdio_stream_array="$undef"
11411         ;;
11412 *)      $cat >&4 <<EOM
11413 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11414 EOM
11415         d_stdio_stream_array="$define"
11416         ;;
11417 esac
11418
11419 : see if strcoll exists
11420 set strcoll d_strcoll
11421 eval $inlibc
11422
11423 : check for structure copying
11424 echo " "
11425 echo "Checking to see if your C compiler can copy structs..." >&4
11426 $cat >try.c <<'EOCP'
11427 int main()
11428 {
11429         struct blurfl {
11430                 int dyick;
11431         } foo, bar;
11432
11433         foo = bar;
11434 }
11435 EOCP
11436 if $cc -c try.c >/dev/null 2>&1 ; then
11437         val="$define"
11438         echo "Yup, it can."
11439 else
11440         val="$undef"
11441         echo "Nope, it can't."
11442 fi
11443 set d_strctcpy
11444 eval $setvar
11445 $rm -f try.*
11446
11447 : see if strerror and/or sys_errlist[] exist
11448 echo " "
11449 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11450     if set strerror val -f d_strerror; eval $csym; $val; then
11451                 echo 'strerror() found.' >&4
11452                 d_strerror="$define"
11453                 d_strerrm='strerror(e)'
11454                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11455                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11456                         d_syserrlst="$define"
11457                 else
11458                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11459                         d_syserrlst="$undef"
11460                 fi
11461     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11462                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11463                 echo 'strerror() found in string header.' >&4
11464                 d_strerror="$define"
11465                 d_strerrm='strerror(e)'
11466                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11467                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11468                                 d_syserrlst="$define"
11469                 else
11470                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11471                         d_syserrlst="$undef"
11472                 fi
11473     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11474                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11475                 d_strerror="$undef"
11476                 d_syserrlst="$define"
11477                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11478     else
11479                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11480                 d_strerror="$undef"
11481                 d_syserrlst="$undef"
11482                 d_strerrm='"unknown"'
11483     fi
11484 fi
11485
11486 : see if strtod exists
11487 set strtod d_strtod
11488 eval $inlibc
11489
11490 : see if strtol exists
11491 set strtol d_strtol
11492 eval $inlibc
11493
11494 : see if strtold exists
11495 set strtold d_strtold
11496 eval $inlibc
11497
11498 : see if strtoll exists
11499 set strtoll d_strtoll
11500 eval $inlibc
11501
11502 case "$d_longlong-$d_strtoll" in
11503 "$define-$define")
11504         $cat <<EOM
11505 Checking whether your strtoll() works okay...
11506 EOM
11507         $cat >try.c <<'EOCP'
11508 #include <errno.h>
11509 #ifdef __hpux
11510 #define strtoll __strtoll
11511 #endif
11512 #include <stdio.h>
11513 extern long long int strtoll(char *s, char **, int); 
11514 static int bad = 0;
11515 int check(char *s, long long ell, int een) {
11516         long long gll;
11517         errno = 0;
11518         gll = strtoll(s, 0, 10);
11519         if (!((gll == ell) && (errno == een)))
11520                 bad++;
11521 }
11522 int main() {
11523         check(" 1",                                      1LL, 0);
11524         check(" 0",                                      0LL, 0);
11525         check("-1",                                     -1LL, 0);
11526         check("-9223372036854775808", -9223372036854775808LL, 0);
11527         check("-9223372036854775808", -9223372036854775808LL, 0);
11528         check(" 9223372036854775807",  9223372036854775807LL, 0);
11529         check("-9223372036854775808", -9223372036854775808LL, 0);
11530         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11531         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11532         if (!bad)
11533                 printf("ok\n");
11534 }
11535 EOCP
11536         set try
11537         if eval $compile; then
11538                 case "`./try`" in
11539                 ok) echo "Your strtoll() seems to be working okay." ;;
11540                 *) cat <<EOM >&4
11541 Your strtoll() doesn't seem to be working okay.
11542 EOM
11543                    d_strtoll="$undef"
11544                    ;;
11545                 esac
11546         fi
11547         ;;
11548 esac
11549
11550 : see if strtoul exists
11551 set strtoul d_strtoul
11552 eval $inlibc
11553
11554 : see if strtoull exists
11555 set strtoull d_strtoull
11556 eval $inlibc
11557
11558 case "$d_longlong-$d_strtoull" in
11559 "$define-$define")
11560         $cat <<EOM
11561 Checking whether your strtoull() works okay...
11562 EOM
11563         $cat >try.c <<'EOCP'
11564 #include <errno.h>
11565 #ifdef __hpux
11566 #define strtoull __strtoull
11567 #endif
11568 #include <stdio.h>
11569 extern unsigned long long int strtoull(char *s, char **, int); 
11570 static int bad = 0;
11571 int check(char *s, long long eull, int een) {
11572         long long gull;
11573         errno = 0;
11574         gull = strtoull(s, 0, 10);
11575         if (!((gull == eull) && (errno == een)))
11576                 bad++;
11577 }
11578 int main() {
11579         check(" 1",                                       1LL, 0);
11580         check(" 0",                                       0LL, 0);
11581         check("18446744073709551615", 18446744073709551615ULL, 0);
11582         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11583         if (!bad)
11584                 printf("ok\n");
11585 }
11586 EOCP
11587         set try
11588         if eval $compile; then
11589                 case "`./try`" in
11590                 ok) echo "Your strtoull() seems to be working okay." ;;
11591                 *) cat <<EOM >&4
11592 Your strtoull() doesn't seem to be working okay.
11593 EOM
11594                    d_strtoull="$undef"
11595                    ;;
11596                 esac
11597         fi
11598         ;;
11599 esac
11600
11601 : see if strtouq exists
11602 set strtouq d_strtouq
11603 eval $inlibc
11604
11605 : see if strxfrm exists
11606 set strxfrm d_strxfrm
11607 eval $inlibc
11608
11609 : see if symlink exists
11610 set symlink d_symlink
11611 eval $inlibc
11612
11613 : see if syscall exists
11614 set syscall d_syscall
11615 eval $inlibc
11616
11617 : see if sysconf exists
11618 set sysconf d_sysconf
11619 eval $inlibc
11620
11621 : see if system exists
11622 set system d_system
11623 eval $inlibc
11624
11625 : see if tcgetpgrp exists
11626 set tcgetpgrp d_tcgetpgrp
11627 eval $inlibc
11628
11629 : see if tcsetpgrp exists
11630 set tcsetpgrp d_tcsetpgrp
11631 eval $inlibc
11632
11633 : see if prototype for telldir is available
11634 echo " "
11635 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11636 eval $hasproto
11637
11638 : see if this is a sys/times.h system
11639 set sys/times.h i_systimes
11640 eval $inhdr
11641
11642 : see if times exists
11643 echo " "
11644 if set times val -f d_times; eval $csym; $val; then
11645         echo 'times() found.' >&4
11646         d_times="$define"
11647         inc=''
11648         case "$i_systimes" in
11649         "$define") inc='sys/times.h';;
11650         esac
11651         rp="What is the type returned by times() on this system?"
11652         set clock_t clocktype long stdio.h sys/types.h $inc
11653         eval $typedef_ask
11654 else
11655         echo 'times() NOT found, hope that will do.' >&4
11656         d_times="$undef"
11657         clocktype='int'
11658 fi
11659
11660 : see if truncate exists
11661 set truncate d_truncate
11662 eval $inlibc
11663
11664 : see if tzname[] exists
11665 echo " "
11666 if set tzname val -a d_tzname; eval $csym; $val; then
11667         val="$define"
11668         echo 'tzname[] found.' >&4
11669 else
11670         val="$undef"
11671         echo 'tzname[] NOT found.' >&4
11672 fi
11673 set d_tzname
11674 eval $setvar
11675
11676 : see if umask exists
11677 set umask d_umask
11678 eval $inlibc
11679
11680 : see if ustat exists
11681 set ustat d_ustat
11682 eval $inlibc
11683
11684 : backward compatibility for d_hvfork
11685 if test X$d_hvfork != X; then
11686         d_vfork="$d_hvfork"
11687         d_hvfork=''
11688 fi
11689 : see if there is a vfork
11690 val=''
11691 set vfork val
11692 eval $inlibc
11693
11694 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11695 : perl on Solaris 2.x, and probably elsewhere.
11696 case "$val" in
11697 $define)
11698         echo " "
11699         case "$usevfork" in
11700         false) dflt='n';;
11701         *) dflt='y';;
11702         esac
11703         cat <<'EOM'
11704  
11705 Perl can only use a vfork() that doesn't suffer from strict
11706 restrictions on calling functions or modifying global data in
11707 the child.  For example, glibc-2.1 contains such a vfork()
11708 that is unsuitable.  If your system provides a proper fork()
11709 call, chances are that you do NOT want perl to use vfork().
11710
11711 EOM
11712         rp="Do you still want to use vfork()?"
11713         . ./myread
11714         case "$ans" in
11715         y|Y) ;;
11716         *)
11717                 echo "Ok, we won't use vfork()."
11718                 val="$undef"
11719                 ;;
11720         esac
11721         ;;
11722 esac
11723 set d_vfork
11724 eval $setvar
11725 case "$d_vfork" in
11726 $define) usevfork='true';;
11727 *) usevfork='false';;
11728 esac
11729
11730 : see if this is an sysdir system
11731 set sys/dir.h i_sysdir
11732 eval $inhdr
11733
11734 : see if this is an sysndir system
11735 set sys/ndir.h i_sysndir
11736 eval $inhdr
11737
11738 : see if closedir exists
11739 set closedir d_closedir
11740 eval $inlibc
11741
11742 case "$d_closedir" in
11743 "$define")
11744         echo " "
11745         echo "Checking whether closedir() returns a status..." >&4
11746         cat > closedir.c <<EOM
11747 #$i_dirent I_DIRENT             /**/
11748 #$i_sysdir I_SYS_DIR            /**/
11749 #$i_sysndir I_SYS_NDIR          /**/
11750 #$i_systypes I_SYS_TYPES        /**/
11751
11752 #if defined(I_SYS_TYPES)
11753 #include <sys/types.h>
11754 #endif
11755 #if defined(I_DIRENT)
11756 #include <dirent.h>
11757 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11758 #include <sys/dir.h>
11759 #endif
11760 #else
11761 #ifdef I_SYS_NDIR
11762 #include <sys/ndir.h>
11763 #else
11764 #ifdef I_SYS_DIR
11765 #ifdef hp9000s500
11766 #include <ndir.h>       /* may be wrong in the future */
11767 #else
11768 #include <sys/dir.h>
11769 #endif
11770 #endif
11771 #endif
11772 #endif 
11773 int main() { return closedir(opendir(".")); }
11774 EOM
11775         set closedir
11776         if eval $compile_ok; then
11777                 if ./closedir > /dev/null 2>&1 ; then
11778                         echo "Yes, it does."
11779                         val="$undef"
11780                 else
11781                         echo "No, it doesn't."
11782                         val="$define"
11783                 fi
11784         else
11785                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11786                 val="$define"
11787         fi
11788         ;;
11789 *)
11790         val="$undef";
11791         ;;
11792 esac
11793 set d_void_closedir
11794 eval $setvar
11795 $rm -f closedir*
11796 : check for volatile keyword
11797 echo " "
11798 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11799 $cat >try.c <<'EOCP'
11800 int main()
11801 {
11802         typedef struct _goo_struct goo_struct;
11803         goo_struct * volatile goo = ((goo_struct *)0);
11804         struct _goo_struct {
11805                 long long_int;
11806                 int reg_int;
11807                 char char_var;
11808         };
11809         typedef unsigned short foo_t;
11810         char *volatile foo;
11811         volatile int bar;
11812         volatile foo_t blech;
11813         foo = foo;
11814 }
11815 EOCP
11816 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11817         val="$define"
11818         echo "Yup, it does."
11819 else
11820         val="$undef"
11821         echo "Nope, it doesn't."
11822 fi
11823 set d_volatile
11824 eval $setvar
11825 $rm -f try.*
11826
11827 : see if there is a wait4
11828 set wait4 d_wait4
11829 eval $inlibc
11830
11831 : see if waitpid exists
11832 set waitpid d_waitpid
11833 eval $inlibc
11834
11835 : see if wcstombs exists
11836 set wcstombs d_wcstombs
11837 eval $inlibc
11838
11839 : see if wctomb exists
11840 set wctomb d_wctomb
11841 eval $inlibc
11842
11843 : preserve RCS keywords in files with variable substitution, grrr
11844 Date='$Date'
11845 Id='$Id'
11846 Log='$Log'
11847 RCSfile='$RCSfile'
11848 Revision='$Revision'
11849
11850 case "$crosscompile" in
11851 ''|[nN]*) crosscompile="$undef" ;;
11852 esac
11853
11854 case "$osname" in
11855 next|rhapsody|darwin) multiarch="$define" ;;
11856 esac
11857 case "$multiarch" in
11858 ''|[nN]*) multiarch="$undef" ;;
11859 esac
11860
11861 : check for alignment requirements
11862 echo " "
11863 case "$crosscompile$multiarch" in
11864 *$define*)
11865         $cat <<EOM
11866 You seem to be either cross-compiling or doing a multiarchitecture build,
11867 skipping the memory alignment check.
11868
11869 EOM
11870         case "$alignbytes" in
11871         '') alignbytes=8 ;;
11872         esac
11873         ;;
11874 *)
11875         case "$alignbytes" in
11876         '') echo "Checking alignment constraints..." >&4
11877                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11878                         $cat >try.c <<'EOCP'
11879 typedef long double NV;
11880 EOCP
11881                 else
11882                         $cat >try.c <<'EOCP'
11883 typedef double NV;
11884 EOCP
11885                 fi
11886                 $cat >>try.c <<'EOCP'
11887 #include <stdio.h>
11888 struct foobar {
11889         char foo;
11890         NV bar;
11891 } try_algn;
11892 int main()
11893 {
11894     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11895     return(0);
11896 }
11897 EOCP
11898                 set try
11899                 if eval $compile_ok; then
11900                         dflt=`./try`
11901                 else
11902                         dflt='8'
11903                         echo "(I can't seem to compile the test program...)"
11904                 fi
11905                 ;;
11906         *) dflt="$alignbytes"
11907                 ;;
11908         esac
11909         rp="Doubles must be aligned on a how-many-byte boundary?"
11910         . ./myread
11911         alignbytes="$ans"
11912         $rm -f try.c try
11913         ;;
11914 esac
11915
11916
11917 : set the base revision
11918 baserev=5.0
11919
11920 : check for ordering of bytes in a long
11921 echo " "
11922 case "$crosscompile$multiarch" in
11923 *$define*)
11924         $cat <<EOM
11925 You seem to be either cross-compiling or doing a multiarchitecture build,
11926 skipping the byteorder check.
11927
11928 EOM
11929         byteorder='0xffff'
11930         ;;
11931 *)
11932         case "$byteorder" in
11933         '')
11934                 $cat <<'EOM'
11935 In the following, larger digits indicate more significance.  A big-endian
11936 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11937 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11938 machines may have weird orders like 3412.  A Cray will report 87654321,
11939 an Alpha will report 12345678. If the test program works the default is
11940 probably right.
11941 I'm now running the test program...
11942 EOM
11943                 $cat >try.c <<'EOCP'
11944 #include <stdio.h>
11945 int main()
11946 {
11947         int i;
11948         union {
11949                 unsigned long l;
11950                 char c[sizeof(long)];
11951         } u;
11952
11953         if (sizeof(long) > 4)
11954                 u.l = (0x08070605L << 32) | 0x04030201L;
11955         else
11956                 u.l = 0x04030201L;
11957         for (i = 0; i < sizeof(long); i++)
11958                 printf("%c", u.c[i]+'0');
11959         printf("\n");
11960         exit(0);
11961 }
11962 EOCP
11963                 xxx_prompt=y
11964                 set try
11965                 if eval $compile && ./try > /dev/null; then
11966                         dflt=`./try`
11967                         case "$dflt" in
11968                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11969                                 echo "(The test program ran ok.)"
11970                                 echo "byteorder=$dflt"
11971                                 xxx_prompt=n
11972                         ;;
11973                         ????|????????) echo "(The test program ran ok.)" ;;
11974                         *) echo "(The test program didn't run right for some reason.)" ;;
11975                         esac
11976                 else
11977                         dflt='4321'
11978                         cat <<'EOM'
11979 (I can't seem to compile the test program.  Guessing big-endian...)
11980 EOM
11981                 fi
11982                 case "$xxx_prompt" in
11983                 y)
11984                         rp="What is the order of bytes in a long?"
11985                         . ./myread
11986                         byteorder="$ans"
11987                         ;;
11988                 *)      byteorder=$dflt
11989                         ;;
11990                 esac
11991                 ;;
11992         esac
11993         $rm -f try.c try
11994         ;;
11995 esac
11996
11997
11998 : how do we catenate cpp tokens here?
11999 echo " "
12000 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12001 $cat >cpp_stuff.c <<'EOCP'
12002 #define RCAT(a,b)a/**/b
12003 #define ACAT(a,b)a ## b
12004 RCAT(Rei,ser)
12005 ACAT(Cir,cus)
12006 EOCP
12007 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12008 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12009         echo "Oh!  Smells like ANSI's been here." >&4
12010         echo "We can catify or stringify, separately or together!"
12011         cpp_stuff=42
12012 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12013         echo "Ah, yes!  The good old days!" >&4
12014         echo "However, in the good old days we don't know how to stringify and"
12015         echo "catify at the same time."
12016         cpp_stuff=1
12017 else
12018         $cat >&4 <<EOM
12019 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12020 to have to edit the values of CAT[2-5] in config.h...
12021 EOM
12022         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12023 fi
12024 $rm -f cpp_stuff.*
12025
12026 : see if this is a db.h system
12027 set db.h i_db
12028 eval $inhdr
12029
12030 case "$i_db" in
12031 $define)
12032         : Check db version.
12033         echo " "
12034         echo "Checking Berkeley DB version ..." >&4
12035         $cat >try.c <<EOCP
12036 #$d_const HASCONST
12037 #ifndef HASCONST
12038 #define const
12039 #endif
12040 #include <sys/types.h>
12041 #include <stdio.h>
12042 #include <db.h>
12043 int main()
12044 {
12045 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12046     int Major, Minor, Patch ;
12047     unsigned long Version ;
12048     (void)db_version(&Major, &Minor, &Patch) ;
12049     printf("You have Berkeley DB Version 2 or greater\n");
12050
12051     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12052                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12053     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12054                 Major, Minor, Patch) ;
12055
12056     /* check that db.h & libdb are compatible */
12057     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12058         printf("db.h and libdb are incompatible\n") ;
12059         exit(3);        
12060     }
12061
12062     printf("db.h and libdb are compatible\n") ;
12063
12064     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12065                 + DB_VERSION_PATCH ;
12066
12067     /* needs to be >= 2.3.4 */
12068     if (Version < 2003004) {
12069     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12070         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12071         exit(2);        
12072     }
12073
12074     exit(0);
12075 #else
12076 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12077     printf("You have Berkeley DB Version 1\n");
12078     exit(0);    /* DB version < 2: the coast is clear. */
12079 #else
12080     exit(1);    /* <db.h> not Berkeley DB? */
12081 #endif
12082 #endif
12083 }
12084 EOCP
12085         set try
12086         if eval $compile_ok && ./try; then
12087                 echo 'Looks OK.' >&4
12088         else
12089                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12090                 i_db=$undef
12091                 case " $libs " in
12092                 *"-ldb "*)
12093                         : Remove db from list of libraries to use
12094                         echo "Removing unusable -ldb from library list" >&4
12095                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12096                         shift
12097                         libs="$*"
12098                         echo "libs = $libs" >&4
12099                         ;;
12100                 esac
12101         fi
12102         $rm -f try.*
12103         ;;
12104 esac
12105
12106 case "$i_db" in
12107 define)
12108         : Check the return type needed for hash 
12109         echo " "
12110         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12111         $cat >try.c <<EOCP
12112 #$d_const HASCONST
12113 #ifndef HASCONST
12114 #define const
12115 #endif
12116 #include <sys/types.h>
12117 #include <db.h>
12118
12119 #ifndef DB_VERSION_MAJOR
12120 u_int32_t hash_cb (ptr, size)
12121 const void *ptr;
12122 size_t size;
12123 {
12124 }
12125 HASHINFO info;
12126 int main()
12127 {
12128         info.hash = hash_cb;
12129 }
12130 #endif
12131 EOCP
12132         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12133                 if $contains warning try.out >>/dev/null 2>&1 ; then
12134                         db_hashtype='int'
12135                 else
12136                         db_hashtype='u_int32_t'
12137                 fi
12138         else
12139                 : XXX Maybe we should just give up here.
12140                 db_hashtype=u_int32_t
12141                 $cat try.out >&4
12142                 echo "Help:  I can't seem to compile the db test program." >&4
12143                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12144         fi
12145         $rm -f try.*
12146         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12147         ;;
12148 *)      db_hashtype=u_int32_t
12149         ;;
12150 esac
12151 case "$i_db" in
12152 define)
12153         : Check the return type needed for prefix 
12154         echo " "
12155         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12156         cat >try.c <<EOCP
12157 #$d_const HASCONST
12158 #ifndef HASCONST
12159 #define const
12160 #endif
12161 #include <sys/types.h>
12162 #include <db.h>
12163
12164 #ifndef DB_VERSION_MAJOR
12165 size_t prefix_cb (key1, key2)
12166 const DBT *key1;
12167 const DBT *key2;
12168 {
12169 }
12170 BTREEINFO info;
12171 int main()
12172 {
12173         info.prefix = prefix_cb;
12174 }
12175 #endif
12176 EOCP
12177         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12178                 if $contains warning try.out >>/dev/null 2>&1 ; then
12179                         db_prefixtype='int'
12180                 else
12181                         db_prefixtype='size_t'
12182                 fi
12183         else
12184                 db_prefixtype='size_t'
12185                 : XXX Maybe we should just give up here.
12186                 $cat try.out >&4
12187                 echo "Help:  I can't seem to compile the db test program." >&4
12188                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12189         fi
12190         $rm -f try.*
12191         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12192         ;;
12193 *)      db_prefixtype='size_t'
12194         ;;
12195 esac
12196
12197 : check for void type
12198 echo " "
12199 echo "Checking to see how well your C compiler groks the void type..." >&4
12200 case "$voidflags" in
12201 '')
12202         $cat >try.c <<'EOCP'
12203 #if TRY & 1
12204 void sub() {
12205 #else
12206 sub() {
12207 #endif
12208         extern void moo();      /* function returning void */
12209         void (*goo)();          /* ptr to func returning void */
12210 #if TRY & 8
12211         void *hue;              /* generic ptr */
12212 #endif
12213 #if TRY & 2
12214         void (*foo[10])();
12215 #endif
12216
12217 #if TRY & 4
12218         if(goo == moo) {
12219                 exit(0);
12220         }
12221 #endif
12222         exit(0);
12223 }
12224 int main() { sub(); }
12225 EOCP
12226         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12227                 voidflags=$defvoidused
12228         echo "Good.  It appears to support void to the level $package wants.">&4
12229                 if $contains warning .out >/dev/null 2>&1; then
12230                         echo "However, you might get some warnings that look like this:"
12231                         $cat .out
12232                 fi
12233         else
12234 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12235                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12236                         echo "It supports 1..."
12237                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12238                                 echo "It also supports 2..."
12239                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12240                                         voidflags=7
12241                                         echo "And it supports 4 but not 8 definitely."
12242                                 else
12243                                         echo "It doesn't support 4..."
12244                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12245                                                 voidflags=11
12246                                                 echo "But it supports 8."
12247                                         else
12248                                                 voidflags=3
12249                                                 echo "Neither does it support 8."
12250                                         fi
12251                                 fi
12252                         else
12253                                 echo "It does not support 2..."
12254                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12255                                         voidflags=13
12256                                         echo "But it supports 4 and 8."
12257                                 else
12258                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12259                                                 voidflags=5
12260                                                 echo "And it supports 4 but has not heard about 8."
12261                                         else
12262                                                 echo "However it supports 8 but not 4."
12263                                         fi
12264                                 fi
12265                         fi
12266                 else
12267                         echo "There is no support at all for void."
12268                         voidflags=0
12269                 fi
12270         fi
12271 esac
12272 case "$voidflags" in
12273 "$defvoidused") ;;
12274 *)      $cat >&4 <<'EOM'
12275   Support flag bits are:
12276     1: basic void declarations.
12277     2: arrays of pointers to functions returning void.
12278     4: operations between pointers to and addresses of void functions.
12279     8: generic void pointers.
12280 EOM
12281         dflt="$voidflags";
12282         rp="Your void support flags add up to what?"
12283         . ./myread
12284         voidflags="$ans"
12285         ;;
12286 esac
12287 $rm -f try.* .out
12288
12289
12290 : How can we generate normalized random numbers ?
12291 echo " "
12292 echo "Looking for a random number function..." >&4
12293 case "$randfunc" in
12294 '')
12295         if set drand48 val -f; eval $csym; $val; then
12296                 dflt="drand48"
12297                 echo "Good, found drand48()." >&4
12298         elif set random val -f; eval $csym; $val; then
12299                 dflt="random"
12300                 echo "OK, found random()." >&4
12301         else
12302                 dflt="rand"
12303                 echo "Yick, looks like I have to use rand()." >&4
12304         fi
12305         echo " "
12306         ;;
12307 *)
12308         dflt="$randfunc"
12309         ;;
12310 esac
12311 cont=true
12312
12313 case "$ccflags" in
12314 *-Dmy_rand=*|*-Dmy_srand=*)
12315         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12316         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12317         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12318         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12319         ;;
12320 esac
12321
12322 while $test "$cont"; do
12323         rp="Use which function to generate random numbers?"
12324         . ./myread
12325         if $test "$ans" = "$dflt"; then
12326                 : null
12327         else
12328                 randbits=''
12329         fi
12330         randfunc="$ans"
12331         if set $ans val -f; eval $csym; $val; then
12332                 cont=''
12333         else
12334                 dflt=y
12335                 rp="I cannot find function $ans. Use that name anyway?"
12336                 . ./myread
12337                 dflt=rand
12338                 case "$ans" in
12339                         [yY]*) cont='';;
12340                 esac
12341         fi
12342         case "$cont" in
12343         '')
12344                 case "$randfunc" in
12345                 drand48)
12346                         drand01="drand48()"
12347                         seedfunc="srand48"
12348                         randbits=48
12349                         randseedtype=long
12350                         ;;
12351                 rand|random)
12352                         case "$randbits" in
12353                         '')
12354 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12355                                 $cat >try.c <<EOCP
12356 #$i_unistd I_UNISTD
12357 #$i_stdlib I_STDLIB
12358 #include <stdio.h>
12359 #ifdef I_UNISTD
12360 #  include <unistd.h>
12361 #endif
12362 #ifdef I_STDLIB
12363 #  include <stdlib.h>
12364 #endif
12365 int main()
12366 {
12367         register int i;
12368         register unsigned long tmp;
12369         register unsigned long max = 0L;
12370
12371         for (i = 1000; i; i--) {
12372                 tmp = (unsigned long) $randfunc();
12373                 if (tmp > max) max = tmp;
12374         }
12375         for (i = 0; max; i++)
12376                 max /= 2;
12377         printf("%d\n",i);
12378 }
12379 EOCP
12380                                 set try
12381                                 if eval $compile_ok; then
12382                                         dflt=`try`
12383                                 else
12384                                         dflt='?'
12385                                         echo "(I can't seem to compile the test program...)"
12386                                 fi
12387                                 ;;
12388                         *)
12389                                 dflt="$randbits"
12390                                 ;;
12391                         esac
12392                         rp="How many bits does your $randfunc() function produce?"
12393                         . ./myread
12394                         randbits="$ans"
12395                         $rm -f try.c try
12396                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12397                         seedfunc="s$randfunc"
12398                         randseedtype=unsigned
12399                         ;;
12400                 *)
12401                         dflt="31"
12402                         rp="How many bits does your $randfunc() function produce?"
12403                         . ./myread
12404                         randbits="$ans"
12405                         seedfunc="s$randfunc"
12406                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12407                         if set $seedfunc val -f; eval $csym; $val; then
12408                                 echo "(Using $seedfunc() to seed random generator)"
12409                         else
12410                                 echo "(Warning: no $seedfunc() to seed random generator)"
12411                                 seedfunc=rand
12412                         fi
12413                         randseedtype=unsigned
12414                         ;;
12415                 esac
12416                 ;;
12417         esac
12418 done
12419
12420 echo " "
12421 echo "Determining whether or not we are on an EBCDIC system..." >&4
12422 $cat >tebcdic.c <<'EOM'
12423 int main()
12424 {
12425   if ('M'==0xd4) return 0;
12426   return 1;
12427 }
12428 EOM
12429
12430 val=$undef
12431 set tebcdic
12432 if eval $compile_ok; then
12433         if ./tebcdic; then
12434                 echo "You have EBCDIC." >&4
12435                 val="$define"
12436         else
12437                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12438         fi
12439 else
12440         echo "I'm unable to compile the test program." >&4
12441         echo "I'll assume ASCII or some ISO Latin." >&4
12442 fi
12443 $rm -f tebcdic.c tebcdic
12444 set ebcdic
12445 eval $setvar
12446
12447 echo " "
12448 $cat >&4 <<EOM
12449 Checking how to flush all pending stdio output...
12450 EOM
12451 # I only know how to find the first 32 possibly open files on SunOS.
12452 # See also hints/sunos_4_1.sh and util.c  --AD
12453 case "$osname" in
12454 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12455 esac
12456 $cat >>try.c <<EOCP
12457 #include <stdio.h>
12458 #$i_unistd I_UNISTD
12459 #ifdef I_UNISTD
12460 # include <unistd.h>
12461 #endif
12462 #$d_sysconf HAS_SYSCONF
12463 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12464 #ifdef HAS_STDIO_STREAM_ARRAY
12465 # define STDIO_STREAM_ARRAY $stdio_stream_array
12466 #endif
12467 int main() {
12468   FILE* p = fopen("try.out", "w");
12469 #ifdef TRY_FPUTC
12470   fputc('x', p);
12471 #else
12472 # ifdef TRY_FPRINTF
12473   fprintf(p, "x");
12474 # endif
12475 #endif
12476 #ifdef TRY_FFLUSH_NULL
12477   fflush(NULL);
12478 #endif
12479 #ifdef TRY_FFLUSH_ALL
12480   {
12481     long open_max = -1;
12482 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12483     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12484 # else
12485 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12486     open_max = sysconf(_SC_OPEN_MAX);
12487 #  else
12488 #   ifdef FOPEN_MAX
12489     open_max = FOPEN_MAX;
12490 #   else
12491 #    ifdef OPEN_MAX
12492     open_max = OPEN_MAX;
12493 #    else
12494 #     ifdef _NFILE
12495     open_max = _NFILE;
12496 #     endif
12497 #    endif
12498 #   endif
12499 #  endif
12500 # endif 
12501 # ifdef HAS_STDIO_STREAM_ARRAY
12502     if (open_max > 0) {
12503       long i;
12504       for (i = 0; i < open_max; i++)
12505             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12506                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12507                 STDIO_STREAM_ARRAY[i]._flag)
12508                 fflush(&STDIO_STREAM_ARRAY[i]);
12509     }   
12510   }
12511 # endif
12512 #endif
12513   _exit(42);
12514 }
12515 EOCP
12516 : first we have to find out how _not_ to flush
12517 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12518     output=''
12519     set try -DTRY_FPUTC
12520     if eval $compile; then
12521             $rm -f try.out
12522             ./try$exe_ext 2>/dev/null
12523             if $test ! -s try.out -a "X$?" = X42; then
12524                 output=-DTRY_FPUTC
12525             fi
12526     fi
12527     case "$output" in
12528     '')
12529             set try -DTRY_FPRINTF
12530             $rm -f try.out
12531             if eval $compile; then
12532                     $rm -f try.out
12533                     ./try$exe_ext 2>/dev/null
12534                     if $test ! -s try.out -a "X$?" = X42; then
12535                         output=-DTRY_FPRINTF
12536                     fi
12537             fi
12538         ;;
12539     esac
12540 fi
12541 : check for fflush NULL behaviour
12542 case "$fflushNULL" in
12543 '')     set try -DTRY_FFLUSH_NULL $output
12544         if eval $compile; then
12545                 $rm -f try.out
12546                 ./try$exe_ext 2>/dev/null
12547                 code="$?"
12548                 if $test -s try.out -a "X$code" = X42; then
12549                         fflushNULL="`$cat try.out`"
12550                 else
12551                         if $test "X$code" != X42; then
12552                                 $cat >&4 <<EOM
12553 (If this test failed, don't worry, we'll try another method shortly.)
12554 EOM
12555                         fi
12556                 fi
12557         fi
12558         $rm -f core try.core core.try.*
12559         case "$fflushNULL" in
12560         x)      $cat >&4 <<EOM
12561 Your fflush(NULL) works okay for output streams.
12562 Let's see if it clobbers input pipes...
12563 EOM
12564 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12565 # bug that improperly flushes the input end of pipes.  So we avoid the
12566 # autoflush on fork/system/exec support for now. :-(
12567 $cat >tryp.c <<EOCP
12568 #include <stdio.h>
12569 int
12570 main(int argc, char **argv)
12571 {
12572     char buf[1024];
12573     int i;
12574     char *bp = buf;
12575     while (1) {
12576         while ((i = getc(stdin)) != -1
12577                && (*bp++ = i) != '\n'
12578                && bp < &buf[1024])
12579         /* DO NOTHING */ ;
12580         *bp = '\0';
12581         fprintf(stdout, "%s", buf);
12582         fflush(NULL);
12583         if (i == -1)
12584             return 0;
12585         bp = buf;
12586     }
12587 }
12588 EOCP
12589                 fflushNULL="$define"
12590                 set tryp
12591                 if eval $compile; then
12592                     $rm -f tryp.out
12593                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12594                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12595                        $cat >&4 <<EOM
12596 fflush(NULL) seems to behave okay with input streams.
12597 EOM
12598                         fflushNULL="$define"
12599                     else
12600                         $cat >&4 <<EOM
12601 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12602 EOM
12603                         fflushNULL="$undef"
12604                     fi
12605                 fi
12606                 $rm -f core tryp.c tryp.core core.tryp.*
12607                 ;;
12608         '')     $cat >&4 <<EOM
12609 Your fflush(NULL) isn't working (contrary to ANSI C).
12610 EOM
12611                 fflushNULL="$undef"
12612                 ;;
12613         *)      $cat >&4 <<EOM
12614 Cannot figure out whether your fflush(NULL) works or not.
12615 I'm assuming it doesn't (contrary to ANSI C).
12616 EOM
12617                 fflushNULL="$undef"
12618                 ;;
12619         esac
12620         ;;
12621 $define|true|[yY]*)
12622         fflushNULL="$define"
12623         ;;
12624 *)
12625         fflushNULL="$undef"
12626         ;;
12627 esac
12628 : check explicit looping only if NULL did not work, and if the pipe
12629 : bug does not show up on an explicit flush too
12630 case "$fflushNULL" in
12631 "$undef")
12632         $cat >tryp.c <<EOCP
12633 #include <stdio.h>
12634 int
12635 main(int argc, char **argv)
12636 {
12637     char buf[1024];
12638     int i;
12639     char *bp = buf;
12640     while (1) {
12641         while ((i = getc(stdin)) != -1
12642                && (*bp++ = i) != '\n'
12643                && bp < &buf[1024])
12644         /* DO NOTHING */ ;
12645         *bp = '\0';
12646         fprintf(stdout, "%s", buf);
12647         fflush(stdin);
12648         if (i == -1)
12649             return 0;
12650         bp = buf;
12651     }
12652 }
12653 EOCP
12654         set tryp
12655         if eval $compile; then
12656             $rm -f tryp.out
12657             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12658             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12659                $cat >&4 <<EOM
12660 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12661 EOM
12662                 : now check for fflushall behaviour
12663                 case "$fflushall" in
12664                 '')     set try -DTRY_FFLUSH_ALL $output
12665                         if eval $compile; then
12666                                 $cat >&4 <<EOM
12667 (Now testing the other method--but note that this also may fail.)
12668 EOM
12669                                 $rm -f try.out
12670                                 ./try$exe_ext 2>/dev/null
12671                                 if $test -s try.out -a "X$?" = X42; then
12672                                         fflushall="`$cat try.out`"
12673                                 fi
12674                         fi
12675                         $rm -f core try.core core.try.*
12676                         case "$fflushall" in
12677                         x)      $cat >&4 <<EOM
12678 Whew. Flushing explicitly all the stdio streams works.
12679 EOM
12680                                 fflushall="$define"
12681                                 ;;
12682                         '')     $cat >&4 <<EOM
12683 Sigh. Flushing explicitly all the stdio streams doesn't work.
12684 EOM
12685                                 fflushall="$undef"
12686                                 ;;
12687                         *)      $cat >&4 <<EOM
12688 Cannot figure out whether flushing stdio streams explicitly works or not.
12689 I'm assuming it doesn't.
12690 EOM
12691                                 fflushall="$undef"
12692                                 ;;
12693                         esac
12694                         ;;
12695                 "$define"|true|[yY]*)
12696                         fflushall="$define"
12697                         ;;
12698                 *)
12699                         fflushall="$undef"
12700                         ;;
12701                 esac
12702             else
12703                 $cat >&4 <<EOM
12704 All is futile.  Even fflush(stdin) clobbers input pipes!
12705 EOM
12706                 fflushall="$undef"
12707             fi
12708         else
12709             fflushall="$undef"
12710         fi
12711         $rm -f core tryp.c tryp.core core.tryp.*
12712         ;;
12713 *)      fflushall="$undef"
12714         ;;
12715 esac
12716
12717 case "$fflushNULL$fflushall" in
12718 undefundef)
12719         $cat <<EOM
12720 OK, I give up.  I cannot figure out how to flush pending stdio output.
12721 We won't be flushing handles at all before fork/exec/popen.
12722 EOM
12723         ;;
12724 esac
12725 $rm -f try.* try$exe_ext
12726
12727 : Store the full pathname to the ar program for use in the C program
12728 : Respect a hint or command line value for full_ar.
12729 case "$full_ar" in
12730 '') full_ar=$ar ;;
12731 esac
12732
12733 : Store the full pathname to the sed program for use in the C program
12734 full_sed=$sed
12735
12736 : see what type gids are declared as in the kernel
12737 echo " "
12738 echo "Looking for the type for group ids returned by getgid()."
12739 set gid_t gidtype xxx stdio.h sys/types.h
12740 eval $typedef
12741 case "$gidtype" in
12742 xxx)
12743         xxx=`./findhdr sys/user.h`
12744         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12745         case $1 in
12746         unsigned) dflt="$1 $2" ;;
12747         *) dflt="$1" ;;
12748         esac
12749         ;;
12750 *) dflt="$gidtype";;
12751 esac
12752 case "$gidtype" in
12753 gid_t) echo "gid_t found." ;;
12754 *)      rp="What is the type for group ids returned by getgid()?"
12755         . ./myread
12756         gidtype="$ans"
12757         ;;
12758 esac
12759
12760 echo " "
12761 case "$gidtype" in
12762 *_t) zzz="$gidtype"     ;;
12763 *)   zzz="gid"          ;;
12764 esac
12765 echo "Checking the size of $zzz..." >&4 
12766 cat > try.c <<EOCP
12767 #include <sys/types.h>
12768 #include <stdio.h>
12769 int main() {
12770     printf("%d\n", (int)sizeof($gidtype));
12771     exit(0);
12772 }
12773 EOCP
12774 set try
12775 if eval $compile_ok; then
12776         yyy=`./try`
12777         case "$yyy" in
12778         '')     gidsize=4
12779                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12780                 ;;
12781         *)      gidsize=$yyy
12782                 echo "Your $zzz is $gidsize bytes long."
12783                 ;;
12784         esac
12785 else
12786         gidsize=4
12787         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12788 fi
12789
12790
12791 echo " "
12792 case "$gidtype" in
12793 *_t) zzz="$gidtype"     ;;
12794 *)   zzz="gid"          ;;
12795 esac
12796 echo "Checking the sign of $zzz..." >&4 
12797 cat > try.c <<EOCP
12798 #include <sys/types.h>
12799 #include <stdio.h>
12800 int main() {
12801         $gidtype foo = -1;
12802         if (foo < 0)
12803                 printf("-1\n");
12804         else
12805                 printf("1\n");
12806 }
12807 EOCP
12808 set try
12809 if eval $compile; then
12810         yyy=`./try`
12811         case "$yyy" in
12812         '')     gidsign=1
12813                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12814                 ;;
12815         *)      gidsign=$yyy
12816                 case "$gidsign" in
12817                  1) echo "Your $zzz is unsigned." ;;
12818                 -1) echo "Your $zzz is signed."   ;;
12819                 esac
12820                 ;;
12821         esac
12822 else
12823         gidsign=1
12824         echo "(I can't compile the test program--guessing unsigned.)" >&4
12825 fi
12826
12827
12828 echo " "
12829
12830 if $test X"$quadtype" != X; then
12831
12832 echo "Checking how to print 64-bit integers..." >&4
12833
12834 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12835         $cat >try.c <<'EOCP'
12836 #include <sys/types.h>
12837 #include <stdio.h>
12838 int main() {
12839   int q = 12345678901;
12840   printf("%ld\n", q);
12841 }
12842 EOCP
12843         set try
12844         if eval $compile; then
12845                 yyy=`./try$exe_ext`
12846                 case "$yyy" in
12847                 12345678901)
12848                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12849                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12850                         echo "We will use %d."
12851                         ;;
12852                 esac
12853         fi
12854 fi
12855
12856 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12857         $cat >try.c <<'EOCP'
12858 #include <sys/types.h>
12859 #include <stdio.h>
12860 int main() {
12861   long q = 12345678901;
12862   printf("%ld\n", q);
12863 }
12864 EOCP
12865         set try
12866         if eval $compile; then
12867                 yyy=`./try$exe_ext`
12868                 case "$yyy" in
12869                 12345678901)
12870                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12871                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12872                         echo "We will use %ld."
12873                         ;;
12874                 esac
12875         fi
12876 fi
12877
12878 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12879         $cat >try.c <<'EOCP'
12880 #include <sys/types.h>
12881 #include <inttypes.h>
12882 #include <stdio.h>
12883 int main() {
12884   int64_t q = 12345678901;
12885   printf("%" PRId64 "\n", q);
12886 }
12887 EOCP
12888         set try
12889         if eval $compile; then
12890                 yyy=`./try$exe_ext`
12891                 case "$yyy" in
12892                 12345678901)
12893                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12894                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12895                         echo "We will use the C9X style."
12896                         ;;
12897                 esac
12898         fi
12899 fi
12900
12901 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12902         $cat >try.c <<'EOCP'
12903 #include <sys/types.h>
12904 #include <stdio.h>
12905 int main() {
12906   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12907   printf("%lld\n", q);
12908 }
12909 EOCP
12910         set try
12911         if eval $compile; then
12912                 yyy=`./try$exe_ext`
12913                 case "$yyy" in
12914                 12345678901)
12915                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12916                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12917                         echo "We will use the %lld style."
12918                         ;;
12919                 esac
12920         fi
12921 fi
12922
12923 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12924         $cat >try.c <<EOCP
12925 #include <sys/types.h>
12926 #include <stdio.h>
12927 int main() {
12928   $quadtype q = 12345678901;
12929   printf("%Ld\n", q);
12930 }
12931 EOCP
12932         set try
12933         if eval $compile; then
12934                 yyy=`./try$exe_ext`
12935                 case "$yyy" in
12936                 12345678901)
12937                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12938                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12939                         echo "We will use %Ld."
12940                         ;;
12941                 esac
12942         fi
12943 fi
12944
12945 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12946         $cat >try.c <<EOCP
12947 #include <sys/types.h>
12948 #include <stdio.h>
12949 int main() {
12950   $quadtype q = 12345678901;
12951   printf("%qd\n", q);
12952 }
12953 EOCP
12954         set try
12955         if eval $compile; then
12956                 yyy=`./try$exe_ext`
12957                 case "$yyy" in
12958                 12345678901)
12959                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12960                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12961                         echo "We will use %qd."
12962                         ;;
12963                 esac
12964         fi
12965 fi
12966
12967 if $test X"$sPRId64" = X; then
12968         echo "Cannot figure out how to print 64-bit integers." >&4
12969 fi
12970
12971 $rm -f try try.*
12972
12973 fi
12974
12975 case "$sPRId64" in
12976 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12977         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12978         ;;
12979 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12980         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12981         ;;
12982 esac
12983
12984
12985 echo " "
12986 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12987
12988 if $test X"$ivsize" = X8; then
12989         ivdformat="$sPRId64"
12990         uvuformat="$sPRIu64"
12991         uvoformat="$sPRIo64"
12992         uvxformat="$sPRIx64"
12993 else
12994         if $test X"$ivsize" = X"$longsize"; then
12995                 ivdformat='"ld"'
12996                 uvuformat='"lu"'
12997                 uvoformat='"lo"'
12998                 uvxformat='"lx"'
12999         else
13000                 if $test X"$ivsize" = X"$intsize"; then
13001                         ivdformat='"d"'
13002                         uvuformat='"u"'
13003                         uvoformat='"o"'
13004                         uvxformat='"x"'
13005                 else
13006                         : far out
13007                         if $test X"$ivsize" = X"$shortsize"; then
13008                                 ivdformat='"hd"'
13009                                 uvuformat='"hu"'
13010                                 uvoformat='"ho"'
13011                                 uvxformat='"hx"'
13012                         fi
13013                 fi
13014         fi
13015 fi
13016
13017 case "$ivdformat" in
13018 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13019     exit 1
13020     ;;
13021 esac
13022
13023
13024 echo " "
13025 $echo "Checking the format string to be used for gids..." >&4
13026
13027 case "$gidsign" in
13028 -1)     if $test X"$gidsize" = X"$ivsize"; then
13029                 gidformat="$ivdformat"
13030         else
13031                 if $test X"$gidsize" = X"$longsize"; then
13032                         gidformat='"ld"'
13033                 else
13034                         if $test X"$gidsize" = X"$intsize"; then
13035                                 gidformat='"d"'
13036                         else
13037                                 if $test X"$gidsize" = X"$shortsize"; then
13038                                         gidformat='"hd"'
13039                                 fi
13040                         fi
13041                 fi
13042         fi
13043         ;;
13044 *)      if $test X"$gidsize" = X"$uvsize"; then
13045                 gidformat="$uvuformat"
13046         else
13047                 if $test X"$gidsize" = X"$longsize"; then
13048                         gidformat='"lu"'
13049                 else
13050                         if $test X"$gidsize" = X"$intsize"; then
13051                                 gidformat='"u"'
13052                         else
13053                                 if $test X"$gidsize" = X"$shortsize"; then
13054                                         gidformat='"hu"'
13055                                 fi
13056                         fi
13057                 fi
13058         fi
13059         ;;
13060 esac
13061
13062 : see if getgroups exists
13063 set getgroups d_getgrps
13064 eval $inlibc
13065
13066 : see if setgroups exists
13067 set setgroups d_setgrps
13068 eval $inlibc
13069
13070
13071 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13072 echo " "
13073 case "$d_getgrps$d_setgrps" in
13074 *define*)
13075         case "$groupstype" in
13076         '') dflt="$gidtype" ;;
13077         *)  dflt="$groupstype" ;;
13078         esac
13079         $cat <<EOM
13080 What type of pointer is the second argument to getgroups() and setgroups()?
13081 Usually this is the same as group ids, $gidtype, but not always.
13082
13083 EOM
13084         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13085         . ./myread
13086         groupstype="$ans"
13087         ;;
13088 *)  groupstype="$gidtype";;
13089 esac
13090
13091 echo " "
13092 echo "Checking if your $make program sets \$(MAKE)..." >&4
13093 case "$make_set_make" in
13094 '')
13095         $sed 's/^X //' > testmake.mak << 'EOF'
13096 Xall:
13097 X       @echo 'maketemp="$(MAKE)"'
13098 EOF
13099         case "`$make -f testmake.mak 2>/dev/null`" in
13100         *maketemp=*) make_set_make='#' ;;
13101         *)      make_set_make="MAKE=$make" ;;
13102         esac
13103         $rm -f testmake.mak
13104         ;;
13105 esac
13106 case "$make_set_make" in
13107 '#') echo "Yup, it does.";;
13108 *) echo "Nope, it doesn't.";;
13109 esac
13110
13111 : see what type is used for mode_t
13112 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13113 set mode_t modetype int stdio.h sys/types.h
13114 eval $typedef_ask
13115
13116 : define a fucntion to check prototypes
13117 $cat > protochk <<EOSH
13118 $startsh
13119 cc="$cc"
13120 optimize="$optimize"
13121 ccflags="$ccflags"
13122 prototype="$prototype"
13123 define="$define"
13124 rm=$rm
13125 EOSH
13126
13127 $cat >> protochk <<'EOSH'
13128
13129 $rm -f try.c
13130 foo="$1"
13131 shift
13132 while test $# -ge 2; do
13133         case "$1" in
13134                 $define) echo "#include <$2>" >> try.c ;;
13135                 literal) echo "$2" >> try.c ;;
13136         esac
13137     shift 2
13138 done
13139 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13140 cat >> try.c <<'EOCP'
13141 #ifdef CAN_PROTOTYPE
13142 #define _(args) args
13143 #else
13144 #define _(args) ()
13145 #endif
13146 EOCP
13147 echo "$foo" >> try.c
13148 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13149 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13150 status=$?
13151 $rm -f try.[co]
13152 exit $status
13153 EOSH
13154 chmod +x protochk
13155 $eunicefix protochk
13156
13157 : see what type is used for size_t
13158 rp="What is the type used for the length parameter for string functions?"
13159 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13160 eval $typedef_ask
13161
13162 : check for type of arguments to gethostbyaddr. 
13163 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13164         case "$d_gethbyaddr" in
13165         $define)
13166                 $cat <<EOM
13167
13168 Checking to see what type of arguments are accepted by gethostbyaddr().
13169 EOM
13170                 hdrs="$define sys/types.h
13171                         $d_socket sys/socket.h 
13172                         $i_niin netinet/in.h 
13173                         $i_netdb netdb.h
13174                         $i_unistd unistd.h"
13175                 : The first arg can 'char *' or 'void *'
13176                 : The second arg is some of integral type
13177                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13178                         for yyy in size_t long int; do
13179                                 case "$netdb_host_type" in
13180                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13181                                         if ./protochk "$try" $hdrs; then
13182                                                 echo "Your system accepts $xxx for the first arg."
13183                                                 echo "...and $yyy for the second arg."
13184                                                 netdb_host_type="$xxx"
13185                                                 netdb_hlen_type="$yyy"
13186                                         fi
13187                                         ;;
13188                                 esac
13189                         done
13190                 done
13191                 : In case none of those worked, prompt the user.
13192                 case "$netdb_host_type" in
13193                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13194                         dflt='char *'
13195                         . ./myread
13196                         netdb_host_type=$ans
13197                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13198                         dflt="$sizetype"
13199                         . ./myread
13200                         netdb_hlen_type=$ans
13201                         ;;
13202                 esac
13203                 ;;
13204         *)      : no gethostbyaddr, so pick harmless defaults
13205                 netdb_host_type='char *'
13206                 netdb_hlen_type="$sizetype"
13207                 ;;
13208         esac
13209         # Remove the "const" if needed. -- but then we'll have a 
13210         # prototype clash!
13211         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13212 fi
13213
13214 : check for type of argument to gethostbyname. 
13215 if test "X$netdb_name_type" = X ; then
13216         case "$d_gethbyname" in
13217         $define)
13218                 $cat <<EOM
13219
13220 Checking to see what type of argument is accepted by gethostbyname().
13221 EOM
13222                 hdrs="$define sys/types.h
13223                         $d_socket sys/socket.h 
13224                         $i_niin netinet/in.h 
13225                         $i_netdb netdb.h
13226                         $i_unistd unistd.h"
13227                 for xxx in "const char *" "char *"; do
13228                         case "$netdb_name_type" in
13229                         '')     try="extern struct hostent *gethostbyname($xxx);"
13230                                 if ./protochk "$try" $hdrs; then
13231                                         echo "Your system accepts $xxx."
13232                                         netdb_name_type="$xxx"
13233                                 fi
13234                                 ;;
13235                         esac
13236                 done
13237                 : In case none of those worked, prompt the user.
13238                 case "$netdb_name_type" in
13239                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13240                         dflt='char *'
13241                         . ./myread
13242                         netdb_name_type=$ans
13243                         ;;
13244                 esac
13245                 ;;
13246         *)      : no gethostbyname, so pick harmless default
13247                 netdb_name_type='char *'
13248                 ;;
13249         esac
13250 fi
13251
13252 : check for type of 1st argument to getnetbyaddr. 
13253 if test "X$netdb_net_type" = X ; then
13254         case "$d_getnbyaddr" in
13255         $define)
13256                 $cat <<EOM
13257
13258 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13259 EOM
13260                 hdrs="$define sys/types.h
13261                         $d_socket sys/socket.h 
13262                         $i_niin netinet/in.h 
13263                         $i_netdb netdb.h
13264                         $i_unistd unistd.h"
13265                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13266                         case "$netdb_net_type" in
13267                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13268                                 if ./protochk "$try" $hdrs; then
13269                                         echo "Your system accepts $xxx."
13270                                         netdb_net_type="$xxx"
13271                                 fi
13272                                 ;;
13273                         esac
13274                 done
13275                 : In case none of those worked, prompt the user.
13276                 case "$netdb_net_type" in
13277                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13278                         dflt='long'
13279                         . ./myread
13280                         netdb_net_type=$ans
13281                         ;;
13282                 esac
13283                 ;;
13284         *)      : no getnetbyaddr, so pick harmless default
13285                 netdb_net_type='long'
13286                 ;;
13287         esac
13288 fi
13289 : locate the preferred pager for this system
13290 case "$pager" in
13291 '')
13292         dflt=''
13293         case "$pg" in
13294         /*) dflt=$pg;;
13295         esac
13296         case "$more" in
13297         /*) dflt=$more;;
13298         esac
13299         case "$less" in
13300         /*) dflt=$less;;
13301         esac
13302         case "$dflt" in
13303         '') dflt=/usr/ucb/more;;
13304         esac
13305         ;;
13306 *) dflt="$pager";;
13307 esac
13308 echo " "
13309 fn=f/
13310 rp='What pager is used on your system?'
13311 . ./getfile
13312 pager="$ans"
13313
13314 : see what type pids are declared as in the kernel
13315 rp="What is the type of process ids on this system?"
13316 set pid_t pidtype int stdio.h sys/types.h
13317 eval $typedef_ask
13318
13319 : Find earliest binary compatible site_perl subdirectory perl can use.
13320 case "$bincompat5005" in
13321 "$define") xs_apiversion='5.005' ;;
13322 *) xs_apiversion=$version ;;   # The current site_perl version.
13323 esac
13324 : Find earliest pure perl site_perl subdirectory perl can use.
13325 : The versioned directories started at 5.005.
13326 pm_apiversion='5.005'
13327
13328 : check for length of pointer
13329 echo " "
13330 case "$ptrsize" in
13331 '')
13332         echo "Checking to see how big your pointers are..." >&4
13333         if test "$voidflags" -gt 7; then
13334                 echo '#define VOID_PTR char *' > try.c
13335         else
13336                 echo '#define VOID_PTR void *' > try.c
13337         fi
13338         $cat >>try.c <<'EOCP'
13339 #include <stdio.h>
13340 int main()
13341 {
13342     printf("%d\n", (int)sizeof(VOID_PTR));
13343     exit(0);
13344 }
13345 EOCP
13346         set try
13347         if eval $compile_ok; then
13348                 ptrsize=`./try`
13349                 echo "Your pointers are $ptrsize bytes long."
13350         else
13351                 dflt='4'
13352                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13353                 rp="What is the size of a pointer (in bytes)?"
13354                 . ./myread
13355                 ptrsize="$ans"
13356         fi
13357         ;;
13358 esac
13359 $rm -f try.c try
13360
13361 : see if ar generates random libraries by itself
13362 echo " "
13363 echo "Checking how to generate random libraries on your machine..." >&4
13364 echo 'int bar1() { return bar2(); }' > bar1.c
13365 echo 'int bar2() { return 2; }' > bar2.c
13366 $cat > foo.c <<'EOP'
13367 int main() { printf("%d\n", bar1()); exit(0); }
13368 EOP
13369 $cc $ccflags -c bar1.c >/dev/null 2>&1
13370 $cc $ccflags -c bar2.c >/dev/null 2>&1
13371 $cc $ccflags -c foo.c >/dev/null 2>&1
13372 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13373 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13374         ./foobar >/dev/null 2>&1; then
13375         echo "$ar appears to generate random libraries itself."
13376         orderlib=false
13377         ranlib=":"
13378 elif $ar ts bar$_a >/dev/null 2>&1 &&
13379         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13380         ./foobar >/dev/null 2>&1; then
13381                 echo "a table of contents needs to be added with '$ar ts'."
13382                 orderlib=false
13383                 ranlib="$ar ts"
13384 else
13385         case "$ranlib" in
13386         :) ranlib='';;
13387         '')
13388                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13389                 $test -f $ranlib || ranlib=''
13390                 ;;
13391         esac
13392         if $test -n "$ranlib"; then
13393                 echo "your system has '$ranlib'; we'll use that."
13394                 orderlib=false
13395         else
13396                 echo "your system doesn't seem to support random libraries"
13397                 echo "so we'll use lorder and tsort to order the libraries."
13398                 orderlib=true
13399                 ranlib=":"
13400         fi
13401 fi
13402 $rm -f foo* bar* 
13403
13404 : check for type of arguments to select. 
13405 case "$selecttype" in
13406 '') case "$d_select" in
13407         $define)
13408                 echo " "
13409                 $cat <<EOM
13410 Checking to see what type of arguments are accepted by select().
13411 EOM
13412                 hdrs="$define sys/types.h
13413                         $i_systime sys/time.h 
13414                         $i_sysselct sys/select.h
13415                         $d_socket sys/socket.h"
13416                 : The first arg can be int, unsigned, or size_t
13417                 : The last arg may or may not be 'const'
13418                 val=''
13419                 : void pointer has been seen but using that
13420                 : breaks the selectminbits test
13421                 for xxx in 'fd_set *' 'int *'; do
13422                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13423                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13424                                         case "$val" in
13425                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13426                                                 if ./protochk "$try" $hdrs; then
13427                                                         echo "Your system accepts $xxx."
13428                                                         val="$xxx"
13429                                                 fi
13430                                                 ;;
13431                                         esac
13432                                 done
13433                         done
13434                 done
13435                 case "$val" in
13436                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13437                         case "$d_fd_set" in
13438                                 $define) dflt="fd_set *" ;;
13439                                 *)              dflt="int *" ;;
13440                         esac
13441                         . ./myread
13442                         val=$ans
13443                         ;;
13444                 esac
13445                 selecttype="$val"
13446                 ;;
13447         *)      : no select, so pick a harmless default
13448                 selecttype='int *'
13449                 ;;
13450         esac
13451         ;;
13452 esac
13453
13454 : check for the select 'width'
13455 case "$selectminbits" in
13456 '') case "$d_select" in
13457         $define)
13458                 $cat <<EOM
13459
13460 Checking to see on how many bits at a time your select() operates...
13461 EOM
13462                 $cat >try.c <<EOCP
13463 #include <sys/types.h>
13464 #$i_time I_TIME
13465 #$i_systime I_SYS_TIME
13466 #$i_systimek I_SYS_TIME_KERNEL
13467 #ifdef I_TIME
13468 #   include <time.h>
13469 #endif
13470 #ifdef I_SYS_TIME
13471 #   ifdef I_SYS_TIME_KERNEL
13472 #       define KERNEL
13473 #   endif
13474 #   include <sys/time.h>
13475 #   ifdef I_SYS_TIME_KERNEL
13476 #       undef KERNEL
13477 #   endif
13478 #endif
13479 #$i_sysselct I_SYS_SELECT
13480 #ifdef I_SYS_SELECT
13481 #include <sys/select.h>
13482 #endif
13483 #$d_socket HAS_SOCKET
13484 #ifdef HAS_SOCKET
13485 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13486 #endif
13487 #include <stdio.h>
13488 $selecttype b;
13489 #define S sizeof(*(b))
13490 #define MINBITS 64
13491 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13492 #define NBITS  (NBYTES * 8)
13493 int main() {
13494     char s[NBYTES];
13495     struct timeval t;
13496     int i;
13497     FILE* fp;
13498     int fd;
13499
13500     fclose(stdin);
13501     fp = fopen("try.c", "r");
13502     if (fp == 0)
13503       exit(1);
13504     fd = fileno(fp);
13505     if (fd < 0)
13506       exit(2);
13507     b = ($selecttype)s;
13508     for (i = 0; i < NBITS; i++)
13509         FD_SET(i, b);
13510     t.tv_sec  = 0;
13511     t.tv_usec = 0;
13512     select(fd + 1, b, 0, 0, &t);
13513     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13514     printf("%d\n", i + 1);
13515     return 0;
13516 }
13517 EOCP
13518                 set try
13519                 if eval $compile_ok; then
13520                         selectminbits=`./try`
13521                         case "$selectminbits" in
13522                         '')     cat >&4 <<EOM
13523 Cannot figure out on how many bits at a time your select() operates.
13524 I'll play safe and guess it is 32 bits.
13525 EOM
13526                                 selectminbits=32
13527                                 bits="32 bits"
13528                                 ;;
13529                         1)      bits="1 bit" ;;
13530                         *)      bits="$selectminbits bits" ;;
13531                         esac
13532                         echo "Your select() operates on $bits at a time." >&4
13533                 else
13534                         rp='What is the minimum number of bits your select() operates on?'
13535                         case "$byteorder" in
13536                         1234|12345678)  dflt=32 ;;
13537                         *)              dflt=1  ;;
13538                         esac
13539                         . ./myread
13540                         val=$ans
13541                         selectminbits="$val"
13542                 fi
13543                 $rm -f try.* try
13544                 ;;
13545         *)      : no select, so pick a harmless default
13546                 selectminbits='32'
13547                 ;;
13548         esac
13549         ;;
13550 esac
13551
13552 : Trace out the files included by signal.h, then look for SIGxxx names.
13553 : Remove SIGARRAYSIZE used by HPUX.
13554 : Remove SIGSTKSIZE used by Linux.
13555 : Remove SIGSTKSZ used by Posix.
13556 : Remove SIGTYP void lines used by OS2.
13557 : Some cpps, like os390, dont give the file name anywhere
13558 if [ "X$fieldn" = X ]; then
13559         : Just make some guesses.  We check them later.
13560         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13561 else
13562         xxx=`echo '#include <signal.h>' |
13563         $cppstdin $cppminus $cppflags 2>/dev/null |
13564         $grep '^[       ]*#.*include' | 
13565         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13566 fi
13567 : Check this list of files to be sure we have parsed the cpp output ok.
13568 : This will also avoid potentially non-existent files, such 
13569 : as ../foo/bar.h
13570 xxxfiles=''
13571 for xx in $xxx /dev/null ; do
13572         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13573 done
13574 : If we have found no files, at least try signal.h
13575 case "$xxxfiles" in
13576 '')     xxxfiles=`./findhdr signal.h` ;;
13577 esac
13578 xxx=`awk '
13579 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13580         print substr($2, 4, 20)
13581 }
13582 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13583         print substr($3, 4, 20)
13584 }' $xxxfiles`
13585 : Append some common names just in case the awk scan failed.
13586 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13587 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13588 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13589 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13590 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13591
13592 : generate a few handy files for later
13593 $cat > signal.c <<'EOCP'
13594 #include <sys/types.h>
13595 #include <signal.h>
13596 #include <stdio.h>
13597 int main() {
13598
13599 /* Strange style to avoid deeply-nested #if/#else/#endif */
13600 #ifndef NSIG
13601 #  ifdef _NSIG
13602 #    define NSIG (_NSIG)
13603 #  endif
13604 #endif
13605
13606 #ifndef NSIG
13607 #  ifdef SIGMAX
13608 #    define NSIG (SIGMAX+1)
13609 #  endif
13610 #endif
13611
13612 #ifndef NSIG
13613 #  ifdef SIG_MAX
13614 #    define NSIG (SIG_MAX+1)
13615 #  endif
13616 #endif
13617
13618 #ifndef NSIG
13619 #  ifdef MAXSIG
13620 #    define NSIG (MAXSIG+1)
13621 #  endif
13622 #endif
13623
13624 #ifndef NSIG
13625 #  ifdef MAX_SIG
13626 #    define NSIG (MAX_SIG+1)
13627 #  endif
13628 #endif
13629
13630 #ifndef NSIG
13631 #  ifdef SIGARRAYSIZE
13632 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13633 #  endif
13634 #endif
13635
13636 #ifndef NSIG
13637 #  ifdef _sys_nsig
13638 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13639 #  endif
13640 #endif
13641
13642 /* Default to some arbitrary number that's big enough to get most
13643    of the common signals.
13644 */
13645 #ifndef NSIG
13646 #    define NSIG 50
13647 #endif
13648
13649 printf("NSIG %d\n", NSIG);
13650
13651 #ifndef JUST_NSIG
13652
13653 EOCP
13654
13655 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13656 {
13657         printf "#ifdef SIG"; printf $1; printf "\n"
13658         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13659         printf $1; printf ");\n"
13660         printf "#endif\n"
13661 }
13662 END {
13663         printf "#endif /* JUST_NSIG */\n";
13664         printf "exit(0);\n}\n";
13665 }
13666 ' >>signal.c
13667 $cat >signal.awk <<'EOP'
13668 BEGIN { ndups = 0 }
13669 $1 ~ /^NSIG$/ { nsig = $2 }
13670 ($1 !~ /^NSIG$/) && (NF == 2) {
13671     if ($2 > maxsig) { maxsig = $2 }
13672     if (sig_name[$2]) {
13673         dup_name[ndups] = $1
13674         dup_num[ndups] = $2
13675         ndups++ 
13676     }
13677     else {
13678         sig_name[$2] = $1
13679         sig_num[$2] = $2
13680     }
13681 }
13682 END { 
13683     if (nsig == 0) {
13684         nsig = maxsig + 1
13685     }
13686     printf("NSIG %d\n", nsig);
13687     for (n = 1; n < nsig; n++) {
13688         if (sig_name[n]) {
13689             printf("%s %d\n", sig_name[n], sig_num[n])
13690         }
13691         else {
13692             printf("NUM%d %d\n", n, n) 
13693         }
13694     }
13695     for (n = 0; n < ndups; n++) {
13696         printf("%s %d\n", dup_name[n], dup_num[n])
13697     }
13698 }
13699 EOP
13700 $cat >signal_cmd <<EOS
13701 $startsh
13702 if $test -s signal.lst; then
13703     echo "Using your existing signal.lst file"
13704         exit 0
13705 fi
13706 xxx="$xxx"
13707 EOS
13708 $cat >>signal_cmd <<'EOS'
13709
13710 set signal
13711 if eval $compile_ok; then
13712         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13713 else
13714         echo "(I can't seem be able to compile the whole test program)" >&4
13715         echo "(I'll try it in little pieces.)" >&4
13716         set signal -DJUST_NSIG
13717         if eval $compile_ok; then
13718                 ./signal$_exe > signal.nsg
13719                 $cat signal.nsg
13720         else
13721                 echo "I can't seem to figure out how many signals you have." >&4
13722                 echo "Guessing 50." >&4
13723                 echo 'NSIG 50' > signal.nsg
13724         fi
13725         : Now look at all the signal names, one at a time.
13726         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13727                 $cat > signal.c <<EOCP
13728 #include <sys/types.h>
13729 #include <signal.h>
13730 #include <stdio.h>
13731 int main() {
13732 printf("$xx %d\n", SIG${xx});
13733 return 0;
13734 }
13735 EOCP
13736                 set signal
13737                 if eval $compile; then
13738                         echo "SIG${xx} found."
13739                         ./signal$_exe  >> signal.ls1
13740                 else
13741                         echo "SIG${xx} NOT found."
13742                 fi
13743         done
13744         if $test -s signal.ls1; then
13745                 $cat signal.nsg signal.ls1 |
13746                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13747         fi
13748
13749 fi
13750 if $test -s signal.lst; then
13751         :
13752 else
13753         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13754         echo 'kill -l' >signal
13755         set X `csh -f <signal`
13756         $rm -f signal
13757         shift
13758         case $# in
13759         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13760         esac
13761         echo $@ | $tr ' ' $trnl | \
13762             $awk '{ printf "%s %d\n", $1, ++s; }
13763                   END { printf "NSIG %d\n", ++s }' >signal.lst
13764 fi
13765 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13766 EOS
13767 chmod a+x signal_cmd
13768 $eunicefix signal_cmd
13769
13770 : generate list of signal names
13771 echo " "
13772 case "$sig_name_init" in
13773 '') doinit=yes ;;
13774 *)  case "$sig_num_init" in
13775     ''|*,*) doinit=yes ;;
13776     esac ;;
13777 esac
13778 case "$doinit" in
13779 yes)
13780         echo "Generating a list of signal names and numbers..." >&4
13781         . ./signal_cmd
13782         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13783         sig_name=`$awk 'BEGIN { printf "ZERO " }
13784                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13785         sig_num=`$awk  'BEGIN { printf "0 " }
13786                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13787         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13788                              !/^NSIG/   { printf "\"%s\", ", $1 }
13789                              END        { printf "0\n" }' signal.lst`
13790         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13791                              !/^NSIG/   { printf "%d, ", $2}
13792                              END        { printf "0\n"}' signal.lst`
13793         ;;
13794 esac
13795 echo "The following $sig_count signals are available:"
13796 echo " "
13797 echo $sig_name | $awk \
13798 'BEGIN { linelen = 0 }
13799 {
13800         for (i = 1; i <= NF; i++) {
13801                 name = "SIG" $i " "
13802                 linelen = linelen + length(name)
13803                 if (linelen > 70) {
13804                         printf "\n"
13805                         linelen = length(name)
13806                 }
13807                 printf "%s", name
13808         }
13809         printf "\n"
13810 }'
13811 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13812
13813 echo " "
13814 case "$sizetype" in
13815 *_t) zzz="$sizetype"    ;;
13816 *)   zzz="filesize"     ;;
13817 esac
13818 echo "Checking the size of $zzz..." >&4 
13819 cat > try.c <<EOCP
13820 #include <sys/types.h>
13821 #include <stdio.h>
13822 int main() {
13823     printf("%d\n", (int)sizeof($sizetype));
13824     exit(0);
13825 }
13826 EOCP
13827 set try
13828 if eval $compile_ok; then
13829         yyy=`./try`
13830         case "$yyy" in
13831         '')     sizesize=4
13832                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
13833                 ;;
13834         *)      sizesize=$yyy
13835                 echo "Your $zzz size is $sizesize bytes."
13836                 ;;
13837         esac
13838 else
13839         sizesize=4
13840         echo "(I can't compile the test program--guessing $sizesize.)" >&4
13841 fi
13842
13843
13844 : check for socklen_t
13845 echo " "
13846 echo "Checking to see if you have socklen_t..." >&4
13847 $cat >try.c <<EOCP
13848 #include <sys/types.h>
13849 #$d_socket HAS_SOCKET
13850 #ifdef HAS_SOCKET
13851 #include <sys/socket.h>
13852 #endif
13853 int main() { socklen_t x = 16; }
13854 EOCP
13855 set try
13856 if eval $compile; then
13857         val="$define"
13858         echo "You have socklen_t."
13859 else
13860         val="$undef"
13861         echo "You do not have socklen_t."
13862         case "$sizetype" in
13863         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
13864         esac
13865 fi
13866 $rm -f try try.*
13867 set d_socklen_t
13868 eval $setvar
13869
13870 : check for type of the size argument to socket calls
13871 case "$d_socket" in
13872 "$define")
13873         $cat <<EOM
13874
13875 Checking to see what type is the last argument of accept().
13876 EOM
13877         hdrs="$define sys/types.h $d_socket sys/socket.h" 
13878         yyy=''
13879         case "$d_socklen_t" in
13880         "$define") yyy="$yyy socklen_t"
13881         esac
13882         yyy="$yyy $sizetype int long unsigned"
13883         for xxx in $yyy; do
13884                 case "$socksizetype" in
13885                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
13886                         if ./protochk "$try" $hdrs; then
13887                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
13888                                 socksizetype="$xxx"
13889                         fi
13890                         ;;
13891                 esac
13892         done
13893 : In case none of those worked, prompt the user.
13894         case "$socksizetype" in
13895         '')     rp='What is the type for socket address structure sizes?'
13896                 dflt='int'
13897                 . ./myread
13898                 socksizetype=$ans
13899                 ;;
13900         esac
13901         ;;
13902 *)      : no sockets, so pick relatively harmless default
13903         socksizetype='int'
13904         ;;
13905 esac
13906
13907 : see what type is used for signed size_t
13908 set ssize_t ssizetype int stdio.h sys/types.h
13909 eval $typedef
13910 dflt="$ssizetype"
13911 $cat > ssize.c <<EOM
13912 #include <stdio.h>
13913 #include <sys/types.h>
13914 #define Size_t $sizetype
13915 #define SSize_t $dflt
13916 int main()
13917 {
13918         if (sizeof(Size_t) == sizeof(SSize_t))
13919                 printf("$dflt\n");
13920         else if (sizeof(Size_t) == sizeof(int))
13921                 printf("int\n");
13922         else 
13923                 printf("long\n");
13924         exit(0);
13925 }
13926 EOM
13927 echo " "
13928 set ssize
13929 if eval $compile_ok && ./ssize > /dev/null; then
13930         ssizetype=`./ssize`
13931         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13932 else
13933         $cat >&4 <<EOM
13934 Help! I can't compile and run the ssize_t test program: please enlighten me!
13935 (This is probably a misconfiguration in your system or libraries, and
13936 you really ought to fix it.  Still, I'll try anyway.)
13937
13938 I need a type that is the same size as $sizetype, but is guaranteed to
13939 be signed.  Common values are ssize_t, int and long.
13940
13941 EOM
13942         rp="What signed type is the same size as $sizetype?"
13943         . ./myread
13944         ssizetype="$ans"
13945 fi
13946 $rm -f ssize ssize.*
13947
13948 : see what type of char stdio uses.
13949 echo " "
13950 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13951         echo "Your stdio uses unsigned chars." >&4
13952         stdchar="unsigned char"
13953 else
13954         echo "Your stdio uses signed chars." >&4
13955         stdchar="char"
13956 fi
13957
13958 : see if time exists
13959 echo " "
13960 if test "X$d_time" = X -o X"$timetype" = X; then
13961     if set time val -f d_time; eval $csym; $val; then
13962                 echo 'time() found.' >&4
13963                 val="$define"
13964                 rp="What is the type returned by time() on this system?"
13965                 set time_t timetype long stdio.h sys/types.h
13966                 eval $typedef_ask
13967     else
13968                 echo 'time() not found, hope that will do.' >&4
13969                 val="$undef"
13970                 timetype='int';
13971     fi
13972     set d_time
13973     eval $setvar
13974 fi
13975
13976 : see what type uids are declared as in the kernel
13977 echo " "
13978 echo "Looking for the type for user ids returned by getuid()."
13979 set uid_t uidtype xxx stdio.h sys/types.h
13980 eval $typedef
13981 case "$uidtype" in
13982 xxx)
13983         xxx=`./findhdr sys/user.h`
13984         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13985         case $1 in
13986         unsigned) dflt="$1 $2" ;;
13987         *) dflt="$1" ;;
13988         esac
13989         ;;
13990 *) dflt="$uidtype";;
13991 esac
13992 case "$uidtype" in
13993 uid_t)  echo "uid_t found." ;;
13994 *)      rp="What is the type for user ids returned by getuid()?"
13995         . ./myread
13996         uidtype="$ans"
13997         ;;
13998 esac
13999
14000 echo " "
14001 case "$uidtype" in
14002 *_t) zzz="$uidtype"     ;;
14003 *)   zzz="uid"          ;;
14004 esac
14005 echo "Checking the size of $zzz..." >&4 
14006 cat > try.c <<EOCP
14007 #include <sys/types.h>
14008 #include <stdio.h>
14009 int main() {
14010     printf("%d\n", (int)sizeof($uidtype));
14011     exit(0);
14012 }
14013 EOCP
14014 set try
14015 if eval $compile_ok; then
14016         yyy=`./try`
14017         case "$yyy" in
14018         '')     uidsize=4
14019                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14020                 ;;
14021         *)      uidsize=$yyy
14022                 echo "Your $zzz is $uidsize bytes long."
14023                 ;;
14024         esac
14025 else
14026         uidsize=4
14027         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14028 fi
14029
14030 echo " "
14031 case "$uidtype" in
14032 *_t) zzz="$uidtype"     ;;
14033 *)   zzz="uid"          ;;
14034 esac
14035 echo "Checking the sign of $zzz..." >&4
14036 cat > try.c <<EOCP
14037 #include <sys/types.h>
14038 #include <stdio.h>
14039 int main() {
14040         $uidtype foo = -1;
14041         if (foo < 0)
14042                 printf("-1\n");
14043         else
14044                 printf("1\n");
14045 }
14046 EOCP
14047 set try
14048 if eval $compile; then
14049         yyy=`./try`
14050         case "$yyy" in
14051         '')     uidsign=1
14052                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14053                 ;;
14054         *)      uidsign=$yyy
14055                 case "$uidsign" in
14056                  1) echo "Your $zzz is unsigned." ;;
14057                 -1) echo "Your $zzz is signed."   ;;
14058                 esac
14059                 ;;
14060         esac
14061 else
14062         uidsign=1
14063         echo "(I can't compile the test program--guessing unsigned.)" >&4
14064 fi
14065
14066
14067
14068 echo " "
14069 $echo "Checking the format string to be used for uids..." >&4
14070
14071 case "$uidsign" in
14072 -1)     if $test X"$uidsize" = X"$ivsize"; then
14073                 uidformat="$ivdformat"
14074         else
14075                 if $test X"$uidsize" = X"$longsize"; then
14076                         uidformat='"ld"'
14077                 else
14078                         if $test X"$uidsize" = X"$intsize"; then
14079                                 uidformat='"d"'
14080                         else
14081                                 if $test X"$uidsize" = X"$shortsize"; then
14082                                         uidformat='"hd"'
14083                                 fi
14084                         fi
14085                 fi
14086         fi
14087         ;;
14088 *)      if $test X"$uidsize" = X"$uvsize"; then
14089                 uidformat="$uvuformat"
14090         else
14091                 if $test X"$uidsize" = X"$longsize"; then
14092                         uidformat='"lu"'
14093                 else
14094                         if $test X"$uidsize" = X"$intsize"; then
14095                                 uidformat='"u"'
14096                         else
14097                                 if $test X"$uidsize" = X"$shortsize"; then
14098                                         uidformat='"hu"'
14099                                 fi
14100                         fi
14101                 fi
14102         fi
14103         ;;
14104 esac
14105
14106 : see if dbm.h is available
14107 : see if dbmclose exists
14108 set dbmclose d_dbmclose
14109 eval $inlibc
14110
14111 case "$d_dbmclose" in
14112 $define)
14113         set dbm.h i_dbm
14114         eval $inhdr
14115         case "$i_dbm" in
14116         $define)
14117                 val="$undef"
14118                 set i_rpcsvcdbm
14119                 eval $setvar
14120                 ;;
14121         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14122                 eval $inhdr
14123                 ;;
14124         esac
14125         ;;
14126 *)      echo "We won't be including <dbm.h>"
14127         val="$undef"
14128         set i_dbm
14129         eval $setvar
14130         val="$undef"
14131         set i_rpcsvcdbm
14132         eval $setvar
14133         ;;
14134 esac
14135
14136 : see if this is a sys/file.h system
14137 val=''
14138 set sys/file.h val
14139 eval $inhdr
14140
14141 : do we need to include sys/file.h ?
14142 case "$val" in
14143 "$define")
14144         echo " "
14145         if $h_sysfile; then
14146                 val="$define"
14147                 echo "We'll be including <sys/file.h>." >&4
14148         else
14149                 val="$undef"
14150                 echo "We won't be including <sys/file.h>." >&4
14151         fi
14152         ;;
14153 *)
14154         h_sysfile=false
14155         ;;
14156 esac
14157 set i_sysfile
14158 eval $setvar
14159
14160 : see if fcntl.h is there
14161 val=''
14162 set fcntl.h val
14163 eval $inhdr
14164
14165 : see if we can include fcntl.h
14166 case "$val" in
14167 "$define")
14168         echo " "
14169         if $h_fcntl; then
14170                 val="$define"
14171                 echo "We'll be including <fcntl.h>." >&4
14172         else
14173                 val="$undef"
14174                 if $h_sysfile; then
14175         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14176                 else
14177                         echo "We won't be including <fcntl.h>." >&4
14178                 fi
14179         fi
14180         ;;
14181 *)
14182         h_fcntl=false
14183         val="$undef"
14184         ;;
14185 esac
14186 set i_fcntl
14187 eval $setvar
14188
14189 : see if this is a iconv.h system
14190 set iconv.h i_iconv
14191 eval $inhdr
14192
14193 : see if this is a ieeefp.h system
14194 set ieeefp.h i_ieeefp
14195 eval $inhdr
14196
14197 : see if locale.h is available
14198 set locale.h i_locale
14199 eval $inhdr
14200
14201 : see if mach cthreads are available
14202 if test "X$usethreads" = "X$define"; then
14203         set mach/cthreads.h i_machcthr
14204         eval $inhdr
14205 else
14206         i_machcthr="$undef"
14207 fi
14208
14209
14210
14211 : see if this is a math.h system
14212 set math.h i_math
14213 eval $inhdr
14214
14215 : see if this is a mntent.h system
14216 set mntent.h i_mntent
14217 eval $inhdr
14218
14219 : see if ndbm.h is available
14220 set ndbm.h t_ndbm
14221 eval $inhdr
14222 case "$t_ndbm" in
14223 $define)
14224         : see if dbm_open exists
14225         set dbm_open d_dbm_open
14226         eval $inlibc
14227         case "$d_dbm_open" in
14228         $undef)
14229                 t_ndbm="$undef"
14230                 echo "We won't be including <ndbm.h>"
14231                 ;;
14232         esac
14233         ;;
14234 esac
14235 val="$t_ndbm"
14236 set i_ndbm
14237 eval $setvar
14238
14239 : see if net/errno.h is available
14240 val=''
14241 set net/errno.h val
14242 eval $inhdr
14243
14244 : Unfortunately, it causes problems on some systems.  Arrgh.
14245 case "$val" in
14246 $define)
14247         cat > try.c <<'EOM'
14248 #include <stdio.h>
14249 #include <errno.h>
14250 #include <net/errno.h>
14251 int func()
14252 {
14253         return ENOTSOCK;
14254 }
14255 EOM
14256         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14257                 echo "We'll be including <net/errno.h>." >&4
14258         else
14259                 echo "We won't be including <net/errno.h>." >&4
14260                 val="$undef"
14261         fi
14262         $rm -f try.* try
14263         ;;
14264 esac
14265 set i_neterrno
14266 eval $setvar
14267
14268 : see if netinet/tcp.h is available
14269 set netinet/tcp.h i_netinettcp
14270 eval $inhdr
14271
14272 : see if this is a poll.h system
14273 set poll.h i_poll
14274 eval $inhdr
14275
14276 echo " "
14277 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14278 $cat <<'EOSH' > Cppsym.know
14279 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14280 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14281 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14282 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14283 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14284 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14285 bull c cadmus clipper CMU COFF COMPILER_VERSION
14286 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14287 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14288 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14289 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14290 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14291 H3050R H3050RX hbullx20 hcx host_mips
14292 hp200 hp300 hp700 HP700 hp800 hp9000
14293 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14294 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14295 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14296 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14297 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14298 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14299 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14300 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14301 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14302 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14303 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14304 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14305 MATH_HAS_NO_SIDE_EFFECTS
14306 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14307 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14308 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14309 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14310 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14311 NetBSD news1500 news1700 news1800 news1900 news3700
14312 news700 news800 news900 NeXT NLS ns16000 ns32000
14313 ns32016 ns32332 ns32k nsc32000
14314 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14315 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14316 pc532 pdp11 PGC PIC plexus PORTAR posix
14317 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14318 POSIX_C_SOURCE POSIX_SOURCE POWER
14319 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14320 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14321 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14322 sony sony_news sonyrisc sparc sparclite spectrum
14323 stardent stdc STDC_EXT stratos sun sun3 sun386
14324 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14325 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14326 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14327 sysV68 sysV88 Tek4132 Tek4300 titan
14328 tower tower32 tower32_200 tower32_600 tower32_700
14329 tower32_800 tower32_850 tss
14330 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14331 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14332 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14333 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14334 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14335 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14336 z8000
14337 EOSH
14338 # Maybe put other stuff here too.
14339 cat <<EOSH >>Cppsym.know
14340 $osname
14341 EOSH
14342 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14343 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14344 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14345 $rm -f Cppsym.a Cppsym.b
14346 cat <<EOSH > Cppsym
14347 $startsh
14348 if $test \$# -gt 0; then
14349     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14350     if $test -s Cppsym.got; then
14351         $rm -f Cppsym.got
14352         exit 0
14353     fi
14354     $rm -f Cppsym.got
14355     exit 1
14356 else
14357     $tr " " "$trnl" | ./Cppsym.try
14358     exit 0
14359 fi
14360 EOSH
14361 chmod +x Cppsym
14362 $eunicefix Cppsym
14363 cat <<EOSH > Cppsym.try
14364 $startsh
14365 cat <<'EOCP' > try.c
14366 #include <stdio.h>
14367 int main() {
14368 EOCP
14369 $awk \\
14370 EOSH
14371 cat <<'EOSH' >> Cppsym.try
14372 'length($1) > 0 {
14373     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
14374     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
14375     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
14376     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
14377 }'       >> try.c
14378 echo '}' >> try.c
14379 EOSH
14380 cat <<EOSH >> Cppsym.try
14381 ccflags="$ccflags"
14382 case "$osname-$gccversion" in
14383 irix-) ccflags="\$ccflags -woff 1178" ;;
14384 esac
14385 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14386 EOSH
14387 chmod +x Cppsym.try
14388 $eunicefix Cppsym.try
14389 ./Cppsym < Cppsym.know > Cppsym.true
14390 : now check the C compiler for additional symbols
14391 postprocess_cc_v=''
14392 case "$osname" in
14393 aix) postprocess_cc_v="|$tr , ' '" ;;
14394 esac
14395 $cat >ccsym <<EOS
14396 $startsh
14397 $cat >tmp.c <<EOF
14398 extern int foo;
14399 EOF
14400 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14401 do
14402         case "\$i" in
14403         -D*) echo "\$i" | $sed 's/^-D//';;
14404         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14405         esac
14406 done
14407 $rm -f try.c
14408 EOS
14409 postprocess_cc_v=''
14410 chmod +x ccsym
14411 $eunicefix ccsym
14412 ./ccsym > ccsym1.raw
14413 if $test -s ccsym1.raw; then
14414        $sort ccsym1.raw | $uniq >ccsym.raw
14415 else
14416        mv ccsym1.raw ccsym.raw
14417 fi
14418
14419 $awk '/\=/ { print $0; next }
14420         { print $0"=1" }' ccsym.raw >ccsym.list
14421 $awk '/\=/ { print $0; next }
14422         { print $0"=1" }' Cppsym.true >ccsym.true
14423 $comm -13 ccsym.true ccsym.list >ccsym.own
14424 $comm -12 ccsym.true ccsym.list >ccsym.com
14425 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14426 also=''
14427 if $test -z ccsym.raw; then
14428         echo "Your C compiler doesn't seem to define any symbols!" >&4
14429         echo " "
14430         echo "However, your C preprocessor defines the following symbols:"
14431         $cat Cppsym.true
14432         ccsymbols=''
14433         cppsymbols=`$cat Cppsym.true`
14434         cppsymbols=`echo $cppsymbols`
14435         cppccsymbols="$cppsymbols"
14436 else
14437         if $test -s ccsym.com; then
14438                 echo "Your C compiler and pre-processor define these symbols:"
14439                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14440                 also='also '
14441                 symbols='ones'
14442                 cppccsymbols=`$cat ccsym.com`
14443                 cppccsymbols=`echo $cppccsymbols`
14444                 $test "$silent" || sleep 1
14445         fi
14446         if $test -s ccsym.cpp; then
14447                 $test "$also" && echo " "
14448                 echo "Your C pre-processor ${also}defines the following symbols:"
14449                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14450                 also='further '
14451                 cppsymbols=`$cat ccsym.cpp`
14452                 cppsymbols=`echo $cppsymbols`
14453                 $test "$silent" || sleep 1
14454         fi
14455         if $test -s ccsym.own; then
14456                 $test "$also" && echo " "
14457                 echo "Your C compiler ${also}defines the following cpp symbols:"
14458                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14459                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14460                 ccsymbols=`$cat ccsym.own`
14461                 ccsymbols=`echo $ccsymbols`
14462                 $test "$silent" || sleep 1
14463         fi
14464 fi
14465 $rm -f ccsym*
14466
14467 : see if this is a termio system
14468 val="$undef"
14469 val2="$undef"
14470 val3="$undef"
14471 if $test `./findhdr termios.h`; then
14472         set tcsetattr i_termios
14473         eval $inlibc
14474         val3="$i_termios"
14475 fi
14476 echo " "
14477 case "$val3" in
14478 "$define") echo "You have POSIX termios.h... good!" >&4;;
14479 *) if ./Cppsym pyr; then
14480                 case "`/bin/universe`" in
14481                 ucb) if $test `./findhdr sgtty.h`; then
14482                                 val2="$define"
14483                                 echo "<sgtty.h> found." >&4
14484                         else
14485                                 echo "System is pyramid with BSD universe."
14486                                 echo "<sgtty.h> not found--you could have problems." >&4
14487                         fi;;
14488                 *) if $test `./findhdr termio.h`; then
14489                                 val="$define"
14490                                 echo "<termio.h> found." >&4
14491                         else
14492                                 echo "System is pyramid with USG universe."
14493                                 echo "<termio.h> not found--you could have problems." >&4
14494                         fi;;
14495                 esac
14496         elif ./usg; then
14497                 if $test `./findhdr termio.h`; then
14498                         echo "<termio.h> found." >&4
14499                         val="$define"
14500                 elif $test `./findhdr sgtty.h`; then
14501                         echo "<sgtty.h> found." >&4
14502                         val2="$define"
14503                 else
14504 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14505                 fi
14506         else
14507                 if $test `./findhdr sgtty.h`; then
14508                         echo "<sgtty.h> found." >&4
14509                         val2="$define"
14510                 elif $test `./findhdr termio.h`; then
14511                         echo "<termio.h> found." >&4
14512                         val="$define"
14513                 else
14514 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14515                 fi
14516         fi;;
14517 esac
14518 set i_termio; eval $setvar
14519 val=$val2; set i_sgtty; eval $setvar
14520 val=$val3; set i_termios; eval $setvar
14521
14522 : see if this is a shadow.h system
14523 set shadow.h i_shadow
14524 eval $inhdr
14525
14526 : see if this is a socks.h system
14527 set socks.h i_socks
14528 eval $inhdr
14529
14530 : see if stdarg is available
14531 echo " "
14532 if $test `./findhdr stdarg.h`; then
14533         echo "<stdarg.h> found." >&4
14534         valstd="$define"
14535 else
14536         echo "<stdarg.h> NOT found." >&4
14537         valstd="$undef"
14538 fi
14539
14540 : see if varags is available
14541 echo " "
14542 if $test `./findhdr varargs.h`; then
14543         echo "<varargs.h> found." >&4
14544 else
14545         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14546 fi
14547
14548 : set up the varargs testing programs
14549 $cat > varargs.c <<EOP
14550 #ifdef I_STDARG
14551 #include <stdarg.h>
14552 #endif
14553 #ifdef I_VARARGS
14554 #include <varargs.h>
14555 #endif
14556
14557 #ifdef I_STDARG
14558 int f(char *p, ...)
14559 #else
14560 int f(va_alist)
14561 va_dcl
14562 #endif
14563 {
14564         va_list ap;
14565 #ifndef I_STDARG
14566         char *p;
14567 #endif
14568 #ifdef I_STDARG
14569         va_start(ap,p);
14570 #else
14571         va_start(ap);
14572         p = va_arg(ap, char *);
14573 #endif
14574         va_end(ap);
14575 }
14576 EOP
14577 $cat > varargs <<EOP
14578 $startsh
14579 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14580         echo "true"
14581 else
14582         echo "false"
14583 fi
14584 $rm -f varargs$_o
14585 EOP
14586 chmod +x varargs
14587
14588 : now check which varargs header should be included
14589 echo " "
14590 i_varhdr=''
14591 case "$valstd" in
14592 "$define")
14593         if `./varargs I_STDARG`; then
14594                 val='stdarg.h'
14595         elif `./varargs I_VARARGS`; then
14596                 val='varargs.h'
14597         fi
14598         ;;
14599 *)
14600         if `./varargs I_VARARGS`; then
14601                 val='varargs.h'
14602         fi
14603         ;;
14604 esac
14605 case "$val" in
14606 '')
14607 echo "I could not find the definition for va_dcl... You have problems..." >&4
14608         val="$undef"; set i_stdarg; eval $setvar
14609         val="$undef"; set i_varargs; eval $setvar
14610         ;;
14611 *) 
14612         set i_varhdr
14613         eval $setvar
14614         case "$i_varhdr" in
14615         stdarg.h)
14616                 val="$define"; set i_stdarg; eval $setvar
14617                 val="$undef"; set i_varargs; eval $setvar
14618                 ;;
14619         varargs.h)
14620                 val="$undef"; set i_stdarg; eval $setvar
14621                 val="$define"; set i_varargs; eval $setvar
14622                 ;;
14623         esac
14624         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14625 esac
14626 $rm -f varargs*
14627
14628 : see if stddef is available
14629 set stddef.h i_stddef
14630 eval $inhdr
14631
14632 : see if this is a sunmath.h system
14633 set sunmath.h i_sunmath
14634 eval $inhdr
14635
14636 : see if sys/access.h is available
14637 set sys/access.h i_sysaccess
14638 eval $inhdr
14639
14640 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14641 set sys/filio.h i_sysfilio
14642 eval $inhdr
14643 echo " "
14644 if $test `./findhdr sys/ioctl.h`; then
14645         val="$define"
14646         echo '<sys/ioctl.h> found.' >&4
14647 else
14648         val="$undef"
14649         if $test $i_sysfilio = "$define"; then
14650             echo '<sys/ioctl.h> NOT found.' >&4
14651         else
14652                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14653                 $test $i_termio = "$define" && xxx="termio.h"
14654                 $test $i_termios = "$define" && xxx="termios.h"
14655 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14656         fi
14657 fi
14658 set i_sysioctl
14659 eval $setvar
14660
14661
14662 : see if this is a syslog.h system
14663 set syslog.h i_syslog
14664 eval $inhdr
14665
14666
14667 : see if this is a sys/mode.h system
14668 set sys/mode.h i_sysmode
14669 eval $inhdr
14670
14671 : see if sys/resource.h has to be included
14672 set sys/resource.h i_sysresrc
14673 eval $inhdr
14674
14675 : see if sys/security.h is available
14676 set sys/security.h i_syssecrt
14677 eval $inhdr
14678
14679 : see if this is a sys/statvfs.h system
14680 set sys/statvfs.h i_sysstatvfs
14681 eval $inhdr
14682
14683 : see if this is a sys/uio.h system
14684 set sys/uio.h i_sysuio
14685 eval $inhdr
14686
14687 : see if this is a sys/un.h system
14688 set sys/un.h i_sysun
14689 eval $inhdr
14690
14691
14692 : see if this is a sys/utsname.h system
14693 set sys/utsname.h i_sysutsname
14694 eval $inhdr
14695
14696 : see if this is a syswait system
14697 set sys/wait.h i_syswait
14698 eval $inhdr
14699
14700 : see if this is a ustat.h system
14701 set ustat.h i_ustat
14702 eval $inhdr
14703
14704 : see if this is an utime system
14705 set utime.h i_utime
14706 eval $inhdr
14707
14708 : see if this is a values.h system
14709 set values.h i_values
14710 eval $inhdr
14711
14712 : see if this is a vfork system
14713 case "$d_vfork" in
14714 "$define")
14715         set vfork.h i_vfork
14716         eval $inhdr
14717         ;;
14718 *)
14719         i_vfork="$undef"
14720         ;;
14721 esac
14722
14723 : see if gdbm.h is available
14724 set gdbm.h t_gdbm
14725 eval $inhdr
14726 case "$t_gdbm" in
14727 $define)
14728         : see if gdbm_open exists
14729         set gdbm_open d_gdbm_open
14730         eval $inlibc
14731         case "$d_gdbm_open" in
14732         $undef)
14733                 t_gdbm="$undef"
14734                 echo "We won't be including <gdbm.h>"
14735                 ;;
14736         esac
14737         ;;
14738 esac
14739 val="$t_gdbm"
14740 set i_gdbm
14741 eval $setvar
14742
14743 echo " "
14744 echo "Looking for extensions..." >&4
14745 : If we are using the old config.sh, known_extensions may contain
14746 : old or inaccurate or duplicate values.
14747 known_extensions=''
14748 nonxs_extensions=''
14749 : We do not use find because it might not be available.
14750 : We do not just use MANIFEST because the user may have dropped
14751 : some additional extensions into the source tree and expect them
14752 : to be built.
14753
14754 : Function to recursively find available extensions, ignoring DynaLoader
14755 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14756 find_extensions='
14757     for xxx in *; do
14758        case "$xxx" in
14759            DynaLoader|dynaload) ;;
14760            *)
14761            if $test -f $xxx/$xxx.xs; then
14762                known_extensions="$known_extensions $1$xxx";
14763            elif $test -f $xxx/Makefile.PL; then
14764                nonxs_extensions="$nonxs_extensions $1$xxx";
14765            else
14766                if $test -d $xxx -a $# -lt 10; then
14767                    set $1$xxx/ $*;
14768                    cd $xxx;
14769                    eval $find_extensions;
14770                    cd ..;
14771                    shift;
14772                fi;
14773            fi
14774            ;;
14775        esac;
14776     done'
14777 tdir=`pwd`
14778 cd $rsrc/ext
14779 set X
14780 shift
14781 eval $find_extensions
14782 set X $nonxs_extensions
14783 shift
14784 nonxs_extensions="$*"
14785 set X $known_extensions
14786 shift
14787 known_extensions="$*"
14788 cd $tdir
14789
14790 : Now see which are supported on this system.
14791 avail_ext=''
14792 for xxx in $known_extensions ; do
14793         case "$xxx" in
14794         DB_File|db_file)
14795                 case "$i_db" in
14796                 $define) avail_ext="$avail_ext $xxx" ;;
14797                 esac
14798                 ;;
14799         GDBM_File|gdbm_fil)
14800                 case "$i_gdbm" in 
14801                 $define) avail_ext="$avail_ext $xxx" ;;
14802                 esac
14803                 ;;
14804         NDBM_File|ndbm_fil)
14805                 case "$i_ndbm" in
14806                 $define)
14807                     case "$osname-$use64bitint" in
14808                     hpux-define)
14809                         case "$libs" in
14810                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14811                         esac
14812                         ;;
14813                     *) avail_ext="$avail_ext $xxx" ;;
14814                     esac
14815                     ;;
14816                 esac
14817                 ;;
14818         ODBM_File|odbm_fil) 
14819                 case "${i_dbm}${i_rpcsvcdbm}" in
14820                 *"${define}"*)
14821                     case "$osname-$use64bitint" in
14822                     hpux-define)
14823                         case "$libs" in
14824                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14825                         esac
14826                         ;;
14827                     *) avail_ext="$avail_ext $xxx" ;;
14828                     esac
14829                     ;;
14830                 esac
14831                 ;;
14832         POSIX|posix)
14833                 case "$useposix" in
14834                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14835                 esac
14836                 ;;
14837         Opcode|opcode)
14838                 case "$useopcode" in
14839                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14840                 esac
14841                 ;;
14842         Socket|socket)
14843                 case "$d_socket" in 
14844                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14845                 esac
14846                 ;;
14847         Thread|thread)
14848                 case "$usethreads" in 
14849                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14850                 esac
14851                 ;;
14852         IPC/SysV|ipc/sysv)
14853                 : XXX Do we need a useipcsysv variable here
14854                 case "${d_msg}${d_sem}${d_shm}" in 
14855                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14856                 esac
14857                 ;;
14858         *)      avail_ext="$avail_ext $xxx"
14859                 ;;
14860         esac
14861 done
14862
14863 set X $avail_ext
14864 shift
14865 avail_ext="$*"
14866
14867 : Now see which nonxs extensions are supported on this system.
14868 : For now assume all are.
14869 nonxs_ext=''
14870 for xxx in $nonxs_extensions ; do
14871         case "$xxx" in
14872         *)      nonxs_ext="$nonxs_ext $xxx"
14873                 ;;
14874         esac
14875 done
14876
14877 set X $nonxs_ext
14878 shift
14879 nonxs_ext="$*"
14880
14881 case $usedl in
14882 $define)
14883         $cat <<EOM
14884 A number of extensions are supplied with $package.  You may choose to
14885 compile these extensions for dynamic loading (the default), compile
14886 them into the $package executable (static loading), or not include
14887 them at all.  Answer "none" to include no extensions.
14888 Note that DynaLoader is always built and need not be mentioned here.
14889
14890 EOM
14891         case "$dynamic_ext" in
14892         '') dflt="$avail_ext" ;;
14893         *)      dflt="$dynamic_ext"
14894                 # Perhaps we are reusing an old out-of-date config.sh.
14895                 case "$hint" in
14896                 previous)
14897                         if test X"$dynamic_ext" != X"$avail_ext"; then
14898                                 $cat <<EOM
14899 NOTICE:  Your previous config.sh list may be incorrect. 
14900 The extensions now available to you are 
14901         ${avail_ext}
14902 but the default list from your previous config.sh is
14903         ${dynamic_ext} 
14904
14905 EOM
14906                         fi
14907                         ;;
14908                 esac
14909                 ;;
14910         esac
14911         case "$dflt" in
14912         '')     dflt=none;;
14913         esac
14914         rp="What extensions do you wish to load dynamically?"
14915         . ./myread
14916         case "$ans" in
14917         none) dynamic_ext=' ' ;;
14918         *) dynamic_ext="$ans" ;;
14919         esac
14920
14921         case "$static_ext" in
14922         '')
14923                 : Exclude those already listed in dynamic linking
14924                 dflt=''
14925                 for xxx in $avail_ext; do
14926                         case " $dynamic_ext " in
14927                         *" $xxx "*) ;;
14928                         *) dflt="$dflt $xxx" ;;
14929                         esac
14930                 done
14931                 set X $dflt
14932                 shift
14933                 dflt="$*"
14934                 ;;
14935         *)  dflt="$static_ext" 
14936                 ;;
14937         esac
14938
14939         case "$dflt" in
14940         '')     dflt=none;;
14941         esac
14942         rp="What extensions do you wish to load statically?"
14943         . ./myread
14944         case "$ans" in
14945         none) static_ext=' ' ;;
14946         *) static_ext="$ans" ;;
14947         esac
14948         ;;
14949 *)
14950         $cat <<EOM
14951 A number of extensions are supplied with $package.  Answer "none" 
14952 to include no extensions. 
14953 Note that DynaLoader is always built and need not be mentioned here.
14954
14955 EOM
14956         case "$static_ext" in
14957         '') dflt="$avail_ext" ;;
14958         *)      dflt="$static_ext"
14959                 # Perhaps we are reusing an old out-of-date config.sh.
14960                 case "$hint" in
14961                 previous)
14962                         if test X"$static_ext" != X"$avail_ext"; then
14963                                 $cat <<EOM
14964 NOTICE:  Your previous config.sh list may be incorrect. 
14965 The extensions now available to you are 
14966         ${avail_ext}
14967 but the default list from your previous config.sh is
14968         ${static_ext} 
14969
14970 EOM
14971                         fi
14972                         ;;
14973                 esac
14974                 ;;
14975         esac
14976         : Exclude those that are not xs extensions
14977         case "$dflt" in
14978         '')     dflt=none;;
14979         esac
14980         rp="What extensions do you wish to include?"
14981         . ./myread
14982         case "$ans" in
14983         none) static_ext=' ' ;;
14984         *) static_ext="$ans" ;;
14985         esac
14986         ;;
14987 esac
14988
14989 set X $dynamic_ext $static_ext $nonxs_ext
14990 shift
14991 extensions="$*"
14992
14993 : Remove build directory name from cppstdin so it can be used from
14994 : either the present location or the final installed location.
14995 echo " "
14996 : Get out of the UU directory to get correct path name.
14997 cd ..
14998 case "$cppstdin" in
14999 `pwd`/cppstdin)
15000         echo "Stripping down cppstdin path name"
15001         cppstdin=cppstdin
15002         ;;
15003 esac
15004 cd UU
15005
15006 : end of configuration questions
15007 echo " "
15008 echo "End of configuration questions."
15009 echo " "
15010
15011 : back to where it started
15012 if test -d ../UU; then
15013         cd ..
15014 fi
15015
15016 : configuration may be patched via a 'config.over' file
15017 if $test -f config.over; then
15018         echo " "
15019         dflt=y
15020         rp='I see a config.over file.  Do you wish to load it?'
15021         . UU/myread
15022         case "$ans" in
15023         n*) echo "OK, I'll ignore it.";;
15024         *)      . ./config.over
15025                 echo "Configuration override changes have been loaded."
15026                 ;;
15027         esac
15028 fi
15029
15030 : in case they want portability, strip down executable paths
15031 case "$d_portable" in
15032 "$define")
15033         echo " "
15034         echo "Stripping down executable paths..." >&4
15035         for file in $loclist $trylist; do
15036                 eval temp=\$$file
15037                 eval $file=`basename $temp`
15038         done
15039         ;;
15040 esac
15041
15042 : create config.sh file
15043 echo " "
15044 echo "Creating config.sh..." >&4
15045 $spitshell <<EOT >config.sh
15046 $startsh
15047 #
15048 # This file was produced by running the Configure script. It holds all the
15049 # definitions figured out by Configure. Should you modify one of these values,
15050 # do not forget to propagate your changes by running "Configure -der". You may
15051 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15052 #
15053
15054 # Package name      : $package
15055 # Source directory  : $src
15056 # Configuration time: $cf_time
15057 # Configured by     : $cf_by
15058 # Target system     : $myuname
15059
15060 Author='$Author'
15061 Date='$Date'
15062 Header='$Header'
15063 Id='$Id'
15064 Locker='$Locker'
15065 Log='$Log'
15066 Mcc='$Mcc'
15067 RCSfile='$RCSfile'
15068 Revision='$Revision'
15069 Source='$Source'
15070 State='$State'
15071 _a='$_a'
15072 _exe='$_exe'
15073 _o='$_o'
15074 afs='$afs'
15075 alignbytes='$alignbytes'
15076 ansi2knr='$ansi2knr'
15077 aphostname='$aphostname'
15078 api_revision='$api_revision'
15079 api_subversion='$api_subversion'
15080 api_version='$api_version'
15081 api_versionstring='$api_versionstring'
15082 ar='$ar'
15083 archlib='$archlib'
15084 archlibexp='$archlibexp'
15085 archname64='$archname64'
15086 archname='$archname'
15087 archobjs='$archobjs'
15088 awk='$awk'
15089 baserev='$baserev'
15090 bash='$bash'
15091 bin='$bin'
15092 bincompat5005='$bincompat5005'
15093 binexp='$binexp'
15094 bison='$bison'
15095 byacc='$byacc'
15096 byteorder='$byteorder'
15097 c='$c'
15098 castflags='$castflags'
15099 cat='$cat'
15100 cc='$cc'
15101 cccdlflags='$cccdlflags'
15102 ccdlflags='$ccdlflags'
15103 ccflags='$ccflags'
15104 ccsymbols='$ccsymbols'
15105 cf_by='$cf_by'
15106 cf_email='$cf_email'
15107 cf_time='$cf_time'
15108 charsize='$charsize'
15109 chgrp='$chgrp'
15110 chmod='$chmod'
15111 chown='$chown'
15112 clocktype='$clocktype'
15113 comm='$comm'
15114 compress='$compress'
15115 contains='$contains'
15116 cp='$cp'
15117 cpio='$cpio'
15118 cpp='$cpp'
15119 cpp_stuff='$cpp_stuff'
15120 cppccsymbols='$cppccsymbols'
15121 cppflags='$cppflags'
15122 cpplast='$cpplast'
15123 cppminus='$cppminus'
15124 cpprun='$cpprun'
15125 cppstdin='$cppstdin'
15126 cppsymbols='$cppsymbols'
15127 crosscompile='$crosscompile'
15128 cryptlib='$cryptlib'
15129 csh='$csh'
15130 d_Gconvert='$d_Gconvert'
15131 d_PRIEldbl='$d_PRIEldbl'
15132 d_PRIFldbl='$d_PRIFldbl'
15133 d_PRIGldbl='$d_PRIGldbl'
15134 d_PRIX64='$d_PRIX64'
15135 d_PRId64='$d_PRId64'
15136 d_PRIeldbl='$d_PRIeldbl'
15137 d_PRIfldbl='$d_PRIfldbl'
15138 d_PRIgldbl='$d_PRIgldbl'
15139 d_PRIi64='$d_PRIi64'
15140 d_PRIo64='$d_PRIo64'
15141 d_PRIu64='$d_PRIu64'
15142 d_PRIx64='$d_PRIx64'
15143 d_access='$d_access'
15144 d_accessx='$d_accessx'
15145 d_alarm='$d_alarm'
15146 d_archlib='$d_archlib'
15147 d_atolf='$d_atolf'
15148 d_atoll='$d_atoll'
15149 d_attribut='$d_attribut'
15150 d_bcmp='$d_bcmp'
15151 d_bcopy='$d_bcopy'
15152 d_bincompat5005='$d_bincompat5005'
15153 d_bsd='$d_bsd'
15154 d_bsdgetpgrp='$d_bsdgetpgrp'
15155 d_bsdsetpgrp='$d_bsdsetpgrp'
15156 d_bzero='$d_bzero'
15157 d_casti32='$d_casti32'
15158 d_castneg='$d_castneg'
15159 d_charvspr='$d_charvspr'
15160 d_chown='$d_chown'
15161 d_chroot='$d_chroot'
15162 d_chsize='$d_chsize'
15163 d_closedir='$d_closedir'
15164 d_const='$d_const'
15165 d_crypt='$d_crypt'
15166 d_csh='$d_csh'
15167 d_cuserid='$d_cuserid'
15168 d_dbl_dig='$d_dbl_dig'
15169 d_difftime='$d_difftime'
15170 d_dirnamlen='$d_dirnamlen'
15171 d_dlerror='$d_dlerror'
15172 d_dlopen='$d_dlopen'
15173 d_dlsymun='$d_dlsymun'
15174 d_dosuid='$d_dosuid'
15175 d_drand48proto='$d_drand48proto'
15176 d_dup2='$d_dup2'
15177 d_eaccess='$d_eaccess'
15178 d_endgrent='$d_endgrent'
15179 d_endhent='$d_endhent'
15180 d_endnent='$d_endnent'
15181 d_endpent='$d_endpent'
15182 d_endpwent='$d_endpwent'
15183 d_endsent='$d_endsent'
15184 d_endspent='$d_endspent'
15185 d_eofnblk='$d_eofnblk'
15186 d_eunice='$d_eunice'
15187 d_fchmod='$d_fchmod'
15188 d_fchown='$d_fchown'
15189 d_fcntl='$d_fcntl'
15190 d_fd_macros='$d_fd_macros'
15191 d_fd_set='$d_fd_set'
15192 d_fds_bits='$d_fds_bits'
15193 d_fgetpos='$d_fgetpos'
15194 d_flexfnam='$d_flexfnam'
15195 d_flock='$d_flock'
15196 d_fork='$d_fork'
15197 d_fpathconf='$d_fpathconf'
15198 d_fpos64_t='$d_fpos64_t'
15199 d_frexpl='$d_frexpl'
15200 d_fs_data_s='$d_fs_data_s'
15201 d_fseeko='$d_fseeko'
15202 d_fsetpos='$d_fsetpos'
15203 d_fstatfs='$d_fstatfs'
15204 d_fstatvfs='$d_fstatvfs'
15205 d_ftello='$d_ftello'
15206 d_ftime='$d_ftime'
15207 d_getcwd='$d_getcwd'
15208 d_getfsstat='$d_getfsstat'
15209 d_getgrent='$d_getgrent'
15210 d_getgrps='$d_getgrps'
15211 d_gethbyaddr='$d_gethbyaddr'
15212 d_gethbyname='$d_gethbyname'
15213 d_gethent='$d_gethent'
15214 d_gethname='$d_gethname'
15215 d_gethostprotos='$d_gethostprotos'
15216 d_getlogin='$d_getlogin'
15217 d_getmnt='$d_getmnt'
15218 d_getmntent='$d_getmntent'
15219 d_getnbyaddr='$d_getnbyaddr'
15220 d_getnbyname='$d_getnbyname'
15221 d_getnent='$d_getnent'
15222 d_getnetprotos='$d_getnetprotos'
15223 d_getpbyname='$d_getpbyname'
15224 d_getpbynumber='$d_getpbynumber'
15225 d_getpent='$d_getpent'
15226 d_getpgid='$d_getpgid'
15227 d_getpgrp2='$d_getpgrp2'
15228 d_getpgrp='$d_getpgrp'
15229 d_getppid='$d_getppid'
15230 d_getprior='$d_getprior'
15231 d_getprotoprotos='$d_getprotoprotos'
15232 d_getpwent='$d_getpwent'
15233 d_getsbyname='$d_getsbyname'
15234 d_getsbyport='$d_getsbyport'
15235 d_getsent='$d_getsent'
15236 d_getservprotos='$d_getservprotos'
15237 d_getspent='$d_getspent'
15238 d_getspnam='$d_getspnam'
15239 d_gettimeod='$d_gettimeod'
15240 d_gnulibc='$d_gnulibc'
15241 d_grpasswd='$d_grpasswd'
15242 d_hasmntopt='$d_hasmntopt'
15243 d_htonl='$d_htonl'
15244 d_iconv='$d_iconv'
15245 d_index='$d_index'
15246 d_inetaton='$d_inetaton'
15247 d_int64_t='$d_int64_t'
15248 d_isascii='$d_isascii'
15249 d_isnan='$d_isnan'
15250 d_isnanl='$d_isnanl'
15251 d_killpg='$d_killpg'
15252 d_lchown='$d_lchown'
15253 d_ldbl_dig='$d_ldbl_dig'
15254 d_link='$d_link'
15255 d_locconv='$d_locconv'
15256 d_lockf='$d_lockf'
15257 d_longdbl='$d_longdbl'
15258 d_longlong='$d_longlong'
15259 d_lseekproto='$d_lseekproto'
15260 d_lstat='$d_lstat'
15261 d_madvise='$d_madvise'
15262 d_mblen='$d_mblen'
15263 d_mbstowcs='$d_mbstowcs'
15264 d_mbtowc='$d_mbtowc'
15265 d_memchr='$d_memchr'
15266 d_memcmp='$d_memcmp'
15267 d_memcpy='$d_memcpy'
15268 d_memmove='$d_memmove'
15269 d_memset='$d_memset'
15270 d_mkdir='$d_mkdir'
15271 d_mkdtemp='$d_mkdtemp'
15272 d_mkfifo='$d_mkfifo'
15273 d_mkstemp='$d_mkstemp'
15274 d_mkstemps='$d_mkstemps'
15275 d_mktime='$d_mktime'
15276 d_mmap='$d_mmap'
15277 d_modfl='$d_modfl'
15278 d_mprotect='$d_mprotect'
15279 d_msg='$d_msg'
15280 d_msg_ctrunc='$d_msg_ctrunc'
15281 d_msg_dontroute='$d_msg_dontroute'
15282 d_msg_oob='$d_msg_oob'
15283 d_msg_peek='$d_msg_peek'
15284 d_msg_proxy='$d_msg_proxy'
15285 d_msgctl='$d_msgctl'
15286 d_msgget='$d_msgget'
15287 d_msgrcv='$d_msgrcv'
15288 d_msgsnd='$d_msgsnd'
15289 d_msync='$d_msync'
15290 d_munmap='$d_munmap'
15291 d_mymalloc='$d_mymalloc'
15292 d_nice='$d_nice'
15293 d_nv_preserves_uv='$d_nv_preserves_uv'
15294 d_off64_t='$d_off64_t'
15295 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15296 d_oldpthreads='$d_oldpthreads'
15297 d_oldsock='$d_oldsock'
15298 d_open3='$d_open3'
15299 d_pathconf='$d_pathconf'
15300 d_pause='$d_pause'
15301 d_phostname='$d_phostname'
15302 d_pipe='$d_pipe'
15303 d_poll='$d_poll'
15304 d_portable='$d_portable'
15305 d_pthread_yield='$d_pthread_yield'
15306 d_pwage='$d_pwage'
15307 d_pwchange='$d_pwchange'
15308 d_pwclass='$d_pwclass'
15309 d_pwcomment='$d_pwcomment'
15310 d_pwexpire='$d_pwexpire'
15311 d_pwgecos='$d_pwgecos'
15312 d_pwpasswd='$d_pwpasswd'
15313 d_pwquota='$d_pwquota'
15314 d_qgcvt='$d_qgcvt'
15315 d_quad='$d_quad'
15316 d_readdir='$d_readdir'
15317 d_readlink='$d_readlink'
15318 d_rename='$d_rename'
15319 d_rewinddir='$d_rewinddir'
15320 d_rmdir='$d_rmdir'
15321 d_safebcpy='$d_safebcpy'
15322 d_safemcpy='$d_safemcpy'
15323 d_sanemcmp='$d_sanemcmp'
15324 d_sched_yield='$d_sched_yield'
15325 d_scm_rights='$d_scm_rights'
15326 d_seekdir='$d_seekdir'
15327 d_select='$d_select'
15328 d_sem='$d_sem'
15329 d_semctl='$d_semctl'
15330 d_semctl_semid_ds='$d_semctl_semid_ds'
15331 d_semctl_semun='$d_semctl_semun'
15332 d_semget='$d_semget'
15333 d_semop='$d_semop'
15334 d_setegid='$d_setegid'
15335 d_seteuid='$d_seteuid'
15336 d_setgrent='$d_setgrent'
15337 d_setgrps='$d_setgrps'
15338 d_sethent='$d_sethent'
15339 d_setlinebuf='$d_setlinebuf'
15340 d_setlocale='$d_setlocale'
15341 d_setnent='$d_setnent'
15342 d_setpent='$d_setpent'
15343 d_setpgid='$d_setpgid'
15344 d_setpgrp2='$d_setpgrp2'
15345 d_setpgrp='$d_setpgrp'
15346 d_setprior='$d_setprior'
15347 d_setpwent='$d_setpwent'
15348 d_setregid='$d_setregid'
15349 d_setresgid='$d_setresgid'
15350 d_setresuid='$d_setresuid'
15351 d_setreuid='$d_setreuid'
15352 d_setrgid='$d_setrgid'
15353 d_setruid='$d_setruid'
15354 d_setsent='$d_setsent'
15355 d_setsid='$d_setsid'
15356 d_setspent='$d_setspent'
15357 d_setvbuf='$d_setvbuf'
15358 d_sfio='$d_sfio'
15359 d_shm='$d_shm'
15360 d_shmat='$d_shmat'
15361 d_shmatprototype='$d_shmatprototype'
15362 d_shmctl='$d_shmctl'
15363 d_shmdt='$d_shmdt'
15364 d_shmget='$d_shmget'
15365 d_sigaction='$d_sigaction'
15366 d_sigsetjmp='$d_sigsetjmp'
15367 d_socket='$d_socket'
15368 d_socklen_t='$d_socklen_t'
15369 d_sockpair='$d_sockpair'
15370 d_sqrtl='$d_sqrtl'
15371 d_statblks='$d_statblks'
15372 d_statfs_f_flags='$d_statfs_f_flags'
15373 d_statfs_s='$d_statfs_s'
15374 d_statvfs='$d_statvfs'
15375 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15376 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15377 d_stdio_stream_array='$d_stdio_stream_array'
15378 d_stdiobase='$d_stdiobase'
15379 d_stdstdio='$d_stdstdio'
15380 d_strchr='$d_strchr'
15381 d_strcoll='$d_strcoll'
15382 d_strctcpy='$d_strctcpy'
15383 d_strerrm='$d_strerrm'
15384 d_strerror='$d_strerror'
15385 d_strtod='$d_strtod'
15386 d_strtol='$d_strtol'
15387 d_strtold='$d_strtold'
15388 d_strtoll='$d_strtoll'
15389 d_strtoul='$d_strtoul'
15390 d_strtoull='$d_strtoull'
15391 d_strtouq='$d_strtouq'
15392 d_strxfrm='$d_strxfrm'
15393 d_suidsafe='$d_suidsafe'
15394 d_symlink='$d_symlink'
15395 d_syscall='$d_syscall'
15396 d_sysconf='$d_sysconf'
15397 d_sysernlst='$d_sysernlst'
15398 d_syserrlst='$d_syserrlst'
15399 d_system='$d_system'
15400 d_tcgetpgrp='$d_tcgetpgrp'
15401 d_tcsetpgrp='$d_tcsetpgrp'
15402 d_telldir='$d_telldir'
15403 d_telldirproto='$d_telldirproto'
15404 d_time='$d_time'
15405 d_times='$d_times'
15406 d_truncate='$d_truncate'
15407 d_tzname='$d_tzname'
15408 d_umask='$d_umask'
15409 d_uname='$d_uname'
15410 d_union_semun='$d_union_semun'
15411 d_ustat='$d_ustat'
15412 d_vendorarch='$d_vendorarch'
15413 d_vendorbin='$d_vendorbin'
15414 d_vendorlib='$d_vendorlib'
15415 d_vfork='$d_vfork'
15416 d_void_closedir='$d_void_closedir'
15417 d_voidsig='$d_voidsig'
15418 d_voidtty='$d_voidtty'
15419 d_volatile='$d_volatile'
15420 d_vprintf='$d_vprintf'
15421 d_wait4='$d_wait4'
15422 d_waitpid='$d_waitpid'
15423 d_wcstombs='$d_wcstombs'
15424 d_wctomb='$d_wctomb'
15425 d_xenix='$d_xenix'
15426 date='$date'
15427 db_hashtype='$db_hashtype'
15428 db_prefixtype='$db_prefixtype'
15429 defvoidused='$defvoidused'
15430 direntrytype='$direntrytype'
15431 dlext='$dlext'
15432 dlsrc='$dlsrc'
15433 doublesize='$doublesize'
15434 drand01='$drand01'
15435 dynamic_ext='$dynamic_ext'
15436 eagain='$eagain'
15437 ebcdic='$ebcdic'
15438 echo='$echo'
15439 egrep='$egrep'
15440 emacs='$emacs'
15441 eunicefix='$eunicefix'
15442 exe_ext='$exe_ext'
15443 expr='$expr'
15444 extensions='$extensions'
15445 fflushNULL='$fflushNULL'
15446 fflushall='$fflushall'
15447 find='$find'
15448 firstmakefile='$firstmakefile'
15449 flex='$flex'
15450 fpossize='$fpossize'
15451 fpostype='$fpostype'
15452 freetype='$freetype'
15453 full_ar='$full_ar'
15454 full_csh='$full_csh'
15455 full_sed='$full_sed'
15456 gccversion='$gccversion'
15457 gidformat='$gidformat'
15458 gidsign='$gidsign'
15459 gidsize='$gidsize'
15460 gidtype='$gidtype'
15461 glibpth='$glibpth'
15462 grep='$grep'
15463 groupcat='$groupcat'
15464 groupstype='$groupstype'
15465 gzip='$gzip'
15466 h_fcntl='$h_fcntl'
15467 h_sysfile='$h_sysfile'
15468 hint='$hint'
15469 hostcat='$hostcat'
15470 huge='$huge'
15471 i16size='$i16size'
15472 i16type='$i16type'
15473 i32size='$i32size'
15474 i32type='$i32type'
15475 i64size='$i64size'
15476 i64type='$i64type'
15477 i8size='$i8size'
15478 i8type='$i8type'
15479 i_arpainet='$i_arpainet'
15480 i_bsdioctl='$i_bsdioctl'
15481 i_db='$i_db'
15482 i_dbm='$i_dbm'
15483 i_dirent='$i_dirent'
15484 i_dld='$i_dld'
15485 i_dlfcn='$i_dlfcn'
15486 i_fcntl='$i_fcntl'
15487 i_float='$i_float'
15488 i_gdbm='$i_gdbm'
15489 i_grp='$i_grp'
15490 i_iconv='$i_iconv'
15491 i_ieeefp='$i_ieeefp'
15492 i_inttypes='$i_inttypes'
15493 i_limits='$i_limits'
15494 i_locale='$i_locale'
15495 i_machcthr='$i_machcthr'
15496 i_malloc='$i_malloc'
15497 i_math='$i_math'
15498 i_memory='$i_memory'
15499 i_mntent='$i_mntent'
15500 i_ndbm='$i_ndbm'
15501 i_netdb='$i_netdb'
15502 i_neterrno='$i_neterrno'
15503 i_netinettcp='$i_netinettcp'
15504 i_niin='$i_niin'
15505 i_poll='$i_poll'
15506 i_pthread='$i_pthread'
15507 i_pwd='$i_pwd'
15508 i_rpcsvcdbm='$i_rpcsvcdbm'
15509 i_sfio='$i_sfio'
15510 i_sgtty='$i_sgtty'
15511 i_shadow='$i_shadow'
15512 i_socks='$i_socks'
15513 i_stdarg='$i_stdarg'
15514 i_stddef='$i_stddef'
15515 i_stdlib='$i_stdlib'
15516 i_string='$i_string'
15517 i_sunmath='$i_sunmath'
15518 i_sysaccess='$i_sysaccess'
15519 i_sysdir='$i_sysdir'
15520 i_sysfile='$i_sysfile'
15521 i_sysfilio='$i_sysfilio'
15522 i_sysin='$i_sysin'
15523 i_sysioctl='$i_sysioctl'
15524 i_syslog='$i_syslog'
15525 i_sysmman='$i_sysmman'
15526 i_sysmode='$i_sysmode'
15527 i_sysmount='$i_sysmount'
15528 i_sysndir='$i_sysndir'
15529 i_sysparam='$i_sysparam'
15530 i_sysresrc='$i_sysresrc'
15531 i_syssecrt='$i_syssecrt'
15532 i_sysselct='$i_sysselct'
15533 i_syssockio='$i_syssockio'
15534 i_sysstat='$i_sysstat'
15535 i_sysstatfs='$i_sysstatfs'
15536 i_sysstatvfs='$i_sysstatvfs'
15537 i_systime='$i_systime'
15538 i_systimek='$i_systimek'
15539 i_systimes='$i_systimes'
15540 i_systypes='$i_systypes'
15541 i_sysuio='$i_sysuio'
15542 i_sysun='$i_sysun'
15543 i_sysutsname='$i_sysutsname'
15544 i_sysvfs='$i_sysvfs'
15545 i_syswait='$i_syswait'
15546 i_termio='$i_termio'
15547 i_termios='$i_termios'
15548 i_time='$i_time'
15549 i_unistd='$i_unistd'
15550 i_ustat='$i_ustat'
15551 i_utime='$i_utime'
15552 i_values='$i_values'
15553 i_varargs='$i_varargs'
15554 i_varhdr='$i_varhdr'
15555 i_vfork='$i_vfork'
15556 ignore_versioned_solibs='$ignore_versioned_solibs'
15557 inc_version_list='$inc_version_list'
15558 inc_version_list_init='$inc_version_list_init'
15559 incpath='$incpath'
15560 inews='$inews'
15561 installarchlib='$installarchlib'
15562 installbin='$installbin'
15563 installman1dir='$installman1dir'
15564 installman3dir='$installman3dir'
15565 installprefix='$installprefix'
15566 installprefixexp='$installprefixexp'
15567 installprivlib='$installprivlib'
15568 installscript='$installscript'
15569 installsitearch='$installsitearch'
15570 installsitebin='$installsitebin'
15571 installsitelib='$installsitelib'
15572 installstyle='$installstyle'
15573 installusrbinperl='$installusrbinperl'
15574 installvendorarch='$installvendorarch'
15575 installvendorbin='$installvendorbin'
15576 installvendorlib='$installvendorlib'
15577 intsize='$intsize'
15578 ivdformat='$ivdformat'
15579 ivsize='$ivsize'
15580 ivtype='$ivtype'
15581 known_extensions='$known_extensions'
15582 ksh='$ksh'
15583 large='$large'
15584 ld='$ld'
15585 lddlflags='$lddlflags'
15586 ldflags='$ldflags'
15587 ldlibpthname='$ldlibpthname'
15588 less='$less'
15589 lib_ext='$lib_ext'
15590 libc='$libc'
15591 libperl='$libperl'
15592 libpth='$libpth'
15593 libs='$libs'
15594 libsdirs='$libsdirs'
15595 libsfiles='$libsfiles'
15596 libsfound='$libsfound'
15597 libspath='$libspath'
15598 libswanted='$libswanted'
15599 line='$line'
15600 lint='$lint'
15601 lkflags='$lkflags'
15602 ln='$ln'
15603 lns='$lns'
15604 locincpth='$locincpth'
15605 loclibpth='$loclibpth'
15606 longdblsize='$longdblsize'
15607 longlongsize='$longlongsize'
15608 longsize='$longsize'
15609 lp='$lp'
15610 lpr='$lpr'
15611 ls='$ls'
15612 lseeksize='$lseeksize'
15613 lseektype='$lseektype'
15614 mail='$mail'
15615 mailx='$mailx'
15616 make='$make'
15617 make_set_make='$make_set_make'
15618 mallocobj='$mallocobj'
15619 mallocsrc='$mallocsrc'
15620 malloctype='$malloctype'
15621 man1dir='$man1dir'
15622 man1direxp='$man1direxp'
15623 man1ext='$man1ext'
15624 man3dir='$man3dir'
15625 man3direxp='$man3direxp'
15626 man3ext='$man3ext'
15627 medium='$medium'
15628 mips_type='$mips_type'
15629 mkdir='$mkdir'
15630 mmaptype='$mmaptype'
15631 models='$models'
15632 modetype='$modetype'
15633 more='$more'
15634 multiarch='$multiarch'
15635 mv='$mv'
15636 myarchname='$myarchname'
15637 mydomain='$mydomain'
15638 myhostname='$myhostname'
15639 myuname='$myuname'
15640 n='$n'
15641 netdb_hlen_type='$netdb_hlen_type'
15642 netdb_host_type='$netdb_host_type'
15643 netdb_name_type='$netdb_name_type'
15644 netdb_net_type='$netdb_net_type'
15645 nm='$nm'
15646 nm_opt='$nm_opt'
15647 nm_so_opt='$nm_so_opt'
15648 nonxs_ext='$nonxs_ext'
15649 nroff='$nroff'
15650 nvsize='$nvsize'
15651 nvtype='$nvtype'
15652 o_nonblock='$o_nonblock'
15653 obj_ext='$obj_ext'
15654 old_pthread_create_joinable='$old_pthread_create_joinable'
15655 optimize='$optimize'
15656 orderlib='$orderlib'
15657 osname='$osname'
15658 osvers='$osvers'
15659 package='$package'
15660 pager='$pager'
15661 passcat='$passcat'
15662 patchlevel='$patchlevel'
15663 path_sep='$path_sep'
15664 perl5='$perl5'
15665 perl='$perl'
15666 perladmin='$perladmin'
15667 perlpath='$perlpath'
15668 pg='$pg'
15669 phostname='$phostname'
15670 pidtype='$pidtype'
15671 plibpth='$plibpth'
15672 pm_apiversion='$pm_apiversion'
15673 pmake='$pmake'
15674 pr='$pr'
15675 prefix='$prefix'
15676 prefixexp='$prefixexp'
15677 privlib='$privlib'
15678 privlibexp='$privlibexp'
15679 prototype='$prototype'
15680 ptrsize='$ptrsize'
15681 quadkind='$quadkind'
15682 quadtype='$quadtype'
15683 randbits='$randbits'
15684 randfunc='$randfunc'
15685 randseedtype='$randseedtype'
15686 ranlib='$ranlib'
15687 rd_nodata='$rd_nodata'
15688 revision='$revision'
15689 rm='$rm'
15690 rmail='$rmail'
15691 runnm='$runnm'
15692 sPRIEldbl='$sPRIEldbl'
15693 sPRIFldbl='$sPRIFldbl'
15694 sPRIGldbl='$sPRIGldbl'
15695 sPRIX64='$sPRIX64'
15696 sPRId64='$sPRId64'
15697 sPRIeldbl='$sPRIeldbl'
15698 sPRIfldbl='$sPRIfldbl'
15699 sPRIgldbl='$sPRIgldbl'
15700 sPRIi64='$sPRIi64'
15701 sPRIo64='$sPRIo64'
15702 sPRIu64='$sPRIu64'
15703 sPRIx64='$sPRIx64'
15704 sched_yield='$sched_yield'
15705 scriptdir='$scriptdir'
15706 scriptdirexp='$scriptdirexp'
15707 sed='$sed'
15708 seedfunc='$seedfunc'
15709 selectminbits='$selectminbits'
15710 selecttype='$selecttype'
15711 sendmail='$sendmail'
15712 sh='$sh'
15713 shar='$shar'
15714 sharpbang='$sharpbang'
15715 shmattype='$shmattype'
15716 shortsize='$shortsize'
15717 shrpenv='$shrpenv'
15718 shsharp='$shsharp'
15719 sig_count='$sig_count'
15720 sig_name='$sig_name'
15721 sig_name_init='$sig_name_init'
15722 sig_num='$sig_num'
15723 sig_num_init='$sig_num_init'
15724 signal_t='$signal_t'
15725 sitearch='$sitearch'
15726 sitearchexp='$sitearchexp'
15727 sitebin='$sitebin'
15728 sitebinexp='$sitebinexp'
15729 sitelib='$sitelib'
15730 sitelib_stem='$sitelib_stem'
15731 sitelibexp='$sitelibexp'
15732 siteprefix='$siteprefix'
15733 siteprefixexp='$siteprefixexp'
15734 sizesize='$sizesize'
15735 sizetype='$sizetype'
15736 sleep='$sleep'
15737 smail='$smail'
15738 small='$small'
15739 so='$so'
15740 sockethdr='$sockethdr'
15741 socketlib='$socketlib'
15742 socksizetype='$socksizetype'
15743 sort='$sort'
15744 spackage='$spackage'
15745 spitshell='$spitshell'
15746 split='$split'
15747 src='$src'
15748 ssizetype='$ssizetype'
15749 startperl='$startperl'
15750 startsh='$startsh'
15751 static_ext='$static_ext'
15752 stdchar='$stdchar'
15753 stdio_base='$stdio_base'
15754 stdio_bufsiz='$stdio_bufsiz'
15755 stdio_cnt='$stdio_cnt'
15756 stdio_filbuf='$stdio_filbuf'
15757 stdio_ptr='$stdio_ptr'
15758 stdio_stream_array='$stdio_stream_array'
15759 strings='$strings'
15760 submit='$submit'
15761 subversion='$subversion'
15762 sysman='$sysman'
15763 tail='$tail'
15764 tar='$tar'
15765 tbl='$tbl'
15766 tee='$tee'
15767 test='$test'
15768 timeincl='$timeincl'
15769 timetype='$timetype'
15770 touch='$touch'
15771 tr='$tr'
15772 trnl='$trnl'
15773 troff='$troff'
15774 u16size='$u16size'
15775 u16type='$u16type'
15776 u32size='$u32size'
15777 u32type='$u32type'
15778 u64size='$u64size'
15779 u64type='$u64type'
15780 u8size='$u8size'
15781 u8type='$u8type'
15782 uidformat='$uidformat'
15783 uidsign='$uidsign'
15784 uidsize='$uidsize'
15785 uidtype='$uidtype'
15786 uname='$uname'
15787 uniq='$uniq'
15788 uquadtype='$uquadtype'
15789 use5005threads='$use5005threads'
15790 use64bitall='$use64bitall'
15791 use64bitint='$use64bitint'
15792 usedl='$usedl'
15793 useithreads='$useithreads'
15794 uselargefiles='$uselargefiles'
15795 uselongdouble='$uselongdouble'
15796 usemorebits='$usemorebits'
15797 usemultiplicity='$usemultiplicity'
15798 usemymalloc='$usemymalloc'
15799 usenm='$usenm'
15800 useopcode='$useopcode'
15801 useperlio='$useperlio'
15802 useposix='$useposix'
15803 usesfio='$usesfio'
15804 useshrplib='$useshrplib'
15805 usesocks='$usesocks'
15806 usethreads='$usethreads'
15807 usevendorprefix='$usevendorprefix'
15808 usevfork='$usevfork'
15809 usrinc='$usrinc'
15810 uuname='$uuname'
15811 uvoformat='$uvoformat'
15812 uvsize='$uvsize'
15813 uvtype='$uvtype'
15814 uvuformat='$uvuformat'
15815 uvxformat='$uvxformat'
15816 vendorarch='$vendorarch'
15817 vendorarchexp='$vendorarchexp'
15818 vendorbin='$vendorbin'
15819 vendorbinexp='$vendorbinexp'
15820 vendorlib='$vendorlib'
15821 vendorlib_stem='$vendorlib_stem'
15822 vendorlibexp='$vendorlibexp'
15823 vendorprefix='$vendorprefix'
15824 vendorprefixexp='$vendorprefixexp'
15825 version='$version'
15826 vi='$vi'
15827 voidflags='$voidflags'
15828 xlibpth='$xlibpth'
15829 xs_apiversion='$xs_apiversion'
15830 zcat='$zcat'
15831 zip='$zip'
15832 EOT
15833
15834 : Add in command line options if available
15835 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15836
15837 : add special variables
15838 $test -f $src/patchlevel.h && \
15839 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15840 echo "CONFIGDOTSH=true" >>config.sh
15841
15842 : propagate old symbols
15843 if $test -f UU/config.sh; then
15844         <UU/config.sh sort | uniq >UU/oldconfig.sh
15845         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15846         sort | uniq -u >UU/oldsyms
15847         set X `cat UU/oldsyms`
15848         shift
15849         case $# in
15850         0) ;;
15851         *)
15852                 cat <<EOM
15853 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15854 EOM
15855                 echo "# Variables propagated from previous config.sh file." >>config.sh
15856                 for sym in `cat UU/oldsyms`; do
15857                         echo "    Propagating $hint variable "'$'"$sym..."
15858                         eval 'tmp="$'"${sym}"'"'
15859                         echo "$tmp" | \
15860                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15861                 done
15862                 ;;
15863         esac
15864 fi
15865
15866 : Finish up by extracting the .SH files
15867 case "$alldone" in
15868 exit)
15869         $rm -rf UU
15870         echo "Done."
15871         exit 0
15872         ;;
15873 cont)
15874         ;;
15875 '')
15876         dflt=''
15877         nostick=true
15878         $cat <<EOM
15879
15880 If you'd like to make any changes to the config.sh file before I begin
15881 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15882
15883 EOM
15884         rp="Press return or use a shell escape to edit config.sh:"
15885         . UU/myread
15886         nostick=''
15887         case "$ans" in
15888         '') ;;
15889         *) : in case they cannot read
15890                 sh 1>&4 -c "$ans";;
15891         esac
15892         ;;
15893 esac
15894
15895 : if this fails, just run all the .SH files by hand
15896 . ./config.sh
15897
15898 echo " "
15899 exec 1>&4
15900 . ./UU/extract
15901
15902 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15903         dflt=y
15904         case "$silent" in
15905         true) ;;
15906         *)
15907                 $cat <<EOM
15908
15909 Now you need to generate make dependencies by running "$make depend".
15910 You might prefer to run it in background: "$make depend > makedepend.out &"
15911 It can take a while, so you might not want to run it right now.
15912
15913 EOM
15914                 ;;
15915         esac
15916         rp="Run $make depend now?"
15917         . UU/myread
15918         case "$ans" in
15919         y*)
15920                 $make depend && echo "Now you must run a $make."
15921                 ;;
15922         *)
15923                 echo "You must run '$make depend' then '$make'."
15924                 ;;
15925         esac
15926 elif test -f [Mm]akefile; then
15927         echo " "
15928         echo "Now you must run a $make."
15929 else
15930         echo "Done."
15931 fi
15932
15933 if $test -f Policy.sh; then
15934     $cat <<EOM
15935
15936 If you compile $package on a different machine or from a different object
15937 directory, copy the Policy.sh file from this object directory to the
15938 new one before you run Configure -- this will help you with most of
15939 the policy defaults.
15940
15941 EOM
15942 fi
15943 if $test -f config.msg; then
15944     echo "Hmm.  I also noted the following information while running:"
15945     echo " "
15946     $cat config.msg >&4
15947     $rm -f config.msg
15948 fi
15949 $rm -f kit*isdone ark*isdone
15950 $rm -rf UU
15951
15952 : End of Configure
15953