&HUGE_VAL is not defined, it exists.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Fri Apr 28 23:33:15 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 d_perl_otherlibdirs=''
783 otherlibdirs=''
784 package=''
785 spackage=''
786 pager=''
787 api_revision=''
788 api_subversion=''
789 api_version=''
790 api_versionstring=''
791 patchlevel=''
792 revision=''
793 subversion=''
794 version=''
795 perl5=''
796 perladmin=''
797 perlpath=''
798 d_nv_preserves_uv=''
799 i16size=''
800 i16type=''
801 i32size=''
802 i32type=''
803 i64size=''
804 i64type=''
805 i8size=''
806 i8type=''
807 ivsize=''
808 ivtype=''
809 nvsize=''
810 nvtype=''
811 u16size=''
812 u16type=''
813 u32size=''
814 u32type=''
815 u64size=''
816 u64type=''
817 u8size=''
818 u8type=''
819 uvsize=''
820 uvtype=''
821 ivdformat=''
822 uvoformat=''
823 uvuformat=''
824 uvxformat=''
825 pidtype=''
826 prefix=''
827 prefixexp=''
828 installprivlib=''
829 privlib=''
830 privlibexp=''
831 prototype=''
832 ptrsize=''
833 d_PRIX64=''
834 d_PRId64=''
835 d_PRIi64=''
836 d_PRIo64=''
837 d_PRIu64=''
838 d_PRIx64=''
839 sPRIX64=''
840 sPRId64=''
841 sPRIi64=''
842 sPRIo64=''
843 sPRIu64=''
844 sPRIx64=''
845 d_quad=''
846 quadkind=''
847 quadtype=''
848 uquadtype=''
849 drand01=''
850 randbits=''
851 randfunc=''
852 randseedtype=''
853 seedfunc=''
854 installscript=''
855 scriptdir=''
856 scriptdirexp=''
857 selectminbits=''
858 selecttype=''
859 sh=''
860 sig_count=''
861 sig_name=''
862 sig_name_init=''
863 sig_num=''
864 sig_num_init=''
865 installsitearch=''
866 sitearch=''
867 sitearchexp=''
868 installsitebin=''
869 sitebin=''
870 sitebinexp=''
871 installsitelib=''
872 sitelib=''
873 sitelib_stem=''
874 sitelibexp=''
875 siteprefix=''
876 siteprefixexp=''
877 sizesize=''
878 sizetype=''
879 so=''
880 socksizetype=''
881 sharpbang=''
882 shsharp=''
883 spitshell=''
884 src=''
885 ssizetype=''
886 startperl=''
887 startsh=''
888 stdchar=''
889 d_stdio_stream_array=''
890 stdio_stream_array=''
891 sysman=''
892 trnl=''
893 uidformat=''
894 uidsign=''
895 uidsize=''
896 uidtype=''
897 archname64=''
898 use64bitall=''
899 use64bitint=''
900 uselargefiles=''
901 uselongdouble=''
902 usemorebits=''
903 usemultiplicity=''
904 nm_opt=''
905 nm_so_opt=''
906 runnm=''
907 usenm=''
908 useperlio=''
909 usesocks=''
910 d_oldpthreads=''
911 use5005threads=''
912 useithreads=''
913 usethreads=''
914 incpath=''
915 mips_type=''
916 usrinc=''
917 d_vendorarch=''
918 installvendorarch=''
919 vendorarch=''
920 vendorarchexp=''
921 d_vendorbin=''
922 installvendorbin=''
923 vendorbin=''
924 vendorbinexp=''
925 d_vendorlib=''
926 installvendorlib=''
927 vendorlib=''
928 vendorlib_stem=''
929 vendorlibexp=''
930 usevendorprefix=''
931 vendorprefix=''
932 vendorprefixexp=''
933 defvoidused=''
934 voidflags=''
935 pm_apiversion=''
936 xs_apiversion=''
937 CONFIG=''
938
939 define='define'
940 undef='undef'
941 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
942 rmlist=''
943
944 : We must find out about Eunice early
945 eunicefix=':'
946 if test -f /etc/unixtovms; then
947         eunicefix=/etc/unixtovms
948 fi
949 if test -f /etc/unixtovms.exe; then
950         eunicefix=/etc/unixtovms.exe
951 fi
952
953 i_whoami=''
954 : set useposix=false in your hint file to disable the POSIX extension.
955 useposix=true
956 : set useopcode=false in your hint file to disable the Opcode extension.
957 useopcode=true
958 : Trailing extension.  Override this in a hint file, if needed.
959 _exe=''
960 : Extra object files, if any, needed on this platform.
961 archobjs=''
962 : Possible local include directories to search.
963 : Set locincpth to "" in a hint file to defeat local include searches.
964 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
965 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
966 :
967 : no include file wanted by default
968 inclwanted=''
969
970 groupstype=''
971 : change the next line if compiling for Xenix/286 on Xenix/386
972 xlibpth='/usr/lib/386 /lib/386'
973 : Possible local library directories to search.
974 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
975 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
976
977 : general looking path for locating libraries
978 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
979 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
980 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
981 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
982 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
983
984 : Private path used by Configure to find libraries.  Its value
985 : is prepended to libpth. This variable takes care of special
986 : machines, like the mips.  Usually, it should be empty.
987 plibpth=''
988
989 : default library list
990 libswanted=''
991 : some systems want to use only the non-versioned libso:s
992 ignore_versioned_solibs=''
993 : set usemultiplicity on the Configure command line to enable multiplicity.
994 : set usesocks on the Configure command line to enable socks.
995 : set usethreads on the Configure command line to enable threads.
996 : full support for void wanted by default
997 defvoidused=15
998
999 : List of libraries we want.
1000 : If anyone needs -lnet, put it in a hint file.
1001 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1002 libswanted="$libswanted dld ld sun m c cposix posix"
1003 libswanted="$libswanted ndir dir crypt sec"
1004 libswanted="$libswanted ucb bsd BSD PW x iconv"
1005 : We probably want to search /usr/shlib before most other libraries.
1006 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1007 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1008 glibpth="/usr/shlib $glibpth"
1009 : Do not use vfork unless overridden by a hint file.
1010 usevfork=false
1011
1012 : Find the basic shell for Bourne shell scripts
1013 case "$sh" in
1014 '')
1015         case "$SYSTYPE" in
1016         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1017         *) xxx='/bin/sh';;
1018         esac
1019         if test -f "$xxx"; then
1020                 sh="$xxx"
1021         else
1022                 : Build up a list and do a single loop so we can 'break' out.
1023                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1024                 for xxx in sh bash ksh pdksh ash; do
1025                         for p in $pth; do
1026                                 try="$try ${p}/${xxx}"
1027                         done
1028                 done
1029                 for xxx in $try; do
1030                         if test -f "$xxx"; then
1031                                 sh="$xxx";
1032                                 break
1033                         elif test -f "$xxx.exe"; then
1034                                 sh="$xxx";
1035                                 break
1036                         fi
1037                 done
1038         fi
1039         ;;
1040 esac
1041
1042 case "$sh" in
1043 '')     cat <<EOM >&2
1044 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1045
1046 Usually it's in /bin/sh.  How did you even get this far?
1047 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1048 we'll try to straighten this all out.
1049 EOM
1050         exit 1
1051         ;;
1052 esac
1053
1054 : see if sh knows # comments
1055 if `$sh -c '#' >/dev/null 2>&1`; then
1056         shsharp=true
1057         spitshell=cat
1058         xcat=/bin/cat
1059         test -f $xcat || xcat=/usr/bin/cat
1060         echo "#!$xcat" >try
1061         $eunicefix try
1062         chmod +x try
1063         ./try > today
1064         if test -s today; then
1065                 sharpbang='#!'
1066         else
1067                 echo "#! $xcat" > try
1068                 $eunicefix try
1069                 chmod +x try
1070                 ./try > today
1071                 if test -s today; then
1072                         sharpbang='#! '
1073                 else
1074                         sharpbang=': use '
1075                 fi
1076         fi
1077 else
1078         echo " "
1079         echo "Your $sh doesn't grok # comments--I will strip them later on."
1080         shsharp=false
1081         cd ..
1082         echo "exec grep -v '^[  ]*#'" >spitshell
1083         chmod +x spitshell
1084         $eunicefix spitshell
1085         spitshell=`pwd`/spitshell
1086         cd UU
1087         echo "I presume that if # doesn't work, #! won't work either!"
1088         sharpbang=': use '
1089 fi
1090 rm -f try today
1091
1092 : figure out how to guarantee sh startup
1093 case "$startsh" in
1094 '') startsh=${sharpbang}${sh} ;;
1095 *)
1096 esac
1097 cat >try <<EOSS
1098 $startsh
1099 set abc
1100 test "$?abc" != 1
1101 EOSS
1102
1103 chmod +x try
1104 $eunicefix try
1105 if ./try; then
1106         : echo "Yup, it does."
1107 else
1108         echo "Hmm... '$startsh' does not guarantee sh startup..."
1109         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1110 fi
1111 rm -f try
1112
1113
1114 : Save command line options in file UU/cmdline.opt for later use in
1115 : generating config.sh.
1116 cat > cmdline.opt <<EOSH
1117 # Configure command line arguments.
1118 config_arg0='$0'
1119 config_args='$*'
1120 config_argc=$#
1121 EOSH
1122 argn=1
1123 for arg in "$@"; do
1124         cat >>cmdline.opt <<EOSH
1125 config_arg$argn='$arg'
1126 EOSH
1127         argn=`expr $argn + 1`
1128 done
1129
1130 : produce awk script to parse command line options
1131 cat >options.awk <<'EOF'
1132 BEGIN {
1133         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1134
1135         len = length(optstr);
1136         for (i = 1; i <= len; i++) {
1137                 c = substr(optstr, i, 1);
1138                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1139                 if (a == ":") {
1140                         arg[c] = 1;
1141                         i++;
1142                 }
1143                 opt[c] = 1;
1144         }
1145 }
1146 {
1147         expect = 0;
1148         str = $0;
1149         if (substr(str, 1, 1) != "-") {
1150                 printf("'%s'\n", str);
1151                 next;
1152         }
1153         len = length($0);
1154         for (i = 2; i <= len; i++) {
1155                 c = substr(str, i, 1);
1156                 if (!opt[c]) {
1157                         printf("-%s\n", substr(str, i));
1158                         next;
1159                 }
1160                 printf("-%s\n", c);
1161                 if (arg[c]) {
1162                         if (i < len)
1163                                 printf("'%s'\n", substr(str, i + 1));
1164                         else
1165                                 expect = 1;
1166                         next;
1167                 }
1168         }
1169 }
1170 END {
1171         if (expect)
1172                 print "?";
1173 }
1174 EOF
1175
1176 : process the command line options
1177 set X `for arg in "$@"; do echo "X$arg"; done |
1178         sed -e s/X// | awk -f options.awk`
1179 eval "set $*"
1180 shift
1181 rm -f options.awk
1182
1183 : set up default values
1184 fastread=''
1185 reuseval=false
1186 config_sh=''
1187 alldone=''
1188 error=''
1189 silent=''
1190 extractsh=''
1191 override=''
1192 knowitall=''
1193 rm -f optdef.sh posthint.sh
1194 cat >optdef.sh <<EOS
1195 $startsh
1196 EOS
1197
1198
1199 : option parsing
1200 while test $# -gt 0; do
1201         case "$1" in
1202         -d) shift; fastread=yes;;
1203         -e) shift; alldone=cont;;
1204         -f)
1205                 shift
1206                 cd ..
1207                 if test -r "$1"; then
1208                         config_sh="$1"
1209                 else
1210                         echo "$me: cannot read config file $1." >&2
1211                         error=true
1212                 fi
1213                 cd UU
1214                 shift;;
1215         -h) shift; error=true;;
1216         -r) shift; reuseval=true;;
1217         -s) shift; silent=true; realsilent=true;;
1218         -E) shift; alldone=exit;;
1219         -K) shift; knowitall=true;;
1220         -O) shift; override=true;;
1221         -S) shift; silent=true; extractsh=true;;
1222         -D)
1223                 shift
1224                 case "$1" in
1225                 *=)
1226                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1227                         echo "$me: ignoring -D $1" >&2
1228                         ;;
1229                 *=*) echo "$1" | \
1230                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1231                 *) echo "$1='define'" >> optdef.sh;;
1232                 esac
1233                 shift
1234                 ;;
1235         -U)
1236                 shift
1237                 case "$1" in
1238                 *=) echo "$1" >> optdef.sh;;
1239                 *=*)
1240                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1241                         echo "$me: ignoring -U $1" >&2
1242                         ;;
1243                 *) echo "$1='undef'" >> optdef.sh;;
1244                 esac
1245                 shift
1246                 ;;
1247         -A)
1248             shift
1249             xxx=''
1250             yyy="$1"
1251             zzz=''
1252             uuu=undef
1253             case "$yyy" in
1254             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1255                  case "$zzz" in
1256                  *:*) zzz='' ;;
1257                  *)   xxx=append
1258                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1259                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1260                  esac
1261                  ;;
1262             esac
1263             case "$xxx" in
1264             '')  case "$yyy" in
1265                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1266                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1267                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1268                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1269                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1270                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1271                  esac
1272                  ;;       
1273             esac
1274             case "$xxx" in
1275             append)
1276                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1277             clear)
1278                 echo "$yyy=''"                  >> posthint.sh ;;
1279             define)
1280                 case "$zzz" in
1281                 '') zzz=define ;;
1282                 esac
1283                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1284             eval)
1285                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1286             prepend)
1287                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1288             undef)
1289                 case "$zzz" in
1290                 '') zzz="$uuu" ;;
1291                 esac
1292                 echo "$yyy=$zzz"                >> posthint.sh ;;
1293             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1294             esac
1295             shift
1296             ;;
1297         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1298             exit 0;;
1299         --) break;;
1300         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1301         *) break;;
1302         esac
1303 done
1304
1305 case "$error" in
1306 true)
1307         cat >&2 <<EOM
1308 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1309                  [-U symbol] [-U symbol=] [-A command:symbol...]
1310   -d : use defaults for all answers.
1311   -e : go on without questioning past the production of config.sh.
1312   -f : specify an alternate default configuration file.
1313   -h : print this help message and exit (with an error status).
1314   -r : reuse C symbols value if possible (skips costly nm extraction).
1315   -s : silent mode, only echoes questions and essential information.
1316   -D : define symbol to have some value:
1317          -D symbol         symbol gets the value 'define'
1318          -D symbol=value   symbol gets the value 'value'
1319   -E : stop at the end of questions, after having produced config.sh.
1320   -K : do not use unless you know what you are doing.
1321   -O : let -D and -U override definitions from loaded configuration file.
1322   -S : perform variable substitutions on all .SH files (can mix with -f)
1323   -U : undefine symbol:
1324          -U symbol    symbol gets the value 'undef'
1325          -U symbol=   symbol gets completely empty
1326   -A : manipulate symbol after the platform specific hints have been applied:
1327          -A symbol=value                append " "value to symbol
1328          -A append:symbol=value         append value to symbol
1329          -A define:symbol=value         define symbol to have value
1330          -A clear:symbol                define symbol to be ''
1331          -A define:symbol               define symbol to be 'define'
1332          -A eval:symbol=value           define symbol to be eval of value
1333          -A prepend:symbol=value        prepend value to symbol
1334          -A undef:symbol                define symbol to be 'undef'
1335          -A undef:symbol=               define symbol to be ''
1336   -V : print version number and exit (with a zero status).
1337 EOM
1338         exit 1
1339         ;;
1340 esac
1341
1342 : Sanity checks
1343 case "$fastread$alldone" in
1344 yescont|yesexit) ;;
1345 *)
1346         case "$extractsh" in
1347         true) ;;
1348         *)
1349                 if test ! -t 0; then
1350                         echo "Say 'sh Configure', not 'sh <Configure'"
1351                         exit 1
1352                 fi
1353                 ;;
1354         esac
1355         ;;
1356 esac
1357
1358 exec 4>&1
1359 case "$silent" in
1360 true) exec 1>/dev/null;;
1361 esac
1362
1363 : run the defines and the undefines, if any, but leave the file out there...
1364 touch optdef.sh
1365 . ./optdef.sh
1366 : create the posthint manipulation script and leave the file out there...
1367 touch posthint.sh
1368
1369 : set package name
1370 package=perl5
1371 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1372 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1373 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1374 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1375 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1376 esac
1377
1378 : Some greps do not return status, grrr.
1379 echo "grimblepritz" >grimble
1380 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1381         contains=contains
1382 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1383         contains=grep
1384 else
1385         contains=contains
1386 fi
1387 rm -f grimble
1388 : the following should work in any shell
1389 case "$contains" in
1390 contains*)
1391         echo " "
1392         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1393         cat >contains <<'EOSS'
1394 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1395 EOSS
1396 chmod +x contains
1397 esac
1398
1399 : Find the path to the source tree
1400 case "$src" in
1401 '') case "$0" in
1402     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1403          case "$src" in
1404          /*)    ;;
1405          *)     src=`cd ../$src && pwd` ;;
1406          esac
1407          ;;
1408     *)   src='.';;
1409     esac;;
1410 esac
1411 case "$src" in
1412 '')     src=/
1413         rsrc=/
1414         ;;
1415 /*) rsrc="$src";;
1416 *) rsrc="../$src";;
1417 esac
1418 if test -f $rsrc/Configure && \
1419         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1420 then
1421    : found it, so we are ok.
1422 else
1423         rsrc=''
1424         for src in . .. ../.. ../../.. ../../../..; do
1425                 if test -f ../$src/Configure && \
1426                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1427                 then
1428                         rsrc=../$src
1429                         break
1430                 fi
1431         done
1432 fi
1433 case "$rsrc" in
1434 '')
1435         cat <<EOM >&4
1436
1437 Sorry, I can't seem to locate the source dir for $package.  Please start
1438 Configure with an explicit path -- i.e. /some/path/Configure.
1439
1440 EOM
1441         exit 1
1442         ;;
1443 ../.)   rsrc='..';;
1444 *)
1445         echo " "
1446         echo "Sources for $package found in \"$src\"." >&4
1447         ;;
1448 esac
1449
1450 : script used to extract .SH files with variable substitutions
1451 cat >extract <<'EOS'
1452 CONFIGDOTSH=true
1453 echo "Doing variable substitutions on .SH files..."
1454 if test -f $src/MANIFEST; then
1455         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1456 else
1457         echo "(Looking for .SH files under the source directory.)"
1458         set x `(cd $src; find . -name "*.SH" -print)`
1459 fi
1460 shift
1461 case $# in
1462 0) set x `(cd $src; echo *.SH)`; shift;;
1463 esac
1464 if test ! -f $src/$1; then
1465         shift
1466 fi
1467 mkdir_p='
1468 name=$1;
1469 create="";
1470 while test $name; do
1471         if test ! -d "$name"; then
1472                 create="$name $create";
1473                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1474                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1475         else
1476                 name="";
1477         fi;
1478 done;
1479 for file in $create; do
1480         mkdir $file;
1481 done
1482 '
1483 for file in $*; do
1484         case "$src" in
1485         ".")
1486                 case "$file" in
1487                 */*)
1488                         dir=`expr X$file : 'X\(.*\)/'`
1489                         file=`expr X$file : 'X.*/\(.*\)'`
1490                         (cd $dir && . ./$file)
1491                         ;;
1492                 *)
1493                         . ./$file
1494                         ;;
1495                 esac
1496                 ;;
1497         *)
1498                 case "$file" in
1499                 */*)
1500                         dir=`expr X$file : 'X\(.*\)/'`
1501                         file=`expr X$file : 'X.*/\(.*\)'`
1502                         (set x $dir; shift; eval $mkdir_p)
1503                         sh <$src/$dir/$file
1504                         ;;
1505                 *)
1506                         sh <$src/$file
1507                         ;;
1508                 esac
1509                 ;;
1510         esac
1511 done
1512 if test -f $src/config_h.SH; then
1513         if test ! -f config.h; then
1514         : oops, they left it out of MANIFEST, probably, so do it anyway.
1515         . $src/config_h.SH
1516         fi
1517 fi
1518 EOS
1519
1520 : extract files and exit if asked to do so
1521 case "$extractsh" in
1522 true)
1523         case "$realsilent" in
1524         true) ;;
1525         *) exec 1>&4;;
1526         esac
1527         case "$config_sh" in
1528         '') config_sh='config.sh';;
1529         esac
1530         echo " "
1531         echo "Fetching answers from $config_sh..."
1532         cd ..
1533         . $config_sh
1534         test "$override" && . ./optdef.sh
1535         echo " "
1536         . UU/extract
1537         rm -rf UU
1538         echo "Done."
1539         exit 0
1540         ;;
1541 esac
1542
1543 : Eunice requires " " instead of "", can you believe it
1544 echo " "
1545 : Here we go...
1546 echo "Beginning of configuration questions for $package."
1547
1548 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1549
1550 : first determine how to suppress newline on echo command
1551 echo " "
1552 echo "Checking echo to see how to suppress newlines..."
1553 (echo "hi there\c" ; echo " ") >.echotmp
1554 if $contains c .echotmp >/dev/null 2>&1 ; then
1555         echo "...using -n."
1556         n='-n'
1557         c=''
1558 else
1559         cat <<'EOM'
1560 ...using \c
1561 EOM
1562         n=''
1563         c='\c'
1564 fi
1565 echo $n "The star should be here-->$c"
1566 echo '*'
1567 rm -f .echotmp
1568
1569 : Now test for existence of everything in MANIFEST
1570 echo " "
1571 if test -f $rsrc/MANIFEST; then
1572         echo "First let's make sure your kit is complete.  Checking..." >&4
1573         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1574         rm -f missing
1575         tmppwd=`pwd`
1576         for filelist in x??; do
1577                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1578         done
1579         if test -s missing; then
1580                 cat missing >&4
1581                 cat >&4 <<'EOM'
1582
1583 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1584
1585 You have the option of continuing the configuration process, despite the
1586 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1587 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1588 and contact the author (perlbug@perl.com).
1589
1590 EOM
1591                 echo $n "Continue? [n] $c" >&4
1592                 read ans
1593                 case "$ans" in
1594                 y*)
1595                         echo "Continuing..." >&4
1596                         rm -f missing
1597                         ;;
1598                 *)
1599                         echo "ABORTING..." >&4
1600                         kill $$
1601                         ;;
1602                 esac
1603         else
1604                 echo "Looks good..."
1605         fi
1606 else
1607         echo "There is no MANIFEST file.  I hope your kit is complete !"
1608 fi
1609 rm -f missing x??
1610
1611 echo " "
1612 : Find the appropriate value for a newline for tr
1613 if test -n "$DJGPP"; then
1614        trnl='\012'
1615 fi
1616 if test X"$trnl" = X; then
1617         case "`echo foo|tr '\n' x 2>/dev/null`" in
1618         foox) trnl='\n' ;;
1619         esac
1620 fi
1621 if test X"$trnl" = X; then
1622         case "`echo foo|tr '\012' x 2>/dev/null`" in
1623         foox) trnl='\012' ;;
1624         esac
1625 fi
1626 if test X"$trnl" = X; then
1627         cat <<EOM >&2
1628
1629 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1630
1631 EOM
1632         exit 1
1633 fi
1634
1635 : compute the number of columns on the terminal for proper question formatting
1636 case "$COLUMNS" in
1637 '') COLUMNS='80';;
1638 esac
1639
1640 : set up the echo used in my read
1641 myecho="case \"\$xxxm\" in
1642 '') echo $n \"\$rp $c\" >&4;;
1643 *) case \"\$rp\" in
1644         '') echo $n \"[\$xxxm] $c\";;
1645         *)
1646                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1647                         echo \"\$rp\" >&4
1648                         echo $n \"[\$xxxm] $c\" >&4
1649                 else
1650                         echo $n \"\$rp [\$xxxm] $c\" >&4
1651                 fi
1652                 ;;
1653         esac;;
1654 esac"
1655
1656 : now set up to do reads with possible shell escape and default assignment
1657 cat <<EOSC >myread
1658 $startsh
1659 xxxm=\$dflt
1660 $myecho
1661 ans='!'
1662 case "\$fastread" in
1663 yes) case "\$dflt" in
1664         '') ;;
1665         *) ans='';
1666                 case "\$silent-\$rp" in
1667                 true-) ;;
1668                 *) echo " " >&4;;
1669                 esac;;
1670         esac;;
1671 *) case "\$silent" in
1672         true) case "\$rp" in
1673                 '') ans='';;
1674                 esac;;
1675         esac;;
1676 esac
1677 while expr "X\$ans" : "X!" >/dev/null; do
1678         read answ
1679         set x \$xxxm
1680         shift
1681         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1682         case  "\$answ" in
1683         "!")
1684                 sh 1>&4
1685                 echo " "
1686                 $myecho
1687                 ;;
1688         !*)
1689                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1690                 shift
1691                 sh 1>&4 -c "\$*"
1692                 echo " "
1693                 $myecho
1694                 ;;
1695         "\$ans")
1696                 case "\$ans" in
1697                 \\&*)
1698                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1699                         shift
1700                         case "\$1" in
1701                         -d)
1702                                 fastread=yes
1703                                 echo "(OK, I'll run with -d after this question.)" >&4
1704                                 ;;
1705                         -*)
1706                                 echo "*** Sorry, \$1 not supported yet." >&4
1707                                 ;;
1708                         esac
1709                         $myecho
1710                         ans=!
1711                         ;;
1712                 esac;;
1713         *)
1714                 case "\$aok" in
1715                 y)
1716                         echo "*** Substitution done -- please confirm."
1717                         xxxm="\$ans"
1718                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1719                         xxxm="\$ans"
1720                         ans=!
1721                         ;;
1722                 *)
1723                         echo "*** Error -- try again."
1724                         ans=!
1725                         ;;
1726                 esac
1727                 $myecho
1728                 ;;
1729         esac
1730         case "\$ans\$xxxm\$nostick" in
1731         '')
1732                 ans=!
1733                 $myecho
1734                 ;;
1735         esac
1736 done
1737 case "\$ans" in
1738 '') ans="\$xxxm";;
1739 esac
1740 EOSC
1741
1742 : create .config dir to save info across Configure sessions
1743 test -d ../.config || mkdir ../.config
1744 cat >../.config/README <<EOF
1745 This directory created by Configure to save information that should
1746 persist across sessions for $package.
1747
1748 You may safely delete it if you wish.
1749 EOF
1750
1751 : general instructions
1752 needman=true
1753 firsttime=true
1754 user=`(logname) 2>/dev/null`
1755 case "$user" in
1756 '') user=`whoami 2>&1`;;
1757 esac
1758 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1759         firsttime=false
1760         echo " "
1761         rp='Would you like to see the instructions?'
1762         dflt=n
1763         . ./myread
1764         case "$ans" in
1765         [yY]*) ;;
1766         *) needman=false;;
1767         esac
1768 fi
1769 if $needman; then
1770         cat <<EOH
1771
1772 This installation shell script will examine your system and ask you questions
1773 to determine how the perl5 package should be installed. If you get
1774 stuck on a question, you may use a ! shell escape to start a subshell or
1775 execute a command.  Many of the questions will have default answers in square
1776 brackets; typing carriage return will give you the default.
1777
1778 On some of the questions which ask for file or directory names you are allowed
1779 to use the ~name construct to specify the login directory belonging to "name",
1780 even if you don't have a shell which knows about that.  Questions where this is
1781 allowed will be marked "(~name ok)".
1782
1783 EOH
1784         rp=''
1785         dflt='Type carriage return to continue'
1786         . ./myread
1787         cat <<'EOH'
1788
1789 The prompter used in this script allows you to use shell variables and
1790 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1791 in the default answer, as if the default line was a set of arguments given to a
1792 script shell.  This means you may also use $* to repeat the whole default line,
1793 so you do not have to re-type everything to add something to the default.
1794
1795 Everytime there is a substitution, you will have to confirm.  If there is an
1796 error (e.g. an unmatched backtick), the default answer will remain unchanged
1797 and you will be prompted again.
1798
1799 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1800 the questions and use the computed defaults (or the previous answers if there
1801 was already a config.sh file). Type 'Configure -h' for a list of options.
1802 You may also start interactively and then answer '& -d' at any prompt to turn
1803 on the non-interactive behaviour for the remainder of the execution.
1804
1805 EOH
1806         . ./myread
1807         cat <<EOH
1808
1809 Much effort has been expended to ensure that this shell script will run on any
1810 Unix system.  If despite that it blows up on yours, your best bet is to edit
1811 Configure and run it again.  If you can't run Configure for some reason,
1812 you'll have to generate a config.sh file by hand.  Whatever problems you
1813 have, let me (perlbug@perl.com) know how I blew it.
1814
1815 This installation script affects things in two ways:
1816
1817 1) it may do direct variable substitutions on some of the files included
1818    in this kit.
1819 2) it builds a config.h file for inclusion in C programs.  You may edit
1820    any of these files as the need arises after running this script.
1821
1822 If you make a mistake on a question, there is no easy way to back up to it
1823 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1824 files.  Configure will offer to let you do this before it runs the SH files.
1825
1826 EOH
1827         dflt='Type carriage return to continue'
1828         . ./myread
1829         case "$firsttime" in
1830         true) echo $user >>../.config/instruct;;
1831         esac
1832 fi
1833
1834 : find out where common programs are
1835 echo " "
1836 echo "Locating common programs..." >&4
1837 cat <<EOSC >loc
1838 $startsh
1839 case \$# in
1840 0) exit 1;;
1841 esac
1842 thing=\$1
1843 shift
1844 dflt=\$1
1845 shift
1846 for dir in \$*; do
1847         case "\$thing" in
1848         .)
1849         if test -d \$dir/\$thing; then
1850                 echo \$dir
1851                 exit 0
1852         fi
1853         ;;
1854         *)
1855         for thisthing in \$dir/\$thing; do
1856                 : just loop through to pick last item
1857         done
1858         if test -f \$thisthing; then
1859                 echo \$thisthing
1860                 exit 0
1861         elif test -f \$dir/\$thing.exe; then
1862                 if test -n "$DJGPP"; then
1863                         echo \$dir/\$thing.exe
1864                 else
1865                         : on Eunice apparently
1866                         echo \$dir/\$thing
1867                 fi
1868                 exit 0
1869         fi
1870         ;;
1871         esac
1872 done
1873 echo \$dflt
1874 exit 1
1875 EOSC
1876 chmod +x loc
1877 $eunicefix loc
1878 loclist="
1879 awk
1880 cat
1881 comm
1882 cp
1883 echo
1884 expr
1885 grep
1886 ls
1887 make
1888 mkdir
1889 rm
1890 sed
1891 sort
1892 touch
1893 tr
1894 uniq
1895 "
1896 trylist="
1897 Mcc
1898 ar
1899 byacc
1900 cpp
1901 csh
1902 date
1903 egrep
1904 gzip
1905 less
1906 ln
1907 more
1908 nm
1909 nroff
1910 pg
1911 test
1912 uname
1913 zip
1914 "
1915 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1916 pth="$pth /lib /usr/lib"
1917 for file in $loclist; do
1918         eval xxx=\$$file
1919         case "$xxx" in
1920         /*|?:[\\/]*)
1921                 if test -f "$xxx"; then
1922                         : ok
1923                 else
1924                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1925                         xxx=`./loc $file $file $pth`
1926                 fi
1927                 ;;
1928         '') xxx=`./loc $file $file $pth`;;
1929         *) xxx=`./loc $xxx $xxx $pth`;;
1930         esac
1931         eval $file=$xxx
1932         eval _$file=$xxx
1933         case "$xxx" in
1934         /*)
1935                 echo $file is in $xxx.
1936                 ;;
1937         ?:[\\/]*)
1938                 echo $file is in $xxx.
1939                 ;;
1940         *)
1941                 echo "I don't know where '$file' is, and my life depends on it." >&4
1942                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1943                 exit 1
1944                 ;;
1945         esac
1946 done
1947 echo " "
1948 echo "Don't worry if any of the following aren't found..."
1949 say=offhand
1950 for file in $trylist; do
1951         eval xxx=\$$file
1952         case "$xxx" in
1953         /*|?:[\\/]*)
1954                 if test -f "$xxx"; then
1955                         : ok
1956                 else
1957                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1958                         xxx=`./loc $file $file $pth`
1959                 fi
1960                 ;;
1961         '') xxx=`./loc $file $file $pth`;;
1962         *) xxx=`./loc $xxx $xxx $pth`;;
1963         esac
1964         eval $file=$xxx
1965         eval _$file=$xxx
1966         case "$xxx" in
1967         /*)
1968                 echo $file is in $xxx.
1969                 ;;
1970         ?:[\\/]*)
1971                 echo $file is in $xxx.
1972                 ;;
1973         *)
1974                 echo "I don't see $file out there, $say."
1975                 say=either
1976                 ;;
1977         esac
1978 done
1979 case "$egrep" in
1980 egrep)
1981         echo "Substituting grep for egrep."
1982         egrep=$grep
1983         ;;
1984 esac
1985 case "$ln" in
1986 ln)
1987         echo "Substituting cp for ln."
1988         ln=$cp
1989         ;;
1990 esac
1991 case "$test" in
1992 test)
1993         echo "Hopefully test is built into your sh."
1994         ;;
1995 *)
1996         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1997                 echo "Using the test built into your sh."
1998                 test=test
1999                 _test=test
2000         fi
2001         ;;
2002 esac
2003 case "$echo" in
2004 echo)
2005         echo "Hopefully echo is built into your sh."
2006         ;;
2007 '') ;;
2008 *)
2009         echo " "
2010 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2011         $echo $n "hi there$c" >foo1
2012         echo $n "hi there$c" >foo2
2013         if cmp foo1 foo2 >/dev/null 2>&1; then
2014                 echo "They are compatible.  In fact, they may be identical."
2015         else
2016                 case "$n" in
2017                 '-n') n='' c='\c';;
2018                 *) n='-n' c='';;
2019                 esac
2020                 cat <<FOO
2021 They are not compatible!  You are probably running ksh on a non-USG system.
2022 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2023 have echo built in and we may have to run some Bourne shell scripts.  That
2024 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2025
2026 FOO
2027                 $echo $n "The star should be here-->$c"
2028                 $echo "*"
2029         fi
2030         $rm -f foo1 foo2
2031         ;;
2032 esac
2033
2034 : determine whether symbolic links are supported
2035 echo " "
2036 $touch blurfl
2037 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2038         echo "Symbolic links are supported." >&4
2039         lns="$ln -s"
2040 else
2041         echo "Symbolic links are NOT supported." >&4
2042         lns="$ln"
2043 fi
2044 $rm -f blurfl sym
2045
2046 : see whether [:lower:] and [:upper:] are supported character classes
2047 echo " "
2048 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2049 ABYZ)
2050         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2051         up='[:upper:]'
2052         low='[:lower:]'
2053         ;;
2054 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2055         # (0xc9 and 0xd1), therefore that is a nice testing point.
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 | $tr I-J i-j 2>/dev/null`" in
2065             ij) up='A-Z'
2066                 low='a-z'
2067                 ;;
2068             esac
2069         fi
2070         if test "X$up" = X -o "X$low" = X; then
2071             case "`echo IJ | od -x 2>/dev/null`" in
2072             *C9D1*|*c9d1*)
2073                 echo "Hey, this might be EBCDIC." >&4
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                 if test "X$up" = X -o "X$low" = X; then
2082                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2083                     ij) up='A-IJ-RS-Z'
2084                         low='a-ij-rs-z'
2085                         ;;
2086                     esac
2087                 fi
2088                 ;;
2089             esac
2090         fi
2091 esac
2092 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2093 ij)
2094     echo "Using $up and $low to convert case." >&4
2095     ;;
2096 *)
2097     echo "I don't know how to translate letters from upper to lower case." >&4
2098     echo "Your tr is not acting any way I know of." >&4
2099     exit 1
2100     ;;
2101 esac
2102 : set up the translation script tr, must be called with ./tr of course
2103 cat >tr <<EOSC
2104 $startsh
2105 case "\$1\$2" in
2106 '[A-Z][a-z]') exec $tr '$up' '$low';;
2107 '[a-z][A-Z]') exec $tr '$low' '$up';;
2108 esac
2109 exec $tr "\$@"
2110 EOSC
2111 chmod +x tr
2112 $eunicefix tr
2113
2114 : Try to determine whether config.sh was made on this system
2115 case "$config_sh" in
2116 '')
2117 myuname=`$uname -a 2>/dev/null`
2118 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2119 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2120 # because the A-Z/a-z are not consecutive.
2121 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2122         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2123 newmyuname="$myuname"
2124 dflt=n
2125 case "$knowitall" in
2126 '')
2127         if test -f ../config.sh; then
2128                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2129                         eval "`grep myuname= ../config.sh`"
2130                 fi
2131                 if test "X$myuname" = "X$newmyuname"; then
2132                         dflt=y
2133                 fi
2134         fi
2135         ;;
2136 *) dflt=y;;
2137 esac
2138
2139 : Get old answers from old config file if Configure was run on the
2140 : same system, otherwise use the hints.
2141 hint=default
2142 cd ..
2143 if test -f config.sh; then
2144         echo " "
2145         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2146         . UU/myread
2147         case "$ans" in
2148         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2149         *)  echo "Fetching default answers from your old config.sh file..." >&4
2150                 tmp_n="$n"
2151                 tmp_c="$c"
2152                 tmp_sh="$sh"
2153                 . ./config.sh
2154                 cp config.sh UU
2155                 n="$tmp_n"
2156                 c="$tmp_c"
2157                 : Older versions did not always set $sh.  Catch re-use of such
2158                 : an old config.sh.
2159                 case "$sh" in
2160                 '') sh="$tmp_sh" ;;
2161                 esac
2162                 hint=previous
2163                 ;;
2164         esac
2165 fi
2166 if test ! -f config.sh; then
2167         $cat <<EOM
2168
2169 First time through, eh?  I have some defaults handy for some systems
2170 that need some extra help getting the Configure answers right:
2171
2172 EOM
2173         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2174         dflt=''
2175         : Half the following guesses are probably wrong... If you have better
2176         : tests or hints, please send them to perlbug@perl.com
2177         : The metaconfig authors would also appreciate a copy...
2178         $test -f /irix && osname=irix
2179         $test -f /xenix && osname=sco_xenix
2180         $test -f /dynix && osname=dynix
2181         $test -f /dnix && osname=dnix
2182         $test -f /lynx.os && osname=lynxos
2183         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2184         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2185         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2186         $test -f /bin/mips && /bin/mips && osname=mips
2187         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2188                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2189         $test -d /usr/apollo/bin && osname=apollo
2190         $test -f /etc/saf/_sactab && osname=svr4
2191         $test -d /usr/include/minix && osname=minix
2192         if $test -d /MachTen -o -d /MachTen_Folder; then
2193                 osname=machten
2194                 if $test -x /sbin/version; then
2195                         osvers=`/sbin/version | $awk '{print $2}' |
2196                         $sed -e 's/[A-Za-z]$//'`
2197                 elif $test -x /usr/etc/version; then
2198                         osvers=`/usr/etc/version | $awk '{print $2}' |
2199                         $sed -e 's/[A-Za-z]$//'`
2200                 else
2201                         osvers="$2.$3"
2202                 fi
2203         fi
2204
2205         $test -f /sys/posix.dll &&
2206                 $test -f /usr/bin/what &&
2207                 set X `/usr/bin/what /sys/posix.dll` &&
2208                 $test "$3" = UWIN &&
2209                 osname=uwin &&
2210                 osvers="$5"
2211
2212         if $test -f $uname; then
2213                 set X $myuname
2214                 shift
2215
2216                 case "$5" in
2217                 fps*) osname=fps ;;
2218                 mips*)
2219                         case "$4" in
2220                         umips) osname=umips ;;
2221                         *) osname=mips ;;
2222                         esac;;
2223                 [23]100) osname=mips ;;
2224                 next*) osname=next ;;
2225                 i386*)
2226                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2227                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2228                                 osname='sco'
2229                                 osvers=$tmp
2230                         elif $test -f /etc/kconfig; then
2231                                 osname=isc
2232                                 if test "$lns" = "$ln -s"; then
2233                                         osvers=4
2234                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2235                                         osvers=3
2236                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2237                                         osvers=2
2238                                 fi
2239                         fi
2240                         tmp=''
2241                         ;;
2242                 pc*)
2243                         if test -n "$DJGPP"; then
2244                                 osname=dos
2245                                 osvers=djgpp
2246                         fi
2247                         ;;
2248                 esac
2249
2250                 case "$1" in
2251                 aix) osname=aix
2252                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2253                         case "$tmp" in
2254                         'not found') osvers="$4"."$3" ;;
2255                         '<3240'|'<>3240') osvers=3.2.0 ;;
2256                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2257                         '=3250'|'>3250') osvers=3.2.5 ;;
2258                         *) osvers=$tmp;;
2259                         esac
2260                         ;;
2261                 bsd386) osname=bsd386
2262                         osvers=`$uname -r`
2263                         ;;
2264                 cygwin*) osname=cygwin
2265                         osvers="$3"
2266                         ;;
2267                 *dc.osx) osname=dcosx
2268                         osvers="$3"
2269                         ;;
2270                 dnix) osname=dnix
2271                         osvers="$3"
2272                         ;;
2273                 domainos) osname=apollo
2274                         osvers="$3"
2275                         ;;
2276                 dgux) osname=dgux 
2277                         osvers="$3"
2278                         ;;
2279                 dynixptx*) osname=dynixptx
2280                         osvers=`echo "$4"|sed 's/^v//'`
2281                         ;;
2282                 freebsd) osname=freebsd 
2283                         osvers="$3" ;;
2284                 genix) osname=genix ;;
2285                 hp*) osname=hpux 
2286                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2287                         ;;
2288                 irix*) osname=irix
2289                         case "$3" in
2290                         4*) osvers=4 ;;
2291                         5*) osvers=5 ;;
2292                         *)      osvers="$3" ;;
2293                         esac
2294                         ;;
2295                 linux) osname=linux
2296                         case "$3" in
2297                         *)      osvers="$3" ;;
2298                         esac
2299                         ;;
2300                 MiNT) osname=mint
2301                         ;;
2302                 netbsd*) osname=netbsd
2303                         osvers="$3"
2304                         ;;
2305                 news-os) osvers="$3"
2306                         case "$3" in
2307                         4*) osname=newsos4 ;;
2308                         *) osname=newsos ;;
2309                         esac
2310                         ;;
2311                 next*) osname=next ;;
2312                 POSIX-BC | posix-bc ) osname=posix-bc
2313                         osvers="$3"
2314                         ;;
2315                 powerux | power_ux | powermax_os | powermaxos | \
2316                 powerunix | power_unix) osname=powerux
2317                         osvers="$3"
2318                         ;;
2319                 qnx) osname=qnx
2320                         osvers="$4"
2321                         ;;
2322                 solaris) osname=solaris
2323                         case "$3" in
2324                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2325                         *)      osvers="$3" ;;
2326                         esac
2327                         ;;
2328                 sunos) osname=sunos
2329                         case "$3" in
2330                         5*) osname=solaris
2331                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2332                         *)      osvers="$3" ;;
2333                         esac
2334                         ;;
2335                 titanos) osname=titanos
2336                         case "$3" in
2337                         1*) osvers=1 ;;
2338                         2*) osvers=2 ;;
2339                         3*) osvers=3 ;;
2340                         4*) osvers=4 ;;
2341                         *)      osvers="$3" ;;
2342                         esac
2343                         ;;
2344                 ultrix) osname=ultrix
2345                         osvers="$3"
2346                         ;;
2347                 osf1|mls+)      case "$5" in
2348                                 alpha)
2349                                         osname=dec_osf
2350                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2351                                         ;;
2352                         hp*)    osname=hp_osf1  ;;
2353                         mips)   osname=mips_osf1 ;;
2354                         esac
2355                         ;;
2356                 unixware) osname=svr5
2357                         osvers="$4"
2358                         ;;
2359                 uts) osname=uts
2360                         osvers="$3"
2361                         ;;
2362                 $2) case "$osname" in
2363                         *isc*) ;;
2364                         *freebsd*) ;;
2365                         svr*)
2366                                 : svr4.x or possibly later
2367                                 case "svr$3" in 
2368                                 ${osname}*)
2369                                         osname=svr$3
2370                                         osvers=$4
2371                                         ;;
2372                                 esac
2373                                 case "$osname" in
2374                                 svr4.0)
2375                                         : Check for ESIX
2376                                         if test -f /stand/boot ; then
2377                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2378                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2379                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2380                                                         if test -n "$isesix"; then
2381                                                                 osname=esix4
2382                                                         fi
2383                                                 fi
2384                                         fi
2385                                         ;;
2386                                 esac
2387                                 ;;
2388                         *)      if test -f /etc/systemid; then
2389                                         osname=sco
2390                                         set `echo $3 | $sed 's/\./ /g'` $4
2391                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2392                                                 osvers=$1.$2.$3
2393                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2394                                                 osvers=$1.$2
2395                                         elif $test -f $src/hints/sco_$1.sh; then
2396                                                 osvers=$1
2397                                         fi
2398                                 else
2399                                         case "$osname" in
2400                                         '') : Still unknown.  Probably a generic Sys V.
2401                                                 osname="sysv"
2402                                                 osvers="$3"
2403                                                 ;;
2404                                         esac
2405                                 fi
2406                                 ;;
2407                         esac
2408                         ;;
2409                 *)      case "$osname" in
2410                         '') : Still unknown.  Probably a generic BSD.
2411                                 osname="$1"
2412                                 osvers="$3"
2413                                 ;;
2414                         esac
2415                         ;;
2416                 esac
2417         else
2418                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2419                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2420                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2421                                 osname=news_os
2422                         fi
2423                         $rm -f UU/kernel.what
2424                 elif test -d c:/.; then
2425                         set X $myuname
2426                         osname=os2
2427                         osvers="$5"
2428                 fi
2429         fi
2430         
2431         : Now look for a hint file osname_osvers, unless one has been
2432         : specified already.
2433         case "$hintfile" in
2434         ''|' ')
2435                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2436                 : Also try without trailing minor version numbers.
2437                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2438                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2439                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2440                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2441                 case "$file" in
2442                 '') dflt=none ;;
2443                 *)  case "$osvers" in
2444                         '') dflt=$file
2445                                 ;;
2446                         *)  if $test -f $src/hints/$file.sh ; then
2447                                         dflt=$file
2448                                 elif $test -f $src/hints/$xfile.sh ; then
2449                                         dflt=$xfile
2450                                 elif $test -f $src/hints/$xxfile.sh ; then
2451                                         dflt=$xxfile
2452                                 elif $test -f $src/hints/$xxxfile.sh ; then
2453                                         dflt=$xxxfile
2454                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2455                                         dflt=$xxxxfile
2456                                 elif $test -f "$src/hints/${osname}.sh" ; then
2457                                         dflt="${osname}"
2458                                 else
2459                                         dflt=none
2460                                 fi
2461                                 ;;
2462                         esac
2463                         ;;
2464                 esac
2465                 if $test -f Policy.sh ; then
2466                         case "$dflt" in
2467                         *Policy*) ;;
2468                         none) dflt="Policy" ;;
2469                         *) dflt="Policy $dflt" ;;
2470                         esac
2471                 fi
2472                 ;;
2473         *)
2474                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2475                 ;;
2476         esac
2477
2478         if $test -f Policy.sh ; then
2479                 $cat <<EOM
2480
2481 There's also a Policy hint file available, which should make the
2482 site-specific (policy) questions easier to answer.
2483 EOM
2484
2485         fi
2486
2487         $cat <<EOM
2488
2489 You may give one or more space-separated answers, or "none" if appropriate.
2490 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2491 is a good thing.  DO NOT give a wrong version or a wrong OS.
2492
2493 EOM
2494
2495         rp="Which of these apply, if any?"
2496         . UU/myread
2497         tans=$ans
2498         for file in $tans; do
2499                 if $test X$file = XPolicy -a -f Policy.sh; then
2500                         . Policy.sh
2501                         $cat Policy.sh >> UU/config.sh
2502                 elif $test -f $src/hints/$file.sh; then
2503                         . $src/hints/$file.sh
2504                         $cat $src/hints/$file.sh >> UU/config.sh
2505                 elif $test X$tans = X -o X$tans = Xnone ; then
2506                         : nothing
2507                 else
2508                         : Give one chance to correct a possible typo.
2509                         echo "$file.sh does not exist"
2510                         dflt=$file
2511                         rp="hint to use instead?"
2512                         . UU/myread
2513                         for file in $ans; do
2514                                 if $test -f "$src/hints/$file.sh"; then
2515                                         . $src/hints/$file.sh
2516                                         $cat $src/hints/$file.sh >> UU/config.sh
2517                                 elif $test X$ans = X -o X$ans = Xnone ; then
2518                                         : nothing
2519                                 else
2520                                         echo "$file.sh does not exist -- ignored."
2521                                 fi
2522                         done
2523                 fi
2524         done
2525
2526         hint=recommended
2527         : Remember our hint file for later.
2528         if $test -f "$src/hints/$file.sh" ; then
2529                 hintfile="$file"
2530         else
2531                 hintfile=''
2532         fi
2533 fi
2534 cd UU
2535 ;;
2536 *)
2537         echo " "
2538         echo "Fetching default answers from $config_sh..." >&4
2539         tmp_n="$n"
2540         tmp_c="$c"
2541         cd ..
2542         cp $config_sh config.sh 2>/dev/null
2543         chmod +w config.sh
2544         . ./config.sh
2545         cd UU
2546         cp ../config.sh .
2547         n="$tmp_n"
2548         c="$tmp_c"
2549         hint=previous
2550         ;;
2551 esac
2552 test "$override" && . ./optdef.sh
2553 myuname="$newmyuname"
2554
2555 : Restore computed paths
2556 for file in $loclist $trylist; do
2557         eval $file="\$_$file"
2558 done
2559
2560 cat << EOM
2561
2562 Configure uses the operating system name and version to set some defaults.
2563 The default value is probably right if the name rings a bell. Otherwise,
2564 since spelling matters for me, either accept the default or answer "none"
2565 to leave it blank.
2566
2567 EOM
2568 case "$osname" in
2569         ''|' ')
2570                 case "$hintfile" in
2571                 ''|' '|none) dflt=none ;;
2572                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2573                 esac
2574                 ;;
2575         *) dflt="$osname" ;;
2576 esac
2577 rp="Operating system name?"
2578 . ./myread
2579 case "$ans" in
2580 none)  osname='' ;;
2581 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2582 esac
2583 echo " "
2584 case "$osvers" in
2585         ''|' ')
2586                 case "$hintfile" in
2587                 ''|' '|none) dflt=none ;;
2588                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2589                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2590                         case "$dflt" in
2591                         ''|' ') dflt=none ;;
2592                         esac
2593                         ;;
2594                 esac
2595                 ;;
2596         *) dflt="$osvers" ;;
2597 esac
2598 rp="Operating system version?"
2599 . ./myread
2600 case "$ans" in
2601 none)  osvers='' ;;
2602 *) osvers="$ans" ;;
2603 esac
2604
2605
2606 . ./posthint.sh
2607
2608 : who configured the system
2609 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2610 cf_by=`(logname) 2>/dev/null`
2611 case "$cf_by" in
2612 "")
2613         cf_by=`(whoami) 2>/dev/null`
2614         case "$cf_by" in
2615         "") cf_by=unknown ;;
2616         esac ;;
2617 esac
2618
2619 : set up the script used to warn in case of inconsistency
2620 cat <<EOS >whoa
2621 $startsh
2622 EOS
2623 cat <<'EOSC' >>whoa
2624 dflt=y
2625 echo " "
2626 echo "*** WHOA THERE!!! ***" >&4
2627 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2628 rp="    Keep the $hint value?"
2629 . ./myread
2630 case "$ans" in
2631 y) td=$was; tu=$was;;
2632 esac
2633 EOSC
2634
2635 : function used to set $1 to $val
2636 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2637 case "$val$was" in
2638 $define$undef) . ./whoa; eval "$var=\$td";;
2639 $undef$define) . ./whoa; eval "$var=\$tu";;
2640 *) eval "$var=$val";;
2641 esac'
2642
2643 case "$usethreads" in
2644 $define|true|[yY]*)     dflt='y';;
2645 *) dflt='n';;
2646 esac
2647 cat <<EOM
2648
2649 Perl can be built to take advantage of threads on some systems.
2650 To do so, Configure can be run with -Dusethreads.
2651
2652 Note that threading is a highly experimental feature, and
2653 some known race conditions still remain.  If you choose to try
2654 it, be very sure to not actually deploy it for production
2655 purposes.  README.threads has more details, and is required
2656 reading if you enable threads.
2657
2658 If this doesn't make any sense to you, just accept the default '$dflt'.
2659 EOM
2660 rp='Build a threading Perl?'
2661 . ./myread
2662 case "$ans" in
2663 y|Y)    val="$define" ;;
2664 *)      val="$undef" ;;
2665 esac
2666 set usethreads
2667 eval $setvar
2668
2669 case "$usethreads" in
2670 $define)
2671         $cat <<EOM
2672
2673 As of 5.5.640, Perl has two different internal threading implementations,
2674 the 5.005 version (5005threads) and an interpreter-based version
2675 (ithreads) that has one interpreter per thread.  Both are very 
2676 experimental.  This arrangement exists to help developers work out
2677 which one is better.
2678
2679 If you're a casual user, you probably don't want interpreter-threads
2680 at this time.  There doesn't yet exist a way to create threads from
2681 within Perl in this model, i.e., "use Thread;" will NOT work.
2682 EOM
2683         : Default to ithreads unless overridden on command line or with
2684         : old config.sh
2685         dflt='y'
2686         case "$use5005threads" in
2687                 $define|true|[yY]*) dflt='n';;
2688         esac
2689         case "$useithreads" in
2690                 $undef|false|[nN]*) dflt='n';;
2691         esac
2692         rp='Use interpreter-based ithreads?'
2693         . ./myread
2694         case "$ans" in
2695         y|Y)    val="$define" ;;
2696         *)      val="$undef" ;;
2697         esac
2698         set useithreads
2699         eval $setvar
2700         : Now set use5005threads to the opposite value.
2701         case "$useithreads" in
2702         $define) val="$undef" ;;
2703         *) val="$define" ;;
2704         esac
2705         set use5005threads
2706         eval $setvar
2707         ;;
2708 *)
2709         useithreads="$undef"
2710         use5005threads="$undef"
2711         ;;
2712 esac
2713
2714 case "$d_oldpthreads" in
2715 '')     : Configure tests would be welcome here.  For now, assume undef.
2716         val="$undef" ;;
2717 *)      val="$d_oldpthreads" ;;
2718 esac
2719 set d_oldpthreads
2720 eval $setvar
2721
2722
2723 case "$usethreads" in
2724 "$define"|true|[yY]*)
2725 : Look for a hint-file generated 'call-back-unit'.  If the
2726 : user has specified that a threading perl is to be built,
2727 : we may need to set or change some other defaults.
2728         if $test -f usethreads.cbu; then
2729                 echo "Your platform has some specific hints for threaded builds, using them..."
2730                 . ./usethreads.cbu
2731         else
2732                 $cat <<EOM
2733 (Your platform doesn't have any specific hints for threaded builds.
2734  Assuming POSIX threads, then.)
2735 EOM
2736         fi
2737         ;;
2738 esac
2739
2740 cat <<EOM
2741
2742 Perl can be built so that multiple Perl interpreters can coexist
2743 within the same Perl executable.
2744 EOM
2745
2746 case "$useithreads" in
2747 $define)
2748         cat <<EOM
2749 This multiple interpreter support is required for interpreter-based threads.
2750 EOM
2751         val="$define"
2752         ;;
2753 *)      case "$usemultiplicity" in
2754         $define|true|[yY]*)     dflt='y';;
2755         *) dflt='n';;
2756         esac
2757         echo " "
2758         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2759         rp='Build Perl for multiplicity?'
2760         . ./myread
2761         case "$ans" in
2762         y|Y)    val="$define" ;;
2763         *)      val="$undef" ;;
2764         esac
2765         ;;
2766 esac
2767 set usemultiplicity
2768 eval $setvar
2769
2770 : determine where manual pages are on this system
2771 echo " "
2772 case "$sysman" in
2773 '') 
2774         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2775         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2776         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2777         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2778         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2779         sysman=`./loc . /usr/man/man1 $syspath`
2780         ;;
2781 esac
2782 if $test -d "$sysman"; then
2783         echo "System manual is in $sysman." >&4
2784 else
2785         echo "Could not find manual pages in source form." >&4
2786 fi
2787
2788 : see what memory models we can support
2789 case "$models" in
2790 '')
2791         $cat >pdp11.c <<'EOP'
2792 int main() {
2793 #ifdef pdp11
2794         exit(0);
2795 #else
2796         exit(1);
2797 #endif
2798 }
2799 EOP
2800         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2801         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2802                 dflt='unsplit split'
2803         else
2804                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2805                 case "$tans" in
2806                 X) dflt='none';;
2807                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2808                                 dflt='small'
2809                         else
2810                                 dflt=''
2811                         fi
2812                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2813                                 dflt="$dflt medium"
2814                         fi
2815                         if $test -d /lib/large || $test -d /usr/lib/large; then
2816                                 dflt="$dflt large"
2817                         fi
2818                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2819                                 dflt="$dflt huge"
2820                         fi
2821                 esac
2822         fi;;
2823 *) dflt="$models";;
2824 esac
2825 $cat <<EOM
2826  
2827 Some systems have different model sizes.  On most systems they are called
2828 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2829 split.  If your system doesn't support different memory models, say "none".
2830 If you wish to force everything to one memory model, say "none" here and
2831 put the appropriate flags later when it asks you for other cc and ld flags.
2832 Venix systems may wish to put "none" and let the compiler figure things out.
2833 (In the following question multiple model names should be space separated.)
2834
2835 The default for most systems is "none".
2836
2837 EOM
2838 rp="Which memory models are supported?"
2839 . ./myread
2840 models="$ans"
2841
2842 case "$models" in
2843 none)
2844         small=''
2845         medium=''
2846         large=''
2847         huge=''
2848         unsplit=''
2849         split=''
2850         ;;
2851 *split)
2852         case "$split" in
2853         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2854                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2855                         dflt='-i'
2856                 else
2857                         dflt='none'
2858                 fi;;
2859         *) dflt="$split";;
2860         esac
2861         rp="What flag indicates separate I and D space?"
2862         . ./myread
2863         tans="$ans"
2864         case "$tans" in
2865         none) tans='';;
2866         esac
2867         split="$tans"
2868         unsplit='';;
2869 *large*|*small*|*medium*|*huge*)
2870         case "$models" in
2871         *large*)
2872                 case "$large" in
2873                 '') dflt='-Ml';;
2874                 *) dflt="$large";;
2875                 esac
2876         rp="What flag indicates large model?"
2877         . ./myread
2878         tans="$ans"
2879         case "$tans" in
2880         none) tans='';
2881         esac
2882         large="$tans";;
2883         *) large='';;
2884         esac
2885         case "$models" in
2886         *huge*) case "$huge" in
2887                 '') dflt='-Mh';;
2888                 *) dflt="$huge";;
2889                 esac
2890                 rp="What flag indicates huge model?"
2891                 . ./myread
2892                 tans="$ans"
2893                 case "$tans" in
2894                 none) tans='';
2895                 esac
2896                 huge="$tans";;
2897         *) huge="$large";;
2898         esac
2899         case "$models" in
2900         *medium*) case "$medium" in
2901                 '') dflt='-Mm';;
2902                 *) dflt="$medium";;
2903                 esac
2904                 rp="What flag indicates medium model?"
2905                 . ./myread
2906                 tans="$ans"
2907                 case "$tans" in
2908                 none) tans='';
2909                 esac
2910                 medium="$tans";;
2911         *) medium="$large";;
2912         esac
2913         case "$models" in
2914         *small*) case "$small" in
2915                 '') dflt='none';;
2916                 *) dflt="$small";;
2917                 esac
2918                 rp="What flag indicates small model?"
2919                 . ./myread
2920                 tans="$ans"
2921                 case "$tans" in
2922                 none) tans='';
2923                 esac
2924                 small="$tans";;
2925         *) small='';;
2926         esac
2927         ;;
2928 *)
2929         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2930         ;;
2931 esac
2932 $rm -f pdp11.* pdp11
2933
2934 : make some quick guesses about what we are up against
2935 echo " "
2936 $echo $n "Hmm...  $c"
2937 echo exit 1 >bsd
2938 echo exit 1 >usg
2939 echo exit 1 >v7
2940 echo exit 1 >osf1
2941 echo exit 1 >eunice
2942 echo exit 1 >xenix
2943 echo exit 1 >venix
2944 echo exit 1 >os2
2945 d_bsd="$undef"
2946 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2947 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2948 then
2949         echo "Looks kind of like an OSF/1 system, but we'll see..."
2950         echo exit 0 >osf1
2951 elif test `echo abc | tr a-z A-Z` = Abc ; then
2952         xxx=`./loc addbib blurfl $pth`
2953         if $test -f $xxx; then
2954         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2955                 echo exit 0 >bsd
2956                 echo exit 0 >usg
2957         else
2958                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2959                         echo "Looks kind of like an extended USG system, but we'll see..."
2960                 else
2961                         echo "Looks kind of like a USG system, but we'll see..."
2962                 fi
2963                 echo exit 0 >usg
2964         fi
2965 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2966         echo "Looks kind of like a BSD system, but we'll see..."
2967         d_bsd="$define"
2968         echo exit 0 >bsd
2969 else
2970         echo "Looks kind of like a Version 7 system, but we'll see..."
2971         echo exit 0 >v7
2972 fi
2973 case "$eunicefix" in
2974 *unixtovms*)
2975         $cat <<'EOI'
2976 There is, however, a strange, musty smell in the air that reminds me of
2977 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2978 EOI
2979         echo exit 0 >eunice
2980         d_eunice="$define"
2981 : it so happens the Eunice I know will not run shell scripts in Unix format
2982         ;;
2983 *)
2984         echo " "
2985         echo "Congratulations.  You aren't running Eunice."
2986         d_eunice="$undef"
2987         ;;
2988 esac
2989 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2990 case "$p_" in
2991 :) ;;
2992 *)
2993         $cat <<'EOI'
2994 I have the feeling something is not exactly right, however...don't tell me...
2995 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2996 EOI
2997         echo exit 0 >os2
2998         ;;
2999 esac
3000 if test -f /xenix; then
3001         echo "Actually, this looks more like a XENIX system..."
3002         echo exit 0 >xenix
3003         d_xenix="$define"
3004 else
3005         echo " "
3006         echo "It's not Xenix..."
3007         d_xenix="$undef"
3008 fi
3009 chmod +x xenix
3010 $eunicefix xenix
3011 if test -f /venix; then
3012         echo "Actually, this looks more like a VENIX system..."
3013         echo exit 0 >venix
3014 else
3015         echo " "
3016         if ./xenix; then
3017                 : null
3018         else
3019                 echo "Nor is it Venix..."
3020         fi
3021 fi
3022 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3023 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3024 $rm -f foo
3025
3026 : see if we need a special compiler
3027 echo " "
3028 if ./usg; then
3029         case "$cc" in
3030         '') case "$Mcc" in
3031                 /*) dflt='Mcc';;
3032                 *) case "$large" in
3033                         -M*) dflt='cc';;
3034                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3035                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3036                                                 dflt='cc'
3037                                         else
3038                                                 dflt='cc -M'
3039                                         fi
3040                                 else
3041                                         dflt='cc'
3042                                 fi;;
3043                         esac;;
3044                 esac;;
3045         *)  dflt="$cc";;
3046         esac
3047         case "$dflt" in
3048         *M*)    $cat <<'EOM'
3049 On some older systems the default C compiler will not resolve multiple global
3050 references that happen to have the same name.  On some such systems the "Mcc"
3051 command may be used to force these to be resolved.  On other systems a "cc -M"
3052 command is required.  (Note that the -M flag on other systems indicates a
3053 memory model to use!) If you have the Gnu C compiler, you might wish to use
3054 that instead.
3055
3056 EOM
3057         ;;
3058         esac
3059         rp="Use which C compiler?"
3060         . ./myread
3061         cc="$ans"
3062 else
3063         case "$cc" in
3064         '') dflt=cc;;
3065         *) dflt="$cc";;
3066         esac
3067         rp="Use which C compiler?"
3068         . ./myread
3069         cc="$ans"
3070 fi
3071 : Look for a hint-file generated 'call-back-unit'.  Now that the
3072 : user has specified the compiler, we may need to set or change some
3073 : other defaults.
3074 if $test -f cc.cbu; then
3075     . ./cc.cbu
3076 fi
3077 echo " "
3078 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3079 $cat >gccvers.c <<EOM
3080 #include <stdio.h>
3081 int main() {
3082 #ifdef __GNUC__
3083 #ifdef __VERSION__
3084         printf("%s\n", __VERSION__);
3085 #else
3086         printf("%s\n", "1");
3087 #endif
3088 #endif
3089         exit(0);
3090 }
3091 EOM
3092 if $cc $ldflags -o gccvers gccvers.c; then
3093         gccversion=`./gccvers`
3094         case "$gccversion" in
3095         '') echo "You are not using GNU cc." ;;
3096         *)  echo "You are using GNU cc $gccversion."
3097             ;;
3098         esac
3099 else
3100         echo " "
3101         echo "*** WHOA THERE!!! ***" >&4
3102         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3103         case "$knowitall" in
3104         '')
3105         echo "    You'd better start hunting for one and let me know about it." >&4
3106                 exit 1
3107                 ;;
3108         esac
3109 fi
3110 $rm -f gccvers*
3111 case "$gccversion" in
3112 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3113 esac
3114
3115 : decide how portable to be.  Allow command line overrides.
3116 case "$d_portable" in
3117 "$undef") ;;
3118 *)      d_portable="$define" ;;
3119 esac
3120
3121 : set up shell script to do ~ expansion
3122 cat >filexp <<EOSS
3123 $startsh
3124 : expand filename
3125 case "\$1" in
3126  ~/*|~)
3127         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3128         ;;
3129  ~*)
3130         if $test -f /bin/csh; then
3131                 /bin/csh -f -c "glob \$1"
3132                 failed=\$?
3133                 echo ""
3134                 exit \$failed
3135         else
3136                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3137                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3138                 if $test ! -d "\$dir"; then
3139                         me=\`basename \$0\`
3140                         echo "\$me: can't locate home directory for: \$name" >&2
3141                         exit 1
3142                 fi
3143                 case "\$1" in
3144                 */*)
3145                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3146                         ;;
3147                 *)
3148                         echo \$dir
3149                         ;;
3150                 esac
3151         fi
3152         ;;
3153 *)
3154         echo \$1
3155         ;;
3156 esac
3157 EOSS
3158 chmod +x filexp
3159 $eunicefix filexp
3160
3161 : now set up to get a file name
3162 cat <<EOS >getfile
3163 $startsh
3164 EOS
3165 cat <<'EOSC' >>getfile
3166 tilde=''
3167 fullpath=''
3168 already=''
3169 skip=''
3170 none_ok=''
3171 exp_file=''
3172 nopath_ok=''
3173 orig_rp="$rp"
3174 orig_dflt="$dflt"
3175 case "$gfpth" in
3176 '') gfpth='.' ;;
3177 esac
3178
3179 case "$fn" in
3180 *\(*)
3181         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3182         fn=`echo $fn | sed 's/(.*)//'`
3183         ;;
3184 esac
3185
3186 case "$fn" in
3187 *:*)
3188         loc_file=`expr $fn : '.*:\(.*\)'`
3189         fn=`expr $fn : '\(.*\):.*'`
3190         ;;
3191 esac
3192
3193 case "$fn" in
3194 *~*) tilde=true;;
3195 esac
3196 case "$fn" in
3197 */*) fullpath=true;;
3198 esac
3199 case "$fn" in
3200 *+*) skip=true;;
3201 esac
3202 case "$fn" in
3203 *n*) none_ok=true;;
3204 esac
3205 case "$fn" in
3206 *e*) exp_file=true;;
3207 esac
3208 case "$fn" in
3209 *p*) nopath_ok=true;;
3210 esac
3211
3212 case "$fn" in
3213 *f*) type='File';;
3214 *d*) type='Directory';;
3215 *l*) type='Locate';;
3216 esac
3217
3218 what="$type"
3219 case "$what" in
3220 Locate) what='File';;
3221 esac
3222
3223 case "$exp_file" in
3224 '')
3225         case "$d_portable" in
3226         "$define") ;;
3227         *) exp_file=true;;
3228         esac
3229         ;;
3230 esac
3231
3232 cd ..
3233 while test "$type"; do
3234         redo=''
3235         rp="$orig_rp"
3236         dflt="$orig_dflt"
3237         case "$tilde" in
3238         true) rp="$rp (~name ok)";;
3239         esac
3240         . UU/myread
3241         if test -f UU/getfile.ok && \
3242                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3243         then
3244                 value="$ans"
3245                 ansexp="$ans"
3246                 break
3247         fi
3248         case "$ans" in
3249         none)
3250                 value=''
3251                 ansexp=''
3252                 case "$none_ok" in
3253                 true) type='';;
3254                 esac
3255                 ;;
3256         *)
3257                 case "$tilde" in
3258                 '') value="$ans"
3259                         ansexp="$ans";;
3260                 *)
3261                         value=`UU/filexp $ans`
3262                         case $? in
3263                         0)
3264                                 if test "$ans" != "$value"; then
3265                                         echo "(That expands to $value on this system.)"
3266                                 fi
3267                                 ;;
3268                         *) value="$ans";;
3269                         esac
3270                         ansexp="$value"
3271                         case "$exp_file" in
3272                         '') value="$ans";;
3273                         esac
3274                         ;;
3275                 esac
3276                 case "$fullpath" in
3277                 true)
3278                         case "$ansexp" in
3279                         /*) value="$ansexp" ;;
3280                         *)
3281                                 redo=true
3282                                 case "$already" in
3283                                 true)
3284                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3285                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3286                                         ;;
3287                                 *)
3288                                 echo "Please give a full path name, starting with slash." >&4
3289                                         case "$tilde" in
3290                                         true)
3291                                 echo "Note that using ~name is ok provided it expands well." >&4
3292                                                 already=true
3293                                                 ;;
3294                                         esac
3295                                 esac
3296                                 ;;
3297                         esac
3298                         ;;
3299                 esac
3300                 case "$redo" in
3301                 '')
3302                         case "$type" in
3303                         File)
3304                                 for fp in $gfpth; do
3305                                         if test "X$fp" = X.; then
3306                                             pf="$ansexp"
3307                                         else    
3308                                             pf="$fp/$ansexp"
3309                                         fi
3310                                         if test -f "$pf"; then
3311                                                 type=''
3312                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3313                                         then
3314                                                 echo "($value is not a plain file, but that's ok.)"
3315                                                 type=''
3316                                         fi
3317                                         if test X"$type" = X; then
3318                                             value="$pf"
3319                                             break
3320                                         fi
3321                                 done
3322                                 ;;
3323                         Directory)
3324                                 for fp in $gfpth; do
3325                                         if test "X$fp" = X.; then
3326                                             dir="$ans"
3327                                             direxp="$ansexp"
3328                                         else    
3329                                             dir="$fp/$ansexp"
3330                                             direxp="$fp/$ansexp"
3331                                         fi
3332                                         if test -d "$direxp"; then
3333                                                 type=''
3334                                                 value="$dir"
3335                                                 break
3336                                         fi
3337                                 done
3338                                 ;;
3339                         Locate)
3340                                 if test -d "$ansexp"; then
3341                                         echo "(Looking for $loc_file in directory $value.)"
3342                                         value="$value/$loc_file"
3343                                         ansexp="$ansexp/$loc_file"
3344                                 fi
3345                                 if test -f "$ansexp"; then
3346                                         type=''
3347                                 fi
3348                                 case "$nopath_ok" in
3349                                 true)   case "$value" in
3350                                         */*) ;;
3351                                         *)      echo "Assuming $value will be in people's path."
3352                                                 type=''
3353                                                 ;;
3354                                         esac
3355                                         ;;
3356                                 esac
3357                                 ;;
3358                         esac
3359
3360                         case "$skip" in
3361                         true) type='';
3362                         esac
3363
3364                         case "$type" in
3365                         '') ;;
3366                         *)
3367                                 if test "$fastread" = yes; then
3368                                         dflt=y
3369                                 else
3370                                         dflt=n
3371                                 fi
3372                                 rp="$what $value doesn't exist.  Use that name anyway?"
3373                                 . UU/myread
3374                                 dflt=''
3375                                 case "$ans" in
3376                                 y*) type='';;
3377                                 *) echo " ";;
3378                                 esac
3379                                 ;;
3380                         esac
3381                         ;;
3382                 esac
3383                 ;;
3384         esac
3385 done
3386 cd UU
3387 ans="$value"
3388 rp="$orig_rp"
3389 dflt="$orig_dflt"
3390 rm -f getfile.ok
3391 test "X$gfpthkeep" != Xy && gfpth=""
3392 EOSC
3393
3394 : What should the include directory be ?
3395 echo " "
3396 $echo $n "Hmm...  $c"
3397 dflt='/usr/include'
3398 incpath=''
3399 mips_type=''
3400 if $test -f /bin/mips && /bin/mips; then
3401         echo "Looks like a MIPS system..."
3402         $cat >usr.c <<'EOCP'
3403 #ifdef SYSTYPE_BSD43
3404 /bsd43
3405 #endif
3406 EOCP
3407         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3408                 dflt='/bsd43/usr/include'
3409                 incpath='/bsd43'
3410                 mips_type='BSD 4.3'
3411         else
3412                 mips_type='System V'
3413         fi
3414         $rm -f usr.c usr.out
3415         echo "and you're compiling with the $mips_type compiler and libraries."
3416         xxx_prompt=y
3417         echo "exit 0" >mips
3418 else
3419         echo "Doesn't look like a MIPS system."
3420         xxx_prompt=n
3421         echo "exit 1" >mips
3422 fi
3423 chmod +x mips
3424 $eunicefix mips
3425 case "$usrinc" in
3426 '') ;;
3427 *) dflt="$usrinc";;
3428 esac
3429 case "$xxx_prompt" in
3430 y)      fn=d/
3431         echo " "
3432         rp='Where are the include files you want to use?'
3433         . ./getfile
3434         usrinc="$ans"
3435         ;;
3436 *)      usrinc="$dflt"
3437         ;;
3438 esac
3439
3440 : see how we invoke the C preprocessor
3441 echo " "
3442 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3443 cat <<'EOT' >testcpp.c
3444 #define ABC abc
3445 #define XYZ xyz
3446 ABC.XYZ
3447 EOT
3448 cd ..
3449 if test ! -f cppstdin; then
3450         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3451                 # AIX cc -E doesn't show the absolute headerfile
3452                 # locations but we'll cheat by using the -M flag.
3453                 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
3454         else
3455                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3456         fi
3457 else
3458         echo "Keeping your $hint cppstdin wrapper."
3459 fi
3460 chmod 755 cppstdin
3461 wrapper=`pwd`/cppstdin
3462 ok='false'
3463 cd UU
3464
3465 if $test "X$cppstdin" != "X" && \
3466         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3467         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3468 then
3469         echo "You used to use $cppstdin $cppminus so we'll use that again."
3470         case "$cpprun" in
3471         '') echo "But let's see if we can live without a wrapper..." ;;
3472         *)
3473                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3474                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3475                 then
3476                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3477                         ok='true'
3478                 else
3479                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3480                 fi
3481                 ;;
3482         esac
3483 else
3484         case "$cppstdin" in
3485         '') ;;
3486         *)
3487                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3488                 ;;
3489         esac
3490 fi
3491
3492 if $ok; then
3493         : nothing
3494 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3495         $cc -E <testcpp.c >testcpp.out 2>&1; \
3496         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3497         echo "Yup, it does."
3498         x_cpp="$cc -E"
3499         x_minus='';
3500 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3501         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3502         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3503         echo "Yup, it does."
3504         x_cpp="$cc -E"
3505         x_minus='-';
3506 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3507         $cc -P <testcpp.c >testcpp.out 2>&1; \
3508         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3509         echo "Yipee, that works!"
3510         x_cpp="$cc -P"
3511         x_minus='';
3512 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3513         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3514         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3515         echo "At long last!"
3516         x_cpp="$cc -P"
3517         x_minus='-';
3518 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3519         $cpp <testcpp.c >testcpp.out 2>&1; \
3520         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3521         echo "It works!"
3522         x_cpp="$cpp"
3523         x_minus='';
3524 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3525         $cpp - <testcpp.c >testcpp.out 2>&1; \
3526         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3527         echo "Hooray, it works!  I was beginning to wonder."
3528         x_cpp="$cpp"
3529         x_minus='-';
3530 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3531         $wrapper <testcpp.c >testcpp.out 2>&1; \
3532         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3533         x_cpp="$wrapper"
3534         x_minus=''
3535         echo "Eureka!"
3536 else
3537         dflt=''
3538         rp="No dice.  I can't find a C preprocessor.  Name one:"
3539         . ./myread
3540         x_cpp="$ans"
3541         x_minus=''
3542         $x_cpp <testcpp.c >testcpp.out 2>&1
3543         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3544                 echo "OK, that will do." >&4
3545         else
3546 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3547                 exit 1
3548         fi
3549 fi
3550
3551 case "$ok" in
3552 false)
3553         cppstdin="$x_cpp"
3554         cppminus="$x_minus"
3555         cpprun="$x_cpp"
3556         cpplast="$x_minus"
3557         set X $x_cpp
3558         shift
3559         case "$1" in
3560         "$cpp")
3561                 echo "Perhaps can we force $cc -E using a wrapper..."
3562                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3563                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3564                 then
3565                         echo "Yup, we can."
3566                         cppstdin="$wrapper"
3567                         cppminus='';
3568                 else
3569                         echo "Nope, we'll have to live without it..."
3570                 fi
3571                 ;;
3572         esac
3573         case "$cpprun" in
3574         "$wrapper")
3575                 cpprun=''
3576                 cpplast=''
3577                 ;;
3578         esac
3579         ;;
3580 esac
3581
3582 case "$cppstdin" in
3583 "$wrapper"|'cppstdin') ;;
3584 *) $rm -f $wrapper;;
3585 esac
3586 $rm -f testcpp.c testcpp.out
3587
3588 : Set private lib path
3589 case "$plibpth" in
3590 '') if ./mips; then
3591                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3592         fi;;
3593 esac
3594 case "$libpth" in
3595 ' ') dlist='';;
3596 '') dlist="$loclibpth $plibpth $glibpth";;
3597 *) dlist="$libpth";;
3598 esac
3599
3600 : Now check and see which directories actually exist, avoiding duplicates
3601 libpth=''
3602 for xxx in $dlist
3603 do
3604     if $test -d $xxx; then
3605                 case " $libpth " in
3606                 *" $xxx "*) ;;
3607                 *) libpth="$libpth $xxx";;
3608                 esac
3609     fi
3610 done
3611 $cat <<'EOM'
3612
3613 Some systems have incompatible or broken versions of libraries.  Among
3614 the directories listed in the question below, please remove any you
3615 know not to be holding relevant libraries, and add any that are needed.
3616 Say "none" for none.
3617
3618 EOM
3619 case "$libpth" in
3620 '') dflt='none';;
3621 *)
3622         set X $libpth
3623         shift
3624         dflt=${1+"$@"}
3625         ;;
3626 esac
3627 rp="Directories to use for library searches?"
3628 . ./myread
3629 case "$ans" in
3630 none) libpth=' ';;
3631 *) libpth="$ans";;
3632 esac
3633
3634 : compute shared library extension
3635 case "$so" in
3636 '')
3637         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3638                 dflt='sl'
3639         else
3640                 dflt='so'
3641         fi
3642         ;;
3643 *) dflt="$so";;
3644 esac
3645 $cat <<EOM
3646
3647 On some systems, shared libraries may be available.  Answer 'none' if
3648 you want to suppress searching of shared libraries for the remainder
3649 of this configuration.
3650
3651 EOM
3652 rp='What is the file extension used for shared libraries?'
3653 . ./myread
3654 so="$ans"
3655
3656 : Define several unixisms.
3657 : Hints files or command line option can be used to override them.
3658 : The convoluted testing is in case hints files set either the old
3659 : or the new name.
3660 case "$_exe" in
3661 '')     case "$exe_ext" in
3662     '') ;;
3663         *)      _exe="$exe_ext" ;;
3664         esac
3665         ;;
3666 esac
3667 case "$_a" in
3668 '')     case "$lib_ext" in
3669     '') _a='.a';;
3670         *)      _a="$lib_ext" ;;
3671         esac
3672         ;;
3673 esac
3674 case "$_o" in
3675 '') case "$obj_ext" in
3676         '')     _o='.o';;
3677         *)      _o="$obj_ext";;
3678         esac
3679         ;;
3680 esac
3681 case "$p_" in
3682 '') case "$path_sep" in
3683         '')     p_=':';;
3684         *)      p_="$path_sep";;
3685         esac
3686         ;;
3687 esac
3688 exe_ext=$_exe
3689 lib_ext=$_a
3690 obj_ext=$_o
3691 path_sep=$p_
3692
3693 : Which makefile gets called first.  This is used by make depend.
3694 case "$firstmakefile" in
3695 '') firstmakefile='makefile';;
3696 esac
3697
3698 case "$usesocks" in
3699 $define|true|[yY]*)     dflt='y';;
3700 *) dflt='n';;
3701 esac
3702 cat <<EOM
3703
3704 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3705 Configure must be run with -Dusesocks.
3706
3707 If this doesn't make any sense to you, just accept the default '$dflt'.
3708 EOM
3709 rp='Build Perl for SOCKS?'
3710 . ./myread
3711 case "$ans" in
3712 y|Y)    val="$define" ;;     
3713 *)      val="$undef" ;;
3714 esac
3715 set usesocks
3716 eval $setvar
3717
3718 : Looking for optional libraries
3719 echo " "
3720 echo "Checking for optional libraries..." >&4
3721 case "$libs" in
3722 ' '|'') dflt='';;
3723 *) dflt="$libs";;
3724 esac
3725 case "$libswanted" in
3726 '') libswanted='c_s';;
3727 esac
3728 case "$usesocks" in
3729 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3730 esac
3731 libsfound=''
3732 libsfiles=''
3733 libsdirs=''
3734 libspath=''
3735 for thisdir in $libpth $xlibpth; do
3736   test -d $thisdir && libspath="$libspath $thisdir"
3737 done
3738 for thislib in $libswanted; do
3739         for thisdir in $libspath; do
3740             xxx=''
3741             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3742                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3743                 $test -f "$xxx" && eval $libscheck
3744                 $test -f "$xxx" && libstyle=shared
3745             fi
3746             if test ! -f "$xxx"; then
3747                 xxx=$thisdir/lib$thislib.$so
3748                 $test -f "$xxx" && eval $libscheck
3749                 $test -f "$xxx" && libstyle=shared
3750             fi  
3751             if test ! -f "$xxx"; then
3752                 xxx=$thisdir/lib$thislib$_a
3753                 $test -f "$xxx" && eval $libscheck
3754                 $test -f "$xxx" && libstyle=static
3755             fi
3756             if test ! -f "$xxx"; then
3757                 xxx=$thisdir/$thislib$_a
3758                 $test -f "$xxx" && eval $libscheck
3759                 $test -f "$xxx" && libstyle=static
3760             fi
3761             if test ! -f "$xxx"; then
3762                 xxx=$thisdir/lib${thislib}_s$_a
3763                 $test -f "$xxx" && eval $libscheck
3764                 $test -f "$xxx" && libstyle=static
3765                 $test -f "$xxx" && thislib=${thislib}_s
3766             fi
3767             if test ! -f "$xxx"; then
3768                 xxx=$thisdir/Slib$thislib$_a
3769                 $test -f "$xxx" && eval $libscheck
3770                 $test -f "$xxx" && libstyle=static
3771             fi
3772             if $test -f "$xxx"; then
3773                 case "$libstyle" in
3774                 shared) echo "Found -l$thislib (shared)." ;;
3775                 static) echo "Found -l$thislib." ;;
3776                 *)      echo "Found -l$thislib ($libstyle)." ;;
3777                 esac
3778                 case " $dflt " in
3779                 *"-l$thislib "*);;
3780                 *) dflt="$dflt -l$thislib"
3781                    libsfound="$libsfound $xxx"
3782                    yyy=`basename $xxx`
3783                    libsfiles="$libsfiles $yyy"
3784                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3785                    case " $libsdirs " in
3786                    *" $yyy "*) ;;
3787                    *) libsdirs="$libsdirs $yyy" ;;
3788                    esac
3789                    ;;
3790                 esac
3791                 break
3792             fi  
3793         done
3794         if $test ! -f "$xxx"; then
3795             echo "No -l$thislib."
3796         fi
3797 done
3798 set X $dflt
3799 shift
3800 dflt="$*"
3801 case "$libs" in
3802 '') dflt="$dflt";;
3803 *) dflt="$libs";;
3804 esac
3805 case "$dflt" in
3806 ' '|'') dflt='none';;
3807 esac
3808
3809 $cat <<EOM
3810
3811 In order to compile $package on your machine, a number of libraries
3812 are usually needed.  Include any other special libraries here as well.
3813 Say "none" for none.  The default list is almost always right.
3814 EOM
3815
3816 echo " "
3817 rp="What libraries to use?"
3818 . ./myread
3819 case "$ans" in
3820 none) libs=' ';;
3821 *) libs="$ans";;
3822 esac
3823
3824 : determine optimization, if desired, or use for debug flag also
3825 case "$optimize" in
3826 ' '|$undef) dflt='none';;
3827 '') dflt='-O';;
3828 *) dflt="$optimize";;
3829 esac
3830 $cat <<EOH
3831
3832 By default, $package compiles with the -O flag to use the optimizer.
3833 Alternately, you might want to use the symbolic debugger, which uses
3834 the -g flag (on traditional Unix systems).  Either flag can be
3835 specified here.  To use neither flag, specify the word "none".
3836
3837 EOH
3838 rp="What optimizer/debugger flag should be used?"
3839 . ./myread
3840 optimize="$ans"
3841 case "$optimize" in
3842 'none') optimize=" ";;
3843 esac
3844
3845 dflt=''
3846 : We will not override a previous value, but we might want to
3847 : augment a hint file
3848 case "$hint" in
3849 default|recommended)
3850         case "$gccversion" in
3851         1*) dflt='-fpcc-struct-return' ;;
3852         esac
3853         case "$optimize" in
3854         *-g*) dflt="$dflt -DDEBUGGING";;
3855         esac
3856         case "$gccversion" in
3857         2*) if test -d /etc/conf/kconfig.d &&
3858                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3859                 then
3860                         dflt="$dflt -posix"
3861                 fi
3862                 ;;
3863         esac
3864         case "$gccversion" in
3865         1*) ;;
3866         2.[0-8]*) ;;
3867         ?*)     echo " "
3868                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3869                 echo 'int main(void) { return 0; }' > gcctest.c
3870                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3871                         echo "Yes, it does." 2>&1
3872                         case "$ccflags" in
3873                         *strict-aliasing*) 
3874                                 echo "Leaving current flags $ccflags alone." 2>&1
3875                                 ;;
3876                         *) dflt="$dflt -fno-strict-aliasing" ;;
3877                         esac
3878                 else
3879                         echo "Nope, it doesn't, but that's ok." 2>&1
3880                 fi
3881                 ;;
3882         esac
3883         ;;
3884 esac
3885
3886 case "$mips_type" in
3887 *BSD*|'') inclwanted="$locincpth $usrinc";;
3888 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3889 esac
3890 for thisincl in $inclwanted; do
3891         if $test -d $thisincl; then
3892                 if $test x$thisincl != x$usrinc; then
3893                         case "$dflt" in
3894                         *$thisincl*);;
3895                         *) dflt="$dflt -I$thisincl";;
3896                         esac
3897                 fi
3898         fi
3899 done
3900
3901 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3902         xxx=true;
3903 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3904         xxx=true;
3905 else
3906         xxx=false;
3907 fi;
3908 if $xxx; then
3909         case "$dflt" in
3910         *$2*);;
3911         *) dflt="$dflt -D$2";;
3912         esac;
3913 fi'
3914
3915 set signal.h LANGUAGE_C; eval $inctest
3916
3917 case "$usesocks" in
3918 $define)
3919         ccflags="$ccflags -DSOCKS"
3920         ;;
3921 esac
3922
3923 case "$hint" in
3924 default|recommended) dflt="$ccflags $dflt" ;;
3925 *) dflt="$ccflags";;
3926 esac
3927
3928 case "$dflt" in
3929 ''|' ') dflt=none;;
3930 esac
3931 $cat <<EOH
3932
3933 Your C compiler may want other flags.  For this question you should include
3934 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3935 but you should NOT include libraries or ld flags like -lwhatever.  If you
3936 want $package to honor its debug switch, you should include -DDEBUGGING here.
3937 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3938
3939 To use no flags, specify the word "none".
3940
3941 EOH
3942 set X $dflt
3943 shift
3944 dflt=${1+"$@"}
3945 rp="Any additional cc flags?"
3946 . ./myread
3947 case "$ans" in
3948 none) ccflags='';;
3949 *) ccflags="$ans";;
3950 esac
3951
3952 : the following weeds options from ccflags that are of no interest to cpp
3953 cppflags="$ccflags"
3954 case "$gccversion" in
3955 1*) cppflags="$cppflags -D__GNUC__"
3956 esac
3957 case "$mips_type" in
3958 '');;
3959 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3960 esac
3961 case "$cppflags" in
3962 '');;
3963 *)
3964         echo " "
3965         echo "Let me guess what the preprocessor flags are..." >&4
3966         set X $cppflags
3967         shift
3968         cppflags=''
3969         $cat >cpp.c <<'EOM'
3970 #define BLURFL foo
3971
3972 BLURFL xx LFRULB
3973 EOM
3974         previous=''
3975         for flag in $*
3976         do
3977                 case "$flag" in
3978                 -*) ftry="$flag";;
3979                 *) ftry="$previous $flag";;
3980                 esac
3981                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3982                         >cpp1.out 2>/dev/null && \
3983                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3984                         >cpp2.out 2>/dev/null && \
3985                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3986                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3987                 then
3988                         cppflags="$cppflags $ftry"
3989                         previous=''
3990                 else
3991                         previous="$flag"
3992                 fi
3993         done
3994         set X $cppflags
3995         shift
3996         cppflags=${1+"$@"}
3997         case "$cppflags" in
3998         *-*)  echo "They appear to be: $cppflags";;
3999         esac
4000         $rm -f cpp.c cpp?.out
4001         ;;
4002 esac
4003
4004 : flags used in final linking phase
4005 case "$ldflags" in
4006 '') if ./venix; then
4007                 dflt='-i -z'
4008         else
4009                 dflt=''
4010         fi
4011         case "$ccflags" in
4012         *-posix*) dflt="$dflt -posix" ;;
4013         esac
4014         ;;
4015 *) dflt="$ldflags";;
4016 esac
4017
4018 : Try to guess additional flags to pick up local libraries.
4019 for thislibdir in $libpth; do
4020         case " $loclibpth " in
4021         *" $thislibdir "*)
4022                 case "$dflt " in 
4023                 *"-L$thislibdir "*) ;;
4024                 *)  dflt="$dflt -L$thislibdir" ;;
4025                 esac
4026                 ;;
4027         esac
4028 done
4029
4030 case "$dflt" in
4031 '') dflt='none' ;;
4032 esac
4033
4034 $cat <<EOH
4035
4036 Your C linker may need flags.  For this question you should
4037 include -L/whatever and any other flags used by the C linker, but you
4038 should NOT include libraries like -lwhatever.
4039
4040 Make sure you include the appropriate -L/path flags if your C linker
4041 does not normally search all of the directories you specified above,
4042 namely
4043         $libpth
4044 To use no flags, specify the word "none".
4045
4046 EOH
4047
4048 rp="Any additional ld flags (NOT including libraries)?"
4049 . ./myread
4050 case "$ans" in
4051 none) ldflags='';;
4052 *) ldflags="$ans";;
4053 esac
4054 rmlist="$rmlist pdp11"
4055
4056 : coherency check
4057 echo " "
4058 echo "Checking your choice of C compiler and flags for coherency..." >&4
4059 $cat > try.c <<'EOF'
4060 #include <stdio.h>
4061 int main() { printf("Ok\n"); exit(0); }
4062 EOF
4063 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4064 shift
4065 $cat >try.msg <<'EOM'
4066 I've tried to compile and run the following simple program:
4067
4068 EOM
4069 $cat try.c >> try.msg
4070
4071 $cat >> try.msg <<EOM
4072
4073 I used the command:
4074
4075         $*
4076         ./try
4077
4078 and I got the following output:
4079
4080 EOM
4081 dflt=y
4082 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4083         if sh -c './try' >>try.msg 2>&1; then
4084                 xxx=`./try`
4085                 case "$xxx" in
4086                 "Ok") dflt=n ;;
4087                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4088                         case " $libs " in
4089                         *" -lsfio "*)
4090                                 cat >> try.msg <<'EOQS'
4091 If $libs contains -lsfio, and sfio is mis-configured, then it
4092 sometimes (apparently) runs and exits with a 0 status, but with no
4093 output!  It may have to do with sfio's use of _exit vs. exit.
4094
4095 EOQS
4096                                 rp="You have a big problem.  Shall I abort Configure"
4097                                 dflt=y
4098                                 ;;
4099                         esac
4100                         ;;
4101                 esac
4102         else
4103                 echo "The program compiled OK, but exited with status $?." >>try.msg
4104                 rp="You have a problem.  Shall I abort Configure"
4105                 dflt=y
4106         fi
4107 else
4108         echo "I can't compile the test program." >>try.msg
4109         rp="You have a BIG problem.  Shall I abort Configure"
4110         dflt=y
4111 fi
4112 case "$dflt" in
4113 y)
4114         $cat try.msg >&4
4115         case "$knowitall" in
4116         '')
4117                 echo "(The supplied flags or libraries might be incorrect.)"
4118                 ;;
4119         *) dflt=n;;
4120         esac
4121         echo " "
4122         . ./myread
4123         case "$ans" in
4124         n*|N*) ;;
4125         *)      echo "Ok.  Stopping Configure." >&4
4126                 exit 1
4127                 ;;
4128         esac
4129         ;;
4130 n) echo "OK, that should do.";;
4131 esac
4132 $rm -f try try.* core
4133
4134 : define an is-a-typedef? function
4135 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4136 case "$inclist" in
4137 "") inclist="sys/types.h";;
4138 esac;
4139 eval "varval=\$$var";
4140 case "$varval" in
4141 "")
4142         $rm -f temp.c;
4143         for inc in $inclist; do
4144                 echo "#include <$inc>" >>temp.c;
4145         done;
4146         echo "#ifdef $type" >> temp.c;
4147         echo "printf(\"We have $type\");" >> temp.c;
4148         echo "#endif" >> temp.c;
4149         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4150         if $contains $type temp.E >/dev/null 2>&1; then
4151                 eval "$var=\$type";
4152         else
4153                 eval "$var=\$def";
4154         fi;
4155         $rm -f temp.?;;
4156 *) eval "$var=\$varval";;
4157 esac'
4158
4159 : define an is-a-typedef? function that prompts if the type is not available.
4160 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4161 case "$inclist" in
4162 "") inclist="sys/types.h";;
4163 esac;
4164 eval "varval=\$$var";
4165 case "$varval" in
4166 "")
4167         $rm -f temp.c;
4168         for inc in $inclist; do
4169                 echo "#include <$inc>" >>temp.c;
4170         done;
4171         echo "#ifdef $type" >> temp.c;
4172         echo "printf(\"We have $type\");" >> temp.c;
4173         echo "#endif" >> temp.c;
4174         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4175         echo " " ;
4176         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4177         if $contains $type temp.E >/dev/null 2>&1; then
4178                 echo "$type found." >&4;
4179                 eval "$var=\$type";
4180         else
4181                 echo "$type NOT found." >&4;
4182                 dflt="$def";
4183                 . ./myread ;
4184                 eval "$var=\$ans";
4185         fi;
4186         $rm -f temp.?;;
4187 *) eval "$var=\$varval";;
4188 esac'
4189
4190 : define a shorthand compile call
4191 compile='
4192 mc_file=$1;
4193 shift;
4194 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4195 : define a shorthand compile call for compilations that should be ok.
4196 compile_ok='
4197 mc_file=$1;
4198 shift;
4199 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4200
4201 : check for lengths of integral types
4202 echo " "
4203 case "$intsize" in
4204 '')
4205         echo "Checking to see how big your integers are..." >&4
4206         $cat >intsize.c <<'EOCP'
4207 #include <stdio.h>
4208 int main()
4209 {
4210         printf("intsize=%d;\n", (int)sizeof(int));
4211         printf("longsize=%d;\n", (int)sizeof(long));
4212         printf("shortsize=%d;\n", (int)sizeof(short));
4213         exit(0);
4214 }
4215 EOCP
4216         set intsize
4217         if eval $compile_ok && ./intsize > /dev/null; then
4218                 eval `./intsize`
4219                 echo "Your integers are $intsize bytes long."
4220                 echo "Your long integers are $longsize bytes long."
4221                 echo "Your short integers are $shortsize bytes long."
4222         else
4223                 $cat >&4 <<EOM
4224 !
4225 Help! I can't compile and run the intsize test program: please enlighten me!
4226 (This is probably a misconfiguration in your system or libraries, and
4227 you really ought to fix it.  Still, I'll try anyway.)
4228 !
4229 EOM
4230                 dflt=4
4231                 rp="What is the size of an integer (in bytes)?"
4232                 . ./myread
4233                 intsize="$ans"
4234                 dflt=$intsize
4235                 rp="What is the size of a long integer (in bytes)?"
4236                 . ./myread
4237                 longsize="$ans"
4238                 dflt=2
4239                 rp="What is the size of a short integer (in bytes)?"
4240                 . ./myread
4241                 shortsize="$ans"
4242         fi
4243         ;;
4244 esac
4245 $rm -f intsize intsize.*
4246
4247 : see what type lseek is declared as in the kernel
4248 rp="What is the type used for lseek's offset on this system?"
4249 set off_t lseektype long stdio.h sys/types.h
4250 eval $typedef_ask
4251
4252 echo " "
4253 echo "Checking to see how big your file offsets are..." >&4
4254 $cat >try.c <<EOCP
4255 #include <sys/types.h>
4256 #include <stdio.h>
4257 int main()
4258 {
4259     printf("%d\n", (int)sizeof($lseektype));
4260     return(0); 
4261 }
4262 EOCP
4263 set try
4264 if eval $compile_ok; then
4265         lseeksize=`./try`
4266         echo "Your file offsets are $lseeksize bytes long."
4267 else
4268         dflt=$longsize
4269         echo " "
4270         echo "(I can't seem to compile the test program.  Guessing...)"
4271         rp="What is the size of your file offsets (in bytes)?"
4272         . ./myread
4273         lseeksize="$ans"
4274 fi
4275 $rm -f try.c try
4276
4277 : see what type file positions are declared as in the library
4278 rp="What is the type for file position used by fsetpos()?"
4279 set fpos_t fpostype long stdio.h sys/types.h
4280 eval $typedef_ask
4281
4282 echo " "
4283 case "$fpostype" in
4284 *_t) zzz="$fpostype"    ;;
4285 *)   zzz="fpos_t"       ;;
4286 esac
4287 echo "Checking the size of $zzz..." >&4 
4288 cat > try.c <<EOCP
4289 #include <sys/types.h>
4290 #include <stdio.h>
4291 int main() {
4292     printf("%d\n", (int)sizeof($fpostype));
4293     exit(0);
4294 }
4295 EOCP
4296 set try
4297 if eval $compile_ok; then
4298         yyy=`./try`
4299         case "$yyy" in
4300         '')     fpossize=4
4301                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4302                 ;;
4303         *)      fpossize=$yyy
4304                 echo "Your $zzz is $fpossize bytes long."
4305                 ;;
4306         esac
4307 else
4308         dflt="$longsize"
4309         echo " " >&4
4310         echo "(I can't compile the test program.  Guessing...)" >&4
4311         rp="What is the size of your file positions (in bytes)?"
4312         . ./myread
4313         fpossize="$ans"
4314 fi
4315
4316
4317
4318 # Backward compatibility (uselfs is deprecated).
4319 case "$uselfs" in
4320 "$define"|true|[yY]*)
4321         cat <<EOM >&4
4322
4323 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4324 EOM
4325         uselargefiles="$define"
4326         ;;
4327 esac                          
4328
4329 case "$lseeksize:$fpossize" in
4330 8:8) cat <<EOM
4331
4332 You can have files larger than 2 gigabytes.
4333 EOM
4334    val="$define" ;;
4335 *)    case "$uselargefiles" in
4336    "$undef"|false|[nN]*) dflt='n' ;;
4337    *)   dflt='y' ;;
4338    esac
4339    cat <<EOM
4340
4341 Perl can be built to understand large files (files larger than 2 gigabytes)
4342 on some systems.  To do so, Configure can be run with -Duselargefiles.
4343
4344 If this doesn't make any sense to you, just accept the default '$dflt'.
4345 EOM
4346    rp='Try to understand large files, if available?'
4347    . ./myread
4348    case "$ans" in
4349    y|Y)         val="$define" ;;
4350    *)           val="$undef"  ;;
4351    esac
4352    ;;
4353 esac
4354 set uselargefiles
4355 eval $setvar
4356 case "$uselargefiles" in
4357 "$define")
4358 : Look for a hint-file generated 'call-back-unit'.  If the
4359 : user has specified that a large files perl is to be built,
4360 : we may need to set or change some other defaults.
4361         if $test -f uselargefiles.cbu; then
4362                 echo "Your platform has some specific hints for large file builds, using them..."
4363                 . ./uselargefiles.cbu
4364                 echo " "
4365                 echo "Rechecking to see how big your file offsets are..." >&4
4366                 $cat >try.c <<EOCP
4367 #include <sys/types.h>
4368 #include <stdio.h>
4369 int main()
4370 {
4371     printf("%d\n", (int)sizeof($lseektype));
4372     return(0); 
4373 }
4374 EOCP
4375                 set try
4376                 if eval $compile_ok; then
4377                         lseeksize=`./try`
4378                         $echo "Your file offsets are now $lseeksize bytes long."
4379                 else
4380                         dflt="$lseeksize"
4381                         echo " "
4382                         echo "(I can't seem to compile the test program.  Guessing...)"
4383                         rp="What is the size of your file offsets (in bytes)?"
4384                         . ./myread
4385                         lseeksize="$ans"
4386                 fi
4387                 case "$fpostype" in
4388                 *_t) zzz="$fpostype"    ;;
4389                 *)   zzz="fpos_t"       ;;
4390                 esac
4391                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4392                 $cat > try.c <<EOCP
4393 #include <sys/types.h>
4394 #include <stdio.h>
4395 int main() {
4396     printf("%d\n", (int)sizeof($fpostype));
4397     exit(0);
4398 }
4399 EOCP
4400                 set try
4401                 if eval $compile_ok; then
4402                         yyy=`./try`
4403                         dflt="$lseeksize"
4404                         case "$yyy" in
4405                         '')     echo " "
4406                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4407                                 ;;
4408                         *)      fpossize=$yyy
4409                                 echo " $fpossize bytes." >&4
4410                                 ;;
4411                         esac
4412                 else
4413                         dflt="$fpossize"
4414                         echo " "
4415                         echo "(I can't compile the test program.  Guessing...)" >&4
4416                         rp="What is the size of your file positions (in bytes)?"
4417                         . ./myread
4418                         fpossize="$ans"
4419                 fi
4420                 $rm -f try.c try
4421         fi
4422         ;;
4423 esac
4424
4425
4426 case "$usemorebits" in
4427 "$define"|true|[yY]*)
4428         use64bitint="$define"
4429         uselongdouble="$define"
4430         usemorebits="$define"
4431         ;;
4432 *)      usemorebits="$undef"
4433         ;;
4434 esac
4435
4436
4437 case "$uselonglong" in
4438 "$define"|true|[yY]*)
4439         cat <<EOM >&4
4440
4441 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4442 EOM
4443         use64bitint="$define"
4444         ;;
4445 esac                          
4446 case "$use64bits" in
4447 "$define"|true|[yY]*)
4448         cat <<EOM >&4
4449
4450 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4451 EOM
4452         use64bitint="$define"
4453         ;;
4454 esac                          
4455 case "$use64bitints" in
4456 "$define"|true|[yY]*)
4457         cat <<EOM >&4
4458
4459 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4460 EOM
4461         use64bitint="$define"
4462         ;;
4463 esac                          
4464 case "$use64bitsint" in
4465 "$define"|true|[yY]*)
4466         cat <<EOM >&4
4467
4468 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4469 EOM
4470         use64bitint="$define"
4471         ;;
4472 esac                          
4473 case "$uselonglongs" in
4474 "$define"|true|[yY]*)
4475         cat <<EOM >&4
4476
4477 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4478 EOM
4479         use64bitint="$define"
4480         ;;
4481 esac                          
4482 case "$use64bitsall" in
4483 "$define"|true|[yY]*)
4484         cat <<EOM >&4
4485
4486 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4487 EOM
4488         use64bitall="$define"
4489         ;;
4490 esac                          
4491
4492 case "$ccflags" in
4493 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4494 esac
4495 case "$use64bitall" in
4496 "$define"|true|[yY]*) use64bitint="$define" ;;
4497 esac
4498
4499 case "$longsize" in
4500 8) cat <<EOM
4501
4502 You have natively 64-bit long integers.
4503 EOM
4504    val="$define"
4505    ;;
4506 *) case "$use64bitint" in
4507    "$define"|true|[yY]*) dflt='y';;
4508    *) dflt='n';;
4509    esac
4510    cat <<EOM
4511
4512 Perl can be built to take advantage of 64-bit integer types
4513 on some systems.  To do so, Configure can be run with -Duse64bitint.
4514 Choosing this option will most probably introduce binary incompatibilities.
4515
4516 If this doesn't make any sense to you, just accept the default '$dflt'.
4517 EOM
4518    rp='Try to use 64-bit integers, if available?'
4519    . ./myread
4520    case "$ans" in
4521    [yY]*) val="$define" ;;
4522    *)     val="$undef"  ;;
4523    esac
4524    ;;
4525 esac
4526 set use64bitint
4527 eval $setvar
4528
4529 case "$use64bitall" in
4530 "$define"|true|[yY]*) dflt='y' ;;
4531 *) case "$longsize" in
4532    8) dflt='y' ;;
4533    *) dflt='n' ;;
4534    esac
4535    ;;
4536 esac    
4537 cat <<EOM
4538
4539 You may also choose to try maximal 64-bitness.  It means using as much
4540 64-bitness as possible on the platform.  This in turn means even more
4541 binary incompatibilities.  On the other hand, your platform may not
4542 have any more 64-bitness available than what you already have chosen.
4543
4544 If this doesn't make any sense to you, just accept the default '$dflt'.
4545 EOM
4546 rp='Try to use maximal 64-bit support, if available?'
4547 . ./myread
4548 case "$ans" in
4549 [yY]*) val="$define" ;;
4550 *)     val="$undef"  ;;
4551 esac
4552 set use64bitall
4553 eval $setvar
4554 case "$use64bitall" in
4555 "$define")
4556         case "$use64bitint" in
4557         "$undef")
4558                 cat <<EOM
4559
4560 Since you have chosen a maximally 64-bit build, I'm also turning on
4561 the use of 64-bit integers.
4562 EOM
4563                 use64bitint="$define" ;;
4564         esac
4565         ;;
4566 esac
4567
4568 case "$use64bitint" in
4569 "$define"|true|[yY]*)
4570 : Look for a hint-file generated 'call-back-unit'.  If the
4571 : user has specified that a 64-bit perl is to be built,
4572 : we may need to set or change some other defaults.
4573         if $test -f use64bitint.cbu; then
4574                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4575                 . ./use64bitint.cbu
4576         fi
4577         case "$longsize" in
4578         4) case "$archname64" in
4579            '') archname64=64int ;;
4580            esac
4581            ;;
4582         esac
4583         ;;
4584 esac
4585
4586 case "$use64bitall" in
4587 "$define"|true|[yY]*)
4588 : Look for a hint-file generated 'call-back-unit'.  If the
4589 : user has specified that a maximally 64-bit perl is to be built,
4590 : we may need to set or change some other defaults.
4591         if $test -f use64bitall.cbu; then
4592                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4593                 . ./use64bitall.cbu
4594         fi
4595         case "$longsize" in
4596         4) case "$archname64" in
4597            ''|64int) archname64=64all ;;
4598            esac
4599            ;;
4600         esac
4601         ;;
4602 esac
4603
4604 : determine the architecture name
4605 echo " "
4606 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4607         tarch=`arch`"-$osname"
4608 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4609         if uname -m > tmparch 2>&1 ; then
4610                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4611                         -e 's/$/'"-$osname/" tmparch`
4612         else
4613                 tarch="$osname"
4614         fi
4615         $rm -f tmparch
4616 else
4617         tarch="$osname"
4618 fi
4619 case "$myarchname" in
4620 ''|"$tarch") ;;
4621 *)
4622         echo "(Your architecture name used to be $myarchname.)"
4623         archname=''
4624         ;;
4625 esac
4626 myarchname="$tarch"
4627 case "$archname" in
4628 '') dflt="$tarch";;
4629 *) dflt="$archname";;
4630 esac
4631 rp='What is your architecture name'
4632 . ./myread
4633 archname="$ans"
4634 case "$usethreads" in
4635 $define)
4636         echo "Threads selected." >&4
4637         case "$archname" in
4638         *-thread*) echo "...and architecture name already has -thread." >&4
4639                 ;;
4640         *)      archname="$archname-thread"
4641                 echo "...setting architecture name to $archname." >&4
4642                 ;;
4643         esac
4644         ;;
4645 esac
4646 case "$usemultiplicity" in
4647 $define)
4648         echo "Multiplicity selected." >&4
4649         case "$archname" in
4650         *-multi*) echo "...and architecture name already has -multi." >&4
4651                 ;;
4652         *)      archname="$archname-multi"
4653                 echo "...setting architecture name to $archname." >&4
4654                 ;;
4655         esac
4656         ;;
4657 esac
4658 case "$use64bitint" in
4659 $define)
4660         case "$archname64" in
4661         '')
4662                 ;;
4663         *)
4664                 case "$archname" in
4665                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4666                         ;;
4667                 *)      archname="$archname-$archname64"
4668                         echo "...setting architecture name to $archname." >&4
4669                         ;;
4670                 esac
4671                 ;;
4672         esac
4673 esac
4674
4675 : determine root of directory hierarchy where package will be installed.
4676 case "$prefix" in
4677 '')
4678         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4679         ;;
4680 *)
4681         dflt="$prefix"
4682         ;;
4683 esac
4684 $cat <<EOM
4685
4686 By default, $package will be installed in $dflt/bin, manual pages
4687 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4688 installation directories. Typically this is something like /usr/local.
4689 If you wish to have binaries under /usr/bin but other parts of the
4690 installation under /usr/local, that's ok: you will be prompted
4691 separately for each of the installation directories, the prefix being
4692 only used to set the defaults.
4693
4694 EOM
4695 fn=d~
4696 rp='Installation prefix to use?'
4697 . ./getfile
4698 oldprefix=''
4699 case "$prefix" in
4700 '') ;;
4701 *)
4702         case "$ans" in
4703         "$prefix") ;;
4704         *) oldprefix="$prefix";;
4705         esac
4706         ;;
4707 esac
4708 prefix="$ans"
4709 prefixexp="$ansexp"
4710
4711 : is AFS running?
4712 echo " "
4713 case "$afs" in
4714 $define|true)   afs=true ;;
4715 $undef|false)   afs=false ;;
4716 *)      if test -d /afs; then
4717                 afs=true
4718         else
4719                 afs=false
4720         fi
4721         ;;
4722 esac
4723 if $afs; then
4724         echo "AFS may be running... I'll be extra cautious then..." >&4
4725 else
4726         echo "AFS does not seem to be running..." >&4
4727 fi
4728
4729 : determine installation prefix for where package is to be installed.
4730 if $afs; then 
4731 $cat <<EOM
4732
4733 Since you are running AFS, I need to distinguish the directory in which
4734 files will reside from the directory in which they are installed (and from
4735 which they are presumably copied to the former directory by occult means).
4736
4737 EOM
4738         case "$installprefix" in
4739         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4740         *) dflt="$installprefix";;
4741         esac
4742 else
4743 $cat <<EOM
4744
4745 In some special cases, particularly when building $package for distribution,
4746 it is convenient to distinguish between the directory in which files should 
4747 be installed from the directory ($prefix) in which they 
4748 will eventually reside.  For most users, these two directories are the same.
4749
4750 EOM
4751         case "$installprefix" in
4752         '') dflt=$prefix ;;
4753         *) dflt=$installprefix;;
4754         esac
4755 fi
4756 fn=d~
4757 rp='What installation prefix should I use for installing files?'
4758 . ./getfile
4759 installprefix="$ans"
4760 installprefixexp="$ansexp"
4761
4762 : set the prefixit variable, to compute a suitable default value
4763 prefixit='case "$3" in
4764 ""|none)
4765         case "$oldprefix" in
4766         "") eval "$1=\"\$$2\"";;
4767         *)
4768                 case "$3" in
4769                 "") eval "$1=";;
4770                 none)
4771                         eval "tp=\"\$$2\"";
4772                         case "$tp" in
4773                         ""|" ") eval "$1=\"\$$2\"";;
4774                         *) eval "$1=";;
4775                         esac;;
4776                 esac;;
4777         esac;;
4778 *)
4779         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4780         case "$tp" in
4781         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4782         /*-$oldprefix/*|\~*-$oldprefix/*)
4783                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4784         *) eval "$1=\"\$$2\"";;
4785         esac;;
4786 esac'
4787
4788
4789 : get the patchlevel
4790 echo " "
4791 echo "Getting the current patchlevel..." >&4
4792 if $test -r $rsrc/patchlevel.h;then
4793         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4794         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4795         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4796         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4797         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4798         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4799 else
4800         revision=0
4801         patchlevel=0
4802         subversion=0
4803         api_revision=0
4804         api_version=0
4805         api_subversion=0
4806 fi
4807 $echo $n "(You have $package revision $revision" $c
4808 $echo $n " patchlevel $patchlevel" $c
4809 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4810 echo ".)"
4811 case "$osname" in
4812 dos|vms)
4813         : XXX Should be a Configure test for double-dots in filenames.
4814         version=`echo $revision $patchlevel $subversion | \
4815                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4816         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4817                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4818         ;;
4819 *)
4820         version=`echo $revision $patchlevel $subversion | \
4821                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4822         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4823                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4824         ;;
4825 esac
4826 : Special case the 5.005_xx maintenance series, which used 5.005
4827 : without any subversion label as a subdirectory in $sitelib
4828 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4829         api_versionstring='5.005'
4830 fi
4831
4832 : determine installation style
4833 : For now, try to deduce it from prefix unless it is already set.
4834 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4835 case "$installstyle" in
4836 '')     case "$prefix" in
4837                 *perl*) dflt='lib';;
4838                 *) dflt='lib/perl5' ;;
4839         esac
4840         ;;
4841 *)      dflt="$installstyle" ;;
4842 esac
4843 : Probably not worth prompting for this since we prompt for all
4844 : the directories individually, and the prompt would be too long and
4845 : confusing anyway.
4846 installstyle=$dflt
4847
4848 : determine where private library files go
4849 : Usual default is /usr/local/lib/perl5/$version.
4850 : Also allow things like /opt/perl/lib/$version, since 
4851 : /opt/perl/lib/perl5... would be redundant.
4852 : The default "style" setting is made in installstyle.U
4853 case "$installstyle" in
4854 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4855 *)       set dflt privlib lib/$version ;;
4856 esac
4857 eval $prefixit
4858 $cat <<EOM
4859
4860 There are some auxiliary files for $package that need to be put into a
4861 private library directory that is accessible by everyone.
4862
4863 EOM
4864 fn=d~+
4865 rp='Pathname where the private library files will reside?'
4866 . ./getfile
4867 privlib="$ans"
4868 privlibexp="$ansexp"
4869 : Change installation prefix, if necessary.
4870 if $test X"$prefix" != X"$installprefix"; then
4871         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4872 else
4873         installprivlib="$privlibexp"
4874 fi
4875
4876 : set the prefixup variable, to restore leading tilda escape
4877 prefixup='case "$prefixexp" in
4878 "$prefix") ;;
4879 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4880 esac'
4881
4882 : determine where public architecture dependent libraries go
4883 set archlib archlib
4884 eval $prefixit
4885 : privlib default is /usr/local/lib/$package/$version
4886 : archlib default is /usr/local/lib/$package/$version/$archname
4887 : privlib may have an optional trailing /share.
4888 tdflt=`echo $privlib | $sed 's,/share$,,'`
4889 tdflt=$tdflt/$archname
4890 case "$archlib" in
4891 '')     dflt=$tdflt
4892         ;;
4893 *)      dflt="$archlib"
4894     ;;
4895 esac
4896 $cat <<EOM
4897
4898 $spackage contains architecture-dependent library files.  If you are
4899 sharing libraries in a heterogeneous environment, you might store
4900 these files in a separate location.  Otherwise, you can just include
4901 them with the rest of the public library files.
4902
4903 EOM
4904 fn=d+~
4905 rp='Where do you want to put the public architecture-dependent libraries?'
4906 . ./getfile
4907 archlib="$ans"
4908 archlibexp="$ansexp"
4909 if $test X"$archlib" = X"$privlib"; then
4910         d_archlib="$undef"
4911 else
4912         d_archlib="$define"
4913 fi
4914 : Change installation prefix, if necessary.
4915 if $test X"$prefix" != X"$installprefix"; then
4916         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4917 else
4918         installarchlib="$archlibexp"
4919 fi
4920
4921
4922 : Binary compatibility with 5.005 is not possible for builds
4923 : with advanced features
4924 case "$usethreads$usemultiplicity" in
4925 *define*)
4926         bincompat5005="$undef"
4927         d_bincompat5005="$undef"
4928         ;;
4929 *)      $cat <<EOM
4930
4931 This version of Perl can be compiled for binary compatibility with 5.005.
4932 If you decide to do so, you will be able to continue using most of the
4933 extensions that were compiled for Perl 5.005.
4934
4935 EOM
4936         case "$bincompat5005$d_bincompat5005" in
4937         *"$undef"*) dflt=n ;;
4938         *) dflt=y ;;
4939         esac
4940         rp='Binary compatibility with Perl 5.005?'
4941         . ./myread
4942         case "$ans" in
4943         y*) val="$define" ;;
4944         *)  val="$undef" ;;
4945         esac
4946         set d_bincompat5005
4947         eval $setvar
4948         case "$d_bincompat5005" in
4949         "$define")
4950                 bincompat5005="$define"
4951                 ;;
4952         *)      bincompat5005="$undef"
4953                 d_bincompat5005="$undef"
4954                 ;;
4955         esac
4956         ;;
4957 esac
4958
4959
4960 : see if setuid scripts can be secure
4961 $cat <<EOM
4962
4963 Some kernels have a bug that prevents setuid #! scripts from being
4964 secure.  Some sites have disabled setuid #! scripts because of this.
4965
4966 First let's decide if your kernel supports secure setuid #! scripts.
4967 (If setuid #! scripts would be secure but have been disabled anyway,
4968 don't say that they are secure if asked.)
4969
4970 EOM
4971
4972 val="$undef"
4973 if $test -d /dev/fd; then
4974         echo "#!$ls" >reflect
4975         chmod +x,u+s reflect
4976         ./reflect >flect 2>&1
4977         if $contains "/dev/fd" flect >/dev/null; then
4978                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4979                 val="$define"
4980         else
4981                 $cat <<EOM
4982 If you are not sure if they are secure, I can check but I'll need a
4983 username and password different from the one you are using right now.
4984 If you don't have such a username or don't want me to test, simply
4985 enter 'none'.
4986
4987 EOM
4988                 rp='Other username to test security of setuid scripts with?'
4989                 dflt='none'
4990                 . ./myread
4991                 case "$ans" in
4992                 n|none)
4993                         case "$d_suidsafe" in
4994                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4995                                 dflt=n;;
4996                         "$undef")
4997                                 echo "Well, the $hint value is *not* secure." >&4
4998                                 dflt=n;;
4999                         *)      echo "Well, the $hint value *is* secure." >&4
5000                                 dflt=y;;
5001                         esac
5002                         ;;
5003                 *)
5004                         $rm -f reflect flect
5005                         echo "#!$ls" >reflect
5006                         chmod +x,u+s reflect
5007                         echo >flect
5008                         chmod a+w flect
5009                         echo '"su" will (probably) prompt you for '"$ans's password."
5010                         su $ans -c './reflect >flect'
5011                         if $contains "/dev/fd" flect >/dev/null; then
5012                                 echo "Okay, it looks like setuid scripts are secure." >&4
5013                                 dflt=y
5014                         else
5015                                 echo "I don't think setuid scripts are secure." >&4
5016                                 dflt=n
5017                         fi
5018                         ;;
5019                 esac
5020                 rp='Does your kernel have *secure* setuid scripts?'
5021                 . ./myread
5022                 case "$ans" in
5023                 [yY]*)  val="$define";;
5024                 *)      val="$undef";;
5025                 esac
5026         fi
5027 else
5028         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5029         echo "(That's for file descriptors, not floppy disks.)"
5030         val="$undef"
5031 fi
5032 set d_suidsafe
5033 eval $setvar
5034
5035 $rm -f reflect flect
5036
5037 : now see if they want to do setuid emulation
5038 echo " "
5039 val="$undef"
5040 case "$d_suidsafe" in
5041 "$define")
5042         val="$undef"
5043         echo "No need to emulate SUID scripts since they are secure here." >& 4
5044         ;;
5045 *)
5046         $cat <<EOM
5047 Some systems have disabled setuid scripts, especially systems where
5048 setuid scripts cannot be secure.  On systems where setuid scripts have
5049 been disabled, the setuid/setgid bits on scripts are currently
5050 useless.  It is possible for $package to detect those bits and emulate
5051 setuid/setgid in a secure fashion.  This emulation will only work if
5052 setuid scripts have been disabled in your kernel.
5053
5054 EOM
5055         case "$d_dosuid" in
5056         "$define") dflt=y ;;
5057         *) dflt=n ;;
5058         esac
5059         rp="Do you want to do setuid/setgid emulation?"
5060         . ./myread
5061         case "$ans" in
5062         [yY]*)  val="$define";;
5063         *)      val="$undef";;
5064         esac
5065         ;;
5066 esac
5067 set d_dosuid
5068 eval $setvar
5069
5070 : determine filename position in cpp output
5071 echo " "
5072 echo "Computing filename position in cpp output for #include directives..." >&4
5073 echo '#include <stdio.h>' > foo.c
5074 $cat >fieldn <<EOF
5075 $startsh
5076 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5077 $grep '^[       ]*#.*stdio\.h' | \
5078 while read cline; do
5079         pos=1
5080         set \$cline
5081         while $test \$# -gt 0; do
5082                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5083                         echo "\$pos"
5084                         exit 0
5085                 fi
5086                 shift
5087                 pos=\`expr \$pos + 1\`
5088         done
5089 done
5090 EOF
5091 chmod +x fieldn
5092 fieldn=`./fieldn`
5093 $rm -f foo.c fieldn
5094 case $fieldn in
5095 '') pos='???';;
5096 1) pos=first;;
5097 2) pos=second;;
5098 3) pos=third;;
5099 *) pos="${fieldn}th";;
5100 esac
5101 echo "Your cpp writes the filename in the $pos field of the line."
5102
5103 : locate header file
5104 $cat >findhdr <<EOF
5105 $startsh
5106 wanted=\$1
5107 name=''
5108 for usrincdir in $usrinc
5109 do
5110         if test -f \$usrincdir/\$wanted; then
5111                 echo "\$usrincdir/\$wanted"
5112                 exit 0
5113         fi
5114 done
5115 awkprg='{ print \$$fieldn }'
5116 echo "#include <\$wanted>" > foo\$\$.c
5117 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5118 $grep "^[       ]*#.*\$wanted" | \
5119 while read cline; do
5120         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5121         case "\$name" in
5122         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5123         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5124         *) exit 2;;
5125         esac;
5126 done;
5127 #
5128 # status = 0: grep returned 0 lines, case statement not executed
5129 # status = 1: headerfile found
5130 # status = 2: while loop executed, no headerfile found
5131 #
5132 status=\$?
5133 $rm -f foo\$\$.c;
5134 if test \$status -eq 1; then
5135         exit 0;
5136 fi
5137 exit 1
5138 EOF
5139 chmod +x findhdr
5140
5141 : define an alternate in-header-list? function
5142 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5143 cont=true; xxf="echo \"<\$1> found.\" >&4";
5144 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5145 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5146 esac;
5147 case $# in 4) instead=instead;; *) instead="at last";; esac;
5148 while $test "$cont"; do
5149         xxx=`./findhdr $1`
5150         var=$2; eval "was=\$$2";
5151         if $test "$xxx" && $test -r "$xxx";
5152         then eval $xxf;
5153         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5154                 cont="";
5155         else eval $xxnf;
5156         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5157         set $yyy; shift; shift; yyy=$@;
5158         case $# in 0) cont="";;
5159         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5160                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5161         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5162                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5163         esac;
5164 done;
5165 while $test "$yyy";
5166 do set $yyy; var=$2; eval "was=\$$2";
5167         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5168         set $yyy; shift; shift; yyy=$@;
5169 done'
5170
5171 : see if this is a malloc.h system
5172 set malloc.h i_malloc
5173 eval $inhdr
5174
5175 : see if stdlib is available
5176 set stdlib.h i_stdlib
5177 eval $inhdr
5178
5179 : determine which malloc to compile in
5180 echo " "
5181 case "$usemymalloc" in
5182 ''|[yY]*|true|$define)  dflt='y' ;;
5183 *)      dflt='n' ;;
5184 esac
5185 rp="Do you wish to attempt to use the malloc that comes with $package?"
5186 . ./myread
5187 usemymalloc="$ans"
5188 case "$ans" in
5189 y*|true)
5190         usemymalloc='y'
5191         mallocsrc='malloc.c'
5192         mallocobj="malloc$_o"
5193         d_mymalloc="$define"
5194         case "$libs" in
5195         *-lmalloc*)
5196                 : Remove malloc from list of libraries to use
5197                 echo "Removing unneeded -lmalloc from library list" >&4
5198                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5199                 shift
5200                 libs="$*"
5201                 echo "libs = $libs" >&4
5202                 ;;
5203         esac
5204         ;;
5205 *)
5206         usemymalloc='n'
5207         mallocsrc=''
5208         mallocobj=''
5209         d_mymalloc="$undef"
5210         ;;
5211 esac
5212
5213 : compute the return types of malloc and free
5214 echo " "
5215 $cat >malloc.c <<END
5216 #$i_malloc I_MALLOC
5217 #$i_stdlib I_STDLIB
5218 #include <stdio.h>
5219 #include <sys/types.h>
5220 #ifdef I_MALLOC
5221 #include <malloc.h>
5222 #endif
5223 #ifdef I_STDLIB
5224 #include <stdlib.h>
5225 #endif
5226 #ifdef TRY_MALLOC
5227 void *malloc();
5228 #endif
5229 #ifdef TRY_FREE
5230 void free();
5231 #endif
5232 END
5233 case "$malloctype" in
5234 '')
5235         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5236                 malloctype='void *'
5237         else
5238                 malloctype='char *'
5239         fi
5240         ;;
5241 esac
5242 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5243
5244 case "$freetype" in
5245 '')
5246         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5247                 freetype='void'
5248         else
5249                 freetype='int'
5250         fi
5251         ;;
5252 esac
5253 echo "Your system uses $freetype free(), it would seem." >&4
5254 $rm -f malloc.[co]
5255 $cat <<EOM
5256
5257 After $package is installed, you may wish to install various
5258 add-on modules and utilities.  Typically, these add-ons will
5259 be installed under $prefix with the rest
5260 of this package.  However, you may wish to install such add-ons
5261 elsewhere under a different prefix.
5262
5263 If you do not wish to put everything under a single prefix, that's
5264 ok.  You will be prompted for the individual locations; this siteprefix
5265 is only used to suggest the defaults.
5266
5267 The default should be fine for most people.
5268
5269 EOM
5270 fn=d~+
5271 rp='Installation prefix to use for add-on modules and utilities?'
5272 : XXX Here might be another good place for an installstyle setting.
5273 case "$siteprefix" in
5274 '') dflt=$prefix ;;
5275 *)  dflt=$siteprefix ;;
5276 esac
5277 . ./getfile
5278 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5279 oldsiteprefix=''
5280 case "$siteprefix" in
5281 '') ;;
5282 *)      case "$ans" in
5283         "$prefix") ;;
5284         *) oldsiteprefix="$prefix";;
5285         esac
5286         ;;
5287 esac
5288 siteprefix="$ans"
5289 siteprefixexp="$ansexp"
5290
5291 : determine where site specific libraries go.
5292 : Usual default is /usr/local/lib/perl5/site_perl/$version
5293 : The default "style" setting is made in installstyle.U
5294 : XXX No longer works with Prefixit stuff.
5295 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5296 case "$sitelib" in
5297 '') case "$installstyle" in
5298         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5299         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5300         esac
5301         ;;
5302 *)      dflt="$sitelib"
5303         ;;
5304 esac
5305 $cat <<EOM
5306
5307 The installation process will create a directory for
5308 site-specific extensions and modules.  Most users find it convenient
5309 to place all site-specific files in this directory rather than in the
5310 main distribution directory.
5311
5312 EOM
5313 fn=d~+
5314 rp='Pathname for the site-specific library files?'
5315 . ./getfile
5316 sitelib="$ans"
5317 sitelibexp="$ansexp"
5318 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5319 : Change installation prefix, if necessary.
5320 if $test X"$prefix" != X"$installprefix"; then
5321         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5322 else
5323         installsitelib="$sitelibexp"
5324 fi
5325
5326 : determine where site specific architecture-dependent libraries go.
5327 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5328 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5329 : sitelib may have an optional trailing /share.
5330 case "$sitearch" in
5331 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5332         dflt="$dflt/$archname"
5333         ;;
5334 *)      dflt="$sitearch"
5335         ;;
5336 esac
5337 set sitearch sitearch none
5338 eval $prefixit
5339 $cat <<EOM
5340
5341 The installation process will also create a directory for
5342 architecture-dependent site-specific extensions and modules.
5343
5344 EOM
5345 fn=d~+
5346 rp='Pathname for the site-specific architecture-dependent library files?'
5347 . ./getfile
5348 sitearch="$ans"
5349 sitearchexp="$ansexp"
5350 : Change installation prefix, if necessary.
5351 if $test X"$prefix" != X"$installprefix"; then
5352         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5353 else
5354         installsitearch="$sitearchexp"
5355 fi
5356
5357 $cat <<EOM
5358
5359 The installation process will also create a directory for
5360 vendor-supplied add-ons.  Vendors who supply perl with their system
5361 may find it convenient to place all vendor-supplied files in this
5362 directory rather than in the main distribution directory.  This will
5363 ease upgrades between binary-compatible maintenance versions of perl.
5364
5365 Of course you may also use these directories in whatever way you see
5366 fit.  For example, you might use them to access modules shared over a
5367 company-wide network.
5368
5369 The default answer should be fine for most people.
5370 This causes further questions about vendor add-ons to be skipped
5371 and no vendor-specific directories will be configured for perl.
5372
5373 EOM
5374 rp='Do you want to configure vendor-specific add-on directories?'
5375 case "$usevendorprefix" in
5376 define|true|[yY]*) dflt=y ;;
5377 *)      : User may have set vendorprefix directly on Configure command line.
5378         case "$vendorprefix" in
5379         ''|' ') dflt=n ;;
5380         *)      dflt=y ;;
5381         esac
5382         ;;
5383 esac
5384 . ./myread
5385 case "$ans" in
5386 [yY]*)  fn=d~+
5387         rp='Installation prefix to use for vendor-supplied add-ons?'
5388         case "$vendorprefix" in
5389         '') dflt='' ;;
5390         *)  dflt=$vendorprefix ;;
5391         esac
5392         . ./getfile
5393         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5394         oldvendorprefix=''
5395         case "$vendorprefix" in
5396         '') ;;
5397         *)      case "$ans" in
5398                 "$prefix") ;;
5399                 *) oldvendorprefix="$prefix";;
5400                 esac
5401                 ;;
5402         esac
5403         usevendorprefix="$define"
5404         vendorprefix="$ans"
5405         vendorprefixexp="$ansexp"
5406         ;;
5407 *)      usevendorprefix="$undef"
5408         vendorprefix=''
5409         vendorprefixexp=''
5410         ;;
5411 esac
5412
5413 case "$vendorprefix" in
5414 '')     d_vendorlib="$undef"
5415         vendorlib=''
5416         vendorlibexp=''
5417         ;;
5418 *)      d_vendorlib="$define"
5419         : determine where vendor-supplied modules go.
5420         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5421         case "$vendorlib" in
5422         '')
5423                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5424                 case "$installstyle" in
5425                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5426                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5427                 esac
5428                 ;;
5429         *)      dflt="$vendorlib"
5430                 ;;
5431         esac
5432         fn=d~+
5433         rp='Pathname for the vendor-supplied library files?'
5434         . ./getfile
5435         vendorlib="$ans"
5436         vendorlibexp="$ansexp"
5437         ;;
5438 esac
5439 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
5440 : Change installation prefix, if necessary.
5441 if $test X"$prefix" != X"$installprefix"; then
5442         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5443 else
5444         installvendorlib="$vendorlibexp"
5445 fi
5446
5447 case "$vendorprefix" in
5448 '')     d_vendorarch="$undef"
5449         vendorarch=''
5450         vendorarchexp=''
5451         ;;
5452 *)      d_vendorarch="$define"
5453         : determine where vendor-supplied architecture-dependent libraries go.
5454         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
5455         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
5456         : vendorlib may have an optional trailing /share.
5457         case "$vendorarch" in
5458         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
5459                 dflt="$dflt/$archname"
5460                 ;;
5461         *)      dflt="$vendorarch" ;;
5462         esac
5463         fn=d~+
5464         rp='Pathname for vendor-supplied architecture-dependent files?'
5465         . ./getfile
5466         vendorarch="$ans"
5467         vendorarchexp="$ansexp"
5468         ;;
5469 esac
5470 : Change installation prefix, if necessary.
5471 if $test X"$prefix" != X"$installprefix"; then
5472         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
5473 else
5474         installvendorarch="$vendorarchexp"
5475 fi
5476
5477 : Final catch-all directories to search
5478 $cat <<EOM
5479
5480 Lastly, you can have perl look in other directories for extensions and
5481 modules in addition to those already specified.
5482 These directories will be searched after 
5483         $sitearch 
5484         $sitelib 
5485 EOM
5486 test X"$vendorlib" != "X" && echo '     ' $vendorlib
5487 test X"$vendorarch" != "X" && echo '    ' $vendorarch
5488 echo ' '
5489 case "$otherlibdirs" in
5490 ''|' ') dflt='none' ;;
5491 *)      dflt="$otherlibdirs" ;;
5492 esac
5493 $cat <<EOM
5494 Enter a colon-separated set of extra paths to include in perl's @INC
5495 search path, or enter 'none' for no extra paths.
5496
5497 EOM
5498
5499 rp='Colon-separated list of additional directories for perl to search?'
5500 . ./myread
5501 case "$ans" in
5502 ' '|''|none)    otherlibdirs=' ' ;;     
5503 *)      otherlibdirs="$ans" ;;
5504 esac
5505 case "$otherlibdirs" in
5506 ' ') val=$undef ;;
5507 *)      val=$define ;;
5508 esac
5509 set d_perl_otherlibdirs
5510 eval $setvar
5511
5512 : Cruising for prototypes
5513 echo " "
5514 echo "Checking out function prototypes..." >&4
5515 $cat >prototype.c <<'EOCP'
5516 int main(int argc, char *argv[]) {
5517         exit(0);}
5518 EOCP
5519 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5520         echo "Your C compiler appears to support function prototypes."
5521         val="$define"
5522 else
5523         echo "Your C compiler doesn't seem to understand function prototypes."
5524         val="$undef"
5525 fi
5526 set prototype
5527 eval $setvar
5528 $rm -f prototype*
5529
5530 case "$prototype" in
5531 "$define") ;;
5532 *)      ansi2knr='ansi2knr'
5533         echo " "
5534         cat <<EOM >&4
5535
5536 $me:  FATAL ERROR:
5537 This version of $package can only be compiled by a compiler that 
5538 understands function prototypes.  Unfortunately, your C compiler 
5539         $cc $ccflags
5540 doesn't seem to understand them.  Sorry about that.
5541
5542 If GNU cc is available for your system, perhaps you could try that instead.  
5543
5544 Eventually, we hope to support building Perl with pre-ANSI compilers.
5545 If you would like to help in that effort, please contact <perlbug@perl.org>.
5546
5547 Aborting Configure now.
5548 EOM
5549         exit 2
5550         ;;
5551 esac
5552
5553 : determine where public executables go
5554 echo " "
5555 set dflt bin bin
5556 eval $prefixit
5557 fn=d~
5558 rp='Pathname where the public executables will reside?'
5559 . ./getfile
5560 if $test "X$ansexp" != "X$binexp"; then
5561         installbin=''
5562 fi
5563 bin="$ans"
5564 binexp="$ansexp"
5565 : Change installation prefix, if necessary.
5566 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5567 if $test X"$prefix" != X"$installprefix"; then
5568         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5569 else
5570         installbin="$binexp"
5571 fi
5572
5573 : Find perl5.005 or later.
5574 echo "Looking for a previously installed perl5.005 or later... "
5575 case "$perl5" in
5576 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5577                 : Check if this perl is recent and can load a simple module
5578                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5579                         perl5=$tdir/perl
5580                         break;
5581                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5582                         perl5=$tdir/perl
5583                         break;
5584                 fi
5585         done
5586         ;;
5587 *)      perl5="$perl5"
5588         ;;
5589 esac
5590 case "$perl5" in
5591 '')     echo "None found.  That's ok.";;
5592 *)      echo "Using $perl5." ;;
5593 esac
5594
5595 : Determine list of previous versions to include in @INC
5596 $cat > getverlist <<EOPL
5597 #!$perl5 -w
5598 use File::Basename;
5599 \$api_versionstring = "$api_versionstring";
5600 \$version = "$version";
5601 \$stem = "$sitelib_stem";
5602 \$archname = "$archname";
5603 EOPL
5604         $cat >> getverlist <<'EOPL'
5605 # Can't have leading @ because metaconfig interprets it as a command!
5606 ;@inc_version_list=();
5607 # XXX Redo to do opendir/readdir? 
5608 if (-d $stem) {
5609     chdir($stem);
5610     ;@candidates = glob("5.*");
5611 }
5612 else {
5613     ;@candidates = ();
5614 }
5615
5616 # XXX ToDo:  These comparisons must be reworked when two-digit
5617 # subversions come along, so that 5.7.10 compares as greater than
5618 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5619 # widespread that we can use the built-in version vectors rather
5620 # than reinventing them here.  For 5.6.0, however, we must
5621 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5622 foreach $d (@candidates) {
5623     if ($d lt $version) {
5624         if ($d ge $api_versionstring) {
5625             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
5626         }
5627         elsif ($d ge "5.005") {
5628             unshift(@inc_version_list, grep { -d } $d);
5629         }
5630     }
5631     else {
5632         # Skip newer version.  I.e. don't look in
5633         # 5.7.0 if we're installing 5.6.1.
5634     }
5635 }
5636
5637 if (@inc_version_list) {
5638     print join(' ', @inc_version_list);
5639 }
5640 else {
5641     # Blank space to preserve value for next Configure run.
5642     print " ";
5643 }
5644 EOPL
5645 chmod +x getverlist
5646 case "$inc_version_list" in
5647 '')     if test -x "$perl5"; then
5648                 dflt=`$perl5 getverlist`
5649         else
5650                 dflt='none'
5651         fi
5652         ;;
5653 $undef) dflt='none' ;;
5654 *)  dflt="$inc_version_list" ;;
5655 esac
5656 case "$dflt" in
5657 ''|' ') dflt=none ;;
5658 esac
5659 $cat <<'EOM'
5660
5661 In order to ease the process of upgrading, this version of perl 
5662 can be configured to use modules built and installed with earlier 
5663 versions of perl that were installed under $prefix.  Specify here
5664 the list of earlier versions that this version of perl should check.
5665 If Configure detected no earlier versions of perl installed under
5666 $prefix, then the list will be empty.  Answer 'none' to tell perl
5667 to not search earlier versions.
5668
5669 The default should almost always be sensible, so if you're not sure,
5670 just accept the default.
5671 EOM
5672
5673 rp='List of earlier versions to include in @INC?'
5674 . ./myread
5675 case "$ans" in
5676 [Nn]one|''|' ') inc_version_list=' ' ;;
5677 *) inc_version_list="$ans" ;;
5678 esac
5679 case "$inc_version_list" in
5680 ''|' ') 
5681         inc_version_list_init='0';;
5682 *)      inc_version_list_init=`echo $inc_version_list |
5683                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5684         ;;
5685 esac
5686 $rm -f getverlist
5687
5688 : determine whether to install perl also as /usr/bin/perl
5689
5690 echo " "
5691 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5692         $cat <<EOM
5693 Many scripts expect perl to be installed as /usr/bin/perl.
5694 I can install the perl you are about to compile also as /usr/bin/perl
5695 (in addition to $installbin/perl).
5696 EOM
5697         case "$installusrbinperl" in
5698         "$undef"|[nN]*) dflt='n';;
5699         *)              dflt='y';;
5700         esac
5701         rp="Do you want to install perl as /usr/bin/perl?"
5702         . ./myread
5703         case "$ans" in
5704         [yY]*)  val="$define";;
5705         *)      val="$undef" ;;
5706         esac
5707 else
5708         val="$undef"
5709 fi
5710 set installusrbinperl
5711 eval $setvar
5712
5713 echo " "
5714 echo "Checking for GNU C Library..." >&4
5715 cat >gnulibc.c <<EOM
5716 #include <stdio.h>
5717 int main()
5718 {
5719 #ifdef __GLIBC__
5720     exit(0);
5721 #else
5722     exit(1);
5723 #endif
5724 }
5725 EOM
5726 set gnulibc
5727 if eval $compile_ok && ./gnulibc; then
5728         val="$define"
5729         echo "You are using the GNU C Library"
5730 else
5731         val="$undef"
5732         echo "You are not using the GNU C Library"
5733 fi
5734 $rm -f gnulibc*
5735 set d_gnulibc
5736 eval $setvar
5737
5738 : see if nm is to be used to determine whether a symbol is defined or not
5739 case "$usenm" in
5740 '')
5741         dflt=''
5742         case "$d_gnulibc" in
5743         "$define")
5744                 echo " "
5745                 echo "nm probably won't work on the GNU C Library." >&4
5746                 dflt=n
5747                 ;;
5748         esac
5749         case "$dflt" in
5750         '') 
5751                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5752                         echo " "
5753                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5754                         echo "'nm' won't be sufficient on this sytem." >&4
5755                         dflt=n
5756                 fi
5757                 ;;
5758         esac
5759         case "$dflt" in
5760         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5761                 if $test $dflt -gt 20; then
5762                         dflt=y
5763                 else
5764                         dflt=n
5765                 fi
5766                 ;;
5767         esac
5768         ;;
5769 *)
5770         case "$usenm" in
5771         true|$define) dflt=y;;
5772         *) dflt=n;;
5773         esac
5774         ;;
5775 esac
5776 $cat <<EOM
5777
5778 I can use $nm to extract the symbols from your C libraries. This
5779 is a time consuming task which may generate huge output on the disk (up
5780 to 3 megabytes) but that should make the symbols extraction faster. The
5781 alternative is to skip the 'nm' extraction part and to compile a small
5782 test program instead to determine whether each symbol is present. If
5783 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5784 this may be the best solution.
5785
5786 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5787
5788 EOM
5789 rp="Shall I use $nm to extract C symbols from the libraries?"
5790 . ./myread
5791 case "$ans" in
5792 [Nn]*) usenm=false;;
5793 *) usenm=true;;
5794 esac
5795
5796 runnm=$usenm
5797 case "$reuseval" in
5798 true) runnm=false;;
5799 esac
5800
5801 : nm options which may be necessary
5802 case "$nm_opt" in
5803 '') if $test -f /mach_boot; then
5804                 nm_opt=''       # Mach
5805         elif $test -d /usr/ccs/lib; then
5806                 nm_opt='-p'     # Solaris (and SunOS?)
5807         elif $test -f /dgux; then
5808                 nm_opt='-p'     # DG-UX
5809         elif $test -f /lib64/rld; then
5810                 nm_opt='-p'     # 64-bit Irix
5811         else
5812                 nm_opt=''
5813         fi;;
5814 esac
5815
5816 : nm options which may be necessary for shared libraries but illegal
5817 : for archive libraries.  Thank you, Linux.
5818 case "$nm_so_opt" in
5819 '')     case "$myuname" in
5820         *linux*)
5821                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5822                         nm_so_opt='--dynamic'
5823                 fi
5824                 ;;
5825         esac
5826         ;;
5827 esac
5828
5829 case "$runnm" in
5830 true)
5831 : get list of predefined functions in a handy place
5832 echo " "
5833 case "$libc" in
5834 '') libc=unknown
5835         case "$libs" in
5836         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5837         esac
5838         ;;
5839 esac
5840 libnames='';
5841 case "$libs" in
5842 '') ;;
5843 *)  for thislib in $libs; do
5844         case "$thislib" in
5845         -lc|-lc_s)
5846                 : Handle C library specially below.
5847                 ;;
5848         -l*)
5849                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5850                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5851                         :
5852                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5853                         :
5854                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5855                         :
5856                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5857                         :
5858                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5859                         :
5860                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5861                         :
5862                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5863                         :
5864                 else
5865                         try=''
5866                 fi
5867                 libnames="$libnames $try"
5868                 ;;
5869         *) libnames="$libnames $thislib" ;;
5870         esac
5871         done
5872         ;;
5873 esac
5874 xxx=normal
5875 case "$libc" in
5876 unknown)
5877         set /lib/libc.$so
5878         for xxx in $libpth; do
5879                 $test -r $1 || set $xxx/libc.$so
5880                 : The messy sed command sorts on library version numbers.
5881                 $test -r $1 || \
5882                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5883                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5884                                 h
5885                                 s/[0-9][0-9]*/0000&/g
5886                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5887                                 G
5888                                 s/\n/ /' | \
5889                          sort | $sed -e 's/^.* //'`
5890                 eval set \$$#
5891         done
5892         $test -r $1 || set /usr/ccs/lib/libc.$so
5893         $test -r $1 || set /lib/libsys_s$_a
5894         ;;
5895 *)
5896         set blurfl
5897         ;;
5898 esac
5899 if $test -r "$1"; then
5900         echo "Your (shared) C library seems to be in $1."
5901         libc="$1"
5902 elif $test -r /lib/libc && $test -r /lib/clib; then
5903         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5904         xxx=apollo
5905         libc='/lib/clib /lib/libc'
5906         if $test -r /lib/syslib; then
5907                 echo "(Your math library is in /lib/syslib.)"
5908                 libc="$libc /lib/syslib"
5909         fi
5910 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5911         echo "Your C library seems to be in $libc, as you said before."
5912 elif $test -r $incpath/usr/lib/libc$_a; then
5913         libc=$incpath/usr/lib/libc$_a;
5914         echo "Your C library seems to be in $libc.  That's fine."
5915 elif $test -r /lib/libc$_a; then
5916         libc=/lib/libc$_a;
5917         echo "Your C library seems to be in $libc.  You're normal."
5918 else
5919         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5920                 :
5921         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5922                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5923         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5924                 :
5925         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5926                 :
5927         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5928                 :
5929         else
5930                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5931         fi
5932         if $test -r "$tans"; then
5933                 echo "Your C library seems to be in $tans, of all places."
5934                 libc=$tans
5935         else
5936                 libc='blurfl'
5937         fi
5938 fi
5939 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5940         dflt="$libc"
5941         cat <<EOM
5942
5943 If the guess above is wrong (which it might be if you're using a strange
5944 compiler, or your machine supports multiple models), you can override it here.
5945
5946 EOM
5947 else
5948         dflt=''
5949         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5950         cat >&4 <<EOM
5951 I can't seem to find your C library.  I've looked in the following places:
5952
5953 EOM
5954         $sed 's/^/      /' libpath
5955         cat <<EOM
5956
5957 None of these seems to contain your C library. I need to get its name...
5958
5959 EOM
5960 fi
5961 fn=f
5962 rp='Where is your C library?'
5963 . ./getfile
5964 libc="$ans"
5965
5966 echo " "
5967 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5968 set X `cat libnames`
5969 shift
5970 xxx=files
5971 case $# in 1) xxx=file; esac
5972 echo "Extracting names from the following $xxx for later perusal:" >&4
5973 echo " "
5974 $sed 's/^/      /' libnames >&4
5975 echo " "
5976 $echo $n "This may take a while...$c" >&4
5977
5978 for file in $*; do
5979         case $file in
5980         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5981         *) $nm $nm_opt $file 2>/dev/null;;
5982         esac
5983 done >libc.tmp
5984
5985 $echo $n ".$c"
5986 $grep fprintf libc.tmp > libc.ptf
5987 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5988 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5989 xxx='[ADTSIW]'
5990 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5991         eval $xscan;\
5992         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5993                 eval $xrun
5994 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5995         eval $xscan;\
5996         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5997                 eval $xrun
5998 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5999         eval $xscan;\
6000         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6001                 eval $xrun
6002 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6003         eval $xscan;\
6004         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6005                 eval $xrun
6006 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6007         eval $xscan;\
6008         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6009                 eval $xrun
6010 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6011         eval $xscan;\
6012         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6013                 eval $xrun
6014 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6015                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6016         eval $xscan;\
6017         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6018                 eval $xrun
6019 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6020         eval $xscan;\
6021         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6022                 eval $xrun
6023 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6024         eval $xscan;\
6025         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6026                 eval $xrun
6027 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6028         eval $xscan;\
6029         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6030                 eval $xrun
6031 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6032         eval $xscan;\
6033         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6034                 eval $xrun
6035 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6036         eval $xscan;\
6037         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6038                 eval $xrun
6039 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6040         eval $xscan;\
6041         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6042                 eval $xrun
6043 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6044         eval $xscan;\
6045         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6046                 eval $xrun
6047 else
6048         $nm -p $* 2>/dev/null >libc.tmp
6049         $grep fprintf libc.tmp > libc.ptf
6050         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6051                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6052         then
6053                 nm_opt='-p'
6054                 eval $xrun
6055         else
6056                 echo " "
6057                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6058                 com=''
6059                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
6060                         for thisname in $libnames $libc; do
6061                                 $ar t $thisname >>libc.tmp
6062                         done
6063                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6064                         echo "Ok." >&4
6065                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6066                         # Repeat libc to extract forwarders to DLL entries too
6067                         for thisname in $libnames $libc; do
6068                                 $ar tv $thisname >>libc.tmp
6069                                 # Revision 50 of EMX has bug in $ar.
6070                                 # it will not extract forwarders to DLL entries
6071                                 # Use emximp which will extract exactly them.
6072                                 emximp -o tmp.imp $thisname \
6073                                     2>/dev/null && \
6074                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6075                                     < tmp.imp >>libc.tmp
6076                                 $rm tmp.imp
6077                         done
6078                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6079                         echo "Ok." >&4
6080                 else
6081                         echo "$ar didn't seem to work right." >&4
6082                         echo "Maybe this is a Cray...trying bld instead..." >&4
6083                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
6084                         then
6085                                 for thisname in $libnames; do
6086                                         bld t $libnames | \
6087                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6088                                         $ar t $thisname >>libc.tmp
6089                                 done
6090                                 echo "Ok." >&4
6091                         else
6092                                 echo "That didn't work either.  Giving up." >&4
6093                                 exit 1
6094                         fi
6095                 fi
6096         fi
6097 fi
6098 nm_extract="$com"
6099 if $test -f /lib/syscalls.exp; then
6100         echo " "
6101         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6102         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
6103 fi
6104 ;;
6105 esac
6106 $rm -f libnames libpath
6107
6108 : see if dld is available
6109 set dld.h i_dld
6110 eval $inhdr
6111
6112 : is a C symbol defined?
6113 csym='tlook=$1;
6114 case "$3" in
6115 -v) tf=libc.tmp; tc=""; tdc="";;
6116 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
6117 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
6118 esac;
6119 tx=yes;
6120 case "$reuseval-$4" in
6121 true-) ;;
6122 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6123 esac;
6124 case "$tx" in
6125 yes)
6126         case "$runnm" in
6127         true)
6128                 if $contains $tlook $tf >/dev/null 2>&1;
6129                 then tval=true;
6130                 else tval=false;
6131                 fi;;
6132         *)
6133                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
6134                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
6135                 then tval=true;
6136                 else tval=false;
6137                 fi;
6138                 $rm -f t t.c;;
6139         esac;;
6140 *)
6141         case "$tval" in
6142         $define) tval=true;;
6143         *) tval=false;;
6144         esac;;
6145 esac;
6146 eval "$2=$tval"'
6147
6148 : define an is-in-libc? function
6149 inlibc='echo " "; td=$define; tu=$undef;
6150 sym=$1; var=$2; eval "was=\$$2";
6151 tx=yes;
6152 case "$reuseval$was" in
6153 true) ;;
6154 true*) tx=no;;
6155 esac;
6156 case "$tx" in
6157 yes)
6158         set $sym tres -f;
6159         eval $csym;
6160         case "$tres" in
6161         true)
6162                 echo "$sym() found." >&4;
6163                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6164         *)
6165                 echo "$sym() NOT found." >&4;
6166                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6167         esac;;
6168 *)
6169         case "$was" in
6170         $define) echo "$sym() found." >&4;;
6171         *) echo "$sym() NOT found." >&4;;
6172         esac;;
6173 esac'
6174
6175 : see if dlopen exists
6176 xxx_runnm="$runnm"
6177 runnm=false
6178 set dlopen d_dlopen
6179 eval $inlibc
6180 runnm="$xxx_runnm"
6181
6182 : determine which dynamic loading, if any, to compile in
6183 echo " "
6184 dldir="ext/DynaLoader"
6185 case "$usedl" in
6186 $define|y|true)
6187         dflt='y'
6188         usedl="$define"
6189         ;;
6190 $undef|n|false)
6191         dflt='n'
6192         usedl="$undef"
6193         ;;
6194 *) 
6195         dflt='n'
6196         case "$d_dlopen" in
6197             $define) dflt='y' ;;
6198         esac
6199         case "$i_dld" in
6200             $define) dflt='y' ;;
6201         esac
6202         : Does a dl_xxx.xs file exist for this operating system
6203         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6204         ;;
6205 esac
6206 rp="Do you wish to use dynamic loading?"
6207 . ./myread
6208 usedl="$ans"
6209 case "$ans" in
6210 y*) usedl="$define"
6211         case "$dlsrc" in
6212         '')
6213                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6214                         dflt="$dldir/dl_${osname}.xs"
6215                 elif $test "$d_dlopen" = "$define" ; then
6216                         dflt="$dldir/dl_dlopen.xs"
6217                 elif $test "$i_dld" = "$define" ; then
6218                         dflt="$dldir/dl_dld.xs"
6219                 else
6220                         dflt=''
6221                 fi
6222                 ;;
6223         *)      dflt="$dldir/$dlsrc"
6224                 ;;
6225         esac
6226     echo "The following dynamic loading files are available:"
6227         : Can not go over to $dldir because getfile has path hard-coded in.
6228         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6229         rp="Source file to use for dynamic loading"
6230         fn="fne"
6231         gfpth="$src"
6232         . ./getfile
6233         usedl="$define"
6234         : emulate basename
6235         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6236
6237         $cat << EOM
6238
6239 Some systems may require passing special flags to $cc -c to
6240 compile modules that will be used to create a shared library.
6241 To use no flags, say "none".
6242
6243 EOM
6244     case "$cccdlflags" in
6245     '') case "$gccversion" in
6246                 '') case "$osname" in
6247                         hpux)   dflt='+z' ;;
6248                         next)   dflt='none' ;;
6249                         irix*)  dflt='-KPIC' ;;
6250                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6251                         sunos)  dflt='-pic' ;;
6252                         *)      dflt='none' ;;
6253                     esac
6254                         ;;
6255                 *)  case "$osname" in
6256                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6257                         *)      dflt='-fpic' ;;
6258                     esac ;;
6259             esac ;;
6260         ' ') dflt='none' ;;
6261     *)  dflt="$cccdlflags" ;;
6262     esac
6263     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6264     . ./myread
6265     case "$ans" in
6266     none) cccdlflags=' ' ;;
6267     *) cccdlflags="$ans" ;;
6268     esac
6269
6270     cat << EOM
6271
6272 Some systems use ld to create libraries that can be dynamically loaded,
6273 while other systems (such as those using ELF) use $cc.
6274
6275 EOM
6276         case "$ld" in
6277         '')     $cat >try.c <<'EOM'
6278 /* Test for whether ELF binaries are produced */
6279 #include <fcntl.h>
6280 #include <stdlib.h>
6281 int main() {
6282         char b[4];
6283         int i = open("a.out",O_RDONLY);
6284         if(i == -1) 
6285                 exit(1); /* fail */
6286         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6287                 exit(0); /* succeed (yes, it's ELF) */
6288         else
6289                 exit(1); /* fail */
6290 }
6291 EOM
6292                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6293                         cat <<EOM
6294 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6295 EOM
6296                         dflt="$cc"
6297                 else
6298                         echo "I'll use ld to build dynamic libraries."
6299                         dflt='ld'
6300                 fi
6301                 rm -f try.c a.out
6302                 ;;
6303         *)      dflt="$ld"
6304                 ;;
6305         esac
6306
6307     rp="What command should be used to create dynamic libraries?"
6308     . ./myread
6309         ld="$ans"
6310
6311     cat << EOM
6312
6313 Some systems may require passing special flags to $ld to create a
6314 library that can be dynamically loaded.  If your ld flags include
6315 -L/other/path options to locate libraries outside your loader's normal
6316 search path, you may need to specify those -L options here as well.  To
6317 use no flags, say "none".
6318
6319 EOM
6320     case "$lddlflags" in
6321     '') case "$osname" in
6322                         beos) dflt='-nostart' ;;
6323                         hpux) dflt='-b';
6324                               case "$gccversion" in
6325                               '') dflt="$dflt +vnocompatwarnings" ;;
6326                               esac
6327                               ;;        
6328                         linux|irix*)    dflt='-shared' ;;
6329                         next)  dflt='none' ;;
6330                         solaris) dflt='-G' ;;
6331                         sunos) dflt='-assert nodefinitions' ;;
6332                         svr4*|esix*) dflt="-G $ldflags" ;;
6333                 *)     dflt='none' ;;
6334                         esac
6335                         ;;
6336     *) dflt="$lddlflags" ;;
6337     esac
6338
6339         : Try to guess additional flags to pick up local libraries.
6340         : Be careful not to append to a plain 'none'
6341         case "$dflt" in
6342         none) dflt='' ;;
6343         esac
6344         for thisflag in $ldflags; do
6345                 case "$thisflag" in
6346                 -L*)
6347                         case " $dflt " in
6348                         *" $thisflag "*) ;;
6349                         *) dflt="$dflt $thisflag" ;;
6350                         esac
6351                         ;;
6352                 esac
6353         done
6354
6355         case "$dflt" in
6356         ''|' ') dflt='none' ;;
6357         esac
6358
6359     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6360     . ./myread
6361     case "$ans" in
6362     none) lddlflags=' ' ;;
6363     *) lddlflags="$ans" ;;
6364     esac
6365
6366         cat <<EOM
6367
6368 Some systems may require passing special flags to $cc to indicate that
6369 the resulting executable will use dynamic linking.  To use no flags,
6370 say "none".
6371
6372 EOM
6373     case "$ccdlflags" in
6374     '') case "$osname" in
6375                 hpux)   dflt='-Wl,-E' ;;
6376                 linux)  dflt='-rdynamic' ;;
6377                 next)   dflt='none' ;;
6378                 sunos)  dflt='none' ;;
6379                 *)      dflt='none' ;;
6380             esac ;;
6381     ' ')  dflt='none' ;;
6382     *)  dflt="$ccdlflags" ;;
6383     esac
6384     rp="Any special flags to pass to $cc to use dynamic linking?"
6385     . ./myread
6386     case "$ans" in
6387     none) ccdlflags=' ' ;;
6388     *) ccdlflags="$ans" ;;
6389     esac
6390     ;;
6391 *)  usedl="$undef"
6392         ld='ld'
6393     dlsrc='dl_none.xs'
6394     lddlflags=''
6395     ccdlflags=''
6396     ;;
6397 esac
6398
6399 also=''
6400 case "$usedl" in
6401 $undef)
6402         # No dynamic loading being used, so don't bother even to prompt.
6403         useshrplib='false'
6404         ;;
6405 *)      case "$useshrplib" in
6406         '')     case "$osname" in
6407                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6408                         dflt=y
6409                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6410                         ;;
6411                 next*)
6412                         case "$osvers" in
6413                         4*)     dflt=y
6414                                 also='Building a shared libperl is needed for MAB support.'
6415                                 ;;
6416                         *)      dflt=n
6417                                 ;;
6418                         esac
6419                         ;;
6420                 *)      dflt=n
6421                         ;;
6422                 esac
6423                 ;;
6424         $define|true|[Yy]*)
6425                 dflt=y
6426                 ;;
6427         *)      dflt=n
6428                 ;;
6429         esac
6430         $cat << EOM
6431
6432 The perl executable is normally obtained by linking perlmain.c with
6433 libperl${_a}, any static extensions (usually just DynaLoader), and
6434 any other libraries needed on this system (such as -lm, etc.).  Since
6435 your system supports dynamic loading, it is probably possible to build
6436 a shared libperl.$so.  If you will have more than one executable linked
6437 to libperl.$so, this will significantly reduce the size of each
6438 executable, but it may have a noticeable affect on performance.  The
6439 default is probably sensible for your system.
6440 $also
6441
6442 EOM
6443         rp="Build a shared libperl.$so (y/n)"
6444         . ./myread
6445         case "$ans" in
6446         true|$define|[Yy]*)
6447                 useshrplib='true'  ;;
6448         *)      useshrplib='false' ;;
6449         esac
6450         ;;
6451 esac
6452
6453 case "$useshrplib" in
6454 true)
6455         case "$libperl" in
6456         '')
6457                 # Figure out a good name for libperl.so.  Since it gets stored in
6458                 # a version-specific architecture-dependent library, the version
6459                 # number isn't really that important, except for making cc/ld happy.
6460                 #
6461                 # A name such as libperl.so.3.1
6462                 majmin="libperl.$so.$patchlevel.$subversion"
6463                 # A name such as libperl.so.301
6464                 majonly=`echo $patchlevel $subversion |
6465                         $awk '{printf "%d%02d", $1, $2}'`
6466                 majonly=libperl.$so.$majonly
6467                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6468                 # rely on figuring it out from the naming of libc.
6469                 case "${osname}${osvers}" in
6470                 next4*)
6471                         dflt=libperl.5.$so
6472                         # XXX How handle the --version stuff for MAB?
6473                         ;;
6474                 linux*)  # ld won't link with a bare -lperl otherwise.
6475                         dflt=libperl.$so
6476                         ;;
6477                 cygwin*) # include version
6478                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6479                         ;;
6480                 *)      # Try to guess based on whether libc has major.minor.
6481                         case "$libc" in
6482                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6483                         *libc.$so.[0-9]*) dflt=$majonly ;;
6484                         *)      dflt=libperl.$so ;;
6485                         esac
6486                         ;;
6487                 esac
6488                 ;;
6489         *)      dflt=$libperl
6490                 ;;
6491         esac
6492         cat << EOM
6493
6494 I need to select a good name for the shared libperl.  If your system uses
6495 library names with major and minor numbers, then you might want something
6496 like $majmin.  Alternatively, if your system uses a single version
6497 number for shared libraries, then you might want to use $majonly.
6498 Or, your system might be quite happy with a simple libperl.$so.
6499
6500 Since the shared libperl will get installed into a version-specific
6501 architecture-dependent directory, the version number of the shared perl
6502 library probably isn't important, so the default should be o.k.
6503
6504 EOM
6505         rp='What name do you want to give to the shared libperl?'
6506         . ./myread
6507         libperl=$ans
6508         echo "Ok, I'll use $libperl"
6509         ;;
6510 *)
6511         libperl="libperl${_a}"
6512         ;;
6513 esac
6514
6515 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6516 case "$shrpdir" in
6517 '') ;;
6518 *)      $cat >&4 <<EOM
6519 WARNING:  Use of the shrpdir variable for the installation location of
6520 the shared $libperl is not supported.  It was never documented and
6521 will not work in this version.  Let me (perlbug@perl.com)
6522 know of any problems this may cause.
6523
6524 EOM
6525         case "$shrpdir" in
6526         "$archlibexp/CORE")
6527                 $cat >&4 <<EOM
6528 But your current setting of $shrpdir is
6529 the default anyway, so it's harmless.
6530 EOM
6531                 ;;
6532         *)
6533                 $cat >&4 <<EOM
6534 Further, your current attempted setting of $shrpdir
6535 conflicts with the value of $archlibexp/CORE
6536 that installperl will use.
6537 EOM
6538                 ;;
6539         esac
6540         ;;
6541 esac
6542
6543 # How will the perl executable find the installed shared $libperl?
6544 # Add $xxx to ccdlflags.
6545 # If we can't figure out a command-line option, use $shrpenv to
6546 # set env LD_RUN_PATH.  The main perl makefile uses this.
6547 shrpdir=$archlibexp/CORE
6548 xxx=''
6549 tmp_shrpenv=''
6550 if "$useshrplib"; then
6551     case "$osname" in 
6552         aix)
6553                 # We'll set it in Makefile.SH...
6554                 ;;
6555         solaris|netbsd)
6556                 xxx="-R $shrpdir"
6557                 ;;
6558         freebsd)
6559                 xxx="-Wl,-R$shrpdir"
6560                 ;;
6561         linux|irix*|dec_osf)
6562                 xxx="-Wl,-rpath,$shrpdir"
6563                 ;;
6564         next)
6565                 # next doesn't like the default...
6566                 ;;
6567         beos)
6568                 # beos doesn't like the default, either.
6569                 ;;
6570         hpux*)
6571                 # hpux doesn't like the default, either.
6572                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6573                 ;;
6574         *)
6575                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6576                 ;;
6577         esac
6578         case "$xxx" in
6579         '') ;;
6580         *)      
6581                 # Only add $xxx if it isn't already in ccdlflags.
6582                 case " $ccdlflags " in
6583                 *" $xxx "*)     ;;
6584                 *)      ccdlflags="$ccdlflags $xxx"
6585                         cat <<EOM >&4
6586
6587 Adding $xxx to the flags
6588 passed to $ld so that the perl executable will find the 
6589 installed shared $libperl.
6590
6591 EOM
6592                         ;;
6593                 esac
6594                 ;;
6595         esac
6596 fi
6597 # Fix ccdlflags in AIX for building external extensions.
6598 # (For building Perl itself bare -bE:perl.exp is needed,
6599 #  Makefile.SH takes care of this.)
6600 case "$osname" in
6601 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6602 esac
6603 # Respect a hint or command-line value.
6604 case "$shrpenv" in
6605 '') shrpenv="$tmp_shrpenv" ;;
6606 esac
6607 case "$ldlibpthname" in
6608 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6609 none)   ldlibpthname='' ;;
6610 esac
6611
6612 : determine where manual pages go
6613 set man1dir man1dir none
6614 eval $prefixit
6615 $cat <<EOM
6616
6617 $spackage has manual pages available in source form.
6618 EOM
6619 case "$nroff" in
6620 nroff)
6621         echo "However, you don't have nroff, so they're probably useless to you."
6622         case "$man1dir" in
6623         '') man1dir="none";;
6624         esac;;
6625 esac
6626 echo "If you don't want the manual sources installed, answer 'none'."
6627 case "$man1dir" in
6628 ' ') dflt=none
6629         ;;
6630 '')
6631         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6632         lookpath="$lookpath $prefixexp/man/p_man/man1"
6633         lookpath="$lookpath $prefixexp/man/u_man/man1"
6634         lookpath="$lookpath $prefixexp/man/man.1"
6635         case "$sysman" in
6636         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6637         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6638         esac
6639         set dflt
6640         eval $prefixup
6641         ;;
6642 *)  dflt="$man1dir"
6643         ;;
6644 esac
6645 echo " "
6646 fn=dn+~
6647 rp="Where do the main $spackage manual pages (source) go?"
6648 . ./getfile
6649 if $test "X$man1direxp" != "X$ansexp"; then
6650         installman1dir=''
6651 fi
6652 man1dir="$ans"
6653 man1direxp="$ansexp"
6654 case "$man1dir" in
6655 '')     man1dir=' '
6656         installman1dir='';;
6657 esac
6658
6659 : Change installation prefix, if necessary.
6660 if $test X"$prefix" != X"$installprefix"; then
6661         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6662 else
6663         installman1dir="$man1direxp"
6664 fi
6665
6666 : What suffix to use on installed man pages
6667
6668 case "$man1dir" in
6669 ' ')
6670         man1ext='0'
6671         ;;
6672 *)
6673         rp="What suffix should be used for the main $spackage man pages?"
6674         case "$man1ext" in
6675         '')     case "$man1dir" in
6676                 *1)  dflt=1 ;;
6677                 *1p) dflt=1p ;;
6678                 *1pm) dflt=1pm ;;
6679                 *l) dflt=l;;
6680                 *n) dflt=n;;
6681                 *o) dflt=o;;
6682                 *p) dflt=p;;
6683                 *C) dflt=C;;
6684                 *L) dflt=L;;
6685                 *L1) dflt=L1;;
6686                 *) dflt=1;;
6687                 esac
6688                 ;;
6689         *)      dflt="$man1ext";;
6690         esac
6691         . ./myread
6692         man1ext="$ans"
6693         ;;
6694 esac
6695
6696 : see if we can have long filenames
6697 echo " "
6698 first=123456789abcdef
6699 $rm -f $first
6700 if (echo hi >$first) 2>/dev/null; then
6701         if $test -f 123456789abcde; then
6702                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6703                 val="$undef"
6704         else
6705                 echo 'You can have filenames longer than 14 characters.'>&4
6706                 val="$define"
6707         fi
6708 else
6709         $cat <<'EOM'
6710 You can't have filenames longer than 14 chars.
6711 You can't even think about them!
6712 EOM
6713         val="$undef"
6714 fi 
6715 set d_flexfnam
6716 eval $setvar
6717 $rm -rf 123456789abcde*
6718
6719 : determine where library module manual pages go
6720 set man3dir man3dir none
6721 eval $prefixit
6722 $cat <<EOM
6723
6724 $spackage has manual pages for many of the library modules.
6725 EOM
6726
6727 case "$nroff" in
6728 nroff)
6729         $cat <<'EOM'
6730 However, you don't have nroff, so they're probably useless to you.
6731 EOM
6732         case "$man3dir" in
6733         '') man3dir="none";;
6734         esac;;
6735 esac
6736
6737 case "$d_flexfnam" in
6738 undef)
6739         $cat <<'EOM'
6740 However, your system can't handle the long file names like File::Basename.3. 
6741 EOM
6742         case "$man3dir" in
6743         '') man3dir="none";;
6744         esac;;
6745 esac
6746
6747 echo "If you don't want the manual sources installed, answer 'none'."
6748 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6749 case "$man3dir" in
6750 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6751         if $test -d "$privlib/man/man3"; then
6752                 cat <<EOM >&4
6753
6754 WARNING:  Previous versions of perl installed man3 pages into
6755 $privlib/man/man3.  This version will suggest a 
6756 new default of $dflt.  
6757 EOM
6758                 tdflt=$dflt
6759                 dflt='n'
6760                 rp='Do you wish to preserve the old behavior?(y/n)'
6761                 . ./myread
6762                 case "$ans" in
6763                 y*) dflt="$privlib/man/man3" ;;
6764                 *)  dflt=$tdflt ;;
6765                 esac
6766     fi
6767         ;;
6768 *)      dflt="$man3dir" ;;
6769 esac
6770 case "$dflt" in
6771 ' ') dflt=none ;;
6772 esac
6773 echo " "
6774 fn=dn+~
6775 rp="Where do the $package library man pages (source) go?"
6776 . ./getfile
6777 man3dir="$ans"
6778 man3direxp="$ansexp"
6779 case "$man3dir" in
6780 '')     man3dir=' '
6781         installman3dir='';;
6782 esac
6783
6784 : Change installation prefix, if necessary.
6785 if $test X"$prefix" != X"$installprefix"; then
6786         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6787 else
6788         installman3dir="$man3direxp"
6789 fi
6790
6791 : What suffix to use on installed man pages
6792 case "$man3dir" in
6793 ' ')
6794         man3ext='0'
6795         ;;
6796 *)
6797         rp="What suffix should be used for the $package library man pages?"
6798         case "$man3ext" in
6799         '')     case "$man3dir" in
6800                 *3)  dflt=3 ;;
6801                 *3p) dflt=3p ;;
6802                 *3pm) dflt=3pm ;;
6803                 *l) dflt=l;;
6804                 *n) dflt=n;;
6805                 *o) dflt=o;;
6806                 *p) dflt=p;;
6807                 *C) dflt=C;;
6808                 *L) dflt=L;;
6809                 *L3) dflt=L3;;
6810                 *) dflt=3;;
6811                 esac
6812                 ;;
6813         *)      dflt="$man3ext";;
6814         esac
6815         . ./myread
6816         man3ext="$ans"
6817         ;;
6818 esac
6819
6820 : see if we have to deal with yellow pages, now NIS.
6821 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6822         if $test -f /usr/etc/nibindd; then
6823                 echo " "
6824                 echo "I'm fairly confident you're on a NeXT."
6825                 echo " "
6826                 rp='Do you get the hosts file via NetInfo?'
6827                 dflt=y
6828                 case "$hostcat" in
6829                 nidump*) ;;
6830                 '') ;;
6831                 *) dflt=n;;
6832                 esac
6833                 . ./myread
6834                 case "$ans" in
6835                 y*) hostcat='nidump hosts .';;
6836                 *)      case "$hostcat" in
6837                         nidump*) hostcat='';;
6838                         esac
6839                         ;;
6840                 esac
6841         fi
6842         case "$hostcat" in
6843         nidump*) ;;
6844         *)
6845                 case "$hostcat" in
6846                 *ypcat*) dflt=y;;
6847                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6848                                 dflt=y
6849                         else
6850                                 dflt=n
6851                         fi;;
6852                 *) dflt=n;;
6853                 esac
6854                 echo " "
6855                 rp='Are you getting the hosts file via yellow pages?'
6856                 . ./myread
6857                 case "$ans" in
6858                 y*) hostcat='ypcat hosts';;
6859                 *) hostcat='cat /etc/hosts';;
6860                 esac
6861                 ;;
6862         esac
6863 fi
6864 case "$hostcat" in
6865 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6866 esac
6867 case "$groupcat" in
6868 '') test -f /etc/group && groupcat='cat /etc/group';;
6869 esac
6870 case "$passcat" in
6871 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6872 esac
6873
6874 : now get the host name
6875 echo " "
6876 echo "Figuring out host name..." >&4
6877 case "$myhostname" in
6878 '') cont=true
6879         echo 'Maybe "hostname" will work...'
6880         if tans=`sh -c hostname 2>&1` ; then
6881                 myhostname=$tans
6882                 phostname=hostname
6883                 cont=''
6884         fi
6885         ;;
6886 *) cont='';;
6887 esac
6888 if $test "$cont"; then
6889         if ./xenix; then
6890                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6891                 if tans=`cat /etc/systemid 2>&1` ; then
6892                         myhostname=$tans
6893                         phostname='cat /etc/systemid'
6894                         echo "Whadyaknow.  Xenix always was a bit strange..."
6895                         cont=''
6896                 fi
6897         elif $test -r /etc/systemid; then
6898                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6899         fi
6900 fi
6901 if $test "$cont"; then
6902         echo 'No, maybe "uuname -l" will work...'
6903         if tans=`sh -c 'uuname -l' 2>&1` ; then
6904                 myhostname=$tans
6905                 phostname='uuname -l'
6906         else
6907                 echo 'Strange.  Maybe "uname -n" will work...'
6908                 if tans=`sh -c 'uname -n' 2>&1` ; then
6909                         myhostname=$tans
6910                         phostname='uname -n'
6911                 else
6912                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6913                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6914                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6915                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6916                         else
6917                                 case "$myhostname" in
6918                                 '') echo "Does this machine have an identity crisis or something?"
6919                                         phostname='';;
6920                                 *)
6921                                         echo "Well, you said $myhostname before..."
6922                                         phostname='echo $myhostname';;
6923                                 esac
6924                         fi
6925                 fi
6926         fi
6927 fi
6928 : you do not want to know about this
6929 set $myhostname
6930 myhostname=$1
6931
6932 : verify guess
6933 if $test "$myhostname" ; then
6934         dflt=y
6935         rp='Your host name appears to be "'$myhostname'".'" Right?"
6936         . ./myread
6937         case "$ans" in
6938         y*) ;;
6939         *) myhostname='';;
6940         esac
6941 fi
6942
6943 : bad guess or no guess
6944 while $test "X$myhostname" = X ; do
6945         dflt=''
6946         rp="Please type the (one word) name of your host:"
6947         . ./myread
6948         myhostname="$ans"
6949 done
6950
6951 : translate upper to lower if necessary
6952 case "$myhostname" in
6953 *[A-Z]*)
6954         echo "(Normalizing case in your host name)"
6955         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6956         ;;
6957 esac
6958
6959 case "$myhostname" in
6960 *.*)
6961         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6962         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6963         echo "(Trimming domain name from host name--host name is now $myhostname)"
6964         ;;
6965 *) case "$mydomain" in
6966         '')
6967                 {
6968                         test "X$hostcat" = "Xypcat hosts" &&
6969                         ypmatch "$myhostname" hosts 2>/dev/null |\
6970                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6971                         $test -s hosts
6972                 } || {
6973                         test "X$hostcat" != "X" &&
6974                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6975                                         /[       ]$myhostname[  . ]/p" > hosts
6976                 }
6977                 tmp_re="[       . ]"
6978                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6979                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6980                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6981                         hosts | $sort | $uniq | \
6982                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6983                 case `$echo X$dflt` in
6984                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6985                         dflt=.
6986                         ;;
6987                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6988                         ;;
6989                 esac
6990                 case "$dflt" in
6991                 .)
6992                         tans=`./loc resolv.conf X /etc /usr/etc`
6993                         if $test -f "$tans"; then
6994                                 echo "(Attempting domain name extraction from $tans)"
6995                                 dflt=.`$sed -n -e 's/   / /g' \
6996                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6997                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6998                                 case "$dflt" in
6999                                 .) dflt=.`$sed -n -e 's/        / /g' \
7000                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7001                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7002                                         ;;
7003                                 esac
7004                         fi
7005                         ;;
7006                 esac
7007                 case "$dflt" in
7008                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7009                         dflt=.`sh -c domainname 2>/dev/null`
7010                         case "$dflt" in
7011                         '') dflt='.';;
7012                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7013                         esac
7014                         ;;
7015                 esac
7016                 case "$dflt" in
7017                 .) echo "(Lost all hope -- silly guess then)"
7018                         dflt='.uucp'
7019                         ;;
7020                 esac
7021                 $rm -f hosts
7022                 ;;
7023         *) dflt="$mydomain";;
7024         esac;;
7025 esac
7026 echo " "
7027 rp="What is your domain name?"
7028 . ./myread
7029 tans="$ans"
7030 case "$ans" in
7031 '') ;;
7032 .*) ;;
7033 *) tans=".$tans";;
7034 esac
7035 mydomain="$tans"
7036
7037 : translate upper to lower if necessary
7038 case "$mydomain" in
7039 *[A-Z]*)
7040         echo "(Normalizing case in your domain name)"
7041         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7042         ;;
7043 esac
7044
7045 : a little sanity check here
7046 case "$phostname" in
7047 '') ;;
7048 *)
7049         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7050         $myhostname$mydomain|$myhostname) ;;
7051         *)
7052                 case "$phostname" in
7053                 sed*)
7054                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7055                         ;;
7056                 *)
7057                         echo "(That doesn't agree with your $phostname command, by the way.)"
7058                         ;;
7059                 esac
7060         ;;
7061         esac
7062         ;;
7063 esac
7064
7065 $cat <<EOM
7066
7067 I need to get your e-mail address in Internet format if possible, i.e.
7068 something like user@host.domain. Please answer accurately since I have
7069 no easy means to double check it. The default value provided below
7070 is most probably close to reality but may not be valid from outside
7071 your organization...
7072
7073 EOM
7074 cont=x
7075 while test "$cont"; do
7076         case "$cf_email" in
7077         '') dflt="$cf_by@$myhostname$mydomain";;
7078         *) dflt="$cf_email";;
7079         esac
7080         rp='What is your e-mail address?'
7081         . ./myread
7082         cf_email="$ans"
7083         case "$cf_email" in
7084         *@*.*) cont='' ;;
7085         *)
7086                 rp='Address does not look like an Internet one.  Use it anyway?'
7087                 case "$fastread" in
7088                 yes) dflt=y ;;
7089                 *) dflt=n ;;
7090                 esac
7091                 . ./myread
7092                 case "$ans" in
7093                 y*) cont='' ;;
7094                 *) echo " " ;;
7095                 esac
7096                 ;;
7097         esac
7098 done
7099
7100 $cat <<EOM
7101
7102 If you or somebody else will be maintaining perl at your site, please
7103 fill in the correct e-mail address here so that they may be contacted
7104 if necessary. Currently, the "perlbug" program included with perl
7105 will send mail to this address in addition to perlbug@perl.com. You may
7106 enter "none" for no administrator.
7107
7108 EOM
7109 case "$perladmin" in
7110 '') dflt="$cf_email";;
7111 *) dflt="$perladmin";;
7112 esac
7113 rp='Perl administrator e-mail address'
7114 . ./myread
7115 perladmin="$ans"
7116
7117 : figure out how to guarantee perl startup
7118 case "$startperl" in
7119 '')
7120         case "$sharpbang" in
7121         *!)
7122                 $cat <<EOH
7123
7124 I can use the #! construct to start perl on your system. This will
7125 make startup of perl scripts faster, but may cause problems if you
7126 want to share those scripts and perl is not in a standard place
7127 ($binexp/perl) on all your platforms. The alternative is to force
7128 a shell by starting the script with a single ':' character.
7129
7130 EOH
7131                 dflt="$binexp/perl"
7132                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7133                 . ./myread
7134                 case "$ans" in
7135                 none)   startperl=": # use perl";;
7136                 *)      startperl="#!$ans"
7137                         if $test 30 -lt `echo "$ans" | wc -c`; then
7138                                 $cat >&4 <<EOM
7139
7140 WARNING:  Some systems limit the #! command to 32 characters.
7141 If you experience difficulty running Perl scripts with #!, try
7142 installing Perl in a directory with a shorter pathname.
7143
7144 EOM
7145                         fi ;;
7146                 esac
7147                 ;;
7148         *) startperl=": # use perl"
7149                 ;;
7150         esac
7151         ;;
7152 esac
7153 echo "I'll use $startperl to start perl scripts."
7154
7155 : figure best path for perl in scripts
7156 case "$perlpath" in
7157 '')
7158         perlpath="$binexp/perl"
7159         case "$startperl" in
7160         *!*) ;;
7161         *)
7162                 $cat <<EOH
7163
7164 I will use the "eval 'exec'" idiom to start Perl on your system.
7165 I can use the full path of your Perl binary for this purpose, but
7166 doing so may cause problems if you want to share those scripts and
7167 Perl is not always in a standard place ($binexp/perl).
7168
7169 EOH
7170                 dflt="$binexp/perl"
7171                 rp="What path shall I use in \"eval 'exec'\"?"
7172                 . ./myread
7173                 perlpath="$ans"
7174                 ;;
7175         esac
7176         ;;
7177 esac
7178 case "$startperl" in
7179 *!*)    ;;
7180 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7181 esac
7182
7183 : determine where public executable scripts go
7184 set scriptdir scriptdir
7185 eval $prefixit
7186 case "$scriptdir" in
7187 '')
7188         dflt="$bin"
7189         : guess some guesses
7190         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7191         $test -d /usr/share/bin     && dflt=/usr/share/bin
7192         $test -d /usr/local/script  && dflt=/usr/local/script
7193         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7194         $test -d $prefixexp/script  && dflt=$prefixexp/script
7195         set dflt
7196         eval $prefixup
7197         ;;
7198 *)  dflt="$scriptdir"
7199         ;;
7200 esac
7201 $cat <<EOM
7202  
7203 Some installations have a separate directory just for executable scripts so
7204 that they can mount it across multiple architectures but keep the scripts in
7205 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7206 Or you might just lump your scripts in with all your other executables.
7207  
7208 EOM
7209 fn=d~
7210 rp='Where do you keep publicly executable scripts?'
7211 . ./getfile
7212 if $test "X$ansexp" != "X$scriptdirexp"; then
7213         installscript=''
7214 fi
7215 scriptdir="$ans"
7216 scriptdirexp="$ansexp"
7217 : Change installation prefix, if necessary.
7218 if $test X"$prefix" != X"$installprefix"; then
7219         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7220 else
7221         installscript="$scriptdirexp"
7222 fi
7223
7224 : determine where add-on public executables go
7225 case "$sitebin" in
7226 '')     dflt=$siteprefix/bin ;;
7227 *)      dflt=$sitebin ;;
7228 esac
7229 fn=d~
7230 rp='Pathname where the add-on public executables should be installed?'
7231 . ./getfile
7232 sitebin="$ans"
7233 sitebinexp="$ansexp"
7234 : Change installation prefix, if necessary.
7235 if $test X"$prefix" != X"$installprefix"; then
7236         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7237 else
7238         installsitebin="$sitebinexp"
7239 fi
7240
7241 : see if sqrtl exists
7242 set sqrtl d_sqrtl
7243 eval $inlibc
7244
7245 case "$ccflags" in
7246 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7247 esac
7248
7249 case "$uselongdouble" in
7250 $define|true|[yY]*)     dflt='y';;
7251 *) dflt='n';;
7252 esac
7253 cat <<EOM
7254
7255 Perl can be built to take advantage of long doubles which
7256 (if available) may give more accuracy and range for floating point numbers.
7257
7258 If this doesn't make any sense to you, just accept the default '$dflt'.
7259 EOM
7260 rp='Try to use long doubles if available?'
7261 . ./myread
7262 case "$ans" in
7263 y|Y)    val="$define"   ;;
7264 *)      val="$undef"    ;;
7265 esac
7266 set uselongdouble
7267 eval $setvar
7268
7269 case "$uselongdouble" in
7270 true|[yY]*) uselongdouble="$define" ;;
7271 esac
7272
7273 case "$uselongdouble" in
7274 $define)
7275 : Look for a hint-file generated 'call-back-unit'.  If the
7276 : user has specified that long doubles should be used,
7277 : we may need to set or change some other defaults.
7278         if $test -f uselongdouble.cbu; then
7279                 echo "Your platform has some specific hints for long doubles, using them..."
7280                 . ./uselongdouble.cbu
7281         else
7282                 $cat <<EOM
7283 (Your platform doesn't have any specific hints for long doubles.)
7284 EOM
7285         fi
7286         ;;
7287 esac
7288
7289 case "$uselongdouble:$d_sqrtl" in
7290 $define:$undef)
7291                 $cat <<EOM >&4
7292
7293 *** You requested the use of long doubles but you do not seem to have
7294 *** the mathematic functions for long doubles.  I'm disabling the use
7295 *** of long doubles.
7296
7297 EOM
7298         uselongdouble=$undef
7299         ;;
7300 esac
7301
7302 case "$useperlio" in
7303 $define|true|[yY]*)     dflt='y';;
7304 *) dflt='n';;
7305 esac
7306 cat <<EOM
7307
7308 Previous version of $package used the standard IO mechanisms as defined
7309 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7310 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7311 the default.  This abstraction layer can use AT&T's sfio (if you already
7312 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7313 problems with some extension modules.  Using PerlIO with stdio is safe,
7314 but it is slower than plain stdio and therefore is not the default.
7315
7316 If this doesn't make any sense to you, just accept the default '$dflt'.
7317 EOM
7318 rp='Use the experimental PerlIO abstraction layer?'
7319 . ./myread
7320 case "$ans" in
7321 y|Y) 
7322         val="$define"
7323         ;;     
7324 *)      
7325         echo "Ok, doing things the stdio way"
7326         val="$undef"
7327         ;;
7328 esac
7329 set useperlio
7330 eval $setvar 
7331
7332 case "$vendorprefix" in
7333 '')     d_vendorbin="$undef"
7334         vendorbin=''
7335         vendorbinexp=''
7336         ;;
7337 *)      d_vendorbin="$define"
7338         : determine where vendor-supplied executables go.
7339         case "$vendorbin" in
7340         '') dflt=$vendorprefix/bin ;;
7341         *)      dflt="$vendorbin" ;;
7342         esac
7343         fn=d~+
7344         rp='Pathname for the vendor-supplied executables directory?'
7345         . ./getfile
7346         vendorbin="$ans"
7347         vendorbinexp="$ansexp"
7348         ;;
7349 esac
7350 : Change installation prefix, if necessary.
7351 if $test X"$prefix" != X"$installprefix"; then
7352         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7353 else
7354         installvendorbin="$vendorbinexp"
7355 fi
7356
7357 : see if qgcvt exists
7358 set qgcvt d_qgcvt
7359 eval $inlibc
7360
7361 : check for length of double
7362 echo " "
7363 case "$doublesize" in
7364 '')
7365         echo "Checking to see how big your double precision numbers are..." >&4
7366         $cat >try.c <<'EOCP'
7367 #include <stdio.h>
7368 int main()
7369 {
7370     printf("%d\n", (int)sizeof(double));
7371     exit(0);
7372 }
7373 EOCP
7374         set try
7375         if eval $compile_ok; then
7376                 doublesize=`./try`
7377                 echo "Your double is $doublesize bytes long."
7378         else
7379                 dflt='8'
7380                 echo "(I can't seem to compile the test program.  Guessing...)"
7381                 rp="What is the size of a double precision number (in bytes)?"
7382                 . ./myread
7383                 doublesize="$ans"
7384         fi
7385         ;;
7386 esac
7387 $rm -f try.c try
7388
7389 : check for long doubles
7390 echo " "
7391 echo "Checking to see if you have long double..." >&4
7392 echo 'int main() { long double x = 7.0; }' > try.c
7393 set try
7394 if eval $compile; then
7395         val="$define"
7396         echo "You have long double."
7397 else
7398         val="$undef"
7399         echo "You do not have long double."
7400 fi
7401 $rm try.*
7402 set d_longdbl
7403 eval $setvar
7404
7405 : check for length of long double
7406 case "${d_longdbl}${longdblsize}" in
7407 $define)
7408         echo " "
7409         echo "Checking to see how big your long doubles are..." >&4
7410         $cat >try.c <<'EOCP'
7411 #include <stdio.h>
7412 int main()
7413 {
7414         printf("%d\n", sizeof(long double));
7415 }
7416 EOCP
7417         set try
7418         set try
7419         if eval $compile; then
7420                 longdblsize=`./try$exe_ext`
7421                 echo "Your long doubles are $longdblsize bytes long."
7422         else
7423                 dflt='8'
7424                 echo " "
7425                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7426                 rp="What is the size of a long double (in bytes)?"
7427                 . ./myread
7428                 longdblsize="$ans"
7429         fi
7430         if $test "X$doublesize" = "X$longdblsize"; then
7431                 echo "(That isn't any different from an ordinary double.)"
7432         fi      
7433         ;;
7434 esac
7435 $rm -f try.* try
7436
7437 echo " "
7438
7439 if $test X"$d_longdbl" = X"$define"; then
7440
7441 echo "Checking how to print long doubles..." >&4
7442
7443 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7444         $cat >try.c <<'EOCP'
7445 #include <sys/types.h>
7446 #include <stdio.h>
7447 int main() {
7448   double d = 123.456;
7449   printf("%.3f\n", d);
7450 }
7451 EOCP
7452         set try
7453         if eval $compile; then
7454                 yyy=`./try$exe_ext`
7455                 case "$yyy" in
7456                 123.456)
7457                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7458                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7459                         echo "We will use %f."
7460                         ;;
7461                 esac
7462         fi
7463 fi
7464
7465 if $test X"$sPRIfldbl" = X; then
7466         $cat >try.c <<'EOCP'
7467 #include <sys/types.h>
7468 #include <stdio.h>
7469 int main() {
7470   long double d = 123.456;
7471   printf("%.3llf\n", d);
7472 }
7473 EOCP
7474         set try
7475         if eval $compile; then
7476                 yyy=`./try$exe_ext`
7477                 case "$yyy" in
7478                 123.456)
7479                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7480                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7481                         echo "We will use %llf."
7482                         ;;
7483                 esac
7484         fi
7485 fi
7486
7487 if $test X"$sPRIfldbl" = X; then
7488         $cat >try.c <<'EOCP'
7489 #include <sys/types.h>
7490 #include <stdio.h>
7491 int main() {
7492   long double d = 123.456;
7493   printf("%.3Lf\n", d);
7494 }
7495 EOCP
7496         set try
7497         if eval $compile; then
7498                 yyy=`./try$exe_ext`
7499                 case "$yyy" in
7500                 123.456)
7501                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7502                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7503                         echo "We will use %Lf."
7504                         ;;
7505                 esac
7506         fi
7507 fi
7508
7509 if $test X"$sPRIfldbl" = X; then
7510         $cat >try.c <<'EOCP'
7511 #include <sys/types.h>
7512 #include <stdio.h>
7513 int main() {
7514   long double d = 123.456;
7515   printf("%.3lf\n", d);
7516 }
7517 EOCP
7518         set try
7519         if eval $compile; then
7520                 yyy=`./try$exe_ext`
7521                 case "$yyy" in
7522                 123.456)
7523                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7524                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7525                         echo "We will use %lf."
7526                         ;;
7527                 esac
7528         fi
7529 fi
7530
7531 if $test X"$sPRIfldbl" = X; then
7532         echo "Cannot figure out how to print long doubles." >&4
7533 fi
7534
7535 $rm -f try try.*
7536
7537 fi # d_longdbl
7538
7539 case "$sPRIfldbl" in
7540 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7541         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7542         ;;
7543 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7544         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7545         ;;
7546 esac
7547
7548 : Check how to convert floats to strings.
7549 if test "X$d_Gconvert" = X; then
7550         echo " "
7551         echo "Checking for an efficient way to convert floats to strings."
7552         echo " " > try.c
7553         case "$uselongdouble" in
7554         "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7555         esac
7556         case "$d_longdbl" in
7557         "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7558         esac
7559         case "$d_PRIgldbl" in
7560         "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7561         esac
7562         $cat >>try.c <<EOP
7563 #ifdef TRY_gconvert
7564 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7565 char *myname = "gconvert";
7566 #endif
7567 #ifdef TRY_gcvt
7568 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7569 char *myname = "gcvt";
7570 #endif
7571 #ifdef TRY_qgcvt
7572 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7573 char *myname = "qgcvt";
7574 #define DOUBLETYPE long double
7575 #endif
7576 #ifdef TRY_sprintf
7577 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7578 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7579 #else
7580 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7581 #endif
7582 char *myname = "sprintf";
7583 #endif
7584
7585 #ifndef DOUBLETYPE
7586 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7587 #define DOUBLETYPE long double
7588 #else
7589 #define DOUBLETYPE double
7590 #endif
7591 #endif
7592
7593 #include <stdio.h>
7594
7595 #define I_STDLIB $i_stdlib
7596 #ifdef I_STDLIB
7597 #include <stdlib.h>
7598 #endif
7599
7600 int
7601 checkit(expect, got)
7602 char *expect;
7603 char *got;
7604 {
7605     if (strcmp(expect, got)) {
7606                 printf("%s oddity:  Expected %s, got %s\n",
7607                         myname, expect, got);
7608                 exit(1);
7609         }
7610 }
7611
7612 int main()
7613
7614         char buf[64]; 
7615         buf[63] = '\0';
7616
7617         /* This must be 1st test on (which?) platform */
7618         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7619         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7620         checkit("0.1", buf);
7621
7622         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7623         checkit("1", buf);
7624
7625         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7626         checkit("1.1", buf);
7627
7628         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7629         checkit("1.01", buf);
7630
7631         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7632         checkit("1.001", buf);
7633
7634         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7635         checkit("1.0001", buf);
7636
7637         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7638         checkit("1.00001", buf);
7639
7640         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7641         checkit("1.000001", buf);
7642
7643         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7644         checkit("0", buf);
7645
7646         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7647         checkit("-1", buf);
7648
7649         /* Some Linux gcvt's give 1.e+5 here. */
7650         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7651         checkit("100000", buf);
7652         
7653         /* Some Linux gcvt's give -1.e+5 here. */
7654         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7655         checkit("-100000", buf);
7656
7657         exit(0);
7658 }
7659 EOP
7660         case "$d_Gconvert" in
7661         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7662         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7663         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7664         *) xxx_list='gconvert gcvt sprintf' ;;
7665         esac
7666
7667         case "$d_longdbl$uselongdouble$d_qgcvt" in
7668         "$define$define$define") xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7669         esac
7670
7671         for xxx_convert in $xxx_list; do
7672                 echo "Trying $xxx_convert..."
7673                 $rm -f try try$_o
7674                 set try -DTRY_$xxx_convert
7675                 if eval $compile; then
7676                         echo "$xxx_convert() found." >&4
7677                         if ./try; then
7678                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7679                                 break;
7680                         else
7681                                 echo "...But $xxx_convert didn't work as I expected."
7682                         fi
7683                 else
7684                         echo "$xxx_convert NOT found." >&4
7685                 fi
7686         done
7687                 
7688         case "$xxx_convert" in
7689         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7690         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7691         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7692         *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7693            "$define$define$define")
7694               d_Gconvert="sprintf((b),\"%.*$sPRIgldbl\",(n),(x))" ;;
7695            *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7696            esac
7697            ;;  
7698         esac
7699 fi
7700
7701 : Initialize h_fcntl
7702 h_fcntl=false
7703
7704 : Initialize h_sysfile
7705 h_sysfile=false
7706
7707 : access call always available on UNIX
7708 set access d_access
7709 eval $inlibc
7710
7711 : locate the flags for 'access()'
7712 case "$d_access" in
7713 "$define")
7714         echo " "
7715         $cat >access.c <<'EOCP'
7716 #include <sys/types.h>
7717 #ifdef I_FCNTL
7718 #include <fcntl.h>
7719 #endif
7720 #ifdef I_SYS_FILE
7721 #include <sys/file.h>
7722 #endif
7723 #ifdef I_UNISTD
7724 #include <unistd.h>
7725 #endif
7726 int main() {
7727         exit(R_OK);
7728 }
7729 EOCP
7730         : check sys/file.h first, no particular reason here
7731         if $test `./findhdr sys/file.h` && \
7732                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7733                 h_sysfile=true;
7734                 echo "<sys/file.h> defines the *_OK access constants." >&4
7735         elif $test `./findhdr fcntl.h` && \
7736                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7737                 h_fcntl=true;
7738                 echo "<fcntl.h> defines the *_OK access constants." >&4
7739         elif $test `./findhdr unistd.h` && \
7740                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7741                 echo "<unistd.h> defines the *_OK access constants." >&4
7742         else
7743                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7744         fi
7745         ;;
7746 esac
7747 $rm -f access*
7748
7749 : see if accessx exists
7750 set accessx d_accessx
7751 eval $inlibc
7752
7753 : see if alarm exists
7754 set alarm d_alarm
7755 eval $inlibc
7756
7757 : see if atolf exists
7758 set atolf d_atolf
7759 eval $inlibc
7760
7761 : see if atoll exists
7762 set atoll d_atoll
7763 eval $inlibc
7764
7765 : Look for GNU-cc style attribute checking
7766 echo " "
7767 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7768 $cat >attrib.c <<'EOCP'
7769 #include <stdio.h>
7770 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7771 EOCP
7772 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7773         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7774                 echo "Your C compiler doesn't fully support __attribute__."
7775                 val="$undef"
7776         else
7777                 echo "Your C compiler supports __attribute__."
7778                 val="$define"
7779         fi
7780 else
7781         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7782         val="$undef"
7783 fi
7784 set d_attribut
7785 eval $setvar
7786 $rm -f attrib*
7787
7788 : see if bcmp exists
7789 set bcmp d_bcmp
7790 eval $inlibc
7791
7792 : see if bcopy exists
7793 set bcopy d_bcopy
7794 eval $inlibc
7795
7796 : see if this is a unistd.h system
7797 set unistd.h i_unistd
7798 eval $inhdr
7799
7800 : see if getpgrp exists
7801 set getpgrp d_getpgrp
7802 eval $inlibc
7803
7804 case "$d_getpgrp" in
7805 "$define")
7806         echo " "
7807         echo "Checking to see which flavor of getpgrp is in use..."
7808         $cat >set.c <<EOP
7809 #$i_unistd I_UNISTD
7810 #include <sys/types.h>
7811 #ifdef I_UNISTD
7812 #  include <unistd.h>
7813 #endif
7814 int main()
7815 {
7816         if (getuid() == 0) {
7817                 printf("(I see you are running Configure as super-user...)\n");
7818                 setuid(1);
7819         }
7820 #ifdef TRY_BSD_PGRP
7821         if (getpgrp(1) == 0)
7822                 exit(0);
7823 #else
7824         if (getpgrp() > 0)
7825                 exit(0);
7826 #endif
7827         exit(1);
7828 }
7829 EOP
7830         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7831                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7832                 val="$define"
7833         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7834                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7835                 val="$undef"
7836         else
7837                 echo "I can't seem to compile and run the test program."
7838                 if ./usg; then
7839                         xxx="a USG one, i.e. you use getpgrp()."
7840                 else
7841                         # SVR4 systems can appear rather BSD-ish.
7842                         case "$i_unistd" in
7843                         $undef)
7844                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7845                                 val="$define"
7846                                 ;;
7847                         $define)
7848                                 xxx="probably a USG one, i.e. you use getpgrp()."
7849                                 val="$undef"
7850                                 ;;
7851                         esac
7852                 fi
7853                 echo "Assuming your getpgrp is $xxx" >&4
7854         fi
7855         ;;
7856 *) val="$undef";;
7857 esac
7858 set d_bsdgetpgrp
7859 eval $setvar
7860 $rm -f set set.c
7861
7862 : see if setpgrp exists
7863 set setpgrp d_setpgrp
7864 eval $inlibc
7865
7866 case "$d_setpgrp" in
7867 "$define")
7868         echo " "
7869         echo "Checking to see which flavor of setpgrp is in use..."
7870         $cat >set.c <<EOP
7871 #$i_unistd I_UNISTD
7872 #include <sys/types.h>
7873 #ifdef I_UNISTD
7874 #  include <unistd.h>
7875 #endif
7876 int main()
7877 {
7878         if (getuid() == 0) {
7879                 printf("(I see you are running Configure as super-user...)\n");
7880                 setuid(1);
7881         }
7882 #ifdef TRY_BSD_PGRP
7883         if (-1 == setpgrp(1, 1))
7884                 exit(0);
7885 #else
7886         if (setpgrp() != -1)
7887                 exit(0);
7888 #endif
7889         exit(1);
7890 }
7891 EOP
7892         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7893                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7894                 val="$define"
7895         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7896                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7897                 val="$undef"
7898         else
7899                 echo "(I can't seem to compile and run the test program.)"
7900                 if ./usg; then
7901                         xxx="a USG one, i.e. you use setpgrp()."
7902                 else
7903                         # SVR4 systems can appear rather BSD-ish.
7904                         case "$i_unistd" in
7905                         $undef)
7906                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7907                                 val="$define"
7908                                 ;;
7909                         $define)
7910                                 xxx="probably a USG one, i.e. you use setpgrp()."
7911                                 val="$undef"
7912                                 ;;
7913                         esac
7914                 fi
7915                 echo "Assuming your setpgrp is $xxx" >&4
7916         fi
7917         ;;
7918 *) val="$undef";;
7919 esac
7920 set d_bsdsetpgrp
7921 eval $setvar
7922 $rm -f set set.c
7923 : see if bzero exists
7924 set bzero d_bzero
7925 eval $inlibc
7926
7927 : see if signal is declared as pointer to function returning int or void
7928 echo " "
7929 xxx=`./findhdr signal.h`
7930 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7931 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7932         echo "You have int (*signal())() instead of void." >&4
7933         val="$undef"
7934 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7935         echo "You have void (*signal())()." >&4
7936         val="$define"
7937 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7938         echo "You have int (*signal())() instead of void." >&4
7939         val="$undef"
7940 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7941         echo "You have void (*signal())()." >&4
7942         val="$define"
7943 else
7944         case "$d_voidsig" in
7945         '')
7946         echo "I can't determine whether signal handler returns void or int..." >&4
7947                 dflt=void
7948                 rp="What type does your signal handler return?"
7949                 . ./myread
7950                 case "$ans" in
7951                 v*) val="$define";;
7952                 *) val="$undef";;
7953                 esac;;
7954         "$define")
7955                 echo "As you already told me, signal handler returns void." >&4
7956                 val="$define"
7957                 ;;
7958         *)      echo "As you already told me, signal handler returns int." >&4
7959                 val="$undef"
7960                 ;;
7961         esac
7962 fi
7963 set d_voidsig
7964 eval $setvar
7965 case "$d_voidsig" in
7966 "$define") signal_t="void";;
7967 *) signal_t="int";;
7968 esac
7969 $rm -f $$.tmp
7970
7971 : check for ability to cast large floats to 32-bit ints.
7972 echo " "
7973 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7974 if $test "$intsize" -ge 4; then
7975         xxx=int
7976 else
7977         xxx=long
7978 fi
7979 $cat >try.c <<EOCP
7980 #include <stdio.h>
7981 #include <sys/types.h>
7982 #include <signal.h>
7983 $signal_t blech(s) int s; { exit(3); }
7984 int main()
7985 {
7986         $xxx i32;
7987         double f, g;
7988         int result = 0;
7989         char str[16];
7990         signal(SIGFPE, blech);
7991
7992         /* Don't let compiler optimize the test away.  Store the number 
7993            in a writable string for gcc to pass to sscanf under HP/UX.
7994         */
7995         sprintf(str, "2147483647");
7996         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7997         g = 10 * f;
7998         i32  = ($xxx) g;
7999
8000         /* x86 processors will probably give 0x8000 0000, which is a
8001        sign change.  We don't want that.  We want to mimic SPARC
8002            behavior here, which is to preserve the sign and give
8003            back 0x7fff ffff.
8004         */
8005         if (i32 != ($xxx) f)
8006                 result |= 1;
8007         exit(result);
8008 }
8009 EOCP
8010 set try
8011 if eval $compile_ok; then
8012         ./try
8013         yyy=$?
8014 else
8015         echo "(I can't seem to compile the test program--assuming it can't)"
8016         yyy=1
8017 fi
8018 case "$yyy" in
8019 0)      val="$define"
8020         echo "Yup, it can."
8021         ;;
8022 *)      val="$undef"
8023         echo "Nope, it can't."
8024         ;;
8025 esac
8026 set d_casti32
8027 eval $setvar
8028 $rm -f try try.*
8029
8030 : check for ability to cast negative floats to unsigned
8031 echo " "
8032 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8033 $cat >try.c <<EOCP
8034 #include <stdio.h>
8035 #include <sys/types.h>
8036 #include <signal.h>
8037 $signal_t blech(s) int s; { exit(7); }
8038 $signal_t blech_in_list(s) int s; { exit(4); }
8039 unsigned long dummy_long(p) unsigned long p; { return p; }
8040 unsigned int dummy_int(p) unsigned int p; { return p; }
8041 unsigned short dummy_short(p) unsigned short p; { return p; }
8042 int main()
8043 {
8044         double f;
8045         unsigned long along;
8046         unsigned int aint;
8047         unsigned short ashort;
8048         int result = 0;
8049         char str[16];
8050         
8051         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8052            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8053            optimized the whole file away
8054         */
8055         /* Store the number in a writable string for gcc to pass to 
8056            sscanf under HP/UX.
8057         */
8058         sprintf(str, "-123");
8059         sscanf(str, "%lf", &f);  /* f = -123.; */
8060
8061         signal(SIGFPE, blech);
8062         along = (unsigned long)f;
8063         aint = (unsigned int)f;
8064         ashort = (unsigned short)f;
8065         if (along != (unsigned long)-123)
8066                 result |= 1;
8067         if (aint != (unsigned int)-123)
8068                 result |= 1;
8069         if (ashort != (unsigned short)-123)
8070                 result |= 1;
8071         sprintf(str, "1073741824.");
8072         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8073         f = f + f;
8074         along = 0;
8075         along = (unsigned long)f;
8076         if (along != 0x80000000)
8077                 result |= 2;
8078         f -= 1.;
8079         along = 0;
8080         along = (unsigned long)f;
8081         if (along != 0x7fffffff)
8082                 result |= 1;
8083         f += 2.;
8084         along = 0;
8085         along = (unsigned long)f;
8086         if (along != 0x80000001)
8087                 result |= 2;
8088         if (result)
8089                 exit(result);
8090         signal(SIGFPE, blech_in_list);
8091         sprintf(str, "123.");
8092         sscanf(str, "%lf", &f);  /* f = 123.; */
8093         along = dummy_long((unsigned long)f);
8094         aint = dummy_int((unsigned int)f);
8095         ashort = dummy_short((unsigned short)f);
8096         if (along != (unsigned long)123)
8097                 result |= 4;
8098         if (aint != (unsigned int)123)
8099                 result |= 4;
8100         if (ashort != (unsigned short)123)
8101                 result |= 4;
8102         exit(result);
8103
8104 }
8105 EOCP
8106 set try
8107 if eval $compile_ok; then
8108         ./try
8109         castflags=$?
8110 else
8111         echo "(I can't seem to compile the test program--assuming it can't)"
8112         castflags=7
8113 fi
8114 case "$castflags" in
8115 0)      val="$define"
8116         echo "Yup, it can."
8117         ;;
8118 *)      val="$undef"
8119         echo "Nope, it can't."
8120         ;;
8121 esac
8122 set d_castneg
8123 eval $setvar
8124 $rm -f try.*
8125
8126 : see if vprintf exists
8127 echo " "
8128 if set vprintf val -f d_vprintf; eval $csym; $val; then
8129         echo 'vprintf() found.' >&4
8130         val="$define"
8131         $cat >vprintf.c <<'EOF'
8132 #include <varargs.h>
8133
8134 int main() { xxx("foo"); }
8135
8136 xxx(va_alist)
8137 va_dcl
8138 {
8139         va_list args;
8140         char buf[10];
8141
8142         va_start(args);
8143         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8144 }
8145 EOF
8146         set vprintf
8147         if eval $compile && ./vprintf; then
8148                 echo "Your vsprintf() returns (int)." >&4
8149                 val2="$undef"
8150         else
8151                 echo "Your vsprintf() returns (char*)." >&4
8152                 val2="$define"
8153         fi
8154 else
8155         echo 'vprintf() NOT found.' >&4
8156                 val="$undef"
8157                 val2="$undef"
8158 fi
8159 set d_vprintf
8160 eval $setvar
8161 val=$val2
8162 set d_charvspr
8163 eval $setvar
8164
8165 : see if chown exists
8166 set chown d_chown
8167 eval $inlibc
8168
8169 : see if chroot exists
8170 set chroot d_chroot
8171 eval $inlibc
8172
8173 : see if chsize exists
8174 set chsize d_chsize
8175 eval $inlibc
8176
8177 : check for const keyword
8178 echo " "
8179 echo 'Checking to see if your C compiler knows about "const"...' >&4
8180 $cat >const.c <<'EOCP'
8181 typedef struct spug { int drokk; } spug;
8182 int main()
8183 {
8184         const char *foo;
8185         const spug y;
8186 }
8187 EOCP
8188 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8189         val="$define"
8190         echo "Yup, it does."
8191 else
8192         val="$undef"
8193         echo "Nope, it doesn't."
8194 fi
8195 set d_const
8196 eval $setvar
8197
8198 : see if crypt exists
8199 echo " "
8200 if set crypt val -f d_crypt; eval $csym; $val; then
8201         echo 'crypt() found.' >&4
8202         val="$define"
8203         cryptlib=''
8204 else
8205         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8206         if $test -z "$cryptlib"; then
8207                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8208         else
8209                 cryptlib=-lcrypt
8210         fi
8211         if $test -z "$cryptlib"; then
8212                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8213         else
8214                 cryptlib=-lcrypt
8215         fi
8216         if $test -z "$cryptlib"; then
8217                 cryptlib=`./loc libcrypt$_a "" $libpth`
8218         else
8219                 cryptlib=-lcrypt
8220         fi
8221         if $test -z "$cryptlib"; then
8222                 echo 'crypt() NOT found.' >&4
8223                 val="$undef"
8224         else
8225                 val="$define"
8226         fi
8227 fi
8228 set d_crypt
8229 eval $setvar
8230
8231 : get csh whereabouts
8232 case "$csh" in
8233 'csh') val="$undef" ;;
8234 *) val="$define" ;;
8235 esac
8236 set d_csh
8237 eval $setvar
8238 : Respect a hint or command line value for full_csh.
8239 case "$full_csh" in
8240 '') full_csh=$csh ;;
8241 esac
8242
8243 : see if cuserid exists
8244 set cuserid d_cuserid
8245 eval $inlibc
8246
8247 : see if this is a limits.h system
8248 set limits.h i_limits
8249 eval $inhdr
8250
8251 : see if this is a float.h system
8252 set float.h i_float
8253 eval $inhdr
8254
8255 : See if number of significant digits in a double precision number is known
8256 echo " "
8257 $cat >dbl_dig.c <<EOM
8258 #$i_limits I_LIMITS
8259 #$i_float I_FLOAT
8260 #ifdef I_LIMITS
8261 #include <limits.h>
8262 #endif
8263 #ifdef I_FLOAT
8264 #include <float.h>
8265 #endif
8266 #ifdef DBL_DIG
8267 printf("Contains DBL_DIG");
8268 #endif
8269 EOM
8270 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8271 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8272         echo "DBL_DIG found." >&4
8273         val="$define"
8274 else
8275         echo "DBL_DIG NOT found." >&4
8276         val="$undef"
8277 fi
8278 $rm -f dbl_dig.?
8279 set d_dbl_dig
8280 eval $setvar
8281
8282 : see if difftime exists
8283 set difftime d_difftime
8284 eval $inlibc
8285
8286 : see if this is a dirent system
8287 echo " "
8288 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8289         val="$define"
8290         echo "<dirent.h> found." >&4
8291 else
8292         val="$undef"
8293         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8294                 echo "<sys/dir.h> found." >&4
8295                 echo " "
8296         else
8297                 xinc=`./findhdr sys/ndir.h`
8298         fi
8299         echo "<dirent.h> NOT found." >&4
8300 fi
8301 set i_dirent
8302 eval $setvar
8303
8304 : Look for type of directory structure.
8305 echo " "
8306 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8307
8308 case "$direntrytype" in
8309 ''|' ')
8310         case "$i_dirent" in
8311         $define) guess1='struct dirent' ;;
8312         *) guess1='struct direct'  ;;
8313         esac
8314         ;;
8315 *)      guess1="$direntrytype"
8316         ;;
8317 esac
8318
8319 case "$guess1" in
8320 'struct dirent') guess2='struct direct' ;;
8321 *) guess2='struct dirent' ;;
8322 esac
8323                 
8324 if $contains "$guess1" try.c >/dev/null 2>&1; then
8325         direntrytype="$guess1"
8326         echo "Your directory entries are $direntrytype." >&4
8327 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8328         direntrytype="$guess2"
8329         echo "Your directory entries seem to be $direntrytype." >&4
8330 else
8331         echo "I don't recognize your system's directory entries." >&4
8332         rp="What type is used for directory entries on this system?"
8333         dflt="$guess1"
8334         . ./myread
8335         direntrytype="$ans"
8336 fi
8337 $rm -f try.c
8338
8339
8340 : see if the directory entry stores field length
8341 echo " "
8342 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8343 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8344         echo "Good, your directory entry keeps length information in d_namlen." >&4
8345         val="$define"
8346 else
8347         echo "Your directory entry does not know about the d_namlen field." >&4
8348         val="$undef"
8349 fi
8350 set d_dirnamlen
8351 eval $setvar
8352 $rm -f try.c
8353
8354 : see if dlerror exists
8355 xxx_runnm="$runnm"
8356 runnm=false
8357 set dlerror d_dlerror
8358 eval $inlibc
8359 runnm="$xxx_runnm"
8360
8361 : see if dlfcn is available
8362 set dlfcn.h i_dlfcn
8363 eval $inhdr
8364
8365 case "$usedl" in
8366 $define|y|true)
8367         $cat << EOM
8368
8369 On a few systems, the dynamically loaded modules that perl generates and uses
8370 will need a different extension than shared libs. The default will probably
8371 be appropriate.
8372
8373 EOM
8374         case "$dlext" in
8375         '')     dflt="$so" ;;
8376         *)      dflt="$dlext" ;;
8377         esac
8378         rp='What is the extension of dynamically loaded modules'
8379         . ./myread
8380         dlext="$ans"
8381         ;;
8382 *)
8383         dlext="none"
8384         ;;
8385 esac
8386
8387 : Check if dlsym need a leading underscore
8388 echo " "
8389 val="$undef"
8390
8391 case "$dlsrc" in
8392 dl_dlopen.xs)
8393         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8394         $cat >dyna.c <<'EOM'
8395 fred () { }
8396 EOM
8397
8398 $cat >fred.c<<EOM
8399
8400 #include <stdio.h>
8401 #$i_dlfcn I_DLFCN
8402 #ifdef I_DLFCN
8403 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8404 #else
8405 #include <sys/types.h>
8406 #include <nlist.h>
8407 #include <link.h>
8408 #endif
8409
8410 extern int fred() ;
8411
8412 int main()
8413 {
8414     void * handle ;
8415     void * symbol ;
8416 #ifndef RTLD_LAZY
8417     int mode = 1 ;
8418 #else
8419     int mode = RTLD_LAZY ;
8420 #endif
8421     handle = dlopen("./dyna.$dlext", mode) ;
8422     if (handle == NULL) {
8423         printf ("1\n") ;
8424         fflush (stdout) ;
8425         exit(0);
8426     }
8427     symbol = dlsym(handle, "fred") ;
8428     if (symbol == NULL) {
8429         /* try putting a leading underscore */
8430         symbol = dlsym(handle, "_fred") ;
8431         if (symbol == NULL) {
8432             printf ("2\n") ;
8433             fflush (stdout) ;
8434             exit(0);
8435         }
8436         printf ("3\n") ;
8437     }
8438     else
8439         printf ("4\n") ;
8440     fflush (stdout) ;
8441     exit(0);
8442 }
8443 EOM
8444         : Call the object file tmp-dyna.o in case dlext=o.
8445         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8446                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8447                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8448                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8449                 xxx=`./fred`
8450                 case $xxx in
8451                 1)      echo "Test program failed using dlopen." >&4
8452                         echo "Perhaps you should not use dynamic loading." >&4;;
8453                 2)      echo "Test program failed using dlsym." >&4
8454                         echo "Perhaps you should not use dynamic loading." >&4;;
8455                 3)      echo "dlsym needs a leading underscore" >&4
8456                         val="$define" ;;
8457                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8458                 esac
8459         else
8460                 echo "I can't compile and run the test program." >&4
8461                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8462         fi
8463         ;;
8464 esac
8465                 
8466 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8467
8468 set d_dlsymun
8469 eval $setvar
8470
8471 hasproto='varname=$1; func=$2; shift; shift;
8472 while $test $# -ge 2; do
8473         case "$1" in
8474         $define) echo "#include <$2>";;
8475         esac ;
8476     shift 2;
8477 done > try.c;
8478 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8479 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8480         echo "$func() prototype found.";
8481         val="$define";
8482 else
8483         echo "$func() prototype NOT found.";
8484         val="$undef";
8485 fi;
8486 set $varname;
8487 eval $setvar;
8488 $rm -f try.c tryout.c'
8489
8490 : see if prototype for drand48 is available
8491 echo " "
8492 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8493 eval $hasproto
8494
8495 : see if dup2 exists
8496 set dup2 d_dup2
8497 eval $inlibc
8498
8499 : see if eaccess exists
8500 set eaccess d_eaccess
8501 eval $inlibc
8502
8503 : see if endgrent exists
8504 set endgrent d_endgrent
8505 eval $inlibc
8506
8507 : see if endhostent exists
8508 set endhostent d_endhent
8509 eval $inlibc
8510
8511 : see if endnetent exists
8512 set endnetent d_endnent
8513 eval $inlibc
8514
8515 : see if endprotoent exists
8516 set endprotoent d_endpent
8517 eval $inlibc
8518
8519 : see if endpwent exists
8520 set endpwent d_endpwent
8521 eval $inlibc
8522
8523 : see if endservent exists
8524 set endservent d_endsent
8525 eval $inlibc
8526
8527 : see if endspent exists
8528 set endspent d_endspent
8529 eval $inlibc
8530
8531 : Locate the flags for 'open()'
8532 echo " "
8533 $cat >open3.c <<'EOCP'
8534 #include <sys/types.h>
8535 #ifdef I_FCNTL
8536 #include <fcntl.h>
8537 #endif
8538 #ifdef I_SYS_FILE
8539 #include <sys/file.h>
8540 #endif
8541 int main() {
8542         if(O_RDONLY);
8543 #ifdef O_TRUNC
8544         exit(0);
8545 #else
8546         exit(1);
8547 #endif
8548 }
8549 EOCP
8550 : check sys/file.h first to get FREAD on Sun
8551 if $test `./findhdr sys/file.h` && \
8552                 set open3 -DI_SYS_FILE && eval $compile; then
8553         h_sysfile=true;
8554         echo "<sys/file.h> defines the O_* constants..." >&4
8555         if ./open3; then
8556                 echo "and you have the 3 argument form of open()." >&4
8557                 val="$define"
8558         else
8559                 echo "but not the 3 argument form of open().  Oh, well." >&4
8560                 val="$undef"
8561         fi
8562 elif $test `./findhdr fcntl.h` && \
8563                 set open3 -DI_FCNTL && eval $compile; then
8564         h_fcntl=true;
8565         echo "<fcntl.h> defines the O_* constants..." >&4
8566         if ./open3; then
8567                 echo "and you have the 3 argument form of open()." >&4
8568                 val="$define"
8569         else
8570                 echo "but not the 3 argument form of open().  Oh, well." >&4
8571                 val="$undef"
8572         fi
8573 else
8574         val="$undef"
8575         echo "I can't find the O_* constant definitions!  You got problems." >&4
8576 fi
8577 set d_open3
8578 eval $setvar
8579 $rm -f open3*
8580
8581 : see which of string.h or strings.h is needed
8582 echo " "
8583 strings=`./findhdr string.h`
8584 if $test "$strings" && $test -r "$strings"; then
8585         echo "Using <string.h> instead of <strings.h>." >&4
8586         val="$define"
8587 else
8588         val="$undef"
8589         strings=`./findhdr strings.h`
8590         if $test "$strings" && $test -r "$strings"; then
8591                 echo "Using <strings.h> instead of <string.h>." >&4
8592         else
8593                 echo "No string header found -- You'll surely have problems." >&4
8594         fi
8595 fi
8596 set i_string
8597 eval $setvar
8598 case "$i_string" in
8599 "$undef") strings=`./findhdr strings.h`;;
8600 *)        strings=`./findhdr string.h`;;
8601 esac
8602
8603 : check for non-blocking I/O stuff
8604 case "$h_sysfile" in
8605 true) echo "#include <sys/file.h>" > head.c;;
8606 *)
8607         case "$h_fcntl" in
8608         true) echo "#include <fcntl.h>" > head.c;;
8609         *) echo "#include <sys/fcntl.h>" > head.c;;
8610         esac
8611         ;;
8612 esac
8613 echo " "
8614 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8615 case "$o_nonblock" in
8616 '')
8617         $cat head.c > try.c
8618         $cat >>try.c <<'EOCP'
8619 #include <stdio.h>
8620 int main() {
8621 #ifdef O_NONBLOCK
8622         printf("O_NONBLOCK\n");
8623         exit(0);
8624 #endif
8625 #ifdef O_NDELAY
8626         printf("O_NDELAY\n");
8627         exit(0);
8628 #endif
8629 #ifdef FNDELAY
8630         printf("FNDELAY\n");
8631         exit(0);
8632 #endif
8633         exit(0);
8634 }
8635 EOCP
8636         set try
8637         if eval $compile_ok; then
8638                 o_nonblock=`./try`
8639                 case "$o_nonblock" in
8640                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8641                 *) echo "Seems like we can use $o_nonblock.";;
8642                 esac
8643         else
8644                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8645         fi
8646         ;;
8647 *) echo "Using $hint value $o_nonblock.";;
8648 esac
8649 $rm -f try try.* .out core
8650
8651 echo " "
8652 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8653 case "$eagain" in
8654 '')
8655         $cat head.c > try.c
8656         $cat >>try.c <<EOCP
8657 #include <errno.h>
8658 #include <sys/types.h>
8659 #include <signal.h>
8660 #include <stdio.h> 
8661 #define MY_O_NONBLOCK $o_nonblock
8662 #ifndef errno  /* XXX need better Configure test */
8663 extern int errno;
8664 #endif
8665 #$i_unistd I_UNISTD
8666 #ifdef I_UNISTD
8667 #include <unistd.h>
8668 #endif
8669 #$i_string I_STRING
8670 #ifdef I_STRING
8671 #include <string.h>
8672 #else
8673 #include <strings.h>
8674 #endif
8675 $signal_t blech(x) int x; { exit(3); }
8676 EOCP
8677         $cat >> try.c <<'EOCP'
8678 int main()
8679 {
8680         int pd[2];
8681         int pu[2];
8682         char buf[1];
8683         char string[100];
8684
8685         pipe(pd);       /* Down: child -> parent */
8686         pipe(pu);       /* Up: parent -> child */
8687         if (0 != fork()) {
8688                 int ret;
8689                 close(pd[1]);   /* Parent reads from pd[0] */
8690                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8691                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8692                         exit(1);
8693                 signal(SIGALRM, blech);
8694                 alarm(5);
8695                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8696                         exit(2);
8697                 sprintf(string, "%d\n", ret);
8698                 write(2, string, strlen(string));
8699                 alarm(0);
8700 #ifdef EAGAIN
8701                 if (errno == EAGAIN) {
8702                         printf("EAGAIN\n");
8703                         goto ok;
8704                 }
8705 #endif
8706 #ifdef EWOULDBLOCK
8707                 if (errno == EWOULDBLOCK)
8708                         printf("EWOULDBLOCK\n");
8709 #endif
8710         ok:
8711                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8712                 sleep(2);                               /* Give it time to close our pipe */
8713                 alarm(5);
8714                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8715                 alarm(0);
8716                 sprintf(string, "%d\n", ret);
8717                 write(3, string, strlen(string));
8718                 exit(0);
8719         }
8720
8721         close(pd[0]);                   /* We write to pd[1] */
8722         close(pu[1]);                   /* We read from pu[0] */
8723         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8724         close(pd[1]);                   /* Pipe pd is now fully closed! */
8725         exit(0);                                /* Bye bye, thank you for playing! */
8726 }
8727 EOCP
8728         set try
8729         if eval $compile_ok; then
8730                 echo "$startsh" >mtry
8731                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8732                 chmod +x mtry
8733                 ./mtry >/dev/null 2>&1
8734                 case $? in
8735                 0) eagain=`$cat try.out`;;
8736                 1) echo "Could not perform non-blocking setting!";;
8737                 2) echo "I did a successful read() for something that was not there!";;
8738                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8739                 *) echo "Something terribly wrong happened during testing.";;
8740                 esac
8741                 rd_nodata=`$cat try.ret`
8742                 echo "A read() system call with no data present returns $rd_nodata."
8743                 case "$rd_nodata" in
8744                 0|-1) ;;
8745                 *)
8746                         echo "(That's peculiar, fixing that to be -1.)"
8747                         rd_nodata=-1
8748                         ;;
8749                 esac
8750                 case "$eagain" in
8751                 '')
8752                         echo "Forcing errno EAGAIN on read() with no data available."
8753                         eagain=EAGAIN
8754                         ;;
8755                 *)
8756                         echo "Your read() sets errno to $eagain when no data is available."
8757                         ;;
8758                 esac
8759                 status=`$cat try.err`
8760                 case "$status" in
8761                 0) echo "And it correctly returns 0 to signal EOF.";;
8762                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8763                 *) echo "However, your read() returns '$status' on EOF??";;
8764                 esac
8765                 val="$define"
8766                 if test "$status" = "$rd_nodata"; then
8767                         echo "WARNING: you can't distinguish between EOF and no data!"
8768                         val="$undef"
8769                 fi
8770         else
8771                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8772                 eagain=EAGAIN
8773         fi
8774         set d_eofnblk
8775         eval $setvar
8776         ;;
8777 *)
8778         echo "Using $hint value $eagain."
8779         echo "Your read() returns $rd_nodata when no data is present."
8780         case "$d_eofnblk" in
8781         "$define") echo "And you can see EOF because read() returns 0.";;
8782         "$undef") echo "But you can't see EOF status from read() returned value.";;
8783         *)
8784                 echo "(Assuming you can't see EOF status from read anyway.)"
8785                 d_eofnblk=$undef
8786                 ;;
8787         esac
8788         ;;
8789 esac
8790 $rm -f try try.* .out core head.c mtry
8791
8792 : see if fchmod exists
8793 set fchmod d_fchmod
8794 eval $inlibc
8795
8796 : see if fchown exists
8797 set fchown d_fchown
8798 eval $inlibc
8799
8800 : see if this is an fcntl system
8801 set fcntl d_fcntl
8802 eval $inlibc
8803
8804 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8805 while $test $# -ge 2; do
8806         case "$1" in
8807         $define) echo "#include <$2>";;
8808         esac ;
8809     shift 2;
8810 done > try.c;
8811 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8812 set try;
8813 if eval $compile; then
8814         val="$define";
8815 else
8816         val="$undef";
8817 fi;
8818 set $varname;
8819 eval $setvar;
8820 $rm -f try.c try.o'
8821
8822 socketlib=''
8823 sockethdr=''
8824 : see whether socket exists
8825 echo " "
8826 $echo $n "Hmm... $c" >&4
8827 if set socket val -f d_socket; eval $csym; $val; then
8828         echo "Looks like you have Berkeley networking support." >&4
8829         d_socket="$define"
8830         if set setsockopt val -f; eval $csym; $val; then
8831                 d_oldsock="$undef"
8832         else
8833                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8834                 d_oldsock="$define"
8835         fi
8836 else
8837         if $contains socklib libc.list >/dev/null 2>&1; then
8838                 echo "Looks like you have Berkeley networking support." >&4
8839                 d_socket="$define"
8840                 : we will have to assume that it supports the 4.2 BSD interface
8841                 d_oldsock="$undef"
8842         else
8843                 echo "You don't have Berkeley networking in libc$_a..." >&4
8844                 if test "X$d_socket" = "X$define"; then
8845                    echo "...but you seem to believe that you have sockets." >&4
8846                 else
8847                         for net in net socket
8848                         do
8849                                 if test -f /usr/lib/lib$net$_a; then
8850                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8851                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8852                                         if $contains socket libc.list >/dev/null 2>&1; then
8853                                                 d_socket="$define"
8854                                                 socketlib="-l$net"
8855                                                 case "$net" in
8856                                                 net)
8857                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8858                                                         sockethdr="-I/usr/netinclude"
8859                                                         ;;
8860                                                 esac
8861                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8862                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8863                                                         d_oldsock="$undef"
8864                                                 else
8865                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8866                                                         d_oldsock="$define"
8867                                                 fi
8868                                                 break
8869                                         fi
8870                                 fi
8871                         done
8872                         if test "X$d_socket" != "X$define"; then
8873                            echo "or anywhere else I see." >&4
8874                            d_socket="$undef"
8875                            d_oldsock="$undef"
8876                         fi
8877                 fi
8878         fi
8879 fi
8880
8881 : see if socketpair exists
8882 set socketpair d_sockpair
8883 eval $inlibc
8884
8885
8886 echo " "
8887 echo "Checking the availability of certain socket constants..." >& 4
8888 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8889         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8890         $cat >try.c <<EOF
8891 #include <sys/types.h>
8892 #include <sys/socket.h>
8893 int main() {
8894     int i = $ENUM;
8895 }
8896 EOF
8897         val="$undef"
8898         set try; if eval $compile; then
8899                 val="$define"
8900         fi
8901         set d_${enum}; eval $setvar
8902         $rm -f try.c try
8903 done
8904
8905 : see if sys/select.h has to be included
8906 set sys/select.h i_sysselct
8907 eval $inhdr
8908
8909 : see if we should include time.h, sys/time.h, or both
8910 echo " "
8911 if test "X$timeincl" = X; then
8912         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8913         $echo $n "I'm now running the test program...$c"
8914         $cat >try.c <<'EOCP'
8915 #include <sys/types.h>
8916 #ifdef I_TIME
8917 #include <time.h>
8918 #endif
8919 #ifdef I_SYSTIME
8920 #ifdef SYSTIMEKERNEL
8921 #define KERNEL
8922 #endif
8923 #include <sys/time.h>
8924 #endif
8925 #ifdef I_SYSSELECT
8926 #include <sys/select.h>
8927 #endif
8928 int main()
8929 {
8930         struct tm foo;
8931 #ifdef S_TIMEVAL
8932         struct timeval bar;
8933 #endif
8934 #ifdef S_TIMEZONE
8935         struct timezone tzp;
8936 #endif
8937         if (foo.tm_sec == foo.tm_sec)
8938                 exit(0);
8939 #ifdef S_TIMEVAL
8940         if (bar.tv_sec == bar.tv_sec)
8941                 exit(0);
8942 #endif
8943         exit(1);
8944 }
8945 EOCP
8946         flags=''
8947         for s_timezone in '-DS_TIMEZONE' ''; do
8948         sysselect=''
8949         for s_timeval in '-DS_TIMEVAL' ''; do
8950         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8951         for i_time in '' '-DI_TIME'; do
8952         for i_systime in '-DI_SYSTIME' ''; do
8953                 case "$flags" in
8954                 '') $echo $n ".$c"
8955                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8956                         if eval $compile; then
8957                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8958                                 shift
8959                                 flags="$*"
8960                                 echo " "
8961                                 $echo $n "Succeeded with $flags$c"
8962                         fi
8963                         ;;
8964                 esac
8965         done
8966         done
8967         done
8968         done
8969         done
8970         timeincl=''
8971         echo " "
8972         case "$flags" in
8973         *SYSTIMEKERNEL*) i_systimek="$define"
8974                 timeincl=`./findhdr sys/time.h`
8975                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8976         *) i_systimek="$undef";;
8977         esac
8978         case "$flags" in
8979         *I_TIME*) i_time="$define"
8980                 timeincl=`./findhdr time.h`" $timeincl"
8981                 echo "We'll include <time.h>." >&4;;
8982         *) i_time="$undef";;
8983         esac
8984         case "$flags" in
8985         *I_SYSTIME*) i_systime="$define"
8986                 timeincl=`./findhdr sys/time.h`" $timeincl"
8987                 echo "We'll include <sys/time.h>." >&4;;
8988         *) i_systime="$undef";;
8989         esac
8990         $rm -f try.c try
8991 fi
8992
8993 : check for fd_set items
8994 $cat <<EOM
8995
8996 Checking to see how well your C compiler handles fd_set and friends ...
8997 EOM
8998 $cat >fd_set.c <<EOCP
8999 #$i_systime I_SYS_TIME
9000 #$i_sysselct I_SYS_SELECT
9001 #$d_socket HAS_SOCKET
9002 #include <sys/types.h>
9003 #ifdef HAS_SOCKET
9004 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9005 #endif
9006 #ifdef I_SYS_TIME
9007 #include <sys/time.h>
9008 #endif
9009 #ifdef I_SYS_SELECT
9010 #include <sys/select.h>
9011 #endif
9012 int main() {
9013         fd_set fds;
9014
9015 #ifdef TRYBITS
9016         if(fds.fds_bits);
9017 #endif
9018
9019 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9020         exit(0);
9021 #else
9022         exit(1);
9023 #endif
9024 }
9025 EOCP
9026 set fd_set -DTRYBITS
9027 if eval $compile; then
9028         d_fds_bits="$define"
9029         d_fd_set="$define"
9030         echo "Well, your system knows about the normal fd_set typedef..." >&4
9031         if ./fd_set; then
9032                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9033                 d_fd_macros="$define"
9034         else
9035                 $cat >&4 <<'EOM'
9036 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9037 EOM
9038                 d_fd_macros="$undef"
9039         fi
9040 else
9041         $cat <<'EOM'
9042 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9043 EOM
9044         set fd_set
9045         if eval $compile; then
9046                 d_fds_bits="$undef"
9047                 d_fd_set="$define"
9048                 echo "Well, your system has some sort of fd_set available..." >&4
9049                 if ./fd_set; then
9050                         echo "and you have the normal fd_set macros." >&4
9051                         d_fd_macros="$define"
9052                 else
9053                         $cat <<'EOM'
9054 but not the normal fd_set macros!  Gross!  More work for me...
9055 EOM
9056                         d_fd_macros="$undef"
9057                 fi
9058         else
9059         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9060                 d_fd_set="$undef"
9061                 d_fds_bits="$undef"
9062                 d_fd_macros="$undef"
9063         fi
9064 fi
9065 $rm -f fd_set*
9066
9067 : see if fgetpos exists
9068 set fgetpos d_fgetpos
9069 eval $inlibc
9070
9071 : see if flock exists
9072 set flock d_flock
9073 eval $inlibc
9074
9075 : see if fork exists
9076 set fork d_fork
9077 eval $inlibc
9078
9079 : see if pathconf exists
9080 set pathconf d_pathconf
9081 eval $inlibc
9082
9083 : see if fpathconf exists
9084 set fpathconf d_fpathconf
9085 eval $inlibc
9086
9087
9088 : check for fpos64_t
9089 echo " "
9090 echo "Checking to see if you have fpos64_t..." >&4
9091 $cat >try.c <<EOCP
9092 #include <stdio.h>
9093 int main() { fpos64_t x = 7; }
9094 EOCP
9095 set try
9096 if eval $compile; then
9097         val="$define"
9098         echo "You have fpos64_t."
9099 else
9100         val="$undef"
9101         echo "You do not have fpos64_t."
9102         case "$fpossize" in
9103         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9104         esac
9105 fi
9106 $rm -f try.* try
9107 set d_fpos64_t
9108 eval $setvar
9109
9110 : see if frexpl exists
9111 set frexpl d_frexpl
9112 eval $inlibc
9113
9114 hasstruct='varname=$1; struct=$2; shift; shift;
9115 while $test $# -ge 2; do
9116         case "$1" in
9117         $define) echo "#include <$2>";;
9118         esac ;
9119     shift 2;
9120 done > try.c;
9121 echo "int main () { struct $struct foo; }" >> try.c;
9122 set try;
9123 if eval $compile; then
9124         val="$define";
9125 else
9126         val="$undef";
9127 fi;
9128 set $varname;
9129 eval $setvar;
9130 $rm -f try.c try.o'
9131
9132 : see if this is a sys/param system
9133 set sys/param.h i_sysparam
9134 eval $inhdr
9135
9136 : see if this is a sys/mount.h system
9137 set sys/mount.h i_sysmount
9138 eval $inhdr
9139
9140 : see if sys/types.h has to be included
9141 set sys/types.h i_systypes
9142 eval $inhdr
9143
9144
9145 echo " "
9146 echo "Checking to see if your system supports struct fs_data..." >&4
9147 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9148 eval $hasstruct
9149 case "$d_fs_data_s" in
9150 "$define")      echo "Yes, it does."   ;;
9151 *)              echo "No, it doesn't." ;;
9152 esac
9153
9154 : see if fseeko exists
9155 set fseeko d_fseeko
9156 eval $inlibc
9157 case "$longsize" in
9158 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9159 esac
9160
9161 : see if fsetpos exists
9162 set fsetpos d_fsetpos
9163 eval $inlibc
9164
9165
9166 : see if fstatfs exists
9167 set fstatfs d_fstatfs
9168 eval $inlibc
9169
9170
9171 : see if statvfs exists
9172 set statvfs d_statvfs
9173 eval $inlibc
9174
9175 : see if fstatvfs exists
9176 set fstatvfs d_fstatvfs
9177 eval $inlibc
9178
9179
9180 : see if ftello exists
9181 set ftello d_ftello
9182 eval $inlibc
9183 case "$longsize" in
9184 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9185 esac
9186
9187 : see if getcwd exists
9188 set getcwd d_getcwd
9189 eval $inlibc
9190
9191
9192 : see if getfsstat exists
9193 set getfsstat d_getfsstat
9194 eval $inlibc
9195
9196 : see if getgrent exists
9197 set getgrent d_getgrent
9198 eval $inlibc
9199
9200 : see if gethostbyaddr exists
9201 set gethostbyaddr d_gethbyaddr
9202 eval $inlibc
9203
9204 : see if gethostbyname exists
9205 set gethostbyname d_gethbyname
9206 eval $inlibc
9207
9208 : see if gethostent exists
9209 set gethostent d_gethent
9210 eval $inlibc
9211
9212 : see how we will look up host name
9213 echo " "
9214 call=''
9215 if set gethostname val -f d_gethname; eval $csym; $val; then
9216         echo 'gethostname() found.' >&4
9217         d_gethname="$define"
9218         call=gethostname
9219 fi
9220 if set uname val -f d_uname; eval $csym; $val; then
9221         if ./xenix; then
9222                 $cat <<'EOM'
9223 uname() was found, but you're running xenix, and older versions of xenix
9224 have a broken uname(). If you don't really know whether your xenix is old
9225 enough to have a broken system call, use the default answer.
9226
9227 EOM
9228                 dflt=y
9229                 case "$d_uname" in
9230                 "$define") dflt=n;;
9231                 esac
9232                 rp='Is your uname() broken?'
9233                 . ./myread
9234                 case "$ans" in
9235                 n*) d_uname="$define"; call=uname;;
9236                 esac
9237         else
9238                 echo 'uname() found.' >&4
9239                 d_uname="$define"
9240                 case "$call" in
9241                 '') call=uname ;;
9242                 esac
9243         fi
9244 fi
9245 case "$d_gethname" in
9246 '') d_gethname="$undef";;
9247 esac
9248 case "$d_uname" in
9249 '') d_uname="$undef";;
9250 esac
9251 case "$d_uname$d_gethname" in
9252 *define*)
9253         dflt=n
9254         cat <<EOM
9255  
9256 Every now and then someone has a $call() that lies about the hostname
9257 but can't be fixed for political or economic reasons.  If you wish, I can
9258 pretend $call() isn't there and maybe compute hostname at run-time
9259 thanks to the '$phostname' command.
9260
9261 EOM
9262         rp="Shall I ignore $call() from now on?"
9263         . ./myread
9264         case "$ans" in
9265         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9266         esac;;
9267 esac
9268 case "$phostname" in
9269 '') aphostname='';;
9270 *) case "$aphostname" in
9271         /*) ;;
9272         *) set X $phostname
9273                 shift
9274                 file=$1
9275                 shift
9276                 file=`./loc $file $file $pth`
9277                 aphostname=`echo $file $*`
9278                 ;;
9279         esac
9280         ;;
9281 esac
9282 case "$d_uname$d_gethname" in
9283 *define*) ;;
9284 *)
9285         case "$phostname" in
9286         '')
9287                 echo "There will be no way for $package to get your hostname." >&4;;
9288         *)
9289         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9290                 ;;
9291         esac;;
9292 esac
9293 case "$d_phostname" in
9294 '') d_phostname="$undef";;
9295 esac
9296
9297 : see if this is a netdb.h system
9298 set netdb.h i_netdb
9299 eval $inhdr
9300
9301 : see if prototypes for various gethostxxx netdb.h functions are available
9302 echo " "
9303 set d_gethostprotos gethostent $i_netdb netdb.h
9304 eval $hasproto
9305
9306 : see if getlogin exists
9307 set getlogin d_getlogin
9308 eval $inlibc
9309
9310 : see if getmnt exists
9311 set getmnt d_getmnt
9312 eval $inlibc
9313
9314 : see if getmntent exists
9315 set getmntent d_getmntent
9316 eval $inlibc
9317
9318 : see if getnetbyaddr exists
9319 set getnetbyaddr d_getnbyaddr
9320 eval $inlibc
9321
9322 : see if getnetbyname exists
9323 set getnetbyname d_getnbyname
9324 eval $inlibc
9325
9326 : see if getnetent exists
9327 set getnetent d_getnent
9328 eval $inlibc
9329
9330 : see if prototypes for various getnetxxx netdb.h functions are available
9331 echo " "
9332 set d_getnetprotos getnetent $i_netdb netdb.h
9333 eval $hasproto
9334
9335
9336 : see if getprotobyname exists
9337 set getprotobyname d_getpbyname
9338 eval $inlibc
9339
9340 : see if getprotobynumber exists
9341 set getprotobynumber d_getpbynumber
9342 eval $inlibc
9343
9344 : see if getprotoent exists
9345 set getprotoent d_getpent
9346 eval $inlibc
9347
9348 : see if getpgid exists
9349 set getpgid d_getpgid
9350 eval $inlibc
9351
9352 : see if getpgrp2 exists
9353 set getpgrp2 d_getpgrp2
9354 eval $inlibc
9355
9356 : see if getppid exists
9357 set getppid d_getppid
9358 eval $inlibc
9359
9360 : see if getpriority exists
9361 set getpriority d_getprior
9362 eval $inlibc
9363
9364 : see if prototypes for various getprotoxxx netdb.h functions are available
9365 echo " "
9366 set d_getprotoprotos getprotoent $i_netdb netdb.h
9367 eval $hasproto
9368
9369 : see if getpwent exists
9370 set getpwent d_getpwent
9371 eval $inlibc
9372
9373
9374 : see if getservbyname exists
9375 set getservbyname d_getsbyname
9376 eval $inlibc
9377
9378 : see if getservbyport exists
9379 set getservbyport d_getsbyport
9380 eval $inlibc
9381
9382 : see if getservent exists
9383 set getservent d_getsent
9384 eval $inlibc
9385
9386 : see if prototypes for various getservxxx netdb.h functions are available
9387 echo " "
9388 set d_getservprotos getservent $i_netdb netdb.h
9389 eval $hasproto
9390
9391 : see if getspent exists
9392 set getspent d_getspent
9393 eval $inlibc
9394
9395 : see if getspnam exists
9396 set getspnam d_getspnam
9397 eval $inlibc
9398
9399 : see if gettimeofday or ftime exists
9400 set gettimeofday d_gettimeod
9401 eval $inlibc
9402 case "$d_gettimeod" in
9403 "$undef")
9404         set ftime d_ftime 
9405         eval $inlibc
9406         ;;
9407 *)
9408         val="$undef"; set d_ftime; eval $setvar
9409         ;;
9410 esac
9411 case "$d_gettimeod$d_ftime" in
9412 "$undef$undef")
9413         echo " "
9414         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9415         ;;
9416 esac
9417
9418 : see if this is an grp system
9419 set grp.h i_grp
9420 eval $inhdr
9421
9422 case "$i_grp" in
9423 $define)
9424         xxx=`./findhdr grp.h`
9425         $cppstdin $cppflags $cppminus < $xxx >$$.h
9426
9427         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9428                 val="$define"
9429         else
9430                 val="$undef"
9431         fi
9432         set d_grpasswd
9433         eval $setvar
9434
9435         $rm -f $$.h
9436         ;;
9437 *)
9438         val="$undef";
9439         set d_grpasswd; eval $setvar
9440         ;;
9441 esac
9442
9443 : see if hasmntopt exists
9444 set hasmntopt d_hasmntopt
9445 eval $inlibc
9446
9447 : see if this is a netinet/in.h or sys/in.h system
9448 set netinet/in.h i_niin sys/in.h i_sysin
9449 eval $inhdr
9450
9451 : see if arpa/inet.h has to be included
9452 set arpa/inet.h i_arpainet
9453 eval $inhdr
9454
9455 : see if htonl --and friends-- exists
9456 val=''
9457 set htonl val
9458 eval $inlibc
9459
9460 : Maybe they are macros.
9461 case "$val" in
9462 $undef)
9463         $cat >htonl.c <<EOM
9464 #include <stdio.h>
9465 #include <sys/types.h>
9466 #$i_niin I_NETINET_IN
9467 #$i_sysin I_SYS_IN
9468 #$i_arpainet I_ARPA_INET
9469 #ifdef I_NETINET_IN
9470 #include <netinet/in.h>
9471 #endif
9472 #ifdef I_SYS_IN
9473 #include <sys/in.h>
9474 #endif
9475 #ifdef I_ARPA_INET
9476 #include <arpa/inet.h>
9477 #endif
9478 #ifdef htonl
9479 printf("Defined as a macro.");
9480 #endif
9481 EOM
9482         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9483         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9484                 val="$define"
9485                 echo "But it seems to be defined as a macro." >&4
9486         fi
9487         $rm -f htonl.?
9488         ;;
9489 esac
9490 set d_htonl
9491 eval $setvar
9492
9493 : see if iconv exists
9494 set iconv d_iconv
9495 eval $inlibc
9496
9497 : index or strchr
9498 echo " "
9499 if set index val -f; eval $csym; $val; then
9500         if set strchr val -f d_strchr; eval $csym; $val; then
9501                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9502                         val="$define"
9503                         vali="$undef"
9504                         echo "strchr() found." >&4
9505                 else
9506                         val="$undef"
9507                         vali="$define"
9508                         echo "index() found." >&4
9509                 fi
9510         else
9511                 val="$undef"
9512                 vali="$define"
9513                 echo "index() found." >&4
9514         fi
9515 else
9516         if set strchr val -f d_strchr; eval $csym; $val; then
9517                 val="$define"
9518                 vali="$undef"
9519                 echo "strchr() found." >&4
9520         else
9521                 echo "No index() or strchr() found!" >&4
9522                 val="$undef"
9523                 vali="$undef"
9524         fi
9525 fi
9526 set d_strchr; eval $setvar
9527 val="$vali"
9528 set d_index; eval $setvar
9529
9530 : check whether inet_aton exists
9531 set inet_aton d_inetaton
9532 eval $inlibc
9533
9534 : see if inttypes.h is available
9535 : we want a real compile instead of Inhdr because some systems
9536 : have an inttypes.h which includes non-existent headers
9537 echo " "
9538 $cat >try.c <<EOCP
9539 #include <inttypes.h>
9540 int main() {
9541         static int32_t foo32 = 0x12345678;
9542 }
9543 EOCP
9544 set try
9545 if eval $compile; then
9546         echo "<inttypes.h> found." >&4
9547         val="$define"
9548 else
9549         echo "<inttypes.h> NOT found." >&4
9550         val="$undef"
9551 fi
9552 $rm -f try.c try
9553 set i_inttypes
9554 eval $setvar
9555
9556 : check for int64_t
9557 echo " "
9558 echo "Checking to see if you have int64_t..." >&4
9559 $cat >try.c <<EOCP
9560 #include <sys/types.h>
9561 #$i_inttypes I_INTTYPES
9562 #ifdef I_INTTYPES
9563 #include <inttypes.h>
9564 #endif
9565 int main() { int64_t x = 7; }
9566 EOCP
9567 set try
9568 if eval $compile; then
9569         val="$define"
9570         echo "You have int64_t."
9571 else
9572         val="$undef"
9573         echo "You do not have int64_t."
9574 fi
9575 $rm -f try try.*
9576 set d_int64_t
9577 eval $setvar
9578
9579 : Look for isascii
9580 echo " "
9581 $cat >isascii.c <<'EOCP'
9582 #include <stdio.h>
9583 #include <ctype.h>
9584 int main() {
9585         int c = 'A';
9586         if (isascii(c))
9587                 exit(0);
9588         else
9589                 exit(1);
9590 }
9591 EOCP
9592 set isascii
9593 if eval $compile; then
9594         echo "isascii() found." >&4
9595         val="$define"
9596 else
9597         echo "isascii() NOT found." >&4
9598         val="$undef"
9599 fi
9600 set d_isascii
9601 eval $setvar
9602 $rm -f isascii*
9603
9604 : see if isnan exists
9605 set isnan d_isnan
9606 eval $inlibc
9607
9608 : see if isnanl exists
9609 set isnanl d_isnanl
9610 eval $inlibc
9611
9612 : see if killpg exists
9613 set killpg d_killpg
9614 eval $inlibc
9615
9616 : see if lchown exists
9617 echo " "
9618 $cat > try.c <<'EOCP'
9619 /* System header to define __stub macros and hopefully few prototypes,
9620     which can conflict with char lchown(); below.  */
9621 #include <assert.h>
9622 /* Override any gcc2 internal prototype to avoid an error.  */
9623 /* We use char because int might match the return type of a gcc2
9624    builtin and then its argument prototype would still apply.  */
9625 char lchown();
9626 int main() {
9627     /*  The GNU C library defines this for functions which it implements
9628         to always fail with ENOSYS.  Some functions are actually named
9629         something starting with __ and the normal name is an alias.  */
9630 #if defined (__stub_lchown) || defined (__stub___lchown)
9631 choke me
9632 #else
9633 lchown();
9634 #endif
9635 ; return 0; }
9636 EOCP
9637 set try
9638 if eval $compile; then
9639     $echo "lchown() found." >&4
9640     val="$define"
9641 else
9642     $echo "lchown() NOT found." >&4
9643     val="$undef"
9644 fi
9645 set d_lchown
9646 eval $setvar
9647
9648 : See if number of significant digits in a double precision number is known
9649 echo " "
9650 $cat >ldbl_dig.c <<EOM
9651 #$i_limits I_LIMITS
9652 #$i_float I_FLOAT
9653 #ifdef I_LIMITS
9654 #include <limits.h>
9655 #endif
9656 #ifdef I_FLOAT
9657 #include <float.h>
9658 #endif
9659 #ifdef LDBL_DIG
9660 printf("Contains LDBL_DIG");
9661 #endif
9662 EOM
9663 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9664 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9665         echo "LDBL_DIG found." >&4
9666         val="$define"
9667 else
9668         echo "LDBL_DIG NOT found." >&4
9669         val="$undef"
9670 fi
9671 $rm -f ldbl_dig.?
9672 set d_ldbl_dig
9673 eval $setvar
9674
9675 : see if link exists
9676 set link d_link
9677 eval $inlibc
9678
9679 : see if localeconv exists
9680 set localeconv d_locconv
9681 eval $inlibc
9682
9683 : see if lockf exists
9684 set lockf d_lockf
9685 eval $inlibc
9686
9687 : check for long long
9688 echo " "
9689 echo "Checking to see if you have long long..." >&4
9690 echo 'int main() { long long x = 7; return 0; }' > try.c
9691 set try
9692 if eval $compile; then
9693         val="$define"
9694         echo "You have have long long."
9695 else
9696         val="$undef"
9697         echo "You do not have long long."
9698 fi
9699 $rm try.*
9700 set d_longlong
9701 eval $setvar
9702
9703 : check for length of long long
9704 case "${d_longlong}${longlongsize}" in
9705 $define)
9706         echo " "
9707         echo "Checking to see how big your long longs are..." >&4
9708         $cat >try.c <<'EOCP'
9709 #include <stdio.h>
9710 int main()
9711 {
9712     printf("%d\n", (int)sizeof(long long));
9713     return(0);
9714 }
9715 EOCP
9716         set try
9717         if eval $compile_ok; then
9718                 longlongsize=`./try$exe_ext`
9719                 echo "Your long longs are $longlongsize bytes long."
9720         else
9721                 dflt='8'
9722                 echo " "
9723                 echo "(I can't seem to compile the test program.  Guessing...)"
9724                 rp="What is the size of a long long (in bytes)?"
9725                 . ./myread
9726                 longlongsize="$ans"
9727         fi
9728         if $test "X$longsize" = "X$longlongsize"; then
9729                 echo "(That isn't any different from an ordinary long.)"
9730         fi      
9731         ;;
9732 esac
9733 $rm -f try.* try
9734
9735 : see if prototype for lseek is available
9736 echo " "
9737 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9738 eval $hasproto
9739
9740 : see if lstat exists
9741 set lstat d_lstat
9742 eval $inlibc
9743
9744 : see if madvise exists
9745 set madvise d_madvise
9746 eval $inlibc
9747
9748 : see if mblen exists
9749 set mblen d_mblen
9750 eval $inlibc
9751
9752 : see if mbstowcs exists
9753 set mbstowcs d_mbstowcs
9754 eval $inlibc
9755
9756 : see if mbtowc exists
9757 set mbtowc d_mbtowc
9758 eval $inlibc
9759
9760 : see if memchr exists
9761 set memchr d_memchr
9762 eval $inlibc
9763
9764 : see if memcmp exists
9765 set memcmp d_memcmp
9766 eval $inlibc
9767
9768 : see if memcpy exists
9769 set memcpy d_memcpy
9770 eval $inlibc
9771
9772 : see if memmove exists
9773 set memmove d_memmove
9774 eval $inlibc
9775
9776 : see if memset exists
9777 set memset d_memset
9778 eval $inlibc
9779
9780 : see if mkdir exists
9781 set mkdir d_mkdir
9782 eval $inlibc
9783
9784 : see if mkdtemp exists
9785 set mkdtemp d_mkdtemp
9786 eval $inlibc
9787
9788 : see if mkfifo exists
9789 set mkfifo d_mkfifo
9790 eval $inlibc
9791
9792 : see if mkstemp exists
9793 set mkstemp d_mkstemp
9794 eval $inlibc
9795
9796 : see if mkstemps exists
9797 set mkstemps d_mkstemps
9798 eval $inlibc
9799
9800 : see if mktime exists
9801 set mktime d_mktime
9802 eval $inlibc
9803
9804 : see if this is a sys/mman.h system
9805 set sys/mman.h i_sysmman
9806 eval $inhdr
9807
9808 : see if mmap exists
9809 set mmap d_mmap
9810 eval $inlibc
9811 : see what shmat returns
9812 : default to something harmless
9813 mmaptype='void *'
9814 case "$i_sysmman$d_mmap" in
9815 "$define$define")
9816         $cat >mmap.c <<'END'
9817 #include <sys/mman.h>
9818 void *mmap();
9819 END
9820         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9821                 mmaptype='void *'
9822         else
9823                 mmaptype='caddr_t'
9824         fi
9825         echo "and it returns ($mmaptype)." >&4
9826         ;;
9827 esac
9828
9829
9830
9831 : see if modfl exists
9832 set modfl d_modfl
9833 eval $inlibc
9834
9835 : see if mprotect exists
9836 set mprotect d_mprotect
9837 eval $inlibc
9838
9839 : see if msgctl exists
9840 set msgctl d_msgctl
9841 eval $inlibc
9842
9843 : see if msgget exists
9844 set msgget d_msgget
9845 eval $inlibc
9846
9847 : see if msgsnd exists
9848 set msgsnd d_msgsnd
9849 eval $inlibc
9850
9851 : see if msgrcv exists
9852 set msgrcv d_msgrcv
9853 eval $inlibc
9854
9855 : see how much of the 'msg*(2)' library is present.
9856 h_msg=true
9857 echo " "
9858 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9859 *"$undef"*) h_msg=false;;
9860 esac
9861 case "$osname" in
9862 freebsd)
9863     case "`ipcs 2>&1`" in
9864     "SVID messages"*"not configured"*)
9865         echo "Your $osname does not have the msg*(2) configured." >&4
9866         h_msg=false
9867         val="$undef"
9868         set msgctl d_msgctl
9869         eval $setvar
9870         set msgget d_msgget
9871         eval $setvar
9872         set msgsnd d_msgsnd
9873         eval $setvar
9874         set msgrcv d_msgrcv
9875         eval $setvar
9876         ;;
9877     esac
9878     ;;
9879 esac
9880 : we could also check for sys/ipc.h ...
9881 if $h_msg && $test `./findhdr sys/msg.h`; then
9882         echo "You have the full msg*(2) library." >&4
9883         val="$define"
9884 else
9885         echo "You don't have the full msg*(2) library." >&4
9886         val="$undef"
9887 fi
9888 set d_msg
9889 eval $setvar
9890
9891 : see if msync exists
9892 set msync d_msync
9893 eval $inlibc
9894
9895 : see if munmap exists
9896 set munmap d_munmap
9897 eval $inlibc
9898
9899 : see if nice exists
9900 set nice d_nice
9901 eval $inlibc
9902
9903
9904 echo " "
9905 echo "Checking which 64-bit integer type we could use..." >&4
9906
9907 case "$intsize" in
9908 8) val=int
9909    set quadtype
9910    eval $setvar
9911    val='"unsigned int"'
9912    set uquadtype
9913    eval $setvar
9914    quadkind=1
9915    ;;
9916 *) case "$longsize" in
9917    8) val=long
9918       set quadtype
9919       eval $setvar
9920       val='"unsigned long"'
9921       set uquadtype
9922       eval $setvar
9923       quadkind=2
9924       ;;
9925    *) case "$d_longlong:$longlongsize" in
9926       define:8)
9927         val='"long long"'
9928         set quadtype
9929         eval $setvar
9930         val='"unsigned long long"'
9931         set uquadtype
9932         eval $setvar
9933         quadkind=3
9934         ;;
9935       *) case "$d_int64_t" in
9936          define)
9937            val=int64_t
9938            set quadtype
9939            eval $setvar
9940            val=uint64_t
9941            set uquadtype
9942            eval $setvar
9943            quadkind=4
9944            ;;
9945          esac
9946          ;;
9947       esac
9948       ;;
9949    esac
9950    ;;
9951 esac
9952
9953 case "$quadtype" in
9954 '')     echo "Alas, no 64-bit integer types in sight." >&4
9955         d_quad="$undef"
9956         ;;
9957 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
9958             verb="will"
9959         else
9960             verb="could"
9961         fi
9962         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9963         d_quad="$define"
9964         ;;
9965 esac
9966
9967 : check for length of character
9968 echo " "
9969 case "$charsize" in
9970 '')
9971         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9972         $cat >try.c <<'EOCP'
9973 #include <stdio.h>
9974 int main()
9975 {
9976     printf("%d\n", (int)sizeof(char));
9977     exit(0);
9978 }
9979 EOCP
9980         set try
9981         if eval $compile_ok; then
9982                 dflt=`./try`
9983         else
9984                 dflt='1'
9985                 echo "(I can't seem to compile the test program.  Guessing...)"
9986         fi
9987         ;;
9988 *)
9989         dflt="$charsize"
9990         ;;
9991 esac
9992 rp="What is the size of a character (in bytes)?"
9993 . ./myread
9994 charsize="$ans"
9995 $rm -f try.c try
9996
9997
9998 echo " "
9999 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10000
10001 case "$use64bitint:$d_quad:$quadtype" in
10002 define:define:?*)
10003         ivtype="$quadtype"
10004         uvtype="$uquadtype"
10005         ivsize=8
10006         uvsize=8
10007         ;;
10008 *)      ivtype="long"
10009         uvtype="unsigned long"
10010         ivsize=$longsize
10011         uvsize=$longsize
10012         ;;
10013 esac
10014
10015 case "$uselongdouble:$d_longdbl" in
10016 define:define)
10017         nvtype="long double"
10018         nvsize=$longdblsize
10019         ;;
10020 *)      nvtype=double
10021         nvsize=$doublesize
10022         ;;
10023 esac
10024
10025 $echo "(IV will be "$ivtype", $ivsize bytes)"
10026 $echo "(UV will be "$uvtype", $uvsize bytes)"
10027 $echo "(NV will be "$nvtype", $nvsize bytes)"
10028
10029 $cat >try.c <<EOCP
10030 #$i_inttypes I_INTTYPES
10031 #ifdef I_INTTYPES
10032 #include <inttypes.h>
10033 #endif
10034 #include <stdio.h>
10035 int main() {
10036 #ifdef INT8
10037    int8_t i =  INT8_MAX;
10038   uint8_t u = UINT8_MAX;
10039   printf("int8_t\n");
10040 #endif
10041 #ifdef INT16
10042    int16_t i =  INT16_MAX;
10043   uint16_t i = UINT16_MAX;
10044   printf("int16_t\n");
10045 #endif
10046 #ifdef INT32
10047    int32_t i =  INT32_MAX;
10048   uint32_t u = UINT32_MAX;
10049   printf("int32_t\n");
10050 #endif
10051 }
10052 EOCP
10053
10054 case "$i8type" in
10055 '')     case "$charsize" in
10056         1)      i8type=char
10057                 u8type="unsigned char"
10058                 i8size=$charsize
10059                 u8size=$charsize
10060                 ;;
10061         esac
10062         ;;
10063 esac
10064 case "$i8type" in
10065 '')     set try -DINT8
10066         if eval $compile; then
10067                 case "`./try$exe_ext`" in
10068                 int8_t) i8type=int8_t
10069                         u8type=uint8_t
10070                         i8size=1
10071                         u8size=1
10072                         ;;
10073                 esac
10074         fi
10075         ;;
10076 esac
10077 case "$i8type" in
10078 '')     if $test $charsize -ge 1; then
10079                 i8type=char
10080                 u8type="unsigned char"
10081                 i8size=$charsize
10082                 u8size=$charsize
10083         fi
10084         ;;
10085 esac
10086
10087 case "$i16type" in
10088 '')     case "$shortsize" in
10089         2)      i16type=short
10090                 u16type="unsigned short"
10091                 i16size=$shortsize
10092                 u16size=$shortsize
10093                 ;;
10094         esac
10095         ;;
10096 esac
10097 case "$i16type" in
10098 '')     set try -DINT16
10099         if eval $compile; then
10100                 case "`./try$exe_ext`" in
10101                 int16_t)
10102                         i16type=int16_t
10103                         u16type=uint16_t
10104                         i16size=2
10105                         u16size=2
10106                         ;;
10107                 esac
10108         fi
10109         ;;
10110 esac
10111 case "$i16type" in
10112 '')     if $test $shortsize -ge 2; then
10113                 i16type=short
10114                 u16type="unsigned short"
10115                 i16size=$shortsize
10116                 u16size=$shortsize
10117         fi
10118         ;;
10119 esac
10120
10121 case "$i32type" in
10122 '')     case "$longsize" in
10123         4)      i32type=long
10124                 u32type="unsigned long"
10125                 i32size=$longsize
10126                 u32size=$longsize
10127                 ;;
10128         *)      case "$intsize" in
10129                 4)      i32type=int
10130                         u32type="unsigned int"
10131                         i32size=$intsize
10132                         u32size=$intsize
10133                         ;;
10134                 esac
10135                 ;;
10136         esac
10137         ;;
10138 esac
10139 case "$i32type" in
10140 '')     set try -DINT32
10141         if eval $compile; then
10142                 case "`./try$exe_ext`" in
10143                 int32_t)
10144                         i32type=int32_t
10145                         u32type=uint32_t
10146                         i32size=4
10147                         u32size=4
10148                         ;;
10149                 esac
10150         fi
10151         ;;
10152 esac
10153 case "$i32type" in
10154 '')     if $test $intsize -ge 4; then
10155                 i32type=int
10156                 u32type="unsigned int"
10157                 i32size=$intsize
10158                 u32size=$intsize
10159         fi
10160         ;;
10161 esac
10162
10163 case "$i64type" in
10164 '')     case "$d_quad:$quadtype" in
10165         define:?*)
10166                 i64type="$quadtype"
10167                 u64type="$uquadtype"
10168                 i64size=8
10169                 u64size=8
10170                 ;;
10171         esac
10172         ;;
10173 esac
10174
10175 $echo "Checking whether your NVs can preserve your UVs..." >&4
10176 $cat <<EOP >try.c
10177 #include <stdio.h>
10178 int main() {
10179     $uvtype k = ($uvtype)~0, l;
10180     $nvtype d;
10181     l = k;
10182     d = ($nvtype)l;
10183     l = ($uvtype)d;
10184     if (l == k)
10185        printf("preserve\n");
10186     exit(0);
10187 }
10188 EOP
10189 set try
10190 if eval $compile; then
10191         case "`./try$exe_ext`" in
10192         preserve) d_nv_preserves_uv="$define" ;;
10193         esac
10194 fi      
10195 case "$d_nv_preserves_uv" in
10196 $define) $echo "Yes, they can."  2>&1 ;;
10197 *)       $echo "No, they can't." 2>&1
10198          d_nv_preserves_uv="$undef"
10199          ;;
10200 esac
10201
10202 $rm -f try.* try
10203
10204
10205 : check for off64_t
10206 echo " "
10207 echo "Checking to see if you have off64_t..." >&4
10208 $cat >try.c <<EOCP
10209 #include <sys/types.h>
10210 #include <unistd.h>
10211 int main() { off64_t x = 7; }
10212 EOCP
10213 set try
10214 if eval $compile; then
10215         val="$define"
10216         echo "You have off64_t."
10217 else
10218         val="$undef"
10219         echo "You do not have off64_t."
10220         case "$lseeksize" in
10221         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10222         esac
10223 fi
10224 $rm -f try.* try
10225 set d_off64_t
10226 eval $setvar
10227
10228 : see if POSIX threads are available
10229 set pthread.h i_pthread
10230 eval $inhdr
10231
10232
10233
10234
10235 : how to create joinable pthreads
10236 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10237         echo " "
10238         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10239         $cat >try.c <<'EOCP'
10240 #include <pthread.h>
10241 int main() {
10242     int detachstate = JOINABLE;
10243 }
10244 EOCP
10245         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10246         if eval $compile; then
10247                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10248                 val="$undef" # Yes, undef.
10249                 set d_old_pthread_create_joinable
10250                 eval $setvar
10251                 val=""
10252                 set old_pthread_create_joinable
10253                 eval $setvar
10254         else
10255                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10256                 if eval $compile; then
10257                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10258                         val="$define"
10259                         set d_old_pthread_create_joinable
10260                         eval $setvar
10261                         val=PTHREAD_CREATE_UNDETACHED
10262                         set old_pthread_create_joinable
10263                         eval $setvar
10264                 else            
10265                         set try -DJOINABLE=__UNDETACHED
10266                         if eval $compile; then
10267                                 echo "You seem to use __UNDETACHED." >&4
10268                                 val="$define"
10269                                 set d_old_pthread_create_joinable
10270                                 eval $setvar
10271                                 val=__UNDETACHED
10272                                 set old_pthread_create_joinable
10273                                 eval $setvar
10274                         else
10275                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10276                                 val="$define"
10277                                 set d_old_pthread_create_joinable
10278                                 eval $setvar
10279                                 val=0
10280                                 set old_pthread_create_joinable
10281                                 eval $setvar
10282                         fi
10283                 fi
10284         fi
10285         $rm -f try try.*
10286 else
10287     d_old_pthread_create_joinable="$undef"
10288     old_pthread_create_joinable=""
10289 fi
10290
10291 : see if pause exists
10292 set pause d_pause
10293 eval $inlibc
10294
10295 : see if pipe exists
10296 set pipe d_pipe
10297 eval $inlibc
10298
10299 : see if poll exists
10300 set poll d_poll
10301 eval $inlibc
10302
10303
10304 : see whether the various POSIXish _yields exist
10305 $cat >try.c <<EOP
10306 #include <pthread.h>
10307 #include <stdio.h>
10308 int main() {
10309 #ifdef SCHED_YIELD
10310         sched_yield();
10311 #else
10312 #ifdef PTHREAD_YIELD
10313         pthread_yield();
10314 #else
10315 #ifdef PTHREAD_YIELD_NULL
10316         pthread_yield(NULL);
10317 #endif
10318 #endif
10319 #endif
10320 }
10321 EOP
10322 : see if sched_yield exists
10323 set try -DSCHED_YIELD
10324 if eval $compile; then
10325     val="$define"
10326     sched_yield='sched_yield()'
10327 else
10328     val="$undef"
10329 fi
10330 case "$usethreads" in
10331 $define)
10332         case "$val" in
10333         $define) echo 'sched_yield() found.' >&4        ;;
10334         *)       echo 'sched_yield() NOT found.' >&4    ;;
10335         esac
10336 esac
10337 set d_sched_yield
10338 eval $setvar
10339
10340 : see if pthread_yield exists
10341 set try -DPTHREAD_YIELD
10342 if eval $compile; then
10343     val="$define"
10344     case "$sched_yield" in
10345     '') sched_yield='pthread_yield()' ;;
10346     esac
10347 else
10348     set try -DPTHREAD_YIELD_NULL
10349     if eval $compile; then
10350         val="$define"
10351         case "$sched_yield" in
10352         '') sched_yield='pthread_yield(NULL)' ;;
10353         esac
10354     else
10355         val="$undef"
10356     fi
10357 fi
10358 case "$usethreads" in
10359 $define)
10360         case "$val" in
10361         $define) echo 'pthread_yield() found.' >&4      ;;
10362         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10363         esac
10364         ;;
10365 esac
10366 set d_pthread_yield
10367 eval $setvar
10368
10369 case "$sched_yield" in
10370 '') sched_yield=undef ;;
10371 esac
10372
10373 $rm -f try try.*
10374
10375 : see if this is a pwd.h system
10376 set pwd.h i_pwd
10377 eval $inhdr
10378
10379 case "$i_pwd" in
10380 $define)
10381         xxx=`./findhdr pwd.h`
10382         $cppstdin $cppflags $cppminus < $xxx >$$.h
10383
10384         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10385                 val="$define"
10386         else
10387                 val="$undef"
10388         fi
10389         set d_pwquota
10390         eval $setvar
10391
10392         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10393                 val="$define"
10394         else
10395                 val="$undef"
10396         fi
10397         set d_pwage
10398         eval $setvar
10399
10400         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10401                 val="$define"
10402         else
10403                 val="$undef"
10404         fi
10405         set d_pwchange
10406         eval $setvar
10407
10408         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10409                 val="$define"
10410         else
10411                 val="$undef"
10412         fi
10413         set d_pwclass
10414         eval $setvar
10415
10416         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10417                 val="$define"
10418         else
10419                 val="$undef"
10420         fi
10421         set d_pwexpire
10422         eval $setvar
10423
10424         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10425                 val="$define"
10426         else
10427                 val="$undef"
10428         fi
10429         set d_pwcomment
10430         eval $setvar
10431
10432         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10433                 val="$define"
10434         else
10435                 val="$undef"
10436         fi
10437         set d_pwgecos
10438         eval $setvar
10439
10440         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10441                 val="$define"
10442         else
10443                 val="$undef"
10444         fi
10445         set d_pwpasswd
10446         eval $setvar
10447
10448         $rm -f $$.h
10449         ;;
10450 *)
10451         val="$undef"; 
10452         set d_pwquota; eval $setvar
10453         set d_pwage; eval $setvar
10454         set d_pwchange; eval $setvar
10455         set d_pwclass; eval $setvar
10456         set d_pwexpire; eval $setvar
10457         set d_pwcomment; eval $setvar
10458         set d_pwgecos; eval $setvar
10459         set d_pwpasswd; eval $setvar
10460         ;;
10461 esac
10462
10463 : see if readdir and friends exist
10464 set readdir d_readdir
10465 eval $inlibc
10466 set seekdir d_seekdir
10467 eval $inlibc
10468 set telldir d_telldir
10469 eval $inlibc
10470 set rewinddir d_rewinddir
10471 eval $inlibc
10472
10473 : see if readlink exists
10474 set readlink d_readlink
10475 eval $inlibc
10476
10477 : see if rename exists
10478 set rename d_rename
10479 eval $inlibc
10480
10481 : see if rmdir exists
10482 set rmdir d_rmdir
10483 eval $inlibc
10484
10485 : see if memory.h is available.
10486 val=''
10487 set memory.h val
10488 eval $inhdr
10489
10490 : See if it conflicts with string.h
10491 case "$val" in
10492 $define)
10493         case "$strings" in
10494         '') ;;
10495         *)
10496                 $cppstdin $cppflags $cppminus < $strings > mem.h
10497                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10498                         echo " "
10499                         echo "We won't be including <memory.h>."
10500                         val="$undef"
10501                 fi
10502                 $rm -f mem.h
10503                 ;;
10504         esac
10505 esac
10506 set i_memory
10507 eval $setvar
10508
10509 : can bcopy handle overlapping blocks?
10510 val="$undef"
10511 case "$d_bcopy" in
10512 "$define")
10513         echo " "
10514         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10515         $cat >try.c <<EOCP
10516 #$i_memory I_MEMORY
10517 #$i_stdlib I_STDLIB
10518 #$i_string I_STRING
10519 #$i_unistd I_UNISTD
10520 EOCP
10521         $cat >>try.c <<'EOCP'
10522 #include <stdio.h>
10523 #ifdef I_MEMORY
10524 #  include <memory.h>
10525 #endif
10526 #ifdef I_STDLIB
10527 #  include <stdlib.h>
10528 #endif
10529 #ifdef I_STRING
10530 #  include <string.h>
10531 #else
10532 #  include <strings.h>
10533 #endif
10534 #ifdef I_UNISTD
10535 #  include <unistd.h>  /* Needed for NetBSD */
10536 #endif
10537 int main()
10538 {
10539 char buf[128], abc[128];
10540 char *b;
10541 int len;
10542 int off;
10543 int align;
10544
10545 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10546
10547 for (align = 7; align >= 0; align--) {
10548         for (len = 36; len; len--) {
10549                 b = buf+align;
10550                 bcopy(abc, b, len);
10551                 for (off = 1; off <= len; off++) {
10552                         bcopy(b, b+off, len);
10553                         bcopy(b+off, b, len);
10554                         if (bcmp(b, abc, len))
10555                                 exit(1);
10556                 }
10557         }
10558 }
10559 exit(0);
10560 }
10561 EOCP
10562         set try
10563         if eval $compile_ok; then
10564                 if ./try 2>/dev/null; then
10565                         echo "Yes, it can."
10566                         val="$define"
10567                 else
10568                         echo "It can't, sorry."
10569                         case "$d_memmove" in
10570                         "$define") echo "But that's Ok since you have memmove()." ;;
10571                         esac
10572                 fi
10573         else
10574                 echo "(I can't compile the test program, so we'll assume not...)"
10575                 case "$d_memmove" in
10576                 "$define") echo "But that's Ok since you have memmove()." ;;
10577                 esac
10578         fi
10579         ;;
10580 esac
10581 $rm -f try.* try core
10582 set d_safebcpy
10583 eval $setvar
10584
10585 : can memcpy handle overlapping blocks?
10586 val="$undef"
10587 case "$d_memcpy" in
10588 "$define")
10589         echo " "
10590         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10591         $cat >try.c <<EOCP
10592 #$i_memory I_MEMORY
10593 #$i_stdlib I_STDLIB
10594 #$i_string I_STRING
10595 #$i_unistd I_UNISTD
10596 EOCP
10597         $cat >>try.c <<'EOCP'
10598 #include <stdio.h>
10599 #ifdef I_MEMORY
10600 #  include <memory.h>
10601 #endif
10602 #ifdef I_STDLIB
10603 #  include <stdlib.h>
10604 #endif
10605 #ifdef I_STRING
10606 #  include <string.h>
10607 #else
10608 #  include <strings.h>
10609 #endif
10610 #ifdef I_UNISTD
10611 #  include <unistd.h>  /* Needed for NetBSD */
10612 #endif
10613 int main()
10614 {
10615 char buf[128], abc[128];
10616 char *b;
10617 int len;
10618 int off;
10619 int align;
10620
10621 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10622    try to store the string in read-only memory. */
10623 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10624
10625 for (align = 7; align >= 0; align--) {
10626         for (len = 36; len; len--) {
10627                 b = buf+align;
10628                 memcpy(b, abc, len);
10629                 for (off = 1; off <= len; off++) {
10630                         memcpy(b+off, b, len);
10631                         memcpy(b, b+off, len);
10632                         if (memcmp(b, abc, len))
10633                                 exit(1);
10634                 }
10635         }
10636 }
10637 exit(0);
10638 }
10639 EOCP
10640         set try
10641         if eval $compile_ok; then
10642                 if ./try 2>/dev/null; then
10643                         echo "Yes, it can."
10644                         val="$define"
10645                 else
10646                         echo "It can't, sorry."
10647                         case "$d_memmove" in
10648                         "$define") echo "But that's Ok since you have memmove()." ;;
10649                         esac
10650                 fi
10651         else
10652                 echo "(I can't compile the test program, so we'll assume not...)"
10653                 case "$d_memmove" in
10654                 "$define") echo "But that's Ok since you have memmove()." ;;
10655                 esac
10656         fi
10657         ;;
10658 esac
10659 $rm -f try.* try core
10660 set d_safemcpy
10661 eval $setvar
10662
10663 : can memcmp be trusted to compare relative magnitude?
10664 val="$undef"
10665 case "$d_memcmp" in
10666 "$define")
10667         echo " "
10668         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10669         $cat >try.c <<EOCP
10670 #$i_memory I_MEMORY
10671 #$i_stdlib I_STDLIB
10672 #$i_string I_STRING
10673 #$i_unistd I_UNISTD
10674 EOCP
10675         $cat >>try.c <<'EOCP'
10676 #include <stdio.h>
10677 #ifdef I_MEMORY
10678 #  include <memory.h>
10679 #endif
10680 #ifdef I_STDLIB
10681 #  include <stdlib.h>
10682 #endif
10683 #ifdef I_STRING
10684 #  include <string.h>
10685 #else
10686 #  include <strings.h>
10687 #endif
10688 #ifdef I_UNISTD
10689 #  include <unistd.h>  /* Needed for NetBSD */
10690 #endif
10691 int main()
10692 {
10693 char a = -1;
10694 char b = 0;
10695 if ((a < b) && memcmp(&a, &b, 1) < 0)
10696         exit(1);
10697 exit(0);
10698 }
10699 EOCP
10700         set try
10701         if eval $compile_ok; then
10702                 if ./try 2>/dev/null; then
10703                         echo "Yes, it can."
10704                         val="$define"
10705                 else
10706                         echo "No, it can't (it uses signed chars)."
10707                 fi
10708         else
10709                 echo "(I can't compile the test program, so we'll assume not...)"
10710         fi
10711         ;;
10712 esac
10713 $rm -f try.* try core
10714 set d_sanemcmp
10715 eval $setvar
10716
10717 : see if select exists
10718 set select d_select
10719 eval $inlibc
10720
10721 : see if semctl exists
10722 set semctl d_semctl
10723 eval $inlibc
10724
10725 : see if semget exists
10726 set semget d_semget
10727 eval $inlibc
10728
10729 : see if semop exists
10730 set semop d_semop
10731 eval $inlibc
10732
10733 : see how much of the 'sem*(2)' library is present.
10734 h_sem=true
10735 echo " "
10736 case "$d_semctl$d_semget$d_semop" in
10737 *"$undef"*) h_sem=false;;
10738 esac
10739 case "$osname" in
10740 freebsd)
10741     case "`ipcs 2>&1`" in
10742     "SVID messages"*"not configured"*)
10743         echo "Your $osname does not have the sem*(2) configured." >&4
10744         h_sem=false
10745         val="$undef"
10746         set semctl d_semctl
10747         eval $setvar
10748         set semget d_semget
10749         eval $setvar
10750         set semop d_semop
10751         eval $setvar
10752         ;;
10753     esac
10754     ;;
10755 esac
10756 : we could also check for sys/ipc.h ...
10757 if $h_sem && $test `./findhdr sys/sem.h`; then
10758         echo "You have the full sem*(2) library." >&4
10759         val="$define"
10760 else
10761         echo "You don't have the full sem*(2) library." >&4
10762         val="$undef"
10763 fi
10764 set d_sem
10765 eval $setvar
10766
10767 : see whether sys/sem.h defines union semun
10768 echo " "
10769 $cat > try.c <<'END'
10770 #include <sys/types.h>
10771 #include <sys/ipc.h>
10772 #include <sys/sem.h>
10773 int main () { union semun semun; semun.buf = 0; }
10774 END
10775 set try
10776 if eval $compile; then
10777     echo "You have union semun in <sys/sem.h>." >&4
10778     val="$define"
10779 else
10780     echo "You do not have union semun in <sys/sem.h>." >&4
10781     val="$undef"
10782 fi
10783 $rm -f try try.c try.h
10784 set d_union_semun
10785 eval $setvar
10786
10787 : see how to do semctl IPC_STAT
10788 case "$d_sem" in
10789 $define)
10790     : see whether semctl IPC_STAT can use union semun
10791     echo " "
10792     $cat > try.h <<END
10793 #ifndef S_IRUSR
10794 #   ifdef S_IREAD
10795 #       define S_IRUSR S_IREAD
10796 #       define S_IWUSR S_IWRITE
10797 #       define S_IXUSR S_IEXEC
10798 #   else
10799 #       define S_IRUSR 0400
10800 #       define S_IWUSR 0200
10801 #       define S_IXUSR 0100
10802 #   endif
10803 #   define S_IRGRP (S_IRUSR>>3)
10804 #   define S_IWGRP (S_IWUSR>>3)
10805 #   define S_IXGRP (S_IXUSR>>3)
10806 #   define S_IROTH (S_IRUSR>>6)
10807 #   define S_IWOTH (S_IWUSR>>6)
10808 #   define S_IXOTH (S_IXUSR>>6)
10809 #endif
10810 #ifndef S_IRWXU
10811 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10812 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10813 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10814 #endif
10815 END
10816
10817     $cat > try.c <<END
10818 #include <sys/types.h>
10819 #include <sys/ipc.h>
10820 #include <sys/sem.h>
10821 #include <sys/stat.h>
10822 #include <stdio.h>
10823 #include <errno.h>
10824 #include "try.h"
10825 #ifndef errno
10826 extern int errno;
10827 #endif
10828 #$d_union_semun HAS_UNION_SEMUN
10829 int main() {
10830     union semun
10831 #ifndef HAS_UNION_SEMUN
10832     {
10833         int val;
10834         struct semid_ds *buf;
10835         unsigned short *array;
10836     }
10837 #endif
10838     arg;
10839     int sem, st;
10840
10841 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10842     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10843     if (sem > -1) {
10844         struct semid_ds argbuf;
10845         arg.buf = &argbuf;
10846 #       ifdef IPC_STAT
10847         st = semctl(sem, 0, IPC_STAT, arg);
10848         if (st == 0)
10849             printf("semun\n");
10850         else
10851 #       endif /* IPC_STAT */
10852             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10853 #       ifdef IPC_RMID
10854         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10855 #       endif /* IPC_RMID */
10856             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10857     } else
10858 #endif /* IPC_PRIVATE && ... */
10859         printf("semget failed: errno = %d\n", errno);
10860   return 0;
10861 }
10862 END
10863     val="$undef"
10864     set try
10865     if eval $compile; then
10866         xxx=`./try`
10867         case "$xxx" in
10868         semun) val="$define" ;;
10869         esac
10870     fi
10871     $rm -f try try.c
10872     set d_semctl_semun
10873     eval $setvar
10874     case "$d_semctl_semun" in
10875     $define)
10876         echo "You can use union semun for semctl IPC_STAT." >&4
10877         also='also'
10878         ;;
10879     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10880         also=''
10881         ;;
10882     esac
10883
10884     : see whether semctl IPC_STAT can use struct semid_ds pointer
10885     $cat > try.c <<'END'
10886 #include <sys/types.h>
10887 #include <sys/ipc.h>
10888 #include <sys/sem.h>
10889 #include <sys/stat.h>
10890 #include "try.h"
10891 #include <stdio.h>
10892 #include <errno.h>
10893 #ifndef errno
10894 extern int errno;
10895 #endif
10896 int main() {
10897     struct semid_ds arg;
10898     int sem, st;
10899
10900 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10901     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10902     if (sem > -1) {
10903 #       ifdef IPC_STAT
10904         st = semctl(sem, 0, IPC_STAT, &arg);
10905         if (st == 0)
10906             printf("semid_ds\n");
10907         else
10908 #       endif /* IPC_STAT */
10909             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10910 #       ifdef IPC_RMID
10911         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10912 #       endif /* IPC_RMID */
10913             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10914     } else
10915 #endif /* IPC_PRIVATE && ... */
10916         printf("semget failed: errno = %d\n", errno);
10917
10918     return 0;
10919 }
10920 END
10921     val="$undef"
10922     set try
10923     if eval $compile; then
10924         xxx=`./try`
10925         case "$xxx" in
10926         semid_ds) val="$define" ;;
10927         esac
10928     fi
10929     $rm -f try try.c
10930     set d_semctl_semid_ds
10931     eval $setvar
10932     case "$d_semctl_semid_ds" in
10933     $define)
10934         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10935         ;;
10936     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10937         ;;
10938     esac
10939     $rm -f try.h
10940     ;;
10941 *)  val="$undef"
10942
10943     # We do not have the full sem*(2) library, so assume we can not
10944     # use either.
10945
10946     set d_semctl_semun
10947     eval $setvar
10948
10949     set d_semctl_semid_ds
10950     eval $setvar
10951     ;;
10952 esac
10953
10954 : see if setegid exists
10955 set setegid d_setegid
10956 eval $inlibc
10957
10958 : see if seteuid exists
10959 set seteuid d_seteuid
10960 eval $inlibc
10961
10962 : see if setgrent exists
10963 set setgrent d_setgrent
10964 eval $inlibc
10965
10966 : see if sethostent exists
10967 set sethostent d_sethent
10968 eval $inlibc
10969
10970 : see if setlinebuf exists
10971 set setlinebuf d_setlinebuf
10972 eval $inlibc
10973
10974 : see if setlocale exists
10975 set setlocale d_setlocale
10976 eval $inlibc
10977
10978 : see if setnetent exists
10979 set setnetent d_setnent
10980 eval $inlibc
10981
10982 : see if setprotoent exists
10983 set setprotoent d_setpent
10984 eval $inlibc
10985
10986 : see if setpgid exists
10987 set setpgid d_setpgid
10988 eval $inlibc
10989
10990 : see if setpgrp2 exists
10991 set setpgrp2 d_setpgrp2
10992 eval $inlibc
10993
10994 : see if setpriority exists
10995 set setpriority d_setprior
10996 eval $inlibc
10997
10998 : see if setpwent exists
10999 set setpwent d_setpwent
11000 eval $inlibc
11001
11002 : see if setregid exists
11003 set setregid d_setregid
11004 eval $inlibc
11005 set setresgid d_setresgid
11006 eval $inlibc
11007
11008 : see if setreuid exists
11009 set setreuid d_setreuid
11010 eval $inlibc
11011 set setresuid d_setresuid
11012 eval $inlibc
11013
11014 : see if setrgid exists
11015 set setrgid d_setrgid
11016 eval $inlibc
11017
11018 : see if setruid exists
11019 set setruid d_setruid
11020 eval $inlibc
11021
11022 : see if setservent exists
11023 set setservent d_setsent
11024 eval $inlibc
11025
11026 : see if setsid exists
11027 set setsid d_setsid
11028 eval $inlibc
11029
11030 : see if setspent exists
11031 set setspent d_setspent
11032 eval $inlibc
11033
11034 : see if setvbuf exists
11035 set setvbuf d_setvbuf
11036 eval $inlibc
11037
11038 : see if sfio.h is available
11039 set sfio.h i_sfio
11040 eval $inhdr
11041
11042
11043 : see if sfio library is available
11044 case "$i_sfio" in
11045 $define)
11046         val=''
11047         set sfreserve val
11048         eval $inlibc
11049         ;;
11050 *)
11051         val="$undef"
11052         ;;
11053 esac
11054 : Ok, but do we want to use it.
11055 case "$val" in
11056 $define)
11057         case "$usesfio" in
11058         true|$define|[yY]*) dflt='y';;
11059         *) dflt='n';;
11060         esac
11061         echo "$package can use the sfio library, but it is experimental."
11062         rp="You seem to have sfio available, do you want to try using it?"
11063         . ./myread
11064         case "$ans" in
11065         y|Y) ;;
11066         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11067                 val="$undef"
11068                 : Remove sfio from list of libraries to use
11069                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11070                 shift
11071                 libs="$*"
11072                 echo "libs = $libs" >&4
11073                 ;;
11074         esac
11075         ;;
11076 *)      case "$usesfio" in
11077         true|$define|[yY]*)
11078                 echo "Sorry, cannot find sfio on this machine" >&4
11079                 echo "Ignoring your setting of usesfio=$usesfio" >&4
11080                 ;;
11081         esac
11082         ;;
11083 esac
11084 set d_sfio
11085 eval $setvar
11086 case "$d_sfio" in
11087 $define) usesfio='true';;
11088 *) usesfio='false';;
11089 esac
11090
11091 : see if shmctl exists
11092 set shmctl d_shmctl
11093 eval $inlibc
11094
11095 : see if shmget exists
11096 set shmget d_shmget
11097 eval $inlibc
11098
11099 : see if shmat exists
11100 set shmat d_shmat
11101 eval $inlibc
11102 : see what shmat returns
11103 case "$d_shmat" in
11104 "$define")
11105         $cat >shmat.c <<'END'
11106 #include <sys/shm.h>
11107 void *shmat();
11108 END
11109         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11110                 shmattype='void *'
11111         else
11112                 shmattype='char *'
11113         fi
11114         echo "and it returns ($shmattype)." >&4
11115         : see if a prototype for shmat is available
11116         xxx=`./findhdr sys/shm.h`
11117         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11118         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11119                 val="$define"
11120         else
11121                 val="$undef"
11122         fi
11123         $rm -f shmat.[co]
11124         ;;
11125 *)
11126         val="$undef"
11127         ;;
11128 esac
11129 set d_shmatprototype
11130 eval $setvar
11131
11132 : see if shmdt exists
11133 set shmdt d_shmdt
11134 eval $inlibc
11135
11136 : see how much of the 'shm*(2)' library is present.
11137 h_shm=true
11138 echo " "
11139 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11140 *"$undef"*) h_shm=false;;
11141 esac
11142 case "$osname" in
11143 freebsd)
11144     case "`ipcs 2>&1`" in
11145     "SVID shared memory"*"not configured"*)
11146         echo "Your $osname does not have the shm*(2) configured." >&4
11147         h_shm=false
11148         val="$undef"
11149         set shmctl d_shmctl
11150         evat $setvar
11151         set shmget d_shmget
11152         evat $setvar
11153         set shmat d_shmat
11154         evat $setvar
11155         set shmdt d_shmdt
11156         evat $setvar
11157         ;;
11158     esac
11159     ;;
11160 esac
11161 : we could also check for sys/ipc.h ...
11162 if $h_shm && $test `./findhdr sys/shm.h`; then
11163         echo "You have the full shm*(2) library." >&4
11164         val="$define"
11165 else
11166         echo "You don't have the full shm*(2) library." >&4
11167         val="$undef"
11168 fi
11169 set d_shm
11170 eval $setvar
11171
11172 echo " "
11173 : see if we have sigaction
11174 if set sigaction val -f d_sigaction; eval $csym; $val; then
11175         echo 'sigaction() found.' >&4
11176         $cat > try.c <<'EOP'
11177 #include <stdio.h>
11178 #include <sys/types.h>
11179 #include <signal.h>
11180 int main()
11181 {
11182     struct sigaction act, oact;
11183     act.sa_flags = 0;
11184     oact.sa_handler = 0;
11185     /* so that act and oact are used */
11186     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11187 }
11188 EOP
11189         set try
11190         if eval $compile_ok; then
11191                 val="$define"
11192         else
11193                 echo "But you don't seem to have a useable struct sigaction." >&4
11194                 val="$undef"
11195         fi
11196 else
11197         echo 'sigaction NOT found.' >&4
11198         val="$undef"
11199 fi
11200 set d_sigaction; eval $setvar
11201 $rm -f try try$_o try.c
11202
11203 : see if sigsetjmp exists
11204 echo " "
11205 case "$d_sigsetjmp" in
11206 '')
11207         $cat >try.c <<'EOP'
11208 #include <setjmp.h>
11209 sigjmp_buf env;
11210 int set = 1;
11211 int main()
11212 {
11213         if (sigsetjmp(env,1))
11214                 exit(set);
11215         set = 0;
11216         siglongjmp(env, 1);
11217         exit(1);
11218 }
11219 EOP
11220         set try
11221         if eval $compile; then
11222                 if ./try >/dev/null 2>&1; then
11223                         echo "POSIX sigsetjmp found." >&4
11224                         val="$define"
11225                 else
11226                         $cat >&4 <<EOM
11227 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11228 I'll ignore them.
11229 EOM
11230                         val="$undef"
11231                 fi
11232         else
11233                 echo "sigsetjmp not found." >&4
11234                 val="$undef"
11235         fi
11236         ;;
11237 *) val="$d_sigsetjmp"
11238         case "$d_sigsetjmp" in
11239         $define) echo "POSIX sigsetjmp found." >&4;;
11240         $undef) echo "sigsetjmp not found." >&4;;
11241         esac
11242         ;;
11243 esac
11244 set d_sigsetjmp
11245 eval $setvar
11246 $rm -f try.c try
11247
11248 : see if sys/stat.h is available
11249 set sys/stat.h i_sysstat
11250 eval $inhdr
11251
11252
11253 : see if stat knows about block sizes
11254 echo " "
11255 echo "Checking to see if your struct stat has st_blocks field..." >&4
11256 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11257 eval $hasfield
11258
11259
11260 : see if this is a sys/vfs.h system
11261 set sys/vfs.h i_sysvfs
11262 eval $inhdr
11263
11264
11265 : see if this is a sys/statfs.h system
11266 set sys/statfs.h i_sysstatfs
11267 eval $inhdr
11268
11269
11270 echo " "
11271 echo "Checking to see if your system supports struct statfs..." >&4
11272 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
11273 eval $hasstruct
11274 case "$d_statfs_s" in
11275 "$define")      echo "Yes, it does."   ;;
11276 *)              echo "No, it doesn't." ;;
11277 esac
11278
11279
11280
11281 : see if struct statfs knows about f_flags
11282 case "$d_statfs_s" in
11283 define) 
11284         echo " "
11285         echo "Checking to see if your struct statfs has f_flags field..." >&4
11286         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
11287         eval $hasfield
11288         ;;
11289 *)      val="$undef"
11290         set d_statfs_f_flags
11291         eval $setvar
11292         ;;
11293 esac
11294 case "$d_statfs_f_flags" in
11295 "$define")      echo "Yes, it does."   ;;
11296 *)              echo "No, it doesn't." ;;
11297 esac
11298
11299 : see if _ptr and _cnt from stdio act std
11300 echo " "
11301 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11302         echo "(Looks like you have stdio.h from Linux.)"
11303         case "$stdio_ptr" in
11304         '') stdio_ptr='((fp)->_IO_read_ptr)'
11305                 ptr_lval=$define
11306                 ;;
11307         *)      ptr_lval=$d_stdio_ptr_lval;;
11308         esac
11309         case "$stdio_cnt" in
11310         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11311                 cnt_lval=$undef
11312                 ;;
11313         *)      cnt_lval=$d_stdio_cnt_lval;;
11314         esac
11315         case "$stdio_base" in
11316         '') stdio_base='((fp)->_IO_read_base)';;
11317         esac
11318         case "$stdio_bufsiz" in
11319         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11320         esac
11321 else
11322         case "$stdio_ptr" in
11323         '') stdio_ptr='((fp)->_ptr)'
11324                 ptr_lval=$define
11325                 ;;
11326         *)      ptr_lval=$d_stdio_ptr_lval;;
11327         esac
11328         case "$stdio_cnt" in
11329         '') stdio_cnt='((fp)->_cnt)'
11330                 cnt_lval=$define
11331                 ;;
11332         *)      cnt_lval=$d_stdio_cnt_lval;;
11333         esac
11334         case "$stdio_base" in
11335         '') stdio_base='((fp)->_base)';;
11336         esac
11337         case "$stdio_bufsiz" in
11338         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11339         esac
11340 fi
11341 : test whether _ptr and _cnt really work
11342 echo "Checking how std your stdio is..." >&4
11343 $cat >try.c <<EOP
11344 #include <stdio.h>
11345 #define FILE_ptr(fp)    $stdio_ptr
11346 #define FILE_cnt(fp)    $stdio_cnt
11347 int main() {
11348         FILE *fp = fopen("try.c", "r");
11349         char c = getc(fp);
11350         if (
11351                 18 <= FILE_cnt(fp) &&
11352                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11353         )
11354                 exit(0);
11355         exit(1);
11356 }
11357 EOP
11358 val="$undef"
11359 set try
11360 if eval $compile; then
11361         if ./try; then
11362                 echo "Your stdio acts pretty std."
11363                 val="$define"
11364         else
11365                 echo "Your stdio isn't very std."
11366         fi
11367 else
11368         echo "Your stdio doesn't appear very std."
11369 fi
11370 $rm -f try.c try
11371 set d_stdstdio
11372 eval $setvar
11373
11374 : Can _ptr be used as an lvalue?
11375 case "$d_stdstdio$ptr_lval" in
11376 $define$define) val=$define ;;
11377 *) val=$undef ;;
11378 esac
11379 set d_stdio_ptr_lval
11380 eval $setvar
11381
11382 : Can _cnt be used as an lvalue?
11383 case "$d_stdstdio$cnt_lval" in
11384 $define$define) val=$define ;;
11385 *) val=$undef ;;
11386 esac
11387 set d_stdio_cnt_lval
11388 eval $setvar
11389
11390 : see if _base is also standard
11391 val="$undef"
11392 case "$d_stdstdio" in
11393 $define)
11394         $cat >try.c <<EOP
11395 #include <stdio.h>
11396 #define FILE_base(fp)   $stdio_base
11397 #define FILE_bufsiz(fp) $stdio_bufsiz
11398 int main() {
11399         FILE *fp = fopen("try.c", "r");
11400         char c = getc(fp);
11401         if (
11402                 19 <= FILE_bufsiz(fp) &&
11403                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11404         )
11405                 exit(0);
11406         exit(1);
11407 }
11408 EOP
11409         set try
11410         if eval $compile; then
11411                 if ./try; then
11412                         echo "And its _base field acts std."
11413                         val="$define"
11414                 else
11415                         echo "But its _base field isn't std."
11416                 fi
11417         else
11418                 echo "However, it seems to be lacking the _base field."
11419         fi
11420         $rm -f try.c try
11421         ;;
11422 esac
11423 set d_stdiobase
11424 eval $setvar
11425
11426 $cat >&4 <<EOM
11427 Checking how to access stdio streams by file descriptor number...
11428 EOM
11429 case "$stdio_stream_array" in
11430 '')     $cat >try.c <<EOCP
11431 #include <stdio.h>
11432 int main() {
11433   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11434     printf("yes\n");
11435 }
11436 EOCP
11437         for s in _iob __iob __sF
11438         do
11439                 set try -DSTDIO_STREAM_ARRAY=$s
11440                 if eval $compile; then
11441                         case "`./try$exe_ext`" in
11442                         yes)    stdio_stream_array=$s; break ;;
11443                         esac
11444                 fi
11445         done
11446         $rm -f try.* try$exe_ext
11447 esac
11448 case "$stdio_stream_array" in
11449 '')     $cat >&4 <<EOM
11450 I can't figure out how to access stdio streams by file descriptor number.
11451 EOM
11452         d_stdio_stream_array="$undef"
11453         ;;
11454 *)      $cat >&4 <<EOM
11455 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11456 EOM
11457         d_stdio_stream_array="$define"
11458         ;;
11459 esac
11460
11461 : see if strcoll exists
11462 set strcoll d_strcoll
11463 eval $inlibc
11464
11465 : check for structure copying
11466 echo " "
11467 echo "Checking to see if your C compiler can copy structs..." >&4
11468 $cat >try.c <<'EOCP'
11469 int main()
11470 {
11471         struct blurfl {
11472                 int dyick;
11473         } foo, bar;
11474
11475         foo = bar;
11476 }
11477 EOCP
11478 if $cc -c try.c >/dev/null 2>&1 ; then
11479         val="$define"
11480         echo "Yup, it can."
11481 else
11482         val="$undef"
11483         echo "Nope, it can't."
11484 fi
11485 set d_strctcpy
11486 eval $setvar
11487 $rm -f try.*
11488
11489 : see if strerror and/or sys_errlist[] exist
11490 echo " "
11491 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11492     if set strerror val -f d_strerror; eval $csym; $val; then
11493                 echo 'strerror() found.' >&4
11494                 d_strerror="$define"
11495                 d_strerrm='strerror(e)'
11496                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11497                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11498                         d_syserrlst="$define"
11499                 else
11500                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11501                         d_syserrlst="$undef"
11502                 fi
11503     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11504                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11505                 echo 'strerror() found in string header.' >&4
11506                 d_strerror="$define"
11507                 d_strerrm='strerror(e)'
11508                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11509                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11510                                 d_syserrlst="$define"
11511                 else
11512                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11513                         d_syserrlst="$undef"
11514                 fi
11515     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11516                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11517                 d_strerror="$undef"
11518                 d_syserrlst="$define"
11519                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11520     else
11521                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11522                 d_strerror="$undef"
11523                 d_syserrlst="$undef"
11524                 d_strerrm='"unknown"'
11525     fi
11526 fi
11527
11528 : see if strtod exists
11529 set strtod d_strtod
11530 eval $inlibc
11531
11532 : see if strtol exists
11533 set strtol d_strtol
11534 eval $inlibc
11535
11536 : see if strtold exists
11537 set strtold d_strtold
11538 eval $inlibc
11539
11540 : see if strtoll exists
11541 set strtoll d_strtoll
11542 eval $inlibc
11543
11544 case "$d_longlong-$d_strtoll" in
11545 "$define-$define")
11546         $cat <<EOM
11547 Checking whether your strtoll() works okay...
11548 EOM
11549         $cat >try.c <<'EOCP'
11550 #include <errno.h>
11551 #ifdef __hpux
11552 #define strtoll __strtoll
11553 #endif
11554 #include <stdio.h>
11555 extern long long int strtoll(char *s, char **, int); 
11556 static int bad = 0;
11557 int check(char *s, long long ell, int een) {
11558         long long gll;
11559         errno = 0;
11560         gll = strtoll(s, 0, 10);
11561         if (!((gll == ell) && (errno == een)))
11562                 bad++;
11563 }
11564 int main() {
11565         check(" 1",                                      1LL, 0);
11566         check(" 0",                                      0LL, 0);
11567         check("-1",                                     -1LL, 0);
11568         check("-9223372036854775808", -9223372036854775808LL, 0);
11569         check("-9223372036854775808", -9223372036854775808LL, 0);
11570         check(" 9223372036854775807",  9223372036854775807LL, 0);
11571         check("-9223372036854775808", -9223372036854775808LL, 0);
11572         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11573         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11574         if (!bad)
11575                 printf("ok\n");
11576 }
11577 EOCP
11578         set try
11579         if eval $compile; then
11580                 case "`./try`" in
11581                 ok) echo "Your strtoll() seems to be working okay." ;;
11582                 *) cat <<EOM >&4
11583 Your strtoll() doesn't seem to be working okay.
11584 EOM
11585                    d_strtoll="$undef"
11586                    ;;
11587                 esac
11588         fi
11589         ;;
11590 esac
11591
11592 : see if strtoul exists
11593 set strtoul d_strtoul
11594 eval $inlibc
11595
11596 : see if strtoull exists
11597 set strtoull d_strtoull
11598 eval $inlibc
11599
11600 case "$d_longlong-$d_strtoull" in
11601 "$define-$define")
11602         $cat <<EOM
11603 Checking whether your strtoull() works okay...
11604 EOM
11605         $cat >try.c <<'EOCP'
11606 #include <errno.h>
11607 #ifdef __hpux
11608 #define strtoull __strtoull
11609 #endif
11610 #include <stdio.h>
11611 extern unsigned long long int strtoull(char *s, char **, int); 
11612 static int bad = 0;
11613 int check(char *s, long long eull, int een) {
11614         long long gull;
11615         errno = 0;
11616         gull = strtoull(s, 0, 10);
11617         if (!((gull == eull) && (errno == een)))
11618                 bad++;
11619 }
11620 int main() {
11621         check(" 1",                                       1LL, 0);
11622         check(" 0",                                       0LL, 0);
11623         check("18446744073709551615", 18446744073709551615ULL, 0);
11624         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11625         if (!bad)
11626                 printf("ok\n");
11627 }
11628 EOCP
11629         set try
11630         if eval $compile; then
11631                 case "`./try`" in
11632                 ok) echo "Your strtoull() seems to be working okay." ;;
11633                 *) cat <<EOM >&4
11634 Your strtoull() doesn't seem to be working okay.
11635 EOM
11636                    d_strtoull="$undef"
11637                    ;;
11638                 esac
11639         fi
11640         ;;
11641 esac
11642
11643 : see if strtouq exists
11644 set strtouq d_strtouq
11645 eval $inlibc
11646
11647 : see if strxfrm exists
11648 set strxfrm d_strxfrm
11649 eval $inlibc
11650
11651 : see if symlink exists
11652 set symlink d_symlink
11653 eval $inlibc
11654
11655 : see if syscall exists
11656 set syscall d_syscall
11657 eval $inlibc
11658
11659 : see if sysconf exists
11660 set sysconf d_sysconf
11661 eval $inlibc
11662
11663 : see if system exists
11664 set system d_system
11665 eval $inlibc
11666
11667 : see if tcgetpgrp exists
11668 set tcgetpgrp d_tcgetpgrp
11669 eval $inlibc
11670
11671 : see if tcsetpgrp exists
11672 set tcsetpgrp d_tcsetpgrp
11673 eval $inlibc
11674
11675 : see if prototype for telldir is available
11676 echo " "
11677 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11678 eval $hasproto
11679
11680 : see if this is a sys/times.h system
11681 set sys/times.h i_systimes
11682 eval $inhdr
11683
11684 : see if times exists
11685 echo " "
11686 if set times val -f d_times; eval $csym; $val; then
11687         echo 'times() found.' >&4
11688         d_times="$define"
11689         inc=''
11690         case "$i_systimes" in
11691         "$define") inc='sys/times.h';;
11692         esac
11693         rp="What is the type returned by times() on this system?"
11694         set clock_t clocktype long stdio.h sys/types.h $inc
11695         eval $typedef_ask
11696 else
11697         echo 'times() NOT found, hope that will do.' >&4
11698         d_times="$undef"
11699         clocktype='int'
11700 fi
11701
11702 : see if truncate exists
11703 set truncate d_truncate
11704 eval $inlibc
11705
11706 : see if tzname[] exists
11707 echo " "
11708 if set tzname val -a d_tzname; eval $csym; $val; then
11709         val="$define"
11710         echo 'tzname[] found.' >&4
11711 else
11712         val="$undef"
11713         echo 'tzname[] NOT found.' >&4
11714 fi
11715 set d_tzname
11716 eval $setvar
11717
11718 : see if umask exists
11719 set umask d_umask
11720 eval $inlibc
11721
11722 : see if ustat exists
11723 set ustat d_ustat
11724 eval $inlibc
11725
11726 : backward compatibility for d_hvfork
11727 if test X$d_hvfork != X; then
11728         d_vfork="$d_hvfork"
11729         d_hvfork=''
11730 fi
11731 : see if there is a vfork
11732 val=''
11733 set vfork val
11734 eval $inlibc
11735
11736 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11737 : perl on Solaris 2.x, and probably elsewhere.
11738 case "$val" in
11739 $define)
11740         echo " "
11741         case "$usevfork" in
11742         false) dflt='n';;
11743         *) dflt='y';;
11744         esac
11745         cat <<'EOM'
11746  
11747 Perl can only use a vfork() that doesn't suffer from strict
11748 restrictions on calling functions or modifying global data in
11749 the child.  For example, glibc-2.1 contains such a vfork()
11750 that is unsuitable.  If your system provides a proper fork()
11751 call, chances are that you do NOT want perl to use vfork().
11752
11753 EOM
11754         rp="Do you still want to use vfork()?"
11755         . ./myread
11756         case "$ans" in
11757         y|Y) ;;
11758         *)
11759                 echo "Ok, we won't use vfork()."
11760                 val="$undef"
11761                 ;;
11762         esac
11763         ;;
11764 esac
11765 set d_vfork
11766 eval $setvar
11767 case "$d_vfork" in
11768 $define) usevfork='true';;
11769 *) usevfork='false';;
11770 esac
11771
11772 : see if this is an sysdir system
11773 set sys/dir.h i_sysdir
11774 eval $inhdr
11775
11776 : see if this is an sysndir system
11777 set sys/ndir.h i_sysndir
11778 eval $inhdr
11779
11780 : see if closedir exists
11781 set closedir d_closedir
11782 eval $inlibc
11783
11784 case "$d_closedir" in
11785 "$define")
11786         echo " "
11787         echo "Checking whether closedir() returns a status..." >&4
11788         cat > closedir.c <<EOM
11789 #$i_dirent I_DIRENT             /**/
11790 #$i_sysdir I_SYS_DIR            /**/
11791 #$i_sysndir I_SYS_NDIR          /**/
11792 #$i_systypes I_SYS_TYPES        /**/
11793
11794 #if defined(I_SYS_TYPES)
11795 #include <sys/types.h>
11796 #endif
11797 #if defined(I_DIRENT)
11798 #include <dirent.h>
11799 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11800 #include <sys/dir.h>
11801 #endif
11802 #else
11803 #ifdef I_SYS_NDIR
11804 #include <sys/ndir.h>
11805 #else
11806 #ifdef I_SYS_DIR
11807 #ifdef hp9000s500
11808 #include <ndir.h>       /* may be wrong in the future */
11809 #else
11810 #include <sys/dir.h>
11811 #endif
11812 #endif
11813 #endif
11814 #endif 
11815 int main() { return closedir(opendir(".")); }
11816 EOM
11817         set closedir
11818         if eval $compile_ok; then
11819                 if ./closedir > /dev/null 2>&1 ; then
11820                         echo "Yes, it does."
11821                         val="$undef"
11822                 else
11823                         echo "No, it doesn't."
11824                         val="$define"
11825                 fi
11826         else
11827                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11828                 val="$define"
11829         fi
11830         ;;
11831 *)
11832         val="$undef";
11833         ;;
11834 esac
11835 set d_void_closedir
11836 eval $setvar
11837 $rm -f closedir*
11838 : check for volatile keyword
11839 echo " "
11840 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11841 $cat >try.c <<'EOCP'
11842 int main()
11843 {
11844         typedef struct _goo_struct goo_struct;
11845         goo_struct * volatile goo = ((goo_struct *)0);
11846         struct _goo_struct {
11847                 long long_int;
11848                 int reg_int;
11849                 char char_var;
11850         };
11851         typedef unsigned short foo_t;
11852         char *volatile foo;
11853         volatile int bar;
11854         volatile foo_t blech;
11855         foo = foo;
11856 }
11857 EOCP
11858 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11859         val="$define"
11860         echo "Yup, it does."
11861 else
11862         val="$undef"
11863         echo "Nope, it doesn't."
11864 fi
11865 set d_volatile
11866 eval $setvar
11867 $rm -f try.*
11868
11869 : see if there is a wait4
11870 set wait4 d_wait4
11871 eval $inlibc
11872
11873 : see if waitpid exists
11874 set waitpid d_waitpid
11875 eval $inlibc
11876
11877 : see if wcstombs exists
11878 set wcstombs d_wcstombs
11879 eval $inlibc
11880
11881 : see if wctomb exists
11882 set wctomb d_wctomb
11883 eval $inlibc
11884
11885 : preserve RCS keywords in files with variable substitution, grrr
11886 Date='$Date'
11887 Id='$Id'
11888 Log='$Log'
11889 RCSfile='$RCSfile'
11890 Revision='$Revision'
11891
11892 case "$crosscompile" in
11893 ''|[nN]*) crosscompile="$undef" ;;
11894 esac
11895
11896 case "$osname" in
11897 next|rhapsody|darwin) multiarch="$define" ;;
11898 esac
11899 case "$multiarch" in
11900 ''|[nN]*) multiarch="$undef" ;;
11901 esac
11902
11903 : check for alignment requirements
11904 echo " "
11905 case "$crosscompile$multiarch" in
11906 *$define*)
11907         $cat <<EOM
11908 You seem to be either cross-compiling or doing a multiarchitecture build,
11909 skipping the memory alignment check.
11910
11911 EOM
11912         case "$alignbytes" in
11913         '') alignbytes=8 ;;
11914         esac
11915         ;;
11916 *)
11917         case "$alignbytes" in
11918         '') echo "Checking alignment constraints..." >&4
11919                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11920                         $cat >try.c <<'EOCP'
11921 typedef long double NV;
11922 EOCP
11923                 else
11924                         $cat >try.c <<'EOCP'
11925 typedef double NV;
11926 EOCP
11927                 fi
11928                 $cat >>try.c <<'EOCP'
11929 #include <stdio.h>
11930 struct foobar {
11931         char foo;
11932         NV bar;
11933 } try_algn;
11934 int main()
11935 {
11936     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11937     return(0);
11938 }
11939 EOCP
11940                 set try
11941                 if eval $compile_ok; then
11942                         dflt=`./try`
11943                 else
11944                         dflt='8'
11945                         echo "(I can't seem to compile the test program...)"
11946                 fi
11947                 ;;
11948         *) dflt="$alignbytes"
11949                 ;;
11950         esac
11951         rp="Doubles must be aligned on a how-many-byte boundary?"
11952         . ./myread
11953         alignbytes="$ans"
11954         $rm -f try.c try
11955         ;;
11956 esac
11957
11958
11959 : set the base revision
11960 baserev=5.0
11961
11962 : check for ordering of bytes in a long
11963 echo " "
11964 case "$crosscompile$multiarch" in
11965 *$define*)
11966         $cat <<EOM
11967 You seem to be either cross-compiling or doing a multiarchitecture build,
11968 skipping the byteorder check.
11969
11970 EOM
11971         byteorder='0xffff'
11972         ;;
11973 *)
11974         case "$byteorder" in
11975         '')
11976                 $cat <<'EOM'
11977 In the following, larger digits indicate more significance.  A big-endian
11978 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11979 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11980 machines may have weird orders like 3412.  A Cray will report 87654321,
11981 an Alpha will report 12345678. If the test program works the default is
11982 probably right.
11983 I'm now running the test program...
11984 EOM
11985                 $cat >try.c <<'EOCP'
11986 #include <stdio.h>
11987 int main()
11988 {
11989         int i;
11990         union {
11991                 unsigned long l;
11992                 char c[sizeof(long)];
11993         } u;
11994
11995         if (sizeof(long) > 4)
11996                 u.l = (0x08070605L << 32) | 0x04030201L;
11997         else
11998                 u.l = 0x04030201L;
11999         for (i = 0; i < sizeof(long); i++)
12000                 printf("%c", u.c[i]+'0');
12001         printf("\n");
12002         exit(0);
12003 }
12004 EOCP
12005                 xxx_prompt=y
12006                 set try
12007                 if eval $compile && ./try > /dev/null; then
12008                         dflt=`./try`
12009                         case "$dflt" in
12010                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12011                                 echo "(The test program ran ok.)"
12012                                 echo "byteorder=$dflt"
12013                                 xxx_prompt=n
12014                         ;;
12015                         ????|????????) echo "(The test program ran ok.)" ;;
12016                         *) echo "(The test program didn't run right for some reason.)" ;;
12017                         esac
12018                 else
12019                         dflt='4321'
12020                         cat <<'EOM'
12021 (I can't seem to compile the test program.  Guessing big-endian...)
12022 EOM
12023                 fi
12024                 case "$xxx_prompt" in
12025                 y)
12026                         rp="What is the order of bytes in a long?"
12027                         . ./myread
12028                         byteorder="$ans"
12029                         ;;
12030                 *)      byteorder=$dflt
12031                         ;;
12032                 esac
12033                 ;;
12034         esac
12035         $rm -f try.c try
12036         ;;
12037 esac
12038
12039
12040 : how do we catenate cpp tokens here?
12041 echo " "
12042 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12043 $cat >cpp_stuff.c <<'EOCP'
12044 #define RCAT(a,b)a/**/b
12045 #define ACAT(a,b)a ## b
12046 RCAT(Rei,ser)
12047 ACAT(Cir,cus)
12048 EOCP
12049 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12050 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12051         echo "Oh!  Smells like ANSI's been here." >&4
12052         echo "We can catify or stringify, separately or together!"
12053         cpp_stuff=42
12054 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12055         echo "Ah, yes!  The good old days!" >&4
12056         echo "However, in the good old days we don't know how to stringify and"
12057         echo "catify at the same time."
12058         cpp_stuff=1
12059 else
12060         $cat >&4 <<EOM
12061 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12062 to have to edit the values of CAT[2-5] in config.h...
12063 EOM
12064         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12065 fi
12066 $rm -f cpp_stuff.*
12067
12068 : see if this is a db.h system
12069 set db.h i_db
12070 eval $inhdr
12071
12072 case "$i_db" in
12073 $define)
12074         : Check db version.
12075         echo " "
12076         echo "Checking Berkeley DB version ..." >&4
12077         $cat >try.c <<EOCP
12078 #$d_const HASCONST
12079 #ifndef HASCONST
12080 #define const
12081 #endif
12082 #include <sys/types.h>
12083 #include <stdio.h>
12084 #include <db.h>
12085 int main()
12086 {
12087 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12088     int Major, Minor, Patch ;
12089     unsigned long Version ;
12090     (void)db_version(&Major, &Minor, &Patch) ;
12091     printf("You have Berkeley DB Version 2 or greater\n");
12092
12093     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12094                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12095     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12096                 Major, Minor, Patch) ;
12097
12098     /* check that db.h & libdb are compatible */
12099     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12100         printf("db.h and libdb are incompatible\n") ;
12101         exit(3);        
12102     }
12103
12104     printf("db.h and libdb are compatible\n") ;
12105
12106     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12107                 + DB_VERSION_PATCH ;
12108
12109     /* needs to be >= 2.3.4 */
12110     if (Version < 2003004) {
12111     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12112         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12113         exit(2);        
12114     }
12115
12116     exit(0);
12117 #else
12118 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12119     printf("You have Berkeley DB Version 1\n");
12120     exit(0);    /* DB version < 2: the coast is clear. */
12121 #else
12122     exit(1);    /* <db.h> not Berkeley DB? */
12123 #endif
12124 #endif
12125 }
12126 EOCP
12127         set try
12128         if eval $compile_ok && ./try; then
12129                 echo 'Looks OK.' >&4
12130         else
12131                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12132                 i_db=$undef
12133                 case " $libs " in
12134                 *"-ldb "*)
12135                         : Remove db from list of libraries to use
12136                         echo "Removing unusable -ldb from library list" >&4
12137                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12138                         shift
12139                         libs="$*"
12140                         echo "libs = $libs" >&4
12141                         ;;
12142                 esac
12143         fi
12144         $rm -f try.*
12145         ;;
12146 esac
12147
12148 case "$i_db" in
12149 define)
12150         : Check the return type needed for hash 
12151         echo " "
12152         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12153         $cat >try.c <<EOCP
12154 #$d_const HASCONST
12155 #ifndef HASCONST
12156 #define const
12157 #endif
12158 #include <sys/types.h>
12159 #include <db.h>
12160
12161 #ifndef DB_VERSION_MAJOR
12162 u_int32_t hash_cb (ptr, size)
12163 const void *ptr;
12164 size_t size;
12165 {
12166 }
12167 HASHINFO info;
12168 int main()
12169 {
12170         info.hash = hash_cb;
12171 }
12172 #endif
12173 EOCP
12174         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12175                 if $contains warning try.out >>/dev/null 2>&1 ; then
12176                         db_hashtype='int'
12177                 else
12178                         db_hashtype='u_int32_t'
12179                 fi
12180         else
12181                 : XXX Maybe we should just give up here.
12182                 db_hashtype=u_int32_t
12183                 $cat try.out >&4
12184                 echo "Help:  I can't seem to compile the db test program." >&4
12185                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12186         fi
12187         $rm -f try.*
12188         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12189         ;;
12190 *)      db_hashtype=u_int32_t
12191         ;;
12192 esac
12193 case "$i_db" in
12194 define)
12195         : Check the return type needed for prefix 
12196         echo " "
12197         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12198         cat >try.c <<EOCP
12199 #$d_const HASCONST
12200 #ifndef HASCONST
12201 #define const
12202 #endif
12203 #include <sys/types.h>
12204 #include <db.h>
12205
12206 #ifndef DB_VERSION_MAJOR
12207 size_t prefix_cb (key1, key2)
12208 const DBT *key1;
12209 const DBT *key2;
12210 {
12211 }
12212 BTREEINFO info;
12213 int main()
12214 {
12215         info.prefix = prefix_cb;
12216 }
12217 #endif
12218 EOCP
12219         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12220                 if $contains warning try.out >>/dev/null 2>&1 ; then
12221                         db_prefixtype='int'
12222                 else
12223                         db_prefixtype='size_t'
12224                 fi
12225         else
12226                 db_prefixtype='size_t'
12227                 : XXX Maybe we should just give up here.
12228                 $cat try.out >&4
12229                 echo "Help:  I can't seem to compile the db test program." >&4
12230                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12231         fi
12232         $rm -f try.*
12233         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12234         ;;
12235 *)      db_prefixtype='size_t'
12236         ;;
12237 esac
12238
12239 : check for void type
12240 echo " "
12241 echo "Checking to see how well your C compiler groks the void type..." >&4
12242 case "$voidflags" in
12243 '')
12244         $cat >try.c <<'EOCP'
12245 #if TRY & 1
12246 void sub() {
12247 #else
12248 sub() {
12249 #endif
12250         extern void moo();      /* function returning void */
12251         void (*goo)();          /* ptr to func returning void */
12252 #if TRY & 8
12253         void *hue;              /* generic ptr */
12254 #endif
12255 #if TRY & 2
12256         void (*foo[10])();
12257 #endif
12258
12259 #if TRY & 4
12260         if(goo == moo) {
12261                 exit(0);
12262         }
12263 #endif
12264         exit(0);
12265 }
12266 int main() { sub(); }
12267 EOCP
12268         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12269                 voidflags=$defvoidused
12270         echo "Good.  It appears to support void to the level $package wants.">&4
12271                 if $contains warning .out >/dev/null 2>&1; then
12272                         echo "However, you might get some warnings that look like this:"
12273                         $cat .out
12274                 fi
12275         else
12276 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12277                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12278                         echo "It supports 1..."
12279                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12280                                 echo "It also supports 2..."
12281                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12282                                         voidflags=7
12283                                         echo "And it supports 4 but not 8 definitely."
12284                                 else
12285                                         echo "It doesn't support 4..."
12286                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12287                                                 voidflags=11
12288                                                 echo "But it supports 8."
12289                                         else
12290                                                 voidflags=3
12291                                                 echo "Neither does it support 8."
12292                                         fi
12293                                 fi
12294                         else
12295                                 echo "It does not support 2..."
12296                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12297                                         voidflags=13
12298                                         echo "But it supports 4 and 8."
12299                                 else
12300                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12301                                                 voidflags=5
12302                                                 echo "And it supports 4 but has not heard about 8."
12303                                         else
12304                                                 echo "However it supports 8 but not 4."
12305                                         fi
12306                                 fi
12307                         fi
12308                 else
12309                         echo "There is no support at all for void."
12310                         voidflags=0
12311                 fi
12312         fi
12313 esac
12314 case "$voidflags" in
12315 "$defvoidused") ;;
12316 *)      $cat >&4 <<'EOM'
12317   Support flag bits are:
12318     1: basic void declarations.
12319     2: arrays of pointers to functions returning void.
12320     4: operations between pointers to and addresses of void functions.
12321     8: generic void pointers.
12322 EOM
12323         dflt="$voidflags";
12324         rp="Your void support flags add up to what?"
12325         . ./myread
12326         voidflags="$ans"
12327         ;;
12328 esac
12329 $rm -f try.* .out
12330
12331
12332 : How can we generate normalized random numbers ?
12333 echo " "
12334 echo "Looking for a random number function..." >&4
12335 case "$randfunc" in
12336 '')
12337         if set drand48 val -f; eval $csym; $val; then
12338                 dflt="drand48"
12339                 echo "Good, found drand48()." >&4
12340         elif set random val -f; eval $csym; $val; then
12341                 dflt="random"
12342                 echo "OK, found random()." >&4
12343         else
12344                 dflt="rand"
12345                 echo "Yick, looks like I have to use rand()." >&4
12346         fi
12347         echo " "
12348         ;;
12349 *)
12350         dflt="$randfunc"
12351         ;;
12352 esac
12353 cont=true
12354
12355 case "$ccflags" in
12356 *-Dmy_rand=*|*-Dmy_srand=*)
12357         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12358         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12359         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12360         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12361         ;;
12362 esac
12363
12364 while $test "$cont"; do
12365         rp="Use which function to generate random numbers?"
12366         . ./myread
12367         if $test "$ans" = "$dflt"; then
12368                 : null
12369         else
12370                 randbits=''
12371         fi
12372         randfunc="$ans"
12373         if set $ans val -f; eval $csym; $val; then
12374                 cont=''
12375         else
12376                 dflt=y
12377                 rp="I cannot find function $ans. Use that name anyway?"
12378                 . ./myread
12379                 dflt=rand
12380                 case "$ans" in
12381                         [yY]*) cont='';;
12382                 esac
12383         fi
12384         case "$cont" in
12385         '')
12386                 case "$randfunc" in
12387                 drand48)
12388                         drand01="drand48()"
12389                         seedfunc="srand48"
12390                         randbits=48
12391                         randseedtype=long
12392                         ;;
12393                 rand|random)
12394                         case "$randbits" in
12395                         '')
12396 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12397                                 $cat >try.c <<EOCP
12398 #$i_unistd I_UNISTD
12399 #$i_stdlib I_STDLIB
12400 #include <stdio.h>
12401 #ifdef I_UNISTD
12402 #  include <unistd.h>
12403 #endif
12404 #ifdef I_STDLIB
12405 #  include <stdlib.h>
12406 #endif
12407 int main()
12408 {
12409         register int i;
12410         register unsigned long tmp;
12411         register unsigned long max = 0L;
12412
12413         for (i = 1000; i; i--) {
12414                 tmp = (unsigned long) $randfunc();
12415                 if (tmp > max) max = tmp;
12416         }
12417         for (i = 0; max; i++)
12418                 max /= 2;
12419         printf("%d\n",i);
12420 }
12421 EOCP
12422                                 set try
12423                                 if eval $compile_ok; then
12424                                         dflt=`try`
12425                                 else
12426                                         dflt='?'
12427                                         echo "(I can't seem to compile the test program...)"
12428                                 fi
12429                                 ;;
12430                         *)
12431                                 dflt="$randbits"
12432                                 ;;
12433                         esac
12434                         rp="How many bits does your $randfunc() function produce?"
12435                         . ./myread
12436                         randbits="$ans"
12437                         $rm -f try.c try
12438                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12439                         seedfunc="s$randfunc"
12440                         randseedtype=unsigned
12441                         ;;
12442                 *)
12443                         dflt="31"
12444                         rp="How many bits does your $randfunc() function produce?"
12445                         . ./myread
12446                         randbits="$ans"
12447                         seedfunc="s$randfunc"
12448                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12449                         if set $seedfunc val -f; eval $csym; $val; then
12450                                 echo "(Using $seedfunc() to seed random generator)"
12451                         else
12452                                 echo "(Warning: no $seedfunc() to seed random generator)"
12453                                 seedfunc=rand
12454                         fi
12455                         randseedtype=unsigned
12456                         ;;
12457                 esac
12458                 ;;
12459         esac
12460 done
12461
12462 echo " "
12463 echo "Determining whether or not we are on an EBCDIC system..." >&4
12464 $cat >tebcdic.c <<'EOM'
12465 int main()
12466 {
12467   if ('M'==0xd4) return 0;
12468   return 1;
12469 }
12470 EOM
12471
12472 val=$undef
12473 set tebcdic
12474 if eval $compile_ok; then
12475         if ./tebcdic; then
12476                 echo "You have EBCDIC." >&4
12477                 val="$define"
12478         else
12479                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12480         fi
12481 else
12482         echo "I'm unable to compile the test program." >&4
12483         echo "I'll assume ASCII or some ISO Latin." >&4
12484 fi
12485 $rm -f tebcdic.c tebcdic
12486 set ebcdic
12487 eval $setvar
12488
12489 echo " "
12490 $cat >&4 <<EOM
12491 Checking how to flush all pending stdio output...
12492 EOM
12493 # I only know how to find the first 32 possibly open files on SunOS.
12494 # See also hints/sunos_4_1.sh and util.c  --AD
12495 case "$osname" in
12496 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12497 esac
12498 $cat >>try.c <<EOCP
12499 #include <stdio.h>
12500 #$i_unistd I_UNISTD
12501 #ifdef I_UNISTD
12502 # include <unistd.h>
12503 #endif
12504 #$d_sysconf HAS_SYSCONF
12505 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12506 #ifdef HAS_STDIO_STREAM_ARRAY
12507 # define STDIO_STREAM_ARRAY $stdio_stream_array
12508 #endif
12509 int main() {
12510   FILE* p = fopen("try.out", "w");
12511 #ifdef TRY_FPUTC
12512   fputc('x', p);
12513 #else
12514 # ifdef TRY_FPRINTF
12515   fprintf(p, "x");
12516 # endif
12517 #endif
12518 #ifdef TRY_FFLUSH_NULL
12519   fflush(NULL);
12520 #endif
12521 #ifdef TRY_FFLUSH_ALL
12522   {
12523     long open_max = -1;
12524 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12525     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12526 # else
12527 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12528     open_max = sysconf(_SC_OPEN_MAX);
12529 #  else
12530 #   ifdef FOPEN_MAX
12531     open_max = FOPEN_MAX;
12532 #   else
12533 #    ifdef OPEN_MAX
12534     open_max = OPEN_MAX;
12535 #    else
12536 #     ifdef _NFILE
12537     open_max = _NFILE;
12538 #     endif
12539 #    endif
12540 #   endif
12541 #  endif
12542 # endif 
12543 # ifdef HAS_STDIO_STREAM_ARRAY
12544     if (open_max > 0) {
12545       long i;
12546       for (i = 0; i < open_max; i++)
12547             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12548                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12549                 STDIO_STREAM_ARRAY[i]._flag)
12550                 fflush(&STDIO_STREAM_ARRAY[i]);
12551     }   
12552   }
12553 # endif
12554 #endif
12555   _exit(42);
12556 }
12557 EOCP
12558 : first we have to find out how _not_ to flush
12559 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12560     output=''
12561     set try -DTRY_FPUTC
12562     if eval $compile; then
12563             $rm -f try.out
12564             ./try$exe_ext 2>/dev/null
12565             if $test ! -s try.out -a "X$?" = X42; then
12566                 output=-DTRY_FPUTC
12567             fi
12568     fi
12569     case "$output" in
12570     '')
12571             set try -DTRY_FPRINTF
12572             $rm -f try.out
12573             if eval $compile; then
12574                     $rm -f try.out
12575                     ./try$exe_ext 2>/dev/null
12576                     if $test ! -s try.out -a "X$?" = X42; then
12577                         output=-DTRY_FPRINTF
12578                     fi
12579             fi
12580         ;;
12581     esac
12582 fi
12583 : check for fflush NULL behaviour
12584 case "$fflushNULL" in
12585 '')     set try -DTRY_FFLUSH_NULL $output
12586         if eval $compile; then
12587                 $rm -f try.out
12588                 ./try$exe_ext 2>/dev/null
12589                 code="$?"
12590                 if $test -s try.out -a "X$code" = X42; then
12591                         fflushNULL="`$cat try.out`"
12592                 else
12593                         if $test "X$code" != X42; then
12594                                 $cat >&4 <<EOM
12595 (If this test failed, don't worry, we'll try another method shortly.)
12596 EOM
12597                         fi
12598                 fi
12599         fi
12600         $rm -f core try.core core.try.*
12601         case "$fflushNULL" in
12602         x)      $cat >&4 <<EOM
12603 Your fflush(NULL) works okay for output streams.
12604 Let's see if it clobbers input pipes...
12605 EOM
12606 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12607 # bug that improperly flushes the input end of pipes.  So we avoid the
12608 # autoflush on fork/system/exec support for now. :-(
12609 $cat >tryp.c <<EOCP
12610 #include <stdio.h>
12611 int
12612 main(int argc, char **argv)
12613 {
12614     char buf[1024];
12615     int i;
12616     char *bp = buf;
12617     while (1) {
12618         while ((i = getc(stdin)) != -1
12619                && (*bp++ = i) != '\n'
12620                && bp < &buf[1024])
12621         /* DO NOTHING */ ;
12622         *bp = '\0';
12623         fprintf(stdout, "%s", buf);
12624         fflush(NULL);
12625         if (i == -1)
12626             return 0;
12627         bp = buf;
12628     }
12629 }
12630 EOCP
12631                 fflushNULL="$define"
12632                 set tryp
12633                 if eval $compile; then
12634                     $rm -f tryp.out
12635                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12636                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12637                        $cat >&4 <<EOM
12638 fflush(NULL) seems to behave okay with input streams.
12639 EOM
12640                         fflushNULL="$define"
12641                     else
12642                         $cat >&4 <<EOM
12643 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12644 EOM
12645                         fflushNULL="$undef"
12646                     fi
12647                 fi
12648                 $rm -f core tryp.c tryp.core core.tryp.*
12649                 ;;
12650         '')     $cat >&4 <<EOM
12651 Your fflush(NULL) isn't working (contrary to ANSI C).
12652 EOM
12653                 fflushNULL="$undef"
12654                 ;;
12655         *)      $cat >&4 <<EOM
12656 Cannot figure out whether your fflush(NULL) works or not.
12657 I'm assuming it doesn't (contrary to ANSI C).
12658 EOM
12659                 fflushNULL="$undef"
12660                 ;;
12661         esac
12662         ;;
12663 $define|true|[yY]*)
12664         fflushNULL="$define"
12665         ;;
12666 *)
12667         fflushNULL="$undef"
12668         ;;
12669 esac
12670 : check explicit looping only if NULL did not work, and if the pipe
12671 : bug does not show up on an explicit flush too
12672 case "$fflushNULL" in
12673 "$undef")
12674         $cat >tryp.c <<EOCP
12675 #include <stdio.h>
12676 int
12677 main(int argc, char **argv)
12678 {
12679     char buf[1024];
12680     int i;
12681     char *bp = buf;
12682     while (1) {
12683         while ((i = getc(stdin)) != -1
12684                && (*bp++ = i) != '\n'
12685                && bp < &buf[1024])
12686         /* DO NOTHING */ ;
12687         *bp = '\0';
12688         fprintf(stdout, "%s", buf);
12689         fflush(stdin);
12690         if (i == -1)
12691             return 0;
12692         bp = buf;
12693     }
12694 }
12695 EOCP
12696         set tryp
12697         if eval $compile; then
12698             $rm -f tryp.out
12699             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12700             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12701                $cat >&4 <<EOM
12702 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12703 EOM
12704                 : now check for fflushall behaviour
12705                 case "$fflushall" in
12706                 '')     set try -DTRY_FFLUSH_ALL $output
12707                         if eval $compile; then
12708                                 $cat >&4 <<EOM
12709 (Now testing the other method--but note that this also may fail.)
12710 EOM
12711                                 $rm -f try.out
12712                                 ./try$exe_ext 2>/dev/null
12713                                 if $test -s try.out -a "X$?" = X42; then
12714                                         fflushall="`$cat try.out`"
12715                                 fi
12716                         fi
12717                         $rm -f core try.core core.try.*
12718                         case "$fflushall" in
12719                         x)      $cat >&4 <<EOM
12720 Whew. Flushing explicitly all the stdio streams works.
12721 EOM
12722                                 fflushall="$define"
12723                                 ;;
12724                         '')     $cat >&4 <<EOM
12725 Sigh. Flushing explicitly all the stdio streams doesn't work.
12726 EOM
12727                                 fflushall="$undef"
12728                                 ;;
12729                         *)      $cat >&4 <<EOM
12730 Cannot figure out whether flushing stdio streams explicitly works or not.
12731 I'm assuming it doesn't.
12732 EOM
12733                                 fflushall="$undef"
12734                                 ;;
12735                         esac
12736                         ;;
12737                 "$define"|true|[yY]*)
12738                         fflushall="$define"
12739                         ;;
12740                 *)
12741                         fflushall="$undef"
12742                         ;;
12743                 esac
12744             else
12745                 $cat >&4 <<EOM
12746 All is futile.  Even fflush(stdin) clobbers input pipes!
12747 EOM
12748                 fflushall="$undef"
12749             fi
12750         else
12751             fflushall="$undef"
12752         fi
12753         $rm -f core tryp.c tryp.core core.tryp.*
12754         ;;
12755 *)      fflushall="$undef"
12756         ;;
12757 esac
12758
12759 case "$fflushNULL$fflushall" in
12760 undefundef)
12761         $cat <<EOM
12762 OK, I give up.  I cannot figure out how to flush pending stdio output.
12763 We won't be flushing handles at all before fork/exec/popen.
12764 EOM
12765         ;;
12766 esac
12767 $rm -f try.* try$exe_ext
12768
12769 : Store the full pathname to the ar program for use in the C program
12770 : Respect a hint or command line value for full_ar.
12771 case "$full_ar" in
12772 '') full_ar=$ar ;;
12773 esac
12774
12775 : Store the full pathname to the sed program for use in the C program
12776 full_sed=$sed
12777
12778 : see what type gids are declared as in the kernel
12779 echo " "
12780 echo "Looking for the type for group ids returned by getgid()."
12781 set gid_t gidtype xxx stdio.h sys/types.h
12782 eval $typedef
12783 case "$gidtype" in
12784 xxx)
12785         xxx=`./findhdr sys/user.h`
12786         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12787         case $1 in
12788         unsigned) dflt="$1 $2" ;;
12789         *) dflt="$1" ;;
12790         esac
12791         ;;
12792 *) dflt="$gidtype";;
12793 esac
12794 case "$gidtype" in
12795 gid_t) echo "gid_t found." ;;
12796 *)      rp="What is the type for group ids returned by getgid()?"
12797         . ./myread
12798         gidtype="$ans"
12799         ;;
12800 esac
12801
12802 echo " "
12803 case "$gidtype" in
12804 *_t) zzz="$gidtype"     ;;
12805 *)   zzz="gid"          ;;
12806 esac
12807 echo "Checking the size of $zzz..." >&4 
12808 cat > try.c <<EOCP
12809 #include <sys/types.h>
12810 #include <stdio.h>
12811 int main() {
12812     printf("%d\n", (int)sizeof($gidtype));
12813     exit(0);
12814 }
12815 EOCP
12816 set try
12817 if eval $compile_ok; then
12818         yyy=`./try`
12819         case "$yyy" in
12820         '')     gidsize=4
12821                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12822                 ;;
12823         *)      gidsize=$yyy
12824                 echo "Your $zzz is $gidsize bytes long."
12825                 ;;
12826         esac
12827 else
12828         gidsize=4
12829         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12830 fi
12831
12832
12833 echo " "
12834 case "$gidtype" in
12835 *_t) zzz="$gidtype"     ;;
12836 *)   zzz="gid"          ;;
12837 esac
12838 echo "Checking the sign of $zzz..." >&4 
12839 cat > try.c <<EOCP
12840 #include <sys/types.h>
12841 #include <stdio.h>
12842 int main() {
12843         $gidtype foo = -1;
12844         if (foo < 0)
12845                 printf("-1\n");
12846         else
12847                 printf("1\n");
12848 }
12849 EOCP
12850 set try
12851 if eval $compile; then
12852         yyy=`./try`
12853         case "$yyy" in
12854         '')     gidsign=1
12855                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12856                 ;;
12857         *)      gidsign=$yyy
12858                 case "$gidsign" in
12859                  1) echo "Your $zzz is unsigned." ;;
12860                 -1) echo "Your $zzz is signed."   ;;
12861                 esac
12862                 ;;
12863         esac
12864 else
12865         gidsign=1
12866         echo "(I can't compile the test program--guessing unsigned.)" >&4
12867 fi
12868
12869
12870 echo " "
12871
12872 if $test X"$quadtype" != X; then
12873
12874 echo "Checking how to print 64-bit integers..." >&4
12875
12876 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12877         $cat >try.c <<'EOCP'
12878 #include <sys/types.h>
12879 #include <stdio.h>
12880 int main() {
12881   int q = 12345678901;
12882   printf("%ld\n", q);
12883 }
12884 EOCP
12885         set try
12886         if eval $compile; then
12887                 yyy=`./try$exe_ext`
12888                 case "$yyy" in
12889                 12345678901)
12890                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12891                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12892                         echo "We will use %d."
12893                         ;;
12894                 esac
12895         fi
12896 fi
12897
12898 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12899         $cat >try.c <<'EOCP'
12900 #include <sys/types.h>
12901 #include <stdio.h>
12902 int main() {
12903   long q = 12345678901;
12904   printf("%ld\n", q);
12905 }
12906 EOCP
12907         set try
12908         if eval $compile; then
12909                 yyy=`./try$exe_ext`
12910                 case "$yyy" in
12911                 12345678901)
12912                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12913                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12914                         echo "We will use %ld."
12915                         ;;
12916                 esac
12917         fi
12918 fi
12919
12920 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12921         $cat >try.c <<'EOCP'
12922 #include <sys/types.h>
12923 #include <inttypes.h>
12924 #include <stdio.h>
12925 int main() {
12926   int64_t q = 12345678901;
12927   printf("%" PRId64 "\n", q);
12928 }
12929 EOCP
12930         set try
12931         if eval $compile; then
12932                 yyy=`./try$exe_ext`
12933                 case "$yyy" in
12934                 12345678901)
12935                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12936                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12937                         echo "We will use the C9X style."
12938                         ;;
12939                 esac
12940         fi
12941 fi
12942
12943 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12944         $cat >try.c <<'EOCP'
12945 #include <sys/types.h>
12946 #include <stdio.h>
12947 int main() {
12948   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12949   printf("%lld\n", q);
12950 }
12951 EOCP
12952         set try
12953         if eval $compile; then
12954                 yyy=`./try$exe_ext`
12955                 case "$yyy" in
12956                 12345678901)
12957                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12958                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12959                         echo "We will use the %lld style."
12960                         ;;
12961                 esac
12962         fi
12963 fi
12964
12965 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12966         $cat >try.c <<EOCP
12967 #include <sys/types.h>
12968 #include <stdio.h>
12969 int main() {
12970   $quadtype q = 12345678901;
12971   printf("%Ld\n", q);
12972 }
12973 EOCP
12974         set try
12975         if eval $compile; then
12976                 yyy=`./try$exe_ext`
12977                 case "$yyy" in
12978                 12345678901)
12979                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12980                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12981                         echo "We will use %Ld."
12982                         ;;
12983                 esac
12984         fi
12985 fi
12986
12987 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12988         $cat >try.c <<EOCP
12989 #include <sys/types.h>
12990 #include <stdio.h>
12991 int main() {
12992   $quadtype q = 12345678901;
12993   printf("%qd\n", q);
12994 }
12995 EOCP
12996         set try
12997         if eval $compile; then
12998                 yyy=`./try$exe_ext`
12999                 case "$yyy" in
13000                 12345678901)
13001                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13002                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
13003                         echo "We will use %qd."
13004                         ;;
13005                 esac
13006         fi
13007 fi
13008
13009 if $test X"$sPRId64" = X; then
13010         echo "Cannot figure out how to print 64-bit integers." >&4
13011 fi
13012
13013 $rm -f try try.*
13014
13015 fi
13016
13017 case "$sPRId64" in
13018 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13019         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
13020         ;;
13021 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13022         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
13023         ;;
13024 esac
13025
13026
13027 echo " "
13028 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13029
13030 if $test X"$ivsize" = X8; then
13031         ivdformat="$sPRId64"
13032         uvuformat="$sPRIu64"
13033         uvoformat="$sPRIo64"
13034         uvxformat="$sPRIx64"
13035 else
13036         if $test X"$ivsize" = X"$longsize"; then
13037                 ivdformat='"ld"'
13038                 uvuformat='"lu"'
13039                 uvoformat='"lo"'
13040                 uvxformat='"lx"'
13041         else
13042                 if $test X"$ivsize" = X"$intsize"; then
13043                         ivdformat='"d"'
13044                         uvuformat='"u"'
13045                         uvoformat='"o"'
13046                         uvxformat='"x"'
13047                 else
13048                         : far out
13049                         if $test X"$ivsize" = X"$shortsize"; then
13050                                 ivdformat='"hd"'
13051                                 uvuformat='"hu"'
13052                                 uvoformat='"ho"'
13053                                 uvxformat='"hx"'
13054                         fi
13055                 fi
13056         fi
13057 fi
13058
13059 case "$ivdformat" in
13060 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13061     exit 1
13062     ;;
13063 esac
13064
13065
13066 echo " "
13067 $echo "Checking the format string to be used for gids..." >&4
13068
13069 case "$gidsign" in
13070 -1)     if $test X"$gidsize" = X"$ivsize"; then
13071                 gidformat="$ivdformat"
13072         else
13073                 if $test X"$gidsize" = X"$longsize"; then
13074                         gidformat='"ld"'
13075                 else
13076                         if $test X"$gidsize" = X"$intsize"; then
13077                                 gidformat='"d"'
13078                         else
13079                                 if $test X"$gidsize" = X"$shortsize"; then
13080                                         gidformat='"hd"'
13081                                 fi
13082                         fi
13083                 fi
13084         fi
13085         ;;
13086 *)      if $test X"$gidsize" = X"$uvsize"; then
13087                 gidformat="$uvuformat"
13088         else
13089                 if $test X"$gidsize" = X"$longsize"; then
13090                         gidformat='"lu"'
13091                 else
13092                         if $test X"$gidsize" = X"$intsize"; then
13093                                 gidformat='"u"'
13094                         else
13095                                 if $test X"$gidsize" = X"$shortsize"; then
13096                                         gidformat='"hu"'
13097                                 fi
13098                         fi
13099                 fi
13100         fi
13101         ;;
13102 esac
13103
13104 : see if getgroups exists
13105 set getgroups d_getgrps
13106 eval $inlibc
13107
13108 : see if setgroups exists
13109 set setgroups d_setgrps
13110 eval $inlibc
13111
13112
13113 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13114 echo " "
13115 case "$d_getgrps$d_setgrps" in
13116 *define*)
13117         case "$groupstype" in
13118         '') dflt="$gidtype" ;;
13119         *)  dflt="$groupstype" ;;
13120         esac
13121         $cat <<EOM
13122 What type of pointer is the second argument to getgroups() and setgroups()?
13123 Usually this is the same as group ids, $gidtype, but not always.
13124
13125 EOM
13126         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13127         . ./myread
13128         groupstype="$ans"
13129         ;;
13130 *)  groupstype="$gidtype";;
13131 esac
13132
13133 echo " "
13134 echo "Checking if your $make program sets \$(MAKE)..." >&4
13135 case "$make_set_make" in
13136 '')
13137         $sed 's/^X //' > testmake.mak << 'EOF'
13138 Xall:
13139 X       @echo 'maketemp="$(MAKE)"'
13140 EOF
13141         case "`$make -f testmake.mak 2>/dev/null`" in
13142         *maketemp=*) make_set_make='#' ;;
13143         *)      make_set_make="MAKE=$make" ;;
13144         esac
13145         $rm -f testmake.mak
13146         ;;
13147 esac
13148 case "$make_set_make" in
13149 '#') echo "Yup, it does.";;
13150 *) echo "Nope, it doesn't.";;
13151 esac
13152
13153 : see what type is used for mode_t
13154 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13155 set mode_t modetype int stdio.h sys/types.h
13156 eval $typedef_ask
13157
13158 : define a fucntion to check prototypes
13159 $cat > protochk <<EOSH
13160 $startsh
13161 cc="$cc"
13162 optimize="$optimize"
13163 ccflags="$ccflags"
13164 prototype="$prototype"
13165 define="$define"
13166 rm=$rm
13167 EOSH
13168
13169 $cat >> protochk <<'EOSH'
13170
13171 $rm -f try.c
13172 foo="$1"
13173 shift
13174 while test $# -ge 2; do
13175         case "$1" in
13176                 $define) echo "#include <$2>" >> try.c ;;
13177                 literal) echo "$2" >> try.c ;;
13178         esac
13179     shift 2
13180 done
13181 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13182 cat >> try.c <<'EOCP'
13183 #ifdef CAN_PROTOTYPE
13184 #define _(args) args
13185 #else
13186 #define _(args) ()
13187 #endif
13188 EOCP
13189 echo "$foo" >> try.c
13190 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13191 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13192 status=$?
13193 $rm -f try.[co]
13194 exit $status
13195 EOSH
13196 chmod +x protochk
13197 $eunicefix protochk
13198
13199 : see what type is used for size_t
13200 rp="What is the type used for the length parameter for string functions?"
13201 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13202 eval $typedef_ask
13203
13204 : check for type of arguments to gethostbyaddr. 
13205 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13206         case "$d_gethbyaddr" in
13207         $define)
13208                 $cat <<EOM
13209
13210 Checking to see what type of arguments are accepted by gethostbyaddr().
13211 EOM
13212                 hdrs="$define sys/types.h
13213                         $d_socket sys/socket.h 
13214                         $i_niin netinet/in.h 
13215                         $i_netdb netdb.h
13216                         $i_unistd unistd.h"
13217                 : The first arg can 'char *' or 'void *'
13218                 : The second arg is some of integral type
13219                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13220                         for yyy in size_t long int; do
13221                                 case "$netdb_host_type" in
13222                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13223                                         if ./protochk "$try" $hdrs; then
13224                                                 echo "Your system accepts $xxx for the first arg."
13225                                                 echo "...and $yyy for the second arg."
13226                                                 netdb_host_type="$xxx"
13227                                                 netdb_hlen_type="$yyy"
13228                                         fi
13229                                         ;;
13230                                 esac
13231                         done
13232                 done
13233                 : In case none of those worked, prompt the user.
13234                 case "$netdb_host_type" in
13235                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13236                         dflt='char *'
13237                         . ./myread
13238                         netdb_host_type=$ans
13239                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13240                         dflt="$sizetype"
13241                         . ./myread
13242                         netdb_hlen_type=$ans
13243                         ;;
13244                 esac
13245                 ;;
13246         *)      : no gethostbyaddr, so pick harmless defaults
13247                 netdb_host_type='char *'
13248                 netdb_hlen_type="$sizetype"
13249                 ;;
13250         esac
13251         # Remove the "const" if needed. -- but then we'll have a 
13252         # prototype clash!
13253         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13254 fi
13255
13256 : check for type of argument to gethostbyname. 
13257 if test "X$netdb_name_type" = X ; then
13258         case "$d_gethbyname" in
13259         $define)
13260                 $cat <<EOM
13261
13262 Checking to see what type of argument is accepted by gethostbyname().
13263 EOM
13264                 hdrs="$define sys/types.h
13265                         $d_socket sys/socket.h 
13266                         $i_niin netinet/in.h 
13267                         $i_netdb netdb.h
13268                         $i_unistd unistd.h"
13269                 for xxx in "const char *" "char *"; do
13270                         case "$netdb_name_type" in
13271                         '')     try="extern struct hostent *gethostbyname($xxx);"
13272                                 if ./protochk "$try" $hdrs; then
13273                                         echo "Your system accepts $xxx."
13274                                         netdb_name_type="$xxx"
13275                                 fi
13276                                 ;;
13277                         esac
13278                 done
13279                 : In case none of those worked, prompt the user.
13280                 case "$netdb_name_type" in
13281                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13282                         dflt='char *'
13283                         . ./myread
13284                         netdb_name_type=$ans
13285                         ;;
13286                 esac
13287                 ;;
13288         *)      : no gethostbyname, so pick harmless default
13289                 netdb_name_type='char *'
13290                 ;;
13291         esac
13292 fi
13293
13294 : check for type of 1st argument to getnetbyaddr. 
13295 if test "X$netdb_net_type" = X ; then
13296         case "$d_getnbyaddr" in
13297         $define)
13298                 $cat <<EOM
13299
13300 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13301 EOM
13302                 hdrs="$define sys/types.h
13303                         $d_socket sys/socket.h 
13304                         $i_niin netinet/in.h 
13305                         $i_netdb netdb.h
13306                         $i_unistd unistd.h"
13307                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13308                         case "$netdb_net_type" in
13309                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13310                                 if ./protochk "$try" $hdrs; then
13311                                         echo "Your system accepts $xxx."
13312                                         netdb_net_type="$xxx"
13313                                 fi
13314                                 ;;
13315                         esac
13316                 done
13317                 : In case none of those worked, prompt the user.
13318                 case "$netdb_net_type" in
13319                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13320                         dflt='long'
13321                         . ./myread
13322                         netdb_net_type=$ans
13323                         ;;
13324                 esac
13325                 ;;
13326         *)      : no getnetbyaddr, so pick harmless default
13327                 netdb_net_type='long'
13328                 ;;
13329         esac
13330 fi
13331 : locate the preferred pager for this system
13332 case "$pager" in
13333 '')
13334         dflt=''
13335         case "$pg" in
13336         /*) dflt=$pg;;
13337         esac
13338         case "$more" in
13339         /*) dflt=$more;;
13340         esac
13341         case "$less" in
13342         /*) dflt=$less;;
13343         esac
13344         case "$dflt" in
13345         '') dflt=/usr/ucb/more;;
13346         esac
13347         ;;
13348 *) dflt="$pager";;
13349 esac
13350 echo " "
13351 fn=f/
13352 rp='What pager is used on your system?'
13353 . ./getfile
13354 pager="$ans"
13355
13356 : see what type pids are declared as in the kernel
13357 rp="What is the type of process ids on this system?"
13358 set pid_t pidtype int stdio.h sys/types.h
13359 eval $typedef_ask
13360
13361 : Find earliest binary compatible site_perl subdirectory perl can use.
13362 case "$bincompat5005" in
13363 "$define") xs_apiversion='5.005' ;;
13364 *) xs_apiversion=$version ;;   # The current site_perl version.
13365 esac
13366 : Find earliest pure perl site_perl subdirectory perl can use.
13367 : The versioned directories started at 5.005.
13368 pm_apiversion='5.005'
13369
13370 : check for length of pointer
13371 echo " "
13372 case "$ptrsize" in
13373 '')
13374         echo "Checking to see how big your pointers are..." >&4
13375         if test "$voidflags" -gt 7; then
13376                 echo '#define VOID_PTR char *' > try.c
13377         else
13378                 echo '#define VOID_PTR void *' > try.c
13379         fi
13380         $cat >>try.c <<'EOCP'
13381 #include <stdio.h>
13382 int main()
13383 {
13384     printf("%d\n", (int)sizeof(VOID_PTR));
13385     exit(0);
13386 }
13387 EOCP
13388         set try
13389         if eval $compile_ok; then
13390                 ptrsize=`./try`
13391                 echo "Your pointers are $ptrsize bytes long."
13392         else
13393                 dflt='4'
13394                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13395                 rp="What is the size of a pointer (in bytes)?"
13396                 . ./myread
13397                 ptrsize="$ans"
13398         fi
13399         ;;
13400 esac
13401 $rm -f try.c try
13402
13403 : see if ar generates random libraries by itself
13404 echo " "
13405 echo "Checking how to generate random libraries on your machine..." >&4
13406 echo 'int bar1() { return bar2(); }' > bar1.c
13407 echo 'int bar2() { return 2; }' > bar2.c
13408 $cat > foo.c <<'EOP'
13409 int main() { printf("%d\n", bar1()); exit(0); }
13410 EOP
13411 $cc $ccflags -c bar1.c >/dev/null 2>&1
13412 $cc $ccflags -c bar2.c >/dev/null 2>&1
13413 $cc $ccflags -c foo.c >/dev/null 2>&1
13414 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13415 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13416         ./foobar >/dev/null 2>&1; then
13417         echo "$ar appears to generate random libraries itself."
13418         orderlib=false
13419         ranlib=":"
13420 elif $ar ts bar$_a >/dev/null 2>&1 &&
13421         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13422         ./foobar >/dev/null 2>&1; then
13423                 echo "a table of contents needs to be added with '$ar ts'."
13424                 orderlib=false
13425                 ranlib="$ar ts"
13426 else
13427         case "$ranlib" in
13428         :) ranlib='';;
13429         '')
13430                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13431                 $test -f $ranlib || ranlib=''
13432                 ;;
13433         esac
13434         if $test -n "$ranlib"; then
13435                 echo "your system has '$ranlib'; we'll use that."
13436                 orderlib=false
13437         else
13438                 echo "your system doesn't seem to support random libraries"
13439                 echo "so we'll use lorder and tsort to order the libraries."
13440                 orderlib=true
13441                 ranlib=":"
13442         fi
13443 fi
13444 $rm -f foo* bar* 
13445
13446 : check for type of arguments to select. 
13447 case "$selecttype" in
13448 '') case "$d_select" in
13449         $define)
13450                 echo " "
13451                 $cat <<EOM
13452 Checking to see what type of arguments are accepted by select().
13453 EOM
13454                 hdrs="$define sys/types.h
13455                         $i_systime sys/time.h 
13456                         $i_sysselct sys/select.h
13457                         $d_socket sys/socket.h"
13458                 : The first arg can be int, unsigned, or size_t
13459                 : The last arg may or may not be 'const'
13460                 val=''
13461                 : void pointer has been seen but using that
13462                 : breaks the selectminbits test
13463                 for xxx in 'fd_set *' 'int *'; do
13464                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13465                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13466                                         case "$val" in
13467                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13468                                                 if ./protochk "$try" $hdrs; then
13469                                                         echo "Your system accepts $xxx."
13470                                                         val="$xxx"
13471                                                 fi
13472                                                 ;;
13473                                         esac
13474                                 done
13475                         done
13476                 done
13477                 case "$val" in
13478                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13479                         case "$d_fd_set" in
13480                                 $define) dflt="fd_set *" ;;
13481                                 *)              dflt="int *" ;;
13482                         esac
13483                         . ./myread
13484                         val=$ans
13485                         ;;
13486                 esac
13487                 selecttype="$val"
13488                 ;;
13489         *)      : no select, so pick a harmless default
13490                 selecttype='int *'
13491                 ;;
13492         esac
13493         ;;
13494 esac
13495
13496 : check for the select 'width'
13497 case "$selectminbits" in
13498 '') case "$d_select" in
13499         $define)
13500                 $cat <<EOM
13501
13502 Checking to see on how many bits at a time your select() operates...
13503 EOM
13504                 $cat >try.c <<EOCP
13505 #include <sys/types.h>
13506 #$i_time I_TIME
13507 #$i_systime I_SYS_TIME
13508 #$i_systimek I_SYS_TIME_KERNEL
13509 #ifdef I_TIME
13510 #   include <time.h>
13511 #endif
13512 #ifdef I_SYS_TIME
13513 #   ifdef I_SYS_TIME_KERNEL
13514 #       define KERNEL
13515 #   endif
13516 #   include <sys/time.h>
13517 #   ifdef I_SYS_TIME_KERNEL
13518 #       undef KERNEL
13519 #   endif
13520 #endif
13521 #$i_sysselct I_SYS_SELECT
13522 #ifdef I_SYS_SELECT
13523 #include <sys/select.h>
13524 #endif
13525 #$d_socket HAS_SOCKET
13526 #ifdef HAS_SOCKET
13527 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13528 #endif
13529 #include <stdio.h>
13530 $selecttype b;
13531 #define S sizeof(*(b))
13532 #define MINBITS 64
13533 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13534 #define NBITS  (NBYTES * 8)
13535 int main() {
13536     char s[NBYTES];
13537     struct timeval t;
13538     int i;
13539     FILE* fp;
13540     int fd;
13541
13542     fclose(stdin);
13543     fp = fopen("try.c", "r");
13544     if (fp == 0)
13545       exit(1);
13546     fd = fileno(fp);
13547     if (fd < 0)
13548       exit(2);
13549     b = ($selecttype)s;
13550     for (i = 0; i < NBITS; i++)
13551         FD_SET(i, b);
13552     t.tv_sec  = 0;
13553     t.tv_usec = 0;
13554     select(fd + 1, b, 0, 0, &t);
13555     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13556     printf("%d\n", i + 1);
13557     return 0;
13558 }
13559 EOCP
13560                 set try
13561                 if eval $compile_ok; then
13562                         selectminbits=`./try`
13563                         case "$selectminbits" in
13564                         '')     cat >&4 <<EOM
13565 Cannot figure out on how many bits at a time your select() operates.
13566 I'll play safe and guess it is 32 bits.
13567 EOM
13568                                 selectminbits=32
13569                                 bits="32 bits"
13570                                 ;;
13571                         1)      bits="1 bit" ;;
13572                         *)      bits="$selectminbits bits" ;;
13573                         esac
13574                         echo "Your select() operates on $bits at a time." >&4
13575                 else
13576                         rp='What is the minimum number of bits your select() operates on?'
13577                         case "$byteorder" in
13578                         1234|12345678)  dflt=32 ;;
13579                         *)              dflt=1  ;;
13580                         esac
13581                         . ./myread
13582                         val=$ans
13583                         selectminbits="$val"
13584                 fi
13585                 $rm -f try.* try
13586                 ;;
13587         *)      : no select, so pick a harmless default
13588                 selectminbits='32'
13589                 ;;
13590         esac
13591         ;;
13592 esac
13593
13594 : Trace out the files included by signal.h, then look for SIGxxx names.
13595 : Remove SIGARRAYSIZE used by HPUX.
13596 : Remove SIGSTKSIZE used by Linux.
13597 : Remove SIGSTKSZ used by Posix.
13598 : Remove SIGTYP void lines used by OS2.
13599 : Some cpps, like os390, dont give the file name anywhere
13600 if [ "X$fieldn" = X ]; then
13601         : Just make some guesses.  We check them later.
13602         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13603 else
13604         xxx=`echo '#include <signal.h>' |
13605         $cppstdin $cppminus $cppflags 2>/dev/null |
13606         $grep '^[       ]*#.*include' | 
13607         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13608 fi
13609 : Check this list of files to be sure we have parsed the cpp output ok.
13610 : This will also avoid potentially non-existent files, such 
13611 : as ../foo/bar.h
13612 xxxfiles=''
13613 for xx in $xxx /dev/null ; do
13614         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13615 done
13616 : If we have found no files, at least try signal.h
13617 case "$xxxfiles" in
13618 '')     xxxfiles=`./findhdr signal.h` ;;
13619 esac
13620 xxx=`awk '
13621 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13622         print substr($2, 4, 20)
13623 }
13624 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13625         print substr($3, 4, 20)
13626 }' $xxxfiles`
13627 : Append some common names just in case the awk scan failed.
13628 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13629 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13630 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13631 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13632 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13633
13634 : generate a few handy files for later
13635 $cat > signal.c <<'EOCP'
13636 #include <sys/types.h>
13637 #include <signal.h>
13638 #include <stdio.h>
13639 int main() {
13640
13641 /* Strange style to avoid deeply-nested #if/#else/#endif */
13642 #ifndef NSIG
13643 #  ifdef _NSIG
13644 #    define NSIG (_NSIG)
13645 #  endif
13646 #endif
13647
13648 #ifndef NSIG
13649 #  ifdef SIGMAX
13650 #    define NSIG (SIGMAX+1)
13651 #  endif
13652 #endif
13653
13654 #ifndef NSIG
13655 #  ifdef SIG_MAX
13656 #    define NSIG (SIG_MAX+1)
13657 #  endif
13658 #endif
13659
13660 #ifndef NSIG
13661 #  ifdef MAXSIG
13662 #    define NSIG (MAXSIG+1)
13663 #  endif
13664 #endif
13665
13666 #ifndef NSIG
13667 #  ifdef MAX_SIG
13668 #    define NSIG (MAX_SIG+1)
13669 #  endif
13670 #endif
13671
13672 #ifndef NSIG
13673 #  ifdef SIGARRAYSIZE
13674 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13675 #  endif
13676 #endif
13677
13678 #ifndef NSIG
13679 #  ifdef _sys_nsig
13680 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13681 #  endif
13682 #endif
13683
13684 /* Default to some arbitrary number that's big enough to get most
13685    of the common signals.
13686 */
13687 #ifndef NSIG
13688 #    define NSIG 50
13689 #endif
13690
13691 printf("NSIG %d\n", NSIG);
13692
13693 #ifndef JUST_NSIG
13694
13695 EOCP
13696
13697 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13698 {
13699         printf "#ifdef SIG"; printf $1; printf "\n"
13700         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13701         printf $1; printf ");\n"
13702         printf "#endif\n"
13703 }
13704 END {
13705         printf "#endif /* JUST_NSIG */\n";
13706         printf "exit(0);\n}\n";
13707 }
13708 ' >>signal.c
13709 $cat >signal.awk <<'EOP'
13710 BEGIN { ndups = 0 }
13711 $1 ~ /^NSIG$/ { nsig = $2 }
13712 ($1 !~ /^NSIG$/) && (NF == 2) {
13713     if ($2 > maxsig) { maxsig = $2 }
13714     if (sig_name[$2]) {
13715         dup_name[ndups] = $1
13716         dup_num[ndups] = $2
13717         ndups++ 
13718     }
13719     else {
13720         sig_name[$2] = $1
13721         sig_num[$2] = $2
13722     }
13723 }
13724 END { 
13725     if (nsig == 0) {
13726         nsig = maxsig + 1
13727     }
13728     printf("NSIG %d\n", nsig);
13729     for (n = 1; n < nsig; n++) {
13730         if (sig_name[n]) {
13731             printf("%s %d\n", sig_name[n], sig_num[n])
13732         }
13733         else {
13734             printf("NUM%d %d\n", n, n) 
13735         }
13736     }
13737     for (n = 0; n < ndups; n++) {
13738         printf("%s %d\n", dup_name[n], dup_num[n])
13739     }
13740 }
13741 EOP
13742 $cat >signal_cmd <<EOS
13743 $startsh
13744 if $test -s signal.lst; then
13745     echo "Using your existing signal.lst file"
13746         exit 0
13747 fi
13748 xxx="$xxx"
13749 EOS
13750 $cat >>signal_cmd <<'EOS'
13751
13752 set signal
13753 if eval $compile_ok; then
13754         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13755 else
13756         echo "(I can't seem be able to compile the whole test program)" >&4
13757         echo "(I'll try it in little pieces.)" >&4
13758         set signal -DJUST_NSIG
13759         if eval $compile_ok; then
13760                 ./signal$_exe > signal.nsg
13761                 $cat signal.nsg
13762         else
13763                 echo "I can't seem to figure out how many signals you have." >&4
13764                 echo "Guessing 50." >&4
13765                 echo 'NSIG 50' > signal.nsg
13766         fi
13767         : Now look at all the signal names, one at a time.
13768         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13769                 $cat > signal.c <<EOCP
13770 #include <sys/types.h>
13771 #include <signal.h>
13772 #include <stdio.h>
13773 int main() {
13774 printf("$xx %d\n", SIG${xx});
13775 return 0;
13776 }
13777 EOCP
13778                 set signal
13779                 if eval $compile; then
13780                         echo "SIG${xx} found."
13781                         ./signal$_exe  >> signal.ls1
13782                 else
13783                         echo "SIG${xx} NOT found."
13784                 fi
13785         done
13786         if $test -s signal.ls1; then
13787                 $cat signal.nsg signal.ls1 |
13788                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13789         fi
13790
13791 fi
13792 if $test -s signal.lst; then
13793         :
13794 else
13795         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13796         echo 'kill -l' >signal
13797         set X `csh -f <signal`
13798         $rm -f signal
13799         shift
13800         case $# in
13801         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13802         esac
13803         echo $@ | $tr ' ' $trnl | \
13804             $awk '{ printf "%s %d\n", $1, ++s; }
13805                   END { printf "NSIG %d\n", ++s }' >signal.lst
13806 fi
13807 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13808 EOS
13809 chmod a+x signal_cmd
13810 $eunicefix signal_cmd
13811
13812 : generate list of signal names
13813 echo " "
13814 case "$sig_name_init" in
13815 '') doinit=yes ;;
13816 *)  case "$sig_num_init" in
13817     ''|*,*) doinit=yes ;;
13818     esac ;;
13819 esac
13820 case "$doinit" in
13821 yes)
13822         echo "Generating a list of signal names and numbers..." >&4
13823         . ./signal_cmd
13824         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13825         sig_name=`$awk 'BEGIN { printf "ZERO " }
13826                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13827         sig_num=`$awk  'BEGIN { printf "0 " }
13828                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13829         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13830                              !/^NSIG/   { printf "\"%s\", ", $1 }
13831                              END        { printf "0\n" }' signal.lst`
13832         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13833                              !/^NSIG/   { printf "%d, ", $2}
13834                              END        { printf "0\n"}' signal.lst`
13835         ;;
13836 esac
13837 echo "The following $sig_count signals are available:"
13838 echo " "
13839 echo $sig_name | $awk \
13840 'BEGIN { linelen = 0 }
13841 {
13842         for (i = 1; i <= NF; i++) {
13843                 name = "SIG" $i " "
13844                 linelen = linelen + length(name)
13845                 if (linelen > 70) {
13846                         printf "\n"
13847                         linelen = length(name)
13848                 }
13849                 printf "%s", name
13850         }
13851         printf "\n"
13852 }'
13853 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13854
13855 echo " "
13856 case "$sizetype" in
13857 *_t) zzz="$sizetype"    ;;
13858 *)   zzz="filesize"     ;;
13859 esac
13860 echo "Checking the size of $zzz..." >&4 
13861 cat > try.c <<EOCP
13862 #include <sys/types.h>
13863 #include <stdio.h>
13864 int main() {
13865     printf("%d\n", (int)sizeof($sizetype));
13866     exit(0);
13867 }
13868 EOCP
13869 set try
13870 if eval $compile_ok; then
13871         yyy=`./try`
13872         case "$yyy" in
13873         '')     sizesize=4
13874                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
13875                 ;;
13876         *)      sizesize=$yyy
13877                 echo "Your $zzz size is $sizesize bytes."
13878                 ;;
13879         esac
13880 else
13881         sizesize=4
13882         echo "(I can't compile the test program--guessing $sizesize.)" >&4
13883 fi
13884
13885
13886 : check for socklen_t
13887 echo " "
13888 echo "Checking to see if you have socklen_t..." >&4
13889 $cat >try.c <<EOCP
13890 #include <sys/types.h>
13891 #$d_socket HAS_SOCKET
13892 #ifdef HAS_SOCKET
13893 #include <sys/socket.h>
13894 #endif
13895 int main() { socklen_t x = 16; }
13896 EOCP
13897 set try
13898 if eval $compile; then
13899         val="$define"
13900         echo "You have socklen_t."
13901 else
13902         val="$undef"
13903         echo "You do not have socklen_t."
13904         case "$sizetype" in
13905         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
13906         esac
13907 fi
13908 $rm -f try try.*
13909 set d_socklen_t
13910 eval $setvar
13911
13912 : check for type of the size argument to socket calls
13913 case "$d_socket" in
13914 "$define")
13915         $cat <<EOM
13916
13917 Checking to see what type is the last argument of accept().
13918 EOM
13919         hdrs="$define sys/types.h $d_socket sys/socket.h" 
13920         yyy=''
13921         case "$d_socklen_t" in
13922         "$define") yyy="$yyy socklen_t"
13923         esac
13924         yyy="$yyy $sizetype int long unsigned"
13925         for xxx in $yyy; do
13926                 case "$socksizetype" in
13927                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
13928                         if ./protochk "$try" $hdrs; then
13929                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
13930                                 socksizetype="$xxx"
13931                         fi
13932                         ;;
13933                 esac
13934         done
13935 : In case none of those worked, prompt the user.
13936         case "$socksizetype" in
13937         '')     rp='What is the type for socket address structure sizes?'
13938                 dflt='int'
13939                 . ./myread
13940                 socksizetype=$ans
13941                 ;;
13942         esac
13943         ;;
13944 *)      : no sockets, so pick relatively harmless default
13945         socksizetype='int'
13946         ;;
13947 esac
13948
13949 : see what type is used for signed size_t
13950 set ssize_t ssizetype int stdio.h sys/types.h
13951 eval $typedef
13952 dflt="$ssizetype"
13953 $cat > ssize.c <<EOM
13954 #include <stdio.h>
13955 #include <sys/types.h>
13956 #define Size_t $sizetype
13957 #define SSize_t $dflt
13958 int main()
13959 {
13960         if (sizeof(Size_t) == sizeof(SSize_t))
13961                 printf("$dflt\n");
13962         else if (sizeof(Size_t) == sizeof(int))
13963                 printf("int\n");
13964         else 
13965                 printf("long\n");
13966         exit(0);
13967 }
13968 EOM
13969 echo " "
13970 set ssize
13971 if eval $compile_ok && ./ssize > /dev/null; then
13972         ssizetype=`./ssize`
13973         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13974 else
13975         $cat >&4 <<EOM
13976 Help! I can't compile and run the ssize_t test program: please enlighten me!
13977 (This is probably a misconfiguration in your system or libraries, and
13978 you really ought to fix it.  Still, I'll try anyway.)
13979
13980 I need a type that is the same size as $sizetype, but is guaranteed to
13981 be signed.  Common values are ssize_t, int and long.
13982
13983 EOM
13984         rp="What signed type is the same size as $sizetype?"
13985         . ./myread
13986         ssizetype="$ans"
13987 fi
13988 $rm -f ssize ssize.*
13989
13990 : see what type of char stdio uses.
13991 echo " "
13992 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13993         echo "Your stdio uses unsigned chars." >&4
13994         stdchar="unsigned char"
13995 else
13996         echo "Your stdio uses signed chars." >&4
13997         stdchar="char"
13998 fi
13999
14000 : see if time exists
14001 echo " "
14002 if test "X$d_time" = X -o X"$timetype" = X; then
14003     if set time val -f d_time; eval $csym; $val; then
14004                 echo 'time() found.' >&4
14005                 val="$define"
14006                 rp="What is the type returned by time() on this system?"
14007                 set time_t timetype long stdio.h sys/types.h
14008                 eval $typedef_ask
14009     else
14010                 echo 'time() not found, hope that will do.' >&4
14011                 val="$undef"
14012                 timetype='int';
14013     fi
14014     set d_time
14015     eval $setvar
14016 fi
14017
14018 : see what type uids are declared as in the kernel
14019 echo " "
14020 echo "Looking for the type for user ids returned by getuid()."
14021 set uid_t uidtype xxx stdio.h sys/types.h
14022 eval $typedef
14023 case "$uidtype" in
14024 xxx)
14025         xxx=`./findhdr sys/user.h`
14026         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14027         case $1 in
14028         unsigned) dflt="$1 $2" ;;
14029         *) dflt="$1" ;;
14030         esac
14031         ;;
14032 *) dflt="$uidtype";;
14033 esac
14034 case "$uidtype" in
14035 uid_t)  echo "uid_t found." ;;
14036 *)      rp="What is the type for user ids returned by getuid()?"
14037         . ./myread
14038         uidtype="$ans"
14039         ;;
14040 esac
14041
14042 echo " "
14043 case "$uidtype" in
14044 *_t) zzz="$uidtype"     ;;
14045 *)   zzz="uid"          ;;
14046 esac
14047 echo "Checking the size of $zzz..." >&4 
14048 cat > try.c <<EOCP
14049 #include <sys/types.h>
14050 #include <stdio.h>
14051 int main() {
14052     printf("%d\n", (int)sizeof($uidtype));
14053     exit(0);
14054 }
14055 EOCP
14056 set try
14057 if eval $compile_ok; then
14058         yyy=`./try`
14059         case "$yyy" in
14060         '')     uidsize=4
14061                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14062                 ;;
14063         *)      uidsize=$yyy
14064                 echo "Your $zzz is $uidsize bytes long."
14065                 ;;
14066         esac
14067 else
14068         uidsize=4
14069         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14070 fi
14071
14072 echo " "
14073 case "$uidtype" in
14074 *_t) zzz="$uidtype"     ;;
14075 *)   zzz="uid"          ;;
14076 esac
14077 echo "Checking the sign of $zzz..." >&4
14078 cat > try.c <<EOCP
14079 #include <sys/types.h>
14080 #include <stdio.h>
14081 int main() {
14082         $uidtype foo = -1;
14083         if (foo < 0)
14084                 printf("-1\n");
14085         else
14086                 printf("1\n");
14087 }
14088 EOCP
14089 set try
14090 if eval $compile; then
14091         yyy=`./try`
14092         case "$yyy" in
14093         '')     uidsign=1
14094                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14095                 ;;
14096         *)      uidsign=$yyy
14097                 case "$uidsign" in
14098                  1) echo "Your $zzz is unsigned." ;;
14099                 -1) echo "Your $zzz is signed."   ;;
14100                 esac
14101                 ;;
14102         esac
14103 else
14104         uidsign=1
14105         echo "(I can't compile the test program--guessing unsigned.)" >&4
14106 fi
14107
14108
14109
14110 echo " "
14111 $echo "Checking the format string to be used for uids..." >&4
14112
14113 case "$uidsign" in
14114 -1)     if $test X"$uidsize" = X"$ivsize"; then
14115                 uidformat="$ivdformat"
14116         else
14117                 if $test X"$uidsize" = X"$longsize"; then
14118                         uidformat='"ld"'
14119                 else
14120                         if $test X"$uidsize" = X"$intsize"; then
14121                                 uidformat='"d"'
14122                         else
14123                                 if $test X"$uidsize" = X"$shortsize"; then
14124                                         uidformat='"hd"'
14125                                 fi
14126                         fi
14127                 fi
14128         fi
14129         ;;
14130 *)      if $test X"$uidsize" = X"$uvsize"; then
14131                 uidformat="$uvuformat"
14132         else
14133                 if $test X"$uidsize" = X"$longsize"; then
14134                         uidformat='"lu"'
14135                 else
14136                         if $test X"$uidsize" = X"$intsize"; then
14137                                 uidformat='"u"'
14138                         else
14139                                 if $test X"$uidsize" = X"$shortsize"; then
14140                                         uidformat='"hu"'
14141                                 fi
14142                         fi
14143                 fi
14144         fi
14145         ;;
14146 esac
14147
14148 : see if dbm.h is available
14149 : see if dbmclose exists
14150 set dbmclose d_dbmclose
14151 eval $inlibc
14152
14153 case "$d_dbmclose" in
14154 $define)
14155         set dbm.h i_dbm
14156         eval $inhdr
14157         case "$i_dbm" in
14158         $define)
14159                 val="$undef"
14160                 set i_rpcsvcdbm
14161                 eval $setvar
14162                 ;;
14163         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14164                 eval $inhdr
14165                 ;;
14166         esac
14167         ;;
14168 *)      echo "We won't be including <dbm.h>"
14169         val="$undef"
14170         set i_dbm
14171         eval $setvar
14172         val="$undef"
14173         set i_rpcsvcdbm
14174         eval $setvar
14175         ;;
14176 esac
14177
14178 : see if this is a sys/file.h system
14179 val=''
14180 set sys/file.h val
14181 eval $inhdr
14182
14183 : do we need to include sys/file.h ?
14184 case "$val" in
14185 "$define")
14186         echo " "
14187         if $h_sysfile; then
14188                 val="$define"
14189                 echo "We'll be including <sys/file.h>." >&4
14190         else
14191                 val="$undef"
14192                 echo "We won't be including <sys/file.h>." >&4
14193         fi
14194         ;;
14195 *)
14196         h_sysfile=false
14197         ;;
14198 esac
14199 set i_sysfile
14200 eval $setvar
14201
14202 : see if fcntl.h is there
14203 val=''
14204 set fcntl.h val
14205 eval $inhdr
14206
14207 : see if we can include fcntl.h
14208 case "$val" in
14209 "$define")
14210         echo " "
14211         if $h_fcntl; then
14212                 val="$define"
14213                 echo "We'll be including <fcntl.h>." >&4
14214         else
14215                 val="$undef"
14216                 if $h_sysfile; then
14217         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14218                 else
14219                         echo "We won't be including <fcntl.h>." >&4
14220                 fi
14221         fi
14222         ;;
14223 *)
14224         h_fcntl=false
14225         val="$undef"
14226         ;;
14227 esac
14228 set i_fcntl
14229 eval $setvar
14230
14231 : see if this is a iconv.h system
14232 set iconv.h i_iconv
14233 eval $inhdr
14234
14235 : see if this is a ieeefp.h system
14236 set ieeefp.h i_ieeefp
14237 eval $inhdr
14238
14239 : see if locale.h is available
14240 set locale.h i_locale
14241 eval $inhdr
14242
14243 : see if mach cthreads are available
14244 if test "X$usethreads" = "X$define"; then
14245         set mach/cthreads.h i_machcthr
14246         eval $inhdr
14247 else
14248         i_machcthr="$undef"
14249 fi
14250
14251
14252
14253 : see if this is a math.h system
14254 set math.h i_math
14255 eval $inhdr
14256
14257 : see if this is a mntent.h system
14258 set mntent.h i_mntent
14259 eval $inhdr
14260
14261 : see if ndbm.h is available
14262 set ndbm.h t_ndbm
14263 eval $inhdr
14264 case "$t_ndbm" in
14265 $define)
14266         : see if dbm_open exists
14267         set dbm_open d_dbm_open
14268         eval $inlibc
14269         case "$d_dbm_open" in
14270         $undef)
14271                 t_ndbm="$undef"
14272                 echo "We won't be including <ndbm.h>"
14273                 ;;
14274         esac
14275         ;;
14276 esac
14277 val="$t_ndbm"
14278 set i_ndbm
14279 eval $setvar
14280
14281 : see if net/errno.h is available
14282 val=''
14283 set net/errno.h val
14284 eval $inhdr
14285
14286 : Unfortunately, it causes problems on some systems.  Arrgh.
14287 case "$val" in
14288 $define)
14289         cat > try.c <<'EOM'
14290 #include <stdio.h>
14291 #include <errno.h>
14292 #include <net/errno.h>
14293 int func()
14294 {
14295         return ENOTSOCK;
14296 }
14297 EOM
14298         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14299                 echo "We'll be including <net/errno.h>." >&4
14300         else
14301                 echo "We won't be including <net/errno.h>." >&4
14302                 val="$undef"
14303         fi
14304         $rm -f try.* try
14305         ;;
14306 esac
14307 set i_neterrno
14308 eval $setvar
14309
14310 : see if netinet/tcp.h is available
14311 set netinet/tcp.h i_netinettcp
14312 eval $inhdr
14313
14314 : see if this is a poll.h system
14315 set poll.h i_poll
14316 eval $inhdr
14317
14318 echo " "
14319 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14320 $cat <<'EOSH' > Cppsym.know
14321 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14322 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14323 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14324 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14325 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14326 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14327 bull c cadmus clipper CMU COFF COMPILER_VERSION
14328 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14329 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14330 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14331 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14332 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14333 H3050R H3050RX hbullx20 hcx host_mips
14334 hp200 hp300 hp700 HP700 hp800 hp9000
14335 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14336 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14337 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14338 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14339 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14340 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14341 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14342 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14343 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14344 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14345 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14346 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14347 MATH_HAS_NO_SIDE_EFFECTS
14348 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14349 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14350 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14351 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14352 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14353 NetBSD news1500 news1700 news1800 news1900 news3700
14354 news700 news800 news900 NeXT NLS ns16000 ns32000
14355 ns32016 ns32332 ns32k nsc32000
14356 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14357 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14358 pc532 pdp11 PGC PIC plexus PORTAR posix
14359 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14360 POSIX_C_SOURCE POSIX_SOURCE POWER
14361 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14362 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14363 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14364 sony sony_news sonyrisc sparc sparclite spectrum
14365 stardent stdc STDC_EXT stratos sun sun3 sun386
14366 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14367 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14368 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14369 sysV68 sysV88 Tek4132 Tek4300 titan
14370 tower tower32 tower32_200 tower32_600 tower32_700
14371 tower32_800 tower32_850 tss
14372 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14373 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14374 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14375 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14376 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14377 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14378 z8000
14379 EOSH
14380 # Maybe put other stuff here too.
14381 cat <<EOSH >>Cppsym.know
14382 $osname
14383 EOSH
14384 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14385 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14386 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
14387 $rm -f Cppsym.a Cppsym.b
14388 cat <<EOSH > Cppsym
14389 $startsh
14390 if $test \$# -gt 0; then
14391     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14392     if $test -s Cppsym.got; then
14393         $rm -f Cppsym.got
14394         exit 0
14395     fi
14396     $rm -f Cppsym.got
14397     exit 1
14398 else
14399     $tr " " "$trnl" | ./Cppsym.try
14400     exit 0
14401 fi
14402 EOSH
14403 chmod +x Cppsym
14404 $eunicefix Cppsym
14405 cat <<EOSH > Cppsym.try
14406 $startsh
14407 cat <<'EOCP' > try.c
14408 #include <stdio.h>
14409 int main() {
14410 EOCP
14411 $awk \\
14412 EOSH
14413 cat <<'EOSH' >> Cppsym.try
14414 'length($1) > 0 {
14415     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
14416     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
14417     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
14418     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
14419 }'       >> try.c
14420 echo '}' >> try.c
14421 EOSH
14422 cat <<EOSH >> Cppsym.try
14423 ccflags="$ccflags"
14424 case "$osname-$gccversion" in
14425 irix-) ccflags="\$ccflags -woff 1178" ;;
14426 esac
14427 $cc $optimize \$ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14428 EOSH
14429 chmod +x Cppsym.try
14430 $eunicefix Cppsym.try
14431 ./Cppsym < Cppsym.know > Cppsym.true
14432 : now check the C compiler for additional symbols
14433 postprocess_cc_v=''
14434 case "$osname" in
14435 aix) postprocess_cc_v="|$tr , ' '" ;;
14436 esac
14437 $cat >ccsym <<EOS
14438 $startsh
14439 $cat >tmp.c <<EOF
14440 extern int foo;
14441 EOF
14442 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14443 do
14444         case "\$i" in
14445         -D*) echo "\$i" | $sed 's/^-D//';;
14446         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14447         esac
14448 done
14449 $rm -f try.c
14450 EOS
14451 postprocess_cc_v=''
14452 chmod +x ccsym
14453 $eunicefix ccsym
14454 ./ccsym > ccsym1.raw
14455 if $test -s ccsym1.raw; then
14456        $sort ccsym1.raw | $uniq >ccsym.raw
14457 else
14458        mv ccsym1.raw ccsym.raw
14459 fi
14460
14461 $awk '/\=/ { print $0; next }
14462         { print $0"=1" }' ccsym.raw >ccsym.list
14463 $awk '/\=/ { print $0; next }
14464         { print $0"=1" }' Cppsym.true >ccsym.true
14465 $comm -13 ccsym.true ccsym.list >ccsym.own
14466 $comm -12 ccsym.true ccsym.list >ccsym.com
14467 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14468 also=''
14469 if $test -z ccsym.raw; then
14470         echo "Your C compiler doesn't seem to define any symbols!" >&4
14471         echo " "
14472         echo "However, your C preprocessor defines the following symbols:"
14473         $cat Cppsym.true
14474         ccsymbols=''
14475         cppsymbols=`$cat Cppsym.true`
14476         cppsymbols=`echo $cppsymbols`
14477         cppccsymbols="$cppsymbols"
14478 else
14479         if $test -s ccsym.com; then
14480                 echo "Your C compiler and pre-processor define these symbols:"
14481                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14482                 also='also '
14483                 symbols='ones'
14484                 cppccsymbols=`$cat ccsym.com`
14485                 cppccsymbols=`echo $cppccsymbols`
14486                 $test "$silent" || sleep 1
14487         fi
14488         if $test -s ccsym.cpp; then
14489                 $test "$also" && echo " "
14490                 echo "Your C pre-processor ${also}defines the following symbols:"
14491                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14492                 also='further '
14493                 cppsymbols=`$cat ccsym.cpp`
14494                 cppsymbols=`echo $cppsymbols`
14495                 $test "$silent" || sleep 1
14496         fi
14497         if $test -s ccsym.own; then
14498                 $test "$also" && echo " "
14499                 echo "Your C compiler ${also}defines the following cpp symbols:"
14500                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14501                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14502                 ccsymbols=`$cat ccsym.own`
14503                 ccsymbols=`echo $ccsymbols`
14504                 $test "$silent" || sleep 1
14505         fi
14506 fi
14507 $rm -f ccsym*
14508
14509 : see if this is a termio system
14510 val="$undef"
14511 val2="$undef"
14512 val3="$undef"
14513 if $test `./findhdr termios.h`; then
14514         set tcsetattr i_termios
14515         eval $inlibc
14516         val3="$i_termios"
14517 fi
14518 echo " "
14519 case "$val3" in
14520 "$define") echo "You have POSIX termios.h... good!" >&4;;
14521 *) if ./Cppsym pyr; then
14522                 case "`/bin/universe`" in
14523                 ucb) if $test `./findhdr sgtty.h`; then
14524                                 val2="$define"
14525                                 echo "<sgtty.h> found." >&4
14526                         else
14527                                 echo "System is pyramid with BSD universe."
14528                                 echo "<sgtty.h> not found--you could have problems." >&4
14529                         fi;;
14530                 *) if $test `./findhdr termio.h`; then
14531                                 val="$define"
14532                                 echo "<termio.h> found." >&4
14533                         else
14534                                 echo "System is pyramid with USG universe."
14535                                 echo "<termio.h> not found--you could have problems." >&4
14536                         fi;;
14537                 esac
14538         elif ./usg; then
14539                 if $test `./findhdr termio.h`; then
14540                         echo "<termio.h> found." >&4
14541                         val="$define"
14542                 elif $test `./findhdr sgtty.h`; then
14543                         echo "<sgtty.h> found." >&4
14544                         val2="$define"
14545                 else
14546 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14547                 fi
14548         else
14549                 if $test `./findhdr sgtty.h`; then
14550                         echo "<sgtty.h> found." >&4
14551                         val2="$define"
14552                 elif $test `./findhdr termio.h`; then
14553                         echo "<termio.h> found." >&4
14554                         val="$define"
14555                 else
14556 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14557                 fi
14558         fi;;
14559 esac
14560 set i_termio; eval $setvar
14561 val=$val2; set i_sgtty; eval $setvar
14562 val=$val3; set i_termios; eval $setvar
14563
14564 : see if this is a shadow.h system
14565 set shadow.h i_shadow
14566 eval $inhdr
14567
14568 : see if this is a socks.h system
14569 set socks.h i_socks
14570 eval $inhdr
14571
14572 : see if stdarg is available
14573 echo " "
14574 if $test `./findhdr stdarg.h`; then
14575         echo "<stdarg.h> found." >&4
14576         valstd="$define"
14577 else
14578         echo "<stdarg.h> NOT found." >&4
14579         valstd="$undef"
14580 fi
14581
14582 : see if varags is available
14583 echo " "
14584 if $test `./findhdr varargs.h`; then
14585         echo "<varargs.h> found." >&4
14586 else
14587         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14588 fi
14589
14590 : set up the varargs testing programs
14591 $cat > varargs.c <<EOP
14592 #ifdef I_STDARG
14593 #include <stdarg.h>
14594 #endif
14595 #ifdef I_VARARGS
14596 #include <varargs.h>
14597 #endif
14598
14599 #ifdef I_STDARG
14600 int f(char *p, ...)
14601 #else
14602 int f(va_alist)
14603 va_dcl
14604 #endif
14605 {
14606         va_list ap;
14607 #ifndef I_STDARG
14608         char *p;
14609 #endif
14610 #ifdef I_STDARG
14611         va_start(ap,p);
14612 #else
14613         va_start(ap);
14614         p = va_arg(ap, char *);
14615 #endif
14616         va_end(ap);
14617 }
14618 EOP
14619 $cat > varargs <<EOP
14620 $startsh
14621 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14622         echo "true"
14623 else
14624         echo "false"
14625 fi
14626 $rm -f varargs$_o
14627 EOP
14628 chmod +x varargs
14629
14630 : now check which varargs header should be included
14631 echo " "
14632 i_varhdr=''
14633 case "$valstd" in
14634 "$define")
14635         if `./varargs I_STDARG`; then
14636                 val='stdarg.h'
14637         elif `./varargs I_VARARGS`; then
14638                 val='varargs.h'
14639         fi
14640         ;;
14641 *)
14642         if `./varargs I_VARARGS`; then
14643                 val='varargs.h'
14644         fi
14645         ;;
14646 esac
14647 case "$val" in
14648 '')
14649 echo "I could not find the definition for va_dcl... You have problems..." >&4
14650         val="$undef"; set i_stdarg; eval $setvar
14651         val="$undef"; set i_varargs; eval $setvar
14652         ;;
14653 *) 
14654         set i_varhdr
14655         eval $setvar
14656         case "$i_varhdr" in
14657         stdarg.h)
14658                 val="$define"; set i_stdarg; eval $setvar
14659                 val="$undef"; set i_varargs; eval $setvar
14660                 ;;
14661         varargs.h)
14662                 val="$undef"; set i_stdarg; eval $setvar
14663                 val="$define"; set i_varargs; eval $setvar
14664                 ;;
14665         esac
14666         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14667 esac
14668 $rm -f varargs*
14669
14670 : see if stddef is available
14671 set stddef.h i_stddef
14672 eval $inhdr
14673
14674 : see if this is a sunmath.h system
14675 set sunmath.h i_sunmath
14676 eval $inhdr
14677
14678 : see if sys/access.h is available
14679 set sys/access.h i_sysaccess
14680 eval $inhdr
14681
14682 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14683 set sys/filio.h i_sysfilio
14684 eval $inhdr
14685 echo " "
14686 if $test `./findhdr sys/ioctl.h`; then
14687         val="$define"
14688         echo '<sys/ioctl.h> found.' >&4
14689 else
14690         val="$undef"
14691         if $test $i_sysfilio = "$define"; then
14692             echo '<sys/ioctl.h> NOT found.' >&4
14693         else
14694                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14695                 $test $i_termio = "$define" && xxx="termio.h"
14696                 $test $i_termios = "$define" && xxx="termios.h"
14697 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14698         fi
14699 fi
14700 set i_sysioctl
14701 eval $setvar
14702
14703
14704 : see if this is a syslog.h system
14705 set syslog.h i_syslog
14706 eval $inhdr
14707
14708
14709 : see if this is a sys/mode.h system
14710 set sys/mode.h i_sysmode
14711 eval $inhdr
14712
14713 : see if sys/resource.h has to be included
14714 set sys/resource.h i_sysresrc
14715 eval $inhdr
14716
14717 : see if sys/security.h is available
14718 set sys/security.h i_syssecrt
14719 eval $inhdr
14720
14721 : see if this is a sys/statvfs.h system
14722 set sys/statvfs.h i_sysstatvfs
14723 eval $inhdr
14724
14725 : see if this is a sys/uio.h system
14726 set sys/uio.h i_sysuio
14727 eval $inhdr
14728
14729 : see if this is a sys/un.h system
14730 set sys/un.h i_sysun
14731 eval $inhdr
14732
14733
14734 : see if this is a sys/utsname.h system
14735 set sys/utsname.h i_sysutsname
14736 eval $inhdr
14737
14738 : see if this is a syswait system
14739 set sys/wait.h i_syswait
14740 eval $inhdr
14741
14742 : see if this is a ustat.h system
14743 set ustat.h i_ustat
14744 eval $inhdr
14745
14746 : see if this is an utime system
14747 set utime.h i_utime
14748 eval $inhdr
14749
14750 : see if this is a values.h system
14751 set values.h i_values
14752 eval $inhdr
14753
14754 : see if this is a vfork system
14755 case "$d_vfork" in
14756 "$define")
14757         set vfork.h i_vfork
14758         eval $inhdr
14759         ;;
14760 *)
14761         i_vfork="$undef"
14762         ;;
14763 esac
14764
14765 : see if gdbm.h is available
14766 set gdbm.h t_gdbm
14767 eval $inhdr
14768 case "$t_gdbm" in
14769 $define)
14770         : see if gdbm_open exists
14771         set gdbm_open d_gdbm_open
14772         eval $inlibc
14773         case "$d_gdbm_open" in
14774         $undef)
14775                 t_gdbm="$undef"
14776                 echo "We won't be including <gdbm.h>"
14777                 ;;
14778         esac
14779         ;;
14780 esac
14781 val="$t_gdbm"
14782 set i_gdbm
14783 eval $setvar
14784
14785 echo " "
14786 echo "Looking for extensions..." >&4
14787 : If we are using the old config.sh, known_extensions may contain
14788 : old or inaccurate or duplicate values.
14789 known_extensions=''
14790 nonxs_extensions=''
14791 : We do not use find because it might not be available.
14792 : We do not just use MANIFEST because the user may have dropped
14793 : some additional extensions into the source tree and expect them
14794 : to be built.
14795
14796 : Function to recursively find available extensions, ignoring DynaLoader
14797 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14798 find_extensions='
14799     for xxx in *; do
14800        case "$xxx" in
14801            DynaLoader|dynaload) ;;
14802            *)
14803            if $test -f $xxx/$xxx.xs; then
14804                known_extensions="$known_extensions $1$xxx";
14805            elif $test -f $xxx/Makefile.PL; then
14806                nonxs_extensions="$nonxs_extensions $1$xxx";
14807            else
14808                if $test -d $xxx -a $# -lt 10; then
14809                    set $1$xxx/ $*;
14810                    cd $xxx;
14811                    eval $find_extensions;
14812                    cd ..;
14813                    shift;
14814                fi;
14815            fi
14816            ;;
14817        esac;
14818     done'
14819 tdir=`pwd`
14820 cd $rsrc/ext
14821 set X
14822 shift
14823 eval $find_extensions
14824 set X $nonxs_extensions
14825 shift
14826 nonxs_extensions="$*"
14827 set X $known_extensions
14828 shift
14829 known_extensions="$*"
14830 cd $tdir
14831
14832 : Now see which are supported on this system.
14833 avail_ext=''
14834 for xxx in $known_extensions ; do
14835         case "$xxx" in
14836         DB_File|db_file)
14837                 case "$i_db" in
14838                 $define) avail_ext="$avail_ext $xxx" ;;
14839                 esac
14840                 ;;
14841         GDBM_File|gdbm_fil)
14842                 case "$i_gdbm" in 
14843                 $define) avail_ext="$avail_ext $xxx" ;;
14844                 esac
14845                 ;;
14846         NDBM_File|ndbm_fil)
14847                 case "$i_ndbm" in
14848                 $define)
14849                     case "$osname-$use64bitint" in
14850                     hpux-define)
14851                         case "$libs" in
14852                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14853                         esac
14854                         ;;
14855                     *) avail_ext="$avail_ext $xxx" ;;
14856                     esac
14857                     ;;
14858                 esac
14859                 ;;
14860         ODBM_File|odbm_fil) 
14861                 case "${i_dbm}${i_rpcsvcdbm}" in
14862                 *"${define}"*)
14863                     case "$osname-$use64bitint" in
14864                     hpux-define)
14865                         case "$libs" in
14866                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14867                         esac
14868                         ;;
14869                     *) avail_ext="$avail_ext $xxx" ;;
14870                     esac
14871                     ;;
14872                 esac
14873                 ;;
14874         POSIX|posix)
14875                 case "$useposix" in
14876                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14877                 esac
14878                 ;;
14879         Opcode|opcode)
14880                 case "$useopcode" in
14881                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14882                 esac
14883                 ;;
14884         Socket|socket)
14885                 case "$d_socket" in 
14886                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14887                 esac
14888                 ;;
14889         Thread|thread)
14890                 case "$usethreads" in 
14891                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14892                 esac
14893                 ;;
14894         IPC/SysV|ipc/sysv)
14895                 : XXX Do we need a useipcsysv variable here
14896                 case "${d_msg}${d_sem}${d_shm}" in 
14897                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14898                 esac
14899                 ;;
14900         *)      avail_ext="$avail_ext $xxx"
14901                 ;;
14902         esac
14903 done
14904
14905 set X $avail_ext
14906 shift
14907 avail_ext="$*"
14908
14909 : Now see which nonxs extensions are supported on this system.
14910 : For now assume all are.
14911 nonxs_ext=''
14912 for xxx in $nonxs_extensions ; do
14913         case "$xxx" in
14914         *)      nonxs_ext="$nonxs_ext $xxx"
14915                 ;;
14916         esac
14917 done
14918
14919 set X $nonxs_ext
14920 shift
14921 nonxs_ext="$*"
14922
14923 case $usedl in
14924 $define)
14925         $cat <<EOM
14926 A number of extensions are supplied with $package.  You may choose to
14927 compile these extensions for dynamic loading (the default), compile
14928 them into the $package executable (static loading), or not include
14929 them at all.  Answer "none" to include no extensions.
14930 Note that DynaLoader is always built and need not be mentioned here.
14931
14932 EOM
14933         case "$dynamic_ext" in
14934         '') dflt="$avail_ext" ;;
14935         *)      dflt="$dynamic_ext"
14936                 # Perhaps we are reusing an old out-of-date config.sh.
14937                 case "$hint" in
14938                 previous)
14939                         if test X"$dynamic_ext" != X"$avail_ext"; then
14940                                 $cat <<EOM
14941 NOTICE:  Your previous config.sh list may be incorrect. 
14942 The extensions now available to you are 
14943         ${avail_ext}
14944 but the default list from your previous config.sh is
14945         ${dynamic_ext} 
14946
14947 EOM
14948                         fi
14949                         ;;
14950                 esac
14951                 ;;
14952         esac
14953         case "$dflt" in
14954         '')     dflt=none;;
14955         esac
14956         rp="What extensions do you wish to load dynamically?"
14957         . ./myread
14958         case "$ans" in
14959         none) dynamic_ext=' ' ;;
14960         *) dynamic_ext="$ans" ;;
14961         esac
14962
14963         case "$static_ext" in
14964         '')
14965                 : Exclude those already listed in dynamic linking
14966                 dflt=''
14967                 for xxx in $avail_ext; do
14968                         case " $dynamic_ext " in
14969                         *" $xxx "*) ;;
14970                         *) dflt="$dflt $xxx" ;;
14971                         esac
14972                 done
14973                 set X $dflt
14974                 shift
14975                 dflt="$*"
14976                 ;;
14977         *)  dflt="$static_ext" 
14978                 ;;
14979         esac
14980
14981         case "$dflt" in
14982         '')     dflt=none;;
14983         esac
14984         rp="What extensions do you wish to load statically?"
14985         . ./myread
14986         case "$ans" in
14987         none) static_ext=' ' ;;
14988         *) static_ext="$ans" ;;
14989         esac
14990         ;;
14991 *)
14992         $cat <<EOM
14993 A number of extensions are supplied with $package.  Answer "none" 
14994 to include no extensions. 
14995 Note that DynaLoader is always built and need not be mentioned here.
14996
14997 EOM
14998         case "$static_ext" in
14999         '') dflt="$avail_ext" ;;
15000         *)      dflt="$static_ext"
15001                 # Perhaps we are reusing an old out-of-date config.sh.
15002                 case "$hint" in
15003                 previous)
15004                         if test X"$static_ext" != X"$avail_ext"; then
15005                                 $cat <<EOM
15006 NOTICE:  Your previous config.sh list may be incorrect. 
15007 The extensions now available to you are 
15008         ${avail_ext}
15009 but the default list from your previous config.sh is
15010         ${static_ext} 
15011
15012 EOM
15013                         fi
15014                         ;;
15015                 esac
15016                 ;;
15017         esac
15018         : Exclude those that are not xs extensions
15019         case "$dflt" in
15020         '')     dflt=none;;
15021         esac
15022         rp="What extensions do you wish to include?"
15023         . ./myread
15024         case "$ans" in
15025         none) static_ext=' ' ;;
15026         *) static_ext="$ans" ;;
15027         esac
15028         ;;
15029 esac
15030
15031 set X $dynamic_ext $static_ext $nonxs_ext
15032 shift
15033 extensions="$*"
15034
15035 : Remove build directory name from cppstdin so it can be used from
15036 : either the present location or the final installed location.
15037 echo " "
15038 : Get out of the UU directory to get correct path name.
15039 cd ..
15040 case "$cppstdin" in
15041 `pwd`/cppstdin)
15042         echo "Stripping down cppstdin path name"
15043         cppstdin=cppstdin
15044         ;;
15045 esac
15046 cd UU
15047
15048 : end of configuration questions
15049 echo " "
15050 echo "End of configuration questions."
15051 echo " "
15052
15053 : back to where it started
15054 if test -d ../UU; then
15055         cd ..
15056 fi
15057
15058 : configuration may be patched via a 'config.over' file
15059 if $test -f config.over; then
15060         echo " "
15061         dflt=y
15062         rp='I see a config.over file.  Do you wish to load it?'
15063         . UU/myread
15064         case "$ans" in
15065         n*) echo "OK, I'll ignore it.";;
15066         *)      . ./config.over
15067                 echo "Configuration override changes have been loaded."
15068                 ;;
15069         esac
15070 fi
15071
15072 : in case they want portability, strip down executable paths
15073 case "$d_portable" in
15074 "$define")
15075         echo " "
15076         echo "Stripping down executable paths..." >&4
15077         for file in $loclist $trylist; do
15078                 eval temp=\$$file
15079                 eval $file=`basename $temp`
15080         done
15081         ;;
15082 esac
15083
15084 : create config.sh file
15085 echo " "
15086 echo "Creating config.sh..." >&4
15087 $spitshell <<EOT >config.sh
15088 $startsh
15089 #
15090 # This file was produced by running the Configure script. It holds all the
15091 # definitions figured out by Configure. Should you modify one of these values,
15092 # do not forget to propagate your changes by running "Configure -der". You may
15093 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15094 #
15095
15096 # Package name      : $package
15097 # Source directory  : $src
15098 # Configuration time: $cf_time
15099 # Configured by     : $cf_by
15100 # Target system     : $myuname
15101
15102 Author='$Author'
15103 Date='$Date'
15104 Header='$Header'
15105 Id='$Id'
15106 Locker='$Locker'
15107 Log='$Log'
15108 Mcc='$Mcc'
15109 RCSfile='$RCSfile'
15110 Revision='$Revision'
15111 Source='$Source'
15112 State='$State'
15113 _a='$_a'
15114 _exe='$_exe'
15115 _o='$_o'
15116 afs='$afs'
15117 alignbytes='$alignbytes'
15118 ansi2knr='$ansi2knr'
15119 aphostname='$aphostname'
15120 api_revision='$api_revision'
15121 api_subversion='$api_subversion'
15122 api_version='$api_version'
15123 api_versionstring='$api_versionstring'
15124 ar='$ar'
15125 archlib='$archlib'
15126 archlibexp='$archlibexp'
15127 archname64='$archname64'
15128 archname='$archname'
15129 archobjs='$archobjs'
15130 awk='$awk'
15131 baserev='$baserev'
15132 bash='$bash'
15133 bin='$bin'
15134 bincompat5005='$bincompat5005'
15135 binexp='$binexp'
15136 bison='$bison'
15137 byacc='$byacc'
15138 byteorder='$byteorder'
15139 c='$c'
15140 castflags='$castflags'
15141 cat='$cat'
15142 cc='$cc'
15143 cccdlflags='$cccdlflags'
15144 ccdlflags='$ccdlflags'
15145 ccflags='$ccflags'
15146 ccsymbols='$ccsymbols'
15147 cf_by='$cf_by'
15148 cf_email='$cf_email'
15149 cf_time='$cf_time'
15150 charsize='$charsize'
15151 chgrp='$chgrp'
15152 chmod='$chmod'
15153 chown='$chown'
15154 clocktype='$clocktype'
15155 comm='$comm'
15156 compress='$compress'
15157 contains='$contains'
15158 cp='$cp'
15159 cpio='$cpio'
15160 cpp='$cpp'
15161 cpp_stuff='$cpp_stuff'
15162 cppccsymbols='$cppccsymbols'
15163 cppflags='$cppflags'
15164 cpplast='$cpplast'
15165 cppminus='$cppminus'
15166 cpprun='$cpprun'
15167 cppstdin='$cppstdin'
15168 cppsymbols='$cppsymbols'
15169 crosscompile='$crosscompile'
15170 cryptlib='$cryptlib'
15171 csh='$csh'
15172 d_Gconvert='$d_Gconvert'
15173 d_PRIEldbl='$d_PRIEldbl'
15174 d_PRIFldbl='$d_PRIFldbl'
15175 d_PRIGldbl='$d_PRIGldbl'
15176 d_PRIX64='$d_PRIX64'
15177 d_PRId64='$d_PRId64'
15178 d_PRIeldbl='$d_PRIeldbl'
15179 d_PRIfldbl='$d_PRIfldbl'
15180 d_PRIgldbl='$d_PRIgldbl'
15181 d_PRIi64='$d_PRIi64'
15182 d_PRIo64='$d_PRIo64'
15183 d_PRIu64='$d_PRIu64'
15184 d_PRIx64='$d_PRIx64'
15185 d_access='$d_access'
15186 d_accessx='$d_accessx'
15187 d_alarm='$d_alarm'
15188 d_archlib='$d_archlib'
15189 d_atolf='$d_atolf'
15190 d_atoll='$d_atoll'
15191 d_attribut='$d_attribut'
15192 d_bcmp='$d_bcmp'
15193 d_bcopy='$d_bcopy'
15194 d_bincompat5005='$d_bincompat5005'
15195 d_bsd='$d_bsd'
15196 d_bsdgetpgrp='$d_bsdgetpgrp'
15197 d_bsdsetpgrp='$d_bsdsetpgrp'
15198 d_bzero='$d_bzero'
15199 d_casti32='$d_casti32'
15200 d_castneg='$d_castneg'
15201 d_charvspr='$d_charvspr'
15202 d_chown='$d_chown'
15203 d_chroot='$d_chroot'
15204 d_chsize='$d_chsize'
15205 d_closedir='$d_closedir'
15206 d_const='$d_const'
15207 d_crypt='$d_crypt'
15208 d_csh='$d_csh'
15209 d_cuserid='$d_cuserid'
15210 d_dbl_dig='$d_dbl_dig'
15211 d_difftime='$d_difftime'
15212 d_dirnamlen='$d_dirnamlen'
15213 d_dlerror='$d_dlerror'
15214 d_dlopen='$d_dlopen'
15215 d_dlsymun='$d_dlsymun'
15216 d_dosuid='$d_dosuid'
15217 d_drand48proto='$d_drand48proto'
15218 d_dup2='$d_dup2'
15219 d_eaccess='$d_eaccess'
15220 d_endgrent='$d_endgrent'
15221 d_endhent='$d_endhent'
15222 d_endnent='$d_endnent'
15223 d_endpent='$d_endpent'
15224 d_endpwent='$d_endpwent'
15225 d_endsent='$d_endsent'
15226 d_endspent='$d_endspent'
15227 d_eofnblk='$d_eofnblk'
15228 d_eunice='$d_eunice'
15229 d_fchmod='$d_fchmod'
15230 d_fchown='$d_fchown'
15231 d_fcntl='$d_fcntl'
15232 d_fd_macros='$d_fd_macros'
15233 d_fd_set='$d_fd_set'
15234 d_fds_bits='$d_fds_bits'
15235 d_fgetpos='$d_fgetpos'
15236 d_flexfnam='$d_flexfnam'
15237 d_flock='$d_flock'
15238 d_fork='$d_fork'
15239 d_fpathconf='$d_fpathconf'
15240 d_fpos64_t='$d_fpos64_t'
15241 d_frexpl='$d_frexpl'
15242 d_fs_data_s='$d_fs_data_s'
15243 d_fseeko='$d_fseeko'
15244 d_fsetpos='$d_fsetpos'
15245 d_fstatfs='$d_fstatfs'
15246 d_fstatvfs='$d_fstatvfs'
15247 d_ftello='$d_ftello'
15248 d_ftime='$d_ftime'
15249 d_getcwd='$d_getcwd'
15250 d_getfsstat='$d_getfsstat'
15251 d_getgrent='$d_getgrent'
15252 d_getgrps='$d_getgrps'
15253 d_gethbyaddr='$d_gethbyaddr'
15254 d_gethbyname='$d_gethbyname'
15255 d_gethent='$d_gethent'
15256 d_gethname='$d_gethname'
15257 d_gethostprotos='$d_gethostprotos'
15258 d_getlogin='$d_getlogin'
15259 d_getmnt='$d_getmnt'
15260 d_getmntent='$d_getmntent'
15261 d_getnbyaddr='$d_getnbyaddr'
15262 d_getnbyname='$d_getnbyname'
15263 d_getnent='$d_getnent'
15264 d_getnetprotos='$d_getnetprotos'
15265 d_getpbyname='$d_getpbyname'
15266 d_getpbynumber='$d_getpbynumber'
15267 d_getpent='$d_getpent'
15268 d_getpgid='$d_getpgid'
15269 d_getpgrp2='$d_getpgrp2'
15270 d_getpgrp='$d_getpgrp'
15271 d_getppid='$d_getppid'
15272 d_getprior='$d_getprior'
15273 d_getprotoprotos='$d_getprotoprotos'
15274 d_getpwent='$d_getpwent'
15275 d_getsbyname='$d_getsbyname'
15276 d_getsbyport='$d_getsbyport'
15277 d_getsent='$d_getsent'
15278 d_getservprotos='$d_getservprotos'
15279 d_getspent='$d_getspent'
15280 d_getspnam='$d_getspnam'
15281 d_gettimeod='$d_gettimeod'
15282 d_gnulibc='$d_gnulibc'
15283 d_grpasswd='$d_grpasswd'
15284 d_hasmntopt='$d_hasmntopt'
15285 d_htonl='$d_htonl'
15286 d_iconv='$d_iconv'
15287 d_index='$d_index'
15288 d_inetaton='$d_inetaton'
15289 d_int64_t='$d_int64_t'
15290 d_isascii='$d_isascii'
15291 d_isnan='$d_isnan'
15292 d_isnanl='$d_isnanl'
15293 d_killpg='$d_killpg'
15294 d_lchown='$d_lchown'
15295 d_ldbl_dig='$d_ldbl_dig'
15296 d_link='$d_link'
15297 d_locconv='$d_locconv'
15298 d_lockf='$d_lockf'
15299 d_longdbl='$d_longdbl'
15300 d_longlong='$d_longlong'
15301 d_lseekproto='$d_lseekproto'
15302 d_lstat='$d_lstat'
15303 d_madvise='$d_madvise'
15304 d_mblen='$d_mblen'
15305 d_mbstowcs='$d_mbstowcs'
15306 d_mbtowc='$d_mbtowc'
15307 d_memchr='$d_memchr'
15308 d_memcmp='$d_memcmp'
15309 d_memcpy='$d_memcpy'
15310 d_memmove='$d_memmove'
15311 d_memset='$d_memset'
15312 d_mkdir='$d_mkdir'
15313 d_mkdtemp='$d_mkdtemp'
15314 d_mkfifo='$d_mkfifo'
15315 d_mkstemp='$d_mkstemp'
15316 d_mkstemps='$d_mkstemps'
15317 d_mktime='$d_mktime'
15318 d_mmap='$d_mmap'
15319 d_modfl='$d_modfl'
15320 d_mprotect='$d_mprotect'
15321 d_msg='$d_msg'
15322 d_msg_ctrunc='$d_msg_ctrunc'
15323 d_msg_dontroute='$d_msg_dontroute'
15324 d_msg_oob='$d_msg_oob'
15325 d_msg_peek='$d_msg_peek'
15326 d_msg_proxy='$d_msg_proxy'
15327 d_msgctl='$d_msgctl'
15328 d_msgget='$d_msgget'
15329 d_msgrcv='$d_msgrcv'
15330 d_msgsnd='$d_msgsnd'
15331 d_msync='$d_msync'
15332 d_munmap='$d_munmap'
15333 d_mymalloc='$d_mymalloc'
15334 d_nice='$d_nice'
15335 d_nv_preserves_uv='$d_nv_preserves_uv'
15336 d_off64_t='$d_off64_t'
15337 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15338 d_oldpthreads='$d_oldpthreads'
15339 d_oldsock='$d_oldsock'
15340 d_open3='$d_open3'
15341 d_pathconf='$d_pathconf'
15342 d_pause='$d_pause'
15343 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15344 d_phostname='$d_phostname'
15345 d_pipe='$d_pipe'
15346 d_poll='$d_poll'
15347 d_portable='$d_portable'
15348 d_pthread_yield='$d_pthread_yield'
15349 d_pwage='$d_pwage'
15350 d_pwchange='$d_pwchange'
15351 d_pwclass='$d_pwclass'
15352 d_pwcomment='$d_pwcomment'
15353 d_pwexpire='$d_pwexpire'
15354 d_pwgecos='$d_pwgecos'
15355 d_pwpasswd='$d_pwpasswd'
15356 d_pwquota='$d_pwquota'
15357 d_qgcvt='$d_qgcvt'
15358 d_quad='$d_quad'
15359 d_readdir='$d_readdir'
15360 d_readlink='$d_readlink'
15361 d_rename='$d_rename'
15362 d_rewinddir='$d_rewinddir'
15363 d_rmdir='$d_rmdir'
15364 d_safebcpy='$d_safebcpy'
15365 d_safemcpy='$d_safemcpy'
15366 d_sanemcmp='$d_sanemcmp'
15367 d_sched_yield='$d_sched_yield'
15368 d_scm_rights='$d_scm_rights'
15369 d_seekdir='$d_seekdir'
15370 d_select='$d_select'
15371 d_sem='$d_sem'
15372 d_semctl='$d_semctl'
15373 d_semctl_semid_ds='$d_semctl_semid_ds'
15374 d_semctl_semun='$d_semctl_semun'
15375 d_semget='$d_semget'
15376 d_semop='$d_semop'
15377 d_setegid='$d_setegid'
15378 d_seteuid='$d_seteuid'
15379 d_setgrent='$d_setgrent'
15380 d_setgrps='$d_setgrps'
15381 d_sethent='$d_sethent'
15382 d_setlinebuf='$d_setlinebuf'
15383 d_setlocale='$d_setlocale'
15384 d_setnent='$d_setnent'
15385 d_setpent='$d_setpent'
15386 d_setpgid='$d_setpgid'
15387 d_setpgrp2='$d_setpgrp2'
15388 d_setpgrp='$d_setpgrp'
15389 d_setprior='$d_setprior'
15390 d_setpwent='$d_setpwent'
15391 d_setregid='$d_setregid'
15392 d_setresgid='$d_setresgid'
15393 d_setresuid='$d_setresuid'
15394 d_setreuid='$d_setreuid'
15395 d_setrgid='$d_setrgid'
15396 d_setruid='$d_setruid'
15397 d_setsent='$d_setsent'
15398 d_setsid='$d_setsid'
15399 d_setspent='$d_setspent'
15400 d_setvbuf='$d_setvbuf'
15401 d_sfio='$d_sfio'
15402 d_shm='$d_shm'
15403 d_shmat='$d_shmat'
15404 d_shmatprototype='$d_shmatprototype'
15405 d_shmctl='$d_shmctl'
15406 d_shmdt='$d_shmdt'
15407 d_shmget='$d_shmget'
15408 d_sigaction='$d_sigaction'
15409 d_sigsetjmp='$d_sigsetjmp'
15410 d_socket='$d_socket'
15411 d_socklen_t='$d_socklen_t'
15412 d_sockpair='$d_sockpair'
15413 d_sqrtl='$d_sqrtl'
15414 d_statblks='$d_statblks'
15415 d_statfs_f_flags='$d_statfs_f_flags'
15416 d_statfs_s='$d_statfs_s'
15417 d_statvfs='$d_statvfs'
15418 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15419 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15420 d_stdio_stream_array='$d_stdio_stream_array'
15421 d_stdiobase='$d_stdiobase'
15422 d_stdstdio='$d_stdstdio'
15423 d_strchr='$d_strchr'
15424 d_strcoll='$d_strcoll'
15425 d_strctcpy='$d_strctcpy'
15426 d_strerrm='$d_strerrm'
15427 d_strerror='$d_strerror'
15428 d_strtod='$d_strtod'
15429 d_strtol='$d_strtol'
15430 d_strtold='$d_strtold'
15431 d_strtoll='$d_strtoll'
15432 d_strtoul='$d_strtoul'
15433 d_strtoull='$d_strtoull'
15434 d_strtouq='$d_strtouq'
15435 d_strxfrm='$d_strxfrm'
15436 d_suidsafe='$d_suidsafe'
15437 d_symlink='$d_symlink'
15438 d_syscall='$d_syscall'
15439 d_sysconf='$d_sysconf'
15440 d_sysernlst='$d_sysernlst'
15441 d_syserrlst='$d_syserrlst'
15442 d_system='$d_system'
15443 d_tcgetpgrp='$d_tcgetpgrp'
15444 d_tcsetpgrp='$d_tcsetpgrp'
15445 d_telldir='$d_telldir'
15446 d_telldirproto='$d_telldirproto'
15447 d_time='$d_time'
15448 d_times='$d_times'
15449 d_truncate='$d_truncate'
15450 d_tzname='$d_tzname'
15451 d_umask='$d_umask'
15452 d_uname='$d_uname'
15453 d_union_semun='$d_union_semun'
15454 d_ustat='$d_ustat'
15455 d_vendorarch='$d_vendorarch'
15456 d_vendorbin='$d_vendorbin'
15457 d_vendorlib='$d_vendorlib'
15458 d_vfork='$d_vfork'
15459 d_void_closedir='$d_void_closedir'
15460 d_voidsig='$d_voidsig'
15461 d_voidtty='$d_voidtty'
15462 d_volatile='$d_volatile'
15463 d_vprintf='$d_vprintf'
15464 d_wait4='$d_wait4'
15465 d_waitpid='$d_waitpid'
15466 d_wcstombs='$d_wcstombs'
15467 d_wctomb='$d_wctomb'
15468 d_xenix='$d_xenix'
15469 date='$date'
15470 db_hashtype='$db_hashtype'
15471 db_prefixtype='$db_prefixtype'
15472 defvoidused='$defvoidused'
15473 direntrytype='$direntrytype'
15474 dlext='$dlext'
15475 dlsrc='$dlsrc'
15476 doublesize='$doublesize'
15477 drand01='$drand01'
15478 dynamic_ext='$dynamic_ext'
15479 eagain='$eagain'
15480 ebcdic='$ebcdic'
15481 echo='$echo'
15482 egrep='$egrep'
15483 emacs='$emacs'
15484 eunicefix='$eunicefix'
15485 exe_ext='$exe_ext'
15486 expr='$expr'
15487 extensions='$extensions'
15488 fflushNULL='$fflushNULL'
15489 fflushall='$fflushall'
15490 find='$find'
15491 firstmakefile='$firstmakefile'
15492 flex='$flex'
15493 fpossize='$fpossize'
15494 fpostype='$fpostype'
15495 freetype='$freetype'
15496 full_ar='$full_ar'
15497 full_csh='$full_csh'
15498 full_sed='$full_sed'
15499 gccversion='$gccversion'
15500 gidformat='$gidformat'
15501 gidsign='$gidsign'
15502 gidsize='$gidsize'
15503 gidtype='$gidtype'
15504 glibpth='$glibpth'
15505 grep='$grep'
15506 groupcat='$groupcat'
15507 groupstype='$groupstype'
15508 gzip='$gzip'
15509 h_fcntl='$h_fcntl'
15510 h_sysfile='$h_sysfile'
15511 hint='$hint'
15512 hostcat='$hostcat'
15513 huge='$huge'
15514 i16size='$i16size'
15515 i16type='$i16type'
15516 i32size='$i32size'
15517 i32type='$i32type'
15518 i64size='$i64size'
15519 i64type='$i64type'
15520 i8size='$i8size'
15521 i8type='$i8type'
15522 i_arpainet='$i_arpainet'
15523 i_bsdioctl='$i_bsdioctl'
15524 i_db='$i_db'
15525 i_dbm='$i_dbm'
15526 i_dirent='$i_dirent'
15527 i_dld='$i_dld'
15528 i_dlfcn='$i_dlfcn'
15529 i_fcntl='$i_fcntl'
15530 i_float='$i_float'
15531 i_gdbm='$i_gdbm'
15532 i_grp='$i_grp'
15533 i_iconv='$i_iconv'
15534 i_ieeefp='$i_ieeefp'
15535 i_inttypes='$i_inttypes'
15536 i_limits='$i_limits'
15537 i_locale='$i_locale'
15538 i_machcthr='$i_machcthr'
15539 i_malloc='$i_malloc'
15540 i_math='$i_math'
15541 i_memory='$i_memory'
15542 i_mntent='$i_mntent'
15543 i_ndbm='$i_ndbm'
15544 i_netdb='$i_netdb'
15545 i_neterrno='$i_neterrno'
15546 i_netinettcp='$i_netinettcp'
15547 i_niin='$i_niin'
15548 i_poll='$i_poll'
15549 i_pthread='$i_pthread'
15550 i_pwd='$i_pwd'
15551 i_rpcsvcdbm='$i_rpcsvcdbm'
15552 i_sfio='$i_sfio'
15553 i_sgtty='$i_sgtty'
15554 i_shadow='$i_shadow'
15555 i_socks='$i_socks'
15556 i_stdarg='$i_stdarg'
15557 i_stddef='$i_stddef'
15558 i_stdlib='$i_stdlib'
15559 i_string='$i_string'
15560 i_sunmath='$i_sunmath'
15561 i_sysaccess='$i_sysaccess'
15562 i_sysdir='$i_sysdir'
15563 i_sysfile='$i_sysfile'
15564 i_sysfilio='$i_sysfilio'
15565 i_sysin='$i_sysin'
15566 i_sysioctl='$i_sysioctl'
15567 i_syslog='$i_syslog'
15568 i_sysmman='$i_sysmman'
15569 i_sysmode='$i_sysmode'
15570 i_sysmount='$i_sysmount'
15571 i_sysndir='$i_sysndir'
15572 i_sysparam='$i_sysparam'
15573 i_sysresrc='$i_sysresrc'
15574 i_syssecrt='$i_syssecrt'
15575 i_sysselct='$i_sysselct'
15576 i_syssockio='$i_syssockio'
15577 i_sysstat='$i_sysstat'
15578 i_sysstatfs='$i_sysstatfs'
15579 i_sysstatvfs='$i_sysstatvfs'
15580 i_systime='$i_systime'
15581 i_systimek='$i_systimek'
15582 i_systimes='$i_systimes'
15583 i_systypes='$i_systypes'
15584 i_sysuio='$i_sysuio'
15585 i_sysun='$i_sysun'
15586 i_sysutsname='$i_sysutsname'
15587 i_sysvfs='$i_sysvfs'
15588 i_syswait='$i_syswait'
15589 i_termio='$i_termio'
15590 i_termios='$i_termios'
15591 i_time='$i_time'
15592 i_unistd='$i_unistd'
15593 i_ustat='$i_ustat'
15594 i_utime='$i_utime'
15595 i_values='$i_values'
15596 i_varargs='$i_varargs'
15597 i_varhdr='$i_varhdr'
15598 i_vfork='$i_vfork'
15599 ignore_versioned_solibs='$ignore_versioned_solibs'
15600 inc_version_list='$inc_version_list'
15601 inc_version_list_init='$inc_version_list_init'
15602 incpath='$incpath'
15603 inews='$inews'
15604 installarchlib='$installarchlib'
15605 installbin='$installbin'
15606 installman1dir='$installman1dir'
15607 installman3dir='$installman3dir'
15608 installprefix='$installprefix'
15609 installprefixexp='$installprefixexp'
15610 installprivlib='$installprivlib'
15611 installscript='$installscript'
15612 installsitearch='$installsitearch'
15613 installsitebin='$installsitebin'
15614 installsitelib='$installsitelib'
15615 installstyle='$installstyle'
15616 installusrbinperl='$installusrbinperl'
15617 installvendorarch='$installvendorarch'
15618 installvendorbin='$installvendorbin'
15619 installvendorlib='$installvendorlib'
15620 intsize='$intsize'
15621 ivdformat='$ivdformat'
15622 ivsize='$ivsize'
15623 ivtype='$ivtype'
15624 known_extensions='$known_extensions'
15625 ksh='$ksh'
15626 large='$large'
15627 ld='$ld'
15628 lddlflags='$lddlflags'
15629 ldflags='$ldflags'
15630 ldlibpthname='$ldlibpthname'
15631 less='$less'
15632 lib_ext='$lib_ext'
15633 libc='$libc'
15634 libperl='$libperl'
15635 libpth='$libpth'
15636 libs='$libs'
15637 libsdirs='$libsdirs'
15638 libsfiles='$libsfiles'
15639 libsfound='$libsfound'
15640 libspath='$libspath'
15641 libswanted='$libswanted'
15642 line='$line'
15643 lint='$lint'
15644 lkflags='$lkflags'
15645 ln='$ln'
15646 lns='$lns'
15647 locincpth='$locincpth'
15648 loclibpth='$loclibpth'
15649 longdblsize='$longdblsize'
15650 longlongsize='$longlongsize'
15651 longsize='$longsize'
15652 lp='$lp'
15653 lpr='$lpr'
15654 ls='$ls'
15655 lseeksize='$lseeksize'
15656 lseektype='$lseektype'
15657 mail='$mail'
15658 mailx='$mailx'
15659 make='$make'
15660 make_set_make='$make_set_make'
15661 mallocobj='$mallocobj'
15662 mallocsrc='$mallocsrc'
15663 malloctype='$malloctype'
15664 man1dir='$man1dir'
15665 man1direxp='$man1direxp'
15666 man1ext='$man1ext'
15667 man3dir='$man3dir'
15668 man3direxp='$man3direxp'
15669 man3ext='$man3ext'
15670 medium='$medium'
15671 mips_type='$mips_type'
15672 mkdir='$mkdir'
15673 mmaptype='$mmaptype'
15674 models='$models'
15675 modetype='$modetype'
15676 more='$more'
15677 multiarch='$multiarch'
15678 mv='$mv'
15679 myarchname='$myarchname'
15680 mydomain='$mydomain'
15681 myhostname='$myhostname'
15682 myuname='$myuname'
15683 n='$n'
15684 netdb_hlen_type='$netdb_hlen_type'
15685 netdb_host_type='$netdb_host_type'
15686 netdb_name_type='$netdb_name_type'
15687 netdb_net_type='$netdb_net_type'
15688 nm='$nm'
15689 nm_opt='$nm_opt'
15690 nm_so_opt='$nm_so_opt'
15691 nonxs_ext='$nonxs_ext'
15692 nroff='$nroff'
15693 nvsize='$nvsize'
15694 nvtype='$nvtype'
15695 o_nonblock='$o_nonblock'
15696 obj_ext='$obj_ext'
15697 old_pthread_create_joinable='$old_pthread_create_joinable'
15698 optimize='$optimize'
15699 orderlib='$orderlib'
15700 osname='$osname'
15701 osvers='$osvers'
15702 otherlibdirs='$otherlibdirs'
15703 package='$package'
15704 pager='$pager'
15705 passcat='$passcat'
15706 patchlevel='$patchlevel'
15707 path_sep='$path_sep'
15708 perl5='$perl5'
15709 perl='$perl'
15710 perladmin='$perladmin'
15711 perlpath='$perlpath'
15712 pg='$pg'
15713 phostname='$phostname'
15714 pidtype='$pidtype'
15715 plibpth='$plibpth'
15716 pm_apiversion='$pm_apiversion'
15717 pmake='$pmake'
15718 pr='$pr'
15719 prefix='$prefix'
15720 prefixexp='$prefixexp'
15721 privlib='$privlib'
15722 privlibexp='$privlibexp'
15723 prototype='$prototype'
15724 ptrsize='$ptrsize'
15725 quadkind='$quadkind'
15726 quadtype='$quadtype'
15727 randbits='$randbits'
15728 randfunc='$randfunc'
15729 randseedtype='$randseedtype'
15730 ranlib='$ranlib'
15731 rd_nodata='$rd_nodata'
15732 revision='$revision'
15733 rm='$rm'
15734 rmail='$rmail'
15735 runnm='$runnm'
15736 sPRIEldbl='$sPRIEldbl'
15737 sPRIFldbl='$sPRIFldbl'
15738 sPRIGldbl='$sPRIGldbl'
15739 sPRIX64='$sPRIX64'
15740 sPRId64='$sPRId64'
15741 sPRIeldbl='$sPRIeldbl'
15742 sPRIfldbl='$sPRIfldbl'
15743 sPRIgldbl='$sPRIgldbl'
15744 sPRIi64='$sPRIi64'
15745 sPRIo64='$sPRIo64'
15746 sPRIu64='$sPRIu64'
15747 sPRIx64='$sPRIx64'
15748 sched_yield='$sched_yield'
15749 scriptdir='$scriptdir'
15750 scriptdirexp='$scriptdirexp'
15751 sed='$sed'
15752 seedfunc='$seedfunc'
15753 selectminbits='$selectminbits'
15754 selecttype='$selecttype'
15755 sendmail='$sendmail'
15756 sh='$sh'
15757 shar='$shar'
15758 sharpbang='$sharpbang'
15759 shmattype='$shmattype'
15760 shortsize='$shortsize'
15761 shrpenv='$shrpenv'
15762 shsharp='$shsharp'
15763 sig_count='$sig_count'
15764 sig_name='$sig_name'
15765 sig_name_init='$sig_name_init'
15766 sig_num='$sig_num'
15767 sig_num_init='$sig_num_init'
15768 signal_t='$signal_t'
15769 sitearch='$sitearch'
15770 sitearchexp='$sitearchexp'
15771 sitebin='$sitebin'
15772 sitebinexp='$sitebinexp'
15773 sitelib='$sitelib'
15774 sitelib_stem='$sitelib_stem'
15775 sitelibexp='$sitelibexp'
15776 siteprefix='$siteprefix'
15777 siteprefixexp='$siteprefixexp'
15778 sizesize='$sizesize'
15779 sizetype='$sizetype'
15780 sleep='$sleep'
15781 smail='$smail'
15782 small='$small'
15783 so='$so'
15784 sockethdr='$sockethdr'
15785 socketlib='$socketlib'
15786 socksizetype='$socksizetype'
15787 sort='$sort'
15788 spackage='$spackage'
15789 spitshell='$spitshell'
15790 split='$split'
15791 src='$src'
15792 ssizetype='$ssizetype'
15793 startperl='$startperl'
15794 startsh='$startsh'
15795 static_ext='$static_ext'
15796 stdchar='$stdchar'
15797 stdio_base='$stdio_base'
15798 stdio_bufsiz='$stdio_bufsiz'
15799 stdio_cnt='$stdio_cnt'
15800 stdio_filbuf='$stdio_filbuf'
15801 stdio_ptr='$stdio_ptr'
15802 stdio_stream_array='$stdio_stream_array'
15803 strings='$strings'
15804 submit='$submit'
15805 subversion='$subversion'
15806 sysman='$sysman'
15807 tail='$tail'
15808 tar='$tar'
15809 tbl='$tbl'
15810 tee='$tee'
15811 test='$test'
15812 timeincl='$timeincl'
15813 timetype='$timetype'
15814 touch='$touch'
15815 tr='$tr'
15816 trnl='$trnl'
15817 troff='$troff'
15818 u16size='$u16size'
15819 u16type='$u16type'
15820 u32size='$u32size'
15821 u32type='$u32type'
15822 u64size='$u64size'
15823 u64type='$u64type'
15824 u8size='$u8size'
15825 u8type='$u8type'
15826 uidformat='$uidformat'
15827 uidsign='$uidsign'
15828 uidsize='$uidsize'
15829 uidtype='$uidtype'
15830 uname='$uname'
15831 uniq='$uniq'
15832 uquadtype='$uquadtype'
15833 use5005threads='$use5005threads'
15834 use64bitall='$use64bitall'
15835 use64bitint='$use64bitint'
15836 usedl='$usedl'
15837 useithreads='$useithreads'
15838 uselargefiles='$uselargefiles'
15839 uselongdouble='$uselongdouble'
15840 usemorebits='$usemorebits'
15841 usemultiplicity='$usemultiplicity'
15842 usemymalloc='$usemymalloc'
15843 usenm='$usenm'
15844 useopcode='$useopcode'
15845 useperlio='$useperlio'
15846 useposix='$useposix'
15847 usesfio='$usesfio'
15848 useshrplib='$useshrplib'
15849 usesocks='$usesocks'
15850 usethreads='$usethreads'
15851 usevendorprefix='$usevendorprefix'
15852 usevfork='$usevfork'
15853 usrinc='$usrinc'
15854 uuname='$uuname'
15855 uvoformat='$uvoformat'
15856 uvsize='$uvsize'
15857 uvtype='$uvtype'
15858 uvuformat='$uvuformat'
15859 uvxformat='$uvxformat'
15860 vendorarch='$vendorarch'
15861 vendorarchexp='$vendorarchexp'
15862 vendorbin='$vendorbin'
15863 vendorbinexp='$vendorbinexp'
15864 vendorlib='$vendorlib'
15865 vendorlib_stem='$vendorlib_stem'
15866 vendorlibexp='$vendorlibexp'
15867 vendorprefix='$vendorprefix'
15868 vendorprefixexp='$vendorprefixexp'
15869 version='$version'
15870 vi='$vi'
15871 voidflags='$voidflags'
15872 xlibpth='$xlibpth'
15873 xs_apiversion='$xs_apiversion'
15874 zcat='$zcat'
15875 zip='$zip'
15876 EOT
15877
15878 : Add in command line options if available
15879 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15880
15881 : add special variables
15882 $test -f $src/patchlevel.h && \
15883 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15884 echo "CONFIGDOTSH=true" >>config.sh
15885
15886 : propagate old symbols
15887 if $test -f UU/config.sh; then
15888         <UU/config.sh sort | uniq >UU/oldconfig.sh
15889         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15890         sort | uniq -u >UU/oldsyms
15891         set X `cat UU/oldsyms`
15892         shift
15893         case $# in
15894         0) ;;
15895         *)
15896                 cat <<EOM
15897 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15898 EOM
15899                 echo "# Variables propagated from previous config.sh file." >>config.sh
15900                 for sym in `cat UU/oldsyms`; do
15901                         echo "    Propagating $hint variable "'$'"$sym..."
15902                         eval 'tmp="$'"${sym}"'"'
15903                         echo "$tmp" | \
15904                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15905                 done
15906                 ;;
15907         esac
15908 fi
15909
15910 : Finish up by extracting the .SH files
15911 case "$alldone" in
15912 exit)
15913         $rm -rf UU
15914         echo "Done."
15915         exit 0
15916         ;;
15917 cont)
15918         ;;
15919 '')
15920         dflt=''
15921         nostick=true
15922         $cat <<EOM
15923
15924 If you'd like to make any changes to the config.sh file before I begin
15925 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15926
15927 EOM
15928         rp="Press return or use a shell escape to edit config.sh:"
15929         . UU/myread
15930         nostick=''
15931         case "$ans" in
15932         '') ;;
15933         *) : in case they cannot read
15934                 sh 1>&4 -c "$ans";;
15935         esac
15936         ;;
15937 esac
15938
15939 : if this fails, just run all the .SH files by hand
15940 . ./config.sh
15941
15942 echo " "
15943 exec 1>&4
15944 . ./UU/extract
15945
15946 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15947         dflt=y
15948         case "$silent" in
15949         true) ;;
15950         *)
15951                 $cat <<EOM
15952
15953 Now you need to generate make dependencies by running "$make depend".
15954 You might prefer to run it in background: "$make depend > makedepend.out &"
15955 It can take a while, so you might not want to run it right now.
15956
15957 EOM
15958                 ;;
15959         esac
15960         rp="Run $make depend now?"
15961         . UU/myread
15962         case "$ans" in
15963         y*)
15964                 $make depend && echo "Now you must run a $make."
15965                 ;;
15966         *)
15967                 echo "You must run '$make depend' then '$make'."
15968                 ;;
15969         esac
15970 elif test -f [Mm]akefile; then
15971         echo " "
15972         echo "Now you must run a $make."
15973 else
15974         echo "Done."
15975 fi
15976
15977 if $test -f Policy.sh; then
15978     $cat <<EOM
15979
15980 If you compile $package on a different machine or from a different object
15981 directory, copy the Policy.sh file from this object directory to the
15982 new one before you run Configure -- this will help you with most of
15983 the policy defaults.
15984
15985 EOM
15986 fi
15987 if $test -f config.msg; then
15988     echo "Hmm.  I also noted the following information while running:"
15989     echo " "
15990     $cat config.msg >&4
15991     $rm -f config.msg
15992 fi
15993 $rm -f kit*isdone ark*isdone
15994 $rm -rf UU
15995
15996 : End of Configure
15997