Allow (displaying and) re-editing the Subject in perlbug.
[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 Sat Jun 23 17:56:36 EET DST 2001 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 from=''
169 run=''
170 targetarch=''
171 to=''
172 usecrosscompile=''
173 perllibs=''
174 dynamic_ext=''
175 extensions=''
176 known_extensions=''
177 nonxs_ext=''
178 static_ext=''
179 useopcode=''
180 useposix=''
181 d_bsd=''
182 d_eunice=''
183 d_xenix=''
184 eunicefix=''
185 Mcc=''
186 ar=''
187 awk=''
188 bash=''
189 bison=''
190 byacc=''
191 cat=''
192 chgrp=''
193 chmod=''
194 chown=''
195 comm=''
196 compress=''
197 cp=''
198 cpio=''
199 cpp=''
200 csh=''
201 date=''
202 echo=''
203 egrep=''
204 emacs=''
205 expr=''
206 find=''
207 flex=''
208 grep=''
209 gzip=''
210 inews=''
211 ksh=''
212 less=''
213 line=''
214 lint=''
215 ln=''
216 lp=''
217 lpr=''
218 ls=''
219 mail=''
220 mailx=''
221 make=''
222 mkdir=''
223 more=''
224 mv=''
225 nm=''
226 nroff=''
227 perl=''
228 pg=''
229 pmake=''
230 pr=''
231 rm=''
232 rmail=''
233 sed=''
234 sendmail=''
235 shar=''
236 sleep=''
237 smail=''
238 sort=''
239 submit=''
240 tail=''
241 tar=''
242 tbl=''
243 tee=''
244 test=''
245 touch=''
246 tr=''
247 troff=''
248 uname=''
249 uniq=''
250 uuname=''
251 vi=''
252 zcat=''
253 zip=''
254 full_ar=''
255 full_sed=''
256 libswanted=''
257 hint=''
258 myuname=''
259 osname=''
260 osvers=''
261 Author=''
262 Date=''
263 Header=''
264 Id=''
265 Locker=''
266 Log=''
267 RCSfile=''
268 Revision=''
269 Source=''
270 State=''
271 _a=''
272 _exe=''
273 _o=''
274 archobjs=''
275 exe_ext=''
276 firstmakefile=''
277 lib_ext=''
278 obj_ext=''
279 path_sep=''
280 afs=''
281 afsroot=''
282 alignbytes=''
283 ansi2knr=''
284 archlib=''
285 archlibexp=''
286 d_archlib=''
287 installarchlib=''
288 archname=''
289 myarchname=''
290 d_atolf=''
291 d_atoll=''
292 baserev=''
293 bin=''
294 binexp=''
295 installbin=''
296 bincompat5005=''
297 d_bincompat5005=''
298 byteorder=''
299 cc=''
300 ccflags=''
301 cppflags=''
302 ldflags=''
303 lkflags=''
304 locincpth=''
305 optimize=''
306 cf_email=''
307 cf_by=''
308 cf_time=''
309 charsize=''
310 contains=''
311 cpp_stuff=''
312 cpplast=''
313 cppminus=''
314 cpprun=''
315 cppstdin=''
316 d__fwalk=''
317 d_access=''
318 d_accessx=''
319 d_alarm=''
320 d_attribut=''
321 d_bcmp=''
322 d_bcopy=''
323 d_bzero=''
324 d_casti32=''
325 castflags=''
326 d_castneg=''
327 d_chown=''
328 d_chroot=''
329 d_chsize=''
330 d_closedir=''
331 d_void_closedir=''
332 d_cmsghdr_s=''
333 d_const=''
334 cryptlib=''
335 d_crypt=''
336 d_csh=''
337 full_csh=''
338 d_cuserid=''
339 d_dbl_dig=''
340 d_dbminitproto=''
341 d_difftime=''
342 d_dlerror=''
343 d_dlopen=''
344 d_dlsymun=''
345 d_dosuid=''
346 d_suidsafe=''
347 d_drand48proto=''
348 d_dup2=''
349 d_eaccess=''
350 d_endgrent=''
351 d_endhent=''
352 d_endnent=''
353 d_endpent=''
354 d_endpwent=''
355 d_endsent=''
356 d_fchdir=''
357 d_fchmod=''
358 d_fchown=''
359 d_fcntl=''
360 d_fcntl_can_lock=''
361 d_fd_macros=''
362 d_fd_set=''
363 d_fds_bits=''
364 d_fgetpos=''
365 d_flexfnam=''
366 d_flock=''
367 d_flockproto=''
368 d_fork=''
369 d_fpos64_t=''
370 d_frexpl=''
371 d_fs_data_s=''
372 d_fseeko=''
373 d_fsetpos=''
374 d_fstatfs=''
375 d_fsync=''
376 d_ftello=''
377 d_ftime=''
378 d_gettimeod=''
379 d_Gconvert=''
380 d_getcwd=''
381 d_getespwnam=''
382 d_getfsstat=''
383 d_getgrent=''
384 d_getgrps=''
385 d_gethbyaddr=''
386 d_gethbyname=''
387 d_gethent=''
388 aphostname=''
389 d_gethname=''
390 d_phostname=''
391 d_uname=''
392 d_gethostprotos=''
393 d_getitimer=''
394 d_getlogin=''
395 d_getmnt=''
396 d_getmntent=''
397 d_getnbyaddr=''
398 d_getnbyname=''
399 d_getnent=''
400 d_getnetprotos=''
401 d_getpagsz=''
402 d_getpent=''
403 d_getpgid=''
404 d_getpgrp2=''
405 d_bsdgetpgrp=''
406 d_getpgrp=''
407 d_getppid=''
408 d_getprior=''
409 d_getpbyname=''
410 d_getpbynumber=''
411 d_getprotoprotos=''
412 d_getprpwnam=''
413 d_getpwent=''
414 d_getsent=''
415 d_getservprotos=''
416 d_getspnam=''
417 d_getsbyname=''
418 d_getsbyport=''
419 d_gnulibc=''
420 d_hasmntopt=''
421 d_htonl=''
422 d_iconv=''
423 d_inetaton=''
424 d_int64_t=''
425 d_isascii=''
426 d_isnan=''
427 d_isnanl=''
428 d_killpg=''
429 d_lchown=''
430 d_ldbl_dig=''
431 d_link=''
432 d_locconv=''
433 d_lockf=''
434 d_longdbl=''
435 longdblsize=''
436 d_longlong=''
437 longlongsize=''
438 d_lseekproto=''
439 d_lstat=''
440 d_madvise=''
441 d_mblen=''
442 d_mbstowcs=''
443 d_mbtowc=''
444 d_memchr=''
445 d_memcmp=''
446 d_memcpy=''
447 d_memmove=''
448 d_memset=''
449 d_mkdir=''
450 d_mkdtemp=''
451 d_mkfifo=''
452 d_mkstemp=''
453 d_mkstemps=''
454 d_mktime=''
455 d_mmap=''
456 mmaptype=''
457 d_modfl=''
458 d_modfl_pow32_bug=''
459 d_mprotect=''
460 d_msg=''
461 d_msgctl=''
462 d_msgget=''
463 d_msghdr_s=''
464 d_msgrcv=''
465 d_msgsnd=''
466 d_msync=''
467 d_munmap=''
468 d_nice=''
469 d_off64_t=''
470 d_open3=''
471 d_fpathconf=''
472 d_pathconf=''
473 d_pause=''
474 d_pipe=''
475 d_poll=''
476 d_portable=''
477 d_old_pthread_create_joinable=''
478 old_pthread_create_joinable=''
479 d_pthread_yield=''
480 d_sched_yield=''
481 sched_yield=''
482 d_qgcvt=''
483 d_readdir=''
484 d_rewinddir=''
485 d_seekdir=''
486 d_telldir=''
487 d_readlink=''
488 d_readv=''
489 d_recvmsg=''
490 d_rename=''
491 d_rmdir=''
492 d_safebcpy=''
493 d_safemcpy=''
494 d_sanemcmp=''
495 d_sbrkproto=''
496 d_select=''
497 d_sem=''
498 d_semctl=''
499 d_semget=''
500 d_semop=''
501 d_sendmsg=''
502 d_setegid=''
503 d_seteuid=''
504 d_setgrent=''
505 d_setgrps=''
506 d_sethent=''
507 d_setitimer=''
508 d_setlinebuf=''
509 d_setlocale=''
510 d_setnent=''
511 d_setpent=''
512 d_setpgid=''
513 d_setpgrp2=''
514 d_bsdsetpgrp=''
515 d_setpgrp=''
516 d_setprior=''
517 d_setproctitle=''
518 d_setpwent=''
519 d_setregid=''
520 d_setresgid=''
521 d_setresuid=''
522 d_setreuid=''
523 d_setrgid=''
524 d_setruid=''
525 d_setsent=''
526 d_setsid=''
527 d_setvbuf=''
528 d_sfio=''
529 usesfio=''
530 d_shm=''
531 d_shmat=''
532 d_shmatprototype=''
533 shmattype=''
534 d_shmctl=''
535 d_shmdt=''
536 d_shmget=''
537 d_sigaction=''
538 d_sigprocmask=''
539 d_sigsetjmp=''
540 d_sockatmark=''
541 d_sockatmarkproto=''
542 d_msg_ctrunc=''
543 d_msg_dontroute=''
544 d_msg_oob=''
545 d_msg_peek=''
546 d_msg_proxy=''
547 d_oldsock=''
548 d_scm_rights=''
549 d_socket=''
550 d_sockpair=''
551 sockethdr=''
552 socketlib=''
553 d_socklen_t=''
554 d_socks5_init=''
555 d_sqrtl=''
556 d_sresgproto=''
557 d_sresuproto=''
558 d_statblks=''
559 d_statfs_f_flags=''
560 d_statfs_s=''
561 d_fstatvfs=''
562 d_statvfs=''
563 d_stdio_cnt_lval=''
564 d_stdio_ptr_lval=''
565 d_stdio_ptr_lval_nochange_cnt=''
566 d_stdio_ptr_lval_sets_cnt=''
567 d_stdiobase=''
568 d_stdstdio=''
569 stdio_base=''
570 stdio_bufsiz=''
571 stdio_cnt=''
572 stdio_filbuf=''
573 stdio_ptr=''
574 d_index=''
575 d_strchr=''
576 d_strcoll=''
577 d_strctcpy=''
578 d_strerrm=''
579 d_strerror=''
580 d_sysernlst=''
581 d_syserrlst=''
582 d_strftime=''
583 d_strtod=''
584 d_strtol=''
585 d_strtold=''
586 d_strtoll=''
587 d_strtoq=''
588 d_strtoul=''
589 d_strtoull=''
590 d_strtouq=''
591 d_strxfrm=''
592 d_symlink=''
593 d_syscall=''
594 d_syscallproto=''
595 d_sysconf=''
596 d_system=''
597 d_tcgetpgrp=''
598 d_tcsetpgrp=''
599 d_telldirproto=''
600 d_time=''
601 timetype=''
602 clocktype=''
603 d_times=''
604 d_truncate=''
605 d_tzname=''
606 d_u32align=''
607 d_ualarm=''
608 d_umask=''
609 d_semctl_semid_ds=''
610 d_semctl_semun=''
611 d_union_semun=''
612 d_usleep=''
613 d_usleepproto=''
614 d_ustat=''
615 d_vfork=''
616 usevfork=''
617 d_voidsig=''
618 signal_t=''
619 d_volatile=''
620 d_charvspr=''
621 d_vprintf=''
622 d_wait4=''
623 d_waitpid=''
624 d_wcstombs=''
625 d_wctomb=''
626 d_writev=''
627 dlext=''
628 cccdlflags=''
629 ccdlflags=''
630 dlsrc=''
631 ld=''
632 lddlflags=''
633 usedl=''
634 doublesize=''
635 ebcdic=''
636 fflushNULL=''
637 fflushall=''
638 fpossize=''
639 fpostype=''
640 gccosandvers=''
641 gccversion=''
642 gidformat=''
643 gidsign=''
644 gidsize=''
645 gidtype=''
646 groupstype=''
647 h_fcntl=''
648 h_sysfile=''
649 i_arpainet=''
650 db_hashtype=''
651 db_prefixtype=''
652 db_version_major=''
653 db_version_minor=''
654 db_version_patch=''
655 i_db=''
656 i_dbm=''
657 i_rpcsvcdbm=''
658 d_dirnamlen=''
659 direntrytype=''
660 i_dirent=''
661 i_dld=''
662 i_dlfcn=''
663 i_fcntl=''
664 i_float=''
665 i_gdbm=''
666 d_grpasswd=''
667 i_grp=''
668 i_iconv=''
669 i_ieeefp=''
670 i_inttypes=''
671 i_libutil=''
672 i_limits=''
673 i_locale=''
674 i_machcthr=''
675 i_malloc=''
676 i_math=''
677 i_memory=''
678 i_mntent=''
679 i_ndbm=''
680 i_netdb=''
681 i_neterrno=''
682 i_netinettcp=''
683 i_niin=''
684 i_sysin=''
685 i_poll=''
686 i_prot=''
687 i_pthread=''
688 d_pwage=''
689 d_pwchange=''
690 d_pwclass=''
691 d_pwcomment=''
692 d_pwexpire=''
693 d_pwgecos=''
694 d_pwpasswd=''
695 d_pwquota=''
696 i_pwd=''
697 i_sfio=''
698 i_shadow=''
699 i_socks=''
700 i_stddef=''
701 i_stdlib=''
702 i_string=''
703 strings=''
704 i_sunmath=''
705 i_sysaccess=''
706 i_sysdir=''
707 i_sysfile=''
708 d_voidtty=''
709 i_bsdioctl=''
710 i_sysfilio=''
711 i_sysioctl=''
712 i_syssockio=''
713 i_syslog=''
714 i_sysmman=''
715 i_sysmode=''
716 i_sysmount=''
717 i_sysndir=''
718 i_sysparam=''
719 i_sysresrc=''
720 i_syssecrt=''
721 i_sysselct=''
722 i_sysstat=''
723 i_sysstatfs=''
724 i_sysstatvfs=''
725 i_systimes=''
726 i_systypes=''
727 i_sysuio=''
728 i_sysun=''
729 i_sysutsname=''
730 i_sysvfs=''
731 i_syswait=''
732 i_sgtty=''
733 i_termio=''
734 i_termios=''
735 i_systime=''
736 i_systimek=''
737 i_time=''
738 timeincl=''
739 i_unistd=''
740 i_ustat=''
741 i_utime=''
742 i_values=''
743 i_stdarg=''
744 i_varargs=''
745 i_varhdr=''
746 i_vfork=''
747 inc_version_list=''
748 inc_version_list_init=''
749 installprefix=''
750 installprefixexp=''
751 installstyle=''
752 installusrbinperl=''
753 intsize=''
754 longsize=''
755 shortsize=''
756 issymlink=''
757 libc=''
758 ldlibpthname=''
759 libperl=''
760 shrpenv=''
761 useshrplib=''
762 glibpth=''
763 libpth=''
764 loclibpth=''
765 plibpth=''
766 xlibpth=''
767 ignore_versioned_solibs=''
768 libs=''
769 libsdirs=''
770 libsfiles=''
771 libsfound=''
772 libspath=''
773 lns=''
774 d_PRIEUldbl=''
775 d_PRIFUldbl=''
776 d_PRIGUldbl=''
777 d_PRIeldbl=''
778 d_PRIfldbl=''
779 d_PRIgldbl=''
780 d_SCNfldbl=''
781 sPRIEUldbl=''
782 sPRIFUldbl=''
783 sPRIGUldbl=''
784 sPRIeldbl=''
785 sPRIfldbl=''
786 sPRIgldbl=''
787 sSCNfldbl=''
788 lseeksize=''
789 lseektype=''
790 make_set_make=''
791 d_mymalloc=''
792 freetype=''
793 mallocobj=''
794 mallocsrc=''
795 malloctype=''
796 usemymalloc=''
797 installman1dir=''
798 man1dir=''
799 man1direxp=''
800 man1ext=''
801 installman3dir=''
802 man3dir=''
803 man3direxp=''
804 man3ext=''
805 modetype=''
806 multiarch=''
807 mydomain=''
808 myhostname=''
809 phostname=''
810 c=''
811 n=''
812 d_eofnblk=''
813 eagain=''
814 o_nonblock=''
815 rd_nodata=''
816 need_va_copy=''
817 netdb_hlen_type=''
818 netdb_host_type=''
819 netdb_name_type=''
820 netdb_net_type=''
821 groupcat=''
822 hostcat=''
823 passcat=''
824 orderlib=''
825 ranlib=''
826 d_perl_otherlibdirs=''
827 otherlibdirs=''
828 package=''
829 spackage=''
830 pager=''
831 api_revision=''
832 api_subversion=''
833 api_version=''
834 api_versionstring=''
835 patchlevel=''
836 perl_patchlevel=''
837 revision=''
838 subversion=''
839 version=''
840 perl5=''
841 perladmin=''
842 perlpath=''
843 d_nv_preserves_uv=''
844 d_nv_preserves_uv_bits=''
845 i16size=''
846 i16type=''
847 i32size=''
848 i32type=''
849 i64size=''
850 i64type=''
851 i8size=''
852 i8type=''
853 ivsize=''
854 ivtype=''
855 nvsize=''
856 nvtype=''
857 u16size=''
858 u16type=''
859 u32size=''
860 u32type=''
861 u64size=''
862 u64type=''
863 u8size=''
864 u8type=''
865 uvsize=''
866 uvtype=''
867 ivdformat=''
868 nvEUformat=''
869 nvFUformat=''
870 nvGUformat=''
871 nveformat=''
872 nvfformat=''
873 nvgformat=''
874 uvXUformat=''
875 uvoformat=''
876 uvuformat=''
877 uvxformat=''
878 pidtype=''
879 prefix=''
880 prefixexp=''
881 installprivlib=''
882 privlib=''
883 privlibexp=''
884 prototype=''
885 ptrsize=''
886 d_PRIXU64=''
887 d_PRId64=''
888 d_PRIi64=''
889 d_PRIo64=''
890 d_PRIu64=''
891 d_PRIx64=''
892 sPRIXU64=''
893 sPRId64=''
894 sPRIi64=''
895 sPRIo64=''
896 sPRIu64=''
897 sPRIx64=''
898 d_quad=''
899 quadkind=''
900 quadtype=''
901 uquadtype=''
902 drand01=''
903 randbits=''
904 randfunc=''
905 randseedtype=''
906 seedfunc=''
907 installscript=''
908 scriptdir=''
909 scriptdirexp=''
910 selectminbits=''
911 selecttype=''
912 sh=''
913 sig_count=''
914 sig_name=''
915 sig_name_init=''
916 sig_num=''
917 sig_num_init=''
918 sig_size=''
919 installsitearch=''
920 sitearch=''
921 sitearchexp=''
922 installsitebin=''
923 sitebin=''
924 sitebinexp=''
925 installsitelib=''
926 sitelib=''
927 sitelib_stem=''
928 sitelibexp=''
929 siteprefix=''
930 siteprefixexp=''
931 sizesize=''
932 sizetype=''
933 so=''
934 socksizetype=''
935 sharpbang=''
936 shsharp=''
937 spitshell=''
938 src=''
939 ssizetype=''
940 startperl=''
941 startsh=''
942 stdchar=''
943 d_stdio_stream_array=''
944 stdio_stream_array=''
945 sysman=''
946 trnl=''
947 uidformat=''
948 uidsign=''
949 uidsize=''
950 uidtype=''
951 archname64=''
952 use64bitall=''
953 use64bitint=''
954 ccflags_uselargefiles=''
955 ldflags_uselargefiles=''
956 libswanted_uselargefiles=''
957 uselargefiles=''
958 uselongdouble=''
959 usemorebits=''
960 usemultiplicity=''
961 nm_opt=''
962 nm_so_opt=''
963 runnm=''
964 usenm=''
965 useperlio=''
966 usesocks=''
967 d_oldpthreads=''
968 use5005threads=''
969 useithreads=''
970 usereentrant=''
971 usethreads=''
972 incpath=''
973 mips_type=''
974 usrinc=''
975 d_vendorarch=''
976 installvendorarch=''
977 vendorarch=''
978 vendorarchexp=''
979 d_vendorbin=''
980 installvendorbin=''
981 vendorbin=''
982 vendorbinexp=''
983 d_vendorlib=''
984 installvendorlib=''
985 vendorlib=''
986 vendorlib_stem=''
987 vendorlibexp=''
988 usevendorprefix=''
989 vendorprefix=''
990 vendorprefixexp=''
991 versiononly=''
992 defvoidused=''
993 voidflags=''
994 pm_apiversion=''
995 xs_apiversion=''
996 yacc=''
997 yaccflags=''
998 CONFIG=''
999
1000 define='define'
1001 undef='undef'
1002 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1003 rmlist=''
1004
1005 : We must find out about Eunice early
1006 eunicefix=':'
1007 if test -f /etc/unixtovms; then
1008         eunicefix=/etc/unixtovms
1009 fi
1010 if test -f /etc/unixtovms.exe; then
1011         eunicefix=/etc/unixtovms.exe
1012 fi
1013
1014 i_whoami=''
1015 ccname=''
1016 ccversion=''
1017 perllibs=''
1018 : set useposix=false in your hint file to disable the POSIX extension.
1019 useposix=true
1020 : set useopcode=false in your hint file to disable the Opcode extension.
1021 useopcode=true
1022 : Trailing extension.  Override this in a hint file, if needed.
1023 _exe=''
1024 : Extra object files, if any, needed on this platform.
1025 archobjs=''
1026 archname=''
1027 : Possible local include directories to search.
1028 : Set locincpth to "" in a hint file to defeat local include searches.
1029 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1030 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1031 :
1032 : no include file wanted by default
1033 inclwanted=''
1034
1035 groupstype=''
1036 libnames=''
1037 : change the next line if compiling for Xenix/286 on Xenix/386
1038 xlibpth='/usr/lib/386 /lib/386'
1039 : Possible local library directories to search.
1040 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1041 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1042
1043 : general looking path for locating libraries
1044 glibpth="/lib /usr/lib $xlibpth"
1045 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1046 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1047 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1048
1049 : Private path used by Configure to find libraries.  Its value
1050 : is prepended to libpth. This variable takes care of special
1051 : machines, like the mips.  Usually, it should be empty.
1052 plibpth=''
1053
1054 : default library list
1055 libswanted=''
1056 : some systems want to use only the non-versioned libso:s
1057 ignore_versioned_solibs=''
1058 archname64=''
1059 ccflags_uselargefiles=''
1060 ldflags_uselargefiles=''
1061 libswanted_uselargefiles=''
1062 : set usemultiplicity on the Configure command line to enable multiplicity.
1063 : set usesocks on the Configure command line to enable socks.
1064 : set usethreads on the Configure command line to enable threads.
1065 usereentrant='undef'
1066 : full support for void wanted by default
1067 defvoidused=15
1068
1069 : List of libraries we want.
1070 : If anyone needs -lnet, put it in a hint file.
1071 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1072 libswanted="$libswanted dld ld sun m c cposix posix"
1073 libswanted="$libswanted ndir dir crypt sec"
1074 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1075 : We probably want to search /usr/shlib before most other libraries.
1076 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1077 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1078 glibpth="/usr/shlib $glibpth"
1079 : Do not use vfork unless overridden by a hint file.
1080 usevfork=false
1081
1082 : Find the basic shell for Bourne shell scripts
1083 case "$sh" in
1084 '')
1085         case "$SYSTYPE" in
1086         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1087         *) xxx='/bin/sh';;
1088         esac
1089         if test -f "$xxx"; then
1090                 sh="$xxx"
1091         else
1092                 : Build up a list and do a single loop so we can 'break' out.
1093                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1094                 for xxx in sh bash ksh pdksh ash; do
1095                         for p in $pth; do
1096                                 try="$try ${p}/${xxx}"
1097                         done
1098                 done
1099                 for xxx in $try; do
1100                         if test -f "$xxx"; then
1101                                 sh="$xxx";
1102                                 break
1103                         elif test -f "$xxx.exe"; then
1104                                 sh="$xxx";
1105                                 break
1106                         fi
1107                 done
1108         fi
1109         ;;
1110 esac
1111
1112 case "$sh" in
1113 '')     cat <<EOM >&2
1114 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1115
1116 Usually it's in /bin/sh.  How did you even get this far?
1117 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1118 we'll try to straighten this all out.
1119 EOM
1120         exit 1
1121         ;;
1122 esac
1123
1124 : see if sh knows # comments
1125 if `$sh -c '#' >/dev/null 2>&1`; then
1126         shsharp=true
1127         spitshell=cat
1128         xcat=/bin/cat
1129         test -f $xcat || xcat=/usr/bin/cat
1130         echo "#!$xcat" >sharp
1131         $eunicefix sharp
1132         chmod +x sharp
1133         ./sharp > today
1134         if test -s today; then
1135                 sharpbang='#!'
1136         else
1137                 echo "#! $xcat" > sharp
1138                 $eunicefix sharp
1139                 chmod +x sharp
1140                 ./sharp > today
1141                 if test -s today; then
1142                         sharpbang='#! '
1143                 else
1144                         sharpbang=': use '
1145                 fi
1146         fi
1147 else
1148         echo " "
1149         echo "Your $sh doesn't grok # comments--I will strip them later on."
1150         shsharp=false
1151         cd ..
1152         echo "exec grep -v '^[  ]*#'" >spitshell
1153         chmod +x spitshell
1154         $eunicefix spitshell
1155         spitshell=`pwd`/spitshell
1156         cd UU
1157         echo "I presume that if # doesn't work, #! won't work either!"
1158         sharpbang=': use '
1159 fi
1160 rm -f sharp today
1161
1162 : figure out how to guarantee sh startup
1163 case "$startsh" in
1164 '') startsh=${sharpbang}${sh} ;;
1165 *)
1166 esac
1167 cat >sharp <<EOSS
1168 $startsh
1169 set abc
1170 test "$?abc" != 1
1171 EOSS
1172
1173 chmod +x sharp
1174 $eunicefix sharp
1175 if ./sharp; then
1176         : echo "Yup, it does."
1177 else
1178         echo "Hmm... '$startsh' does not guarantee sh startup..."
1179         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1180 fi
1181 rm -f sharp
1182
1183
1184 : Save command line options in file UU/cmdline.opt for later use in
1185 : generating config.sh.
1186 cat > cmdline.opt <<EOSH
1187 # Configure command line arguments.
1188 config_arg0='$0'
1189 config_args='$*'
1190 config_argc=$#
1191 EOSH
1192 argn=1
1193 for arg in "$@"; do
1194         cat >>cmdline.opt <<EOSH
1195 config_arg$argn='$arg'
1196 EOSH
1197         argn=`expr $argn + 1`
1198 done
1199
1200 : produce awk script to parse command line options
1201 cat >options.awk <<'EOF'
1202 BEGIN {
1203         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1204
1205         len = length(optstr);
1206         for (i = 1; i <= len; i++) {
1207                 c = substr(optstr, i, 1);
1208                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1209                 if (a == ":") {
1210                         arg[c] = 1;
1211                         i++;
1212                 }
1213                 opt[c] = 1;
1214         }
1215 }
1216 {
1217         expect = 0;
1218         str = $0;
1219         if (substr(str, 1, 1) != "-") {
1220                 printf("'%s'\n", str);
1221                 next;
1222         }
1223         len = length($0);
1224         for (i = 2; i <= len; i++) {
1225                 c = substr(str, i, 1);
1226                 if (!opt[c]) {
1227                         printf("-%s\n", substr(str, i));
1228                         next;
1229                 }
1230                 printf("-%s\n", c);
1231                 if (arg[c]) {
1232                         if (i < len)
1233                                 printf("'%s'\n", substr(str, i + 1));
1234                         else
1235                                 expect = 1;
1236                         next;
1237                 }
1238         }
1239 }
1240 END {
1241         if (expect)
1242                 print "?";
1243 }
1244 EOF
1245
1246 : process the command line options
1247 set X `for arg in "$@"; do echo "X$arg"; done |
1248         sed -e s/X// | awk -f options.awk`
1249 eval "set $*"
1250 shift
1251 rm -f options.awk
1252
1253 : set up default values
1254 fastread=''
1255 reuseval=false
1256 config_sh=''
1257 alldone=''
1258 error=''
1259 silent=''
1260 extractsh=''
1261 override=''
1262 knowitall=''
1263 rm -f optdef.sh posthint.sh
1264 cat >optdef.sh <<EOS
1265 $startsh
1266 EOS
1267
1268
1269 : option parsing
1270 while test $# -gt 0; do
1271         case "$1" in
1272         -d) shift; fastread=yes;;
1273         -e) shift; alldone=cont;;
1274         -f)
1275                 shift
1276                 cd ..
1277                 if test -r "$1"; then
1278                         config_sh="$1"
1279                 else
1280                         echo "$me: cannot read config file $1." >&2
1281                         error=true
1282                 fi
1283                 cd UU
1284                 shift;;
1285         -h) shift; error=true;;
1286         -r) shift; reuseval=true;;
1287         -s) shift; silent=true; realsilent=true;;
1288         -E) shift; alldone=exit;;
1289         -K) shift; knowitall=true;;
1290         -O) shift; override=true;;
1291         -S) shift; silent=true; extractsh=true;;
1292         -D)
1293                 shift
1294                 case "$1" in
1295                 *=)
1296                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1297                         echo "$me: ignoring -D $1" >&2
1298                         ;;
1299                 *=*) echo "$1" | \
1300                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1301                 *) echo "$1='define'" >> optdef.sh;;
1302                 esac
1303                 shift
1304                 ;;
1305         -U)
1306                 shift
1307                 case "$1" in
1308                 *=) echo "$1" >> optdef.sh;;
1309                 *=*)
1310                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1311                         echo "$me: ignoring -U $1" >&2
1312                         ;;
1313                 *) echo "$1='undef'" >> optdef.sh;;
1314                 esac
1315                 shift
1316                 ;;
1317         -A)
1318             shift
1319             xxx=''
1320             yyy="$1"
1321             zzz=''
1322             uuu=undef
1323             case "$yyy" in
1324             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1325                  case "$zzz" in
1326                  *:*) zzz='' ;;
1327                  *)   xxx=append
1328                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1329                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1330                  esac
1331                  ;;
1332             esac
1333             case "$xxx" in
1334             '')  case "$yyy" in
1335                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1336                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1337                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1338                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1339                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1340                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1341                  esac
1342                  ;;       
1343             esac
1344             case "$xxx" in
1345             append)
1346                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1347             clear)
1348                 echo "$yyy=''"                  >> posthint.sh ;;
1349             define)
1350                 case "$zzz" in
1351                 '') zzz=define ;;
1352                 esac
1353                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1354             eval)
1355                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1356             prepend)
1357                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1358             undef)
1359                 case "$zzz" in
1360                 '') zzz="$uuu" ;;
1361                 esac
1362                 echo "$yyy=$zzz"                >> posthint.sh ;;
1363             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1364             esac
1365             shift
1366             ;;
1367         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1368             exit 0;;
1369         --) break;;
1370         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1371         *) break;;
1372         esac
1373 done
1374
1375 case "$error" in
1376 true)
1377         cat >&2 <<EOM
1378 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1379                  [-U symbol] [-U symbol=] [-A command:symbol...]
1380   -d : use defaults for all answers.
1381   -e : go on without questioning past the production of config.sh.
1382   -f : specify an alternate default configuration file.
1383   -h : print this help message and exit (with an error status).
1384   -r : reuse C symbols value if possible (skips costly nm extraction).
1385   -s : silent mode, only echoes questions and essential information.
1386   -D : define symbol to have some value:
1387          -D symbol         symbol gets the value 'define'
1388          -D symbol=value   symbol gets the value 'value'
1389   -E : stop at the end of questions, after having produced config.sh.
1390   -K : do not use unless you know what you are doing.
1391   -O : let -D and -U override definitions from loaded configuration file.
1392   -S : perform variable substitutions on all .SH files (can mix with -f)
1393   -U : undefine symbol:
1394          -U symbol    symbol gets the value 'undef'
1395          -U symbol=   symbol gets completely empty
1396   -A : manipulate symbol after the platform specific hints have been applied:
1397          -A symbol=value                append " "value to symbol
1398          -A append:symbol=value         append value to symbol
1399          -A define:symbol=value         define symbol to have value
1400          -A clear:symbol                define symbol to be ''
1401          -A define:symbol               define symbol to be 'define'
1402          -A eval:symbol=value           define symbol to be eval of value
1403          -A prepend:symbol=value        prepend value to symbol
1404          -A undef:symbol                define symbol to be 'undef'
1405          -A undef:symbol=               define symbol to be ''
1406   -V : print version number and exit (with a zero status).
1407 EOM
1408         exit 1
1409         ;;
1410 esac
1411
1412 : Sanity checks
1413 case "$fastread$alldone" in
1414 yescont|yesexit) ;;
1415 *)
1416         case "$extractsh" in
1417         true) ;;
1418         *)
1419                 if test ! -t 0; then
1420                         echo "Say 'sh Configure', not 'sh <Configure'"
1421                         exit 1
1422                 fi
1423                 ;;
1424         esac
1425         ;;
1426 esac
1427
1428 exec 4>&1
1429 case "$silent" in
1430 true) exec 1>/dev/null;;
1431 esac
1432
1433 : run the defines and the undefines, if any, but leave the file out there...
1434 touch optdef.sh
1435 . ./optdef.sh
1436 : create the posthint manipulation script and leave the file out there...
1437 touch posthint.sh
1438
1439 : set package name
1440 package=perl5
1441 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1442 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1443 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1444 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1445 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1446 esac
1447
1448 : Some greps do not return status, grrr.
1449 echo "grimblepritz" >grimble
1450 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1451         contains=contains
1452 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1453         contains=grep
1454 else
1455         contains=contains
1456 fi
1457 rm -f grimble
1458 : the following should work in any shell
1459 case "$contains" in
1460 contains*)
1461         echo " "
1462         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1463         cat >contains <<'EOSS'
1464 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1465 EOSS
1466 chmod +x contains
1467 esac
1468
1469 : Find the path to the source tree
1470 case "$src" in
1471 '') case "$0" in
1472     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1473          case "$src" in
1474          /*)    ;;
1475          .)     ;;
1476          *)     src=`cd ../$src && pwd` ;;
1477          esac
1478          ;;
1479     *)   src='.';;
1480     esac;;
1481 esac
1482 case "$src" in
1483 '')     src=/
1484         rsrc=/
1485         ;;
1486 /*) rsrc="$src";;
1487 *) rsrc="../$src";;
1488 esac
1489 if test -f $rsrc/Configure && \
1490         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1491 then
1492    : found it, so we are ok.
1493 else
1494         rsrc=''
1495         for src in . .. ../.. ../../.. ../../../..; do
1496                 if test -f ../$src/Configure && \
1497                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1498                 then
1499                         rsrc=../$src
1500                         break
1501                 fi
1502         done
1503 fi
1504 case "$rsrc" in
1505 '')
1506         cat <<EOM >&4
1507
1508 Sorry, I can't seem to locate the source dir for $package.  Please start
1509 Configure with an explicit path -- i.e. /some/path/Configure.
1510
1511 EOM
1512         exit 1
1513         ;;
1514 ../.)   rsrc='..';;
1515 *)
1516         echo " "
1517         echo "Sources for $package found in \"$src\"." >&4
1518         ;;
1519 esac
1520
1521 : script used to extract .SH files with variable substitutions
1522 cat >extract <<'EOS'
1523 PERL_CONFIG_SH=true
1524 echo "Doing variable substitutions on .SH files..."
1525 if test -f MANIFEST; then
1526         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1527 else
1528         echo "(Looking for .SH files under the source directory.)"
1529         set x `(cd $src; find . -name "*.SH" -print)`
1530 fi
1531 shift
1532 case $# in
1533 0) set x `(cd $src; echo *.SH)`; shift;;
1534 esac
1535 if test ! -f $src/$1; then
1536         shift
1537 fi
1538 mkdir_p='
1539 name=$1;
1540 create="";
1541 while test $name; do
1542         if test ! -d "$name"; then
1543                 create="$name $create";
1544                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1545                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1546         else
1547                 name="";
1548         fi;
1549 done;
1550 for file in $create; do
1551         mkdir $file;
1552 done
1553 '
1554 for file in $*; do
1555         case "$src" in
1556         ".")
1557                 case "$file" in
1558                 */*)
1559                         dir=`expr X$file : 'X\(.*\)/'`
1560                         file=`expr X$file : 'X.*/\(.*\)'`
1561                         (cd $dir && . ./$file)
1562                         ;;
1563                 *)
1564                         . ./$file
1565                         ;;
1566                 esac
1567                 ;;
1568         *)
1569                 case "$file" in
1570                 */*)
1571                         dir=`expr X$file : 'X\(.*\)/'`
1572                         file=`expr X$file : 'X.*/\(.*\)'`
1573                         (set x $dir; shift; eval $mkdir_p)
1574                         sh <$src/$dir/$file
1575                         ;;
1576                 *)
1577                         sh <$src/$file
1578                         ;;
1579                 esac
1580                 ;;
1581         esac
1582 done
1583 if test -f $src/config_h.SH; then
1584         if test ! -f config.h; then
1585         : oops, they left it out of MANIFEST, probably, so do it anyway.
1586         . $src/config_h.SH
1587         fi
1588 fi
1589 EOS
1590
1591 : extract files and exit if asked to do so
1592 case "$extractsh" in
1593 true)
1594         case "$realsilent" in
1595         true) ;;
1596         *) exec 1>&4;;
1597         esac
1598         case "$config_sh" in
1599         '') config_sh='config.sh';;
1600         esac
1601         echo " "
1602         echo "Fetching answers from $config_sh..."
1603         cd ..
1604         . $config_sh
1605         test "$override" && . ./optdef.sh
1606         echo " "
1607         . UU/extract
1608         rm -rf UU
1609         echo "Extraction done."
1610         exit 0
1611         ;;
1612 esac
1613
1614 : Eunice requires " " instead of "", can you believe it
1615 echo " "
1616 : Here we go...
1617 echo "Beginning of configuration questions for $package."
1618
1619 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1620
1621 : first determine how to suppress newline on echo command
1622 echo " "
1623 echo "Checking echo to see how to suppress newlines..."
1624 (echo "hi there\c" ; echo " ") >.echotmp
1625 if $contains c .echotmp >/dev/null 2>&1 ; then
1626         echo "...using -n."
1627         n='-n'
1628         c=''
1629 else
1630         cat <<'EOM'
1631 ...using \c
1632 EOM
1633         n=''
1634         c='\c'
1635 fi
1636 echo $n "The star should be here-->$c"
1637 echo '*'
1638 rm -f .echotmp
1639
1640 : Now test for existence of everything in MANIFEST
1641 echo " "
1642 if test -f $rsrc/MANIFEST; then
1643         echo "First let's make sure your kit is complete.  Checking..." >&4
1644         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1645         rm -f missing
1646         tmppwd=`pwd`
1647         for filelist in x??; do
1648                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1649         done
1650         if test -s missing; then
1651                 cat missing >&4
1652                 cat >&4 <<'EOM'
1653
1654 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1655
1656 You have the option of continuing the configuration process, despite the
1657 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1658 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1659 and contact the author (perlbug@perl.org).
1660
1661 EOM
1662                 echo $n "Continue? [n] $c" >&4
1663                 read ans
1664                 case "$ans" in
1665                 y*)
1666                         echo "Continuing..." >&4
1667                         rm -f missing
1668                         ;;
1669                 *)
1670                         echo "ABORTING..." >&4
1671                         kill $$
1672                         ;;
1673                 esac
1674         else
1675                 echo "Looks good..."
1676         fi
1677 else
1678         echo "There is no MANIFEST file.  I hope your kit is complete !"
1679 fi
1680 rm -f missing x??
1681
1682 echo " "
1683 : Find the appropriate value for a newline for tr
1684 if test -n "$DJGPP"; then
1685        trnl='\012'
1686 fi
1687 if test X"$trnl" = X; then
1688         case "`echo foo|tr '\n' x 2>/dev/null`" in
1689         foox) trnl='\n' ;;
1690         esac
1691 fi
1692 if test X"$trnl" = X; then
1693         case "`echo foo|tr '\012' x 2>/dev/null`" in
1694         foox) trnl='\012' ;;
1695         esac
1696 fi
1697 if test X"$trnl" = X; then
1698         cat <<EOM >&2
1699
1700 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1701
1702 EOM
1703         exit 1
1704 fi
1705
1706 : compute the number of columns on the terminal for proper question formatting
1707 case "$COLUMNS" in
1708 '') COLUMNS='80';;
1709 esac
1710
1711 : set up the echo used in my read
1712 myecho="case \"\$xxxm\" in
1713 '') echo $n \"\$rp $c\" >&4;;
1714 *) case \"\$rp\" in
1715         '') echo $n \"[\$xxxm] $c\";;
1716         *)
1717                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1718                         echo \"\$rp\" >&4
1719                         echo $n \"[\$xxxm] $c\" >&4
1720                 else
1721                         echo $n \"\$rp [\$xxxm] $c\" >&4
1722                 fi
1723                 ;;
1724         esac;;
1725 esac"
1726
1727 : now set up to do reads with possible shell escape and default assignment
1728 cat <<EOSC >myread
1729 $startsh
1730 xxxm=\$dflt
1731 $myecho
1732 ans='!'
1733 case "\$fastread" in
1734 yes) case "\$dflt" in
1735         '') ;;
1736         *) ans='';
1737                 case "\$silent-\$rp" in
1738                 true-) ;;
1739                 *) echo " " >&4;;
1740                 esac;;
1741         esac;;
1742 *) case "\$silent" in
1743         true) case "\$rp" in
1744                 '') ans='';;
1745                 esac;;
1746         esac;;
1747 esac
1748 while expr "X\$ans" : "X!" >/dev/null; do
1749         read answ
1750         set x \$xxxm
1751         shift
1752         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1753         case  "\$answ" in
1754         "!")
1755                 sh 1>&4
1756                 echo " "
1757                 $myecho
1758                 ;;
1759         !*)
1760                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1761                 shift
1762                 sh 1>&4 -c "\$*"
1763                 echo " "
1764                 $myecho
1765                 ;;
1766         "\$ans")
1767                 case "\$ans" in
1768                 \\&*)
1769                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1770                         shift
1771                         case "\$1" in
1772                         -d)
1773                                 fastread=yes
1774                                 echo "(OK, I'll run with -d after this question.)" >&4
1775                                 ;;
1776                         -*)
1777                                 echo "*** Sorry, \$1 not supported yet." >&4
1778                                 ;;
1779                         esac
1780                         $myecho
1781                         ans=!
1782                         ;;
1783                 esac;;
1784         *)
1785                 case "\$aok" in
1786                 y)
1787                         echo "*** Substitution done -- please confirm."
1788                         xxxm="\$ans"
1789                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1790                         xxxm="\$ans"
1791                         ans=!
1792                         ;;
1793                 *)
1794                         echo "*** Error -- try again."
1795                         ans=!
1796                         ;;
1797                 esac
1798                 $myecho
1799                 ;;
1800         esac
1801         case "\$ans\$xxxm\$nostick" in
1802         '')
1803                 ans=!
1804                 $myecho
1805                 ;;
1806         esac
1807 done
1808 case "\$ans" in
1809 '') ans="\$xxxm";;
1810 esac
1811 EOSC
1812
1813 : create .config dir to save info across Configure sessions
1814 test -d ../.config || mkdir ../.config
1815 cat >../.config/README <<EOF
1816 This directory created by Configure to save information that should
1817 persist across sessions for $package.
1818
1819 You may safely delete it if you wish.
1820 EOF
1821
1822 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1823 case "$usedevel" in
1824 $define|true|[yY]*) ;;
1825 *) case "$xversion" in
1826    *[13579])
1827         cat >&4 <<EOH
1828 *** WHOA THERE!!! ***
1829
1830     This is an UNSTABLE DEVELOPMENT release.
1831     The version of this $package distribution is $xversion, that is, odd,
1832     (as opposed to even) and that signifies a development release.
1833     If you want a maintenance release, you want an even-numbered version.
1834
1835     Do ***NOT*** install this into production use.
1836     Data corruption and crashes are possible.
1837
1838     It is most seriously suggested that you do not continue any further
1839     unless you want to help in developing and debugging Perl.
1840
1841     If you *still* want to build perl, you can answer 'y' now,
1842     or pass -Dusedevel to Configure.
1843
1844 EOH
1845         rp='Do you really want to continue?'
1846         dflt='n'
1847         . ./myread
1848         case "$ans" in
1849         [yY]) echo >&4 "Okay, continuing."
1850               usedevel="$define" ;;
1851         *) echo >&4 "Okay, bye."
1852            exit 1
1853            ;;
1854         esac
1855         ;;
1856     esac
1857     ;;
1858 esac
1859 case "$usedevel" in
1860 $define|true|[yY]*)
1861         case "$versiononly" in
1862         '') versiononly="$define" ;;
1863         esac
1864         case "$installusrbinperl" in
1865         '') installusrbinperl="$undef" ;;
1866         esac
1867         ;;
1868 esac
1869
1870 : general instructions
1871 needman=true
1872 firsttime=true
1873 user=`(logname) 2>/dev/null`
1874 case "$user" in
1875 '') user=`whoami 2>&1`;;
1876 esac
1877 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1878         firsttime=false
1879         echo " "
1880         rp='Would you like to see the instructions?'
1881         dflt=n
1882         . ./myread
1883         case "$ans" in
1884         [yY]*) ;;
1885         *) needman=false;;
1886         esac
1887 fi
1888 if $needman; then
1889         cat <<EOH
1890
1891 This installation shell script will examine your system and ask you questions
1892 to determine how the perl5 package should be installed. If you get
1893 stuck on a question, you may use a ! shell escape to start a subshell or
1894 execute a command.  Many of the questions will have default answers in square
1895 brackets; typing carriage return will give you the default.
1896
1897 On some of the questions which ask for file or directory names you are allowed
1898 to use the ~name construct to specify the login directory belonging to "name",
1899 even if you don't have a shell which knows about that.  Questions where this is
1900 allowed will be marked "(~name ok)".
1901
1902 EOH
1903         rp=''
1904         dflt='Type carriage return to continue'
1905         . ./myread
1906         cat <<'EOH'
1907
1908 The prompter used in this script allows you to use shell variables and
1909 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1910 in the default answer, as if the default line was a set of arguments given to a
1911 script shell.  This means you may also use $* to repeat the whole default line,
1912 so you do not have to re-type everything to add something to the default.
1913
1914 Everytime there is a substitution, you will have to confirm.  If there is an
1915 error (e.g. an unmatched backtick), the default answer will remain unchanged
1916 and you will be prompted again.
1917
1918 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1919 the questions and use the computed defaults (or the previous answers if there
1920 was already a config.sh file). Type 'Configure -h' for a list of options.
1921 You may also start interactively and then answer '& -d' at any prompt to turn
1922 on the non-interactive behaviour for the remainder of the execution.
1923
1924 EOH
1925         . ./myread
1926         cat <<EOH
1927
1928 Much effort has been expended to ensure that this shell script will run on any
1929 Unix system.  If despite that it blows up on yours, your best bet is to edit
1930 Configure and run it again.  If you can't run Configure for some reason,
1931 you'll have to generate a config.sh file by hand.  Whatever problems you
1932 have, let me (perlbug@perl.org) know how I blew it.
1933
1934 This installation script affects things in two ways:
1935
1936 1) it may do direct variable substitutions on some of the files included
1937    in this kit.
1938 2) it builds a config.h file for inclusion in C programs.  You may edit
1939    any of these files as the need arises after running this script.
1940
1941 If you make a mistake on a question, there is no easy way to back up to it
1942 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1943 files.  Configure will offer to let you do this before it runs the SH files.
1944
1945 EOH
1946         dflt='Type carriage return to continue'
1947         . ./myread
1948         case "$firsttime" in
1949         true) echo $user >>../.config/instruct;;
1950         esac
1951 fi
1952
1953 : find out where common programs are
1954 echo " "
1955 echo "Locating common programs..." >&4
1956 cat <<EOSC >loc
1957 $startsh
1958 case \$# in
1959 0) exit 1;;
1960 esac
1961 thing=\$1
1962 shift
1963 dflt=\$1
1964 shift
1965 for dir in \$*; do
1966         case "\$thing" in
1967         .)
1968         if test -d \$dir/\$thing; then
1969                 echo \$dir
1970                 exit 0
1971         fi
1972         ;;
1973         *)
1974         for thisthing in \$dir/\$thing; do
1975                 : just loop through to pick last item
1976         done
1977         if test -f \$thisthing; then
1978                 echo \$thisthing
1979                 exit 0
1980         elif test -f \$dir/\$thing.exe; then
1981                 if test -n "$DJGPP"; then
1982                         echo \$dir/\$thing.exe
1983                 else
1984                         : on Eunice apparently
1985                         echo \$dir/\$thing
1986                 fi
1987                 exit 0
1988         fi
1989         ;;
1990         esac
1991 done
1992 echo \$dflt
1993 exit 1
1994 EOSC
1995 chmod +x loc
1996 $eunicefix loc
1997 loclist="
1998 awk
1999 cat
2000 chmod
2001 comm
2002 cp
2003 echo
2004 expr
2005 grep
2006 ls
2007 make
2008 mkdir
2009 rm
2010 sed
2011 sort
2012 touch
2013 tr
2014 uniq
2015 "
2016 trylist="
2017 Mcc
2018 ar
2019 bison
2020 byacc
2021 cpp
2022 csh
2023 date
2024 egrep
2025 gzip
2026 less
2027 ln
2028 more
2029 nm
2030 nroff
2031 pg
2032 test
2033 uname
2034 zip
2035 "
2036 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2037 pth="$pth /lib /usr/lib"
2038 for file in $loclist; do
2039         eval xxx=\$$file
2040         case "$xxx" in
2041         /*|?:[\\/]*)
2042                 if test -f "$xxx"; then
2043                         : ok
2044                 else
2045                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2046                         xxx=`./loc $file $file $pth`
2047                 fi
2048                 ;;
2049         '') xxx=`./loc $file $file $pth`;;
2050         *) xxx=`./loc $xxx $xxx $pth`;;
2051         esac
2052         eval $file=$xxx
2053         eval _$file=$xxx
2054         case "$xxx" in
2055         /*)
2056                 echo $file is in $xxx.
2057                 ;;
2058         ?:[\\/]*)
2059                 echo $file is in $xxx.
2060                 ;;
2061         *)
2062                 echo "I don't know where '$file' is, and my life depends on it." >&4
2063                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2064                 exit 1
2065                 ;;
2066         esac
2067 done
2068 echo " "
2069 echo "Don't worry if any of the following aren't found..."
2070 say=offhand
2071 for file in $trylist; do
2072         eval xxx=\$$file
2073         case "$xxx" in
2074         /*|?:[\\/]*)
2075                 if test -f "$xxx"; then
2076                         : ok
2077                 else
2078                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2079                         xxx=`./loc $file $file $pth`
2080                 fi
2081                 ;;
2082         '') xxx=`./loc $file $file $pth`;;
2083         *) xxx=`./loc $xxx $xxx $pth`;;
2084         esac
2085         eval $file=$xxx
2086         eval _$file=$xxx
2087         case "$xxx" in
2088         /*)
2089                 echo $file is in $xxx.
2090                 ;;
2091         ?:[\\/]*)
2092                 echo $file is in $xxx.
2093                 ;;
2094         *)
2095                 echo "I don't see $file out there, $say."
2096                 say=either
2097                 ;;
2098         esac
2099 done
2100 case "$egrep" in
2101 egrep)
2102         echo "Substituting grep for egrep."
2103         egrep=$grep
2104         ;;
2105 esac
2106 case "$ln" in
2107 ln)
2108         echo "Substituting cp for ln."
2109         ln=$cp
2110         ;;
2111 esac
2112 case "$test" in
2113 test)
2114         echo "Hopefully test is built into your sh."
2115         ;;
2116 *)
2117         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2118                 echo "Using the test built into your sh."
2119                 test=test
2120                 _test=test
2121         fi
2122         ;;
2123 esac
2124 case "$echo" in
2125 echo)
2126         echo "Hopefully echo is built into your sh."
2127         ;;
2128 '') ;;
2129 *)
2130         echo " "
2131 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2132         $echo $n "hi there$c" >foo1
2133         echo $n "hi there$c" >foo2
2134         if cmp foo1 foo2 >/dev/null 2>&1; then
2135                 echo "They are compatible.  In fact, they may be identical."
2136         else
2137                 case "$n" in
2138                 '-n') n='' c='\c';;
2139                 *) n='-n' c='';;
2140                 esac
2141                 cat <<FOO
2142 They are not compatible!  You are probably running ksh on a non-USG system.
2143 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2144 have echo built in and we may have to run some Bourne shell scripts.  That
2145 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2146
2147 FOO
2148                 $echo $n "The star should be here-->$c"
2149                 $echo "*"
2150         fi
2151         $rm -f foo1 foo2
2152         ;;
2153 esac
2154
2155 cat <<EOS >checkcc
2156 $startsh
2157 EOS
2158 cat <<'EOSC' >>checkcc
2159 case "$cc" in
2160 '') ;;
2161 *)  $rm -f try try.*
2162     $cat >try.c <<EOM
2163 int main(int argc, char *argv[]) {
2164   return 0;
2165 }
2166 EOM
2167     if $cc -o try $ccflags $ldflags try.c; then
2168        :
2169     else
2170         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2171         despair=yes
2172         trygcc=yes
2173         case "$cc" in
2174         *gcc*) trygcc=no ;;
2175         esac
2176         case "`$cc -v -c try.c 2>&1`" in
2177         *gcc*) trygcc=no ;;
2178         esac
2179         if $test X"$trygcc" = Xyes; then
2180             if gcc -o try -c try.c; then
2181                 echo " "
2182                 echo "You seem to have a working gcc, though." >&4
2183                 rp="Would you like to use it?"
2184                 dflt=y
2185                 if $test -f myread; then
2186                     . ./myread
2187                 else
2188                     if $test -f UU/myread; then
2189                         . ./UU/myread
2190                     else
2191                         echo "Cannot find myread, sorry.  Aborting." >&2
2192                         exit 1
2193                     fi
2194                 fi  
2195                 case "$ans" in
2196                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2197                 esac
2198             fi
2199         fi
2200         if $test X"$despair" = Xyes; then
2201             $cat >&4 <<EOM
2202 You need to find a working C compiler.
2203 Either (purchase and) install the C compiler supplied by your OS vendor,
2204 or for a free C compiler try http://gcc.gnu.org/
2205 I cannot continue any further, aborting.
2206 EOM
2207             exit 1
2208         fi
2209     fi
2210     $rm -f try try.*
2211     ;;
2212 esac
2213 EOSC
2214
2215 : determine whether symbolic links are supported
2216 echo " "
2217 $touch blurfl
2218 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2219         echo "Symbolic links are supported." >&4
2220         lns="$ln -s"
2221 else
2222         echo "Symbolic links are NOT supported." >&4
2223         lns="$ln"
2224 fi
2225 $rm -f blurfl sym
2226
2227 : determine whether symbolic links are supported
2228 echo " "
2229 case "$lns" in
2230 *"ln -s")
2231         echo "Checking how to test for symbolic links..." >&4
2232         $lns blurfl sym
2233         if $test "X$issymlink" = X; then
2234                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2235                 if test $? = 0; then
2236                         issymlink="test -h"
2237                 fi              
2238         fi
2239         if $test "X$issymlink" = X; then
2240                 if  $test -h >/dev/null 2>&1; then
2241                         issymlink="$test -h"
2242                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2243                 fi              
2244         fi
2245         if $test "X$issymlink" = X; then
2246                 if $test -L sym 2>/dev/null; then
2247                         issymlink="$test -L"
2248                 fi
2249         fi
2250         if $test "X$issymlink" != X; then
2251                 echo "You can test for symbolic links with '$issymlink'." >&4
2252         else
2253                 echo "I do not know how you can test for symbolic links." >&4
2254         fi
2255         $rm -f blurfl sym
2256         ;;
2257 *)      echo "No symbolic links, so not testing for their testing..." >&4
2258         ;;
2259 esac
2260 echo " "
2261
2262
2263 case "$mksymlinks" in
2264 $define|true|[yY]*)
2265         case "$src" in
2266         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2267                 exit 1
2268                 ;;
2269         *)      case "$lns:$issymlink" in
2270                 *"ln -s:"*"test -"?)
2271                         echo "Creating the symbolic links..." >&4
2272                         echo "(First creating the subdirectories...)" >&4
2273                         cd ..
2274                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2275                                 read directory
2276                                 test -z "$directory" && break
2277                                 mkdir -p $directory
2278                         done
2279                         # Sanity check 1.
2280                         if test ! -d t/base; then
2281                                 echo "Failed to create the subdirectories.  Aborting." >&4
2282                                 exit 1
2283                         fi
2284                         echo "(Then creating the symlinks...)" >&4
2285                         awk '{print $1}' $src/MANIFEST | while true; do
2286                                 read filename
2287                                 test -z "$filename" && break
2288                                 if test -f $filename; then
2289                                         if $issymlink $filename; then
2290                                                 rm -f $filename
2291                                         fi
2292                                 fi
2293                                 if test -f $filename; then
2294                                         echo "$filename already exists, not symlinking."
2295                                 else
2296                                         ln -s $src/$filename $filename
2297                                 fi
2298                         done
2299                         # Sanity check 2.
2300                         if test ! -f t/base/commonsense.t; then
2301                                 echo "Failed to create the symlinks.  Aborting." >&4
2302                                 exit 1
2303                         fi
2304                         cd UU
2305                         ;;
2306                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2307                         ;;
2308                 esac
2309                 ;;
2310         esac
2311         ;;
2312 esac
2313
2314
2315 case "$usecrosscompile" in
2316 $define|true|[yY]*)
2317         $echo "Cross-compiling..."
2318         croak=''
2319         case "$cc" in
2320         *-*-gcc) # A cross-compiling gcc, probably.
2321             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2322             ar=$targetarch-ar
2323             # leave out ld, choosing it is more complex
2324             nm=$targetarch-nm
2325             ranlib=$targetarch-ranlib
2326             $echo 'extern int foo;' > try.c
2327             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2328             shift
2329             if $test $# -gt 0; then
2330                 incpth="$incpth $*"
2331                 incpth="`$echo $incpth|$sed 's/^ //'`"
2332                 echo "Guessing incpth '$incpth'." >&4
2333                 for i in $*; do
2334                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2335                     if $test -d $j; then
2336                         libpth="$libpth $j"
2337                     fi
2338                 done   
2339                 libpth="`$echo $libpth|$sed 's/^ //'`"
2340                 echo "Guessing libpth '$libpth'." >&4
2341             fi
2342             $rm -f try.c
2343             ;;
2344         esac
2345         case "$targetarch" in
2346         '') echo "Targetarch not defined." >&4; croak=y ;;
2347         *)  echo "Using targetarch $targetarch." >&4 ;;
2348         esac
2349         case "$incpth" in
2350         '') echo "Incpth not defined." >&4; croak=y ;;
2351         *)  echo "Using incpth '$incpth'." >&4 ;;
2352         esac
2353         case "$libpth" in
2354         '') echo "Libpth not defined." >&4; croak=y ;;
2355         *)  echo "Using libpth '$libpth'." >&4 ;;
2356         esac
2357         case "$usrinc" in
2358         '') for i in $incpth; do
2359                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2360                     usrinc=$i
2361                     echo "Guessing usrinc $usrinc." >&4
2362                     break
2363                 fi
2364             done
2365             case "$usrinc" in
2366             '') echo "Usrinc not defined." >&4; croak=y ;;
2367             esac
2368             ;;
2369         *)  echo "Using usrinc $usrinc." >&4 ;;
2370         esac
2371         case "$targethost" in
2372         '') echo "Targethost not defined." >&4; croak=y ;;
2373         *)  echo "Using targethost $targethost." >&4
2374         esac
2375         locincpth=' '
2376         loclibpth=' '
2377         case "$croak" in
2378         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2379         esac
2380         case "$src" in
2381         /*) run=$src/Cross/run
2382             targetmkdir=$src/Cross/mkdir
2383             to=$src/Cross/to
2384             from=$src/Cross/from
2385             ;;
2386         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2387             run=$pwd/Cross/run
2388             targetmkdir=$pwd/Cross/mkdir
2389             to=$pwd/Cross/to
2390             from=$pwd/Cross/from
2391             ;;
2392         esac
2393         case "$targetrun" in
2394         '') targetrun=ssh ;;
2395         esac
2396         case "$targetto" in
2397         '') targetto=scp ;;
2398         esac
2399         case "$targetfrom" in
2400         '') targetfrom=scp ;;
2401         esac
2402         run=$run-$targetrun
2403         to=$to-$targetto
2404         from=$from-$targetfrom
2405         case "$targetdir" in
2406         '')  targetdir=/tmp
2407              echo "Guessing targetdir $targetdir." >&4
2408              ;;
2409         esac
2410         case "$targetuser" in
2411         '')  targetuser=root
2412              echo "Guessing targetuser $targetuser." >&4
2413              ;;
2414         esac
2415         case "$targetfrom" in
2416         scp)    q=-q ;;
2417         *)      q='' ;;
2418         esac
2419         case "$targetrun" in
2420         ssh|rsh)
2421             cat >$run <<EOF
2422 #!/bin/sh
2423 case "\$1" in
2424 -cwd)
2425   shift
2426   cwd=\$1
2427   shift
2428   ;;
2429 esac
2430 case "\$cwd" in
2431 '') cwd=$targetdir ;;
2432 esac
2433 exe=\$1
2434 shift
2435 if $test ! -f \$exe.xok; then
2436   $to \$exe
2437   $touch \$exe.xok
2438 fi
2439 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2440 EOF
2441             ;;
2442         *)  echo "Unknown targetrun '$targetrun'" >&4
2443             exit 1
2444             ;;
2445         esac
2446         case "$targetmkdir" in
2447         */Cross/mkdir)
2448             cat >$targetmkdir <<EOF
2449 #!/bin/sh
2450 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2451 EOF
2452             $chmod a+rx $targetmkdir
2453             ;;
2454         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2455             exit 1
2456             ;;
2457         esac
2458         case "$targetto" in
2459         scp|rcp)
2460             cat >$to <<EOF
2461 #!/bin/sh
2462 for f in \$@
2463 do
2464   case "\$f" in
2465   /*)
2466     $targetmkdir \`dirname \$f\`
2467     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2468     ;;
2469   *)
2470     $targetmkdir $targetdir/\`dirname \$f\`
2471     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2472     ;;
2473   esac
2474 done
2475 exit 0
2476 EOF
2477             ;;
2478         cp) cat >$to <<EOF
2479 #!/bin/sh
2480 for f in \$@
2481 do
2482   case "\$f" in
2483   /*)
2484     $mkdir -p $targetdir/\`dirname \$f\`
2485     $cp \$f $targetdir/\$f || exit 1
2486     ;;
2487   *)
2488     $targetmkdir $targetdir/\`dirname \$f\`
2489     $cp \$f $targetdir/\$f || exit 1
2490     ;;
2491   esac
2492 done
2493 exit 0
2494 EOF
2495             ;;
2496         *)  echo "Unknown targetto '$targetto'" >&4
2497             exit 1
2498             ;;
2499         esac
2500         case "$targetfrom" in
2501         scp|rcp)
2502           cat >$from <<EOF
2503 #!/bin/sh
2504 for f in \$@
2505 do
2506   $rm -f \$f
2507   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2508 done
2509 exit 0
2510 EOF
2511             ;;
2512         cp) cat >$from <<EOF
2513 #!/bin/sh
2514 for f in \$@
2515 do
2516   $rm -f \$f
2517   cp $targetdir/\$f . || exit 1
2518 done
2519 exit 0
2520 EOF
2521             ;;
2522         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2523             exit 1
2524             ;;
2525         esac
2526         if $test ! -f $run; then
2527             echo "Target 'run' script '$run' not found." >&4
2528         else
2529             $chmod a+rx $run
2530         fi
2531         if $test ! -f $to; then
2532             echo "Target 'to' script '$to' not found." >&4
2533         else
2534             $chmod a+rx $to
2535         fi
2536         if $test ! -f $from; then
2537             echo "Target 'from' script '$from' not found." >&4
2538         else
2539             $chmod a+rx $from
2540         fi
2541         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2542             exit 1
2543         fi
2544         cat >&4 <<EOF
2545 Using '$run' for remote execution,
2546 and '$from' and '$to'
2547 for remote file transfer.
2548 EOF
2549         ;;
2550 *)      run=''
2551         to=:
2552         from=:
2553         usecrosscompile='undef'
2554         targetarch=''
2555         ;;
2556 esac
2557
2558 : see whether [:lower:] and [:upper:] are supported character classes
2559 echo " "
2560 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2561 ABYZ)
2562         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2563         up='[:upper:]'
2564         low='[:lower:]'
2565         ;;
2566 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2567         # (0xc9 and 0xd1), therefore that is a nice testing point.
2568         if test "X$up" = X -o "X$low" = X; then
2569             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2570             ij) up='[A-Z]'
2571                 low='[a-z]'
2572                 ;;
2573             esac
2574         fi
2575         if test "X$up" = X -o "X$low" = X; then
2576             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2577             ij) up='A-Z'
2578                 low='a-z'
2579                 ;;
2580             esac
2581         fi
2582         if test "X$up" = X -o "X$low" = X; then
2583             case "`echo IJ | od -x 2>/dev/null`" in
2584             *C9D1*|*c9d1*)
2585                 echo "Hey, this might be EBCDIC." >&4
2586                 if test "X$up" = X -o "X$low" = X; then
2587                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2588                     ij) up='[A-IJ-RS-Z]'
2589                         low='[a-ij-rs-z]'
2590                         ;;
2591                     esac
2592                 fi
2593                 if test "X$up" = X -o "X$low" = X; then
2594                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2595                     ij) up='A-IJ-RS-Z'
2596                         low='a-ij-rs-z'
2597                         ;;
2598                     esac
2599                 fi
2600                 ;;
2601             esac
2602         fi
2603 esac
2604 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2605 ij)
2606     echo "Using $up and $low to convert case." >&4
2607     ;;
2608 *)
2609     echo "I don't know how to translate letters from upper to lower case." >&4
2610     echo "Your tr is not acting any way I know of." >&4
2611     exit 1
2612     ;;
2613 esac
2614 : set up the translation script tr, must be called with ./tr of course
2615 cat >tr <<EOSC
2616 $startsh
2617 case "\$1\$2" in
2618 '[A-Z][a-z]') exec $tr '$up' '$low';;
2619 '[a-z][A-Z]') exec $tr '$low' '$up';;
2620 esac
2621 exec $tr "\$@"
2622 EOSC
2623 chmod +x tr
2624 $eunicefix tr
2625
2626 : Try to determine whether config.sh was made on this system
2627 case "$config_sh" in
2628 '')
2629 myuname=`$uname -a 2>/dev/null`
2630 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2631 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2632 # because the A-Z/a-z are not consecutive.
2633 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2634         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2635 newmyuname="$myuname"
2636 dflt=n
2637 case "$knowitall" in
2638 '')
2639         if test -f ../config.sh; then
2640                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2641                         eval "`grep myuname= ../config.sh`"
2642                 fi
2643                 if test "X$myuname" = "X$newmyuname"; then
2644                         dflt=y
2645                 fi
2646         fi
2647         ;;
2648 *) dflt=y;;
2649 esac
2650
2651 : Get old answers from old config file if Configure was run on the
2652 : same system, otherwise use the hints.
2653 hint=default
2654 cd ..
2655 if test -f config.sh; then
2656         echo " "
2657         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2658         . UU/myread
2659         case "$ans" in
2660         n*|N*) echo "OK, I'll ignore it."
2661                 mv config.sh config.sh.old
2662                 myuname="$newmyuname"
2663                 ;;
2664         *)  echo "Fetching default answers from your old config.sh file..." >&4
2665                 tmp_n="$n"
2666                 tmp_c="$c"
2667                 tmp_sh="$sh"
2668                 . ./config.sh
2669                 cp config.sh UU
2670                 n="$tmp_n"
2671                 c="$tmp_c"
2672                 : Older versions did not always set $sh.  Catch re-use of such
2673                 : an old config.sh.
2674                 case "$sh" in
2675                 '') sh="$tmp_sh" ;;
2676                 esac
2677                 hint=previous
2678                 ;;
2679         esac
2680 fi
2681 . ./UU/checkcc
2682 if test ! -f config.sh; then
2683         $cat <<EOM
2684
2685 First time through, eh?  I have some defaults handy for some systems
2686 that need some extra help getting the Configure answers right:
2687
2688 EOM
2689         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2690         dflt=''
2691         : Half the following guesses are probably wrong... If you have better
2692         : tests or hints, please send them to perlbug@perl.org
2693         : The metaconfig authors would also appreciate a copy...
2694         $test -f /irix && osname=irix
2695         $test -f /xenix && osname=sco_xenix
2696         $test -f /dynix && osname=dynix
2697         $test -f /dnix && osname=dnix
2698         $test -f /lynx.os && osname=lynxos
2699         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2700         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2701         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2702         $test -f /bin/mips && /bin/mips && osname=mips
2703         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2704                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2705         $test -d /usr/apollo/bin && osname=apollo
2706         $test -f /etc/saf/_sactab && osname=svr4
2707         $test -d /usr/include/minix && osname=minix
2708         if $test -d /MachTen -o -d /MachTen_Folder; then
2709                 osname=machten
2710                 if $test -x /sbin/version; then
2711                         osvers=`/sbin/version | $awk '{print $2}' |
2712                         $sed -e 's/[A-Za-z]$//'`
2713                 elif $test -x /usr/etc/version; then
2714                         osvers=`/usr/etc/version | $awk '{print $2}' |
2715                         $sed -e 's/[A-Za-z]$//'`
2716                 else
2717                         osvers="$2.$3"
2718                 fi
2719         fi
2720
2721         $test -f /sys/posix.dll &&
2722                 $test -f /usr/bin/what &&
2723                 set X `/usr/bin/what /sys/posix.dll` &&
2724                 $test "$3" = UWIN &&
2725                 osname=uwin &&
2726                 osvers="$5"
2727
2728         if $test -f $uname; then
2729                 set X $myuname
2730                 shift
2731
2732                 case "$5" in
2733                 fps*) osname=fps ;;
2734                 mips*)
2735                         case "$4" in
2736                         umips) osname=umips ;;
2737                         *) osname=mips ;;
2738                         esac;;
2739                 [23]100) osname=mips ;;
2740                 next*) osname=next ;;
2741                 i386*)
2742                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2743                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2744                                 osname='sco'
2745                                 osvers=$tmp
2746                         elif $test -f /etc/kconfig; then
2747                                 osname=isc
2748                                 if test "$lns" = "$ln -s"; then
2749                                         osvers=4
2750                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2751                                         osvers=3
2752                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2753                                         osvers=2
2754                                 fi
2755                         fi
2756                         tmp=''
2757                         ;;
2758                 pc*)
2759                         if test -n "$DJGPP"; then
2760                                 osname=dos
2761                                 osvers=djgpp
2762                         fi
2763                         ;;
2764                 esac
2765
2766                 case "$1" in
2767                 aix) osname=aix
2768                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2769                         case "$tmp" in
2770                         'not found') osvers="$4"."$3" ;;
2771                         '<3240'|'<>3240') osvers=3.2.0 ;;
2772                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2773                         '=3250'|'>3250') osvers=3.2.5 ;;
2774                         *) osvers=$tmp;;
2775                         esac
2776                         ;;
2777                 bsd386) osname=bsd386
2778                         osvers=`$uname -r`
2779                         ;;
2780                 cygwin*) osname=cygwin
2781                         osvers="$3"
2782                         ;;
2783                 *dc.osx) osname=dcosx
2784                         osvers="$3"
2785                         ;;
2786                 dnix) osname=dnix
2787                         osvers="$3"
2788                         ;;
2789                 domainos) osname=apollo
2790                         osvers="$3"
2791                         ;;
2792                 dgux) osname=dgux 
2793                         osvers="$3"
2794                         ;;
2795                 dynixptx*) osname=dynixptx
2796                         osvers=`echo "$4"|sed 's/^v//'`
2797                         ;;
2798                 freebsd) osname=freebsd 
2799                         osvers="$3" ;;
2800                 genix) osname=genix ;;
2801                 hp*) osname=hpux 
2802                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2803                         ;;
2804                 irix*) osname=irix
2805                         case "$3" in
2806                         4*) osvers=4 ;;
2807                         5*) osvers=5 ;;
2808                         *)      osvers="$3" ;;
2809                         esac
2810                         ;;
2811                 linux) osname=linux
2812                         case "$3" in
2813                         *)      osvers="$3" ;;
2814                         esac
2815                         ;;
2816                 MiNT) osname=mint
2817                         ;;
2818                 netbsd*) osname=netbsd
2819                         osvers="$3"
2820                         ;;
2821                 news-os) osvers="$3"
2822                         case "$3" in
2823                         4*) osname=newsos4 ;;
2824                         *) osname=newsos ;;
2825                         esac
2826                         ;;
2827                 next*) osname=next ;;
2828                 nonstop-ux) osname=nonstopux ;;
2829                 POSIX-BC | posix-bc ) osname=posix-bc
2830                         osvers="$3"
2831                         ;;
2832                 powerux | power_ux | powermax_os | powermaxos | \
2833                 powerunix | power_unix) osname=powerux
2834                         osvers="$3"
2835                         ;;
2836                 qnx) osname=qnx
2837                         osvers="$4"
2838                         ;;
2839                 solaris) osname=solaris
2840                         case "$3" in
2841                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2842                         *)      osvers="$3" ;;
2843                         esac
2844                         ;;
2845                 sunos) osname=sunos
2846                         case "$3" in
2847                         5*) osname=solaris
2848                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2849                         *)      osvers="$3" ;;
2850                         esac
2851                         ;;
2852                 titanos) osname=titanos
2853                         case "$3" in
2854                         1*) osvers=1 ;;
2855                         2*) osvers=2 ;;
2856                         3*) osvers=3 ;;
2857                         4*) osvers=4 ;;
2858                         *)      osvers="$3" ;;
2859                         esac
2860                         ;;
2861                 ultrix) osname=ultrix
2862                         osvers="$3"
2863                         ;;
2864                 osf1|mls+)      case "$5" in
2865                                 alpha)
2866                                         osname=dec_osf
2867                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2868                                         case "$osvers" in
2869                                         [1-9].[0-9]*) ;;
2870                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2871                                         esac
2872                                         ;;
2873                         hp*)    osname=hp_osf1  ;;
2874                         mips)   osname=mips_osf1 ;;
2875                         esac
2876                         ;;
2877                 unixware) osname=svr5
2878                         osvers="$4"
2879                         ;;
2880                 uts) osname=uts
2881                         osvers="$3"
2882                         ;;
2883                 $2) case "$osname" in
2884                         *isc*) ;;
2885                         *freebsd*) ;;
2886                         svr*)
2887                                 : svr4.x or possibly later
2888                                 case "svr$3" in 
2889                                 ${osname}*)
2890                                         osname=svr$3
2891                                         osvers=$4
2892                                         ;;
2893                                 esac
2894                                 case "$osname" in
2895                                 svr4.0)
2896                                         : Check for ESIX
2897                                         if test -f /stand/boot ; then
2898                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2899                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2900                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2901                                                         if test -n "$isesix"; then
2902                                                                 osname=esix4
2903                                                         fi
2904                                                 fi
2905                                         fi
2906                                         ;;
2907                                 esac
2908                                 ;;
2909                         *)      if test -f /etc/systemid; then
2910                                         osname=sco
2911                                         set `echo $3 | $sed 's/\./ /g'` $4
2912                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2913                                                 osvers=$1.$2.$3
2914                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2915                                                 osvers=$1.$2
2916                                         elif $test -f $src/hints/sco_$1.sh; then
2917                                                 osvers=$1
2918                                         fi
2919                                 else
2920                                         case "$osname" in
2921                                         '') : Still unknown.  Probably a generic Sys V.
2922                                                 osname="sysv"
2923                                                 osvers="$3"
2924                                                 ;;
2925                                         esac
2926                                 fi
2927                                 ;;
2928                         esac
2929                         ;;
2930                 *)      case "$osname" in
2931                         '') : Still unknown.  Probably a generic BSD.
2932                                 osname="$1"
2933                                 osvers="$3"
2934                                 ;;
2935                         esac
2936                         ;;
2937                 esac
2938         else
2939                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2940                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2941                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2942                                 osname=news_os
2943                         fi
2944                         $rm -f UU/kernel.what
2945                 elif test -d c:/.; then
2946                         set X $myuname
2947                         osname=os2
2948                         osvers="$5"
2949                 fi
2950         fi
2951         
2952         case "$targetarch" in
2953         '') ;;
2954         *)  hostarch=$osname
2955             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
2956             osvers=''
2957             ;;
2958         esac
2959
2960         : Now look for a hint file osname_osvers, unless one has been
2961         : specified already.
2962         case "$hintfile" in
2963         ''|' ')
2964                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2965                 : Also try without trailing minor version numbers.
2966                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2967                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2968                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2969                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2970                 case "$file" in
2971                 '') dflt=none ;;
2972                 *)  case "$osvers" in
2973                         '') dflt=$file
2974                                 ;;
2975                         *)  if $test -f $src/hints/$file.sh ; then
2976                                         dflt=$file
2977                                 elif $test -f $src/hints/$xfile.sh ; then
2978                                         dflt=$xfile
2979                                 elif $test -f $src/hints/$xxfile.sh ; then
2980                                         dflt=$xxfile
2981                                 elif $test -f $src/hints/$xxxfile.sh ; then
2982                                         dflt=$xxxfile
2983                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2984                                         dflt=$xxxxfile
2985                                 elif $test -f "$src/hints/${osname}.sh" ; then
2986                                         dflt="${osname}"
2987                                 else
2988                                         dflt=none
2989                                 fi
2990                                 ;;
2991                         esac
2992                         ;;
2993                 esac
2994                 if $test -f Policy.sh ; then
2995                         case "$dflt" in
2996                         *Policy*) ;;
2997                         none) dflt="Policy" ;;
2998                         *) dflt="Policy $dflt" ;;
2999                         esac
3000                 fi
3001                 ;;
3002         *)
3003                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3004                 ;;
3005         esac
3006
3007         if $test -f Policy.sh ; then
3008                 $cat <<EOM
3009
3010 There's also a Policy hint file available, which should make the
3011 site-specific (policy) questions easier to answer.
3012 EOM
3013
3014         fi
3015
3016         $cat <<EOM
3017
3018 You may give one or more space-separated answers, or "none" if appropriate.
3019 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3020 is a good thing.  DO NOT give a wrong version or a wrong OS.
3021
3022 EOM
3023
3024         rp="Which of these apply, if any?"
3025         . UU/myread
3026         tans=$ans
3027         for file in $tans; do
3028                 if $test X$file = XPolicy -a -f Policy.sh; then
3029                         . Policy.sh
3030                         $cat Policy.sh >> UU/config.sh
3031                 elif $test -f $src/hints/$file.sh; then
3032                         . $src/hints/$file.sh
3033                         $cat $src/hints/$file.sh >> UU/config.sh
3034                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3035                         : nothing
3036                 else
3037                         : Give one chance to correct a possible typo.
3038                         echo "$file.sh does not exist"
3039                         dflt=$file
3040                         rp="hint to use instead?"
3041                         . UU/myread
3042                         for file in $ans; do
3043                                 if $test -f "$src/hints/$file.sh"; then
3044                                         . $src/hints/$file.sh
3045                                         $cat $src/hints/$file.sh >> UU/config.sh
3046                                 elif $test X$ans = X -o X$ans = Xnone ; then
3047                                         : nothing
3048                                 else
3049                                         echo "$file.sh does not exist -- ignored."
3050                                 fi
3051                         done
3052                 fi
3053         done
3054
3055         hint=recommended
3056         : Remember our hint file for later.
3057         if $test -f "$src/hints/$file.sh" ; then
3058                 hintfile="$file"
3059         else
3060                 hintfile=''
3061         fi
3062 fi
3063 cd UU
3064 ;;
3065 *)
3066         echo " "
3067         echo "Fetching default answers from $config_sh..." >&4
3068         tmp_n="$n"
3069         tmp_c="$c"
3070         cd ..
3071         cp $config_sh config.sh 2>/dev/null
3072         chmod +w config.sh
3073         . ./config.sh
3074         cd UU
3075         cp ../config.sh .
3076         n="$tmp_n"
3077         c="$tmp_c"
3078         hint=previous
3079         ;;
3080 esac
3081 test "$override" && . ./optdef.sh
3082
3083 : Restore computed paths
3084 for file in $loclist $trylist; do
3085         eval $file="\$_$file"
3086 done
3087
3088 cat << EOM
3089
3090 Configure uses the operating system name and version to set some defaults.
3091 The default value is probably right if the name rings a bell. Otherwise,
3092 since spelling matters for me, either accept the default or answer "none"
3093 to leave it blank.
3094
3095 EOM
3096 case "$osname" in
3097         ''|' ')
3098                 case "$hintfile" in
3099                 ''|' '|none) dflt=none ;;
3100                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3101                 esac
3102                 ;;
3103         *) dflt="$osname" ;;
3104 esac
3105 rp="Operating system name?"
3106 . ./myread
3107 case "$ans" in
3108 none)  osname='' ;;
3109 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3110 esac
3111 echo " "
3112 case "$osvers" in
3113         ''|' ')
3114                 case "$hintfile" in
3115                 ''|' '|none) dflt=none ;;
3116                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3117                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3118                         case "$dflt" in
3119                         ''|' ') dflt=none ;;
3120                         esac
3121                         ;;
3122                 esac
3123                 ;;
3124         *) dflt="$osvers" ;;
3125 esac
3126 rp="Operating system version?"
3127 . ./myread
3128 case "$ans" in
3129 none)  osvers='' ;;
3130 *) osvers="$ans" ;;
3131 esac
3132
3133
3134 . ./posthint.sh
3135
3136 : who configured the system
3137 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3138 cf_by=`(logname) 2>/dev/null`
3139 case "$cf_by" in
3140 "")
3141         cf_by=`(whoami) 2>/dev/null`
3142         case "$cf_by" in
3143         "") cf_by=unknown ;;
3144         esac ;;
3145 esac
3146
3147 : set up the script used to warn in case of inconsistency
3148 cat <<EOS >whoa
3149 $startsh
3150 EOS
3151 cat <<'EOSC' >>whoa
3152 dflt=y
3153 echo " "
3154 echo "*** WHOA THERE!!! ***" >&4
3155 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3156 rp="    Keep the $hint value?"
3157 . ./myread
3158 case "$ans" in
3159 y) td=$was; tu=$was;;
3160 esac
3161 EOSC
3162
3163 : function used to set $1 to $val
3164 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3165 case "$val$was" in
3166 $define$undef) . ./whoa; eval "$var=\$td";;
3167 $undef$define) . ./whoa; eval "$var=\$tu";;
3168 *) eval "$var=$val";;
3169 esac'
3170
3171 case "$usethreads" in
3172 $define|true|[yY]*)     dflt='y';;
3173 *) dflt='n';;
3174 esac
3175 cat <<EOM
3176
3177 Perl can be built to take advantage of threads on some systems.
3178 To do so, Configure can be run with -Dusethreads.
3179
3180 Note that threading is a highly experimental feature, and
3181 some known race conditions still remain.  If you choose to try
3182 it, be very sure to not actually deploy it for production
3183 purposes.  README.threads has more details, and is required
3184 reading if you enable threads.
3185
3186 If this doesn't make any sense to you, just accept the default '$dflt'.
3187 EOM
3188 rp='Build a threading Perl?'
3189 . ./myread
3190 case "$ans" in
3191 y|Y)    val="$define" ;;
3192 *)      val="$undef" ;;
3193 esac
3194 set usethreads
3195 eval $setvar
3196
3197 case "$usethreads" in
3198 $define)
3199         $cat <<EOM
3200
3201 As of 5.5.640, Perl has two different internal threading implementations,
3202 the 5.005 version (5005threads) and an interpreter-based version
3203 (ithreads) that has one interpreter per thread.  Both are very 
3204 experimental.  This arrangement exists to help developers work out
3205 which one is better.
3206
3207 If you're a casual user, you probably don't want interpreter-threads
3208 at this time.  There doesn't yet exist a way to create threads from
3209 within Perl in this model, i.e., "use Thread;" will NOT work.
3210 EOM
3211         : Default to ithreads unless overridden on command line or with
3212         : old config.sh
3213         dflt='y'
3214         case "$use5005threads" in
3215                 $define|true|[yY]*) dflt='n';;
3216         esac
3217         case "$useithreads" in
3218                 $undef|false|[nN]*) dflt='n';;
3219         esac
3220         rp='Use interpreter-based ithreads?'
3221         . ./myread
3222         case "$ans" in
3223         y|Y)    val="$define" ;;
3224         *)      val="$undef" ;;
3225         esac
3226         set useithreads
3227         eval $setvar
3228         : Now set use5005threads to the opposite value.
3229         case "$useithreads" in
3230         $define) val="$undef" ;;
3231         *) val="$define" ;;
3232         esac
3233         set use5005threads
3234         eval $setvar
3235         ;;
3236 *)
3237         useithreads="$undef"
3238         use5005threads="$undef"
3239         ;;
3240 esac
3241
3242 case "$useithreads$use5005threads" in
3243 "$define$define")
3244         $cat >&4 <<EOM
3245
3246 You cannot have both the ithreads and the 5.005 threads enabled
3247 at the same time.  Disabling the 5.005 threads since they are
3248 much less stable than the ithreads.
3249
3250 EOM
3251         use5005threads="$undef"
3252         ;;
3253 esac
3254
3255 case "$d_oldpthreads" in
3256 '')     : Configure tests would be welcome here.  For now, assume undef.
3257         val="$undef" ;;
3258 *)      val="$d_oldpthreads" ;;
3259 esac
3260 set d_oldpthreads
3261 eval $setvar
3262
3263
3264 case "$usethreads" in
3265 "$define"|true|[yY]*)
3266 : Look for a hint-file generated 'call-back-unit'.  If the
3267 : user has specified that a threading perl is to be built,
3268 : we may need to set or change some other defaults.
3269         if $test -f usethreads.cbu; then
3270                 echo "Your platform has some specific hints for threaded builds, using them..."
3271                 . ./usethreads.cbu
3272         else
3273                 $cat <<EOM
3274 (Your platform doesn't have any specific hints for threaded builds.
3275  Assuming POSIX threads, then.)
3276 EOM
3277         fi
3278         ;;
3279 esac
3280
3281 cat <<EOM
3282
3283 Perl can be built so that multiple Perl interpreters can coexist
3284 within the same Perl executable.
3285 EOM
3286
3287 case "$useithreads" in
3288 $define)
3289         cat <<EOM
3290 This multiple interpreter support is required for interpreter-based threads.
3291 EOM
3292         val="$define"
3293         ;;
3294 *)      case "$usemultiplicity" in
3295         $define|true|[yY]*)     dflt='y';;
3296         *) dflt='n';;
3297         esac
3298         echo " "
3299         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3300         rp='Build Perl for multiplicity?'
3301         . ./myread
3302         case "$ans" in
3303         y|Y)    val="$define" ;;
3304         *)      val="$undef" ;;
3305         esac
3306         ;;
3307 esac
3308 set usemultiplicity
3309 eval $setvar
3310
3311 : make some quick guesses about what we are up against
3312 echo " "
3313 $echo $n "Hmm...  $c"
3314 echo exit 1 >bsd
3315 echo exit 1 >usg
3316 echo exit 1 >v7
3317 echo exit 1 >osf1
3318 echo exit 1 >eunice
3319 echo exit 1 >xenix
3320 echo exit 1 >venix
3321 echo exit 1 >os2
3322 d_bsd="$undef"
3323 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3324 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3325 then
3326         echo "Looks kind of like an OSF/1 system, but we'll see..."
3327         echo exit 0 >osf1
3328 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3329         xxx=`./loc addbib blurfl $pth`
3330         if $test -f $xxx; then
3331         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3332                 echo exit 0 >bsd
3333                 echo exit 0 >usg
3334         else
3335                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3336                         echo "Looks kind of like an extended USG system, but we'll see..."
3337                 else
3338                         echo "Looks kind of like a USG system, but we'll see..."
3339                 fi
3340                 echo exit 0 >usg
3341         fi
3342 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3343         echo "Looks kind of like a BSD system, but we'll see..."
3344         d_bsd="$define"
3345         echo exit 0 >bsd
3346 else
3347         echo "Looks kind of like a Version 7 system, but we'll see..."
3348         echo exit 0 >v7
3349 fi
3350 case "$eunicefix" in
3351 *unixtovms*)
3352         $cat <<'EOI'
3353 There is, however, a strange, musty smell in the air that reminds me of
3354 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3355 EOI
3356         echo exit 0 >eunice
3357         d_eunice="$define"
3358 : it so happens the Eunice I know will not run shell scripts in Unix format
3359         ;;
3360 *)
3361         echo " "
3362         echo "Congratulations.  You aren't running Eunice."
3363         d_eunice="$undef"
3364         ;;
3365 esac
3366 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3367 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3368 : semicolon as a patch separator
3369 case "$p_" in
3370 :) ;;
3371 *)
3372         $cat <<'EOI'
3373 I have the feeling something is not exactly right, however...don't tell me...
3374 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3375 (Or you may be running DOS with DJGPP.)
3376 EOI
3377         echo exit 0 >os2
3378         ;;
3379 esac
3380 if test -f /xenix; then
3381         echo "Actually, this looks more like a XENIX system..."
3382         echo exit 0 >xenix
3383         d_xenix="$define"
3384 else
3385         echo " "
3386         echo "It's not Xenix..."
3387         d_xenix="$undef"
3388 fi
3389 chmod +x xenix
3390 $eunicefix xenix
3391 if test -f /venix; then
3392         echo "Actually, this looks more like a VENIX system..."
3393         echo exit 0 >venix
3394 else
3395         echo " "
3396         if ./xenix; then
3397                 : null
3398         else
3399                 echo "Nor is it Venix..."
3400         fi
3401 fi
3402 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3403 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3404 $rm -f foo
3405
3406 case "$cc" in
3407 '') dflt=cc;;
3408 *) dflt="$cc";;
3409 esac
3410 rp="Use which C compiler?"
3411 . ./myread
3412 cc="$ans"
3413 : Look for a hint-file generated 'call-back-unit'.  Now that the
3414 : user has specified the compiler, we may need to set or change some
3415 : other defaults.
3416 if $test -f cc.cbu; then
3417     . ./cc.cbu
3418 fi
3419 . ./checkcc
3420
3421 echo " "
3422 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3423 $cat >try.c <<EOM
3424 #include <stdio.h>
3425 int main() {
3426 #ifdef __GNUC__
3427 #ifdef __VERSION__
3428         printf("%s\n", __VERSION__);
3429 #else
3430         printf("%s\n", "1");
3431 #endif
3432 #endif
3433         exit(0);
3434 }
3435 EOM
3436 if $cc -o try $ccflags $ldflags try.c; then
3437         gccversion=`$run ./try`
3438         case "$gccversion" in
3439         '') echo "You are not using GNU cc." ;;
3440         *)  echo "You are using GNU cc $gccversion."
3441             ccname=gcc  
3442             ;;
3443         esac
3444 else
3445         echo " "
3446         echo "*** WHOA THERE!!! ***" >&4
3447         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3448         case "$knowitall" in
3449         '')
3450         echo "    You'd better start hunting for one and let me know about it." >&4
3451                 exit 1
3452                 ;;
3453         esac
3454 fi
3455 $rm -f try try.*
3456 case "$gccversion" in
3457 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3458 esac
3459 case "$gccversion" in
3460 '') gccosandvers='' ;;
3461 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3462    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3463    gccshortvers=''
3464    case "$gccosandvers" in
3465    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3466    $osname$osvers) ;; # looking good
3467    $osname*) cat <<EOM >&4
3468
3469 *** WHOA THERE!!! ***
3470
3471     Your gcc has not been compiled for the exact release of
3472     your operating system ($gccosandvers versus $osname$osvers).
3473
3474     In general it is a good idea to keep gcc synchronized with
3475     the operating system because otherwise serious problems
3476     may ensue when trying to compile software, like Perl.
3477
3478     I'm trying to be optimistic here, though, and will continue.
3479     If later during the configuration and build icky compilation
3480     problems appear (headerfile conflicts being the most common
3481     manifestation), I suggest reinstalling the gcc to match
3482     your operating system release.
3483
3484 EOM
3485       ;;
3486    *) gccosandvers='' ;; # failed to parse, better be silent
3487    esac
3488    ;;
3489 esac
3490 case "$ccname" in
3491 '') ccname="$cc" ;;
3492 esac
3493
3494 case "$gccversion" in
3495 '') ;;
3496 *)  case "$ccflags" in
3497     *-Wall*) ;;
3498     *) ccflags="$ccflags -Wall" ;;
3499     esac
3500     ;;
3501 esac
3502
3503 : see how we invoke the C preprocessor
3504 echo " "
3505 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3506 cat <<'EOT' >testcpp.c
3507 #define ABC abc
3508 #define XYZ xyz
3509 ABC.XYZ
3510 EOT
3511 cd ..
3512 if test ! -f cppstdin; then
3513         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3514                 # AIX cc -E doesn't show the absolute headerfile
3515                 # locations but we'll cheat by using the -M flag.
3516                 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
3517         else
3518                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3519         fi
3520 else
3521         echo "Keeping your $hint cppstdin wrapper."
3522 fi
3523 chmod 755 cppstdin
3524 wrapper=`pwd`/cppstdin
3525 ok='false'
3526 cd UU
3527
3528 if $test "X$cppstdin" != "X" && \
3529         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3530         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3531 then
3532         echo "You used to use $cppstdin $cppminus so we'll use that again."
3533         case "$cpprun" in
3534         '') echo "But let's see if we can live without a wrapper..." ;;
3535         *)
3536                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3537                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3538                 then
3539                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3540                         ok='true'
3541                 else
3542                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3543                 fi
3544                 ;;
3545         esac
3546 else
3547         case "$cppstdin" in
3548         '') ;;
3549         *)
3550                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3551                 ;;
3552         esac
3553 fi
3554
3555 if $ok; then
3556         : nothing
3557 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3558         $cc -E <testcpp.c >testcpp.out 2>&1; \
3559         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3560         echo "Yup, it does."
3561         x_cpp="$cc -E"
3562         x_minus='';
3563 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3564         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3565         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3566         echo "Yup, it does."
3567         x_cpp="$cc -E"
3568         x_minus='-';
3569 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3570         $cc -P <testcpp.c >testcpp.out 2>&1; \
3571         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3572         echo "Yipee, that works!"
3573         x_cpp="$cc -P"
3574         x_minus='';
3575 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3576         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3577         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3578         echo "At long last!"
3579         x_cpp="$cc -P"
3580         x_minus='-';
3581 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3582         $cpp <testcpp.c >testcpp.out 2>&1; \
3583         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3584         echo "It works!"
3585         x_cpp="$cpp"
3586         x_minus='';
3587 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3588         $cpp - <testcpp.c >testcpp.out 2>&1; \
3589         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3590         echo "Hooray, it works!  I was beginning to wonder."
3591         x_cpp="$cpp"
3592         x_minus='-';
3593 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3594         $wrapper <testcpp.c >testcpp.out 2>&1; \
3595         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3596         x_cpp="$wrapper"
3597         x_minus=''
3598         echo "Eureka!"
3599 else
3600         dflt=''
3601         rp="No dice.  I can't find a C preprocessor.  Name one:"
3602         . ./myread
3603         x_cpp="$ans"
3604         x_minus=''
3605         $x_cpp <testcpp.c >testcpp.out 2>&1
3606         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3607                 echo "OK, that will do." >&4
3608         else
3609 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3610                 exit 1
3611         fi
3612 fi
3613
3614 case "$ok" in
3615 false)
3616         cppstdin="$x_cpp"
3617         cppminus="$x_minus"
3618         cpprun="$x_cpp"
3619         cpplast="$x_minus"
3620         set X $x_cpp
3621         shift
3622         case "$1" in
3623         "$cpp")
3624                 echo "Perhaps can we force $cc -E using a wrapper..."
3625                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3626                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3627                 then
3628                         echo "Yup, we can."
3629                         cppstdin="$wrapper"
3630                         cppminus='';
3631                 else
3632                         echo "Nope, we'll have to live without it..."
3633                 fi
3634                 ;;
3635         esac
3636         case "$cpprun" in
3637         "$wrapper")
3638                 cpprun=''
3639                 cpplast=''
3640                 ;;
3641         esac
3642         ;;
3643 esac
3644
3645 case "$cppstdin" in
3646 "$wrapper"|'cppstdin') ;;
3647 *) $rm -f $wrapper;;
3648 esac
3649 $rm -f testcpp.c testcpp.out
3650
3651 : decide how portable to be.  Allow command line overrides.
3652 case "$d_portable" in
3653 "$undef") ;;
3654 *)      d_portable="$define" ;;
3655 esac
3656
3657 : set up shell script to do ~ expansion
3658 cat >filexp <<EOSS
3659 $startsh
3660 : expand filename
3661 case "\$1" in
3662  ~/*|~)
3663         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3664         ;;
3665  ~*)
3666         if $test -f /bin/csh; then
3667                 /bin/csh -f -c "glob \$1"
3668                 failed=\$?
3669                 echo ""
3670                 exit \$failed
3671         else
3672                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3673                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3674                 if $test ! -d "\$dir"; then
3675                         me=\`basename \$0\`
3676                         echo "\$me: can't locate home directory for: \$name" >&2
3677                         exit 1
3678                 fi
3679                 case "\$1" in
3680                 */*)
3681                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3682                         ;;
3683                 *)
3684                         echo \$dir
3685                         ;;
3686                 esac
3687         fi
3688         ;;
3689 *)
3690         echo \$1
3691         ;;
3692 esac
3693 EOSS
3694 chmod +x filexp
3695 $eunicefix filexp
3696
3697 : now set up to get a file name
3698 cat <<EOS >getfile
3699 $startsh
3700 EOS
3701 cat <<'EOSC' >>getfile
3702 tilde=''
3703 fullpath=''
3704 already=''
3705 skip=''
3706 none_ok=''
3707 exp_file=''
3708 nopath_ok=''
3709 orig_rp="$rp"
3710 orig_dflt="$dflt"
3711 case "$gfpth" in
3712 '') gfpth='.' ;;
3713 esac
3714
3715 case "$fn" in
3716 *\(*)
3717         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3718         fn=`echo $fn | sed 's/(.*)//'`
3719         ;;
3720 esac
3721
3722 case "$fn" in
3723 *:*)
3724         loc_file=`expr $fn : '.*:\(.*\)'`
3725         fn=`expr $fn : '\(.*\):.*'`
3726         ;;
3727 esac
3728
3729 case "$fn" in
3730 *~*) tilde=true;;
3731 esac
3732 case "$fn" in
3733 */*) fullpath=true;;
3734 esac
3735 case "$fn" in
3736 *+*) skip=true;;
3737 esac
3738 case "$fn" in
3739 *n*) none_ok=true;;
3740 esac
3741 case "$fn" in
3742 *e*) exp_file=true;;
3743 esac
3744 case "$fn" in
3745 *p*) nopath_ok=true;;
3746 esac
3747
3748 case "$fn" in
3749 *f*) type='File';;
3750 *d*) type='Directory';;
3751 *l*) type='Locate';;
3752 esac
3753
3754 what="$type"
3755 case "$what" in
3756 Locate) what='File';;
3757 esac
3758
3759 case "$exp_file" in
3760 '')
3761         case "$d_portable" in
3762         "$define") ;;
3763         *) exp_file=true;;
3764         esac
3765         ;;
3766 esac
3767
3768 cd ..
3769 while test "$type"; do
3770         redo=''
3771         rp="$orig_rp"
3772         dflt="$orig_dflt"
3773         case "$tilde" in
3774         true) rp="$rp (~name ok)";;
3775         esac
3776         . UU/myread
3777         if test -f UU/getfile.ok && \
3778                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3779         then
3780                 value="$ans"
3781                 ansexp="$ans"
3782                 break
3783         fi
3784         case "$ans" in
3785         none)
3786                 value=''
3787                 ansexp=''
3788                 case "$none_ok" in
3789                 true) type='';;
3790                 esac
3791                 ;;
3792         *)
3793                 case "$tilde" in
3794                 '') value="$ans"
3795                         ansexp="$ans";;
3796                 *)
3797                         value=`UU/filexp $ans`
3798                         case $? in
3799                         0)
3800                                 if test "$ans" != "$value"; then
3801                                         echo "(That expands to $value on this system.)"
3802                                 fi
3803                                 ;;
3804                         *) value="$ans";;
3805                         esac
3806                         ansexp="$value"
3807                         case "$exp_file" in
3808                         '') value="$ans";;
3809                         esac
3810                         ;;
3811                 esac
3812                 case "$fullpath" in
3813                 true)
3814                         case "$ansexp" in
3815                         /*) value="$ansexp" ;;
3816                         [a-zA-Z]:/*) value="$ansexp" ;;
3817                         *)
3818                                 redo=true
3819                                 case "$already" in
3820                                 true)
3821                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3822                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3823                                         ;;
3824                                 *)
3825                                 echo "Please give a full path name, starting with slash." >&4
3826                                         case "$tilde" in
3827                                         true)
3828                                 echo "Note that using ~name is ok provided it expands well." >&4
3829                                                 already=true
3830                                                 ;;
3831                                         esac
3832                                 esac
3833                                 ;;
3834                         esac
3835                         ;;
3836                 esac
3837                 case "$redo" in
3838                 '')
3839                         case "$type" in
3840                         File)
3841                                 for fp in $gfpth; do
3842                                         if test "X$fp" = X.; then
3843                                             pf="$ansexp"
3844                                         else    
3845                                             pf="$fp/$ansexp"
3846                                         fi
3847                                         if test -f "$pf"; then
3848                                                 type=''
3849                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3850                                         then
3851                                                 echo "($value is not a plain file, but that's ok.)"
3852                                                 type=''
3853                                         fi
3854                                         if test X"$type" = X; then
3855                                             value="$pf"
3856                                             break
3857                                         fi
3858                                 done
3859                                 ;;
3860                         Directory)
3861                                 for fp in $gfpth; do
3862                                         if test "X$fp" = X.; then
3863                                             dir="$ans"
3864                                             direxp="$ansexp"
3865                                         else    
3866                                             dir="$fp/$ansexp"
3867                                             direxp="$fp/$ansexp"
3868                                         fi
3869                                         if test -d "$direxp"; then
3870                                                 type=''
3871                                                 value="$dir"
3872                                                 break
3873                                         fi
3874                                 done
3875                                 ;;
3876                         Locate)
3877                                 if test -d "$ansexp"; then
3878                                         echo "(Looking for $loc_file in directory $value.)"
3879                                         value="$value/$loc_file"
3880                                         ansexp="$ansexp/$loc_file"
3881                                 fi
3882                                 if test -f "$ansexp"; then
3883                                         type=''
3884                                 fi
3885                                 case "$nopath_ok" in
3886                                 true)   case "$value" in
3887                                         */*) ;;
3888                                         *)      echo "Assuming $value will be in people's path."
3889                                                 type=''
3890                                                 ;;
3891                                         esac
3892                                         ;;
3893                                 esac
3894                                 ;;
3895                         esac
3896
3897                         case "$skip" in
3898                         true) type='';
3899                         esac
3900
3901                         case "$type" in
3902                         '') ;;
3903                         *)
3904                                 if test "$fastread" = yes; then
3905                                         dflt=y
3906                                 else
3907                                         dflt=n
3908                                 fi
3909                                 rp="$what $value doesn't exist.  Use that name anyway?"
3910                                 . UU/myread
3911                                 dflt=''
3912                                 case "$ans" in
3913                                 y*) type='';;
3914                                 *) echo " ";;
3915                                 esac
3916                                 ;;
3917                         esac
3918                         ;;
3919                 esac
3920                 ;;
3921         esac
3922 done
3923 cd UU
3924 ans="$value"
3925 rp="$orig_rp"
3926 dflt="$orig_dflt"
3927 rm -f getfile.ok
3928 test "X$gfpthkeep" != Xy && gfpth=""
3929 EOSC
3930
3931 : What should the include directory be ?
3932 echo " "
3933 $echo $n "Hmm...  $c"
3934 dflt='/usr/include'
3935 incpath=''
3936 mips_type=''
3937 if $test -f /bin/mips && /bin/mips; then
3938         echo "Looks like a MIPS system..."
3939         $cat >usr.c <<'EOCP'
3940 #ifdef SYSTYPE_BSD43
3941 /bsd43
3942 #endif
3943 EOCP
3944         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3945                 dflt='/bsd43/usr/include'
3946                 incpath='/bsd43'
3947                 mips_type='BSD 4.3'
3948         else
3949                 mips_type='System V'
3950         fi
3951         $rm -f usr.c usr.out
3952         echo "and you're compiling with the $mips_type compiler and libraries."
3953         xxx_prompt=y
3954         echo "exit 0" >mips
3955 else
3956         echo "Doesn't look like a MIPS system."
3957         xxx_prompt=n
3958         echo "exit 1" >mips
3959 fi
3960 chmod +x mips
3961 $eunicefix mips
3962 case "$usrinc" in
3963 '') ;;
3964 *) dflt="$usrinc";;
3965 esac
3966 case "$xxx_prompt" in
3967 y)      fn=d/
3968         echo " "
3969         rp='Where are the include files you want to use?'
3970         . ./getfile
3971         usrinc="$ans"
3972         ;;
3973 *)      usrinc="$dflt"
3974         ;;
3975 esac
3976
3977 : Set private lib path
3978 case "$plibpth" in
3979 '') if ./mips; then
3980                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3981         fi;;
3982 esac
3983 case "$libpth" in
3984 ' ') dlist='';;
3985 '') dlist="$loclibpth $plibpth $glibpth";;
3986 *) dlist="$libpth";;
3987 esac
3988
3989 : Now check and see which directories actually exist, avoiding duplicates
3990 libpth=''
3991 for xxx in $dlist
3992 do
3993     if $test -d $xxx; then
3994                 case " $libpth " in
3995                 *" $xxx "*) ;;
3996                 *) libpth="$libpth $xxx";;
3997                 esac
3998     fi
3999 done
4000 $cat <<'EOM'
4001
4002 Some systems have incompatible or broken versions of libraries.  Among
4003 the directories listed in the question below, please remove any you
4004 know not to be holding relevant libraries, and add any that are needed.
4005 Say "none" for none.
4006
4007 EOM
4008 case "$libpth" in
4009 '') dflt='none';;
4010 *)
4011         set X $libpth
4012         shift
4013         dflt=${1+"$@"}
4014         ;;
4015 esac
4016 rp="Directories to use for library searches?"
4017 . ./myread
4018 case "$ans" in
4019 none) libpth=' ';;
4020 *) libpth="$ans";;
4021 esac
4022
4023 : compute shared library extension
4024 case "$so" in
4025 '')
4026         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4027                 dflt='sl'
4028         else
4029                 dflt='so'
4030         fi
4031         ;;
4032 *) dflt="$so";;
4033 esac
4034 $cat <<EOM
4035
4036 On some systems, shared libraries may be available.  Answer 'none' if
4037 you want to suppress searching of shared libraries for the remainder
4038 of this configuration.
4039
4040 EOM
4041 rp='What is the file extension used for shared libraries?'
4042 . ./myread
4043 so="$ans"
4044
4045 : Define several unixisms.
4046 : Hints files or command line option can be used to override them.
4047 : The convoluted testing is in case hints files set either the old
4048 : or the new name.
4049 case "$_exe" in
4050 '')     case "$exe_ext" in
4051     '') ;;
4052         *)      _exe="$exe_ext" ;;
4053         esac
4054         ;;
4055 esac
4056 case "$_a" in
4057 '')     case "$lib_ext" in
4058     '') _a='.a';;
4059         *)      _a="$lib_ext" ;;
4060         esac
4061         ;;
4062 esac
4063 case "$_o" in
4064 '') case "$obj_ext" in
4065         '')     _o='.o';;
4066         *)      _o="$obj_ext";;
4067         esac
4068         ;;
4069 esac
4070 case "$p_" in
4071 '') case "$path_sep" in
4072         '')     p_=':';;
4073         *)      p_="$path_sep";;
4074         esac
4075         ;;
4076 esac
4077 exe_ext=$_exe
4078 lib_ext=$_a
4079 obj_ext=$_o
4080 path_sep=$p_
4081
4082 : Which makefile gets called first.  This is used by make depend.
4083 case "$firstmakefile" in
4084 '') firstmakefile='makefile';;
4085 esac
4086
4087 case "$usesocks" in
4088 $define|true|[yY]*)     dflt='y';;
4089 *) dflt='n';;
4090 esac
4091 cat <<EOM
4092
4093 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4094 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4095 to use the PerlIO abstraction layer, this will be implicitly selected.
4096
4097 If this doesn't make any sense to you, just accept the default '$dflt'.
4098 EOM
4099 rp='Build Perl for SOCKS?'
4100 . ./myread
4101 case "$ans" in
4102 y|Y)    val="$define" ;;     
4103 *)      val="$undef" ;;
4104 esac
4105 set usesocks
4106 eval $setvar
4107
4108 case "$usesocks" in
4109 $define|true|[yY]*) useperlio="$define";;
4110 esac
4111
4112 : Looking for optional libraries
4113 echo " "
4114 echo "Checking for optional libraries..." >&4
4115 case "$libs" in
4116 ' '|'') dflt='';;
4117 *) dflt="$libs";;
4118 esac
4119 case "$libswanted" in
4120 '') libswanted='c_s';;
4121 esac
4122 case "$usesocks" in
4123 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4124 esac
4125 libsfound=''
4126 libsfiles=''
4127 libsdirs=''
4128 libspath=''
4129 for thisdir in $libpth $xlibpth; do
4130   test -d $thisdir && libspath="$libspath $thisdir"
4131 done
4132 for thislib in $libswanted; do
4133         for thisdir in $libspath; do
4134             xxx=''
4135             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4136                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
4137                 $test -f "$xxx" && eval $libscheck
4138                 $test -f "$xxx" && libstyle=shared
4139             fi
4140             if test ! -f "$xxx"; then
4141                 xxx=$thisdir/lib$thislib.$so
4142                 $test -f "$xxx" && eval $libscheck
4143                 $test -f "$xxx" && libstyle=shared
4144             fi  
4145             if test ! -f "$xxx"; then
4146                 xxx=$thisdir/lib$thislib$_a
4147                 $test -f "$xxx" && eval $libscheck
4148                 $test -f "$xxx" && libstyle=static
4149             fi
4150             if test ! -f "$xxx"; then
4151                 xxx=$thisdir/$thislib$_a
4152                 $test -f "$xxx" && eval $libscheck
4153                 $test -f "$xxx" && libstyle=static
4154             fi
4155             if test ! -f "$xxx"; then
4156                 xxx=$thisdir/lib${thislib}_s$_a
4157                 $test -f "$xxx" && eval $libscheck
4158                 $test -f "$xxx" && libstyle=static
4159                 $test -f "$xxx" && thislib=${thislib}_s
4160             fi
4161             if test ! -f "$xxx"; then
4162                 xxx=$thisdir/Slib$thislib$_a
4163                 $test -f "$xxx" && eval $libscheck
4164                 $test -f "$xxx" && libstyle=static
4165             fi
4166             if $test -f "$xxx"; then
4167                 case "$libstyle" in
4168                 shared) echo "Found -l$thislib (shared)." ;;
4169                 static) echo "Found -l$thislib." ;;
4170                 *)      echo "Found -l$thislib ($libstyle)." ;;
4171                 esac
4172                 case " $dflt " in
4173                 *"-l$thislib "*);;
4174                 *) dflt="$dflt -l$thislib"
4175                    libsfound="$libsfound $xxx"
4176                    yyy=`basename $xxx`
4177                    libsfiles="$libsfiles $yyy"
4178                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4179                    case " $libsdirs " in
4180                    *" $yyy "*) ;;
4181                    *) libsdirs="$libsdirs $yyy" ;;
4182                    esac
4183                    ;;
4184                 esac
4185                 break
4186             fi  
4187         done
4188         if $test ! -f "$xxx"; then
4189             echo "No -l$thislib."
4190         fi
4191 done
4192 set X $dflt
4193 shift
4194 dflt="$*"
4195 case "$libs" in
4196 '') dflt="$dflt";;
4197 *) dflt="$libs";;
4198 esac
4199 case "$dflt" in
4200 ' '|'') dflt='none';;
4201 esac
4202
4203 $cat <<EOM
4204
4205 In order to compile $package on your machine, a number of libraries
4206 are usually needed.  Include any other special libraries here as well.
4207 Say "none" for none.  The default list is almost always right.
4208 EOM
4209
4210 echo " "
4211 rp="What libraries to use?"
4212 . ./myread
4213 case "$ans" in
4214 none) libs=' ';;
4215 *) libs="$ans";;
4216 esac
4217
4218 : determine optimization, if desired, or use for debug flag also
4219 case "$optimize" in
4220 ' '|$undef) dflt='none';;
4221 '') dflt='-O';;
4222 *) dflt="$optimize";;
4223 esac
4224 $cat <<EOH
4225
4226 By default, $package compiles with the -O flag to use the optimizer.
4227 Alternately, you might want to use the symbolic debugger, which uses
4228 the -g flag (on traditional Unix systems).  Either flag can be
4229 specified here.  To use neither flag, specify the word "none".
4230
4231 EOH
4232 rp="What optimizer/debugger flag should be used?"
4233 . ./myread
4234 optimize="$ans"
4235 case "$optimize" in
4236 'none') optimize=" ";;
4237 esac
4238
4239 dflt=''
4240 : We will not override a previous value, but we might want to
4241 : augment a hint file
4242 case "$hint" in
4243 default|recommended)
4244         case "$gccversion" in
4245         1*) dflt='-fpcc-struct-return' ;;
4246         esac
4247         case "$optimize" in
4248         *-g*) dflt="$dflt -DDEBUGGING";;
4249         esac
4250         case "$gccversion" in
4251         2*) if test -d /etc/conf/kconfig.d &&
4252                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4253                 then
4254                         dflt="$dflt -posix"
4255                 fi
4256                 ;;
4257         esac
4258         case "$gccversion" in
4259         1*) ;;
4260         2.[0-8]*) ;;
4261         ?*)     echo " "
4262                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4263                 echo 'int main(void) { return 0; }' > gcctest.c
4264                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4265                         echo "Yes, it does." 2>&1
4266                         case "$ccflags" in
4267                         *strict-aliasing*) 
4268                                 echo "Leaving current flags $ccflags alone." 2>&1
4269                                 ;;
4270                         *) dflt="$dflt -fno-strict-aliasing" ;;
4271                         esac
4272                 else
4273                         echo "Nope, it doesn't, but that's ok." 2>&1
4274                 fi
4275                 ;;
4276         esac
4277         ;;
4278 esac
4279
4280 case "$mips_type" in
4281 *BSD*|'') inclwanted="$locincpth $usrinc";;
4282 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4283 esac
4284 for thisincl in $inclwanted; do
4285         if $test -d $thisincl; then
4286                 if $test x$thisincl != x$usrinc; then
4287                         case "$dflt" in
4288                         *" -I$thisincl "*);;
4289                         *) dflt="$dflt -I$thisincl ";;
4290                         esac
4291                 fi
4292         fi
4293 done
4294
4295 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4296         xxx=true;
4297 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4298         xxx=true;
4299 else
4300         xxx=false;
4301 fi;
4302 if $xxx; then
4303         case "$dflt" in
4304         *$2*);;
4305         *) dflt="$dflt -D$2";;
4306         esac;
4307 fi'
4308
4309 set signal.h LANGUAGE_C; eval $inctest
4310
4311 case "$usesocks" in
4312 $define)
4313         ccflags="$ccflags -DSOCKS"
4314         ;;
4315 esac
4316
4317 case "$hint" in
4318 default|recommended) dflt="$ccflags $dflt" ;;
4319 *) dflt="$ccflags";;
4320 esac
4321
4322 case "$dflt" in
4323 ''|' ') dflt=none;;
4324 esac
4325
4326 $cat <<EOH
4327
4328 Your C compiler may want other flags.  For this question you should include
4329 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4330 but you should NOT include libraries or ld flags like -lwhatever.  If you
4331 want $package to honor its debug switch, you should include -DDEBUGGING here.
4332 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4333
4334 To use no flags, specify the word "none".
4335
4336 EOH
4337 set X $dflt
4338 shift
4339 dflt=${1+"$@"}
4340 rp="Any additional cc flags?"
4341 . ./myread
4342 case "$ans" in
4343 none) ccflags='';;
4344 *) ccflags="$ans";;
4345 esac
4346
4347 : the following weeds options from ccflags that are of no interest to cpp
4348 case "$cppflags" in
4349 '') cppflags="$ccflags" ;;
4350 *)  cppflags="$cppflags $ccflags" ;;
4351 esac
4352 case "$gccversion" in
4353 1*) cppflags="$cppflags -D__GNUC__"
4354 esac
4355 case "$mips_type" in
4356 '');;
4357 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4358 esac
4359 case "$cppflags" in
4360 '');;
4361 *)
4362         echo " "
4363         echo "Let me guess what the preprocessor flags are..." >&4
4364         set X $cppflags
4365         shift
4366         cppflags=''
4367         $cat >cpp.c <<'EOM'
4368 #define BLURFL foo
4369
4370 BLURFL xx LFRULB
4371 EOM
4372         previous=''
4373         for flag in $*
4374         do
4375                 case "$flag" in
4376                 -*) ftry="$flag";;
4377                 *) ftry="$previous $flag";;
4378                 esac
4379                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4380                         >cpp1.out 2>/dev/null && \
4381                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4382                         >cpp2.out 2>/dev/null && \
4383                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4384                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4385                 then
4386                         cppflags="$cppflags $ftry"
4387                         previous=''
4388                 else
4389                         previous="$flag"
4390                 fi
4391         done
4392         set X $cppflags
4393         shift
4394         cppflags=${1+"$@"}
4395         case "$cppflags" in
4396         *-*)  echo "They appear to be: $cppflags";;
4397         esac
4398         $rm -f cpp.c cpp?.out
4399         ;;
4400 esac
4401
4402 : flags used in final linking phase
4403 case "$ldflags" in
4404 '') if ./venix; then
4405                 dflt='-i -z'
4406         else
4407                 dflt=''
4408         fi
4409         case "$ccflags" in
4410         *-posix*) dflt="$dflt -posix" ;;
4411         esac
4412         ;;
4413 *) dflt="$ldflags";;
4414 esac
4415
4416 : Try to guess additional flags to pick up local libraries.
4417 for thislibdir in $libpth; do
4418         case " $loclibpth " in
4419         *" $thislibdir "*)
4420                 case "$dflt " in 
4421                 *"-L$thislibdir "*) ;;
4422                 *)  dflt="$dflt -L$thislibdir" ;;
4423                 esac
4424                 ;;
4425         esac
4426 done
4427
4428 case "$dflt" in
4429 '') dflt='none' ;;
4430 esac
4431
4432 $cat <<EOH
4433
4434 Your C linker may need flags.  For this question you should
4435 include -L/whatever and any other flags used by the C linker, but you
4436 should NOT include libraries like -lwhatever.
4437
4438 Make sure you include the appropriate -L/path flags if your C linker
4439 does not normally search all of the directories you specified above,
4440 namely
4441         $libpth
4442 To use no flags, specify the word "none".
4443
4444 EOH
4445
4446 rp="Any additional ld flags (NOT including libraries)?"
4447 . ./myread
4448 case "$ans" in
4449 none) ldflags='';;
4450 *) ldflags="$ans";;
4451 esac
4452 rmlist="$rmlist pdp11"
4453
4454 : coherency check
4455 echo " "
4456 echo "Checking your choice of C compiler and flags for coherency..." >&4
4457 $cat > try.c <<'EOF'
4458 #include <stdio.h>
4459 int main() { printf("Ok\n"); exit(0); }
4460 EOF
4461 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4462 shift
4463 $cat >try.msg <<'EOM'
4464 I've tried to compile and run the following simple program:
4465
4466 EOM
4467 $cat try.c >> try.msg
4468
4469 $cat >> try.msg <<EOM
4470
4471 I used the command:
4472
4473         $*
4474         $run ./try
4475
4476 and I got the following output:
4477
4478 EOM
4479 dflt=y
4480 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4481         if $sh -c "$run ./try" >>try.msg 2>&1; then
4482                 xxx=`$run ./try`
4483                 case "$xxx" in
4484                 "Ok") dflt=n ;;
4485                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4486                         case " $libs " in
4487                         *" -lsfio "*)
4488                                 cat >> try.msg <<'EOQS'
4489 If $libs contains -lsfio, and sfio is mis-configured, then it
4490 sometimes (apparently) runs and exits with a 0 status, but with no
4491 output!  It may have to do with sfio's use of _exit vs. exit.
4492
4493 EOQS
4494                                 rp="You have a big problem.  Shall I abort Configure"
4495                                 dflt=y
4496                                 ;;
4497                         esac
4498                         ;;
4499                 esac
4500         else
4501                 echo "The program compiled OK, but exited with status $?." >>try.msg
4502                 rp="You have a problem.  Shall I abort Configure"
4503                 dflt=y
4504         fi
4505 else
4506         echo "I can't compile the test program." >>try.msg
4507         rp="You have a BIG problem.  Shall I abort Configure"
4508         dflt=y
4509 fi
4510 case "$dflt" in
4511 y)
4512         $cat try.msg >&4
4513         case "$knowitall" in
4514         '')
4515                 echo "(The supplied flags or libraries might be incorrect.)"
4516                 ;;
4517         *) dflt=n;;
4518         esac
4519         echo " "
4520         . ./myread
4521         case "$ans" in
4522         n*|N*) ;;
4523         *)      echo "Ok.  Stopping Configure." >&4
4524                 exit 1
4525                 ;;
4526         esac
4527         ;;
4528 n) echo "OK, that should do.";;
4529 esac
4530 $rm -f try try.* core
4531
4532 : define an is-a-typedef? function
4533 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4534 case "$inclist" in
4535 "") inclist="sys/types.h";;
4536 esac;
4537 eval "varval=\$$var";
4538 case "$varval" in
4539 "")
4540         $rm -f temp.c;
4541         for inc in $inclist; do
4542                 echo "#include <$inc>" >>temp.c;
4543         done;
4544         echo "#ifdef $type" >> temp.c;
4545         echo "printf(\"We have $type\");" >> temp.c;
4546         echo "#endif" >> temp.c;
4547         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4548         if $contains $type temp.E >/dev/null 2>&1; then
4549                 eval "$var=\$type";
4550         else
4551                 eval "$var=\$def";
4552         fi;
4553         $rm -f temp.?;;
4554 *) eval "$var=\$varval";;
4555 esac'
4556
4557 : define an is-a-typedef? function that prompts if the type is not available.
4558 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4559 case "$inclist" in
4560 "") inclist="sys/types.h";;
4561 esac;
4562 eval "varval=\$$var";
4563 case "$varval" in
4564 "")
4565         $rm -f temp.c;
4566         for inc in $inclist; do
4567                 echo "#include <$inc>" >>temp.c;
4568         done;
4569         echo "#ifdef $type" >> temp.c;
4570         echo "printf(\"We have $type\");" >> temp.c;
4571         echo "#endif" >> temp.c;
4572         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4573         echo " " ;
4574         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4575         if $contains $type temp.E >/dev/null 2>&1; then
4576                 echo "$type found." >&4;
4577                 eval "$var=\$type";
4578         else
4579                 echo "$type NOT found." >&4;
4580                 dflt="$def";
4581                 . ./myread ;
4582                 eval "$var=\$ans";
4583         fi;
4584         $rm -f temp.?;;
4585 *) eval "$var=\$varval";;
4586 esac'
4587
4588 : define a shorthand compile call
4589 compile='
4590 mc_file=$1;
4591 shift;
4592 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4593 : define a shorthand compile call for compilations that should be ok.
4594 compile_ok='
4595 mc_file=$1;
4596 shift;
4597 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4598
4599 : check for lengths of integral types
4600 echo " "
4601 case "$intsize" in
4602 '')
4603         echo "Checking to see how big your integers are..." >&4
4604         $cat >try.c <<'EOCP'
4605 #include <stdio.h>
4606 int main()
4607 {
4608         printf("intsize=%d;\n", (int)sizeof(int));
4609         printf("longsize=%d;\n", (int)sizeof(long));
4610         printf("shortsize=%d;\n", (int)sizeof(short));
4611         exit(0);
4612 }
4613 EOCP
4614         set try
4615         if eval $compile_ok && $run ./try > /dev/null; then
4616                 eval `$run ./try`
4617                 echo "Your integers are $intsize bytes long."
4618                 echo "Your long integers are $longsize bytes long."
4619                 echo "Your short integers are $shortsize bytes long."
4620         else
4621                 $cat >&4 <<EOM
4622 !
4623 Help! I can't compile and run the intsize test program: please enlighten me!
4624 (This is probably a misconfiguration in your system or libraries, and
4625 you really ought to fix it.  Still, I'll try anyway.)
4626 !
4627 EOM
4628                 dflt=4
4629                 rp="What is the size of an integer (in bytes)?"
4630                 . ./myread
4631                 intsize="$ans"
4632                 dflt=$intsize
4633                 rp="What is the size of a long integer (in bytes)?"
4634                 . ./myread
4635                 longsize="$ans"
4636                 dflt=2
4637                 rp="What is the size of a short integer (in bytes)?"
4638                 . ./myread
4639                 shortsize="$ans"
4640         fi
4641         ;;
4642 esac
4643 $rm -f try try.*
4644
4645 : see what type lseek is declared as in the kernel
4646 rp="What is the type used for lseek's offset on this system?"
4647 set off_t lseektype long stdio.h sys/types.h
4648 eval $typedef_ask
4649
4650 echo " "
4651 echo "Checking to see how big your file offsets are..." >&4
4652 $cat >try.c <<EOCP
4653 #include <sys/types.h>
4654 #include <stdio.h>
4655 int main()
4656 {
4657     printf("%d\n", (int)sizeof($lseektype));
4658     return(0); 
4659 }
4660 EOCP
4661 set try
4662 if eval $compile_ok; then
4663         lseeksize=`$run ./try`
4664         echo "Your file offsets are $lseeksize bytes long."
4665 else
4666         dflt=$longsize
4667         echo " "
4668         echo "(I can't seem to compile the test program.  Guessing...)"
4669         rp="What is the size of your file offsets (in bytes)?"
4670         . ./myread
4671         lseeksize="$ans"
4672 fi
4673 $rm -f try.c try
4674
4675 : see what type file positions are declared as in the library
4676 rp="What is the type for file position used by fsetpos()?"
4677 set fpos_t fpostype long stdio.h sys/types.h
4678 eval $typedef_ask
4679
4680 echo " "
4681 case "$fpostype" in
4682 *_t) zzz="$fpostype"    ;;
4683 *)   zzz="fpos_t"       ;;
4684 esac
4685 echo "Checking the size of $zzz..." >&4 
4686 cat > try.c <<EOCP
4687 #include <sys/types.h>
4688 #include <stdio.h>
4689 int main() {
4690     printf("%d\n", (int)sizeof($fpostype));
4691     exit(0);
4692 }
4693 EOCP
4694 set try
4695 if eval $compile_ok; then
4696         yyy=`$run ./try`
4697         case "$yyy" in
4698         '')     fpossize=4
4699                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4700                 ;;
4701         *)      fpossize=$yyy
4702                 echo "Your $zzz is $fpossize bytes long."
4703                 ;;
4704         esac
4705 else
4706         dflt="$longsize"
4707         echo " " >&4
4708         echo "(I can't compile the test program.  Guessing...)" >&4
4709         rp="What is the size of your file positions (in bytes)?"
4710         . ./myread
4711         fpossize="$ans"
4712 fi
4713
4714
4715
4716 # Backward compatibility (uselfs is deprecated).
4717 case "$uselfs" in
4718 "$define"|true|[yY]*)
4719         cat <<EOM >&4
4720
4721 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4722 EOM
4723         uselargefiles="$define"
4724         ;;
4725 esac                          
4726
4727 case "$lseeksize:$fpossize" in
4728 8:8) cat <<EOM
4729
4730 You can have files larger than 2 gigabytes.
4731 EOM
4732    val="$define" ;;
4733 *)    case "$uselargefiles" in
4734    "$undef"|false|[nN]*) dflt='n' ;;
4735    *)   dflt='y' ;;
4736    esac
4737    cat <<EOM
4738
4739 Perl can be built to understand large files (files larger than 2 gigabytes)
4740 on some systems.  To do so, Configure can be run with -Duselargefiles.
4741
4742 If this doesn't make any sense to you, just accept the default '$dflt'.
4743 EOM
4744    rp='Try to understand large files, if available?'
4745    . ./myread
4746    case "$ans" in
4747    y|Y)         val="$define" ;;
4748    *)           val="$undef"  ;;
4749    esac
4750    ;;
4751 esac
4752 set uselargefiles
4753 eval $setvar
4754 case "$uselargefiles" in
4755 "$define")
4756 : Look for a hint-file generated 'call-back-unit'.  If the
4757 : user has specified that a large files perl is to be built,
4758 : we may need to set or change some other defaults.
4759         if $test -f uselargefiles.cbu; then
4760                 echo "Your platform has some specific hints for large file builds, using them..."
4761                 . ./uselargefiles.cbu
4762                 echo " "
4763                 echo "Rechecking to see how big your file offsets are..." >&4
4764                 $cat >try.c <<EOCP
4765 #include <sys/types.h>
4766 #include <stdio.h>
4767 int main()
4768 {
4769     printf("%d\n", (int)sizeof($lseektype));
4770     return(0); 
4771 }
4772 EOCP
4773                 set try
4774                 if eval $compile_ok; then
4775                         lseeksize=`$run ./try`
4776                         $echo "Your file offsets are now $lseeksize bytes long."
4777                 else
4778                         dflt="$lseeksize"
4779                         echo " "
4780                         echo "(I can't seem to compile the test program.  Guessing...)"
4781                         rp="What is the size of your file offsets (in bytes)?"
4782                         . ./myread
4783                         lseeksize="$ans"
4784                 fi
4785                 case "$fpostype" in
4786                 *_t) zzz="$fpostype"    ;;
4787                 *)   zzz="fpos_t"       ;;
4788                 esac
4789                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4790                 $cat > try.c <<EOCP
4791 #include <sys/types.h>
4792 #include <stdio.h>
4793 int main() {
4794     printf("%d\n", (int)sizeof($fpostype));
4795     exit(0);
4796 }
4797 EOCP
4798                 set try
4799                 if eval $compile_ok; then
4800                         yyy=`$run ./try`
4801                         dflt="$lseeksize"
4802                         case "$yyy" in
4803                         '')     echo " "
4804                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4805                                 ;;
4806                         *)      fpossize=$yyy
4807                                 echo " $fpossize bytes." >&4
4808                                 ;;
4809                         esac
4810                 else
4811                         dflt="$fpossize"
4812                         echo " "
4813                         echo "(I can't compile the test program.  Guessing...)" >&4
4814                         rp="What is the size of your file positions (in bytes)?"
4815                         . ./myread
4816                         fpossize="$ans"
4817                 fi
4818                 $rm -f try.c try
4819         fi
4820         ;;
4821 esac
4822
4823
4824 case "$usemorebits" in
4825 "$define"|true|[yY]*)
4826         use64bitint="$define"
4827         uselongdouble="$define"
4828         usemorebits="$define"
4829         ;;
4830 *)      usemorebits="$undef"
4831         ;;
4832 esac
4833
4834 : check for void type
4835 echo " "
4836 echo "Checking to see how well your C compiler groks the void type..." >&4
4837 case "$voidflags" in
4838 '')
4839         $cat >try.c <<'EOCP'
4840 #if TRY & 1
4841 void sub() {
4842 #else
4843 sub() {
4844 #endif
4845         extern void moo();      /* function returning void */
4846         void (*goo)();          /* ptr to func returning void */
4847 #if TRY & 8
4848         void *hue;              /* generic ptr */
4849 #endif
4850 #if TRY & 2
4851         void (*foo[10])();
4852 #endif
4853
4854 #if TRY & 4
4855         if(goo == moo) {
4856                 exit(0);
4857         }
4858 #endif
4859         exit(0);
4860 }
4861 int main() { sub(); }
4862 EOCP
4863         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4864                 voidflags=$defvoidused
4865         echo "Good.  It appears to support void to the level $package wants.">&4
4866                 if $contains warning .out >/dev/null 2>&1; then
4867                         echo "However, you might get some warnings that look like this:"
4868                         $cat .out
4869                 fi
4870         else
4871 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4872                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4873                         echo "It supports 1..."
4874                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4875                                 echo "It also supports 2..."
4876                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4877                                         voidflags=7
4878                                         echo "And it supports 4 but not 8 definitely."
4879                                 else
4880                                         echo "It doesn't support 4..."
4881                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4882                                                 voidflags=11
4883                                                 echo "But it supports 8."
4884                                         else
4885                                                 voidflags=3
4886                                                 echo "Neither does it support 8."
4887                                         fi
4888                                 fi
4889                         else
4890                                 echo "It does not support 2..."
4891                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4892                                         voidflags=13
4893                                         echo "But it supports 4 and 8."
4894                                 else
4895                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4896                                                 voidflags=5
4897                                                 echo "And it supports 4 but has not heard about 8."
4898                                         else
4899                                                 echo "However it supports 8 but not 4."
4900                                         fi
4901                                 fi
4902                         fi
4903                 else
4904                         echo "There is no support at all for void."
4905                         voidflags=0
4906                 fi
4907         fi
4908 esac
4909 case "$voidflags" in
4910 "$defvoidused") ;;
4911 *)      $cat >&4 <<'EOM'
4912   Support flag bits are:
4913     1: basic void declarations.
4914     2: arrays of pointers to functions returning void.
4915     4: operations between pointers to and addresses of void functions.
4916     8: generic void pointers.
4917 EOM
4918         dflt="$voidflags";
4919         rp="Your void support flags add up to what?"
4920         . ./myread
4921         voidflags="$ans"
4922         ;;
4923 esac
4924 $rm -f try.* .out
4925
4926 : check for length of pointer
4927 echo " "
4928 case "$ptrsize" in
4929 '')
4930         echo "Checking to see how big your pointers are..." >&4
4931         if test "$voidflags" -gt 7; then
4932                 echo '#define VOID_PTR char *' > try.c
4933         else
4934                 echo '#define VOID_PTR void *' > try.c
4935         fi
4936         $cat >>try.c <<'EOCP'
4937 #include <stdio.h>
4938 int main()
4939 {
4940     printf("%d\n", (int)sizeof(VOID_PTR));
4941     exit(0);
4942 }
4943 EOCP
4944         set try
4945         if eval $compile_ok; then
4946                 ptrsize=`$run ./try`
4947                 echo "Your pointers are $ptrsize bytes long."
4948         else
4949                 dflt='4'
4950                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4951                 rp="What is the size of a pointer (in bytes)?"
4952                 . ./myread
4953                 ptrsize="$ans"
4954         fi
4955         ;;
4956 esac
4957 $rm -f try.c try
4958
4959 : check for long long
4960 echo " "
4961 echo "Checking to see if you have long long..." >&4
4962 echo 'int main() { long long x = 7; return 0; }' > try.c
4963 set try
4964 if eval $compile; then
4965         val="$define"
4966         echo "You have long long."
4967 else
4968         val="$undef"
4969         echo "You do not have long long."
4970 fi
4971 $rm try.*
4972 set d_longlong
4973 eval $setvar
4974
4975 : check for length of long long
4976 case "${d_longlong}${longlongsize}" in
4977 $define)
4978         echo " "
4979         echo "Checking to see how big your long longs are..." >&4
4980         $cat >try.c <<'EOCP'
4981 #include <stdio.h>
4982 int main()
4983 {
4984     printf("%d\n", (int)sizeof(long long));
4985     return(0);
4986 }
4987 EOCP
4988         set try
4989         if eval $compile_ok; then
4990                 longlongsize=`$run ./try`
4991                 echo "Your long longs are $longlongsize bytes long."
4992         else
4993                 dflt='8'
4994                 echo " "
4995                 echo "(I can't seem to compile the test program.  Guessing...)"
4996                 rp="What is the size of a long long (in bytes)?"
4997                 . ./myread
4998                 longlongsize="$ans"
4999         fi
5000         if $test "X$longsize" = "X$longlongsize"; then
5001                 echo "(That isn't any different from an ordinary long.)"
5002         fi      
5003         ;;
5004 esac
5005 $rm -f try.* try
5006
5007 : determine filename position in cpp output
5008 echo " "
5009 echo "Computing filename position in cpp output for #include directives..." >&4
5010 echo '#include <stdio.h>' > foo.c
5011 $cat >fieldn <<EOF
5012 $startsh
5013 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5014 $grep '^[       ]*#.*stdio\.h' | \
5015 while read cline; do
5016         pos=1
5017         set \$cline
5018         while $test \$# -gt 0; do
5019                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5020                         echo "\$pos"
5021                         exit 0
5022                 fi
5023                 shift
5024                 pos=\`expr \$pos + 1\`
5025         done
5026 done
5027 EOF
5028 chmod +x fieldn
5029 fieldn=`./fieldn`
5030 $rm -f foo.c fieldn
5031 case $fieldn in
5032 '') pos='???';;
5033 1) pos=first;;
5034 2) pos=second;;
5035 3) pos=third;;
5036 *) pos="${fieldn}th";;
5037 esac
5038 echo "Your cpp writes the filename in the $pos field of the line."
5039
5040 : locate header file
5041 $cat >findhdr <<EOF
5042 $startsh
5043 wanted=\$1
5044 name=''
5045 for usrincdir in $usrinc
5046 do
5047         if test -f \$usrincdir/\$wanted; then
5048                 echo "\$usrincdir/\$wanted"
5049                 exit 0
5050         fi
5051 done
5052 awkprg='{ print \$$fieldn }'
5053 echo "#include <\$wanted>" > foo\$\$.c
5054 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5055 $grep "^[       ]*#.*\$wanted" | \
5056 while read cline; do
5057         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5058         case "\$name" in
5059         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5060         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5061         *) exit 2;;
5062         esac;
5063 done;
5064 #
5065 # status = 0: grep returned 0 lines, case statement not executed
5066 # status = 1: headerfile found
5067 # status = 2: while loop executed, no headerfile found
5068 #
5069 status=\$?
5070 $rm -f foo\$\$.c;
5071 if test \$status -eq 1; then
5072         exit 0;
5073 fi
5074 exit 1
5075 EOF
5076 chmod +x findhdr
5077
5078 : define an alternate in-header-list? function
5079 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5080 cont=true; xxf="echo \"<\$1> found.\" >&4";
5081 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5082 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5083 esac;
5084 case $# in 4) instead=instead;; *) instead="at last";; esac;
5085 while $test "$cont"; do
5086         xxx=`./findhdr $1`
5087         var=$2; eval "was=\$$2";
5088         if $test "$xxx" && $test -r "$xxx";
5089         then eval $xxf;
5090         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5091                 cont="";
5092         else eval $xxnf;
5093         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5094         set $yyy; shift; shift; yyy=$@;
5095         case $# in 0) cont="";;
5096         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5097                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5098         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5099                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5100         esac;
5101 done;
5102 while $test "$yyy";
5103 do set $yyy; var=$2; eval "was=\$$2";
5104         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5105         set $yyy; shift; shift; yyy=$@;
5106 done'
5107
5108 : see if inttypes.h is available
5109 : we want a real compile instead of Inhdr because some systems
5110 : have an inttypes.h which includes non-existent headers
5111 echo " "
5112 $cat >try.c <<EOCP
5113 #include <inttypes.h>
5114 int main() {
5115         static int32_t foo32 = 0x12345678;
5116 }
5117 EOCP
5118 set try
5119 if eval $compile; then
5120         echo "<inttypes.h> found." >&4
5121         val="$define"
5122 else
5123         echo "<inttypes.h> NOT found." >&4
5124         val="$undef"
5125 fi
5126 $rm -f try.c try
5127 set i_inttypes
5128 eval $setvar
5129
5130 : check for int64_t
5131 echo " "
5132 echo "Checking to see if you have int64_t..." >&4
5133 $cat >try.c <<EOCP
5134 #include <sys/types.h>
5135 #$i_inttypes I_INTTYPES
5136 #ifdef I_INTTYPES
5137 #include <inttypes.h>
5138 #endif
5139 int main() { int64_t x = 7; }
5140 EOCP
5141 set try
5142 if eval $compile; then
5143         val="$define"
5144         echo "You have int64_t."
5145 else
5146         val="$undef"
5147         echo "You do not have int64_t."
5148 fi
5149 $rm -f try try.*
5150 set d_int64_t
5151 eval $setvar
5152
5153
5154 echo " "
5155 echo "Checking which 64-bit integer type we could use..." >&4
5156
5157 case "$intsize" in
5158 8) val=int
5159    set quadtype
5160    eval $setvar
5161    val='"unsigned int"'
5162    set uquadtype
5163    eval $setvar
5164    quadkind=1
5165    ;;
5166 *) case "$longsize" in
5167    8) val=long
5168       set quadtype
5169       eval $setvar
5170       val='"unsigned long"'
5171       set uquadtype
5172       eval $setvar
5173       quadkind=2
5174       ;;
5175    *) case "$d_longlong:$longlongsize" in
5176       define:8)
5177         val='"long long"'
5178         set quadtype
5179         eval $setvar
5180         val='"unsigned long long"'
5181         set uquadtype
5182         eval $setvar
5183         quadkind=3
5184         ;;
5185       *) case "$d_int64_t" in
5186          define)
5187            val=int64_t
5188            set quadtype
5189            eval $setvar
5190            val=uint64_t
5191            set uquadtype
5192            eval $setvar
5193            quadkind=4
5194            ;;
5195          esac
5196          ;;
5197       esac
5198       ;;
5199    esac
5200    ;;
5201 esac
5202
5203 case "$quadtype" in
5204 '')     echo "Alas, no 64-bit integer types in sight." >&4
5205         d_quad="$undef"
5206         ;;
5207 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5208         d_quad="$define"
5209         ;;
5210 esac
5211
5212
5213 case "$uselonglong" in
5214 "$define"|true|[yY]*)
5215         cat <<EOM >&4
5216
5217 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5218 EOM
5219         use64bitint="$define"
5220         ;;
5221 esac                          
5222 case "$use64bits" in
5223 "$define"|true|[yY]*)
5224         cat <<EOM >&4
5225
5226 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5227 EOM
5228         use64bitint="$define"
5229         ;;
5230 esac                          
5231 case "$use64bitints" in
5232 "$define"|true|[yY]*)
5233         cat <<EOM >&4
5234
5235 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5236 EOM
5237         use64bitint="$define"
5238         ;;
5239 esac                          
5240 case "$use64bitsint" in
5241 "$define"|true|[yY]*)
5242         cat <<EOM >&4
5243
5244 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5245 EOM
5246         use64bitint="$define"
5247         ;;
5248 esac                          
5249 case "$uselonglongs" in
5250 "$define"|true|[yY]*)
5251         cat <<EOM >&4
5252
5253 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5254 EOM
5255         use64bitint="$define"
5256         ;;
5257 esac                          
5258 case "$use64bitsall" in
5259 "$define"|true|[yY]*)
5260         cat <<EOM >&4
5261
5262 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5263 EOM
5264         use64bitall="$define"
5265         ;;
5266 esac                          
5267
5268 case "$ccflags" in
5269 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5270 esac
5271 case "$use64bitall" in
5272 "$define"|true|[yY]*) use64bitint="$define" ;;
5273 esac
5274
5275 case "$longsize" in
5276 8) cat <<EOM
5277
5278 You have natively 64-bit long integers.
5279 EOM
5280    val="$define"
5281    ;;
5282 *) case "$use64bitint" in
5283    "$define"|true|[yY]*) dflt='y';;
5284    *) dflt='n';;
5285    esac
5286    case "$d_quad" in
5287    "$define") ;;
5288    *) dflt='n' ;;
5289    esac
5290    cat <<EOM
5291
5292 Perl can be built to take advantage of 64-bit integer types
5293 on some systems.  To do so, Configure can be run with -Duse64bitint.
5294 Choosing this option will most probably introduce binary incompatibilities.
5295
5296 If this doesn't make any sense to you, just accept the default '$dflt'.
5297 (The default has been chosen based on your configuration.)
5298 EOM
5299    rp='Try to use 64-bit integers, if available?'
5300    . ./myread
5301    case "$ans" in
5302    [yY]*) val="$define" ;;
5303    *)     val="$undef"  ;;
5304    esac
5305    ;;
5306 esac
5307 set use64bitint
5308 eval $setvar
5309
5310 case "$use64bitall" in
5311 "$define"|true|[yY]*) dflt='y' ;;
5312 *) case "$longsize" in
5313    8) dflt='y' ;;
5314    *) dflt='n' ;;
5315    esac
5316    ;;
5317 esac    
5318 cat <<EOM
5319
5320 You may also choose to try maximal 64-bitness.  It means using as much
5321 64-bitness as possible on the platform.  This in turn means even more
5322 binary incompatibilities.  On the other hand, your platform may not
5323 have any more 64-bitness available than what you already have chosen.
5324
5325 If this doesn't make any sense to you, just accept the default '$dflt'.
5326 (The default has been chosen based on your configuration.)
5327 EOM
5328 rp='Try to use maximal 64-bit support, if available?'
5329 . ./myread
5330 case "$ans" in
5331 [yY]*) val="$define" ;;
5332 *)     val="$undef"  ;;
5333 esac
5334 set use64bitall
5335 eval $setvar
5336 case "$use64bitall" in
5337 "$define")
5338         case "$use64bitint" in
5339         "$undef")
5340                 cat <<EOM
5341
5342 Since you have chosen a maximally 64-bit build, I'm also turning on
5343 the use of 64-bit integers.
5344 EOM
5345                 use64bitint="$define" ;;
5346         esac
5347         ;;
5348 esac
5349
5350 case "$use64bitall" in
5351 "$define"|true|[yY]*)
5352         case "$ptrsize" in
5353         4)      cat <<EOM >&4
5354
5355 *** You have chosen a maximally 64-bit build, but your pointers
5356 *** are only 4 bytes wide, disabling maximal 64-bitness.
5357
5358 EOM
5359                 use64bitall="$undef"
5360                 case "$use64bitint" in
5361                 "$define"|true|[yY]*) ;;
5362                 *)      cat <<EOM >&4
5363
5364 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5365
5366 EOM
5367                         use64bitint="$define"
5368                         ;;
5369                 esac
5370                 ;;
5371         esac
5372         ;;
5373 esac
5374
5375 case "$use64bitint" in
5376 "$define"|true|[yY]*)
5377 : Look for a hint-file generated 'call-back-unit'.  If the
5378 : user has specified that a 64-bit perl is to be built,
5379 : we may need to set or change some other defaults.
5380         if $test -f use64bitint.cbu; then
5381                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5382                 . ./use64bitint.cbu
5383         fi
5384         case "$longsize" in
5385         4) case "$archname64" in
5386            '') archname64=64int ;;
5387            esac
5388            ;;
5389         esac
5390         ;;
5391 esac
5392
5393 case "$use64bitall" in
5394 "$define"|true|[yY]*)
5395 : Look for a hint-file generated 'call-back-unit'.  If the
5396 : user has specified that a maximally 64-bit perl is to be built,
5397 : we may need to set or change some other defaults.
5398         if $test -f use64bitall.cbu; then
5399                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5400                 . ./use64bitall.cbu
5401         fi
5402         case "$longsize" in
5403         4) case "$archname64" in
5404            ''|64int) archname64=64all ;;
5405            esac
5406            ;;
5407         esac
5408         ;;
5409 esac
5410
5411 echo " "
5412 echo "Checking for GNU C Library..." >&4
5413 cat >try.c <<EOM
5414 #include <stdio.h>
5415 int main()
5416 {
5417 #ifdef __GLIBC__
5418     exit(0);
5419 #else
5420     exit(1);
5421 #endif
5422 }
5423 EOM
5424 set try
5425 if eval $compile_ok && $run ./try; then
5426         val="$define"
5427         echo "You are using the GNU C Library"
5428 else
5429         val="$undef"
5430         echo "You are not using the GNU C Library"
5431 fi
5432 $rm -f try try.*
5433 set d_gnulibc
5434 eval $setvar
5435
5436 : see if nm is to be used to determine whether a symbol is defined or not
5437 case "$usenm" in
5438 '')
5439         dflt=''
5440         case "$d_gnulibc" in
5441         "$define")
5442                 echo " "
5443                 echo "nm probably won't work on the GNU C Library." >&4
5444                 dflt=n
5445                 ;;
5446         esac
5447         case "$dflt" in
5448         '') 
5449                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5450                         echo " "
5451                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5452                         echo "'nm' won't be sufficient on this sytem." >&4
5453                         dflt=n
5454                 fi
5455                 ;;
5456         esac
5457         case "$dflt" in
5458         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5459                 if $test $dflt -gt 20; then
5460                         dflt=y
5461                 else
5462                         dflt=n
5463                 fi
5464                 ;;
5465         esac
5466         ;;
5467 *)
5468         case "$usenm" in
5469         true|$define) dflt=y;;
5470         *) dflt=n;;
5471         esac
5472         ;;
5473 esac
5474 $cat <<EOM
5475
5476 I can use $nm to extract the symbols from your C libraries. This
5477 is a time consuming task which may generate huge output on the disk (up
5478 to 3 megabytes) but that should make the symbols extraction faster. The
5479 alternative is to skip the 'nm' extraction part and to compile a small
5480 test program instead to determine whether each symbol is present. If
5481 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5482 this may be the best solution.
5483
5484 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5485
5486 EOM
5487 rp="Shall I use $nm to extract C symbols from the libraries?"
5488 . ./myread
5489 case "$ans" in
5490 [Nn]*) usenm=false;;
5491 *) usenm=true;;
5492 esac
5493
5494 runnm=$usenm
5495 case "$reuseval" in
5496 true) runnm=false;;
5497 esac
5498
5499 : nm options which may be necessary
5500 case "$nm_opt" in
5501 '') if $test -f /mach_boot; then
5502                 nm_opt=''       # Mach
5503         elif $test -d /usr/ccs/lib; then
5504                 nm_opt='-p'     # Solaris (and SunOS?)
5505         elif $test -f /dgux; then
5506                 nm_opt='-p'     # DG-UX
5507         elif $test -f /lib64/rld; then
5508                 nm_opt='-p'     # 64-bit Irix
5509         else
5510                 nm_opt=''
5511         fi;;
5512 esac
5513
5514 : nm options which may be necessary for shared libraries but illegal
5515 : for archive libraries.  Thank you, Linux.
5516 case "$nm_so_opt" in
5517 '')     case "$myuname" in
5518         *linux*)
5519                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5520                         nm_so_opt='--dynamic'
5521                 fi
5522                 ;;
5523         esac
5524         ;;
5525 esac
5526
5527 case "$runnm" in
5528 true)
5529 : get list of predefined functions in a handy place
5530 echo " "
5531 case "$libc" in
5532 '') libc=unknown
5533         case "$libs" in
5534         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5535         esac
5536         ;;
5537 esac
5538 case "$libs" in
5539 '') ;;
5540 *)  for thislib in $libs; do
5541         case "$thislib" in
5542         -lc|-lc_s)
5543                 : Handle C library specially below.
5544                 ;;
5545         -l*)
5546                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5547                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5548                         :
5549                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5550                         :
5551                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5552                         :
5553                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5554                         :
5555                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5556                         :
5557                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5558                         :
5559                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5560                         :
5561                 else
5562                         try=''
5563                 fi
5564                 libnames="$libnames $try"
5565                 ;;
5566         *) libnames="$libnames $thislib" ;;
5567         esac
5568         done
5569         ;;
5570 esac
5571 xxx=normal
5572 case "$libc" in
5573 unknown)
5574         set /lib/libc.$so
5575         for xxx in $libpth; do
5576                 $test -r $1 || set $xxx/libc.$so
5577                 : The messy sed command sorts on library version numbers.
5578                 $test -r $1 || \
5579                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5580                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5581                                 h
5582                                 s/[0-9][0-9]*/0000&/g
5583                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5584                                 G
5585                                 s/\n/ /' | \
5586                          $sort | $sed -e 's/^.* //'`
5587                 eval set \$$#
5588         done
5589         $test -r $1 || set /usr/ccs/lib/libc.$so
5590         $test -r $1 || set /lib/libsys_s$_a
5591         ;;
5592 *)
5593         set blurfl
5594         ;;
5595 esac
5596 if $test -r "$1"; then
5597         echo "Your (shared) C library seems to be in $1."
5598         libc="$1"
5599 elif $test -r /lib/libc && $test -r /lib/clib; then
5600         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5601         xxx=apollo
5602         libc='/lib/clib /lib/libc'
5603         if $test -r /lib/syslib; then
5604                 echo "(Your math library is in /lib/syslib.)"
5605                 libc="$libc /lib/syslib"
5606         fi
5607 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5608         echo "Your C library seems to be in $libc, as you said before."
5609 elif $test -r $incpath/usr/lib/libc$_a; then
5610         libc=$incpath/usr/lib/libc$_a;
5611         echo "Your C library seems to be in $libc.  That's fine."
5612 elif $test -r /lib/libc$_a; then
5613         libc=/lib/libc$_a;
5614         echo "Your C library seems to be in $libc.  You're normal."
5615 else
5616         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5617                 :
5618         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5619                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5620         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5621                 :
5622         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5623                 :
5624         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5625                 :
5626         else
5627                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5628         fi
5629         if $test -r "$tans"; then
5630                 echo "Your C library seems to be in $tans, of all places."
5631                 libc=$tans
5632         else
5633                 libc='blurfl'
5634         fi
5635 fi
5636 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5637         dflt="$libc"
5638         cat <<EOM
5639
5640 If the guess above is wrong (which it might be if you're using a strange
5641 compiler, or your machine supports multiple models), you can override it here.
5642
5643 EOM
5644 else
5645         dflt=''
5646         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5647         cat >&4 <<EOM
5648 I can't seem to find your C library.  I've looked in the following places:
5649
5650 EOM
5651         $sed 's/^/      /' libpath
5652         cat <<EOM
5653
5654 None of these seems to contain your C library. I need to get its name...
5655
5656 EOM
5657 fi
5658 fn=f
5659 rp='Where is your C library?'
5660 . ./getfile
5661 libc="$ans"
5662
5663 echo " "
5664 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5665 set X `cat libnames`
5666 shift
5667 xxx=files
5668 case $# in 1) xxx=file; esac
5669 echo "Extracting names from the following $xxx for later perusal:" >&4
5670 echo " "
5671 $sed 's/^/      /' libnames >&4
5672 echo " "
5673 $echo $n "This may take a while...$c" >&4
5674
5675 for file in $*; do
5676         case $file in
5677         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5678         *) $nm $nm_opt $file 2>/dev/null;;
5679         esac
5680 done >libc.tmp
5681
5682 $echo $n ".$c"
5683 $grep fprintf libc.tmp > libc.ptf
5684 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5685 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5686 xxx='[ADTSIW]'
5687 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5688         eval $xscan;\
5689         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5690                 eval $xrun
5691 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5692         eval $xscan;\
5693         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5694                 eval $xrun
5695 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5696         eval $xscan;\
5697         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5698                 eval $xrun
5699 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5700         eval $xscan;\
5701         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5702                 eval $xrun
5703 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5704         eval $xscan;\
5705         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5706                 eval $xrun
5707 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5708         eval $xscan;\
5709         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5710                 eval $xrun
5711 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5712                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5713         eval $xscan;\
5714         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5715                 eval $xrun
5716 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5717         eval $xscan;\
5718         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5719                 eval $xrun
5720 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5721         eval $xscan;\
5722         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5723                 eval $xrun
5724 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5725         eval $xscan;\
5726         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727                 eval $xrun
5728 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5729         eval $xscan;\
5730         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5731                 eval $xrun
5732 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5733         eval $xscan;\
5734         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735                 eval $xrun
5736 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5737         eval $xscan;\
5738         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739                 eval $xrun
5740 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5741         eval $xscan;\
5742         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5743                 eval $xrun
5744 else
5745         $nm -p $* 2>/dev/null >libc.tmp
5746         $grep fprintf libc.tmp > libc.ptf
5747         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5748                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5749         then
5750                 nm_opt='-p'
5751                 eval $xrun
5752         else
5753                 echo " "
5754                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5755                 com=''
5756                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5757                         for thisname in $libnames $libc; do
5758                                 $ar t $thisname >>libc.tmp
5759                         done
5760                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5761                         echo "Ok." >&4
5762                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5763                         # Repeat libc to extract forwarders to DLL entries too
5764                         for thisname in $libnames $libc; do
5765                                 $ar tv $thisname >>libc.tmp
5766                                 # Revision 50 of EMX has bug in $ar.
5767                                 # it will not extract forwarders to DLL entries
5768                                 # Use emximp which will extract exactly them.
5769                                 emximp -o tmp.imp $thisname \
5770                                     2>/dev/null && \
5771                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5772                                     < tmp.imp >>libc.tmp
5773                                 $rm tmp.imp
5774                         done
5775                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5776                         echo "Ok." >&4
5777                 else
5778                         echo "$ar didn't seem to work right." >&4
5779                         echo "Maybe this is a Cray...trying bld instead..." >&4
5780                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5781                         then
5782                                 for thisname in $libnames; do
5783                                         bld t $libnames | \
5784                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5785                                         $ar t $thisname >>libc.tmp
5786                                 done
5787                                 echo "Ok." >&4
5788                         else
5789                                 echo "That didn't work either.  Giving up." >&4
5790                                 exit 1
5791                         fi
5792                 fi
5793         fi
5794 fi
5795 nm_extract="$com"
5796 if $test -f /lib/syscalls.exp; then
5797         echo " "
5798         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5799         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5800 fi
5801 ;;
5802 esac
5803 $rm -f libnames libpath
5804
5805 : is a C symbol defined?
5806 csym='tlook=$1;
5807 case "$3" in
5808 -v) tf=libc.tmp; tc=""; tdc="";;
5809 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5810 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5811 esac;
5812 tx=yes;
5813 case "$reuseval-$4" in
5814 true-) ;;
5815 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5816 esac;
5817 case "$tx" in
5818 yes)
5819         case "$runnm" in
5820         true)
5821                 if $contains $tlook $tf >/dev/null 2>&1;
5822                 then tval=true;
5823                 else tval=false;
5824                 fi;;
5825         *)
5826                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5827                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5828                 then tval=true;
5829                 else tval=false;
5830                 fi;
5831                 $rm -f t t.c;;
5832         esac;;
5833 *)
5834         case "$tval" in
5835         $define) tval=true;;
5836         *) tval=false;;
5837         esac;;
5838 esac;
5839 eval "$2=$tval"'
5840
5841 : define an is-in-libc? function
5842 inlibc='echo " "; td=$define; tu=$undef;
5843 sym=$1; var=$2; eval "was=\$$2";
5844 tx=yes;
5845 case "$reuseval$was" in
5846 true) ;;
5847 true*) tx=no;;
5848 esac;
5849 case "$tx" in
5850 yes)
5851         set $sym tres -f;
5852         eval $csym;
5853         case "$tres" in
5854         true)
5855                 echo "$sym() found." >&4;
5856                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5857         *)
5858                 echo "$sym() NOT found." >&4;
5859                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5860         esac;;
5861 *)
5862         case "$was" in
5863         $define) echo "$sym() found." >&4;;
5864         *) echo "$sym() NOT found." >&4;;
5865         esac;;
5866 esac'
5867
5868 : see if sqrtl exists
5869 set sqrtl d_sqrtl
5870 eval $inlibc
5871
5872 case "$ccflags" in
5873 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5874 esac
5875
5876 case "$uselongdouble" in
5877 $define|true|[yY]*)     dflt='y';;
5878 *) dflt='n';;
5879 esac
5880 cat <<EOM
5881
5882 Perl can be built to take advantage of long doubles which
5883 (if available) may give more accuracy and range for floating point numbers.
5884
5885 If this doesn't make any sense to you, just accept the default '$dflt'.
5886 EOM
5887 rp='Try to use long doubles if available?'
5888 . ./myread
5889 case "$ans" in
5890 y|Y)    val="$define"   ;;
5891 *)      val="$undef"    ;;
5892 esac
5893 set uselongdouble
5894 eval $setvar
5895
5896 case "$uselongdouble" in
5897 true|[yY]*) uselongdouble="$define" ;;
5898 esac
5899
5900 case "$uselongdouble" in
5901 $define)
5902 : Look for a hint-file generated 'call-back-unit'.  If the
5903 : user has specified that long doubles should be used,
5904 : we may need to set or change some other defaults.
5905         if $test -f uselongdouble.cbu; then
5906                 echo "Your platform has some specific hints for long doubles, using them..."
5907                 . ./uselongdouble.cbu
5908         else
5909                 $cat <<EOM
5910 (Your platform doesn't have any specific hints for long doubles.)
5911 EOM
5912         fi
5913         ;;
5914 esac
5915
5916 case "$uselongdouble:$d_sqrtl" in
5917 $define:$undef)
5918                 $cat <<EOM >&4
5919
5920 *** You requested the use of long doubles but you do not seem to have
5921 *** the mathematic functions for long doubles.  I'm disabling the use
5922 *** of long doubles.
5923
5924 EOM
5925         uselongdouble=$undef
5926         ;;
5927 esac
5928
5929 : check for length of double
5930 echo " "
5931 case "$doublesize" in
5932 '')
5933         echo "Checking to see how big your double precision numbers are..." >&4
5934         $cat >try.c <<'EOCP'
5935 #include <stdio.h>
5936 int main()
5937 {
5938     printf("%d\n", (int)sizeof(double));
5939     exit(0);
5940 }
5941 EOCP
5942         set try
5943         if eval $compile_ok; then
5944                 doublesize=`$run ./try`
5945                 echo "Your double is $doublesize bytes long."
5946         else
5947                 dflt='8'
5948                 echo "(I can't seem to compile the test program.  Guessing...)"
5949                 rp="What is the size of a double precision number (in bytes)?"
5950                 . ./myread
5951                 doublesize="$ans"
5952         fi
5953         ;;
5954 esac
5955 $rm -f try.c try
5956
5957 : check for long doubles
5958 echo " "
5959 echo "Checking to see if you have long double..." >&4
5960 echo 'int main() { long double x = 7.0; }' > try.c
5961 set try
5962 if eval $compile; then
5963         val="$define"
5964         echo "You have long double."
5965 else
5966         val="$undef"
5967         echo "You do not have long double."
5968 fi
5969 $rm try.*
5970 set d_longdbl
5971 eval $setvar
5972
5973 : check for length of long double
5974 case "${d_longdbl}${longdblsize}" in
5975 $define)
5976         echo " "
5977         echo "Checking to see how big your long doubles are..." >&4
5978         $cat >try.c <<'EOCP'
5979 #include <stdio.h>
5980 int main()
5981 {
5982         printf("%d\n", sizeof(long double));
5983 }
5984 EOCP
5985         set try
5986         set try
5987         if eval $compile; then
5988                 longdblsize=`$run ./try`
5989                 echo "Your long doubles are $longdblsize bytes long."
5990         else
5991                 dflt='8'
5992                 echo " "
5993                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5994                 rp="What is the size of a long double (in bytes)?"
5995                 . ./myread
5996                 longdblsize="$ans"
5997         fi
5998         if $test "X$doublesize" = "X$longdblsize"; then
5999                 echo "(That isn't any different from an ordinary double.)"
6000         fi      
6001         ;;
6002 esac
6003 $rm -f try.* try
6004
6005 case "$useperlio" in
6006 $define|true|[yY]*|'')  dflt='y';;
6007 *) dflt='n';;
6008 esac
6009 cat <<EOM
6010
6011 Previous version of $package used the standard IO mechanisms as
6012 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6013 alternate IO mechanisms via the PerlIO abstraction layer, but the
6014 stdio mechanism is still available if needed.  The abstraction layer
6015 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6016 Using PerlIO with sfio may cause problems with some extension modules.
6017
6018 If this doesn't make any sense to you, just accept the default '$dflt'.
6019 EOM
6020 rp='Use the PerlIO abstraction layer?'
6021 . ./myread
6022 case "$ans" in
6023 y|Y) 
6024         val="$define"
6025         ;;
6026 *)      
6027         echo "Ok, doing things the stdio way."
6028         val="$undef"
6029         ;;
6030 esac
6031 set useperlio
6032 eval $setvar 
6033
6034 case "$usesocks" in
6035 $define|true|[yY]*)
6036         case "$useperlio" in
6037         $define|true|[yY]*) ;;
6038         *)      cat >&4 <<EOM
6039
6040 You are using the SOCKS proxy protocol library which means that you
6041 should also use the PerlIO layer.  You may be headed for trouble.
6042
6043 EOM
6044                 ;;
6045         esac
6046         ;;
6047 esac
6048
6049         
6050 : determine the architecture name
6051 echo " "
6052 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6053         tarch=`arch`"-$osname"
6054 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6055         if uname -m > tmparch 2>&1 ; then
6056                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6057                         -e 's/$/'"-$osname/" tmparch`
6058         else
6059                 tarch="$osname"
6060         fi
6061         $rm -f tmparch
6062 else
6063         tarch="$osname"
6064 fi
6065 case "$myarchname" in
6066 ''|"$tarch") ;;
6067 *)
6068         echo "(Your architecture name used to be $myarchname.)"
6069         archname=''
6070         ;;
6071 esac
6072 case "$targetarch" in
6073 '') ;;
6074 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6075 esac
6076 myarchname="$tarch"
6077 case "$archname" in
6078 '') dflt="$tarch";;
6079 *) dflt="$archname";;
6080 esac
6081 rp='What is your architecture name'
6082 . ./myread
6083 archname="$ans"
6084 case "$usethreads" in
6085 $define)
6086         echo "Threads selected." >&4
6087         case "$archname" in
6088         *-thread*) echo "...and architecture name already has -thread." >&4
6089                 ;;
6090         *)      archname="$archname-thread"
6091                 echo "...setting architecture name to $archname." >&4
6092                 ;;
6093         esac
6094         ;;
6095 esac
6096 case "$usemultiplicity" in
6097 $define)
6098         echo "Multiplicity selected." >&4
6099         case "$archname" in
6100         *-multi*) echo "...and architecture name already has -multi." >&4
6101                 ;;
6102         *)      archname="$archname-multi"
6103                 echo "...setting architecture name to $archname." >&4
6104                 ;;
6105         esac
6106         ;;
6107 esac
6108 case "$use64bitint$use64bitall" in
6109 *"$define"*)
6110         case "$archname64" in
6111         '')
6112                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6113                 ;;
6114         *)
6115                 case "$use64bitint" in
6116                 "$define") echo "64 bit integers selected." >&4 ;;
6117                 esac
6118                 case "$use64bitall" in
6119                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6120                 esac
6121                 case "$archname" in
6122                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6123                         ;;
6124                 *)      archname="$archname-$archname64"
6125                         echo "...setting architecture name to $archname." >&4
6126                         ;;
6127                 esac
6128                 ;;
6129         esac
6130 esac
6131 case "$uselongdouble" in
6132 $define)
6133         echo "Long doubles selected." >&4
6134         case "$longdblsize" in
6135         $doublesize)
6136                 "...but long doubles are equal to doubles, not changing architecture name." >&4
6137                 ;;
6138         *)
6139                 case "$archname" in
6140                 *-ld*) echo "...and architecture name already has -ld." >&4
6141                         ;;
6142                 *)      archname="$archname-ld"
6143                         echo "...setting architecture name to $archname." >&4
6144                         ;;
6145                 esac
6146                 ;;
6147         esac
6148         ;;
6149 esac
6150 case "$useperlio" in
6151 $define)
6152         echo "Perlio selected." >&4
6153         ;;
6154 *)
6155         echo "Perlio not selected, using stdio." >&4
6156         case "$archname" in
6157         *-stdio*) echo "...and architecture name already has -stdio." >&4
6158                 ;;
6159         *)      archname="$archname-stdio"
6160                 echo "...setting architecture name to $archname." >&4
6161                 ;;
6162         esac
6163         ;;
6164 esac
6165
6166 : determine root of directory hierarchy where package will be installed.
6167 case "$prefix" in
6168 '')
6169         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6170         ;;
6171 *)
6172         dflt="$prefix"
6173         ;;
6174 esac
6175 $cat <<EOM
6176
6177 By default, $package will be installed in $dflt/bin, manual pages
6178 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6179 installation directories. Typically this is something like /usr/local.
6180 If you wish to have binaries under /usr/bin but other parts of the
6181 installation under /usr/local, that's ok: you will be prompted
6182 separately for each of the installation directories, the prefix being
6183 only used to set the defaults.
6184
6185 EOM
6186 fn=d~
6187 rp='Installation prefix to use?'
6188 . ./getfile
6189 oldprefix=''
6190 case "$prefix" in
6191 '') ;;
6192 *)
6193         case "$ans" in
6194         "$prefix") ;;
6195         *) oldprefix="$prefix";;
6196         esac
6197         ;;
6198 esac
6199 prefix="$ans"
6200 prefixexp="$ansexp"
6201
6202 case "$afsroot" in
6203 '')     afsroot=/afs ;;
6204 *)      afsroot=$afsroot ;;
6205 esac
6206
6207 : is AFS running?
6208 echo " "
6209 case "$afs" in
6210 $define|true)   afs=true ;;
6211 $undef|false)   afs=false ;;
6212 *)      if test -d $afsroot; then
6213                 afs=true
6214         else
6215                 afs=false
6216         fi
6217         ;;
6218 esac
6219 if $afs; then
6220         echo "AFS may be running... I'll be extra cautious then..." >&4
6221 else
6222         echo "AFS does not seem to be running..." >&4
6223 fi
6224
6225 : determine installation prefix for where package is to be installed.
6226 if $afs; then 
6227 $cat <<EOM
6228
6229 Since you are running AFS, I need to distinguish the directory in which
6230 files will reside from the directory in which they are installed (and from
6231 which they are presumably copied to the former directory by occult means).
6232
6233 EOM
6234         case "$installprefix" in
6235         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6236         *) dflt="$installprefix";;
6237         esac
6238 else
6239 $cat <<EOM
6240
6241 In some special cases, particularly when building $package for distribution,
6242 it is convenient to distinguish between the directory in which files should 
6243 be installed from the directory ($prefix) in which they 
6244 will eventually reside.  For most users, these two directories are the same.
6245
6246 EOM
6247         case "$installprefix" in
6248         '') dflt=$prefix ;;
6249         *) dflt=$installprefix;;
6250         esac
6251 fi
6252 fn=d~
6253 rp='What installation prefix should I use for installing files?'
6254 . ./getfile
6255 installprefix="$ans"
6256 installprefixexp="$ansexp"
6257
6258 : set the prefixit variable, to compute a suitable default value
6259 prefixit='case "$3" in
6260 ""|none)
6261         case "$oldprefix" in
6262         "") eval "$1=\"\$$2\"";;
6263         *)
6264                 case "$3" in
6265                 "") eval "$1=";;
6266                 none)
6267                         eval "tp=\"\$$2\"";
6268                         case "$tp" in
6269                         ""|" ") eval "$1=\"\$$2\"";;
6270                         *) eval "$1=";;
6271                         esac;;
6272                 esac;;
6273         esac;;
6274 *)
6275         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6276         case "$tp" in
6277         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6278         /*-$oldprefix/*|\~*-$oldprefix/*)
6279                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6280         *) eval "$1=\"\$$2\"";;
6281         esac;;
6282 esac'
6283
6284
6285 : get the patchlevel
6286 echo " "
6287 echo "Getting the current patchlevel..." >&4
6288 if $test -r $rsrc/patchlevel.h;then
6289         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6290         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6291         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6292         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6293         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6294         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6295        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6296 else
6297         revision=0
6298         patchlevel=0
6299         subversion=0
6300         api_revision=0
6301         api_version=0
6302         api_subversion=0
6303         perl_patchlevel=0
6304         $echo "(You do not have patchlevel.h.  Eek.)"
6305 fi
6306 if $test -r $rsrc/.patch ; then  
6307         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6308                 perl_patchlevel=`cat $rsrc/.patch`
6309         fi
6310 fi
6311 case "$perl_patchlevel" in
6312 0)  ;;
6313 '') $echo "(You have $package version $patchlevel subversion $subversion.)" ;;
6314 *)  $echo "(You have $package version $patchlevel subversion $subversion patchlevel $perl_patchlevel.)" ;;
6315 esac
6316 case "$osname" in
6317 dos|vms)
6318         : XXX Should be a Configure test for double-dots in filenames.
6319         version=`echo $revision $patchlevel $subversion | \
6320                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6321         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6322                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6323         ;;
6324 *)
6325         version=`echo $revision $patchlevel $subversion | \
6326                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6327         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6328                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6329         ;;
6330 esac
6331 : Special case the 5.005_xx maintenance series, which used 5.005
6332 : without any subversion label as a subdirectory in $sitelib
6333 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6334         api_versionstring='5.005'
6335 fi
6336
6337 : determine installation style
6338 : For now, try to deduce it from prefix unless it is already set.
6339 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6340 case "$installstyle" in
6341 '')     case "$prefix" in
6342                 *perl*) dflt='lib';;
6343                 *) dflt='lib/perl5' ;;
6344         esac
6345         ;;
6346 *)      dflt="$installstyle" ;;
6347 esac
6348 : Probably not worth prompting for this since we prompt for all
6349 : the directories individually, and the prompt would be too long and
6350 : confusing anyway.
6351 installstyle=$dflt
6352
6353 : determine where private library files go
6354 : Usual default is /usr/local/lib/perl5/$version.
6355 : Also allow things like /opt/perl/lib/$version, since 
6356 : /opt/perl/lib/perl5... would be redundant.
6357 : The default "style" setting is made in installstyle.U
6358 case "$installstyle" in
6359 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6360 *)       set dflt privlib lib/$version ;;
6361 esac
6362 eval $prefixit
6363 $cat <<EOM
6364
6365 There are some auxiliary files for $package that need to be put into a
6366 private library directory that is accessible by everyone.
6367
6368 EOM
6369 fn=d~+
6370 rp='Pathname where the private library files will reside?'
6371 . ./getfile
6372 privlib="$ans"
6373 privlibexp="$ansexp"
6374 : Change installation prefix, if necessary.
6375 if $test X"$prefix" != X"$installprefix"; then
6376         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6377 else
6378         installprivlib="$privlibexp"
6379 fi
6380
6381 : set the prefixup variable, to restore leading tilda escape
6382 prefixup='case "$prefixexp" in
6383 "$prefix") ;;
6384 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6385 esac'
6386
6387 : determine where public architecture dependent libraries go
6388 set archlib archlib
6389 eval $prefixit
6390 : privlib default is /usr/local/lib/$package/$version
6391 : archlib default is /usr/local/lib/$package/$version/$archname
6392 : privlib may have an optional trailing /share.
6393 tdflt=`echo $privlib | $sed 's,/share$,,'`
6394 tdflt=$tdflt/$archname
6395 case "$archlib" in
6396 '')     dflt=$tdflt
6397         ;;
6398 *)      dflt="$archlib"
6399     ;;
6400 esac
6401 $cat <<EOM
6402
6403 $spackage contains architecture-dependent library files.  If you are
6404 sharing libraries in a heterogeneous environment, you might store
6405 these files in a separate location.  Otherwise, you can just include
6406 them with the rest of the public library files.
6407
6408 EOM
6409 fn=d+~
6410 rp='Where do you want to put the public architecture-dependent libraries?'
6411 . ./getfile
6412 archlib="$ans"
6413 archlibexp="$ansexp"
6414 if $test X"$archlib" = X"$privlib"; then
6415         d_archlib="$undef"
6416 else
6417         d_archlib="$define"
6418 fi
6419 : Change installation prefix, if necessary.
6420 if $test X"$prefix" != X"$installprefix"; then
6421         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6422 else
6423         installarchlib="$archlibexp"
6424 fi
6425
6426
6427 : Binary compatibility with 5.005 is not possible for builds
6428 : with advanced features
6429 case "$usethreads$usemultiplicity" in
6430 *define*)
6431         bincompat5005="$undef"
6432         d_bincompat5005="$undef"
6433         ;;
6434 *)      $cat <<EOM
6435
6436 This version of Perl can be compiled for binary compatibility with 5.005.
6437 If you decide to do so, you will be able to continue using most of the
6438 extensions that were compiled for Perl 5.005.
6439
6440 EOM
6441         case "$bincompat5005$d_bincompat5005" in
6442         *"$undef"*) dflt=n ;;
6443         *) dflt=y ;;
6444         esac
6445         rp='Binary compatibility with Perl 5.005?'
6446         . ./myread
6447         case "$ans" in
6448         y*) val="$define" ;;
6449         *)  val="$undef" ;;
6450         esac
6451         set d_bincompat5005
6452         eval $setvar
6453         case "$d_bincompat5005" in
6454         "$define")
6455                 bincompat5005="$define"
6456                 ;;
6457         *)      bincompat5005="$undef"
6458                 d_bincompat5005="$undef"
6459                 ;;
6460         esac
6461         ;;
6462 esac
6463
6464
6465 : see if setuid scripts can be secure
6466 $cat <<EOM
6467
6468 Some kernels have a bug that prevents setuid #! scripts from being
6469 secure.  Some sites have disabled setuid #! scripts because of this.
6470
6471 First let's decide if your kernel supports secure setuid #! scripts.
6472 (If setuid #! scripts would be secure but have been disabled anyway,
6473 don't say that they are secure if asked.)
6474
6475 EOM
6476
6477 val="$undef"
6478 if $test -d /dev/fd; then
6479         echo "#!$ls" >reflect
6480         chmod +x,u+s reflect
6481         ./reflect >flect 2>&1
6482         if $contains "/dev/fd" flect >/dev/null; then
6483                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6484                 val="$define"
6485         else
6486                 $cat <<EOM
6487 If you are not sure if they are secure, I can check but I'll need a
6488 username and password different from the one you are using right now.
6489 If you don't have such a username or don't want me to test, simply
6490 enter 'none'.
6491
6492 EOM
6493                 rp='Other username to test security of setuid scripts with?'
6494                 dflt='none'
6495                 . ./myread
6496                 case "$ans" in
6497                 n|none)
6498                         case "$d_suidsafe" in
6499                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6500                                 dflt=n;;
6501                         "$undef")
6502                                 echo "Well, the $hint value is *not* secure." >&4
6503                                 dflt=n;;
6504                         *)      echo "Well, the $hint value *is* secure." >&4
6505                                 dflt=y;;
6506                         esac
6507                         ;;
6508                 *)
6509                         $rm -f reflect flect
6510                         echo "#!$ls" >reflect
6511                         chmod +x,u+s reflect
6512                         echo >flect
6513                         chmod a+w flect
6514                         echo '"su" will (probably) prompt you for '"$ans's password."
6515                         su $ans -c './reflect >flect'
6516                         if $contains "/dev/fd" flect >/dev/null; then
6517                                 echo "Okay, it looks like setuid scripts are secure." >&4
6518                                 dflt=y
6519                         else
6520                                 echo "I don't think setuid scripts are secure." >&4
6521                                 dflt=n
6522                         fi
6523                         ;;
6524                 esac
6525                 rp='Does your kernel have *secure* setuid scripts?'
6526                 . ./myread
6527                 case "$ans" in
6528                 [yY]*)  val="$define";;
6529                 *)      val="$undef";;
6530                 esac
6531         fi
6532 else
6533         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6534         echo "(That's for file descriptors, not floppy disks.)"
6535         val="$undef"
6536 fi
6537 set d_suidsafe
6538 eval $setvar
6539
6540 $rm -f reflect flect
6541
6542 : now see if they want to do setuid emulation
6543 echo " "
6544 val="$undef"
6545 case "$d_suidsafe" in
6546 "$define")
6547         val="$undef"
6548         echo "No need to emulate SUID scripts since they are secure here." >& 4
6549         ;;
6550 *)
6551         $cat <<EOM
6552 Some systems have disabled setuid scripts, especially systems where
6553 setuid scripts cannot be secure.  On systems where setuid scripts have
6554 been disabled, the setuid/setgid bits on scripts are currently
6555 useless.  It is possible for $package to detect those bits and emulate
6556 setuid/setgid in a secure fashion.  This emulation will only work if
6557 setuid scripts have been disabled in your kernel.
6558
6559 EOM
6560         case "$d_dosuid" in
6561         "$define") dflt=y ;;
6562         *) dflt=n ;;
6563         esac
6564         rp="Do you want to do setuid/setgid emulation?"
6565         . ./myread
6566         case "$ans" in
6567         [yY]*)  val="$define";;
6568         *)      val="$undef";;
6569         esac
6570         ;;
6571 esac
6572 set d_dosuid
6573 eval $setvar
6574
6575 : see if this is a malloc.h system
6576 set malloc.h i_malloc
6577 eval $inhdr
6578
6579 : see if stdlib is available
6580 set stdlib.h i_stdlib
6581 eval $inhdr
6582
6583 : determine which malloc to compile in
6584 echo " "
6585 case "$usemymalloc" in
6586 [yY]*|true|$define)     dflt='y' ;;
6587 [nN]*|false|$undef)     dflt='n' ;;
6588 *)      case "$ptrsize" in
6589         4) dflt='y' ;;
6590         *) dflt='n' ;;
6591         esac
6592         ;;
6593 esac
6594 rp="Do you wish to attempt to use the malloc that comes with $package?"
6595 . ./myread
6596 usemymalloc="$ans"
6597 case "$ans" in
6598 y*|true)
6599         usemymalloc='y'
6600         mallocsrc='malloc.c'
6601         mallocobj="malloc$_o"
6602         d_mymalloc="$define"
6603         case "$libs" in
6604         *-lmalloc*)
6605                 : Remove malloc from list of libraries to use
6606                 echo "Removing unneeded -lmalloc from library list" >&4
6607                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6608                 shift
6609                 libs="$*"
6610                 echo "libs = $libs" >&4
6611                 ;;
6612         esac
6613         ;;
6614 *)
6615         usemymalloc='n'
6616         mallocsrc=''
6617         mallocobj=''
6618         d_mymalloc="$undef"
6619         ;;
6620 esac
6621
6622 : compute the return types of malloc and free
6623 echo " "
6624 $cat >malloc.c <<END
6625 #$i_malloc I_MALLOC
6626 #$i_stdlib I_STDLIB
6627 #include <stdio.h>
6628 #include <sys/types.h>
6629 #ifdef I_MALLOC
6630 #include <malloc.h>
6631 #endif
6632 #ifdef I_STDLIB
6633 #include <stdlib.h>
6634 #endif
6635 #ifdef TRY_MALLOC
6636 void *malloc();
6637 #endif
6638 #ifdef TRY_FREE
6639 void free();
6640 #endif
6641 END
6642 case "$malloctype" in
6643 '')
6644         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6645                 malloctype='void *'
6646         else
6647                 malloctype='char *'
6648         fi
6649         ;;
6650 esac
6651 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6652
6653 case "$freetype" in
6654 '')
6655         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6656                 freetype='void'
6657         else
6658                 freetype='int'
6659         fi
6660         ;;
6661 esac
6662 echo "Your system uses $freetype free(), it would seem." >&4
6663 $rm -f malloc.[co]
6664 $cat <<EOM
6665
6666 After $package is installed, you may wish to install various
6667 add-on modules and utilities.  Typically, these add-ons will
6668 be installed under $prefix with the rest
6669 of this package.  However, you may wish to install such add-ons
6670 elsewhere under a different prefix.
6671
6672 If you do not wish to put everything under a single prefix, that's
6673 ok.  You will be prompted for the individual locations; this siteprefix
6674 is only used to suggest the defaults.
6675
6676 The default should be fine for most people.
6677
6678 EOM
6679 fn=d~+
6680 rp='Installation prefix to use for add-on modules and utilities?'
6681 : XXX Here might be another good place for an installstyle setting.
6682 case "$siteprefix" in
6683 '') dflt=$prefix ;;
6684 *)  dflt=$siteprefix ;;
6685 esac
6686 . ./getfile
6687 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6688 oldsiteprefix=''
6689 case "$siteprefix" in
6690 '') ;;
6691 *)      case "$ans" in
6692         "$prefix") ;;
6693         *) oldsiteprefix="$prefix";;
6694         esac
6695         ;;
6696 esac
6697 siteprefix="$ans"
6698 siteprefixexp="$ansexp"
6699
6700 : determine where site specific libraries go.
6701 : Usual default is /usr/local/lib/perl5/site_perl/$version
6702 : The default "style" setting is made in installstyle.U
6703 : XXX No longer works with Prefixit stuff.
6704 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6705 case "$sitelib" in
6706 '') case "$installstyle" in
6707         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6708         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6709         esac
6710         ;;
6711 *)      dflt="$sitelib"
6712         ;;
6713 esac
6714 $cat <<EOM
6715
6716 The installation process will create a directory for
6717 site-specific extensions and modules.  Most users find it convenient
6718 to place all site-specific files in this directory rather than in the
6719 main distribution directory.
6720
6721 EOM
6722 fn=d~+
6723 rp='Pathname for the site-specific library files?'
6724 . ./getfile
6725 sitelib="$ans"
6726 sitelibexp="$ansexp"
6727 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6728 : Change installation prefix, if necessary.
6729 if $test X"$prefix" != X"$installprefix"; then
6730         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6731 else
6732         installsitelib="$sitelibexp"
6733 fi
6734
6735 : determine where site specific architecture-dependent libraries go.
6736 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6737 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6738 : sitelib may have an optional trailing /share.
6739 case "$sitearch" in
6740 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6741         dflt="$dflt/$archname"
6742         ;;
6743 *)      dflt="$sitearch"
6744         ;;
6745 esac
6746 set sitearch sitearch none
6747 eval $prefixit
6748 $cat <<EOM
6749
6750 The installation process will also create a directory for
6751 architecture-dependent site-specific extensions and modules.
6752
6753 EOM
6754 fn=d~+
6755 rp='Pathname for the site-specific architecture-dependent library files?'
6756 . ./getfile
6757 sitearch="$ans"
6758 sitearchexp="$ansexp"
6759 : Change installation prefix, if necessary.
6760 if $test X"$prefix" != X"$installprefix"; then
6761         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6762 else
6763         installsitearch="$sitearchexp"
6764 fi
6765
6766 $cat <<EOM
6767
6768 The installation process will also create a directory for
6769 vendor-supplied add-ons.  Vendors who supply perl with their system
6770 may find it convenient to place all vendor-supplied files in this
6771 directory rather than in the main distribution directory.  This will
6772 ease upgrades between binary-compatible maintenance versions of perl.
6773
6774 Of course you may also use these directories in whatever way you see
6775 fit.  For example, you might use them to access modules shared over a
6776 company-wide network.
6777
6778 The default answer should be fine for most people.
6779 This causes further questions about vendor add-ons to be skipped
6780 and no vendor-specific directories will be configured for perl.
6781
6782 EOM
6783 rp='Do you want to configure vendor-specific add-on directories?'
6784 case "$usevendorprefix" in
6785 define|true|[yY]*) dflt=y ;;
6786 *)      : User may have set vendorprefix directly on Configure command line.
6787         case "$vendorprefix" in
6788         ''|' ') dflt=n ;;
6789         *)      dflt=y ;;
6790         esac
6791         ;;
6792 esac
6793 . ./myread
6794 case "$ans" in
6795 [yY]*)  fn=d~+
6796         rp='Installation prefix to use for vendor-supplied add-ons?'
6797         case "$vendorprefix" in
6798         '') dflt='' ;;
6799         *)  dflt=$vendorprefix ;;
6800         esac
6801         . ./getfile
6802         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6803         oldvendorprefix=''
6804         case "$vendorprefix" in
6805         '') ;;
6806         *)      case "$ans" in
6807                 "$prefix") ;;
6808                 *) oldvendorprefix="$prefix";;
6809                 esac
6810                 ;;
6811         esac
6812         usevendorprefix="$define"
6813         vendorprefix="$ans"
6814         vendorprefixexp="$ansexp"
6815         ;;
6816 *)      usevendorprefix="$undef"
6817         vendorprefix=''
6818         vendorprefixexp=''
6819         ;;
6820 esac
6821
6822 case "$vendorprefix" in
6823 '')     d_vendorlib="$undef"
6824         vendorlib=''
6825         vendorlibexp=''
6826         ;;
6827 *)      d_vendorlib="$define"
6828         : determine where vendor-supplied modules go.
6829         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6830         case "$vendorlib" in
6831         '')
6832                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6833                 case "$installstyle" in
6834                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6835                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6836                 esac
6837                 ;;
6838         *)      dflt="$vendorlib"
6839                 ;;
6840         esac
6841         fn=d~+
6842         rp='Pathname for the vendor-supplied library files?'
6843         . ./getfile
6844         vendorlib="$ans"
6845         vendorlibexp="$ansexp"
6846         ;;
6847 esac
6848 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6849 : Change installation prefix, if necessary.
6850 if $test X"$prefix" != X"$installprefix"; then
6851         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6852 else
6853         installvendorlib="$vendorlibexp"
6854 fi
6855
6856 case "$vendorprefix" in
6857 '')     d_vendorarch="$undef"
6858         vendorarch=''
6859         vendorarchexp=''
6860         ;;
6861 *)      d_vendorarch="$define"
6862         : determine where vendor-supplied architecture-dependent libraries go.
6863         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6864         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6865         : vendorlib may have an optional trailing /share.
6866         case "$vendorarch" in
6867         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6868                 dflt="$dflt/$archname"
6869                 ;;
6870         *)      dflt="$vendorarch" ;;
6871         esac
6872         fn=d~+
6873         rp='Pathname for vendor-supplied architecture-dependent files?'
6874         . ./getfile
6875         vendorarch="$ans"
6876         vendorarchexp="$ansexp"
6877         ;;
6878 esac
6879 : Change installation prefix, if necessary.
6880 if $test X"$prefix" != X"$installprefix"; then
6881         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6882 else
6883         installvendorarch="$vendorarchexp"
6884 fi
6885
6886 : Final catch-all directories to search
6887 $cat <<EOM
6888
6889 Lastly, you can have perl look in other directories for extensions and
6890 modules in addition to those already specified.
6891 These directories will be searched after 
6892         $sitearch 
6893         $sitelib 
6894 EOM
6895 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6896 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6897 echo ' '
6898 case "$otherlibdirs" in
6899 ''|' ') dflt='none' ;;
6900 *)      dflt="$otherlibdirs" ;;
6901 esac
6902 $cat <<EOM
6903 Enter a colon-separated set of extra paths to include in perl's @INC
6904 search path, or enter 'none' for no extra paths.
6905
6906 EOM
6907
6908 rp='Colon-separated list of additional directories for perl to search?'
6909 . ./myread
6910 case "$ans" in
6911 ' '|''|none)    otherlibdirs=' ' ;;     
6912 *)      otherlibdirs="$ans" ;;
6913 esac
6914 case "$otherlibdirs" in
6915 ' ') val=$undef ;;
6916 *)      val=$define ;;
6917 esac
6918 set d_perl_otherlibdirs
6919 eval $setvar
6920
6921 : Cruising for prototypes
6922 echo " "
6923 echo "Checking out function prototypes..." >&4
6924 $cat >prototype.c <<'EOCP'
6925 int main(int argc, char *argv[]) {
6926         exit(0);}
6927 EOCP
6928 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6929         echo "Your C compiler appears to support function prototypes."
6930         val="$define"
6931 else
6932         echo "Your C compiler doesn't seem to understand function prototypes."
6933         val="$undef"
6934 fi
6935 set prototype
6936 eval $setvar
6937 $rm -f prototype*
6938
6939 case "$prototype" in
6940 "$define") ;;
6941 *)      ansi2knr='ansi2knr'
6942         echo " "
6943         cat <<EOM >&4
6944
6945 $me:  FATAL ERROR:
6946 This version of $package can only be compiled by a compiler that 
6947 understands function prototypes.  Unfortunately, your C compiler 
6948         $cc $ccflags
6949 doesn't seem to understand them.  Sorry about that.
6950
6951 If GNU cc is available for your system, perhaps you could try that instead.  
6952
6953 Eventually, we hope to support building Perl with pre-ANSI compilers.
6954 If you would like to help in that effort, please contact <perlbug@perl.org>.
6955
6956 Aborting Configure now.
6957 EOM
6958         exit 2
6959         ;;
6960 esac
6961
6962 : determine where public executables go
6963 echo " "
6964 set dflt bin bin
6965 eval $prefixit
6966 fn=d~
6967 rp='Pathname where the public executables will reside?'
6968 . ./getfile
6969 if $test "X$ansexp" != "X$binexp"; then
6970         installbin=''
6971 fi
6972 bin="$ans"
6973 binexp="$ansexp"
6974 : Change installation prefix, if necessary.
6975 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6976 if $test X"$prefix" != X"$installprefix"; then
6977         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6978 else
6979         installbin="$binexp"
6980 fi
6981
6982 : Find perl5.005 or later.
6983 echo "Looking for a previously installed perl5.005 or later... "
6984 case "$perl5" in
6985 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6986                 : Check if this perl is recent and can load a simple module
6987                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6988                         perl5=$tdir/perl
6989                         break;
6990                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6991                         perl5=$tdir/perl5
6992                         break;
6993                 fi
6994         done
6995         ;;
6996 *)      perl5="$perl5"
6997         ;;
6998 esac
6999 case "$perl5" in
7000 '')     echo "None found.  That's ok.";;
7001 *)      echo "Using $perl5." ;;
7002 esac
7003
7004 : Determine list of previous versions to include in @INC
7005 $cat > getverlist <<EOPL
7006 #!$perl5 -w
7007 use File::Basename;
7008 \$api_versionstring = "$api_versionstring";
7009 \$version = "$version";
7010 \$stem = "$sitelib_stem";
7011 \$archname = "$archname";
7012 EOPL
7013         $cat >> getverlist <<'EOPL'
7014 # Can't have leading @ because metaconfig interprets it as a command!
7015 ;@inc_version_list=();
7016 # XXX Redo to do opendir/readdir? 
7017 if (-d $stem) {
7018     chdir($stem);
7019     ;@candidates = glob("5.*");
7020 }
7021 else {
7022     ;@candidates = ();
7023 }
7024
7025 # XXX ToDo:  These comparisons must be reworked when two-digit
7026 # subversions come along, so that 5.7.10 compares as greater than
7027 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7028 # widespread that we can use the built-in version vectors rather
7029 # than reinventing them here.  For 5.6.0, however, we must
7030 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7031 foreach $d (@candidates) {
7032     if ($d lt $version) {
7033         if ($d ge $api_versionstring) {
7034             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7035         }
7036         elsif ($d ge "5.005") {
7037             unshift(@inc_version_list, grep { -d } $d);
7038         }
7039     }
7040     else {
7041         # Skip newer version.  I.e. don't look in
7042         # 5.7.0 if we're installing 5.6.1.
7043     }
7044 }
7045
7046 if (@inc_version_list) {
7047     print join(' ', @inc_version_list);
7048 }
7049 else {
7050     # Blank space to preserve value for next Configure run.
7051     print " ";
7052 }
7053 EOPL
7054 chmod +x getverlist
7055 case "$inc_version_list" in
7056 '')     if test -x "$perl5$exe_ext"; then
7057                 dflt=`$perl5 getverlist`
7058         else
7059                 dflt='none'
7060         fi
7061         ;;
7062 $undef) dflt='none' ;;
7063 *)  eval dflt=\"$inc_version_list\" ;;
7064 esac
7065 case "$dflt" in
7066 ''|' ') dflt=none ;;
7067 esac
7068 case "$dflt" in
7069 5.005) case "$bincompat5005" in
7070        $define|true|[yY]*) ;;
7071        *) dflt=none ;;
7072        esac
7073        ;;
7074 esac
7075 $cat <<'EOM'
7076
7077 In order to ease the process of upgrading, this version of perl 
7078 can be configured to use modules built and installed with earlier 
7079 versions of perl that were installed under $prefix.  Specify here
7080 the list of earlier versions that this version of perl should check.
7081 If Configure detected no earlier versions of perl installed under
7082 $prefix, then the list will be empty.  Answer 'none' to tell perl
7083 to not search earlier versions.
7084
7085 The default should almost always be sensible, so if you're not sure,
7086 just accept the default.
7087 EOM
7088
7089 rp='List of earlier versions to include in @INC?'
7090 . ./myread
7091 case "$ans" in
7092 [Nn]one|''|' ') inc_version_list=' ' ;;
7093 *) inc_version_list="$ans" ;;
7094 esac
7095 case "$inc_version_list" in
7096 ''|' ') 
7097         inc_version_list_init='0';;
7098 *)      inc_version_list_init=`echo $inc_version_list |
7099                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7100         ;;
7101 esac
7102 $rm -f getverlist
7103
7104 : determine whether to install perl also as /usr/bin/perl
7105
7106 echo " "
7107 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7108         $cat <<EOM
7109 Many scripts expect perl to be installed as /usr/bin/perl.
7110 I can install the perl you are about to compile also as /usr/bin/perl
7111 (in addition to $installbin/perl).
7112 EOM
7113         case "$installusrbinperl" in
7114         "$undef"|[nN]*) dflt='n';;
7115         *)              dflt='y';;
7116         esac
7117         rp="Do you want to install perl as /usr/bin/perl?"
7118         . ./myread
7119         case "$ans" in
7120         [yY]*)  val="$define";;
7121         *)      val="$undef" ;;
7122         esac
7123 else
7124         val="$undef"
7125 fi
7126 set installusrbinperl
7127 eval $setvar
7128
7129 : see if dld is available
7130 set dld.h i_dld
7131 eval $inhdr
7132
7133 : see if dlopen exists
7134 xxx_runnm="$runnm"
7135 runnm=false
7136 set dlopen d_dlopen
7137 eval $inlibc
7138 runnm="$xxx_runnm"
7139
7140 : determine which dynamic loading, if any, to compile in
7141 echo " "
7142 dldir="ext/DynaLoader"
7143 case "$usedl" in
7144 $define|y|true)
7145         dflt='y'
7146         usedl="$define"
7147         ;;
7148 $undef|n|false)
7149         dflt='n'
7150         usedl="$undef"
7151         ;;
7152 *) 
7153         dflt='n'
7154         case "$d_dlopen" in
7155             $define) dflt='y' ;;
7156         esac
7157         case "$i_dld" in
7158             $define) dflt='y' ;;
7159         esac
7160         : Does a dl_xxx.xs file exist for this operating system
7161         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7162         ;;
7163 esac
7164 rp="Do you wish to use dynamic loading?"
7165 . ./myread
7166 usedl="$ans"
7167 case "$ans" in
7168 y*) usedl="$define"
7169         case "$dlsrc" in
7170         '')
7171                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7172                         dflt="$dldir/dl_${osname}.xs"
7173                 elif $test "$d_dlopen" = "$define" ; then
7174                         dflt="$dldir/dl_dlopen.xs"
7175                 elif $test "$i_dld" = "$define" ; then
7176                         dflt="$dldir/dl_dld.xs"
7177                 else
7178                         dflt=''
7179                 fi
7180                 ;;
7181         *)      dflt="$dldir/$dlsrc"
7182                 ;;
7183         esac
7184     echo "The following dynamic loading files are available:"
7185         : Can not go over to $dldir because getfile has path hard-coded in.
7186         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
7187         rp="Source file to use for dynamic loading"
7188         fn="fne"
7189         gfpth="$src"
7190         . ./getfile
7191         usedl="$define"
7192         : emulate basename
7193         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7194
7195         $cat << EOM
7196
7197 Some systems may require passing special flags to $cc -c to
7198 compile modules that will be used to create a shared library.
7199 To use no flags, say "none".
7200
7201 EOM
7202     case "$cccdlflags" in
7203     '') case "$gccversion" in
7204                 '') case "$osname" in
7205                         hpux)   dflt='+z' ;;
7206                         next)   dflt='none' ;;
7207                         irix*)  dflt='-KPIC' ;;
7208                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7209                         sunos)  dflt='-pic' ;;
7210                         *)      dflt='none' ;;
7211                     esac
7212                         ;;
7213                 *)  case "$osname" in
7214                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7215                         *)      dflt='-fpic' ;;
7216                     esac ;;
7217             esac ;;
7218         ' ') dflt='none' ;;
7219     *)  dflt="$cccdlflags" ;;
7220     esac
7221     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7222     . ./myread
7223     case "$ans" in
7224     none) cccdlflags=' ' ;;
7225     *) cccdlflags="$ans" ;;
7226     esac
7227
7228     cat << EOM
7229
7230 Some systems use ld to create libraries that can be dynamically loaded,
7231 while other systems (such as those using ELF) use $cc.
7232
7233 EOM
7234         case "$ld" in
7235         '')     $cat >try.c <<'EOM'
7236 /* Test for whether ELF binaries are produced */
7237 #include <fcntl.h>
7238 #include <stdlib.h>
7239 int main() {
7240         char b[4];
7241         int i = open("a.out",O_RDONLY);
7242         if(i == -1) 
7243                 exit(1); /* fail */
7244         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7245                 exit(0); /* succeed (yes, it's ELF) */
7246         else
7247                 exit(1); /* fail */
7248 }
7249 EOM
7250                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7251                         cat <<EOM
7252 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7253 EOM
7254                         dflt="$cc"
7255                 else
7256                         echo "I'll use ld to build dynamic libraries."
7257                         dflt='ld'
7258                 fi
7259                 rm -f try.c a.out
7260                 ;;
7261         *)      dflt="$ld"
7262                 ;;
7263         esac
7264
7265     rp="What command should be used to create dynamic libraries?"
7266     . ./myread
7267         ld="$ans"
7268
7269     cat << EOM
7270
7271 Some systems may require passing special flags to $ld to create a
7272 library that can be dynamically loaded.  If your ld flags include
7273 -L/other/path options to locate libraries outside your loader's normal
7274 search path, you may need to specify those -L options here as well.  To
7275 use no flags, say "none".
7276
7277 EOM
7278     case "$lddlflags" in
7279     '') case "$osname" in
7280                         beos) dflt='-nostart' ;;
7281                         hpux) dflt='-b';
7282                               case "$gccversion" in
7283                               '') dflt="$dflt +vnocompatwarnings" ;;
7284                               esac
7285                               ;;        
7286                         linux|irix*)    dflt='-shared' ;;
7287                         next)  dflt='none' ;;
7288                         solaris) dflt='-G' ;;
7289                         sunos) dflt='-assert nodefinitions' ;;
7290                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7291                 *)     dflt='none' ;;
7292                         esac
7293                         ;;
7294     *) dflt="$lddlflags" ;;
7295     esac
7296
7297         : Try to guess additional flags to pick up local libraries.
7298         : Be careful not to append to a plain 'none'
7299         case "$dflt" in
7300         none) dflt='' ;;
7301         esac
7302         for thisflag in $ldflags; do
7303                 case "$thisflag" in
7304                 -L*|-R*)
7305                         case " $dflt " in
7306                         *" $thisflag "*) ;;
7307                         *) dflt="$dflt $thisflag" ;;
7308                         esac
7309                         ;;
7310                 esac
7311         done
7312
7313         case "$dflt" in
7314         ''|' ') dflt='none' ;;
7315         esac
7316
7317     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7318     . ./myread
7319     case "$ans" in
7320     none) lddlflags=' ' ;;
7321     *) lddlflags="$ans" ;;
7322     esac
7323
7324         cat <<EOM
7325
7326 Some systems may require passing special flags to $cc to indicate that
7327 the resulting executable will use dynamic linking.  To use no flags,
7328 say "none".
7329
7330 EOM
7331     case "$ccdlflags" in
7332     '') case "$osname" in
7333                 hpux)   dflt='-Wl,-E' ;;
7334                 linux)  dflt='-rdynamic' ;;
7335                 next)   dflt='none' ;;
7336                 sunos)  dflt='none' ;;
7337                 *)      dflt='none' ;;
7338             esac ;;
7339     ' ')  dflt='none' ;;
7340     *)  dflt="$ccdlflags" ;;
7341     esac
7342     rp="Any special flags to pass to $cc to use dynamic linking?"
7343     . ./myread
7344     case "$ans" in
7345     none) ccdlflags=' ' ;;
7346     *) ccdlflags="$ans" ;;
7347     esac
7348     ;;
7349 *)  usedl="$undef"
7350         ld='ld'
7351     dlsrc='dl_none.xs'
7352     lddlflags=''
7353     ccdlflags=''
7354     ;;
7355 esac
7356
7357 also=''
7358 case "$usedl" in
7359 $undef)
7360         # No dynamic loading being used, so don't bother even to prompt.
7361         useshrplib='false'
7362         ;;
7363 *)      case "$useshrplib" in
7364         '')     case "$osname" in
7365                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7366                         dflt=y
7367                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7368                         ;;
7369                 next*)
7370                         case "$osvers" in
7371                         4*)     dflt=y
7372                                 also='Building a shared libperl is needed for MAB support.'
7373                                 ;;
7374                         *)      dflt=n
7375                                 ;;
7376                         esac
7377                         ;;
7378                 *)      dflt=n
7379                         ;;
7380                 esac
7381                 ;;
7382         $define|true|[Yy]*)
7383                 dflt=y
7384                 ;;
7385         *)      dflt=n
7386                 ;;
7387         esac
7388         $cat << EOM
7389
7390 The perl executable is normally obtained by linking perlmain.c with
7391 libperl${_a}, any static extensions (usually just DynaLoader), and
7392 any other libraries needed on this system (such as -lm, etc.).  Since
7393 your system supports dynamic loading, it is probably possible to build
7394 a shared libperl.$so.  If you will have more than one executable linked
7395 to libperl.$so, this will significantly reduce the size of each
7396 executable, but it may have a noticeable affect on performance.  The
7397 default is probably sensible for your system.
7398 $also
7399
7400 EOM
7401         rp="Build a shared libperl.$so (y/n)"
7402         . ./myread
7403         case "$ans" in
7404         true|$define|[Yy]*)
7405                 useshrplib='true'  ;;
7406         *)      useshrplib='false' ;;
7407         esac
7408         ;;
7409 esac
7410
7411 case "$useshrplib" in
7412 true)
7413         case "$libperl" in
7414         '')
7415                 # Figure out a good name for libperl.so.  Since it gets stored in
7416                 # a version-specific architecture-dependent library, the version
7417                 # number isn't really that important, except for making cc/ld happy.
7418                 #
7419                 # A name such as libperl.so.3.1
7420                 majmin="libperl.$so.$patchlevel.$subversion"
7421                 # A name such as libperl.so.301
7422                 majonly=`echo $patchlevel $subversion |
7423                         $awk '{printf "%d%02d", $1, $2}'`
7424                 majonly=libperl.$so.$majonly
7425                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7426                 # rely on figuring it out from the naming of libc.
7427                 case "${osname}${osvers}" in
7428                 next4*)
7429                         dflt=libperl.5.$so
7430                         # XXX How handle the --version stuff for MAB?
7431                         ;;
7432                 linux*)  # ld won't link with a bare -lperl otherwise.
7433                         dflt=libperl.$so
7434                         ;;
7435                 cygwin*) # include version
7436                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7437                         ;;
7438                 *)      # Try to guess based on whether libc has major.minor.
7439                         case "$libc" in
7440                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7441                         *libc.$so.[0-9]*) dflt=$majonly ;;
7442                         *)      dflt=libperl.$so ;;
7443                         esac
7444                         ;;
7445                 esac
7446                 ;;
7447         *)      dflt=$libperl
7448                 ;;
7449         esac
7450         cat << EOM
7451
7452 I need to select a good name for the shared libperl.  If your system uses
7453 library names with major and minor numbers, then you might want something
7454 like $majmin.  Alternatively, if your system uses a single version
7455 number for shared libraries, then you might want to use $majonly.
7456 Or, your system might be quite happy with a simple libperl.$so.
7457
7458 Since the shared libperl will get installed into a version-specific
7459 architecture-dependent directory, the version number of the shared perl
7460 library probably isn't important, so the default should be o.k.
7461
7462 EOM
7463         rp='What name do you want to give to the shared libperl?'
7464         . ./myread
7465         libperl=$ans
7466         echo "Ok, I'll use $libperl"
7467         ;;
7468 *)
7469         libperl="libperl${_a}"
7470         ;;
7471 esac
7472
7473 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7474 case "$shrpdir" in
7475 '') ;;
7476 *)      $cat >&4 <<EOM
7477 WARNING:  Use of the shrpdir variable for the installation location of
7478 the shared $libperl is not supported.  It was never documented and
7479 will not work in this version.  Let me (perlbug@perl.org)
7480 know of any problems this may cause.
7481
7482 EOM
7483         case "$shrpdir" in
7484         "$archlibexp/CORE")
7485                 $cat >&4 <<EOM
7486 But your current setting of $shrpdir is
7487 the default anyway, so it's harmless.
7488 EOM
7489                 ;;
7490         *)
7491                 $cat >&4 <<EOM
7492 Further, your current attempted setting of $shrpdir
7493 conflicts with the value of $archlibexp/CORE
7494 that installperl will use.
7495 EOM
7496                 ;;
7497         esac
7498         ;;
7499 esac
7500
7501 # How will the perl executable find the installed shared $libperl?
7502 # Add $xxx to ccdlflags.
7503 # If we can't figure out a command-line option, use $shrpenv to
7504 # set env LD_RUN_PATH.  The main perl makefile uses this.
7505 shrpdir=$archlibexp/CORE
7506 xxx=''
7507 tmp_shrpenv=''
7508 if "$useshrplib"; then
7509     case "$osname" in 
7510         aix)
7511                 # We'll set it in Makefile.SH...
7512                 ;;
7513         solaris|netbsd)
7514                 xxx="-R $shrpdir"
7515                 ;;
7516         freebsd)
7517                 xxx="-Wl,-R$shrpdir"
7518                 ;;
7519         linux|irix*|dec_osf)
7520                 xxx="-Wl,-rpath,$shrpdir"
7521                 ;;
7522         next)
7523                 # next doesn't like the default...
7524                 ;;
7525         beos)
7526                 # beos doesn't like the default, either.
7527                 ;;
7528         hpux*)
7529                 # hpux doesn't like the default, either.
7530                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7531                 ;;
7532         *)
7533                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7534                 ;;
7535         esac
7536         case "$xxx" in
7537         '') ;;
7538         *)      
7539                 # Only add $xxx if it isn't already in ccdlflags.
7540                 case " $ccdlflags " in
7541                 *" $xxx "*)     ;;
7542                 *)      ccdlflags="$ccdlflags $xxx"
7543                         cat <<EOM >&4
7544
7545 Adding $xxx to the flags
7546 passed to $ld so that the perl executable will find the 
7547 installed shared $libperl.
7548
7549 EOM
7550                         ;;
7551                 esac
7552                 ;;
7553         esac
7554 fi
7555 # Fix ccdlflags in AIX for building external extensions.
7556 # (For building Perl itself bare -bE:perl.exp is needed,
7557 #  Makefile.SH takes care of this.)
7558 case "$osname" in
7559 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7560 esac
7561 # Respect a hint or command-line value.
7562 case "$shrpenv" in
7563 '') shrpenv="$tmp_shrpenv" ;;
7564 esac
7565 case "$ldlibpthname" in
7566 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7567 none)   ldlibpthname='' ;;
7568 esac
7569
7570 : determine where manual pages are on this system
7571 echo " "
7572 case "$sysman" in
7573 '') 
7574         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7575         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7576         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7577         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7578         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7579         sysman=`./loc . /usr/man/man1 $syspath`
7580         ;;
7581 esac
7582 if $test -d "$sysman"; then
7583         echo "System manual is in $sysman." >&4
7584 else
7585         echo "Could not find manual pages in source form." >&4
7586 fi
7587
7588 : determine where manual pages go
7589 set man1dir man1dir none
7590 eval $prefixit
7591 $cat <<EOM
7592
7593 $spackage has manual pages available in source form.
7594 EOM
7595 case "$nroff" in
7596 nroff)
7597         echo "However, you don't have nroff, so they're probably useless to you."
7598         case "$man1dir" in
7599         '') man1dir="none";;
7600         esac;;
7601 esac
7602 echo "If you don't want the manual sources installed, answer 'none'."
7603 case "$man1dir" in
7604 ' ') dflt=none
7605         ;;
7606 '')
7607         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7608         lookpath="$lookpath $prefixexp/man/p_man/man1"
7609         lookpath="$lookpath $prefixexp/man/u_man/man1"
7610         lookpath="$lookpath $prefixexp/man/man.1"
7611         case "$sysman" in
7612         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7613         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7614         esac
7615         set dflt
7616         eval $prefixup
7617         ;;
7618 *)  dflt="$man1dir"
7619         ;;
7620 esac
7621 echo " "
7622 fn=dn+~
7623 rp="Where do the main $spackage manual pages (source) go?"
7624 . ./getfile
7625 if $test "X$man1direxp" != "X$ansexp"; then
7626         installman1dir=''
7627 fi
7628 man1dir="$ans"
7629 man1direxp="$ansexp"
7630 case "$man1dir" in
7631 '')     man1dir=' '
7632         installman1dir='';;
7633 esac
7634
7635 : Change installation prefix, if necessary.
7636 if $test X"$prefix" != X"$installprefix"; then
7637         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7638 else
7639         installman1dir="$man1direxp"
7640 fi
7641
7642 : What suffix to use on installed man pages
7643
7644 case "$man1dir" in
7645 ' ')
7646         man1ext='0'
7647         ;;
7648 *)
7649         rp="What suffix should be used for the main $spackage man pages?"
7650         case "$man1ext" in
7651         '')     case "$man1dir" in
7652                 *1)  dflt=1 ;;
7653                 *1p) dflt=1p ;;
7654                 *1pm) dflt=1pm ;;
7655                 *l) dflt=l;;
7656                 *n) dflt=n;;
7657                 *o) dflt=o;;
7658                 *p) dflt=p;;
7659                 *C) dflt=C;;
7660                 *L) dflt=L;;
7661                 *L1) dflt=L1;;
7662                 *) dflt=1;;
7663                 esac
7664                 ;;
7665         *)      dflt="$man1ext";;
7666         esac
7667         . ./myread
7668         man1ext="$ans"
7669         ;;
7670 esac
7671
7672 : see if we can have long filenames
7673 echo " "
7674 first=123456789abcdef
7675 $rm -f $first
7676 if (echo hi >$first) 2>/dev/null; then
7677         if $test -f 123456789abcde; then
7678                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7679                 val="$undef"
7680         else
7681                 echo 'You can have filenames longer than 14 characters.'>&4
7682                 val="$define"
7683         fi
7684 else
7685         $cat <<'EOM'
7686 You can't have filenames longer than 14 chars.
7687 You can't even think about them!
7688 EOM
7689         val="$undef"
7690 fi 
7691 set d_flexfnam
7692 eval $setvar
7693 $rm -rf 123456789abcde*
7694
7695 : determine where library module manual pages go
7696 set man3dir man3dir none
7697 eval $prefixit
7698 $cat <<EOM
7699
7700 $spackage has manual pages for many of the library modules.
7701 EOM
7702
7703 case "$nroff" in
7704 nroff)
7705         $cat <<'EOM'
7706 However, you don't have nroff, so they're probably useless to you.
7707 EOM
7708         case "$man3dir" in
7709         '') man3dir="none";;
7710         esac;;
7711 esac
7712
7713 case "$d_flexfnam" in
7714 undef)
7715         $cat <<'EOM'
7716 However, your system can't handle the long file names like File::Basename.3. 
7717 EOM
7718         case "$man3dir" in
7719         '') man3dir="none";;
7720         esac;;
7721 esac
7722
7723 echo "If you don't want the manual sources installed, answer 'none'."
7724 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7725 case "$man3dir" in
7726 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7727         if $test -d "$privlib/man/man3"; then
7728                 cat <<EOM >&4
7729
7730 WARNING:  Previous versions of perl installed man3 pages into
7731 $privlib/man/man3.  This version will suggest a 
7732 new default of $dflt.  
7733 EOM
7734                 tdflt=$dflt
7735                 dflt='n'
7736                 rp='Do you wish to preserve the old behavior?(y/n)'
7737                 . ./myread
7738                 case "$ans" in
7739                 y*) dflt="$privlib/man/man3" ;;
7740                 *)  dflt=$tdflt ;;
7741                 esac
7742     fi
7743         ;;
7744 *)      dflt="$man3dir" ;;
7745 esac
7746 case "$dflt" in
7747 ' ') dflt=none ;;
7748 esac
7749 echo " "
7750 fn=dn+~
7751 rp="Where do the $package library man pages (source) go?"
7752 . ./getfile
7753 man3dir="$ans"
7754 man3direxp="$ansexp"
7755 case "$man3dir" in
7756 '')     man3dir=' '
7757         installman3dir='';;
7758 esac
7759
7760 : Change installation prefix, if necessary.
7761 if $test X"$prefix" != X"$installprefix"; then
7762         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7763 else
7764         installman3dir="$man3direxp"
7765 fi
7766
7767 : What suffix to use on installed man pages
7768 case "$man3dir" in
7769 ' ')
7770         man3ext='0'
7771         ;;
7772 *)
7773         rp="What suffix should be used for the $package library man pages?"
7774         case "$man3ext" in
7775         '')     case "$man3dir" in
7776                 *3)  dflt=3 ;;
7777                 *3p) dflt=3p ;;
7778                 *3pm) dflt=3pm ;;
7779                 *l) dflt=l;;
7780                 *n) dflt=n;;
7781                 *o) dflt=o;;
7782                 *p) dflt=p;;
7783                 *C) dflt=C;;
7784                 *L) dflt=L;;
7785                 *L3) dflt=L3;;
7786                 *) dflt=3;;
7787                 esac
7788                 ;;
7789         *)      dflt="$man3ext";;
7790         esac
7791         . ./myread
7792         man3ext="$ans"
7793         ;;
7794 esac
7795
7796 : see if we have to deal with yellow pages, now NIS.
7797 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7798         if $test -f /usr/etc/nibindd; then
7799                 echo " "
7800                 echo "I'm fairly confident you're on a NeXT."
7801                 echo " "
7802                 rp='Do you get the hosts file via NetInfo?'
7803                 dflt=y
7804                 case "$hostcat" in
7805                 nidump*) ;;
7806                 '') ;;
7807                 *) dflt=n;;
7808                 esac
7809                 . ./myread
7810                 case "$ans" in
7811                 y*) hostcat='nidump hosts .';;
7812                 *)      case "$hostcat" in
7813                         nidump*) hostcat='';;
7814                         esac
7815                         ;;
7816                 esac
7817         fi
7818         case "$hostcat" in
7819         nidump*) ;;
7820         *)
7821                 case "$hostcat" in
7822                 *ypcat*) dflt=y;;
7823                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7824                                 dflt=y
7825                         else
7826                                 dflt=n
7827                         fi;;
7828                 *) dflt=n;;
7829                 esac
7830                 echo " "
7831                 rp='Are you getting the hosts file via yellow pages?'
7832                 . ./myread
7833                 case "$ans" in
7834                 y*) hostcat='ypcat hosts';;
7835                 *) hostcat='cat /etc/hosts';;
7836                 esac
7837                 ;;
7838         esac
7839 fi
7840 case "$hostcat" in
7841 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7842 esac
7843 case "$groupcat" in
7844 '') test -f /etc/group && groupcat='cat /etc/group';;
7845 esac
7846 case "$passcat" in
7847 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7848 esac
7849
7850 : now get the host name
7851 echo " "
7852 echo "Figuring out host name..." >&4
7853 case "$myhostname" in
7854 '') cont=true
7855         echo 'Maybe "hostname" will work...'
7856         if tans=`sh -c hostname 2>&1` ; then
7857                 myhostname=$tans
7858                 phostname=hostname
7859                 cont=''
7860         fi
7861         ;;
7862 *) cont='';;
7863 esac
7864 if $test "$cont"; then
7865         if ./xenix; then
7866                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7867                 if tans=`cat /etc/systemid 2>&1` ; then
7868                         myhostname=$tans
7869                         phostname='cat /etc/systemid'
7870                         echo "Whadyaknow.  Xenix always was a bit strange..."
7871                         cont=''
7872                 fi
7873         elif $test -r /etc/systemid; then
7874                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7875         fi
7876 fi
7877 if $test "$cont"; then
7878         echo 'No, maybe "uuname -l" will work...'
7879         if tans=`sh -c 'uuname -l' 2>&1` ; then
7880                 myhostname=$tans
7881                 phostname='uuname -l'
7882         else
7883                 echo 'Strange.  Maybe "uname -n" will work...'
7884                 if tans=`sh -c 'uname -n' 2>&1` ; then
7885                         myhostname=$tans
7886                         phostname='uname -n'
7887                 else
7888                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7889                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7890                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7891                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7892                         else
7893                                 case "$myhostname" in
7894                                 '') echo "Does this machine have an identity crisis or something?"
7895                                         phostname='';;
7896                                 *)
7897                                         echo "Well, you said $myhostname before..."
7898                                         phostname='echo $myhostname';;
7899                                 esac
7900                         fi
7901                 fi
7902         fi
7903 fi
7904 : you do not want to know about this
7905 set $myhostname
7906 myhostname=$1
7907
7908 : verify guess
7909 if $test "$myhostname" ; then
7910         dflt=y
7911         rp='Your host name appears to be "'$myhostname'".'" Right?"
7912         . ./myread
7913         case "$ans" in
7914         y*) ;;
7915         *) myhostname='';;
7916         esac
7917 fi
7918
7919 : bad guess or no guess
7920 while $test "X$myhostname" = X ; do
7921         dflt=''
7922         rp="Please type the (one word) name of your host:"
7923         . ./myread
7924         myhostname="$ans"
7925 done
7926
7927 : translate upper to lower if necessary
7928 case "$myhostname" in
7929 *[A-Z]*)
7930         echo "(Normalizing case in your host name)"
7931         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7932         ;;
7933 esac
7934
7935 case "$myhostname" in
7936 *.*)
7937         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7938         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7939         echo "(Trimming domain name from host name--host name is now $myhostname)"
7940         ;;
7941 *) case "$mydomain" in
7942         '')
7943                 {
7944                         test "X$hostcat" = "Xypcat hosts" &&
7945                         ypmatch "$myhostname" hosts 2>/dev/null |\
7946                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7947                         $test -s hosts
7948                 } || {
7949                         test "X$hostcat" != "X" &&
7950                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7951                                         /[       ]$myhostname[  . ]/p" > hosts
7952                 }
7953                 tmp_re="[       . ]"
7954                 if $test -f hosts; then
7955                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7956                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7957                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7958                                 hosts | $sort | $uniq | \
7959                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7960                         case `$echo X$dflt` in
7961                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7962                                 dflt=.
7963                                 ;;
7964                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7965                                 ;;
7966                         esac
7967                 else
7968                         echo "(I cannot locate a hosts database anywhere)"
7969                         dflt=.
7970                 fi
7971                 case "$dflt" in
7972                 .)
7973                         tans=`./loc resolv.conf X /etc /usr/etc`
7974                         if $test -f "$tans"; then
7975                                 echo "(Attempting domain name extraction from $tans)"
7976                                 dflt=.`$sed -n -e 's/   / /g' \
7977                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7978                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7979                                 case "$dflt" in
7980                                 .) dflt=.`$sed -n -e 's/        / /g' \
7981                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7982                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7983                                         ;;
7984                                 esac
7985                         fi
7986                         ;;
7987                 esac
7988                 case "$dflt" in
7989                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7990                         dflt=.`sh -c domainname 2>/dev/null`
7991                         case "$dflt" in
7992                         '') dflt='.';;
7993                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7994                         esac
7995                         ;;
7996                 esac
7997                 case "$dflt$osname" in
7998                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7999                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8000                         ;;
8001                 esac
8002                 case "$dflt" in
8003                 .) echo "(Lost all hope -- silly guess then)"
8004                         dflt='.uucp'
8005                         ;;
8006                 esac
8007                 $rm -f hosts
8008                 ;;
8009         *) dflt="$mydomain";;
8010         esac;;
8011 esac
8012 echo " "
8013 rp="What is your domain name?"
8014 . ./myread
8015 tans="$ans"
8016 case "$ans" in
8017 '') ;;
8018 .*) ;;
8019 *) tans=".$tans";;
8020 esac
8021 mydomain="$tans"
8022
8023 : translate upper to lower if necessary
8024 case "$mydomain" in
8025 *[A-Z]*)
8026         echo "(Normalizing case in your domain name)"
8027         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8028         ;;
8029 esac
8030
8031 : a little sanity check here
8032 case "$phostname" in
8033 '') ;;
8034 *)
8035         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8036         $myhostname$mydomain|$myhostname) ;;
8037         *)
8038                 case "$phostname" in
8039                 sed*)
8040                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8041                         ;;
8042                 *)
8043                         echo "(That doesn't agree with your $phostname command, by the way.)"
8044                         ;;
8045                 esac
8046         ;;
8047         esac
8048         ;;
8049 esac
8050
8051 $cat <<EOM
8052
8053 I need to get your e-mail address in Internet format if possible, i.e.
8054 something like user@host.domain. Please answer accurately since I have
8055 no easy means to double check it. The default value provided below
8056 is most probably close to reality but may not be valid from outside
8057 your organization...
8058
8059 EOM
8060 cont=x
8061 while test "$cont"; do
8062         case "$cf_email" in
8063         '') dflt="$cf_by@$myhostname$mydomain";;
8064         *) dflt="$cf_email";;
8065         esac
8066         rp='What is your e-mail address?'
8067         . ./myread
8068         cf_email="$ans"
8069         case "$cf_email" in
8070         *@*.*) cont='' ;;
8071         *)
8072                 rp='Address does not look like an Internet one.  Use it anyway?'
8073                 case "$fastread" in
8074                 yes) dflt=y ;;
8075                 *) dflt=n ;;
8076                 esac
8077                 . ./myread
8078                 case "$ans" in
8079                 y*) cont='' ;;
8080                 *) echo " " ;;
8081                 esac
8082                 ;;
8083         esac
8084 done
8085
8086 $cat <<EOM
8087
8088 If you or somebody else will be maintaining perl at your site, please
8089 fill in the correct e-mail address here so that they may be contacted
8090 if necessary. Currently, the "perlbug" program included with perl
8091 will send mail to this address in addition to perlbug@perl.org. You may
8092 enter "none" for no administrator.
8093
8094 EOM
8095 case "$perladmin" in
8096 '') dflt="$cf_email";;
8097 *) dflt="$perladmin";;
8098 esac
8099 rp='Perl administrator e-mail address'
8100 . ./myread
8101 perladmin="$ans"
8102
8103 : determine whether to only install version-specific parts.
8104 echo " "
8105 $cat <<EOM
8106 Do you want to install only the version-specific parts of the perl
8107 distribution?  Usually you do *not* want to do this.
8108 EOM
8109 case "$versiononly" in
8110 "$define"|[Yy]*|true) dflt='y' ;;
8111 *) dflt='n';
8112 esac
8113 rp="Do you want to install only the version-specific parts of perl?"
8114 . ./myread
8115 case "$ans" in
8116 [yY]*)  val="$define";;
8117 *)      val="$undef" ;;
8118 esac
8119 set versiononly
8120 eval $setvar
8121
8122 : figure out how to guarantee perl startup
8123 case "$startperl" in
8124 '')
8125         case "$sharpbang" in
8126         *!)
8127                 $cat <<EOH
8128
8129 I can use the #! construct to start perl on your system. This will
8130 make startup of perl scripts faster, but may cause problems if you
8131 want to share those scripts and perl is not in a standard place
8132 ($binexp/perl) on all your platforms. The alternative is to force
8133 a shell by starting the script with a single ':' character.
8134
8135 EOH
8136                 case "$versiononly" in
8137                 "$define")      dflt="$binexp/perl$version";;  
8138                 *)              dflt="$binexp/perl";;
8139                 esac
8140                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8141                 . ./myread
8142                 case "$ans" in
8143                 none)   startperl=": # use perl";;
8144                 *)      startperl="#!$ans"
8145                         if $test 30 -lt `echo "$ans" | wc -c`; then
8146                                 $cat >&4 <<EOM
8147
8148 WARNING:  Some systems limit the #! command to 32 characters.
8149 If you experience difficulty running Perl scripts with #!, try
8150 installing Perl in a directory with a shorter pathname.
8151
8152 EOM
8153                         fi ;;
8154                 esac
8155                 ;;
8156         *) startperl=": # use perl"
8157                 ;;
8158         esac
8159         ;;
8160 esac
8161 echo "I'll use $startperl to start perl scripts."
8162
8163 : figure best path for perl in scripts
8164 case "$perlpath" in
8165 '')
8166         perlpath="$binexp/perl"
8167         case "$startperl" in
8168         *!*) ;;
8169         *)
8170                 $cat <<EOH
8171
8172 I will use the "eval 'exec'" idiom to start Perl on your system.
8173 I can use the full path of your Perl binary for this purpose, but
8174 doing so may cause problems if you want to share those scripts and
8175 Perl is not always in a standard place ($binexp/perl).
8176
8177 EOH
8178                 dflt="$binexp/perl"
8179                 rp="What path shall I use in \"eval 'exec'\"?"
8180                 . ./myread
8181                 perlpath="$ans"
8182                 ;;
8183         esac
8184         ;;
8185 esac
8186 case "$startperl" in
8187 *!*)    ;;
8188 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8189 esac
8190
8191 : determine where public executable scripts go
8192 set scriptdir scriptdir
8193 eval $prefixit
8194 case "$scriptdir" in
8195 '')
8196         dflt="$bin"
8197         : guess some guesses
8198         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8199         $test -d /usr/share/bin     && dflt=/usr/share/bin
8200         $test -d /usr/local/script  && dflt=/usr/local/script
8201         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8202         $test -d $prefixexp/script  && dflt=$prefixexp/script
8203         set dflt
8204         eval $prefixup
8205         ;;
8206 *)  dflt="$scriptdir"
8207         ;;
8208 esac
8209 $cat <<EOM
8210  
8211 Some installations have a separate directory just for executable scripts so
8212 that they can mount it across multiple architectures but keep the scripts in
8213 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8214 Or you might just lump your scripts in with all your other executables.
8215  
8216 EOM
8217 fn=d~
8218 rp='Where do you keep publicly executable scripts?'
8219 . ./getfile
8220 if $test "X$ansexp" != "X$scriptdirexp"; then
8221         installscript=''
8222 fi
8223 scriptdir="$ans"
8224 scriptdirexp="$ansexp"
8225 : Change installation prefix, if necessary.
8226 if $test X"$prefix" != X"$installprefix"; then
8227         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8228 else
8229         installscript="$scriptdirexp"
8230 fi
8231
8232 : determine where add-on public executables go
8233 case "$sitebin" in
8234 '')     dflt=$siteprefix/bin ;;
8235 *)      dflt=$sitebin ;;
8236 esac
8237 fn=d~
8238 rp='Pathname where the add-on public executables should be installed?'
8239 . ./getfile
8240 sitebin="$ans"
8241 sitebinexp="$ansexp"
8242 : Change installation prefix, if necessary.
8243 if $test X"$prefix" != X"$installprefix"; then
8244         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8245 else
8246         installsitebin="$sitebinexp"
8247 fi
8248
8249 case "$vendorprefix" in
8250 '')     d_vendorbin="$undef"
8251         vendorbin=''
8252         vendorbinexp=''
8253         ;;
8254 *)      d_vendorbin="$define"
8255         : determine where vendor-supplied executables go.
8256         case "$vendorbin" in
8257         '') dflt=$vendorprefix/bin ;;
8258         *)      dflt="$vendorbin" ;;
8259         esac
8260         fn=d~+
8261         rp='Pathname for the vendor-supplied executables directory?'
8262         . ./getfile
8263         vendorbin="$ans"
8264         vendorbinexp="$ansexp"
8265         ;;
8266 esac
8267 : Change installation prefix, if necessary.
8268 if $test X"$prefix" != X"$installprefix"; then
8269         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8270 else
8271         installvendorbin="$vendorbinexp"
8272 fi
8273
8274 : see if qgcvt exists
8275 set qgcvt d_qgcvt
8276 eval $inlibc
8277
8278 echo " "
8279
8280 if $test X"$d_longdbl" = X"$define"; then
8281
8282 echo "Checking how to print long doubles..." >&4
8283
8284 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8285         $cat >try.c <<'EOCP'
8286 #include <sys/types.h>
8287 #include <stdio.h>
8288 int main() {
8289   double d = 123.456;
8290   printf("%.3f\n", d);
8291 }
8292 EOCP
8293         set try
8294         if eval $compile; then
8295                 yyy=`$run ./try`
8296                 case "$yyy" in
8297                 123.456)
8298                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8299                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8300                         echo "We will use %f."
8301                         ;;
8302                 esac
8303         fi
8304 fi
8305
8306 if $test X"$sPRIfldbl" = X; then
8307         $cat >try.c <<'EOCP'
8308 #include <sys/types.h>
8309 #include <stdio.h>
8310 int main() {
8311   long double d = 123.456;
8312   printf("%.3Lf\n", d);
8313 }
8314 EOCP
8315         set try
8316         if eval $compile; then
8317                 yyy=`$run ./try`
8318                 case "$yyy" in
8319                 123.456)
8320                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8321                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8322                         echo "We will use %Lf."
8323                         ;;
8324                 esac
8325         fi
8326 fi
8327
8328 if $test X"$sPRIfldbl" = X; then
8329         $cat >try.c <<'EOCP'
8330 #include <sys/types.h>
8331 #include <stdio.h>
8332 int main() {
8333   long double d = 123.456;
8334   printf("%.3llf\n", d);
8335 }
8336 EOCP
8337         set try
8338         if eval $compile; then
8339                 yyy=`$run ./try`
8340                 case "$yyy" in
8341                 123.456)
8342                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8343                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8344                         echo "We will use %llf."
8345                         ;;
8346                 esac
8347         fi
8348 fi
8349
8350 if $test X"$sPRIfldbl" = X; then
8351         $cat >try.c <<'EOCP'
8352 #include <sys/types.h>
8353 #include <stdio.h>
8354 int main() {
8355   long double d = 123.456;
8356   printf("%.3lf\n", d);
8357 }
8358 EOCP
8359         set try
8360         if eval $compile; then
8361                 yyy=`$run ./try`
8362                 case "$yyy" in
8363                 123.456)
8364                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8365                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8366                         echo "We will use %lf."
8367                         ;;
8368                 esac
8369         fi
8370 fi
8371
8372 if $test X"$sPRIfldbl" = X; then
8373         echo "Cannot figure out how to print long doubles." >&4
8374 else
8375         sSCNfldbl=$sPRIfldbl    # expect consistency
8376 fi
8377
8378 $rm -f try try.*
8379
8380 fi # d_longdbl
8381
8382 case "$sPRIfldbl" in
8383 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8384         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8385         d_SCNfldbl="$undef";
8386         ;;
8387 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8388         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8389         d_SCNfldbl="$define";
8390         ;;
8391 esac
8392
8393 : Check how to convert floats to strings.
8394 echo " "
8395 echo "Checking for an efficient way to convert floats to strings."
8396 echo " " > try.c
8397 case "$uselongdouble" in
8398 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8399 esac
8400 case "$d_longdbl" in
8401 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8402 esac
8403 case "$d_PRIgldbl" in
8404 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8405 esac
8406 $cat >>try.c <<EOP
8407 #ifdef TRY_gconvert
8408 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8409 char *myname = "gconvert";
8410 #endif
8411 #ifdef TRY_gcvt
8412 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8413 char *myname = "gcvt";
8414 #endif
8415 #ifdef TRY_qgcvt
8416 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8417 char *myname = "qgcvt";
8418 #define DOUBLETYPE long double
8419 #endif
8420 #ifdef TRY_sprintf
8421 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8422 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8423 #else
8424 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8425 #endif
8426 char *myname = "sprintf";
8427 #endif
8428
8429 #ifndef DOUBLETYPE
8430 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8431 #define DOUBLETYPE long double
8432 #else
8433 #define DOUBLETYPE double
8434 #endif
8435 #endif
8436
8437 #include <stdio.h>
8438
8439 #define I_STDLIB $i_stdlib
8440 #ifdef I_STDLIB
8441 #include <stdlib.h>
8442 #endif
8443
8444 int
8445 checkit(expect, got)
8446 char *expect;
8447 char *got;
8448 {
8449     if (strcmp(expect, got)) {
8450                 printf("%s oddity:  Expected %s, got %s\n",
8451                         myname, expect, got);
8452                 exit(1);
8453         }
8454 }
8455
8456 int main()
8457
8458         char buf[64]; 
8459         buf[63] = '\0';
8460
8461         /* This must be 1st test on (which?) platform */
8462         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8463         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8464         checkit("0.1", buf);
8465
8466         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8467         checkit("1", buf);
8468
8469         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8470         checkit("1.1", buf);
8471
8472         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8473         checkit("1.01", buf);
8474
8475         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8476         checkit("1.001", buf);
8477
8478         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8479         checkit("1.0001", buf);
8480
8481         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8482         checkit("1.00001", buf);
8483
8484         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8485         checkit("1.000001", buf);
8486
8487         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8488         checkit("0", buf);
8489
8490         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8491         checkit("-1", buf);
8492
8493         /* Some Linux gcvt's give 1.e+5 here. */
8494         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8495         checkit("100000", buf);
8496         
8497         /* Some Linux gcvt's give -1.e+5 here. */
8498         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8499         checkit("-100000", buf);
8500
8501         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8502         checkit("123.456", buf);
8503
8504         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8505         Gconvert((DOUBLETYPE)1e30, 8, 0, buf);
8506         if (strlen(buf) > 5)
8507             checkit("1e+030", buf); /* for Microsoft */
8508         else
8509             checkit("1e+30", buf);
8510
8511         exit(0);
8512 }
8513 EOP
8514 case "$d_Gconvert" in
8515 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8516 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8517 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8518 *) xxx_list='gconvert gcvt sprintf' ;;
8519 esac
8520
8521 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8522 "$define$define$define")
8523     # for long doubles prefer first qgcvt, then sprintf
8524     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8525     xxx_list="sprintf $xxx_list"
8526     case "$d_qgcvt" in
8527     "$define") xxx_list="qgcvt $xxx_list" ;;
8528     esac
8529     ;;
8530 esac
8531
8532 for xxx_convert in $xxx_list; do
8533         echo "Trying $xxx_convert..."
8534         $rm -f try try$_o
8535         set try -DTRY_$xxx_convert
8536         if eval $compile; then
8537                 echo "$xxx_convert() found." >&4
8538                 if $run ./try; then
8539                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8540                         break;
8541                 else
8542                         echo "...But $xxx_convert didn't work as I expected."
8543                 fi
8544         else
8545                 echo "$xxx_convert NOT found." >&4
8546         fi
8547 done
8548         
8549 case "$xxx_convert" in
8550 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8551 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8552 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8553 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8554    "$define$define$define")
8555       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8556    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8557    esac
8558    ;;  
8559 esac
8560
8561 : see if _fwalk exists
8562 set fwalk d__fwalk
8563 eval $inlibc
8564
8565 : Initialize h_fcntl
8566 h_fcntl=false
8567
8568 : Initialize h_sysfile
8569 h_sysfile=false
8570
8571 : access call always available on UNIX
8572 set access d_access
8573 eval $inlibc
8574
8575 : locate the flags for 'access()'
8576 case "$d_access" in
8577 "$define")
8578         echo " "
8579         $cat >access.c <<'EOCP'
8580 #include <sys/types.h>
8581 #ifdef I_FCNTL
8582 #include <fcntl.h>
8583 #endif
8584 #ifdef I_SYS_FILE
8585 #include <sys/file.h>
8586 #endif
8587 #ifdef I_UNISTD
8588 #include <unistd.h>
8589 #endif
8590 int main() {
8591         exit(R_OK);
8592 }
8593 EOCP
8594         : check sys/file.h first, no particular reason here
8595         if $test `./findhdr sys/file.h` && \
8596                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8597                 h_sysfile=true;
8598                 echo "<sys/file.h> defines the *_OK access constants." >&4
8599         elif $test `./findhdr fcntl.h` && \
8600                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8601                 h_fcntl=true;
8602                 echo "<fcntl.h> defines the *_OK access constants." >&4
8603         elif $test `./findhdr unistd.h` && \
8604                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8605                 echo "<unistd.h> defines the *_OK access constants." >&4
8606         else
8607                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8608         fi
8609         ;;
8610 esac
8611 $rm -f access*
8612
8613 : see if accessx exists
8614 set accessx d_accessx
8615 eval $inlibc
8616
8617 : see if alarm exists
8618 set alarm d_alarm
8619 eval $inlibc
8620
8621 : see if atolf exists
8622 set atolf d_atolf
8623 eval $inlibc
8624
8625 : see if atoll exists
8626 set atoll d_atoll
8627 eval $inlibc
8628
8629 : Look for GNU-cc style attribute checking
8630 echo " "
8631 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8632 $cat >attrib.c <<'EOCP'
8633 #include <stdio.h>
8634 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8635 EOCP
8636 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8637         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8638                 echo "Your C compiler doesn't fully support __attribute__."
8639                 val="$undef"
8640         else
8641                 echo "Your C compiler supports __attribute__."
8642                 val="$define"
8643         fi
8644 else
8645         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8646         val="$undef"
8647 fi
8648 set d_attribut
8649 eval $setvar
8650 $rm -f attrib*
8651
8652 : see if bcmp exists
8653 set bcmp d_bcmp
8654 eval $inlibc
8655
8656 : see if bcopy exists
8657 set bcopy d_bcopy
8658 eval $inlibc
8659
8660 : see if this is a unistd.h system
8661 set unistd.h i_unistd
8662 eval $inhdr
8663
8664 : see if getpgrp exists
8665 set getpgrp d_getpgrp
8666 eval $inlibc
8667
8668 case "$d_getpgrp" in
8669 "$define")
8670         echo " "
8671         echo "Checking to see which flavor of getpgrp is in use..."
8672         $cat >try.c <<EOP
8673 #$i_unistd I_UNISTD
8674 #include <sys/types.h>
8675 #ifdef I_UNISTD
8676 #  include <unistd.h>
8677 #endif
8678 int main()
8679 {
8680         if (getuid() == 0) {
8681                 printf("(I see you are running Configure as super-user...)\n");
8682                 setuid(1);
8683         }
8684 #ifdef TRY_BSD_PGRP
8685         if (getpgrp(1) == 0)
8686                 exit(0);
8687 #else
8688         if (getpgrp() > 0)
8689                 exit(0);
8690 #endif
8691         exit(1);
8692 }
8693 EOP
8694         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8695                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8696                 val="$define"
8697         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8698                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8699                 val="$undef"
8700         else
8701                 echo "I can't seem to compile and run the test program."
8702                 if ./usg; then
8703                         xxx="a USG one, i.e. you use getpgrp()."
8704                 else
8705                         # SVR4 systems can appear rather BSD-ish.
8706                         case "$i_unistd" in
8707                         $undef)
8708                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8709                                 val="$define"
8710                                 ;;
8711                         $define)
8712                                 xxx="probably a USG one, i.e. you use getpgrp()."
8713                                 val="$undef"
8714                                 ;;
8715                         esac
8716                 fi
8717                 echo "Assuming your getpgrp is $xxx" >&4
8718         fi
8719         ;;
8720 *) val="$undef";;
8721 esac
8722 set d_bsdgetpgrp
8723 eval $setvar
8724 $rm -f try try.*
8725
8726 : see if setpgrp exists
8727 set setpgrp d_setpgrp
8728 eval $inlibc
8729
8730 case "$d_setpgrp" in
8731 "$define")
8732         echo " "
8733         echo "Checking to see which flavor of setpgrp is in use..."
8734         $cat >try.c <<EOP
8735 #$i_unistd I_UNISTD
8736 #include <sys/types.h>
8737 #ifdef I_UNISTD
8738 #  include <unistd.h>
8739 #endif
8740 int main()
8741 {
8742         if (getuid() == 0) {
8743                 printf("(I see you are running Configure as super-user...)\n");
8744                 setuid(1);
8745         }
8746 #ifdef TRY_BSD_PGRP
8747         if (-1 == setpgrp(1, 1))
8748                 exit(0);
8749 #else
8750         if (setpgrp() != -1)
8751                 exit(0);
8752 #endif
8753         exit(1);
8754 }
8755 EOP
8756         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8757                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8758                 val="$define"
8759         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8760                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8761                 val="$undef"
8762         else
8763                 echo "(I can't seem to compile and run the test program.)"
8764                 if ./usg; then
8765                         xxx="a USG one, i.e. you use setpgrp()."
8766                 else
8767                         # SVR4 systems can appear rather BSD-ish.
8768                         case "$i_unistd" in
8769                         $undef)
8770                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8771                                 val="$define"
8772                                 ;;
8773                         $define)
8774                                 xxx="probably a USG one, i.e. you use setpgrp()."
8775                                 val="$undef"
8776                                 ;;
8777                         esac
8778                 fi
8779                 echo "Assuming your setpgrp is $xxx" >&4
8780         fi
8781         ;;
8782 *) val="$undef";;
8783 esac
8784 set d_bsdsetpgrp
8785 eval $setvar
8786 $rm -f try try.*
8787 : see if bzero exists
8788 set bzero d_bzero
8789 eval $inlibc
8790
8791 : see if signal is declared as pointer to function returning int or void
8792 echo " "
8793 xxx=`./findhdr signal.h`
8794 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8795 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8796         echo "You have int (*signal())() instead of void." >&4
8797         val="$undef"
8798 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8799         echo "You have void (*signal())()." >&4
8800         val="$define"
8801 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8802         echo "You have int (*signal())() instead of void." >&4
8803         val="$undef"
8804 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8805         echo "You have void (*signal())()." >&4
8806         val="$define"
8807 else
8808         case "$d_voidsig" in
8809         '')
8810         echo "I can't determine whether signal handler returns void or int..." >&4
8811                 dflt=void
8812                 rp="What type does your signal handler return?"
8813                 . ./myread
8814                 case "$ans" in
8815                 v*) val="$define";;
8816                 *) val="$undef";;
8817                 esac;;
8818         "$define")
8819                 echo "As you already told me, signal handler returns void." >&4
8820                 val="$define"
8821                 ;;
8822         *)      echo "As you already told me, signal handler returns int." >&4
8823                 val="$undef"
8824                 ;;
8825         esac
8826 fi
8827 set d_voidsig
8828 eval $setvar
8829 case "$d_voidsig" in
8830 "$define") signal_t="void";;
8831 *) signal_t="int";;
8832 esac
8833 $rm -f $$.tmp
8834
8835 : check for ability to cast large floats to 32-bit ints.
8836 echo " "
8837 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8838 if $test "$intsize" -ge 4; then
8839         xxx=int
8840 else
8841         xxx=long
8842 fi
8843 $cat >try.c <<EOCP
8844 #include <stdio.h>
8845 #include <sys/types.h>
8846 #include <signal.h>
8847 $signal_t blech(s) int s; { exit(3); }
8848 int main()
8849 {
8850         $xxx i32;
8851         double f, g;
8852         int result = 0;
8853         char str[16];
8854         signal(SIGFPE, blech);
8855
8856         /* Don't let compiler optimize the test away.  Store the number 
8857            in a writable string for gcc to pass to sscanf under HP/UX.
8858         */
8859         sprintf(str, "2147483647");
8860         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8861         g = 10 * f;
8862         i32  = ($xxx) g;
8863
8864         /* x86 processors will probably give 0x8000 0000, which is a
8865        sign change.  We don't want that.  We want to mimic SPARC
8866            behavior here, which is to preserve the sign and give
8867            back 0x7fff ffff.
8868         */
8869         if (i32 != ($xxx) f)
8870                 result |= 1;
8871         exit(result);
8872 }
8873 EOCP
8874 set try
8875 if eval $compile_ok; then
8876         $run ./try
8877         yyy=$?
8878 else
8879         echo "(I can't seem to compile the test program--assuming it can't)"
8880         yyy=1
8881 fi
8882 case "$yyy" in
8883 0)      val="$define"
8884         echo "Yup, it can."
8885         ;;
8886 *)      val="$undef"
8887         echo "Nope, it can't."
8888         ;;
8889 esac
8890 set d_casti32
8891 eval $setvar
8892 $rm -f try try.*
8893
8894 : check for ability to cast negative floats to unsigned
8895 echo " "
8896 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8897 $cat >try.c <<EOCP
8898 #include <stdio.h>
8899 #include <sys/types.h>
8900 #include <signal.h>
8901 $signal_t blech(s) int s; { exit(7); }
8902 $signal_t blech_in_list(s) int s; { exit(4); }
8903 unsigned long dummy_long(p) unsigned long p; { return p; }
8904 unsigned int dummy_int(p) unsigned int p; { return p; }
8905 unsigned short dummy_short(p) unsigned short p; { return p; }
8906 int main()
8907 {
8908         double f;
8909         unsigned long along;
8910         unsigned int aint;
8911         unsigned short ashort;
8912         int result = 0;
8913         char str[16];
8914         
8915         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8916            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8917            optimized the whole file away
8918         */
8919         /* Store the number in a writable string for gcc to pass to 
8920            sscanf under HP/UX.
8921         */
8922         sprintf(str, "-123");
8923         sscanf(str, "%lf", &f);  /* f = -123.; */
8924
8925         signal(SIGFPE, blech);
8926         along = (unsigned long)f;
8927         aint = (unsigned int)f;
8928         ashort = (unsigned short)f;
8929         if (along != (unsigned long)-123)
8930                 result |= 1;
8931         if (aint != (unsigned int)-123)
8932                 result |= 1;
8933         if (ashort != (unsigned short)-123)
8934                 result |= 1;
8935         sprintf(str, "1073741824.");
8936         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8937         f = f + f;
8938         along = 0;
8939         along = (unsigned long)f;
8940         if (along != 0x80000000)
8941                 result |= 2;
8942         f -= 1.;
8943         along = 0;
8944         along = (unsigned long)f;
8945         if (along != 0x7fffffff)
8946                 result |= 1;
8947         f += 2.;
8948         along = 0;
8949         along = (unsigned long)f;
8950         if (along != 0x80000001)
8951                 result |= 2;
8952         if (result)
8953                 exit(result);
8954         signal(SIGFPE, blech_in_list);
8955         sprintf(str, "123.");
8956         sscanf(str, "%lf", &f);  /* f = 123.; */
8957         along = dummy_long((unsigned long)f);
8958         aint = dummy_int((unsigned int)f);
8959         ashort = dummy_short((unsigned short)f);
8960         if (along != (unsigned long)123)
8961                 result |= 4;
8962         if (aint != (unsigned int)123)
8963                 result |= 4;
8964         if (ashort != (unsigned short)123)
8965                 result |= 4;
8966         exit(result);
8967
8968 }
8969 EOCP
8970 set try
8971 if eval $compile_ok; then
8972         $run ./try
8973         castflags=$?
8974 else
8975         echo "(I can't seem to compile the test program--assuming it can't)"
8976         castflags=7
8977 fi
8978 case "$castflags" in
8979 0)      val="$define"
8980         echo "Yup, it can."
8981         ;;
8982 *)      val="$undef"
8983         echo "Nope, it can't."
8984         ;;
8985 esac
8986 set d_castneg
8987 eval $setvar
8988 $rm -f try.*
8989
8990 : see if vprintf exists
8991 echo " "
8992 if set vprintf val -f d_vprintf; eval $csym; $val; then
8993         echo 'vprintf() found.' >&4
8994         val="$define"
8995         $cat >try.c <<'EOF'
8996 #include <varargs.h>
8997
8998 int main() { xxx("foo"); }
8999
9000 xxx(va_alist)
9001 va_dcl
9002 {
9003         va_list args;
9004         char buf[10];
9005
9006         va_start(args);
9007         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9008 }
9009 EOF
9010         set try
9011         if eval $compile && $run ./try; then
9012                 echo "Your vsprintf() returns (int)." >&4
9013                 val2="$undef"
9014         else
9015                 echo "Your vsprintf() returns (char*)." >&4
9016                 val2="$define"
9017         fi
9018 else
9019         echo 'vprintf() NOT found.' >&4
9020                 val="$undef"
9021                 val2="$undef"
9022 fi
9023 $rm -f try try.*
9024 set d_vprintf
9025 eval $setvar
9026 val=$val2
9027 set d_charvspr
9028 eval $setvar
9029
9030 : see if chown exists
9031 set chown d_chown
9032 eval $inlibc
9033
9034 : see if chroot exists
9035 set chroot d_chroot
9036 eval $inlibc
9037
9038 : see if chsize exists
9039 set chsize d_chsize
9040 eval $inlibc
9041
9042 hasstruct='varname=$1; struct=$2; shift; shift;
9043 while $test $# -ge 2; do
9044         case "$1" in
9045         $define) echo "#include <$2>";;
9046         esac ;
9047     shift 2;
9048 done > try.c;
9049 echo "int main () { struct $struct foo; }" >> try.c;
9050 set try;
9051 if eval $compile; then
9052         val="$define";
9053 else
9054         val="$undef";
9055 fi;
9056 set $varname;
9057 eval $setvar;
9058 $rm -f try.c try.o'
9059
9060 : see if sys/types.h has to be included
9061 set sys/types.h i_systypes
9062 eval $inhdr
9063
9064 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9065 while $test $# -ge 2; do
9066         case "$1" in
9067         $define) echo "#include <$2>";;
9068         esac ;
9069     shift 2;
9070 done > try.c;
9071 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9072 set try;
9073 if eval $compile; then
9074         val="$define";
9075 else
9076         val="$undef";
9077 fi;
9078 set $varname;
9079 eval $setvar;
9080 $rm -f try.c try.o'
9081
9082 socketlib=''
9083 sockethdr=''
9084 : see whether socket exists
9085 echo " "
9086 $echo $n "Hmm... $c" >&4
9087 if set socket val -f d_socket; eval $csym; $val; then
9088         echo "Looks like you have Berkeley networking support." >&4
9089         d_socket="$define"
9090         if set setsockopt val -f; eval $csym; $val; then
9091                 d_oldsock="$undef"
9092         else
9093                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9094                 d_oldsock="$define"
9095         fi
9096 else
9097         if $contains socklib libc.list >/dev/null 2>&1; then
9098                 echo "Looks like you have Berkeley networking support." >&4
9099                 d_socket="$define"
9100                 : we will have to assume that it supports the 4.2 BSD interface
9101                 d_oldsock="$undef"
9102         else
9103                 echo "You don't have Berkeley networking in libc$_a..." >&4
9104                 if test "X$d_socket" = "X$define"; then
9105                    echo "...but you seem to believe that you have sockets." >&4
9106                 else
9107                         for net in net socket
9108                         do
9109                                 if test -f /usr/lib/lib$net$_a; then
9110                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9111                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9112                                         if $contains socket libc.list >/dev/null 2>&1; then
9113                                                 d_socket="$define"
9114                                                 socketlib="-l$net"
9115                                                 case "$net" in
9116                                                 net)
9117                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9118                                                         sockethdr="-I/usr/netinclude"
9119                                                         ;;
9120                                                 esac
9121                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9122                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9123                                                         d_oldsock="$undef"
9124                                                 else
9125                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9126                                                         d_oldsock="$define"
9127                                                 fi
9128                                                 break
9129                                         fi
9130                                 fi
9131                         done
9132                         if test "X$d_socket" != "X$define"; then
9133                            echo "or anywhere else I see." >&4
9134                            d_socket="$undef"
9135                            d_oldsock="$undef"
9136                         fi
9137                 fi
9138         fi
9139 fi
9140
9141 : see if socketpair exists
9142 set socketpair d_sockpair
9143 eval $inlibc
9144
9145
9146 echo " "
9147 echo "Checking the availability of certain socket constants..." >& 4
9148 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9149         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9150         $cat >try.c <<EOF
9151 #include <sys/types.h>
9152 #include <sys/socket.h>
9153 int main() {
9154     int i = $ENUM;
9155 }
9156 EOF
9157         val="$undef"
9158         set try; if eval $compile; then
9159                 val="$define"
9160         fi
9161         set d_${enum}; eval $setvar
9162         $rm -f try.c try
9163 done
9164
9165 : see if this is a sys/uio.h system
9166 set sys/uio.h i_sysuio
9167 eval $inhdr
9168
9169
9170 echo " "
9171 echo "Checking to see if your system supports struct cmsghdr..." >&4
9172 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9173 eval $hasstruct
9174 case "$d_cmsghdr_s" in
9175 "$define")      echo "Yes, it does."   ;;
9176 *)              echo "No, it doesn't." ;;
9177 esac
9178
9179
9180 : check for const keyword
9181 echo " "
9182 echo 'Checking to see if your C compiler knows about "const"...' >&4
9183 $cat >const.c <<'EOCP'
9184 typedef struct spug { int drokk; } spug;
9185 int main()
9186 {
9187         const char *foo;
9188         const spug y;
9189 }
9190 EOCP
9191 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9192         val="$define"
9193         echo "Yup, it does."
9194 else
9195         val="$undef"
9196         echo "Nope, it doesn't."
9197 fi
9198 set d_const
9199 eval $setvar
9200
9201 : see if crypt exists
9202 echo " "
9203 if set crypt val -f d_crypt; eval $csym; $val; then
9204         echo 'crypt() found.' >&4
9205         val="$define"
9206         cryptlib=''
9207 else
9208         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9209         if $test -z "$cryptlib"; then
9210                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9211         else
9212                 cryptlib=-lcrypt
9213         fi
9214         if $test -z "$cryptlib"; then
9215                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9216         else
9217                 cryptlib=-lcrypt
9218         fi
9219         if $test -z "$cryptlib"; then
9220                 cryptlib=`./loc libcrypt$_a "" $libpth`
9221         else
9222                 cryptlib=-lcrypt
9223         fi
9224         if $test -z "$cryptlib"; then
9225                 echo 'crypt() NOT found.' >&4
9226                 val="$undef"
9227         else
9228                 val="$define"
9229         fi
9230 fi
9231 set d_crypt
9232 eval $setvar
9233
9234 : get csh whereabouts
9235 case "$csh" in
9236 'csh') val="$undef" ;;
9237 *) val="$define" ;;
9238 esac
9239 set d_csh
9240 eval $setvar
9241 : Respect a hint or command line value for full_csh.
9242 case "$full_csh" in
9243 '') full_csh=$csh ;;
9244 esac
9245
9246 : see if cuserid exists
9247 set cuserid d_cuserid
9248 eval $inlibc
9249
9250 : see if this is a limits.h system
9251 set limits.h i_limits
9252 eval $inhdr
9253
9254 : see if this is a float.h system
9255 set float.h i_float
9256 eval $inhdr
9257
9258 : See if number of significant digits in a double precision number is known
9259 echo " "
9260 $cat >dbl_dig.c <<EOM
9261 #$i_limits I_LIMITS
9262 #$i_float I_FLOAT
9263 #ifdef I_LIMITS
9264 #include <limits.h>
9265 #endif
9266 #ifdef I_FLOAT
9267 #include <float.h>
9268 #endif
9269 #ifdef DBL_DIG
9270 printf("Contains DBL_DIG");
9271 #endif
9272 EOM
9273 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9274 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9275         echo "DBL_DIG found." >&4
9276         val="$define"
9277 else
9278         echo "DBL_DIG NOT found." >&4
9279         val="$undef"
9280 fi
9281 $rm -f dbl_dig.?
9282 set d_dbl_dig
9283 eval $setvar
9284
9285 hasproto='varname=$1; func=$2; shift; shift;
9286 while $test $# -ge 2; do
9287         case "$1" in
9288         $define) echo "#include <$2>";;
9289         esac ;
9290     shift 2;
9291 done > try.c;
9292 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9293 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9294         echo "$func() prototype found.";
9295         val="$define";
9296 else
9297         echo "$func() prototype NOT found.";
9298         val="$undef";
9299 fi;
9300 set $varname;
9301 eval $setvar;
9302 $rm -f try.c tryout.c'
9303
9304 : see if dbm.h is available
9305 : see if dbmclose exists
9306 set dbmclose d_dbmclose
9307 eval $inlibc
9308
9309 case "$d_dbmclose" in
9310 $define)
9311         set dbm.h i_dbm
9312         eval $inhdr
9313         case "$i_dbm" in
9314         $define)
9315                 val="$undef"
9316                 set i_rpcsvcdbm
9317                 eval $setvar
9318                 ;;
9319         *)      set rpcsvc/dbm.h i_rpcsvcdbm
9320                 eval $inhdr
9321                 ;;
9322         esac
9323         ;;
9324 *)      echo "We won't be including <dbm.h>"
9325         val="$undef"
9326         set i_dbm
9327         eval $setvar
9328         val="$undef"
9329         set i_rpcsvcdbm
9330         eval $setvar
9331         ;;
9332 esac
9333
9334 : see if prototype for dbminit is available
9335 echo " "
9336 set d_dbminitproto dbminit $i_dbm dbm.h
9337 eval $hasproto
9338
9339 : see if difftime exists
9340 set difftime d_difftime
9341 eval $inlibc
9342
9343 : see if this is a dirent system
9344 echo " "
9345 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9346         val="$define"
9347         echo "<dirent.h> found." >&4
9348 else
9349         val="$undef"
9350         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9351                 echo "<sys/dir.h> found." >&4
9352                 echo " "
9353         else
9354                 xinc=`./findhdr sys/ndir.h`
9355         fi
9356         echo "<dirent.h> NOT found." >&4
9357 fi
9358 set i_dirent
9359 eval $setvar
9360
9361 : Look for type of directory structure.
9362 echo " "
9363 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9364
9365 case "$direntrytype" in
9366 ''|' ')
9367         case "$i_dirent" in
9368         $define) guess1='struct dirent' ;;
9369         *) guess1='struct direct'  ;;
9370         esac
9371         ;;
9372 *)      guess1="$direntrytype"
9373         ;;
9374 esac
9375
9376 case "$guess1" in
9377 'struct dirent') guess2='struct direct' ;;
9378 *) guess2='struct dirent' ;;
9379 esac
9380                 
9381 if $contains "$guess1" try.c >/dev/null 2>&1; then
9382         direntrytype="$guess1"
9383         echo "Your directory entries are $direntrytype." >&4
9384 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9385         direntrytype="$guess2"
9386         echo "Your directory entries seem to be $direntrytype." >&4
9387 else
9388         echo "I don't recognize your system's directory entries." >&4
9389         rp="What type is used for directory entries on this system?"
9390         dflt="$guess1"
9391         . ./myread
9392         direntrytype="$ans"
9393 fi
9394 $rm -f try.c
9395
9396
9397 : see if the directory entry stores field length
9398 echo " "
9399 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9400 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9401         echo "Good, your directory entry keeps length information in d_namlen." >&4
9402         val="$define"
9403 else
9404         echo "Your directory entry does not know about the d_namlen field." >&4
9405         val="$undef"
9406 fi
9407 set d_dirnamlen
9408 eval $setvar
9409 $rm -f try.c
9410
9411 : see if dlerror exists
9412 xxx_runnm="$runnm"
9413 runnm=false
9414 set dlerror d_dlerror
9415 eval $inlibc
9416 runnm="$xxx_runnm"
9417
9418 : see if dlfcn is available
9419 set dlfcn.h i_dlfcn
9420 eval $inhdr
9421
9422 case "$usedl" in
9423 $define|y|true)
9424         $cat << EOM
9425
9426 On a few systems, the dynamically loaded modules that perl generates and uses
9427 will need a different extension than shared libs. The default will probably
9428 be appropriate.
9429
9430 EOM
9431         case "$dlext" in
9432         '')     dflt="$so" ;;
9433         *)      dflt="$dlext" ;;
9434         esac
9435         rp='What is the extension of dynamically loaded modules'
9436         . ./myread
9437         dlext="$ans"
9438         ;;
9439 *)
9440         dlext="none"
9441         ;;
9442 esac
9443
9444 : Check if dlsym need a leading underscore
9445 echo " "
9446 val="$undef"
9447
9448 case "$dlsrc" in
9449 dl_dlopen.xs)
9450         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9451         $cat >dyna.c <<'EOM'
9452 fred () { }
9453 EOM
9454
9455 $cat >fred.c<<EOM
9456
9457 #include <stdio.h>
9458 #$i_dlfcn I_DLFCN
9459 #ifdef I_DLFCN
9460 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
9461 #else
9462 #include <sys/types.h>
9463 #include <nlist.h>
9464 #include <link.h>
9465 #endif
9466
9467 extern int fred() ;
9468
9469 int main()
9470 {
9471     void * handle ;
9472     void * symbol ;
9473 #ifndef RTLD_LAZY
9474     int mode = 1 ;
9475 #else
9476     int mode = RTLD_LAZY ;
9477 #endif
9478     handle = dlopen("./dyna.$dlext", mode) ;
9479     if (handle == NULL) {
9480         printf ("1\n") ;
9481         fflush (stdout) ;
9482         exit(0);
9483     }
9484     symbol = dlsym(handle, "fred") ;
9485     if (symbol == NULL) {
9486         /* try putting a leading underscore */
9487         symbol = dlsym(handle, "_fred") ;
9488         if (symbol == NULL) {
9489             printf ("2\n") ;
9490             fflush (stdout) ;
9491             exit(0);
9492         }
9493         printf ("3\n") ;
9494     }
9495     else
9496         printf ("4\n") ;
9497     fflush (stdout) ;
9498     exit(0);
9499 }
9500 EOM
9501         : Call the object file tmp-dyna.o in case dlext=o.
9502         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9503                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9504                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9505                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
9506                 xxx=`$run ./fred`
9507                 case $xxx in
9508                 1)      echo "Test program failed using dlopen." >&4
9509                         echo "Perhaps you should not use dynamic loading." >&4;;
9510                 2)      echo "Test program failed using dlsym." >&4
9511                         echo "Perhaps you should not use dynamic loading." >&4;;
9512                 3)      echo "dlsym needs a leading underscore" >&4
9513                         val="$define" ;;
9514                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9515                 esac
9516         else
9517                 echo "I can't compile and run the test program." >&4
9518                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9519         fi
9520         ;;
9521 esac
9522                 
9523 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9524
9525 set d_dlsymun
9526 eval $setvar
9527
9528 : see if prototype for drand48 is available
9529 echo " "
9530 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9531 eval $hasproto
9532
9533 : see if dup2 exists
9534 set dup2 d_dup2
9535 eval $inlibc
9536
9537 : see if eaccess exists
9538 set eaccess d_eaccess
9539 eval $inlibc
9540
9541 : see if endgrent exists
9542 set endgrent d_endgrent
9543 eval $inlibc
9544
9545 : see if endhostent exists
9546 set endhostent d_endhent
9547 eval $inlibc
9548
9549 : see if endnetent exists
9550 set endnetent d_endnent
9551 eval $inlibc
9552
9553 : see if endprotoent exists
9554 set endprotoent d_endpent
9555 eval $inlibc
9556
9557 : see if endpwent exists
9558 set endpwent d_endpwent
9559 eval $inlibc
9560
9561 : see if endservent exists
9562 set endservent d_endsent
9563 eval $inlibc
9564
9565 : Locate the flags for 'open()'
9566 echo " "
9567 $cat >try.c <<'EOCP'
9568 #include <sys/types.h>
9569 #ifdef I_FCNTL
9570 #include <fcntl.h>
9571 #endif
9572 #ifdef I_SYS_FILE
9573 #include <sys/file.h>
9574 #endif
9575 int main() {
9576         if(O_RDONLY);
9577 #ifdef O_TRUNC
9578         exit(0);
9579 #else
9580         exit(1);
9581 #endif
9582 }
9583 EOCP
9584 : check sys/file.h first to get FREAD on Sun
9585 if $test `./findhdr sys/file.h` && \
9586                 set try -DI_SYS_FILE && eval $compile; then
9587         h_sysfile=true;
9588         echo "<sys/file.h> defines the O_* constants..." >&4
9589         if $run ./try; then
9590                 echo "and you have the 3 argument form of open()." >&4
9591                 val="$define"
9592         else
9593                 echo "but not the 3 argument form of open().  Oh, well." >&4
9594                 val="$undef"
9595         fi
9596 elif $test `./findhdr fcntl.h` && \
9597                 set try -DI_FCNTL && eval $compile; then
9598         h_fcntl=true;
9599         echo "<fcntl.h> defines the O_* constants..." >&4
9600         if $run ./try; then
9601                 echo "and you have the 3 argument form of open()." >&4
9602                 val="$define"
9603         else
9604                 echo "but not the 3 argument form of open().  Oh, well." >&4
9605                 val="$undef"
9606         fi
9607 else
9608         val="$undef"
9609         echo "I can't find the O_* constant definitions!  You got problems." >&4
9610 fi
9611 set d_open3
9612 eval $setvar
9613 $rm -f try try.*
9614
9615 : see which of string.h or strings.h is needed
9616 echo " "
9617 strings=`./findhdr string.h`
9618 if $test "$strings" && $test -r "$strings"; then
9619         echo "Using <string.h> instead of <strings.h>." >&4
9620         val="$define"
9621 else
9622         val="$undef"
9623         strings=`./findhdr strings.h`
9624         if $test "$strings" && $test -r "$strings"; then
9625                 echo "Using <strings.h> instead of <string.h>." >&4
9626         else
9627                 echo "No string header found -- You'll surely have problems." >&4
9628         fi
9629 fi
9630 set i_string
9631 eval $setvar
9632 case "$i_string" in
9633 "$undef") strings=`./findhdr strings.h`;;
9634 *)        strings=`./findhdr string.h`;;
9635 esac
9636
9637 : check for non-blocking I/O stuff
9638 case "$h_sysfile" in
9639 true) echo "#include <sys/file.h>" > head.c;;
9640 *)
9641        case "$h_fcntl" in
9642        true) echo "#include <fcntl.h>" > head.c;;
9643        *) echo "#include <sys/fcntl.h>" > head.c;;
9644        esac
9645        ;;
9646 esac
9647 echo " "
9648 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9649 case "$o_nonblock" in
9650 '')
9651         $cat head.c > try.c
9652         $cat >>try.c <<'EOCP'
9653 #include <stdio.h>
9654 int main() {
9655 #ifdef O_NONBLOCK
9656         printf("O_NONBLOCK\n");
9657         exit(0);
9658 #endif
9659 #ifdef O_NDELAY
9660         printf("O_NDELAY\n");
9661         exit(0);
9662 #endif
9663 #ifdef FNDELAY
9664         printf("FNDELAY\n");
9665         exit(0);
9666 #endif
9667         exit(0);
9668 }
9669 EOCP
9670         set try
9671         if eval $compile_ok; then
9672                 o_nonblock=`$run ./try`
9673                 case "$o_nonblock" in
9674                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9675                 *) echo "Seems like we can use $o_nonblock.";;
9676                 esac
9677         else
9678                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9679         fi
9680         ;;
9681 *) echo "Using $hint value $o_nonblock.";;
9682 esac
9683 $rm -f try try.* .out core
9684
9685 echo " "
9686 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9687 case "$eagain" in
9688 '')
9689         $cat head.c > try.c
9690         $cat >>try.c <<EOCP
9691 #include <errno.h>
9692 #include <sys/types.h>
9693 #include <signal.h>
9694 #include <stdio.h> 
9695 #define MY_O_NONBLOCK $o_nonblock
9696 #ifndef errno  /* XXX need better Configure test */
9697 extern int errno;
9698 #endif
9699 #$i_unistd I_UNISTD
9700 #ifdef I_UNISTD
9701 #include <unistd.h>
9702 #endif
9703 #$i_string I_STRING
9704 #ifdef I_STRING
9705 #include <string.h>
9706 #else
9707 #include <strings.h>
9708 #endif
9709 $signal_t blech(x) int x; { exit(3); }
9710 EOCP
9711         $cat >> try.c <<'EOCP'
9712 int main()
9713 {
9714         int pd[2];
9715         int pu[2];
9716         char buf[1];
9717         char string[100];
9718
9719         pipe(pd);       /* Down: child -> parent */
9720         pipe(pu);       /* Up: parent -> child */
9721         if (0 != fork()) {
9722                 int ret;
9723                 close(pd[1]);   /* Parent reads from pd[0] */
9724                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9725 #ifdef F_SETFL
9726                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9727                         exit(1);
9728 #else
9729                 exit(4);
9730 #endif
9731                 signal(SIGALRM, blech);
9732                 alarm(5);
9733                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9734                         exit(2);
9735                 sprintf(string, "%d\n", ret);
9736                 write(2, string, strlen(string));
9737                 alarm(0);
9738 #ifdef EAGAIN
9739                 if (errno == EAGAIN) {
9740                         printf("EAGAIN\n");
9741                         goto ok;
9742                 }
9743 #endif
9744 #ifdef EWOULDBLOCK
9745                 if (errno == EWOULDBLOCK)
9746                         printf("EWOULDBLOCK\n");
9747 #endif
9748         ok:
9749                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9750                 sleep(2);                               /* Give it time to close our pipe */
9751                 alarm(5);
9752                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9753                 alarm(0);
9754                 sprintf(string, "%d\n", ret);
9755                 write(3, string, strlen(string));
9756                 exit(0);
9757         }
9758
9759         close(pd[0]);                   /* We write to pd[1] */
9760         close(pu[1]);                   /* We read from pu[0] */
9761         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9762         close(pd[1]);                   /* Pipe pd is now fully closed! */
9763         exit(0);                                /* Bye bye, thank you for playing! */
9764 }
9765 EOCP
9766         set try
9767         if eval $compile_ok; then
9768                 echo "$startsh" >mtry
9769                 echo "$run ./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9770                 chmod +x mtry
9771                 ./mtry >/dev/null 2>&1
9772                 case $? in
9773                 0) eagain=`$cat try.out`;;
9774                 1) echo "Could not perform non-blocking setting!";;
9775                 2) echo "I did a successful read() for something that was not there!";;
9776                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9777                 4) echo "Could not find F_SETFL!";;
9778                 *) echo "Something terribly wrong happened during testing.";;
9779                 esac
9780                 rd_nodata=`$cat try.ret`
9781                 echo "A read() system call with no data present returns $rd_nodata."
9782                 case "$rd_nodata" in
9783                 0|-1) ;;
9784                 *)
9785                         echo "(That's peculiar, fixing that to be -1.)"
9786                         rd_nodata=-1
9787                         ;;
9788                 esac
9789                 case "$eagain" in
9790                 '')
9791                         echo "Forcing errno EAGAIN on read() with no data available."
9792                         eagain=EAGAIN
9793                         ;;
9794                 *)
9795                         echo "Your read() sets errno to $eagain when no data is available."
9796                         ;;
9797                 esac
9798                 status=`$cat try.err`
9799                 case "$status" in
9800                 0) echo "And it correctly returns 0 to signal EOF.";;
9801                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9802                 *) echo "However, your read() returns '$status' on EOF??";;
9803                 esac
9804                 val="$define"
9805                 if test "$status" = "$rd_nodata"; then
9806                         echo "WARNING: you can't distinguish between EOF and no data!"
9807                         val="$undef"
9808                 fi
9809         else
9810                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9811                 eagain=EAGAIN
9812         fi
9813         set d_eofnblk
9814         eval $setvar
9815         ;;
9816 *)
9817         echo "Using $hint value $eagain."
9818         echo "Your read() returns $rd_nodata when no data is present."
9819         case "$d_eofnblk" in
9820         "$define") echo "And you can see EOF because read() returns 0.";;
9821         "$undef") echo "But you can't see EOF status from read() returned value.";;
9822         *)
9823                 echo "(Assuming you can't see EOF status from read anyway.)"
9824                 d_eofnblk=$undef
9825                 ;;
9826         esac
9827         ;;
9828 esac
9829 $rm -f try try.* .out core head.c mtry
9830
9831 : see if fchdir exists
9832 set fchdir d_fchdir
9833 eval $inlibc
9834
9835 : see if fchmod exists
9836 set fchmod d_fchmod
9837 eval $inlibc
9838
9839 : see if fchown exists
9840 set fchown d_fchown
9841 eval $inlibc
9842
9843 : see if this is an fcntl system
9844 set fcntl d_fcntl
9845 eval $inlibc
9846
9847 echo " "
9848 : See if fcntl-based locking works.
9849 $cat >try.c <<'EOCP'
9850 #include <stdlib.h>
9851 #include <unistd.h>
9852 #include <fcntl.h>
9853 int main() {
9854 #if defined(F_SETLK) && defined(F_SETLKW)
9855      struct flock flock;
9856      int retval, fd;
9857      fd = open("try.c", O_RDONLY);
9858      flock.l_type = F_RDLCK;
9859      flock.l_whence = SEEK_SET;
9860      flock.l_start = flock.l_len = 0;
9861      retval = fcntl(fd, F_SETLK, &flock);
9862      close(fd);
9863      (retval < 0 ? exit(2) : exit(0));
9864 #else
9865      exit(2);
9866 #endif
9867 }
9868 EOCP
9869 echo "Checking if fcntl-based file locking works... "
9870 case "$d_fcntl" in
9871 "$define")
9872         set try
9873         if eval $compile_ok; then
9874                 if $run ./try; then
9875                         echo "Yes, it seems to work."
9876                         val="$define"
9877                 else
9878                         echo "Nope, it didn't work."
9879                         val="$undef"
9880                 fi
9881         else
9882                 echo "I'm unable to compile the test program, so I'll assume not."
9883                 val="$undef"
9884         fi
9885         ;;
9886 *) val="$undef";
9887         echo "Nope, since you don't even have fcntl()."
9888         ;;
9889 esac
9890 set d_fcntl_can_lock
9891 eval $setvar
9892 $rm -f try*
9893
9894
9895 : see if sys/select.h has to be included
9896 set sys/select.h i_sysselct
9897 eval $inhdr
9898
9899 : see if we should include time.h, sys/time.h, or both
9900 echo " "
9901 if test "X$timeincl" = X; then
9902         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9903         $echo $n "I'm now running the test program...$c"
9904         $cat >try.c <<'EOCP'
9905 #include <sys/types.h>
9906 #ifdef I_TIME
9907 #include <time.h>
9908 #endif
9909 #ifdef I_SYSTIME
9910 #ifdef SYSTIMEKERNEL
9911 #define KERNEL
9912 #endif
9913 #include <sys/time.h>
9914 #endif
9915 #ifdef I_SYSSELECT
9916 #include <sys/select.h>
9917 #endif
9918 int main()
9919 {
9920         struct tm foo;
9921 #ifdef S_TIMEVAL
9922         struct timeval bar;
9923 #endif
9924 #ifdef S_TIMEZONE
9925         struct timezone tzp;
9926 #endif
9927         if (foo.tm_sec == foo.tm_sec)
9928                 exit(0);
9929 #ifdef S_TIMEVAL
9930         if (bar.tv_sec == bar.tv_sec)
9931                 exit(0);
9932 #endif
9933         exit(1);
9934 }
9935 EOCP
9936         flags=''
9937         for s_timezone in '-DS_TIMEZONE' ''; do
9938         sysselect=''
9939         for s_timeval in '-DS_TIMEVAL' ''; do
9940         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9941         for i_time in '' '-DI_TIME'; do
9942         for i_systime in '-DI_SYSTIME' ''; do
9943                 case "$flags" in
9944                 '') $echo $n ".$c"
9945                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9946                         if eval $compile; then
9947                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9948                                 shift
9949                                 flags="$*"
9950                                 echo " "
9951                                 $echo $n "Succeeded with $flags$c"
9952                         fi
9953                         ;;
9954                 esac
9955         done
9956         done
9957         done
9958         done
9959         done
9960         timeincl=''
9961         echo " "
9962         case "$flags" in
9963         *SYSTIMEKERNEL*) i_systimek="$define"
9964                 timeincl=`./findhdr sys/time.h`
9965                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9966         *) i_systimek="$undef";;
9967         esac
9968         case "$flags" in
9969         *I_TIME*) i_time="$define"
9970                 timeincl=`./findhdr time.h`" $timeincl"
9971                 echo "We'll include <time.h>." >&4;;
9972         *) i_time="$undef";;
9973         esac
9974         case "$flags" in
9975         *I_SYSTIME*) i_systime="$define"
9976                 timeincl=`./findhdr sys/time.h`" $timeincl"
9977                 echo "We'll include <sys/time.h>." >&4;;
9978         *) i_systime="$undef";;
9979         esac
9980         $rm -f try.c try
9981 fi
9982
9983 : check for fd_set items
9984 $cat <<EOM
9985
9986 Checking to see how well your C compiler handles fd_set and friends ...
9987 EOM
9988 $cat >try.c <<EOCP
9989 #$i_systime I_SYS_TIME
9990 #$i_sysselct I_SYS_SELECT
9991 #$d_socket HAS_SOCKET
9992 #include <sys/types.h>
9993 #ifdef HAS_SOCKET
9994 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9995 #endif
9996 #ifdef I_SYS_TIME
9997 #include <sys/time.h>
9998 #endif
9999 #ifdef I_SYS_SELECT
10000 #include <sys/select.h>
10001 #endif
10002 int main() {
10003         fd_set fds;
10004
10005 #ifdef TRYBITS
10006         if(fds.fds_bits);
10007 #endif
10008
10009 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
10010         exit(0);
10011 #else
10012         exit(1);
10013 #endif
10014 }
10015 EOCP
10016 set try -DTRYBITS
10017 if eval $compile; then
10018         d_fds_bits="$define"
10019         d_fd_set="$define"
10020         echo "Well, your system knows about the normal fd_set typedef..." >&4
10021         if $run ./try; then
10022                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
10023                 d_fd_macros="$define"
10024         else
10025                 $cat >&4 <<'EOM'
10026 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
10027 EOM
10028                 d_fd_macros="$undef"
10029         fi
10030 else
10031         $cat <<'EOM'
10032 Hmm, your compiler has some difficulty with fd_set.  Checking further...
10033 EOM
10034         set try
10035         if eval $compile; then
10036                 d_fds_bits="$undef"
10037                 d_fd_set="$define"
10038                 echo "Well, your system has some sort of fd_set available..." >&4
10039                 if $run ./try; then
10040                         echo "and you have the normal fd_set macros." >&4
10041                         d_fd_macros="$define"
10042                 else
10043                         $cat <<'EOM'
10044 but not the normal fd_set macros!  Gross!  More work for me...
10045 EOM
10046                         d_fd_macros="$undef"
10047                 fi
10048         else
10049         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
10050                 d_fd_set="$undef"
10051                 d_fds_bits="$undef"
10052                 d_fd_macros="$undef"
10053         fi
10054 fi
10055 $rm -f try try.*
10056
10057 : see if fgetpos exists
10058 set fgetpos d_fgetpos
10059 eval $inlibc
10060
10061 : see if flock exists
10062 set flock d_flock
10063 eval $inlibc
10064
10065 : see if this is a sys/file.h system
10066 val=''
10067 set sys/file.h val
10068 eval $inhdr
10069
10070 : do we need to include sys/file.h ?
10071 case "$val" in
10072 "$define")
10073         echo " "
10074         if $h_sysfile; then
10075                 val="$define"
10076                 echo "We'll be including <sys/file.h>." >&4
10077         else
10078                 val="$undef"
10079                 echo "We won't be including <sys/file.h>." >&4
10080         fi
10081         ;;
10082 *)
10083         h_sysfile=false
10084         ;;
10085 esac
10086 set i_sysfile
10087 eval $setvar
10088
10089 : see if prototype for flock is available
10090 echo " "
10091 set d_flockproto flock $i_sysfile sys/file.h
10092 eval $hasproto
10093
10094 : see if fork exists
10095 set fork d_fork
10096 eval $inlibc
10097
10098 : see if pathconf exists
10099 set pathconf d_pathconf
10100 eval $inlibc
10101
10102 : see if fpathconf exists
10103 set fpathconf d_fpathconf
10104 eval $inlibc
10105
10106
10107 : check for fpos64_t
10108 echo " "
10109 echo "Checking to see if you have fpos64_t..." >&4
10110 $cat >try.c <<EOCP
10111 #include <stdio.h>
10112 int main() { fpos64_t x = 7; }
10113 EOCP
10114 set try
10115 if eval $compile; then
10116         val="$define"
10117         echo "You have fpos64_t."
10118 else
10119         val="$undef"
10120         echo "You do not have fpos64_t."
10121         case "$fpossize" in
10122         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
10123         esac
10124 fi
10125 $rm -f try.* try
10126 set d_fpos64_t
10127 eval $setvar
10128
10129 : see if frexpl exists
10130 set frexpl d_frexpl
10131 eval $inlibc
10132
10133 : see if this is a sys/param system
10134 set sys/param.h i_sysparam
10135 eval $inhdr
10136
10137 : see if this is a sys/mount.h system
10138 set sys/mount.h i_sysmount
10139 eval $inhdr
10140
10141
10142 echo " "
10143 echo "Checking to see if your system supports struct fs_data..." >&4
10144 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
10145 eval $hasstruct
10146 case "$d_fs_data_s" in
10147 "$define")      echo "Yes, it does."   ;;
10148 *)              echo "No, it doesn't." ;;
10149 esac
10150
10151 : see if fseeko exists
10152 set fseeko d_fseeko
10153 eval $inlibc
10154 case "$longsize" in
10155 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
10156 esac
10157
10158 : see if fsetpos exists
10159 set fsetpos d_fsetpos
10160 eval $inlibc
10161
10162
10163 : see if fstatfs exists
10164 set fstatfs d_fstatfs
10165 eval $inlibc
10166
10167
10168 : see if statvfs exists
10169 set statvfs d_statvfs
10170 eval $inlibc
10171
10172 : see if fstatvfs exists
10173 set fstatvfs d_fstatvfs
10174 eval $inlibc
10175
10176
10177 : see if fsync exists
10178 set fsync d_fsync
10179 eval $inlibc
10180
10181 : see if ftello exists
10182 set ftello d_ftello
10183 eval $inlibc
10184 case "$longsize" in
10185 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
10186 esac
10187
10188 : see if getcwd exists
10189 set getcwd d_getcwd
10190 eval $inlibc
10191
10192 : see if getespwnam exists
10193 set getespwnam d_getespwnam
10194 eval $inlibc
10195
10196
10197 : see if getfsstat exists
10198 set getfsstat d_getfsstat
10199 eval $inlibc
10200
10201 : see if getgrent exists
10202 set getgrent d_getgrent
10203 eval $inlibc
10204
10205 : see if gethostbyaddr exists
10206 set gethostbyaddr d_gethbyaddr
10207 eval $inlibc
10208
10209 : see if gethostbyname exists
10210 set gethostbyname d_gethbyname
10211 eval $inlibc
10212
10213 : see if gethostent exists
10214 set gethostent d_gethent
10215 eval $inlibc
10216
10217 : see how we will look up host name
10218 echo " "
10219 call=''
10220 if set gethostname val -f d_gethname; eval $csym; $val; then
10221         echo 'gethostname() found.' >&4
10222         d_gethname="$define"
10223         call=gethostname
10224 fi
10225 if set uname val -f d_uname; eval $csym; $val; then
10226         if ./xenix; then
10227                 $cat <<'EOM'
10228 uname() was found, but you're running xenix, and older versions of xenix
10229 have a broken uname(). If you don't really know whether your xenix is old
10230 enough to have a broken system call, use the default answer.
10231
10232 EOM
10233                 dflt=y
10234                 case "$d_uname" in
10235                 "$define") dflt=n;;
10236                 esac
10237                 rp='Is your uname() broken?'
10238                 . ./myread
10239                 case "$ans" in
10240                 n*) d_uname="$define"; call=uname;;
10241                 esac
10242         else
10243                 echo 'uname() found.' >&4
10244                 d_uname="$define"
10245                 case "$call" in
10246                 '') call=uname ;;
10247                 esac
10248         fi
10249 fi
10250 case "$d_gethname" in
10251 '') d_gethname="$undef";;
10252 esac
10253 case "$d_uname" in
10254 '') d_uname="$undef";;
10255 esac
10256 case "$d_uname$d_gethname" in
10257 *define*)
10258         dflt=n
10259         cat <<EOM
10260  
10261 Every now and then someone has a $call() that lies about the hostname
10262 but can't be fixed for political or economic reasons.  If you wish, I can
10263 pretend $call() isn't there and maybe compute hostname at run-time
10264 thanks to the '$phostname' command.
10265
10266 EOM
10267         rp="Shall I ignore $call() from now on?"
10268         . ./myread
10269         case "$ans" in
10270         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
10271         esac;;
10272 esac
10273 case "$phostname" in
10274 '') aphostname='';;
10275 *) case "$aphostname" in
10276         /*) ;;
10277         *) set X $phostname
10278                 shift
10279                 file=$1
10280                 shift
10281                 file=`./loc $file $file $pth`
10282                 aphostname=`echo $file $*`
10283                 ;;
10284         esac
10285         ;;
10286 esac
10287 case "$d_uname$d_gethname" in
10288 *define*) ;;
10289 *)
10290         case "$phostname" in
10291         '')
10292                 echo "There will be no way for $package to get your hostname." >&4;;
10293         *)
10294         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10295                 ;;
10296         esac;;
10297 esac
10298 case "$d_phostname" in
10299 '') d_phostname="$undef";;
10300 esac
10301
10302 : see if this is a netdb.h system
10303 set netdb.h i_netdb
10304 eval $inhdr
10305
10306 : see if prototypes for various gethostxxx netdb.h functions are available
10307 echo " "
10308 set d_gethostprotos gethostent $i_netdb netdb.h
10309 eval $hasproto
10310
10311 : see if getitimer exists
10312 set getitimer d_getitimer
10313 eval $inlibc
10314
10315 : see if getlogin exists
10316 set getlogin d_getlogin
10317 eval $inlibc
10318
10319 : see if getmnt exists
10320 set getmnt d_getmnt
10321 eval $inlibc
10322
10323 : see if getmntent exists
10324 set getmntent d_getmntent
10325 eval $inlibc
10326
10327 : see if getnetbyaddr exists
10328 set getnetbyaddr d_getnbyaddr
10329 eval $inlibc
10330
10331 : see if getnetbyname exists
10332 set getnetbyname d_getnbyname
10333 eval $inlibc
10334
10335 : see if getnetent exists
10336 set getnetent d_getnent
10337 eval $inlibc
10338
10339 : see if prototypes for various getnetxxx netdb.h functions are available
10340 echo " "
10341 set d_getnetprotos getnetent $i_netdb netdb.h
10342 eval $hasproto
10343
10344 : see if getpagesize exists
10345 set getpagesize d_getpagsz
10346 eval $inlibc
10347
10348
10349 : see if getprotobyname exists
10350 set getprotobyname d_getpbyname
10351 eval $inlibc
10352
10353 : see if getprotobynumber exists
10354 set getprotobynumber d_getpbynumber
10355 eval $inlibc
10356
10357 : see if getprotoent exists
10358 set getprotoent d_getpent
10359 eval $inlibc
10360
10361 : see if getpgid exists
10362 set getpgid d_getpgid
10363 eval $inlibc
10364
10365 : see if getpgrp2 exists
10366 set getpgrp2 d_getpgrp2
10367 eval $inlibc
10368
10369 : see if getppid exists
10370 set getppid d_getppid
10371 eval $inlibc
10372
10373 : see if getpriority exists
10374 set getpriority d_getprior
10375 eval $inlibc
10376
10377 : see if prototypes for various getprotoxxx netdb.h functions are available
10378 echo " "
10379 set d_getprotoprotos getprotoent $i_netdb netdb.h
10380 eval $hasproto
10381
10382 : see if getprpwnam exists
10383 set getprpwnam d_getprpwnam
10384 eval $inlibc
10385
10386 : see if getpwent exists
10387 set getpwent d_getpwent
10388 eval $inlibc
10389
10390
10391 : see if getservbyname exists
10392 set getservbyname d_getsbyname
10393 eval $inlibc
10394
10395 : see if getservbyport exists
10396 set getservbyport d_getsbyport
10397 eval $inlibc
10398
10399 : see if getservent exists
10400 set getservent d_getsent
10401 eval $inlibc
10402
10403 : see if prototypes for various getservxxx netdb.h functions are available
10404 echo " "
10405 set d_getservprotos getservent $i_netdb netdb.h
10406 eval $hasproto
10407
10408 : see if getspnam exists
10409 set getspnam d_getspnam
10410 eval $inlibc
10411
10412 : see if gettimeofday or ftime exists
10413 set gettimeofday d_gettimeod
10414 eval $inlibc
10415 case "$d_gettimeod" in
10416 "$undef")
10417         set ftime d_ftime 
10418         eval $inlibc
10419         ;;
10420 *)
10421         val="$undef"; set d_ftime; eval $setvar
10422         ;;
10423 esac
10424 case "$d_gettimeod$d_ftime" in
10425 "$undef$undef")
10426         echo " "
10427         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10428         ;;
10429 esac
10430
10431 : see if this is an grp system
10432 set grp.h i_grp
10433 eval $inhdr
10434
10435 case "$i_grp" in
10436 $define)
10437         xxx=`./findhdr grp.h`
10438         $cppstdin $cppflags $cppminus < $xxx >$$.h
10439
10440         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10441                 val="$define"
10442         else
10443                 val="$undef"
10444         fi
10445         set d_grpasswd
10446         eval $setvar
10447
10448         $rm -f $$.h
10449         ;;
10450 *)
10451         val="$undef";
10452         set d_grpasswd; eval $setvar
10453         ;;
10454 esac
10455
10456 : see if hasmntopt exists
10457 set hasmntopt d_hasmntopt
10458 eval $inlibc
10459
10460 : see if this is a netinet/in.h or sys/in.h system
10461 set netinet/in.h i_niin sys/in.h i_sysin
10462 eval $inhdr
10463
10464 : see if arpa/inet.h has to be included
10465 set arpa/inet.h i_arpainet
10466 eval $inhdr
10467
10468 : see if htonl --and friends-- exists
10469 val=''
10470 set htonl val
10471 eval $inlibc
10472
10473 : Maybe they are macros.
10474 case "$val" in
10475 $undef)
10476         $cat >htonl.c <<EOM
10477 #include <stdio.h>
10478 #include <sys/types.h>
10479 #$i_niin I_NETINET_IN
10480 #$i_sysin I_SYS_IN
10481 #$i_arpainet I_ARPA_INET
10482 #ifdef I_NETINET_IN
10483 #include <netinet/in.h>
10484 #endif
10485 #ifdef I_SYS_IN
10486 #include <sys/in.h>
10487 #endif
10488 #ifdef I_ARPA_INET
10489 #include <arpa/inet.h>
10490 #endif
10491 #ifdef htonl
10492 printf("Defined as a macro.");
10493 #endif
10494 EOM
10495         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10496         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10497                 val="$define"
10498                 echo "But it seems to be defined as a macro." >&4
10499         fi
10500         $rm -f htonl.?
10501         ;;
10502 esac
10503 set d_htonl
10504 eval $setvar
10505
10506 : see if iconv exists
10507 set iconv d_iconv
10508 eval $inlibc
10509
10510 : index or strchr
10511 echo " "
10512 if set index val -f; eval $csym; $val; then
10513         if set strchr val -f d_strchr; eval $csym; $val; then
10514                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10515                         val="$define"
10516                         vali="$undef"
10517                         echo "strchr() found." >&4
10518                 else
10519                         val="$undef"
10520                         vali="$define"
10521                         echo "index() found." >&4
10522                 fi
10523         else
10524                 val="$undef"
10525                 vali="$define"
10526                 echo "index() found." >&4
10527         fi
10528 else
10529         if set strchr val -f d_strchr; eval $csym; $val; then
10530                 val="$define"
10531                 vali="$undef"
10532                 echo "strchr() found." >&4
10533         else
10534                 echo "No index() or strchr() found!" >&4
10535                 val="$undef"
10536                 vali="$undef"
10537         fi
10538 fi
10539 set d_strchr; eval $setvar
10540 val="$vali"
10541 set d_index; eval $setvar
10542
10543 : check whether inet_aton exists
10544 set inet_aton d_inetaton
10545 eval $inlibc
10546
10547 : Look for isascii
10548 echo " "
10549 $cat >isascii.c <<'EOCP'
10550 #include <stdio.h>
10551 #include <ctype.h>
10552 int main() {
10553         int c = 'A';
10554         if (isascii(c))
10555                 exit(0);
10556         else
10557                 exit(1);
10558 }
10559 EOCP
10560 set isascii
10561 if eval $compile; then
10562         echo "isascii() found." >&4
10563         val="$define"
10564 else
10565         echo "isascii() NOT found." >&4
10566         val="$undef"
10567 fi
10568 set d_isascii
10569 eval $setvar
10570 $rm -f isascii*
10571
10572 : see if isnan exists
10573 set isnan d_isnan
10574 eval $inlibc
10575
10576 : see if isnanl exists
10577 set isnanl d_isnanl
10578 eval $inlibc
10579
10580 : see if killpg exists
10581 set killpg d_killpg
10582 eval $inlibc
10583
10584 : see if lchown exists
10585 echo " "
10586 $cat > try.c <<'EOCP'
10587 /* System header to define __stub macros and hopefully few prototypes,
10588     which can conflict with char lchown(); below.  */
10589 #include <assert.h>
10590 /* Override any gcc2 internal prototype to avoid an error.  */
10591 /* We use char because int might match the return type of a gcc2
10592    builtin and then its argument prototype would still apply.  */
10593 char lchown();
10594 int main() {
10595     /*  The GNU C library defines this for functions which it implements
10596         to always fail with ENOSYS.  Some functions are actually named
10597         something starting with __ and the normal name is an alias.  */
10598 #if defined (__stub_lchown) || defined (__stub___lchown)
10599 choke me
10600 #else
10601 lchown();
10602 #endif
10603 ; return 0; }
10604 EOCP
10605 set try
10606 if eval $compile; then
10607     $echo "lchown() found." >&4
10608     val="$define"
10609 else
10610     $echo "lchown() NOT found." >&4
10611     val="$undef"
10612 fi
10613 set d_lchown
10614 eval $setvar
10615
10616 : See if number of significant digits in a double precision number is known
10617 echo " "
10618 $cat >ldbl_dig.c <<EOM
10619 #$i_limits I_LIMITS
10620 #$i_float I_FLOAT
10621 #ifdef I_LIMITS
10622 #include <limits.h>
10623 #endif
10624 #ifdef I_FLOAT
10625 #include <float.h>
10626 #endif
10627 #ifdef LDBL_DIG
10628 printf("Contains LDBL_DIG");
10629 #endif
10630 EOM
10631 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10632 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10633         echo "LDBL_DIG found." >&4
10634         val="$define"
10635 else
10636         echo "LDBL_DIG NOT found." >&4
10637         val="$undef"
10638 fi
10639 $rm -f ldbl_dig.?
10640 set d_ldbl_dig
10641 eval $setvar
10642
10643 : see if link exists
10644 set link d_link
10645 eval $inlibc
10646
10647 : see if localeconv exists
10648 set localeconv d_locconv
10649 eval $inlibc
10650
10651 : see if lockf exists
10652 set lockf d_lockf
10653 eval $inlibc
10654
10655 : see if prototype for lseek is available
10656 echo " "
10657 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10658 eval $hasproto
10659
10660 : see if lstat exists
10661 set lstat d_lstat
10662 eval $inlibc
10663
10664 : see if madvise exists
10665 set madvise d_madvise
10666 eval $inlibc
10667
10668 : see if mblen exists
10669 set mblen d_mblen
10670 eval $inlibc
10671
10672 : see if mbstowcs exists
10673 set mbstowcs d_mbstowcs
10674 eval $inlibc
10675
10676 : see if mbtowc exists
10677 set mbtowc d_mbtowc
10678 eval $inlibc
10679
10680 : see if memchr exists
10681 set memchr d_memchr
10682 eval $inlibc
10683
10684 : see if memcmp exists
10685 set memcmp d_memcmp
10686 eval $inlibc
10687
10688 : see if memcpy exists
10689 set memcpy d_memcpy
10690 eval $inlibc
10691
10692 : see if memmove exists
10693 set memmove d_memmove
10694 eval $inlibc
10695
10696 : see if memset exists
10697 set memset d_memset
10698 eval $inlibc
10699
10700 : see if mkdir exists
10701 set mkdir d_mkdir
10702 eval $inlibc
10703
10704 : see if mkdtemp exists
10705 set mkdtemp d_mkdtemp
10706 eval $inlibc
10707
10708 : see if mkfifo exists
10709 set mkfifo d_mkfifo
10710 eval $inlibc
10711
10712 : see if mkstemp exists
10713 set mkstemp d_mkstemp
10714 eval $inlibc
10715
10716 : see if mkstemps exists
10717 set mkstemps d_mkstemps
10718 eval $inlibc
10719
10720 : see if mktime exists
10721 set mktime d_mktime
10722 eval $inlibc
10723
10724 : see if this is a sys/mman.h system
10725 set sys/mman.h i_sysmman
10726 eval $inhdr
10727
10728 : see if mmap exists
10729 set mmap d_mmap
10730 eval $inlibc
10731 : see what shmat returns
10732 : default to something harmless
10733 mmaptype='void *'
10734 case "$i_sysmman$d_mmap" in
10735 "$define$define")
10736         $cat >mmap.c <<'END'
10737 #include <sys/mman.h>
10738 void *mmap();
10739 END
10740         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10741                 mmaptype='void *'
10742         else
10743                 mmaptype='caddr_t'
10744         fi
10745         echo "and it returns ($mmaptype)." >&4
10746         ;;
10747 esac
10748
10749
10750
10751 : see if modfl exists
10752 set modfl d_modfl
10753 eval $inlibc
10754
10755 d_modfl_pow32_bug="$undef"
10756
10757 case "$d_longdbl$d_modfl" in
10758 $define$define)
10759         $cat <<EOM
10760 Checking to see whether your modfl() is okay for large values...
10761 EOM
10762 $cat >try.c <<EOCP
10763 #include <math.h> 
10764 #include <stdio.h>
10765 int main() {
10766     long double nv = 4294967303.15;
10767     long double v, w;
10768     v = modfl(nv, &w);         
10769 #ifdef __GLIBC__
10770     printf("glibc");
10771 #endif
10772     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10773     return 0;
10774 }
10775 EOCP
10776         case "$osname:$gccversion" in
10777         aix:)   saveccflags="$ccflags"
10778                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10779         esac
10780         set try
10781         if eval $compile; then
10782                 foo=`$run ./try`
10783                 case "$foo" in
10784                 *" 4294967303.150000 1.150000 4294967302.000000")
10785                         echo >&4 "Your modfl() is broken for large values."
10786                         d_modfl_pow32_bug="$define"
10787                         case "$foo" in
10788                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
10789                         ;;
10790                         esac
10791                         ;;
10792                 *" 4294967303.150000 0.150000 4294967303.000000")
10793                         echo >&4 "Your modfl() seems okay for large values."
10794                         ;;
10795                 *)      echo >&4 "I don't understand your modfl() at all."
10796                         d_modfl="$undef"
10797                         ;;
10798                 esac
10799                 $rm -f try.* try core core.try.*
10800         else
10801                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
10802                 d_modfl="$undef"
10803         fi
10804         case "$osname:$gccversion" in
10805         aix:)   $ccflags="$saveccflags" ;; # restore
10806         esac
10807         ;;
10808 esac
10809
10810 : see if mprotect exists
10811 set mprotect d_mprotect
10812 eval $inlibc
10813
10814 : see if msgctl exists
10815 set msgctl d_msgctl
10816 eval $inlibc
10817
10818 : see if msgget exists
10819 set msgget d_msgget
10820 eval $inlibc
10821
10822 : see if msgsnd exists
10823 set msgsnd d_msgsnd
10824 eval $inlibc
10825
10826 : see if msgrcv exists
10827 set msgrcv d_msgrcv
10828 eval $inlibc
10829
10830 : see how much of the 'msg*(2)' library is present.
10831 h_msg=true
10832 echo " "
10833 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10834 *"$undef"*) h_msg=false;;
10835 esac
10836 case "$osname" in
10837 freebsd)
10838     case "`ipcs 2>&1`" in
10839     "SVID messages"*"not configured"*)
10840         echo "Your $osname does not have the msg*(2) configured." >&4
10841         h_msg=false
10842         val="$undef"
10843         set msgctl d_msgctl
10844         eval $setvar
10845         set msgget d_msgget
10846         eval $setvar
10847         set msgsnd d_msgsnd
10848         eval $setvar
10849         set msgrcv d_msgrcv
10850         eval $setvar
10851         ;;
10852     esac
10853     ;;
10854 esac
10855 : we could also check for sys/ipc.h ...
10856 if $h_msg && $test `./findhdr sys/msg.h`; then
10857         echo "You have the full msg*(2) library." >&4
10858         val="$define"
10859 else
10860         echo "You don't have the full msg*(2) library." >&4
10861         val="$undef"
10862 fi
10863 set d_msg
10864 eval $setvar
10865
10866
10867 echo " "
10868 echo "Checking to see if your system supports struct msghdr..." >&4
10869 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10870 eval $hasstruct
10871 case "$d_msghdr_s" in
10872 "$define")      echo "Yes, it does."   ;;
10873 *)              echo "No, it doesn't." ;;
10874 esac
10875
10876
10877 : see if msync exists
10878 set msync d_msync
10879 eval $inlibc
10880
10881 : see if munmap exists
10882 set munmap d_munmap
10883 eval $inlibc
10884
10885 : see if nice exists
10886 set nice d_nice
10887 eval $inlibc
10888
10889 : check for length of character
10890 echo " "
10891 case "$charsize" in
10892 '')
10893         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10894         $cat >try.c <<'EOCP'
10895 #include <stdio.h>
10896 int main()
10897 {
10898     printf("%d\n", (int)sizeof(char));
10899     exit(0);
10900 }
10901 EOCP
10902         set try
10903         if eval $compile_ok; then
10904                 dflt=`$run ./try`
10905         else
10906                 dflt='1'
10907                 echo "(I can't seem to compile the test program.  Guessing...)"
10908         fi
10909         ;;
10910 *)
10911         dflt="$charsize"
10912         ;;
10913 esac
10914 rp="What is the size of a character (in bytes)?"
10915 . ./myread
10916 charsize="$ans"
10917 $rm -f try.c try
10918
10919 : check for volatile keyword
10920 echo " "
10921 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10922 $cat >try.c <<'EOCP'
10923 int main()
10924 {
10925         typedef struct _goo_struct goo_struct;
10926         goo_struct * volatile goo = ((goo_struct *)0);
10927         struct _goo_struct {
10928                 long long_int;
10929                 int reg_int;
10930                 char char_var;
10931         };
10932         typedef unsigned short foo_t;
10933         char *volatile foo;
10934         volatile int bar;
10935         volatile foo_t blech;
10936         foo = foo;
10937 }
10938 EOCP
10939 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10940         val="$define"
10941         echo "Yup, it does."
10942 else
10943         val="$undef"
10944         echo "Nope, it doesn't."
10945 fi
10946 set d_volatile
10947 eval $setvar
10948 $rm -f try.*
10949
10950
10951 echo " "
10952 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10953
10954 case "$use64bitint:$d_quad:$quadtype" in
10955 define:define:?*)
10956         ivtype="$quadtype"
10957         uvtype="$uquadtype"
10958         ivsize=8
10959         uvsize=8
10960         ;;
10961 *)      ivtype="long"
10962         uvtype="unsigned long"
10963         ivsize=$longsize
10964         uvsize=$longsize
10965         ;;
10966 esac
10967
10968 case "$uselongdouble:$d_longdbl" in
10969 define:define)
10970         nvtype="long double"
10971         nvsize=$longdblsize
10972         ;;
10973 *)      nvtype=double
10974         nvsize=$doublesize
10975         ;;
10976 esac
10977
10978 $echo "(IV will be "$ivtype", $ivsize bytes)"
10979 $echo "(UV will be "$uvtype", $uvsize bytes)"
10980 $echo "(NV will be "$nvtype", $nvsize bytes)"
10981
10982 $cat >try.c <<EOCP
10983 #$i_inttypes I_INTTYPES
10984 #ifdef I_INTTYPES
10985 #include <inttypes.h>
10986 #endif
10987 #include <stdio.h>
10988 int main() {
10989 #ifdef INT8
10990    int8_t i =  INT8_MAX;
10991   uint8_t u = UINT8_MAX;
10992   printf("int8_t\n");
10993 #endif
10994 #ifdef INT16
10995    int16_t i =  INT16_MAX;
10996   uint16_t i = UINT16_MAX;
10997   printf("int16_t\n");
10998 #endif
10999 #ifdef INT32
11000    int32_t i =  INT32_MAX;
11001   uint32_t u = UINT32_MAX;
11002   printf("int32_t\n");
11003 #endif
11004 }
11005 EOCP
11006
11007 case "$i8type" in
11008 '')     case "$charsize" in
11009         1)      i8type=char
11010                 u8type="unsigned char"
11011                 i8size=$charsize
11012                 u8size=$charsize
11013                 ;;
11014         esac
11015         ;;
11016 esac
11017 case "$i8type" in
11018 '')     set try -DINT8
11019         if eval $compile; then
11020                 case "`$run ./try`" in
11021                 int8_t) i8type=int8_t
11022                         u8type=uint8_t
11023                         i8size=1
11024                         u8size=1
11025                         ;;
11026                 esac
11027         fi
11028         ;;
11029 esac
11030 case "$i8type" in
11031 '')     if $test $charsize -ge 1; then
11032                 i8type=char
11033                 u8type="unsigned char"
11034                 i8size=$charsize
11035                 u8size=$charsize
11036         fi
11037         ;;
11038 esac
11039
11040 case "$i16type" in
11041 '')     case "$shortsize" in
11042         2)      i16type=short
11043                 u16type="unsigned short"
11044                 i16size=$shortsize
11045                 u16size=$shortsize
11046                 ;;
11047         esac
11048         ;;
11049 esac
11050 case "$i16type" in
11051 '')     set try -DINT16
11052         if eval $compile; then
11053                 case "`$run ./try`" in
11054                 int16_t)
11055                         i16type=int16_t
11056                         u16type=uint16_t
11057                         i16size=2
11058                         u16size=2
11059                         ;;
11060                 esac
11061         fi
11062         ;;
11063 esac
11064 case "$i16type" in
11065 '')     if $test $shortsize -ge 2; then
11066                 i16type=short
11067                 u16type="unsigned short"
11068                 i16size=$shortsize
11069                 u16size=$shortsize
11070         fi
11071         ;;
11072 esac
11073
11074 case "$i32type" in
11075 '')     case "$longsize" in
11076         4)      i32type=long
11077                 u32type="unsigned long"
11078                 i32size=$longsize
11079                 u32size=$longsize
11080                 ;;
11081         *)      case "$intsize" in
11082                 4)      i32type=int
11083                         u32type="unsigned int"
11084                         i32size=$intsize
11085                         u32size=$intsize
11086                         ;;
11087                 esac
11088                 ;;
11089         esac
11090         ;;
11091 esac
11092 case "$i32type" in
11093 '')     set try -DINT32
11094         if eval $compile; then
11095                 case "`$run ./try`" in
11096                 int32_t)
11097                         i32type=int32_t
11098                         u32type=uint32_t
11099                         i32size=4
11100                         u32size=4
11101                         ;;
11102                 esac
11103         fi
11104         ;;
11105 esac
11106 case "$i32type" in
11107 '')     if $test $intsize -ge 4; then
11108                 i32type=int
11109                 u32type="unsigned int"
11110                 i32size=$intsize
11111                 u32size=$intsize
11112         fi
11113         ;;
11114 esac
11115
11116 case "$i64type" in
11117 '')     case "$d_quad:$quadtype" in
11118         define:?*)
11119                 i64type="$quadtype"
11120                 u64type="$uquadtype"
11121                 i64size=8
11122                 u64size=8
11123                 ;;
11124         esac
11125         ;;
11126 esac
11127
11128 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
11129 : volatile so that the compiler has to store it out to memory.
11130 if test X"$d_volatile" = X"$define"; then
11131         volatile=volatile
11132 fi
11133 $cat <<EOP >try.c
11134 #include <stdio.h>
11135 #include <sys/types.h>
11136 #include <signal.h>
11137 #ifdef SIGFPE
11138 $volatile int bletched = 0;
11139 $signal_t blech(s) int s; { bletched = 1; }
11140 #endif
11141 int main() {
11142     $uvtype u = 0;
11143     $nvtype d;
11144     int     n = 8 * $uvsize;
11145     int     i;
11146 #ifdef SIGFPE
11147     signal(SIGFPE, blech);
11148 #endif
11149
11150     for (i = 0; i < n; i++) {
11151       u = u << 1 | ($uvtype)1;
11152       d = ($nvtype)u;
11153       if (($uvtype)d != u)
11154         break;
11155       if (d <= 0)
11156         break;
11157       d = ($nvtype)(u - 1);
11158       if (($uvtype)d != (u - 1))
11159         break;
11160 #ifdef SIGFPE
11161       if (bletched) {
11162         break;
11163 #endif
11164       } 
11165     }
11166     printf("%d\n", ((i == n) ? -n : i));
11167     exit(0);
11168 }
11169 EOP
11170 set try
11171
11172 d_nv_preserves_uv="$undef"
11173 if eval $compile; then
11174         d_nv_preserves_uv_bits="`$run ./try`"
11175 fi
11176 case "$d_nv_preserves_uv_bits" in
11177 \-[1-9]*)       
11178         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
11179         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11180         d_nv_preserves_uv="$define"
11181         ;;
11182 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11183         d_nv_preserves_uv="$undef" ;;
11184 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
11185         d_nv_preserves_uv_bits="$undef" ;;
11186 esac
11187
11188 $rm -f try.* try
11189
11190
11191 : check for off64_t
11192 echo " "
11193 echo "Checking to see if you have off64_t..." >&4
11194 $cat >try.c <<EOCP
11195 #include <sys/types.h>
11196 #include <unistd.h>
11197 int main() { off64_t x = 7; }
11198 EOCP
11199 set try
11200 if eval $compile; then
11201         val="$define"
11202         echo "You have off64_t."
11203 else
11204         val="$undef"
11205         echo "You do not have off64_t."
11206         case "$lseeksize" in
11207         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
11208         esac
11209 fi
11210 $rm -f try.* try
11211 set d_off64_t
11212 eval $setvar
11213
11214 : see if POSIX threads are available
11215 set pthread.h i_pthread
11216 eval $inhdr
11217
11218
11219
11220
11221 : how to create joinable pthreads
11222 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
11223         echo " "
11224         echo "Checking what constant to use for creating joinable pthreads..." >&4 
11225         $cat >try.c <<'EOCP'
11226 #include <pthread.h>
11227 int main() {
11228     int detachstate = JOINABLE;
11229 }
11230 EOCP
11231         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
11232         if eval $compile; then
11233                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
11234                 val="$undef" # Yes, undef.
11235                 set d_old_pthread_create_joinable
11236                 eval $setvar
11237                 val=""
11238                 set old_pthread_create_joinable
11239                 eval $setvar
11240         else
11241                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
11242                 if eval $compile; then
11243                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
11244                         val="$define"
11245                         set d_old_pthread_create_joinable
11246                         eval $setvar
11247                         val=PTHREAD_CREATE_UNDETACHED
11248                         set old_pthread_create_joinable
11249                         eval $setvar
11250                 else            
11251                         set try -DJOINABLE=__UNDETACHED
11252                         if eval $compile; then
11253                                 echo "You seem to use __UNDETACHED." >&4
11254                                 val="$define"
11255                                 set d_old_pthread_create_joinable
11256                                 eval $setvar
11257                                 val=__UNDETACHED
11258                                 set old_pthread_create_joinable
11259                                 eval $setvar
11260                         else
11261                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
11262                                 val="$define"
11263                                 set d_old_pthread_create_joinable
11264                                 eval $setvar
11265                                 val=0
11266                                 set old_pthread_create_joinable
11267                                 eval $setvar
11268                         fi
11269                 fi
11270         fi
11271         $rm -f try try.*
11272 else
11273     d_old_pthread_create_joinable="$undef"
11274     old_pthread_create_joinable=""
11275 fi
11276
11277 : see if pause exists
11278 set pause d_pause
11279 eval $inlibc
11280
11281 : see if pipe exists
11282 set pipe d_pipe
11283 eval $inlibc
11284
11285 : see if poll exists
11286 set poll d_poll
11287 eval $inlibc
11288
11289
11290 : see whether the various POSIXish _yields exist
11291 $cat >try.c <<EOP
11292 #include <pthread.h>
11293 #include <stdio.h>
11294 int main() {
11295 #ifdef SCHED_YIELD
11296         sched_yield();
11297 #else
11298 #ifdef PTHREAD_YIELD
11299         pthread_yield();
11300 #else
11301 #ifdef PTHREAD_YIELD_NULL
11302         pthread_yield(NULL);
11303 #endif
11304 #endif
11305 #endif
11306 }
11307 EOP
11308 : see if sched_yield exists
11309 set try -DSCHED_YIELD
11310 if eval $compile; then
11311     val="$define"
11312     sched_yield='sched_yield()'
11313 else
11314     val="$undef"
11315 fi
11316 case "$usethreads" in
11317 $define)
11318         case "$val" in
11319         $define) echo 'sched_yield() found.' >&4        ;;
11320         *)       echo 'sched_yield() NOT found.' >&4    ;;
11321         esac
11322 esac
11323 set d_sched_yield
11324 eval $setvar
11325
11326 : see if pthread_yield exists
11327 set try -DPTHREAD_YIELD
11328 if eval $compile; then
11329     val="$define"
11330     case "$sched_yield" in
11331     '') sched_yield='pthread_yield()' ;;
11332     esac
11333 else
11334     set try -DPTHREAD_YIELD_NULL
11335     if eval $compile; then
11336         val="$define"
11337         case "$sched_yield" in
11338         '') sched_yield='pthread_yield(NULL)' ;;
11339         esac
11340     else
11341         val="$undef"
11342     fi
11343 fi
11344 case "$usethreads" in
11345 $define)
11346         case "$val" in
11347         $define) echo 'pthread_yield() found.' >&4      ;;
11348         *)       echo 'pthread_yield() NOT found.' >&4  ;;
11349         esac
11350         ;;
11351 esac
11352 set d_pthread_yield
11353 eval $setvar
11354
11355 case "$sched_yield" in
11356 '') sched_yield=undef ;;
11357 esac
11358
11359 $rm -f try try.*
11360
11361 : see if this is a pwd.h system
11362 set pwd.h i_pwd
11363 eval $inhdr
11364
11365 case "$i_pwd" in
11366 $define)
11367         xxx=`./findhdr pwd.h`
11368         $cppstdin $cppflags $cppminus < $xxx >$$.h
11369
11370         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11371                 val="$define"
11372         else
11373                 val="$undef"
11374         fi
11375         set d_pwquota
11376         eval $setvar
11377
11378         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11379                 val="$define"
11380         else
11381                 val="$undef"
11382         fi
11383         set d_pwage
11384         eval $setvar
11385
11386         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11387                 val="$define"
11388         else
11389                 val="$undef"
11390         fi
11391         set d_pwchange
11392         eval $setvar
11393
11394         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11395                 val="$define"
11396         else
11397                 val="$undef"
11398         fi
11399         set d_pwclass
11400         eval $setvar
11401
11402         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11403                 val="$define"
11404         else
11405                 val="$undef"
11406         fi
11407         set d_pwexpire
11408         eval $setvar
11409
11410         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11411                 val="$define"
11412         else
11413                 val="$undef"
11414         fi
11415         set d_pwcomment
11416         eval $setvar
11417
11418         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11419                 val="$define"
11420         else
11421                 val="$undef"
11422         fi
11423         set d_pwgecos
11424         eval $setvar
11425
11426         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11427                 val="$define"
11428         else
11429                 val="$undef"
11430         fi
11431         set d_pwpasswd
11432         eval $setvar
11433
11434         $rm -f $$.h
11435         ;;
11436 *)
11437         val="$undef"; 
11438         set d_pwquota; eval $setvar
11439         set d_pwage; eval $setvar
11440         set d_pwchange; eval $setvar
11441         set d_pwclass; eval $setvar
11442         set d_pwexpire; eval $setvar
11443         set d_pwcomment; eval $setvar
11444         set d_pwgecos; eval $setvar
11445         set d_pwpasswd; eval $setvar
11446         ;;
11447 esac
11448
11449 : see if readdir and friends exist
11450 set readdir d_readdir
11451 eval $inlibc
11452 set seekdir d_seekdir
11453 eval $inlibc
11454 set telldir d_telldir
11455 eval $inlibc
11456 set rewinddir d_rewinddir
11457 eval $inlibc
11458
11459 : see if readlink exists
11460 set readlink d_readlink
11461 eval $inlibc
11462
11463 : see if readv exists
11464 set readv d_readv
11465 eval $inlibc
11466
11467 : see if recvmsg exists
11468 set recvmsg d_recvmsg
11469 eval $inlibc
11470
11471 : see if rename exists
11472 set rename d_rename
11473 eval $inlibc
11474
11475 : see if rmdir exists
11476 set rmdir d_rmdir
11477 eval $inlibc
11478
11479 : see if memory.h is available.
11480 val=''
11481 set memory.h val
11482 eval $inhdr
11483
11484 : See if it conflicts with string.h
11485 case "$val" in
11486 $define)
11487         case "$strings" in
11488         '') ;;
11489         *)
11490                 $cppstdin $cppflags $cppminus < $strings > mem.h
11491                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11492                         echo " "
11493                         echo "We won't be including <memory.h>."
11494                         val="$undef"
11495                 fi
11496                 $rm -f mem.h
11497                 ;;
11498         esac
11499 esac
11500 set i_memory
11501 eval $setvar
11502
11503 : can bcopy handle overlapping blocks?
11504 echo " "
11505 val="$undef"
11506 case "$d_memmove" in
11507 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
11508 *)      case "$d_bcopy" in
11509         "$define")
11510                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
11511                 $cat >try.c <<EOCP
11512 #$i_memory I_MEMORY
11513 #$i_stdlib I_STDLIB
11514 #$i_string I_STRING
11515 #$i_unistd I_UNISTD
11516 EOCP
11517         $cat >>try.c <<'EOCP'
11518 #include <stdio.h>
11519 #ifdef I_MEMORY
11520 #  include <memory.h>
11521 #endif
11522 #ifdef I_STDLIB
11523 #  include <stdlib.h>
11524 #endif
11525 #ifdef I_STRING
11526 #  include <string.h>
11527 #else
11528 #  include <strings.h>
11529 #endif
11530 #ifdef I_UNISTD
11531 #  include <unistd.h>  /* Needed for NetBSD */
11532 #endif
11533 int main()
11534 {
11535 char buf[128], abc[128];
11536 char *b;
11537 int len;
11538 int off;
11539 int align;
11540
11541 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11542    try to store the string in read-only memory. */
11543 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11544
11545 for (align = 7; align >= 0; align--) {
11546         for (len = 36; len; len--) {
11547                 b = buf+align;
11548                 bcopy(abc, b, len);
11549                 for (off = 1; off <= len; off++) {
11550                         bcopy(b, b+off, len);
11551                         bcopy(b+off, b, len);
11552                         if (bcmp(b, abc, len))
11553                                 exit(1);
11554                 }
11555         }
11556 }
11557 exit(0);
11558 }
11559 EOCP
11560                 set try
11561                 if eval $compile_ok; then
11562                         if ./try 2>/dev/null; then
11563                                 echo "Yes, it can."
11564                                 val="$define"
11565                         else
11566                                 echo "It can't, sorry."
11567                         fi
11568                 else
11569                         echo "(I can't compile the test program, so we'll assume not...)"
11570                 fi
11571                 ;;
11572         esac
11573         $rm -f try.* try core
11574         ;;
11575 esac
11576 set d_safebcpy
11577 eval $setvar
11578
11579 : can memcpy handle overlapping blocks?
11580 echo " "
11581 val="$undef"
11582 case "$d_memmove" in
11583 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
11584 *)      case "$d_memcpy" in
11585         "$define")
11586                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
11587                 $cat >try.c <<EOCP
11588 #$i_memory I_MEMORY
11589 #$i_stdlib I_STDLIB
11590 #$i_string I_STRING
11591 #$i_unistd I_UNISTD
11592 EOCP
11593         $cat >>try.c <<'EOCP'
11594 #include <stdio.h>
11595 #ifdef I_MEMORY
11596 #  include <memory.h>
11597 #endif
11598 #ifdef I_STDLIB
11599 #  include <stdlib.h>
11600 #endif
11601 #ifdef I_STRING
11602 #  include <string.h>
11603 #else
11604 #  include <strings.h>
11605 #endif
11606 #ifdef I_UNISTD
11607 #  include <unistd.h>  /* Needed for NetBSD */
11608 #endif
11609 int main()
11610 {
11611 char buf[128], abc[128];
11612 char *b;
11613 int len;
11614 int off;
11615 int align;
11616
11617 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11618    try to store the string in read-only memory. */
11619 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11620
11621 for (align = 7; align >= 0; align--) {
11622         for (len = 36; len; len--) {
11623                 b = buf+align;
11624                 memcpy(b, abc, len);
11625                 for (off = 1; off <= len; off++) {
11626                         memcpy(b+off, b, len);
11627                         memcpy(b, b+off, len);
11628                         if (memcmp(b, abc, len))
11629                                 exit(1);
11630                 }
11631         }
11632 }
11633 exit(0);
11634 }
11635 EOCP
11636                 set try
11637                 if eval $compile_ok; then
11638                         if ./try 2>/dev/null; then
11639                                 echo "Yes, it can."
11640                                 val="$define"
11641                         else
11642                                 echo "It can't, sorry."
11643                         fi
11644                 else
11645                         echo "(I can't compile the test program, so we'll assume not...)"
11646                 fi
11647                 ;;
11648         esac
11649         $rm -f try.* try core
11650         ;;
11651 esac
11652 set d_safemcpy
11653 eval $setvar
11654
11655 : can memcmp be trusted to compare relative magnitude?
11656 val="$undef"
11657 case "$d_memcmp" in
11658 "$define")
11659         echo " "
11660         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11661         $cat >try.c <<EOCP
11662 #$i_memory I_MEMORY
11663 #$i_stdlib I_STDLIB
11664 #$i_string I_STRING
11665 #$i_unistd I_UNISTD
11666 EOCP
11667         $cat >>try.c <<'EOCP'
11668 #include <stdio.h>
11669 #ifdef I_MEMORY
11670 #  include <memory.h>
11671 #endif
11672 #ifdef I_STDLIB
11673 #  include <stdlib.h>
11674 #endif
11675 #ifdef I_STRING
11676 #  include <string.h>
11677 #else
11678 #  include <strings.h>
11679 #endif
11680 #ifdef I_UNISTD
11681 #  include <unistd.h>  /* Needed for NetBSD */
11682 #endif
11683 int main()
11684 {
11685 char a = -1;
11686 char b = 0;
11687 if ((a < b) && memcmp(&a, &b, 1) < 0)
11688         exit(1);
11689 exit(0);
11690 }
11691 EOCP
11692         set try
11693         if eval $compile_ok; then
11694                 if $run ./try 2>/dev/null; then
11695                         echo "Yes, it can."
11696                         val="$define"
11697                 else
11698                         echo "No, it can't (it uses signed chars)."
11699                 fi
11700         else
11701                 echo "(I can't compile the test program, so we'll assume not...)"
11702         fi
11703         ;;
11704 esac
11705 $rm -f try.* try core
11706 set d_sanemcmp
11707 eval $setvar
11708
11709 : see if prototype for sbrk is available
11710 echo " "
11711 set d_sbrkproto sbrk $i_unistd unistd.h
11712 eval $hasproto
11713
11714 : see if select exists
11715 set select d_select
11716 eval $inlibc
11717
11718 : see if semctl exists
11719 set semctl d_semctl
11720 eval $inlibc
11721
11722 : see if semget exists
11723 set semget d_semget
11724 eval $inlibc
11725
11726 : see if semop exists
11727 set semop d_semop
11728 eval $inlibc
11729
11730 : see how much of the 'sem*(2)' library is present.
11731 h_sem=true
11732 echo " "
11733 case "$d_semctl$d_semget$d_semop" in
11734 *"$undef"*) h_sem=false;;
11735 esac
11736 case "$osname" in
11737 freebsd)
11738     case "`ipcs 2>&1`" in
11739     "SVID messages"*"not configured"*)
11740         echo "Your $osname does not have the sem*(2) configured." >&4
11741         h_sem=false
11742         val="$undef"
11743         set semctl d_semctl
11744         eval $setvar
11745         set semget d_semget
11746         eval $setvar
11747         set semop d_semop
11748         eval $setvar
11749         ;;
11750     esac
11751     ;;
11752 esac
11753 : we could also check for sys/ipc.h ...
11754 if $h_sem && $test `./findhdr sys/sem.h`; then
11755         echo "You have the full sem*(2) library." >&4
11756         val="$define"
11757 else
11758         echo "You don't have the full sem*(2) library." >&4
11759         val="$undef"
11760 fi
11761 set d_sem
11762 eval $setvar
11763
11764 : see whether sys/sem.h defines union semun
11765 echo " "
11766 $cat > try.c <<'END'
11767 #include <sys/types.h>
11768 #include <sys/ipc.h>
11769 #include <sys/sem.h>
11770 int main () { union semun semun; semun.buf = 0; }
11771 END
11772 set try
11773 if eval $compile; then
11774     echo "You have union semun in <sys/sem.h>." >&4
11775     val="$define"
11776 else
11777     echo "You do not have union semun in <sys/sem.h>." >&4
11778     val="$undef"
11779 fi
11780 $rm -f try try.c try.h
11781 set d_union_semun
11782 eval $setvar
11783
11784 : see how to do semctl IPC_STAT
11785 case "$d_sem" in
11786 $define)
11787     : see whether semctl IPC_STAT can use union semun
11788     echo " "
11789     $cat > try.h <<END
11790 #ifndef S_IRUSR
11791 #   ifdef S_IREAD
11792 #       define S_IRUSR S_IREAD
11793 #       define S_IWUSR S_IWRITE
11794 #       define S_IXUSR S_IEXEC
11795 #   else
11796 #       define S_IRUSR 0400
11797 #       define S_IWUSR 0200
11798 #       define S_IXUSR 0100
11799 #   endif
11800 #   define S_IRGRP (S_IRUSR>>3)
11801 #   define S_IWGRP (S_IWUSR>>3)
11802 #   define S_IXGRP (S_IXUSR>>3)
11803 #   define S_IROTH (S_IRUSR>>6)
11804 #   define S_IWOTH (S_IWUSR>>6)
11805 #   define S_IXOTH (S_IXUSR>>6)
11806 #endif
11807 #ifndef S_IRWXU
11808 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11809 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11810 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11811 #endif
11812 END
11813
11814     $cat > try.c <<END
11815 #include <sys/types.h>
11816 #include <sys/ipc.h>
11817 #include <sys/sem.h>
11818 #include <sys/stat.h>
11819 #include <stdio.h>
11820 #include <errno.h>
11821 #include "try.h"
11822 #ifndef errno
11823 extern int errno;
11824 #endif
11825 #$d_union_semun HAS_UNION_SEMUN
11826 int main() {
11827     union semun
11828 #ifndef HAS_UNION_SEMUN
11829     {
11830         int val;
11831         struct semid_ds *buf;
11832         unsigned short *array;
11833     }
11834 #endif
11835     arg;
11836     int sem, st;
11837
11838 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11839     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11840     if (sem > -1) {
11841         struct semid_ds argbuf;
11842         arg.buf = &argbuf;
11843 #       ifdef IPC_STAT
11844         st = semctl(sem, 0, IPC_STAT, arg);
11845         if (st == 0)
11846             printf("semun\n");
11847         else
11848 #       endif /* IPC_STAT */
11849             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11850 #       ifdef IPC_RMID
11851         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11852 #       endif /* IPC_RMID */
11853             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11854     } else
11855 #endif /* IPC_PRIVATE && ... */
11856         printf("semget failed: errno = %d\n", errno);
11857   return 0;
11858 }
11859 END
11860     val="$undef"
11861     set try
11862     if eval $compile; then
11863         xxx=`$run ./try`
11864         case "$xxx" in
11865         semun) val="$define" ;;
11866         esac
11867     fi
11868     $rm -f try try.c
11869     set d_semctl_semun
11870     eval $setvar
11871     case "$d_semctl_semun" in
11872     $define)
11873         echo "You can use union semun for semctl IPC_STAT." >&4
11874         also='also'
11875         ;;
11876     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11877         also=''
11878         ;;
11879     esac
11880
11881     : see whether semctl IPC_STAT can use struct semid_ds pointer
11882     $cat > try.c <<'END'
11883 #include <sys/types.h>
11884 #include <sys/ipc.h>
11885 #include <sys/sem.h>
11886 #include <sys/stat.h>
11887 #include "try.h"
11888 #include <stdio.h>
11889 #include <errno.h>
11890 #ifndef errno
11891 extern int errno;
11892 #endif
11893 int main() {
11894     struct semid_ds arg;
11895     int sem, st;
11896
11897 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11898     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11899     if (sem > -1) {
11900 #       ifdef IPC_STAT
11901         st = semctl(sem, 0, IPC_STAT, &arg);
11902         if (st == 0)
11903             printf("semid_ds\n");
11904         else
11905 #       endif /* IPC_STAT */
11906             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11907 #       ifdef IPC_RMID
11908         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11909 #       endif /* IPC_RMID */
11910             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11911     } else
11912 #endif /* IPC_PRIVATE && ... */
11913         printf("semget failed: errno = %d\n", errno);
11914
11915     return 0;
11916 }
11917 END
11918     val="$undef"
11919     set try
11920     if eval $compile; then
11921         xxx=`$run ./try`
11922         case "$xxx" in
11923         semid_ds) val="$define" ;;
11924         esac
11925     fi
11926     $rm -f try try.c
11927     set d_semctl_semid_ds
11928     eval $setvar
11929     case "$d_semctl_semid_ds" in
11930     $define)
11931         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11932         ;;
11933     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11934         ;;
11935     esac
11936     $rm -f try.h
11937     ;;
11938 *)  val="$undef"
11939
11940     # We do not have the full sem*(2) library, so assume we can not
11941     # use either.
11942
11943     set d_semctl_semun
11944     eval $setvar
11945
11946     set d_semctl_semid_ds
11947     eval $setvar
11948     ;;
11949 esac
11950
11951 : see if sendmsg exists
11952 set sendmsg d_sendmsg
11953 eval $inlibc
11954
11955 : see if setegid exists
11956 set setegid d_setegid
11957 eval $inlibc
11958
11959 : see if seteuid exists
11960 set seteuid d_seteuid
11961 eval $inlibc
11962
11963 : see if setgrent exists
11964 set setgrent d_setgrent
11965 eval $inlibc
11966
11967 : see if sethostent exists
11968 set sethostent d_sethent
11969 eval $inlibc
11970
11971 : see if setitimer exists
11972 set setitimer d_setitimer
11973 eval $inlibc
11974
11975 : see if setlinebuf exists
11976 set setlinebuf d_setlinebuf
11977 eval $inlibc
11978
11979 : see if setlocale exists
11980 set setlocale d_setlocale
11981 eval $inlibc
11982
11983 : see if setnetent exists
11984 set setnetent d_setnent
11985 eval $inlibc
11986
11987 : see if setprotoent exists
11988 set setprotoent d_setpent
11989 eval $inlibc
11990
11991 : see if setpgid exists
11992 set setpgid d_setpgid
11993 eval $inlibc
11994
11995 : see if setpgrp2 exists
11996 set setpgrp2 d_setpgrp2
11997 eval $inlibc
11998
11999 : see if setpriority exists
12000 set setpriority d_setprior
12001 eval $inlibc
12002
12003 : see if setproctitle exists
12004 set setproctitle d_setproctitle
12005 eval $inlibc
12006
12007 : see if setpwent exists
12008 set setpwent d_setpwent
12009 eval $inlibc
12010
12011 : see if setregid exists
12012 set setregid d_setregid
12013 eval $inlibc
12014 set setresgid d_setresgid
12015 eval $inlibc
12016
12017 : see if setreuid exists
12018 set setreuid d_setreuid
12019 eval $inlibc
12020 set setresuid d_setresuid
12021 eval $inlibc
12022
12023 : see if setrgid exists
12024 set setrgid d_setrgid
12025 eval $inlibc
12026
12027 : see if setruid exists
12028 set setruid d_setruid
12029 eval $inlibc
12030
12031 : see if setservent exists
12032 set setservent d_setsent
12033 eval $inlibc
12034
12035 : see if setsid exists
12036 set setsid d_setsid
12037 eval $inlibc
12038
12039 : see if setvbuf exists
12040 set setvbuf d_setvbuf
12041 eval $inlibc
12042
12043 : see if sfio.h is available
12044 set sfio.h i_sfio
12045 eval $inhdr
12046
12047
12048 : see if sfio library is available
12049 case "$i_sfio" in
12050 $define)
12051         val=''
12052         set sfreserve val
12053         eval $inlibc
12054         ;;
12055 *)
12056         val="$undef"
12057         ;;
12058 esac
12059 : Ok, but do we want to use it.
12060 case "$val" in
12061 $define)
12062         case "$usesfio" in
12063         true|$define|[yY]*) dflt='y';;
12064         *) dflt='n';;
12065         esac
12066         echo "$package can use the sfio library, but it is experimental."
12067         case "$useperlio" in
12068         "$undef")
12069             echo "For sfio also the PerlIO abstraction layer is needed."
12070             echo "Earlier you said you wouldn't want that."
12071             ;;
12072         esac
12073         rp="You seem to have sfio available, do you want to try using it?"
12074         . ./myread
12075         case "$ans" in
12076         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
12077                 useperlio="$define"
12078                 val="$define"
12079                 ;;
12080         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
12081                 val="$undef"
12082                 ;;
12083         esac
12084         ;;
12085 *)      case "$usesfio" in
12086         true|$define|[yY]*)
12087                 echo "Sorry, cannot find sfio on this machine." >&4
12088                 echo "Ignoring your setting of usesfio=$usesfio." >&4
12089                 val="$undef"
12090                 ;;
12091         esac
12092         ;;
12093 esac
12094 set d_sfio
12095 eval $setvar
12096 case "$d_sfio" in
12097 $define) usesfio='true';;
12098 *) usesfio='false';;
12099 esac
12100 case "$d_sfio" in
12101 $define) ;;
12102 *)      : Remove sfio from list of libraries to use
12103         case "$libs" in
12104         *-lsfio*)
12105                 echo "Removing unneeded -lsfio from library list" >&4
12106                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
12107                 shift
12108                 libs="$*"
12109                 echo "libs = $libs" >&4
12110                 ;;
12111         esac
12112 ;;
12113 esac
12114
12115
12116 : see if shmctl exists
12117 set shmctl d_shmctl
12118 eval $inlibc
12119
12120 : see if shmget exists
12121 set shmget d_shmget
12122 eval $inlibc
12123
12124 : see if shmat exists
12125 set shmat d_shmat
12126 eval $inlibc
12127 : see what shmat returns
12128 case "$d_shmat" in
12129 "$define")
12130         $cat >shmat.c <<'END'
12131 #include <sys/shm.h>
12132 void *shmat();
12133 END
12134         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
12135                 shmattype='void *'
12136         else
12137                 shmattype='char *'
12138         fi
12139         echo "and it returns ($shmattype)." >&4
12140         : see if a prototype for shmat is available
12141         xxx=`./findhdr sys/shm.h`
12142         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
12143         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
12144                 val="$define"
12145         else
12146                 val="$undef"
12147         fi
12148         $rm -f shmat.[co]
12149         ;;
12150 *)
12151         val="$undef"
12152         ;;
12153 esac
12154 set d_shmatprototype
12155 eval $setvar
12156
12157 : see if shmdt exists
12158 set shmdt d_shmdt
12159 eval $inlibc
12160
12161 : see how much of the 'shm*(2)' library is present.
12162 h_shm=true
12163 echo " "
12164 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
12165 *"$undef"*) h_shm=false;;
12166 esac
12167 case "$osname" in
12168 freebsd)
12169     case "`ipcs 2>&1`" in
12170     "SVID shared memory"*"not configured"*)
12171         echo "Your $osname does not have the shm*(2) configured." >&4
12172         h_shm=false
12173         val="$undef"
12174         set shmctl d_shmctl
12175         evat $setvar
12176         set shmget d_shmget
12177         evat $setvar
12178         set shmat d_shmat
12179         evat $setvar
12180         set shmdt d_shmdt
12181         evat $setvar
12182         ;;
12183     esac
12184     ;;
12185 esac
12186 : we could also check for sys/ipc.h ...
12187 if $h_shm && $test `./findhdr sys/shm.h`; then
12188         echo "You have the full shm*(2) library." >&4
12189         val="$define"
12190 else
12191         echo "You don't have the full shm*(2) library." >&4
12192         val="$undef"
12193 fi
12194 set d_shm
12195 eval $setvar
12196
12197 echo " "
12198 : see if we have sigaction
12199 if set sigaction val -f d_sigaction; eval $csym; $val; then
12200         echo 'sigaction() found.' >&4
12201         $cat > try.c <<'EOP'
12202 #include <stdio.h>
12203 #include <sys/types.h>
12204 #include <signal.h>
12205 int main()
12206 {
12207     struct sigaction act, oact;
12208     act.sa_flags = 0;
12209     oact.sa_handler = 0;
12210     /* so that act and oact are used */
12211     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
12212 }
12213 EOP
12214         set try
12215         if eval $compile_ok; then
12216                 val="$define"
12217         else
12218                 echo "But you don't seem to have a useable struct sigaction." >&4
12219                 val="$undef"
12220         fi
12221 else
12222         echo 'sigaction NOT found.' >&4
12223         val="$undef"
12224 fi
12225 set d_sigaction; eval $setvar
12226 $rm -f try try$_o try.c
12227
12228 : see if sigprocmask exists
12229 set sigprocmask d_sigprocmask
12230 eval $inlibc
12231
12232 : see if sigsetjmp exists
12233 echo " "
12234 case "$d_sigsetjmp" in
12235 '')
12236         $cat >try.c <<'EOP'
12237 #include <setjmp.h>
12238 sigjmp_buf env;
12239 int set = 1;
12240 int main()
12241 {
12242         if (sigsetjmp(env,1))
12243                 exit(set);
12244         set = 0;
12245         siglongjmp(env, 1);
12246         exit(1);
12247 }
12248 EOP
12249         set try
12250         if eval $compile; then
12251                 if $run ./try >/dev/null 2>&1; then
12252                         echo "POSIX sigsetjmp found." >&4
12253                         val="$define"
12254                 else
12255                         $cat >&4 <<EOM
12256 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
12257 I'll ignore them.
12258 EOM
12259                         val="$undef"
12260                 fi
12261         else
12262                 echo "sigsetjmp not found." >&4
12263                 val="$undef"
12264         fi
12265         ;;
12266 *) val="$d_sigsetjmp"
12267         case "$d_sigsetjmp" in
12268         $define) echo "POSIX sigsetjmp found." >&4;;
12269         $undef) echo "sigsetjmp not found." >&4;;
12270         esac
12271         ;;
12272 esac
12273 set d_sigsetjmp
12274 eval $setvar
12275 $rm -f try.c try
12276
12277 : see if sockatmark exists
12278 set sockatmark d_sockatmark
12279 eval $inlibc
12280
12281 : see if prototype for sockatmark is available
12282 echo " "
12283 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12284 eval $hasproto
12285
12286 : see if socks5_init exists
12287 set socks5_init d_socks5_init
12288 eval $inlibc
12289
12290 : see if prototype for setresgid is available
12291 echo " "
12292 set d_sresgproto setresgid $i_unistd unistd.h
12293 eval $hasproto
12294
12295 : see if prototype for setresuid is available
12296 echo " "
12297 set d_sresuproto setresuid $i_unistd unistd.h
12298 eval $hasproto
12299
12300 : see if sys/stat.h is available
12301 set sys/stat.h i_sysstat
12302 eval $inhdr
12303
12304
12305 : see if stat knows about block sizes
12306 echo " "
12307 echo "Checking to see if your struct stat has st_blocks field..." >&4
12308 set d_statblks stat st_blocks $i_sysstat sys/stat.h
12309 eval $hasfield
12310
12311
12312 : see if this is a sys/vfs.h system
12313 set sys/vfs.h i_sysvfs
12314 eval $inhdr
12315
12316
12317 : see if this is a sys/statfs.h system
12318 set sys/statfs.h i_sysstatfs
12319 eval $inhdr
12320
12321
12322 echo " "
12323 echo "Checking to see if your system supports struct statfs..." >&4
12324 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
12325 eval $hasstruct
12326 case "$d_statfs_s" in
12327 "$define")      echo "Yes, it does."   ;;
12328 *)              echo "No, it doesn't." ;;
12329 esac
12330
12331
12332
12333 : see if struct statfs knows about f_flags
12334 case "$d_statfs_s" in
12335 define) 
12336         echo " "
12337         echo "Checking to see if your struct statfs has f_flags field..." >&4
12338         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
12339         eval $hasfield
12340         ;;
12341 *)      val="$undef"
12342         set d_statfs_f_flags
12343         eval $setvar
12344         ;;
12345 esac
12346 case "$d_statfs_f_flags" in
12347 "$define")      echo "Yes, it does."   ;;
12348 *)              echo "No, it doesn't." ;;
12349 esac
12350
12351 : see if _ptr and _cnt from stdio act std
12352 echo " "
12353
12354 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12355         echo "(Looks like you have stdio.h from BSD.)"
12356         case "$stdio_ptr" in
12357         '') stdio_ptr='((fp)->_p)'
12358                 ptr_lval=$define
12359                 ;;
12360         *)      ptr_lval=$d_stdio_ptr_lval;;
12361         esac
12362         case "$stdio_cnt" in
12363         '') stdio_cnt='((fp)->_r)'
12364                 cnt_lval=$define
12365                 ;;
12366         *)      cnt_lval=$d_stdio_cnt_lval;;
12367         esac
12368         case "$stdio_base" in
12369         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12370         esac
12371         case "$stdio_bufsiz" in
12372         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12373         esac
12374 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12375         echo "(Looks like you have stdio.h from Linux.)"
12376         case "$stdio_ptr" in
12377         '') stdio_ptr='((fp)->_IO_read_ptr)'
12378                 ptr_lval=$define
12379                 ;;
12380         *)      ptr_lval=$d_stdio_ptr_lval;;
12381         esac
12382         case "$stdio_cnt" in
12383         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12384                 cnt_lval=$undef
12385                 ;;
12386         *)      cnt_lval=$d_stdio_cnt_lval;;
12387         esac
12388         case "$stdio_base" in
12389         '') stdio_base='((fp)->_IO_read_base)';;
12390         esac
12391         case "$stdio_bufsiz" in
12392         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12393         esac
12394 else
12395         case "$stdio_ptr" in
12396         '') stdio_ptr='((fp)->_ptr)'
12397                 ptr_lval=$define
12398                 ;;
12399         *)      ptr_lval=$d_stdio_ptr_lval;;
12400         esac
12401         case "$stdio_cnt" in
12402         '') stdio_cnt='((fp)->_cnt)'
12403                 cnt_lval=$define
12404                 ;;
12405         *)      cnt_lval=$d_stdio_cnt_lval;;
12406         esac
12407         case "$stdio_base" in
12408         '') stdio_base='((fp)->_base)';;
12409         esac
12410         case "$stdio_bufsiz" in
12411         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12412         esac
12413 fi
12414
12415 : test whether _ptr and _cnt really work
12416 echo "Checking how std your stdio is..." >&4
12417 $cat >try.c <<EOP
12418 #include <stdio.h>
12419 #define FILE_ptr(fp)    $stdio_ptr
12420 #define FILE_cnt(fp)    $stdio_cnt
12421 int main() {
12422         FILE *fp = fopen("try.c", "r");
12423         char c = getc(fp);
12424         if (
12425                 18 <= FILE_cnt(fp) &&
12426                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12427         )
12428                 exit(0);
12429         exit(1);
12430 }
12431 EOP
12432 val="$undef"
12433 set try
12434 if eval $compile && $to try.c; then
12435         if $run ./try; then
12436                 echo "Your stdio acts pretty std."
12437                 val="$define"
12438         else
12439                 echo "Your stdio isn't very std."
12440         fi
12441 else
12442         echo "Your stdio doesn't appear very std."
12443 fi
12444 $rm -f try.c try
12445 set d_stdstdio
12446 eval $setvar
12447
12448 : Can _ptr be used as an lvalue?
12449 case "$d_stdstdio$ptr_lval" in
12450 $define$define) val=$define ;;
12451 *) val=$undef ;;
12452 esac
12453 set d_stdio_ptr_lval
12454 eval $setvar
12455
12456 : Can _cnt be used as an lvalue?
12457 case "$d_stdstdio$cnt_lval" in
12458 $define$define) val=$define ;;
12459 *) val=$undef ;;
12460 esac
12461 set d_stdio_cnt_lval
12462 eval $setvar
12463
12464
12465 : test whether setting _ptr sets _cnt as a side effect
12466 d_stdio_ptr_lval_sets_cnt="$undef"
12467 d_stdio_ptr_lval_nochange_cnt="$undef"
12468 case "$d_stdio_ptr_lval$d_stdstdio" in
12469 $define$define)
12470         echo "Checking to see what happens if we set the stdio ptr..." >&4
12471 $cat >try.c <<EOP
12472 #include <stdio.h>
12473 /* Can we scream? */
12474 /* Eat dust sed :-) */
12475 /* In the buffer space, no one can hear you scream. */
12476 #define FILE_ptr(fp)    $stdio_ptr
12477 #define FILE_cnt(fp)    $stdio_cnt
12478 #include <sys/types.h>
12479 int main() {
12480         FILE *fp = fopen("try.c", "r");
12481         int c;
12482         char *ptr;
12483         size_t cnt;
12484         if (!fp) {
12485             puts("Fail even to read");
12486             exit(1);
12487         }
12488         c = getc(fp); /* Read away the first # */
12489         if (c == EOF) {
12490             puts("Fail even to read");
12491             exit(1);
12492         }
12493         if (!(
12494                 18 <= FILE_cnt(fp) &&
12495                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12496         )) {
12497                 puts("Fail even to read");
12498                 exit (1);
12499         }
12500         ptr = (char*) FILE_ptr(fp);
12501         cnt = (size_t)FILE_cnt(fp);
12502
12503         FILE_ptr(fp) += 42;
12504
12505         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12506                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12507                 exit (1);
12508         }
12509         if (FILE_cnt(fp) <= 20) {
12510                 printf ("Fail (<20 chars to test)");
12511                 exit (1);
12512         }
12513         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12514                 puts("Fail compare");
12515                 exit (1);
12516         }
12517         if (cnt == FILE_cnt(fp)) {
12518                 puts("Pass_unchanged");
12519                 exit (0);
12520         }       
12521         if (FILE_cnt(fp) == (cnt - 42)) {
12522                 puts("Pass_changed");
12523                 exit (0);
12524         }
12525         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12526         return 1;
12527
12528 }
12529 EOP
12530         set try
12531         if eval $compile && $to try.c; then
12532                 case `$run ./try` in
12533                 Pass_changed)
12534                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12535                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12536                 Pass_unchanged)
12537                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12538                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12539                 Fail*)
12540                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12541                 *)
12542                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12543         esac
12544         else
12545                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12546         fi
12547         $rm -f try.c try
12548         ;;
12549 esac
12550
12551 : see if _base is also standard
12552 val="$undef"
12553 case "$d_stdstdio" in
12554 $define)
12555         $cat >try.c <<EOP
12556 #include <stdio.h>
12557 #define FILE_base(fp)   $stdio_base
12558 #define FILE_bufsiz(fp) $stdio_bufsiz
12559 int main() {
12560         FILE *fp = fopen("try.c", "r");
12561         char c = getc(fp);
12562         if (
12563                 19 <= FILE_bufsiz(fp) &&
12564                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12565         )
12566                 exit(0);
12567         exit(1);
12568 }
12569 EOP
12570         set try
12571         if eval $compile && $to try.c; then
12572                 if $run ./try; then
12573                         echo "And its _base field acts std."
12574                         val="$define"
12575                 else
12576                         echo "But its _base field isn't std."
12577                 fi
12578         else
12579                 echo "However, it seems to be lacking the _base field."
12580         fi
12581         $rm -f try.c try
12582         ;;
12583 esac
12584 set d_stdiobase
12585 eval $setvar
12586
12587 $cat >&4 <<EOM
12588 Checking how to access stdio streams by file descriptor number...
12589 EOM
12590 case "$stdio_stream_array" in
12591 '')     $cat >try.c <<EOCP
12592 #include <stdio.h>
12593 int main() {
12594   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12595     printf("yes\n");
12596 }
12597 EOCP
12598         for s in _iob __iob __sF
12599         do
12600                 set try -DSTDIO_STREAM_ARRAY=$s
12601                 if eval $compile; then
12602                         case "`$run ./try`" in
12603                         yes)    stdio_stream_array=$s; break ;;
12604                         esac
12605                 fi
12606         done
12607         $rm -f try.* try$exe_ext
12608 esac
12609 case "$stdio_stream_array" in
12610 '')     $cat >&4 <<EOM
12611 I can't figure out how to access stdio streams by file descriptor number.
12612 EOM
12613         d_stdio_stream_array="$undef"
12614         ;;
12615 *)      $cat >&4 <<EOM
12616 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12617 EOM
12618         d_stdio_stream_array="$define"
12619         ;;
12620 esac
12621
12622 : see if strcoll exists
12623 set strcoll d_strcoll
12624 eval $inlibc
12625
12626 : check for structure copying
12627 echo " "
12628 echo "Checking to see if your C compiler can copy structs..." >&4
12629 $cat >try.c <<'EOCP'
12630 int main()
12631 {
12632         struct blurfl {
12633                 int dyick;
12634         } foo, bar;
12635
12636         foo = bar;
12637 }
12638 EOCP
12639 if $cc -c try.c >/dev/null 2>&1 ; then
12640         val="$define"
12641         echo "Yup, it can."
12642 else
12643         val="$undef"
12644         echo "Nope, it can't."
12645 fi
12646 set d_strctcpy
12647 eval $setvar
12648 $rm -f try.*
12649
12650 : see if strerror and/or sys_errlist[] exist
12651 echo " "
12652 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12653     if set strerror val -f d_strerror; eval $csym; $val; then
12654                 echo 'strerror() found.' >&4
12655                 d_strerror="$define"
12656                 d_strerrm='strerror(e)'
12657                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12658                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12659                         d_syserrlst="$define"
12660                 else
12661                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12662                         d_syserrlst="$undef"
12663                 fi
12664     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12665                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12666                 echo 'strerror() found in string header.' >&4
12667                 d_strerror="$define"
12668                 d_strerrm='strerror(e)'
12669                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12670                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12671                                 d_syserrlst="$define"
12672                 else
12673                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12674                         d_syserrlst="$undef"
12675                 fi
12676     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12677                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12678                 d_strerror="$undef"
12679                 d_syserrlst="$define"
12680                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12681     else
12682                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12683                 d_strerror="$undef"
12684                 d_syserrlst="$undef"
12685                 d_strerrm='"unknown"'
12686     fi
12687 fi
12688
12689 : see if strftime exists
12690 set strftime d_strftime
12691 eval $inlibc
12692
12693 : see if strtod exists
12694 set strtod d_strtod
12695 eval $inlibc
12696
12697 : see if strtol exists
12698 set strtol d_strtol
12699 eval $inlibc
12700
12701 : see if strtold exists
12702 set strtold d_strtold
12703 eval $inlibc
12704
12705 : see if strtoll exists
12706 set strtoll d_strtoll
12707 eval $inlibc
12708
12709 case "$d_longlong-$d_strtoll" in
12710 "$define-$define")
12711         $cat <<EOM
12712 Checking whether your strtoll() works okay...
12713 EOM
12714         $cat >try.c <<'EOCP'
12715 #include <errno.h>
12716 #ifdef __hpux
12717 #define strtoll __strtoll
12718 #endif
12719 #ifdef __EMX__
12720 #define strtoll _strtoll
12721 #endif
12722 #include <stdio.h>
12723 extern long long int strtoll(char *s, char **, int); 
12724 static int bad = 0;
12725 int check(char *s, long long ell, int een) {
12726         long long gll;
12727         errno = 0;
12728         gll = strtoll(s, 0, 10);
12729         if (!((gll == ell) && (errno == een)))
12730                 bad++;
12731 }
12732 int main() {
12733         check(" 1",                                      1LL, 0);
12734         check(" 0",                                      0LL, 0);
12735         check("-1",                                     -1LL, 0);
12736         check("-9223372036854775808", -9223372036854775808LL, 0);
12737         check("-9223372036854775808", -9223372036854775808LL, 0);
12738         check(" 9223372036854775807",  9223372036854775807LL, 0);
12739         check("-9223372036854775808", -9223372036854775808LL, 0);
12740         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12741         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12742         if (!bad)
12743                 printf("ok\n");
12744 }
12745 EOCP
12746         set try
12747         if eval $compile; then
12748                 yyy=`$run ./try`
12749                 case "$yyy" in
12750                 ok) echo "Your strtoll() seems to be working okay." ;;
12751                 *) cat <<EOM >&4
12752 Your strtoll() doesn't seem to be working okay.
12753 EOM
12754                    d_strtoll="$undef"
12755                    ;;
12756                 esac
12757         else
12758                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12759                 d_strtoll="$undef"
12760         fi
12761         ;;
12762 esac
12763
12764 : see if strtoq exists
12765 set strtoq d_strtoq
12766 eval $inlibc
12767
12768 : see if strtoul exists
12769 set strtoul d_strtoul
12770 eval $inlibc
12771
12772 case "$d_strtoul" in
12773 "$define")
12774         $cat <<EOM
12775 Checking whether your strtoul() works okay...
12776 EOM
12777         $cat >try.c <<'EOCP'
12778 #include <errno.h>
12779 #include <stdio.h>
12780 extern unsigned long int strtoul(char *s, char **, int); 
12781 static int bad = 0;
12782 void check(char *s, unsigned long eul, int een) {
12783         unsigned long gul;
12784         errno = 0;
12785         gul = strtoul(s, 0, 10);
12786         if (!((gul == eul) && (errno == een)))
12787                 bad++;
12788 }
12789 int main() {
12790         check(" 1", 1L, 0);
12791         check(" 0", 0L, 0);
12792 EOCP
12793         case "$longsize" in
12794         8)
12795             $cat >>try.c <<'EOCP'
12796         check("18446744073709551615", 18446744073709551615UL, 0);
12797         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12798 #if 0 /* strtoul() for /^-/ strings is undefined. */
12799         check("-1", 18446744073709551615UL, 0);
12800         check("-18446744073709551614", 2, 0);
12801         check("-18446744073709551615", 1, 0);
12802         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12803         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12804 #endif
12805 EOCP
12806                 ;;
12807         4)
12808                     $cat >>try.c <<'EOCP'
12809         check("4294967295", 4294967295UL, 0);
12810         check("4294967296", 4294967295UL, ERANGE);
12811 #if 0 /* strtoul() for /^-/ strings is undefined. */
12812         check("-1", 4294967295UL, 0);
12813         check("-4294967294", 2, 0);
12814         check("-4294967295", 1, 0);
12815         check("-4294967296", 4294967295UL, ERANGE);
12816         check("-4294967297", 4294967295UL, ERANGE);
12817 #endif
12818 EOCP
12819                 ;;
12820         *)
12821 : Should we write these tests to be more portable by sprintf-ing
12822 : ~0 and then manipulating that char string as input for strtol?
12823                 ;;
12824         esac
12825         $cat >>try.c <<'EOCP'
12826         if (!bad)
12827                 printf("ok\n");
12828         return 0;
12829 }
12830 EOCP
12831         set try
12832         if eval $compile; then
12833                 case "`$run ./try`" in
12834                 ok) echo "Your strtoul() seems to be working okay." ;;
12835                 *) cat <<EOM >&4
12836 Your strtoul() doesn't seem to be working okay.
12837 EOM
12838                    d_strtoul="$undef"
12839                    ;;
12840                 esac
12841         fi
12842         ;;
12843 esac
12844
12845 : see if strtoull exists
12846 set strtoull d_strtoull
12847 eval $inlibc
12848
12849 case "$d_longlong-$d_strtoull" in
12850 "$define-$define")
12851         $cat <<EOM
12852 Checking whether your strtoull() works okay...
12853 EOM
12854         $cat >try.c <<'EOCP'
12855 #include <errno.h>
12856 #ifdef __hpux
12857 #define strtoull __strtoull
12858 #endif
12859 #include <stdio.h>
12860 extern unsigned long long int strtoull(char *s, char **, int); 
12861 static int bad = 0;
12862 int check(char *s, long long eull, int een) {
12863         long long gull;
12864         errno = 0;
12865         gull = strtoull(s, 0, 10);
12866         if (!((gull == eull) && (errno == een)))
12867                 bad++;
12868 }
12869 int main() {
12870         check(" 1",                                        1LL, 0);
12871         check(" 0",                                        0LL, 0);
12872         check("18446744073709551615",  18446744073709551615ULL, 0);
12873         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12874 #if 0 /* strtoull() for /^-/ strings is undefined. */
12875         check("-1",                    18446744073709551615ULL, 0);
12876         check("-18446744073709551614",                     2LL, 0);
12877         check("-18446744073709551615",                     1LL, 0);
12878         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12879         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12880 #endif
12881         if (!bad)
12882                 printf("ok\n");
12883 }
12884 EOCP
12885         set try
12886         if eval $compile; then
12887                 case "`$run ./try`" in
12888                 ok) echo "Your strtoull() seems to be working okay." ;;
12889                 *) cat <<EOM >&4
12890 Your strtoull() doesn't seem to be working okay.
12891 EOM
12892                    d_strtoull="$undef"
12893                    ;;
12894                 esac
12895         fi
12896         ;;
12897 esac
12898
12899 : see if strtouq exists
12900 set strtouq d_strtouq
12901 eval $inlibc
12902
12903 case "$d_strtouq" in
12904 "$define")
12905         $cat <<EOM
12906 Checking whether your strtouq() works okay...
12907 EOM
12908         $cat >try.c <<'EOCP'
12909 #include <errno.h>
12910 #include <stdio.h>
12911 extern unsigned long long int strtouq(char *s, char **, int); 
12912 static int bad = 0;
12913 void check(char *s, unsigned long long eull, int een) {
12914         unsigned long long gull;
12915         errno = 0;
12916         gull = strtouq(s, 0, 10);
12917         if (!((gull == eull) && (errno == een)))
12918                 bad++;
12919 }
12920 int main() {
12921         check(" 1",                                        1LL, 0);
12922         check(" 0",                                        0LL, 0);
12923         check("18446744073709551615",  18446744073709551615ULL, 0);
12924         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12925 #if 0 /* strtouq() for /^-/ strings is undefined. */
12926         check("-1",                    18446744073709551615ULL, 0);
12927         check("-18446744073709551614",                     2LL, 0);
12928         check("-18446744073709551615",                     1LL, 0);
12929         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12930         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12931 #endif
12932         if (!bad)
12933                 printf("ok\n");
12934         return 0;
12935 }
12936 EOCP
12937         set try
12938         if eval $compile; then
12939                 case "`$run ./try`" in
12940                 ok) echo "Your strtouq() seems to be working okay." ;;
12941                 *) cat <<EOM >&4
12942 Your strtouq() doesn't seem to be working okay.
12943 EOM
12944                    d_strtouq="$undef"
12945                    ;;
12946                 esac
12947         fi
12948         ;;
12949 esac
12950
12951 : see if strxfrm exists
12952 set strxfrm d_strxfrm
12953 eval $inlibc
12954
12955 : see if symlink exists
12956 set symlink d_symlink
12957 eval $inlibc
12958
12959 : see if syscall exists
12960 set syscall d_syscall
12961 eval $inlibc
12962
12963 : see if prototype for syscall is available
12964 echo " "
12965 set d_syscallproto syscall $i_unistd unistd.h
12966 eval $hasproto
12967
12968 : see if sysconf exists
12969 set sysconf d_sysconf
12970 eval $inlibc
12971
12972 : see if system exists
12973 set system d_system
12974 eval $inlibc
12975
12976 : see if tcgetpgrp exists
12977 set tcgetpgrp d_tcgetpgrp
12978 eval $inlibc
12979
12980 : see if tcsetpgrp exists
12981 set tcsetpgrp d_tcsetpgrp
12982 eval $inlibc
12983
12984 : see if prototype for telldir is available
12985 echo " "
12986 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12987 eval $hasproto
12988
12989 : see if this is a sys/times.h system
12990 set sys/times.h i_systimes
12991 eval $inhdr
12992
12993 : see if times exists
12994 echo " "
12995 if set times val -f d_times; eval $csym; $val; then
12996         echo 'times() found.' >&4
12997         d_times="$define"
12998         inc=''
12999         case "$i_systimes" in
13000         "$define") inc='sys/times.h';;
13001         esac
13002         rp="What is the type returned by times() on this system?"
13003         set clock_t clocktype long stdio.h sys/types.h $inc
13004         eval $typedef_ask
13005 else
13006         echo 'times() NOT found, hope that will do.' >&4
13007         d_times="$undef"
13008         clocktype='int'
13009 fi
13010
13011 : see if truncate exists
13012 set truncate d_truncate
13013 eval $inlibc
13014
13015 : see if tzname[] exists
13016 echo " "
13017 if set tzname val -a d_tzname; eval $csym; $val; then
13018         val="$define"
13019         echo 'tzname[] found.' >&4
13020 else
13021         val="$undef"
13022         echo 'tzname[] NOT found.' >&4
13023 fi
13024 set d_tzname
13025 eval $setvar
13026
13027 case "$osname" in
13028 next|rhapsody|darwin) multiarch="$define" ;;
13029 esac
13030 case "$multiarch" in
13031 ''|[nN]*) multiarch="$undef" ;;
13032 esac
13033
13034 : check for ordering of bytes in a long
13035 echo " "
13036 case "$usecrosscompile$multiarch" in
13037 *$define*)
13038         $cat <<EOM
13039 You seem to be either cross-compiling or doing a multiarchitecture build,
13040 skipping the byteorder check.
13041
13042 EOM
13043         byteorder='ffff'
13044         ;;
13045 *)
13046         case "$byteorder" in
13047         '')
13048                 $cat <<'EOM'
13049 In the following, larger digits indicate more significance.  A big-endian
13050 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
13051 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
13052 machines may have weird orders like 3412.  A Cray will report 87654321,
13053 an Alpha will report 12345678. If the test program works the default is
13054 probably right.
13055 I'm now running the test program...
13056 EOM
13057                 $cat >try.c <<'EOCP'
13058 #include <stdio.h>
13059 int main()
13060 {
13061         int i;
13062         union {
13063                 unsigned long l;
13064                 char c[sizeof(long)];
13065         } u;
13066
13067         if (sizeof(long) > 4)
13068                 u.l = (0x08070605L << 32) | 0x04030201L;
13069         else
13070                 u.l = 0x04030201L;
13071         for (i = 0; i < sizeof(long); i++)
13072                 printf("%c", u.c[i]+'0');
13073         printf("\n");
13074         exit(0);
13075 }
13076 EOCP
13077                 xxx_prompt=y
13078                 set try
13079                 if eval $compile && ./try > /dev/null; then
13080                         dflt=`$run ./try`
13081                         case "$dflt" in
13082                         [1-4][1-4][1-4][1-4]|12345678|87654321)
13083                                 echo "(The test program ran ok.)"
13084                                 echo "byteorder=$dflt"
13085                                 xxx_prompt=n
13086                         ;;
13087                         ????|????????) echo "(The test program ran ok.)" ;;
13088                         *) echo "(The test program didn't run right for some reason.)" ;;
13089                         esac
13090                 else
13091                         dflt='4321'
13092                         cat <<'EOM'
13093 (I can't seem to compile the test program.  Guessing big-endian...)
13094 EOM
13095                 fi
13096                 case "$xxx_prompt" in
13097                 y)
13098                         rp="What is the order of bytes in a long?"
13099                         . ./myread
13100                         byteorder="$ans"
13101                         ;;
13102                 *)      byteorder=$dflt
13103                         ;;
13104                 esac
13105                 ;;
13106         esac
13107         $rm -f try.c try
13108         ;;
13109 esac
13110
13111
13112 $cat <<EOM
13113
13114 Checking to see whether you can access character data unalignedly...
13115 EOM
13116 $cat >try.c <<EOCP
13117 #include <stdio.h>
13118 #define U32 $u32type
13119 #define BYTEORDER $byteorder
13120 int main() {
13121 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
13122     U8 buf[] = "\0\0\0\1\0\0\0\0";
13123     U32 *up;
13124     int i;
13125
13126     if (sizeof(U32) != 4) {
13127         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
13128         exit(1);
13129     }
13130
13131     fflush(stdout);
13132
13133     for (i = 0; i < 4; i++) {
13134         up = (U32*)(buf + i);
13135         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
13136                (*up == 1 << (8*(3-i)))  /* little-endian */
13137               )
13138            )
13139         {
13140             printf("read failed (%x)\n", *up);
13141             exit(2);
13142         }
13143     }
13144
13145     /* write test */
13146     for (i = 0; i < 4; i++) {
13147         up = (U32*)(buf + i);
13148         *up = 0xBeef;
13149         if (*up != 0xBeef) {
13150             printf("write failed (%x)\n", *up);
13151             exit(3);
13152         }
13153     }
13154
13155     exit(0);
13156 #else
13157     printf("1\n");
13158     exit(1);
13159 #endif
13160     return 0;
13161 }
13162 EOCP
13163 set try
13164 if eval $compile_ok; then
13165         echo "(Testing for character data alignment may dump core.)" >&4
13166         $run ./try 2>&1 >/dev/null
13167         case "$?" in
13168         0)      cat >&4 <<EOM
13169 You can access character data pretty unalignedly.
13170 EOM
13171                 d_u32align="$undef"
13172                 ;;
13173         *)      cat >&4 <<EOM
13174 It seems that you must access character data in an aligned manner.
13175 EOM
13176                 d_u32align="$define"
13177                 ;;
13178         esac
13179         $rm -f core core.try.* try.core
13180 else
13181         rp='Can you access character data at unaligned addresses?'
13182         dflt='n'
13183         . ./myread
13184         case "$ans" in
13185         [yY]*)  d_u32align="$undef"  ;;
13186         *)      d_u32align="$define" ;;
13187         esac
13188 fi
13189
13190 : see if ualarm exists
13191 set ualarm d_ualarm
13192 eval $inlibc
13193
13194 : see if umask exists
13195 set umask d_umask
13196 eval $inlibc
13197
13198 : see if usleep exists
13199 set usleep d_usleep
13200 eval $inlibc
13201
13202 : see if prototype for usleep is available
13203 echo " "
13204 set d_usleepproto usleep $i_unistd unistd.h
13205 eval $hasproto
13206
13207 : see if ustat exists
13208 set ustat d_ustat
13209 eval $inlibc
13210
13211 : backward compatibility for d_hvfork
13212 if test X$d_hvfork != X; then
13213         d_vfork="$d_hvfork"
13214         d_hvfork=''
13215 fi
13216 : see if there is a vfork
13217 val=''
13218 set vfork val
13219 eval $inlibc
13220
13221 : Ok, but do we want to use it. vfork is reportedly unreliable in 
13222 : perl on Solaris 2.x, and probably elsewhere.
13223 case "$val" in
13224 $define)
13225         echo " "
13226         case "$usevfork" in
13227         false) dflt='n';;
13228         *) dflt='y';;
13229         esac
13230         cat <<'EOM'
13231  
13232 Perl can only use a vfork() that doesn't suffer from strict
13233 restrictions on calling functions or modifying global data in
13234 the child.  For example, glibc-2.1 contains such a vfork()
13235 that is unsuitable.  If your system provides a proper fork()
13236 call, chances are that you do NOT want perl to use vfork().
13237
13238 EOM
13239         rp="Do you still want to use vfork()?"
13240         . ./myread
13241         case "$ans" in
13242         y|Y) ;;
13243         *)
13244                 echo "Ok, we won't use vfork()."
13245                 val="$undef"
13246                 ;;
13247         esac
13248         ;;
13249 esac
13250 set d_vfork
13251 eval $setvar
13252 case "$d_vfork" in
13253 $define) usevfork='true';;
13254 *) usevfork='false';;
13255 esac
13256
13257 : see if this is an sysdir system
13258 set sys/dir.h i_sysdir
13259 eval $inhdr
13260
13261 : see if this is an sysndir system
13262 set sys/ndir.h i_sysndir
13263 eval $inhdr
13264
13265 : see if closedir exists
13266 set closedir d_closedir
13267 eval $inlibc
13268
13269 case "$d_closedir" in
13270 "$define")
13271         echo " "
13272         echo "Checking whether closedir() returns a status..." >&4
13273         cat > try.c <<EOM
13274 #$i_dirent I_DIRENT             /**/
13275 #$i_sysdir I_SYS_DIR            /**/
13276 #$i_sysndir I_SYS_NDIR          /**/
13277 #$i_systypes I_SYS_TYPES        /**/
13278
13279 #if defined(I_SYS_TYPES)
13280 #include <sys/types.h>
13281 #endif
13282 #if defined(I_DIRENT)
13283 #include <dirent.h>
13284 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13285 #include <sys/dir.h>
13286 #endif
13287 #else
13288 #ifdef I_SYS_NDIR
13289 #include <sys/ndir.h>
13290 #else
13291 #ifdef I_SYS_DIR
13292 #ifdef hp9000s500
13293 #include <ndir.h>       /* may be wrong in the future */
13294 #else
13295 #include <sys/dir.h>
13296 #endif
13297 #endif
13298 #endif
13299 #endif 
13300 int main() { return closedir(opendir(".")); }
13301 EOM
13302         set try
13303         if eval $compile_ok; then
13304                 if $run ./try > /dev/null 2>&1 ; then
13305                         echo "Yes, it does."
13306                         val="$undef"
13307                 else
13308                         echo "No, it doesn't."
13309                         val="$define"
13310                 fi
13311         else
13312                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13313                 val="$define"
13314         fi
13315         ;;
13316 *)
13317         val="$undef";
13318         ;;
13319 esac
13320 set d_void_closedir
13321 eval $setvar
13322 $rm -f try try.*
13323 : see if there is a wait4
13324 set wait4 d_wait4
13325 eval $inlibc
13326
13327 : see if waitpid exists
13328 set waitpid d_waitpid
13329 eval $inlibc
13330
13331 : see if wcstombs exists
13332 set wcstombs d_wcstombs
13333 eval $inlibc
13334
13335 : see if wctomb exists
13336 set wctomb d_wctomb
13337 eval $inlibc
13338
13339 : see if writev exists
13340 set writev d_writev
13341 eval $inlibc
13342
13343 : preserve RCS keywords in files with variable substitution, grrr
13344 Date='$Date'
13345 Id='$Id'
13346 Log='$Log'
13347 RCSfile='$RCSfile'
13348 Revision='$Revision'
13349
13350 : check for alignment requirements
13351 echo " "
13352 case "$usecrosscompile$multiarch" in
13353 *$define*)
13354         $cat <<EOM
13355 You seem to be either cross-compiling or doing a multiarchitecture build,
13356 skipping the memory alignment check.
13357
13358 EOM
13359         case "$alignbytes" in
13360         '') alignbytes=8 ;;
13361         esac
13362         ;;
13363 *)
13364         case "$alignbytes" in
13365         '') echo "Checking alignment constraints..." >&4
13366                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13367                         $cat >try.c <<'EOCP'
13368 typedef long double NV;
13369 EOCP
13370                 else
13371                         $cat >try.c <<'EOCP'
13372 typedef double NV;
13373 EOCP
13374                 fi
13375                 $cat >>try.c <<'EOCP'
13376 #include <stdio.h>
13377 struct foobar {
13378         char foo;
13379         NV bar;
13380 } try_algn;
13381 int main()
13382 {
13383     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13384     return(0);
13385 }
13386 EOCP
13387                 set try
13388                 if eval $compile_ok; then
13389                         dflt=`$run ./try`
13390                 else
13391                         dflt='8'
13392                         echo "(I can't seem to compile the test program...)"
13393                 fi
13394                 ;;
13395         *) dflt="$alignbytes"
13396                 ;;
13397         esac
13398         rp="Doubles must be aligned on a how-many-byte boundary?"
13399         . ./myread
13400         alignbytes="$ans"
13401         $rm -f try.c try
13402         ;;
13403 esac
13404
13405
13406 : set the base revision
13407 baserev=5.0
13408
13409 : how do we catenate cpp tokens here?
13410 echo " "
13411 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13412 $cat >cpp_stuff.c <<'EOCP'
13413 #define RCAT(a,b)a/**/b
13414 #define ACAT(a,b)a ## b
13415 RCAT(Rei,ser)
13416 ACAT(Cir,cus)
13417 EOCP
13418 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13419 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13420         echo "Oh!  Smells like ANSI's been here." >&4
13421         echo "We can catify or stringify, separately or together!"
13422         cpp_stuff=42
13423 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13424         echo "Ah, yes!  The good old days!" >&4
13425         echo "However, in the good old days we don't know how to stringify and"
13426         echo "catify at the same time."
13427         cpp_stuff=1
13428 else
13429         $cat >&4 <<EOM
13430 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13431 to have to edit the values of CAT[2-5] in config.h...
13432 EOM
13433         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13434 fi
13435 $rm -f cpp_stuff.*
13436
13437 : see if this is a db.h system
13438 set db.h i_db
13439 eval $inhdr
13440
13441 case "$i_db" in
13442 $define)
13443         : Check db version.
13444         echo " "
13445         echo "Checking Berkeley DB version ..." >&4
13446         $cat >try.c <<EOCP
13447 #$d_const HASCONST
13448 #ifndef HASCONST
13449 #define const
13450 #endif
13451 #include <sys/types.h>
13452 #include <stdio.h>
13453 #include <db.h>
13454 int main(int argc, char *argv[])
13455 {
13456 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13457     int Major, Minor, Patch ;
13458     unsigned long Version ;
13459     (void)db_version(&Major, &Minor, &Patch) ;
13460     if (argc == 2) {
13461         printf("%d %d %d %d %d %d\n",
13462                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13463                Major, Minor, Patch);
13464         exit(0);
13465     }
13466     printf("You have Berkeley DB Version 2 or greater.\n");
13467
13468     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13469                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13470     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13471                 Major, Minor, Patch) ;
13472
13473     /* check that db.h & libdb are compatible */
13474     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13475         printf("db.h and libdb are incompatible.\n") ;
13476         exit(3);        
13477     }
13478
13479     printf("db.h and libdb are compatible.\n") ;
13480
13481     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13482                 + DB_VERSION_PATCH ;
13483
13484     /* needs to be >= 2.3.4 */
13485     if (Version < 2003004) {
13486     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13487         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13488         exit(2);        
13489     }
13490
13491     exit(0);
13492 #else
13493 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13494     if (argc == 2) {
13495         printf("1 0 0\n");
13496         exit(0);
13497     }
13498     printf("You have Berkeley DB Version 1.\n");
13499     exit(0);    /* DB version < 2: the coast is clear. */
13500 #else
13501     exit(1);    /* <db.h> not Berkeley DB? */
13502 #endif
13503 #endif
13504 }
13505 EOCP
13506         set try
13507         if eval $compile_ok && $run ./try; then
13508                 echo 'Looks OK.' >&4
13509                 set `$run ./try 1`
13510                 db_version_major=$1
13511                 db_version_minor=$2
13512                 db_version_patch=$3
13513         else
13514                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13515                 i_db=$undef
13516                 case " $libs " in
13517                 *"-ldb "*)
13518                         : Remove db from list of libraries to use
13519                         echo "Removing unusable -ldb from library list" >&4
13520                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13521                         shift
13522                         libs="$*"
13523                         echo "libs = $libs" >&4
13524                         ;;
13525                 esac
13526         fi
13527         $rm -f try.*
13528         ;;
13529 esac
13530
13531 case "$i_db" in
13532 define)
13533         : Check the return type needed for hash 
13534         echo " "
13535         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13536         $cat >try.c <<EOCP
13537 #$d_const HASCONST
13538 #ifndef HASCONST
13539 #define const
13540 #endif
13541 #include <sys/types.h>
13542 #include <db.h>
13543
13544 #ifndef DB_VERSION_MAJOR
13545 u_int32_t hash_cb (ptr, size)
13546 const void *ptr;
13547 size_t size;
13548 {
13549 }
13550 HASHINFO info;
13551 int main()
13552 {
13553         info.hash = hash_cb;
13554 }
13555 #endif
13556 EOCP
13557         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13558                 if $contains warning try.out >>/dev/null 2>&1 ; then
13559                         db_hashtype='int'
13560                 else
13561                         db_hashtype='u_int32_t'
13562                 fi
13563         else
13564                 : XXX Maybe we should just give up here.
13565                 db_hashtype=u_int32_t
13566                 $cat try.out >&4
13567                 echo "Help:  I can't seem to compile the db test program." >&4
13568                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13569         fi
13570         $rm -f try.*
13571         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13572         ;;
13573 *)      db_hashtype=u_int32_t
13574         ;;
13575 esac
13576 case "$i_db" in
13577 define)
13578         : Check the return type needed for prefix 
13579         echo " "
13580         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13581         cat >try.c <<EOCP
13582 #$d_const HASCONST
13583 #ifndef HASCONST
13584 #define const
13585 #endif
13586 #include <sys/types.h>
13587 #include <db.h>
13588
13589 #ifndef DB_VERSION_MAJOR
13590 size_t prefix_cb (key1, key2)
13591 const DBT *key1;
13592 const DBT *key2;
13593 {
13594 }
13595 BTREEINFO info;
13596 int main()
13597 {
13598         info.prefix = prefix_cb;
13599 }
13600 #endif
13601 EOCP
13602         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13603                 if $contains warning try.out >>/dev/null 2>&1 ; then
13604                         db_prefixtype='int'
13605                 else
13606                         db_prefixtype='size_t'
13607                 fi
13608         else
13609                 db_prefixtype='size_t'
13610                 : XXX Maybe we should just give up here.
13611                 $cat try.out >&4
13612                 echo "Help:  I can't seem to compile the db test program." >&4
13613                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13614         fi
13615         $rm -f try.*
13616         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13617         ;;
13618 *)      db_prefixtype='size_t'
13619         ;;
13620 esac
13621
13622
13623 : How can we generate normalized random numbers ?
13624 echo " "
13625 echo "Looking for a random number function..." >&4
13626 case "$randfunc" in
13627 '')
13628         if set drand48 val -f; eval $csym; $val; then
13629                 dflt="drand48"
13630                 echo "Good, found drand48()." >&4
13631         elif set random val -f; eval $csym; $val; then
13632                 dflt="random"
13633                 echo "OK, found random()." >&4
13634         else
13635                 dflt="rand"
13636                 echo "Yick, looks like I have to use rand()." >&4
13637         fi
13638         echo " "
13639         ;;
13640 *)
13641         dflt="$randfunc"
13642         ;;
13643 esac
13644 cont=true
13645
13646 case "$ccflags" in
13647 *-Dmy_rand=*|*-Dmy_srand=*)
13648         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13649         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13650         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13651         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13652         ;;
13653 esac
13654
13655 while $test "$cont"; do
13656         rp="Use which function to generate random numbers?"
13657         . ./myread
13658         if $test "$ans" = "$dflt"; then
13659                 : null
13660         else
13661                 randbits=''
13662         fi
13663         randfunc="$ans"
13664         if set $ans val -f; eval $csym; $val; then
13665                 cont=''
13666         else
13667                 dflt=y
13668                 rp="I cannot find function $ans. Use that name anyway?"
13669                 . ./myread
13670                 dflt=rand
13671                 case "$ans" in
13672                         [yY]*) cont='';;
13673                 esac
13674         fi
13675         case "$cont" in
13676         '')
13677                 case "$randfunc" in
13678                 drand48)
13679                         drand01="drand48()"
13680                         seedfunc="srand48"
13681                         randbits=48
13682                         randseedtype=long
13683                         ;;
13684                 rand|random)
13685                         case "$randbits" in
13686                         '')
13687 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13688                                 $cat >try.c <<EOCP
13689 #$i_unistd I_UNISTD
13690 #$i_stdlib I_STDLIB
13691 #include <stdio.h>
13692 #ifdef I_UNISTD
13693 #  include <unistd.h>
13694 #endif
13695 #ifdef I_STDLIB
13696 #  include <stdlib.h>
13697 #endif
13698 int main()
13699 {
13700         register int i;
13701         register unsigned long tmp;
13702         register unsigned long max = 0L;
13703
13704         for (i = 1000; i; i--) {
13705                 tmp = (unsigned long) $randfunc();
13706                 if (tmp > max) max = tmp;
13707         }
13708         for (i = 0; max; i++)
13709                 max /= 2;
13710         printf("%d\n",i);
13711 }
13712 EOCP
13713                                 set try
13714                                 if eval $compile_ok; then
13715                                         dflt=`try`
13716                                 else
13717                                         dflt='?'
13718                                         echo "(I can't seem to compile the test program...)"
13719                                 fi
13720                                 ;;
13721                         *)
13722                                 dflt="$randbits"
13723                                 ;;
13724                         esac
13725                         rp="How many bits does your $randfunc() function produce?"
13726                         . ./myread
13727                         randbits="$ans"
13728                         $rm -f try.c try
13729                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13730                         seedfunc="s$randfunc"
13731                         randseedtype=unsigned
13732                         ;;
13733                 *)
13734                         dflt="31"
13735                         rp="How many bits does your $randfunc() function produce?"
13736                         . ./myread
13737                         randbits="$ans"
13738                         seedfunc="s$randfunc"
13739                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13740                         if set $seedfunc val -f; eval $csym; $val; then
13741                                 echo "(Using $seedfunc() to seed random generator)"
13742                         else
13743                                 echo "(Warning: no $seedfunc() to seed random generator)"
13744                                 seedfunc=rand
13745                         fi
13746                         randseedtype=unsigned
13747                         ;;
13748                 esac
13749                 ;;
13750         esac
13751 done
13752
13753 echo " "
13754 echo "Determining whether or not we are on an EBCDIC system..." >&4
13755 $cat >try.c <<'EOM'
13756 int main()
13757 {
13758   if ('M'==0xd4) return 0;
13759   return 1;
13760 }
13761 EOM
13762
13763 val=$undef
13764 set try
13765 if eval $compile_ok; then
13766         if $run ./try; then
13767                 echo "You seem to speak EBCDIC." >&4
13768                 val="$define"
13769         else
13770                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
13771         fi
13772 else
13773         echo "I'm unable to compile the test program." >&4
13774         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13775 fi
13776 $rm -f try try.*
13777 set ebcdic
13778 eval $setvar
13779
13780 echo " "
13781 $cat >&4 <<EOM
13782 Checking how to flush all pending stdio output...
13783 EOM
13784 # I only know how to find the first 32 possibly open files on SunOS.
13785 # See also hints/sunos_4_1.sh and util.c  --AD
13786 case "$osname" in
13787 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13788 esac
13789 $cat >>try.c <<EOCP
13790 #include <stdio.h>
13791 #$i_unistd I_UNISTD
13792 #ifdef I_UNISTD
13793 # include <unistd.h>
13794 #endif
13795 #$d_sysconf HAS_SYSCONF
13796 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13797 #ifdef HAS_STDIO_STREAM_ARRAY
13798 # define STDIO_STREAM_ARRAY $stdio_stream_array
13799 #endif
13800 int main() {
13801   FILE* p;
13802   unlink("try.out");
13803   p = fopen("try.out", "w");
13804 #ifdef TRY_FPUTC
13805   fputc('x', p);
13806 #else
13807 # ifdef TRY_FPRINTF
13808   fprintf(p, "x");
13809 # endif
13810 #endif
13811 #ifdef TRY_FFLUSH_NULL
13812   fflush(NULL);
13813 #endif
13814 #ifdef TRY_FFLUSH_ALL
13815   {
13816     long open_max = -1;
13817 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13818     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13819 # else
13820 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13821     open_max = sysconf(_SC_OPEN_MAX);
13822 #  else
13823 #   ifdef FOPEN_MAX
13824     open_max = FOPEN_MAX;
13825 #   else
13826 #    ifdef OPEN_MAX
13827     open_max = OPEN_MAX;
13828 #    else
13829 #     ifdef _NFILE
13830     open_max = _NFILE;
13831 #     endif
13832 #    endif
13833 #   endif
13834 #  endif
13835 # endif 
13836 # ifdef HAS_STDIO_STREAM_ARRAY
13837     if (open_max > 0) {
13838       long i;
13839       for (i = 0; i < open_max; i++)
13840             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13841                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13842                 STDIO_STREAM_ARRAY[i]._flag)
13843                 fflush(&STDIO_STREAM_ARRAY[i]);
13844     }   
13845   }
13846 # endif
13847 #endif
13848   _exit(42);
13849 }
13850 EOCP
13851 : first we have to find out how _not_ to flush
13852 $to try.c
13853 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13854     output=''
13855     set try -DTRY_FPUTC
13856     if eval $compile; then
13857             $run ./try 2>/dev/null
13858             code="$?"
13859             $from try.out
13860             if $test ! -s try.out -a "X$code" = X42; then
13861                 output=-DTRY_FPUTC
13862             fi
13863     fi
13864     case "$output" in
13865     '')
13866             set try -DTRY_FPRINTF
13867             if eval $compile; then
13868                     $run ./try 2>/dev/null
13869                     code="$?"
13870                     $from try.out
13871                     if $test ! -s try.out -a "X$code" = X42; then
13872                         output=-DTRY_FPRINTF
13873                     fi
13874             fi
13875         ;;
13876     esac
13877 fi
13878 : check for fflush NULL behaviour
13879 case "$fflushNULL" in
13880 '')     set try -DTRY_FFLUSH_NULL $output
13881         if eval $compile; then
13882                 $run ./try 2>/dev/null
13883                 code="$?"
13884                 $from try.out
13885                 if $test -s try.out -a "X$code" = X42; then
13886                         fflushNULL="`$cat try.out`"
13887                 else
13888                         if $test "X$code" != X42; then
13889                                 $cat >&4 <<EOM
13890 (If this test failed, don't worry, we'll try another method shortly.)
13891 EOM
13892                         fi
13893                 fi
13894         fi
13895         $rm -f core try.core core.try.*
13896         case "$fflushNULL" in
13897         x)      $cat >&4 <<EOM
13898 Your fflush(NULL) works okay for output streams.
13899 Let's see if it clobbers input pipes...
13900 EOM
13901 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13902 # bug that improperly flushes the input end of pipes.  So we avoid the
13903 # autoflush on fork/system/exec support for now. :-(
13904 $cat >tryp.c <<EOCP
13905 #include <stdio.h>
13906 int
13907 main(int argc, char **argv)
13908 {
13909     char buf[1024];
13910     int i;
13911     char *bp = buf;
13912     while (1) {
13913         while ((i = getc(stdin)) != -1
13914                && (*bp++ = i) != '\n'
13915                && bp < &buf[1024])
13916         /* DO NOTHING */ ;
13917         *bp = '\0';
13918         fprintf(stdout, "%s", buf);
13919         fflush(NULL);
13920         if (i == -1)
13921             return 0;
13922         bp = buf;
13923     }
13924 }
13925 EOCP
13926                 fflushNULL="$define"
13927                 set tryp
13928                 if eval $compile; then
13929                     $rm -f tryp.out
13930                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
13931                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13932                        $cat >&4 <<EOM
13933 fflush(NULL) seems to behave okay with input streams.
13934 EOM
13935                         fflushNULL="$define"
13936                     else
13937                         $cat >&4 <<EOM
13938 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13939 EOM
13940                         fflushNULL="$undef"
13941                     fi
13942                 fi
13943                 $rm -f core tryp.c tryp.core core.tryp.*
13944                 ;;
13945         '')     $cat >&4 <<EOM
13946 Your fflush(NULL) isn't working (contrary to ANSI C).
13947 EOM
13948                 fflushNULL="$undef"
13949                 ;;
13950         *)      $cat >&4 <<EOM
13951 Cannot figure out whether your fflush(NULL) works or not.
13952 I'm assuming it doesn't (contrary to ANSI C).
13953 EOM
13954                 fflushNULL="$undef"
13955                 ;;
13956         esac
13957         ;;
13958 $define|true|[yY]*)
13959         fflushNULL="$define"
13960         ;;
13961 *)
13962         fflushNULL="$undef"
13963         ;;
13964 esac
13965 : check explicit looping only if NULL did not work, and if the pipe
13966 : bug does not show up on an explicit flush too
13967 case "$fflushNULL" in
13968 "$undef")
13969         $cat >tryp.c <<EOCP
13970 #include <stdio.h>
13971 int
13972 main(int argc, char **argv)
13973 {
13974     char buf[1024];
13975     int i;
13976     char *bp = buf;
13977     while (1) {
13978         while ((i = getc(stdin)) != -1
13979                && (*bp++ = i) != '\n'
13980                && bp < &buf[1024])
13981         /* DO NOTHING */ ;
13982         *bp = '\0';
13983         fprintf(stdout, "%s", buf);
13984         fflush(stdin);
13985         if (i == -1)
13986             return 0;
13987         bp = buf;
13988     }
13989 }
13990 EOCP
13991         set tryp
13992         if eval $compile; then
13993             $rm -f tryp.out
13994             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
13995             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13996                $cat >&4 <<EOM
13997 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13998 EOM
13999                 : now check for fflushall behaviour
14000                 case "$fflushall" in
14001                 '')     set try -DTRY_FFLUSH_ALL $output
14002                         if eval $compile; then
14003                                 $cat >&4 <<EOM
14004 (Now testing the other method--but note that this also may fail.)
14005 EOM
14006                                 $run ./try 2>/dev/null
14007                                 code=$?
14008                                 $from try.out
14009                                 if $test -s try.out -a "X$code" = X42; then
14010                                         fflushall="`$cat try.out`"
14011                                 fi
14012                         fi
14013                         $rm -f core try.core core.try.*
14014                         case "$fflushall" in
14015                         x)      $cat >&4 <<EOM
14016 Whew. Flushing explicitly all the stdio streams works.
14017 EOM
14018                                 fflushall="$define"
14019                                 ;;
14020                         '')     $cat >&4 <<EOM
14021 Sigh. Flushing explicitly all the stdio streams doesn't work.
14022 EOM
14023                                 fflushall="$undef"
14024                                 ;;
14025                         *)      $cat >&4 <<EOM
14026 Cannot figure out whether flushing stdio streams explicitly works or not.
14027 I'm assuming it doesn't.
14028 EOM
14029                                 fflushall="$undef"
14030                                 ;;
14031                         esac
14032                         ;;
14033                 "$define"|true|[yY]*)
14034                         fflushall="$define"
14035                         ;;
14036                 *)
14037                         fflushall="$undef"
14038                         ;;
14039                 esac
14040             else
14041                 $cat >&4 <<EOM
14042 All is futile.  Even fflush(stdin) clobbers input pipes!
14043 EOM
14044                 fflushall="$undef"
14045             fi
14046         else
14047             fflushall="$undef"
14048         fi
14049         $rm -f core tryp.c tryp.core core.tryp.*
14050         ;;
14051 *)      fflushall="$undef"
14052         ;;
14053 esac
14054
14055 case "$fflushNULL$fflushall" in
14056 undefundef)
14057         $cat <<EOM
14058 OK, I give up.  I cannot figure out how to flush pending stdio output.
14059 We won't be flushing handles at all before fork/exec/popen.
14060 EOM
14061         ;;
14062 esac
14063 $rm -f try.* try$exe_ext
14064
14065 : Store the full pathname to the ar program for use in the C program
14066 : Respect a hint or command line value for full_ar.
14067 case "$full_ar" in
14068 '') full_ar=$ar ;;
14069 esac
14070
14071 : Store the full pathname to the sed program for use in the C program
14072 full_sed=$sed
14073
14074 : see what type gids are declared as in the kernel
14075 echo " "
14076 echo "Looking for the type for group ids returned by getgid()."
14077 set gid_t gidtype xxx stdio.h sys/types.h
14078 eval $typedef
14079 case "$gidtype" in
14080 xxx)
14081         xxx=`./findhdr sys/user.h`
14082         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
14083         case $1 in
14084         unsigned) dflt="$1 $2" ;;
14085         *) dflt="$1" ;;
14086         esac
14087         ;;
14088 *) dflt="$gidtype";;
14089 esac
14090 case "$gidtype" in
14091 gid_t) echo "gid_t found." ;;
14092 *)      rp="What is the type for group ids returned by getgid()?"
14093         . ./myread
14094         gidtype="$ans"
14095         ;;
14096 esac
14097
14098 echo " "
14099 case "$gidtype" in
14100 *_t) zzz="$gidtype"     ;;
14101 *)   zzz="gid"          ;;
14102 esac
14103 echo "Checking the size of $zzz..." >&4 
14104 cat > try.c <<EOCP
14105 #include <sys/types.h>
14106 #include <stdio.h>
14107 int main() {
14108     printf("%d\n", (int)sizeof($gidtype));
14109     exit(0);
14110 }
14111 EOCP
14112 set try
14113 if eval $compile_ok; then
14114         yyy=`$run ./try`
14115         case "$yyy" in
14116         '')     gidsize=4
14117                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
14118                 ;;
14119         *)      gidsize=$yyy
14120                 echo "Your $zzz is $gidsize bytes long."
14121                 ;;
14122         esac
14123 else
14124         gidsize=4
14125         echo "(I can't compile the test program--guessing $gidsize.)" >&4
14126 fi
14127
14128
14129 echo " "
14130 case "$gidtype" in
14131 *_t) zzz="$gidtype"     ;;
14132 *)   zzz="gid"          ;;
14133 esac
14134 echo "Checking the sign of $zzz..." >&4 
14135 cat > try.c <<EOCP
14136 #include <sys/types.h>
14137 #include <stdio.h>
14138 int main() {
14139         $gidtype foo = -1;
14140         if (foo < 0)
14141                 printf("-1\n");
14142         else
14143                 printf("1\n");
14144 }
14145 EOCP
14146 set try
14147 if eval $compile; then
14148         yyy=`$run ./try`
14149         case "$yyy" in
14150         '')     gidsign=1
14151                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14152                 ;;
14153         *)      gidsign=$yyy
14154                 case "$gidsign" in
14155                  1) echo "Your $zzz is unsigned." ;;
14156                 -1) echo "Your $zzz is signed."   ;;
14157                 esac
14158                 ;;
14159         esac
14160 else
14161         gidsign=1
14162         echo "(I can't compile the test program--guessing unsigned.)" >&4
14163 fi
14164
14165
14166 echo " "
14167
14168 if $test X"$quadtype" != X; then
14169
14170 echo "Checking how to print 64-bit integers..." >&4
14171
14172 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
14173         $cat >try.c <<'EOCP'
14174 #include <sys/types.h>
14175 #include <stdio.h>
14176 int main() {
14177   int q = 12345678901;
14178   printf("%ld\n", q);
14179 }
14180 EOCP
14181         set try
14182         if eval $compile; then
14183                 yyy=`$run ./try`
14184                 case "$yyy" in
14185                 12345678901)
14186                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
14187                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
14188                         echo "We will use %d."
14189                         ;;
14190                 esac
14191         fi
14192 fi
14193
14194 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
14195         $cat >try.c <<'EOCP'
14196 #include <sys/types.h>
14197 #include <stdio.h>
14198 int main() {
14199   long q = 12345678901;
14200   printf("%ld\n", q);
14201 }
14202 EOCP
14203         set try
14204         if eval $compile; then
14205                 yyy=`$run ./try`
14206                 case "$yyy" in
14207                 12345678901)
14208                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
14209                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
14210                         echo "We will use %ld."
14211                         ;;
14212                 esac
14213         fi
14214 fi
14215
14216 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
14217         $cat >try.c <<'EOCP'
14218 #include <sys/types.h>
14219 #include <inttypes.h>
14220 #include <stdio.h>
14221 int main() {
14222   int64_t q = 12345678901;
14223   printf("%" PRId64 "\n", q);
14224 }
14225 EOCP
14226         set try
14227         if eval $compile; then
14228                 yyy=`$run ./try`
14229                 case "$yyy" in
14230                 12345678901)
14231                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
14232                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
14233                         echo "We will use the C9X style."
14234                         ;;
14235                 esac
14236         fi
14237 fi
14238
14239 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14240         $cat >try.c <<EOCP
14241 #include <sys/types.h>
14242 #include <stdio.h>
14243 int main() {
14244   $quadtype q = 12345678901;
14245   printf("%Ld\n", q);
14246 }
14247 EOCP
14248         set try
14249         if eval $compile; then
14250                 yyy=`$run ./try`
14251                 case "$yyy" in
14252                 12345678901)
14253                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
14254                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
14255                         echo "We will use %Ld."
14256                         ;;
14257                 esac
14258         fi
14259 fi
14260
14261 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
14262         $cat >try.c <<'EOCP'
14263 #include <sys/types.h>
14264 #include <stdio.h>
14265 int main() {
14266   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
14267   printf("%lld\n", q);
14268 }
14269 EOCP
14270         set try
14271         if eval $compile; then
14272                 yyy=`$run ./try`
14273                 case "$yyy" in
14274                 12345678901)
14275                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
14276                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
14277                         echo "We will use the %lld style."
14278                         ;;
14279                 esac
14280         fi
14281 fi
14282
14283 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14284         $cat >try.c <<EOCP
14285 #include <sys/types.h>
14286 #include <stdio.h>
14287 int main() {
14288   $quadtype q = 12345678901;
14289   printf("%qd\n", q);
14290 }
14291 EOCP
14292         set try
14293         if eval $compile; then
14294                 yyy=`$run ./try`
14295                 case "$yyy" in
14296                 12345678901)
14297                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14298                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14299                         echo "We will use %qd."
14300                         ;;
14301                 esac
14302         fi
14303 fi
14304
14305 if $test X"$sPRId64" = X; then
14306         echo "Cannot figure out how to print 64-bit integers." >&4
14307 fi
14308
14309 $rm -f try try.*
14310
14311 fi
14312
14313 case "$sPRId64" in
14314 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
14315         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
14316         ;;
14317 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
14318         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
14319         ;;
14320 esac
14321
14322
14323 echo " "
14324 $echo "Checking the format strings to be used for Perl's internal types..." >&4
14325
14326 if $test X"$ivsize" = X8; then
14327         ivdformat="$sPRId64"
14328         uvuformat="$sPRIu64"
14329         uvoformat="$sPRIo64"
14330         uvxformat="$sPRIx64"
14331         uvXUformat="$sPRIXU64"
14332 else
14333         if $test X"$ivsize" = X"$longsize"; then
14334                 ivdformat='"ld"'
14335                 uvuformat='"lu"'
14336                 uvoformat='"lo"'
14337                 uvxformat='"lx"'
14338                 uvXUformat='"lX"'
14339         else
14340                 if $test X"$ivsize" = X"$intsize"; then
14341                         ivdformat='"d"'
14342                         uvuformat='"u"'
14343                         uvoformat='"o"'
14344                         uvxformat='"x"'
14345                         uvXUformat='"X"'
14346                 else
14347                         : far out
14348                         if $test X"$ivsize" = X"$shortsize"; then
14349                                 ivdformat='"hd"'
14350                                 uvuformat='"hu"'
14351                                 uvoformat='"ho"'
14352                                 uvxformat='"hx"'
14353                                 uvXUformat='"hX"'
14354                         fi
14355                 fi
14356         fi
14357 fi
14358
14359 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14360         nveformat="$sPRIeldbl"
14361         nvfformat="$sPRIfldbl"
14362         nvgformat="$sPRIgldbl"
14363         nvEUformat="$sPRIEUldbl"
14364         nvFUformat="$sPRIFUldbl"
14365         nvGUformat="$sPRIGUldbl"
14366 else
14367         nveformat='"e"'
14368         nvfformat='"f"'
14369         nvgformat='"g"'
14370         nvEUformat='"E"'
14371         nvFUformat='"F"'
14372         nvGUformat='"G"'
14373 fi
14374
14375 case "$ivdformat" in
14376 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14377     exit 1
14378     ;;
14379 esac
14380
14381
14382 echo " "
14383 $echo "Checking the format string to be used for gids..." >&4
14384
14385 case "$gidsign" in
14386 -1)     if $test X"$gidsize" = X"$ivsize"; then
14387                 gidformat="$ivdformat"
14388         else
14389                 if $test X"$gidsize" = X"$longsize"; then
14390                         gidformat='"ld"'
14391                 else
14392                         if $test X"$gidsize" = X"$intsize"; then
14393                                 gidformat='"d"'
14394                         else
14395                                 if $test X"$gidsize" = X"$shortsize"; then
14396                                         gidformat='"hd"'
14397                                 fi
14398                         fi
14399                 fi
14400         fi
14401         ;;
14402 *)      if $test X"$gidsize" = X"$uvsize"; then
14403                 gidformat="$uvuformat"
14404         else
14405                 if $test X"$gidsize" = X"$longsize"; then
14406                         gidformat='"lu"'
14407                 else
14408                         if $test X"$gidsize" = X"$intsize"; then
14409                                 gidformat='"u"'
14410                         else
14411                                 if $test X"$gidsize" = X"$shortsize"; then
14412                                         gidformat='"hu"'
14413                                 fi
14414                         fi
14415                 fi
14416         fi
14417         ;;
14418 esac
14419
14420 : see if getgroups exists
14421 set getgroups d_getgrps
14422 eval $inlibc
14423
14424 : see if setgroups exists
14425 set setgroups d_setgrps
14426 eval $inlibc
14427
14428
14429 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14430 echo " "
14431 case "$d_getgrps$d_setgrps" in
14432 *define*)
14433         case "$groupstype" in
14434         '') dflt="$gidtype" ;;
14435         *)  dflt="$groupstype" ;;
14436         esac
14437         $cat <<EOM
14438 What type of pointer is the second argument to getgroups() and setgroups()?
14439 Usually this is the same as group ids, $gidtype, but not always.
14440
14441 EOM
14442         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14443         . ./myread
14444         groupstype="$ans"
14445         ;;
14446 *)  groupstype="$gidtype";;
14447 esac
14448
14449 echo " "
14450 echo "Checking if your $make program sets \$(MAKE)..." >&4
14451 case "$make_set_make" in
14452 '')
14453         $sed 's/^X //' > testmake.mak << 'EOF'
14454 Xall:
14455 X       @echo 'maketemp="$(MAKE)"'
14456 EOF
14457         case "`$make -f testmake.mak 2>/dev/null`" in
14458         *maketemp=*) make_set_make='#' ;;
14459         *)      make_set_make="MAKE=$make" ;;
14460         esac
14461         $rm -f testmake.mak
14462         ;;
14463 esac
14464 case "$make_set_make" in
14465 '#') echo "Yup, it does.";;
14466 *) echo "Nope, it doesn't.";;
14467 esac
14468
14469 : see what type is used for mode_t
14470 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14471 set mode_t modetype int stdio.h sys/types.h
14472 eval $typedef_ask
14473
14474 : see if stdarg is available
14475 echo " "
14476 if $test `./findhdr stdarg.h`; then
14477         echo "<stdarg.h> found." >&4
14478         valstd="$define"
14479 else
14480         echo "<stdarg.h> NOT found." >&4
14481         valstd="$undef"
14482 fi
14483
14484 : see if varags is available
14485 echo " "
14486 if $test `./findhdr varargs.h`; then
14487         echo "<varargs.h> found." >&4
14488 else
14489         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14490 fi
14491
14492 : set up the varargs testing programs
14493 $cat > varargs.c <<EOP
14494 #ifdef I_STDARG
14495 #include <stdarg.h>
14496 #endif
14497 #ifdef I_VARARGS
14498 #include <varargs.h>
14499 #endif
14500
14501 #ifdef I_STDARG
14502 int f(char *p, ...)
14503 #else
14504 int f(va_alist)
14505 va_dcl
14506 #endif
14507 {
14508         va_list ap;
14509 #ifndef I_STDARG
14510         char *p;
14511 #endif
14512 #ifdef I_STDARG
14513         va_start(ap,p);
14514 #else
14515         va_start(ap);
14516         p = va_arg(ap, char *);
14517 #endif
14518         va_end(ap);
14519 }
14520 EOP
14521 $cat > varargs <<EOP
14522 $startsh
14523 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14524         echo "true"
14525 else
14526         echo "false"
14527 fi
14528 $rm -f varargs$_o
14529 EOP
14530 chmod +x varargs
14531
14532 : now check which varargs header should be included
14533 echo " "
14534 i_varhdr=''
14535 case "$valstd" in
14536 "$define")
14537         if `./varargs I_STDARG`; then
14538                 val='stdarg.h'
14539         elif `./varargs I_VARARGS`; then
14540                 val='varargs.h'
14541         fi
14542         ;;
14543 *)
14544         if `./varargs I_VARARGS`; then
14545                 val='varargs.h'
14546         fi
14547         ;;
14548 esac
14549 case "$val" in
14550 '')
14551 echo "I could not find the definition for va_dcl... You have problems..." >&4
14552         val="$undef"; set i_stdarg; eval $setvar
14553         val="$undef"; set i_varargs; eval $setvar
14554         ;;
14555 *) 
14556         set i_varhdr
14557         eval $setvar
14558         case "$i_varhdr" in
14559         stdarg.h)
14560                 val="$define"; set i_stdarg; eval $setvar
14561                 val="$undef"; set i_varargs; eval $setvar
14562                 ;;
14563         varargs.h)
14564                 val="$undef"; set i_stdarg; eval $setvar
14565                 val="$define"; set i_varargs; eval $setvar
14566                 ;;
14567         esac
14568         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14569 esac
14570 $rm -f varargs*
14571
14572 : see if we need va_copy
14573 echo " "
14574 case "$i_stdarg" in
14575 "$define")
14576         $cat >try.c <<EOCP
14577 #include <stdarg.h>
14578 #include <stdio.h>
14579 #$i_stdlib I_STDLIB
14580 #ifdef I_STDLIB
14581 #include <stdlib.h>
14582 #endif
14583 #include <signal.h>
14584
14585 int
14586 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14587 {
14588   return vfprintf(f, fmt, *valp);
14589 }
14590  
14591 int    
14592 myvfprintf(FILE *f, const  char *fmt, va_list val)
14593 {
14594   return ivfprintf(f, fmt, &val);
14595 }
14596       
14597 int
14598 myprintf(char *fmt, ...) 
14599 {
14600   va_list val;
14601   va_start(val, fmt);
14602   return myvfprintf(stdout, fmt, val); 
14603 }         
14604
14605 int
14606 main(int ac, char **av)
14607 {
14608   signal(SIGSEGV, exit);
14609
14610   myprintf("%s%cs all right, then\n", "that", '\'');                            
14611   exit(0);      
14612 }
14613 EOCP
14614         set try
14615         if eval $compile && $run ./try 2>&1 >/dev/null; then
14616                 case "`$run ./try`" in
14617                 "that's all right, then")
14618                         okay=yes
14619                         ;;
14620                 esac
14621         fi
14622         case "$okay" in
14623         yes)    echo "It seems that you don't need va_copy()." >&4
14624                 need_va_copy="$undef"
14625                 ;;
14626         *)      echo "It seems that va_copy() or similar will be needed." >&4
14627                 need_va_copy="$define"
14628                 ;;
14629         esac
14630         $rm -f try.* core core.* *.core *.core.*
14631         ;;
14632 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14633         ;;
14634 esac
14635
14636 : define a fucntion to check prototypes
14637 $cat > protochk <<EOSH
14638 $startsh
14639 cc="$cc"
14640 optimize="$optimize"
14641 ccflags="$ccflags"
14642 prototype="$prototype"
14643 define="$define"
14644 rm=$rm
14645 EOSH
14646
14647 $cat >> protochk <<'EOSH'
14648
14649 $rm -f try.c
14650 foo="$1"
14651 shift
14652 while test $# -ge 2; do
14653         case "$1" in
14654                 $define) echo "#include <$2>" >> try.c ;;
14655                 literal) echo "$2" >> try.c ;;
14656         esac
14657     shift 2
14658 done
14659 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14660 cat >> try.c <<'EOCP'
14661 #ifdef CAN_PROTOTYPE
14662 #define _(args) args
14663 #else
14664 #define _(args) ()
14665 #endif
14666 EOCP
14667 echo "$foo" >> try.c
14668 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14669 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14670 status=$?
14671 $rm -f try.[co]
14672 exit $status
14673 EOSH
14674 chmod +x protochk
14675 $eunicefix protochk
14676
14677 : see what type is used for size_t
14678 rp="What is the type used for the length parameter for string functions?"
14679 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14680 eval $typedef_ask
14681
14682 : check for type of arguments to gethostbyaddr. 
14683 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14684         case "$d_gethbyaddr" in
14685         $define)
14686                 $cat <<EOM
14687
14688 Checking to see what type of arguments are accepted by gethostbyaddr().
14689 EOM
14690                 hdrs="$define sys/types.h
14691                         $d_socket sys/socket.h 
14692                         $i_niin netinet/in.h 
14693                         $i_netdb netdb.h
14694                         $i_unistd unistd.h"
14695                 : The first arg can 'char *' or 'void *'
14696                 : The second arg is some of integral type
14697                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14698                         for yyy in size_t long int; do
14699                                 case "$netdb_host_type" in
14700                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14701                                         if ./protochk "$try" $hdrs; then
14702                                                 echo "Your system accepts $xxx for the first arg."
14703                                                 echo "...and $yyy for the second arg."
14704                                                 netdb_host_type="$xxx"
14705                                                 netdb_hlen_type="$yyy"
14706                                         fi
14707                                         ;;
14708                                 esac
14709                         done
14710                 done
14711                 : In case none of those worked, prompt the user.
14712                 case "$netdb_host_type" in
14713                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14714                         dflt='char *'
14715                         . ./myread
14716                         netdb_host_type=$ans
14717                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14718                         dflt="$sizetype"
14719                         . ./myread
14720                         netdb_hlen_type=$ans
14721                         ;;
14722                 esac
14723                 ;;
14724         *)      : no gethostbyaddr, so pick harmless defaults
14725                 netdb_host_type='char *'
14726                 netdb_hlen_type="$sizetype"
14727                 ;;
14728         esac
14729         # Remove the "const" if needed. -- but then we'll have a 
14730         # prototype clash!
14731         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14732 fi
14733
14734 : check for type of argument to gethostbyname. 
14735 if test "X$netdb_name_type" = X ; then
14736         case "$d_gethbyname" in
14737         $define)
14738                 $cat <<EOM
14739
14740 Checking to see what type of argument is accepted by gethostbyname().
14741 EOM
14742                 hdrs="$define sys/types.h
14743                         $d_socket sys/socket.h 
14744                         $i_niin netinet/in.h 
14745                         $i_netdb netdb.h
14746                         $i_unistd unistd.h"
14747                 for xxx in "const char *" "char *"; do
14748                         case "$netdb_name_type" in
14749                         '')     try="extern struct hostent *gethostbyname($xxx);"
14750                                 if ./protochk "$try" $hdrs; then
14751                                         echo "Your system accepts $xxx."
14752                                         netdb_name_type="$xxx"
14753                                 fi
14754                                 ;;
14755                         esac
14756                 done
14757                 : In case none of those worked, prompt the user.
14758                 case "$netdb_name_type" in
14759                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14760                         dflt='char *'
14761                         . ./myread
14762                         netdb_name_type=$ans
14763                         ;;
14764                 esac
14765                 ;;
14766         *)      : no gethostbyname, so pick harmless default
14767                 netdb_name_type='char *'
14768                 ;;
14769         esac
14770 fi
14771
14772 : check for type of 1st argument to getnetbyaddr. 
14773 if test "X$netdb_net_type" = X ; then
14774         case "$d_getnbyaddr" in
14775         $define)
14776                 $cat <<EOM
14777
14778 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14779 EOM
14780                 hdrs="$define sys/types.h
14781                         $d_socket sys/socket.h 
14782                         $i_niin netinet/in.h 
14783                         $i_netdb netdb.h
14784                         $i_unistd unistd.h"
14785                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14786                         case "$netdb_net_type" in
14787                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14788                                 if ./protochk "$try" $hdrs; then
14789                                         echo "Your system accepts $xxx."
14790                                         netdb_net_type="$xxx"
14791                                 fi
14792                                 ;;
14793                         esac
14794                 done
14795                 : In case none of those worked, prompt the user.
14796                 case "$netdb_net_type" in
14797                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14798                         dflt='long'
14799                         . ./myread
14800                         netdb_net_type=$ans
14801                         ;;
14802                 esac
14803                 ;;
14804         *)      : no getnetbyaddr, so pick harmless default
14805                 netdb_net_type='long'
14806                 ;;
14807         esac
14808 fi
14809 : locate the preferred pager for this system
14810 case "$pager" in
14811 '')
14812         dflt=''
14813         case "$pg" in
14814         /*) dflt=$pg;;
14815         [a-zA-Z]:/*) dflt=$pg;;
14816         esac
14817         case "$more" in
14818         /*) dflt=$more;;
14819         [a-zA-Z]:/*) dflt=$more;;
14820         esac
14821         case "$less" in
14822         /*) dflt=$less;;
14823         [a-zA-Z]:/*) dflt=$less;;
14824         esac
14825         case "$dflt" in
14826         '') dflt=/usr/ucb/more;;
14827         esac
14828         ;;
14829 *) dflt="$pager";;
14830 esac
14831 echo " "
14832 fn=f/
14833 rp='What pager is used on your system?'
14834 . ./getfile
14835 pager="$ans"
14836
14837 : see what type pids are declared as in the kernel
14838 rp="What is the type of process ids on this system?"
14839 set pid_t pidtype int stdio.h sys/types.h
14840 eval $typedef_ask
14841
14842 : Find earliest binary compatible site_perl subdirectory perl can use.
14843 case "$bincompat5005" in
14844 "$define") xs_apiversion='5.005' ;;
14845 *) xs_apiversion=$version ;;   # The current site_perl version.
14846 esac
14847 : Find earliest pure perl site_perl subdirectory perl can use.
14848 : The versioned directories started at 5.005.
14849 pm_apiversion='5.005'
14850
14851 : see if ar generates random libraries by itself
14852 echo " "
14853 echo "Checking how to generate random libraries on your machine..." >&4
14854 echo 'int bar1() { return bar2(); }' > bar1.c
14855 echo 'int bar2() { return 2; }' > bar2.c
14856 $cat > foo.c <<'EOP'
14857 int main() { printf("%d\n", bar1()); exit(0); }
14858 EOP
14859 $cc $ccflags -c bar1.c >/dev/null 2>&1
14860 $cc $ccflags -c bar2.c >/dev/null 2>&1
14861 $cc $ccflags -c foo.c >/dev/null 2>&1
14862 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14863 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14864         $run ./foobar >/dev/null 2>&1; then
14865         echo "$ar appears to generate random libraries itself."
14866         orderlib=false
14867         ranlib=":"
14868 elif $ar ts bar$_a >/dev/null 2>&1 &&
14869         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14870         $run ./foobar >/dev/null 2>&1; then
14871                 echo "a table of contents needs to be added with '$ar ts'."
14872                 orderlib=false
14873                 ranlib="$ar ts"
14874 else
14875         case "$ranlib" in
14876         :) ranlib='';;
14877         '')
14878                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14879                 $test -f $ranlib || ranlib=''
14880                 ;;
14881         esac
14882         if $test -n "$ranlib"; then
14883                 echo "your system has '$ranlib'; we'll use that."
14884                 orderlib=false
14885         else
14886                 echo "your system doesn't seem to support random libraries"
14887                 echo "so we'll use lorder and tsort to order the libraries."
14888                 orderlib=true
14889                 ranlib=":"
14890         fi
14891 fi
14892 $rm -f foo* bar* 
14893
14894 : check for type of arguments to select. 
14895 case "$selecttype" in
14896 '') case "$d_select" in
14897         $define)
14898                 echo " "
14899                 $cat <<EOM
14900 Checking to see what type of arguments are accepted by select().
14901 EOM
14902                 hdrs="$define sys/types.h
14903                         $i_systime sys/time.h 
14904                         $i_sysselct sys/select.h
14905                         $d_socket sys/socket.h"
14906                 : The first arg can be int, unsigned, or size_t
14907                 : The last arg may or may not be 'const'
14908                 val=''
14909                 : void pointer has been seen but using that
14910                 : breaks the selectminbits test
14911                 for xxx in 'fd_set *' 'int *'; do
14912                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14913                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14914                                         case "$val" in
14915                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14916                                                 if ./protochk "$try" $hdrs; then
14917                                                         echo "Your system accepts $xxx."
14918                                                         val="$xxx"
14919                                                 fi
14920                                                 ;;
14921                                         esac
14922                                 done
14923                         done
14924                 done
14925                 case "$val" in
14926                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14927                         case "$d_fd_set" in
14928                                 $define) dflt="fd_set *" ;;
14929                                 *)              dflt="int *" ;;
14930                         esac
14931                         . ./myread
14932                         val=$ans
14933                         ;;
14934                 esac
14935                 selecttype="$val"
14936                 ;;
14937         *)      : no select, so pick a harmless default
14938                 selecttype='int *'
14939                 ;;
14940         esac
14941         ;;
14942 esac
14943
14944 : check for the select 'width'
14945 case "$selectminbits" in
14946 '') case "$d_select" in
14947         $define)
14948                 $cat <<EOM
14949
14950 Checking to see on how many bits at a time your select() operates...
14951 EOM
14952                 $cat >try.c <<EOCP
14953 #include <sys/types.h>
14954 #$i_time I_TIME
14955 #$i_systime I_SYS_TIME
14956 #$i_systimek I_SYS_TIME_KERNEL
14957 #ifdef I_TIME
14958 #   include <time.h>
14959 #endif
14960 #ifdef I_SYS_TIME
14961 #   ifdef I_SYS_TIME_KERNEL
14962 #       define KERNEL
14963 #   endif
14964 #   include <sys/time.h>
14965 #   ifdef I_SYS_TIME_KERNEL
14966 #       undef KERNEL
14967 #   endif
14968 #endif
14969 #$i_sysselct I_SYS_SELECT
14970 #ifdef I_SYS_SELECT
14971 #include <sys/select.h>
14972 #endif
14973 #$d_socket HAS_SOCKET
14974 #ifdef HAS_SOCKET
14975 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14976 #endif
14977 #include <stdio.h>
14978 $selecttype b;
14979 #define S sizeof(*(b))
14980 #define MINBITS 64
14981 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14982 #define NBITS  (NBYTES * 8)
14983 int main() {
14984     char s[NBYTES];
14985     struct timeval t;
14986     int i;
14987     FILE* fp;
14988     int fd;
14989
14990     fclose(stdin);
14991     fp = fopen("try.c", "r");
14992     if (fp == 0)
14993       exit(1);
14994     fd = fileno(fp);
14995     if (fd < 0)
14996       exit(2);
14997     b = ($selecttype)s;
14998     for (i = 0; i < NBITS; i++)
14999         FD_SET(i, b);
15000     t.tv_sec  = 0;
15001     t.tv_usec = 0;
15002     select(fd + 1, b, 0, 0, &t);
15003     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
15004     printf("%d\n", i + 1);
15005     return 0;
15006 }
15007 EOCP
15008                 set try
15009                 if eval $compile_ok; then
15010                         selectminbits=`$run ./try`
15011                         case "$selectminbits" in
15012                         '')     cat >&4 <<EOM
15013 Cannot figure out on how many bits at a time your select() operates.
15014 I'll play safe and guess it is 32 bits.
15015 EOM
15016                                 selectminbits=32
15017                                 bits="32 bits"
15018                                 ;;
15019                         1)      bits="1 bit" ;;
15020                         *)      bits="$selectminbits bits" ;;
15021                         esac
15022                         echo "Your select() operates on $bits at a time." >&4
15023                 else
15024                         rp='What is the minimum number of bits your select() operates on?'
15025                         case "$byteorder" in
15026                         1234|12345678)  dflt=32 ;;
15027                         *)              dflt=1  ;;
15028                         esac
15029                         . ./myread
15030                         val=$ans
15031                         selectminbits="$val"
15032                 fi
15033                 $rm -f try.* try
15034                 ;;
15035         *)      : no select, so pick a harmless default
15036                 selectminbits='32'
15037                 ;;
15038         esac
15039         ;;
15040 esac
15041
15042 : Trace out the files included by signal.h, then look for SIGxxx names.
15043 : Remove SIGARRAYSIZE used by HPUX.
15044 : Remove SIGSTKSIZE used by Linux.
15045 : Remove SIGSTKSZ used by Posix.
15046 : Remove SIGTYP void lines used by OS2.
15047 : Some cpps, like os390, dont give the file name anywhere
15048 if [ "X$fieldn" = X ]; then
15049         : Just make some guesses.  We check them later.
15050         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
15051 else
15052         xxx=`echo '#include <signal.h>' |
15053         $cppstdin $cppminus $cppflags 2>/dev/null |
15054         $grep '^[       ]*#.*include' | 
15055         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
15056 fi
15057 : Check this list of files to be sure we have parsed the cpp output ok.
15058 : This will also avoid potentially non-existent files, such 
15059 : as ../foo/bar.h
15060 xxxfiles=''
15061 for xx in $xxx /dev/null ; do
15062         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
15063 done
15064 : If we have found no files, at least try signal.h
15065 case "$xxxfiles" in
15066 '')     xxxfiles=`./findhdr signal.h` ;;
15067 esac
15068 xxx=`awk '
15069 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
15070         print substr($2, 4, 20)
15071 }
15072 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
15073         print substr($3, 4, 20)
15074 }' $xxxfiles`
15075 : Append some common names just in case the awk scan failed.
15076 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
15077 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
15078 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
15079 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
15080 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
15081
15082 : generate a few handy files for later
15083 $cat > signal.c <<'EOCP'
15084 #include <sys/types.h>
15085 #include <signal.h>
15086 #include <stdio.h>
15087 int main() {
15088
15089 /* Strange style to avoid deeply-nested #if/#else/#endif */
15090 #ifndef NSIG
15091 #  ifdef _NSIG
15092 #    define NSIG (_NSIG)
15093 #  endif
15094 #endif
15095
15096 #ifndef NSIG
15097 #  ifdef SIGMAX
15098 #    define NSIG (SIGMAX+1)
15099 #  endif
15100 #endif
15101
15102 #ifndef NSIG
15103 #  ifdef SIG_MAX
15104 #    define NSIG (SIG_MAX+1)
15105 #  endif
15106 #endif
15107
15108 #ifndef NSIG
15109 #  ifdef MAXSIG
15110 #    define NSIG (MAXSIG+1)
15111 #  endif
15112 #endif
15113
15114 #ifndef NSIG
15115 #  ifdef MAX_SIG
15116 #    define NSIG (MAX_SIG+1)
15117 #  endif
15118 #endif
15119
15120 #ifndef NSIG
15121 #  ifdef SIGARRAYSIZE
15122 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
15123 #  endif
15124 #endif
15125
15126 #ifndef NSIG
15127 #  ifdef _sys_nsig
15128 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
15129 #  endif
15130 #endif
15131
15132 /* Default to some arbitrary number that's big enough to get most
15133    of the common signals.
15134 */
15135 #ifndef NSIG
15136 #    define NSIG 50
15137 #endif
15138
15139 printf("NSIG %d\n", NSIG);
15140
15141 #ifndef JUST_NSIG
15142
15143 EOCP
15144
15145 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
15146 {
15147         printf "#ifdef SIG"; printf $1; printf "\n"
15148         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
15149         printf $1; printf ");\n"
15150         printf "#endif\n"
15151 }
15152 END {
15153         printf "#endif /* JUST_NSIG */\n";
15154         printf "exit(0);\n}\n";
15155 }
15156 ' >>signal.c
15157 $cat >signal.awk <<'EOP'
15158 BEGIN { ndups = 0 }
15159 $1 ~ /^NSIG$/ { nsig = $2 }
15160 ($1 !~ /^NSIG$/) && (NF == 2) {
15161     if ($2 > maxsig) { maxsig = $2 }
15162     if (sig_name[$2]) {
15163         dup_name[ndups] = $1
15164         dup_num[ndups] = $2
15165         ndups++ 
15166     }
15167     else {
15168         sig_name[$2] = $1
15169         sig_num[$2] = $2
15170     }
15171 }
15172 END { 
15173     if (nsig == 0) {
15174         nsig = maxsig + 1
15175     }
15176     printf("NSIG %d\n", nsig);
15177     for (n = 1; n < nsig; n++) {
15178         if (sig_name[n]) {
15179             printf("%s %d\n", sig_name[n], sig_num[n])
15180         }
15181         else {
15182             printf("NUM%d %d\n", n, n) 
15183         }
15184     }
15185     for (n = 0; n < ndups; n++) {
15186         printf("%s %d\n", dup_name[n], dup_num[n])
15187     }
15188 }
15189 EOP
15190 $cat >signal_cmd <<EOS
15191 $startsh
15192 if $test -s signal.lst; then
15193     echo "Using your existing signal.lst file"
15194         exit 0
15195 fi
15196 xxx="$xxx"
15197 EOS
15198 $cat >>signal_cmd <<'EOS'
15199
15200 set signal
15201 if eval $compile_ok; then
15202         $run ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15203 else
15204         echo "(I can't seem be able to compile the whole test program)" >&4
15205         echo "(I'll try it in little pieces.)" >&4
15206         set signal -DJUST_NSIG
15207         if eval $compile_ok; then
15208                 $run ./signal$_exe > signal.nsg
15209                 $cat signal.nsg
15210         else
15211                 echo "I can't seem to figure out how many signals you have." >&4
15212                 echo "Guessing 50." >&4
15213                 echo 'NSIG 50' > signal.nsg
15214         fi
15215         : Now look at all the signal names, one at a time.
15216         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
15217                 $cat > signal.c <<EOCP
15218 #include <sys/types.h>
15219 #include <signal.h>
15220 #include <stdio.h>
15221 int main() {
15222 printf("$xx %d\n", SIG${xx});
15223 return 0;
15224 }
15225 EOCP
15226                 set signal
15227                 if eval $compile; then
15228                         echo "SIG${xx} found."
15229                         $run ./signal$_exe  >> signal.ls1
15230                 else
15231                         echo "SIG${xx} NOT found."
15232                 fi
15233         done
15234         if $test -s signal.ls1; then
15235                 $cat signal.nsg signal.ls1 |
15236                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15237         fi
15238
15239 fi
15240 if $test -s signal.lst; then
15241         :
15242 else
15243         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
15244         echo 'kill -l' >signal
15245         set X `csh -f <signal`
15246         $rm -f signal
15247         shift
15248         case $# in
15249         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
15250         esac
15251         echo $@ | $tr ' ' $trnl | \
15252             $awk '{ printf "%s %d\n", $1, ++s; }
15253                   END { printf "NSIG %d\n", ++s }' >signal.lst
15254 fi
15255 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
15256 EOS
15257 chmod a+x signal_cmd
15258 $eunicefix signal_cmd
15259
15260 : generate list of signal names
15261 echo " "
15262 case "$sig_name_init" in
15263 '') doinit=yes ;;
15264 *)  case "$sig_num_init" in
15265     ''|*,*) doinit=yes ;;
15266     esac ;;
15267 esac
15268 case "$doinit" in
15269 yes)
15270         echo "Generating a list of signal names and numbers..." >&4
15271         . ./signal_cmd
15272         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
15273         sig_name=`$awk 'BEGIN { printf "ZERO " }
15274                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
15275         sig_num=`$awk  'BEGIN { printf "0 " }
15276                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
15277         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
15278                              !/^NSIG/   { printf "\"%s\", ", $1 }
15279                              END        { printf "0\n" }' signal.lst`
15280         sig_num_init=`$awk  'BEGIN      { printf "0, " }
15281                              !/^NSIG/   { printf "%d, ", $2}
15282                              END        { printf "0\n"}' signal.lst`
15283         ;;
15284 esac
15285 echo "The following $sig_count signals are available:"
15286 echo " "
15287 echo $sig_name | $awk \
15288 'BEGIN { linelen = 0 }
15289 {
15290         for (i = 1; i <= NF; i++) {
15291                 name = "SIG" $i " "
15292                 linelen = linelen + length(name)
15293                 if (linelen > 70) {
15294                         printf "\n"
15295                         linelen = length(name)
15296                 }
15297                 printf "%s", name
15298         }
15299         printf "\n"
15300 }'
15301 sig_size=`echo $sig_name | awk '{print NF}'`
15302 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
15303
15304 echo " "
15305 case "$sizetype" in
15306 *_t) zzz="$sizetype"    ;;
15307 *)   zzz="filesize"     ;;
15308 esac
15309 echo "Checking the size of $zzz..." >&4 
15310 cat > try.c <<EOCP
15311 #include <sys/types.h>
15312 #include <stdio.h>
15313 int main() {
15314     printf("%d\n", (int)sizeof($sizetype));
15315     exit(0);
15316 }
15317 EOCP
15318 set try
15319 if eval $compile_ok; then
15320         yyy=`$run ./try`
15321         case "$yyy" in
15322         '')     sizesize=4
15323                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15324                 ;;
15325         *)      sizesize=$yyy
15326                 echo "Your $zzz size is $sizesize bytes."
15327                 ;;
15328         esac
15329 else
15330         sizesize=4
15331         echo "(I can't compile the test program--guessing $sizesize.)" >&4
15332 fi
15333
15334
15335 : check for socklen_t
15336 echo " "
15337 echo "Checking to see if you have socklen_t..." >&4
15338 $cat >try.c <<EOCP
15339 #include <sys/types.h>
15340 #$d_socket HAS_SOCKET
15341 #ifdef HAS_SOCKET
15342 #include <sys/socket.h>
15343 #endif
15344 int main() { socklen_t x = 16; }
15345 EOCP
15346 set try
15347 if eval $compile; then
15348         val="$define"
15349         echo "You have socklen_t."
15350 else
15351         val="$undef"
15352         echo "You do not have socklen_t."
15353         case "$sizetype" in
15354         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15355         esac
15356 fi
15357 $rm -f try try.*
15358 set d_socklen_t
15359 eval $setvar
15360
15361 : see if this is a socks.h system
15362 set socks.h i_socks
15363 eval $inhdr
15364
15365 : check for type of the size argument to socket calls
15366 case "$d_socket" in
15367 "$define")
15368         $cat <<EOM
15369
15370 Checking to see what type is the last argument of accept().
15371 EOM
15372         yyy=''
15373         case "$d_socklen_t" in
15374         "$define") yyy="$yyy socklen_t"
15375         esac
15376         yyy="$yyy $sizetype int long unsigned"
15377         for xxx in $yyy; do
15378                 case "$socksizetype" in
15379                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
15380                         case "$usesocks" in
15381                         "$define")
15382                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15383                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15384                                         socksizetype="$xxx"
15385                                 fi
15386                                 ;;
15387                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
15388                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15389                                         socksizetype="$xxx"
15390                                 fi
15391                                 ;;
15392                         esac
15393                         ;;
15394                 esac
15395         done
15396 : In case none of those worked, prompt the user.
15397         case "$socksizetype" in
15398         '')     rp='What is the type for socket address structure sizes?'
15399                 dflt='int'
15400                 . ./myread
15401                 socksizetype=$ans
15402                 ;;
15403         esac
15404         ;;
15405 *)      : no sockets, so pick relatively harmless default
15406         socksizetype='int'
15407         ;;
15408 esac
15409
15410 : see what type is used for signed size_t
15411 set ssize_t ssizetype int stdio.h sys/types.h
15412 eval $typedef
15413 dflt="$ssizetype"
15414 $cat > try.c <<EOM
15415 #include <stdio.h>
15416 #include <sys/types.h>
15417 #define Size_t $sizetype
15418 #define SSize_t $dflt
15419 int main()
15420 {
15421         if (sizeof(Size_t) == sizeof(SSize_t))
15422                 printf("$dflt\n");
15423         else if (sizeof(Size_t) == sizeof(int))
15424                 printf("int\n");
15425         else 
15426                 printf("long\n");
15427         exit(0);
15428 }
15429 EOM
15430 echo " "
15431 set try
15432 if eval $compile_ok && $run ./try > /dev/null; then
15433         ssizetype=`$run ./try`
15434         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15435 else
15436         $cat >&4 <<EOM
15437 Help! I can't compile and run the ssize_t test program: please enlighten me!
15438 (This is probably a misconfiguration in your system or libraries, and
15439 you really ought to fix it.  Still, I'll try anyway.)
15440
15441 I need a type that is the same size as $sizetype, but is guaranteed to
15442 be signed.  Common values are ssize_t, int and long.
15443
15444 EOM
15445         rp="What signed type is the same size as $sizetype?"
15446         . ./myread
15447         ssizetype="$ans"
15448 fi
15449 $rm -f try try.*
15450
15451 : see what type of char stdio uses.
15452 echo " "
15453 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15454 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15455         echo "Your stdio uses unsigned chars." >&4
15456         stdchar="unsigned char"
15457 else
15458         echo "Your stdio uses signed chars." >&4
15459         stdchar="char"
15460 fi
15461 $rm -f stdioh
15462
15463
15464
15465 : see if time exists
15466 echo " "
15467 if test "X$d_time" = X -o X"$timetype" = X; then
15468     if set time val -f d_time; eval $csym; $val; then
15469                 echo 'time() found.' >&4
15470                 val="$define"
15471                 rp="What is the type returned by time() on this system?"
15472                 set time_t timetype long stdio.h sys/types.h
15473                 eval $typedef_ask
15474     else
15475                 echo 'time() not found, hope that will do.' >&4
15476                 val="$undef"
15477                 timetype='int';
15478     fi
15479     set d_time
15480     eval $setvar
15481 fi
15482
15483 : see what type uids are declared as in the kernel
15484 echo " "
15485 echo "Looking for the type for user ids returned by getuid()."
15486 set uid_t uidtype xxx stdio.h sys/types.h
15487 eval $typedef
15488 case "$uidtype" in
15489 xxx)
15490         xxx=`./findhdr sys/user.h`
15491         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15492         case $1 in
15493         unsigned) dflt="$1 $2" ;;
15494         *) dflt="$1" ;;
15495         esac
15496         ;;
15497 *) dflt="$uidtype";;
15498 esac
15499 case "$uidtype" in
15500 uid_t)  echo "uid_t found." ;;
15501 *)      rp="What is the type for user ids returned by getuid()?"
15502         . ./myread
15503         uidtype="$ans"
15504         ;;
15505 esac
15506
15507 echo " "
15508 case "$uidtype" in
15509 *_t) zzz="$uidtype"     ;;
15510 *)   zzz="uid"          ;;
15511 esac
15512 echo "Checking the size of $zzz..." >&4 
15513 cat > try.c <<EOCP
15514 #include <sys/types.h>
15515 #include <stdio.h>
15516 int main() {
15517     printf("%d\n", (int)sizeof($uidtype));
15518     exit(0);
15519 }
15520 EOCP
15521 set try
15522 if eval $compile_ok; then
15523         yyy=`$run ./try`
15524         case "$yyy" in
15525         '')     uidsize=4
15526                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15527                 ;;
15528         *)      uidsize=$yyy
15529                 echo "Your $zzz is $uidsize bytes long."
15530                 ;;
15531         esac
15532 else
15533         uidsize=4
15534         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15535 fi
15536
15537 echo " "
15538 case "$uidtype" in
15539 *_t) zzz="$uidtype"     ;;
15540 *)   zzz="uid"          ;;
15541 esac
15542 echo "Checking the sign of $zzz..." >&4
15543 cat > try.c <<EOCP
15544 #include <sys/types.h>
15545 #include <stdio.h>
15546 int main() {
15547         $uidtype foo = -1;
15548         if (foo < 0)
15549                 printf("-1\n");
15550         else
15551                 printf("1\n");
15552 }
15553 EOCP
15554 set try
15555 if eval $compile; then
15556         yyy=`$run ./try`
15557         case "$yyy" in
15558         '')     uidsign=1
15559                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15560                 ;;
15561         *)      uidsign=$yyy
15562                 case "$uidsign" in
15563                  1) echo "Your $zzz is unsigned." ;;
15564                 -1) echo "Your $zzz is signed."   ;;
15565                 esac
15566                 ;;
15567         esac
15568 else
15569         uidsign=1
15570         echo "(I can't compile the test program--guessing unsigned.)" >&4
15571 fi
15572
15573
15574
15575 echo " "
15576 $echo "Checking the format string to be used for uids..." >&4
15577
15578 case "$uidsign" in
15579 -1)     if $test X"$uidsize" = X"$ivsize"; then
15580                 uidformat="$ivdformat"
15581         else
15582                 if $test X"$uidsize" = X"$longsize"; then
15583                         uidformat='"ld"'
15584                 else
15585                         if $test X"$uidsize" = X"$intsize"; then
15586                                 uidformat='"d"'
15587                         else
15588                                 if $test X"$uidsize" = X"$shortsize"; then
15589                                         uidformat='"hd"'
15590                                 fi
15591                         fi
15592                 fi
15593         fi
15594         ;;
15595 *)      if $test X"$uidsize" = X"$uvsize"; then
15596                 uidformat="$uvuformat"
15597         else
15598                 if $test X"$uidsize" = X"$longsize"; then
15599                         uidformat='"lu"'
15600                 else
15601                         if $test X"$uidsize" = X"$intsize"; then
15602                                 uidformat='"u"'
15603                         else
15604                                 if $test X"$uidsize" = X"$shortsize"; then
15605                                         uidformat='"hu"'
15606                                 fi
15607                         fi
15608                 fi
15609         fi
15610         ;;
15611 esac
15612
15613 : determine compiler compiler
15614 case "$yacc" in
15615 '')
15616         dflt=yacc;;
15617 *)
15618         dflt="$yacc";;
15619 esac
15620 echo " "
15621 comp='yacc'
15622 if $test -f "$byacc"; then
15623         dflt="$byacc"
15624         comp="byacc or $comp"
15625 fi
15626 if $test -f "$bison"; then
15627         comp="$comp or bison -y"
15628 fi
15629 rp="Which compiler compiler ($comp) shall I use?"
15630 . ./myread
15631 yacc="$ans"
15632 case "$yacc" in
15633 *bis*)
15634         case "$yacc" in
15635         *-y*) ;;
15636         *)
15637                 yacc="$yacc -y"
15638                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15639                 ;;
15640         esac
15641         ;;
15642 esac
15643
15644 : see if fcntl.h is there
15645 val=''
15646 set fcntl.h val
15647 eval $inhdr
15648
15649 : see if we can include fcntl.h
15650 case "$val" in
15651 "$define")
15652         echo " "
15653         if $h_fcntl; then
15654                 val="$define"
15655                 echo "We'll be including <fcntl.h>." >&4
15656         else
15657                 val="$undef"
15658                 if $h_sysfile; then
15659         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15660                 else
15661                         echo "We won't be including <fcntl.h>." >&4
15662                 fi
15663         fi
15664         ;;
15665 *)
15666         h_fcntl=false
15667         val="$undef"
15668         ;;
15669 esac
15670 set i_fcntl
15671 eval $setvar
15672
15673 : see if this is a iconv.h system
15674 set iconv.h i_iconv
15675 eval $inhdr
15676
15677 : see if this is a ieeefp.h system
15678 set ieeefp.h i_ieeefp
15679 eval $inhdr
15680
15681 : see if this is a libutil.h system
15682 set libutil.h i_libutil
15683 eval $inhdr
15684
15685 : see if locale.h is available
15686 set locale.h i_locale
15687 eval $inhdr
15688
15689 : see if mach cthreads are available
15690 if test "X$usethreads" = "X$define"; then
15691         set mach/cthreads.h i_machcthr
15692         eval $inhdr
15693 else
15694         i_machcthr="$undef"
15695 fi
15696
15697
15698
15699 : see if this is a math.h system
15700 set math.h i_math
15701 eval $inhdr
15702
15703 : see if this is a mntent.h system
15704 set mntent.h i_mntent
15705 eval $inhdr
15706
15707 : see if ndbm.h is available
15708 set ndbm.h t_ndbm
15709 eval $inhdr
15710 case "$t_ndbm" in
15711 $define)
15712         : see if dbm_open exists
15713         set dbm_open d_dbm_open
15714         eval $inlibc
15715         case "$d_dbm_open" in
15716         $undef)
15717                 t_ndbm="$undef"
15718                 echo "We won't be including <ndbm.h>"
15719                 ;;
15720         esac
15721         ;;
15722 esac
15723 val="$t_ndbm"
15724 set i_ndbm
15725 eval $setvar
15726
15727 : see if net/errno.h is available
15728 val=''
15729 set net/errno.h val
15730 eval $inhdr
15731
15732 : Unfortunately, it causes problems on some systems.  Arrgh.
15733 case "$val" in
15734 $define)
15735         cat > try.c <<'EOM'
15736 #include <stdio.h>
15737 #include <errno.h>
15738 #include <net/errno.h>
15739 int func()
15740 {
15741         return ENOTSOCK;
15742 }
15743 EOM
15744         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15745                 echo "We'll be including <net/errno.h>." >&4
15746         else
15747                 echo "We won't be including <net/errno.h>." >&4
15748                 val="$undef"
15749         fi
15750         $rm -f try.* try
15751         ;;
15752 esac
15753 set i_neterrno
15754 eval $setvar
15755
15756 : see if netinet/tcp.h is available
15757 set netinet/tcp.h i_netinettcp
15758 eval $inhdr
15759
15760 : see if this is a poll.h system
15761 set poll.h i_poll
15762 eval $inhdr
15763
15764 : see if this is a prot.h system
15765 set prot.h i_prot
15766 eval $inhdr
15767
15768 echo " "
15769 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15770 $cat <<'EOSH' > Cppsym.know
15771 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15772 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15773 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15774 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15775 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15776 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15777 bull c cadmus clipper CMU COFF COMPILER_VERSION
15778 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15779 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15780 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15781 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15782 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15783 H3050R H3050RX hbullx20 hcx host_mips
15784 hp200 hp300 hp700 HP700 hp800 hp9000
15785 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15786 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15787 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15788 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15789 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15790 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15791 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15792 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15793 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15794 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15795 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15796 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15797 MATH_HAS_NO_SIDE_EFFECTS
15798 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15799 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15800 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15801 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15802 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15803 NetBSD news1500 news1700 news1800 news1900 news3700
15804 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15805 ns32016 ns32332 ns32k nsc32000
15806 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15807 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15808 pc532 pdp11 PGC PIC plexus PORTAR posix
15809 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15810 POSIX_C_SOURCE POSIX_SOURCE POWER
15811 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15812 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15813 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15814 sony sony_news sonyrisc sparc sparclite spectrum
15815 stardent stdc STDC_EXT stratos sun sun3 sun386
15816 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15817 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15818 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15819 sysV68 sysV88 Tek4132 Tek4300 titan
15820 TM3200 TM5400 TM5600
15821 tower tower32 tower32_200 tower32_600 tower32_700
15822 tower32_800 tower32_850 tss
15823 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15824 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15825 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15826 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15827 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15828 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15829 z8000
15830 EOSH
15831 # Maybe put other stuff here too.
15832 cat <<EOSH >>Cppsym.know
15833 $osname
15834 EOSH
15835 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15836 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15837 $cat Cppsym.know > Cppsym.c
15838 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15839 $rm -f Cppsym.a Cppsym.b Cppsym.c
15840 cat <<EOSH > Cppsym
15841 $startsh
15842 if $test \$# -gt 0; then
15843     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15844     if $test -s Cppsym.got; then
15845         $rm -f Cppsym.got
15846         exit 0
15847     fi
15848     $rm -f Cppsym.got
15849     exit 1
15850 else
15851     $tr " " "$trnl" | ./Cppsym.try
15852     exit 0
15853 fi
15854 EOSH
15855 chmod +x Cppsym
15856 $eunicefix Cppsym
15857 cat <<EOSH > Cppsym.try
15858 $startsh
15859 cat <<'EOCP' > try.c
15860 #include <stdio.h>
15861 int main() {
15862 EOCP
15863 $awk \\
15864 EOSH
15865 cat <<'EOSH' >> Cppsym.try
15866 'length($1) > 0 {
15867     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15868     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15869     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15870     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15871 }'       >> try.c
15872 echo 'return 0;}' >> try.c
15873 EOSH
15874 cat <<EOSH >> Cppsym.try
15875 ccflags="$ccflags"
15876 case "$osname-$gccversion" in
15877 irix-) ccflags="\$ccflags -woff 1178" ;;
15878 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15879 esac
15880 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
15881 EOSH
15882 chmod +x Cppsym.try
15883 $eunicefix Cppsym.try
15884 ./Cppsym < Cppsym.know > Cppsym.true
15885 : now check the C compiler for additional symbols
15886 postprocess_cc_v=''
15887 case "$osname" in
15888 aix) postprocess_cc_v="|$tr , ' '" ;;
15889 esac
15890 $cat >ccsym <<EOS
15891 $startsh
15892 $cat >tmp.c <<EOF
15893 extern int foo;
15894 EOF
15895 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15896 do
15897         case "\$i" in
15898         -D*) echo "\$i" | $sed 's/^-D//';;
15899         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15900         esac
15901 done
15902 $rm -f try.c
15903 EOS
15904 postprocess_cc_v=''
15905 chmod +x ccsym
15906 $eunicefix ccsym
15907 ./ccsym > ccsym1.raw
15908 if $test -s ccsym1.raw; then
15909        $sort ccsym1.raw | $uniq >ccsym.raw
15910 else
15911        mv ccsym1.raw ccsym.raw
15912 fi
15913
15914 $awk '/\=/ { print $0; next }
15915         { print $0"=1" }' ccsym.raw >ccsym.list
15916 $awk '/\=/ { print $0; next }
15917         { print $0"=1" }' Cppsym.true >ccsym.true
15918 $comm -13 ccsym.true ccsym.list >ccsym.own
15919 $comm -12 ccsym.true ccsym.list >ccsym.com
15920 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15921 also=''
15922 if $test -z ccsym.raw; then
15923         echo "Your C compiler doesn't seem to define any symbols!" >&4
15924         echo " "
15925         echo "However, your C preprocessor defines the following symbols:"
15926         $cat Cppsym.true
15927         ccsymbols=''
15928         cppsymbols=`$cat Cppsym.true`
15929         cppsymbols=`echo $cppsymbols`
15930         cppccsymbols="$cppsymbols"
15931 else
15932         if $test -s ccsym.com; then
15933                 echo "Your C compiler and pre-processor define these symbols:"
15934                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15935                 also='also '
15936                 symbols='ones'
15937                 cppccsymbols=`$cat ccsym.com`
15938                 cppccsymbols=`echo $cppccsymbols`
15939                 $test "$silent" || sleep 1
15940         fi
15941         if $test -s ccsym.cpp; then
15942                 $test "$also" && echo " "
15943                 echo "Your C pre-processor ${also}defines the following symbols:"
15944                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15945                 also='further '
15946                 cppsymbols=`$cat ccsym.cpp`
15947                 cppsymbols=`echo $cppsymbols`
15948                 $test "$silent" || sleep 1
15949         fi
15950         if $test -s ccsym.own; then
15951                 $test "$also" && echo " "
15952                 echo "Your C compiler ${also}defines the following cpp symbols:"
15953                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15954                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15955                 ccsymbols=`$cat ccsym.own`
15956                 ccsymbols=`echo $ccsymbols`
15957                 $test "$silent" || sleep 1
15958         fi
15959 fi
15960
15961 : see if this is a termio system
15962 val="$undef"
15963 val2="$undef"
15964 val3="$undef"
15965 if $test `./findhdr termios.h`; then
15966         set tcsetattr i_termios
15967         eval $inlibc
15968         val3="$i_termios"
15969 fi
15970 echo " "
15971 case "$val3" in
15972 "$define") echo "You have POSIX termios.h... good!" >&4;;
15973 *) if ./Cppsym pyr; then
15974                 case "`/bin/universe`" in
15975                 ucb) if $test `./findhdr sgtty.h`; then
15976                                 val2="$define"
15977                                 echo "<sgtty.h> found." >&4
15978                         else
15979                                 echo "System is pyramid with BSD universe."
15980                                 echo "<sgtty.h> not found--you could have problems." >&4
15981                         fi;;
15982                 *) if $test `./findhdr termio.h`; then
15983                                 val="$define"
15984                                 echo "<termio.h> found." >&4
15985                         else
15986                                 echo "System is pyramid with USG universe."
15987                                 echo "<termio.h> not found--you could have problems." >&4
15988                         fi;;
15989                 esac
15990         elif ./usg; then
15991                 if $test `./findhdr termio.h`; then
15992                         echo "<termio.h> found." >&4
15993                         val="$define"
15994                 elif $test `./findhdr sgtty.h`; then
15995                         echo "<sgtty.h> found." >&4
15996                         val2="$define"
15997                 else
15998 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15999                 fi
16000         else
16001                 if $test `./findhdr sgtty.h`; then
16002                         echo "<sgtty.h> found." >&4
16003                         val2="$define"
16004                 elif $test `./findhdr termio.h`; then
16005                         echo "<termio.h> found." >&4
16006                         val="$define"
16007                 else
16008 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
16009                 fi
16010         fi;;
16011 esac
16012 set i_termio; eval $setvar
16013 val=$val2; set i_sgtty; eval $setvar
16014 val=$val3; set i_termios; eval $setvar
16015
16016 : see if this is a shadow.h system
16017 set shadow.h i_shadow
16018 eval $inhdr
16019
16020 : see if stddef is available
16021 set stddef.h i_stddef
16022 eval $inhdr
16023
16024 : see if this is a sunmath.h system
16025 set sunmath.h i_sunmath
16026 eval $inhdr
16027
16028 : see if sys/access.h is available
16029 set sys/access.h i_sysaccess
16030 eval $inhdr
16031
16032 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
16033 set sys/filio.h i_sysfilio
16034 eval $inhdr
16035 echo " "
16036 if $test `./findhdr sys/ioctl.h`; then
16037         val="$define"
16038         echo '<sys/ioctl.h> found.' >&4
16039 else
16040         val="$undef"
16041         if $test $i_sysfilio = "$define"; then
16042             echo '<sys/ioctl.h> NOT found.' >&4
16043         else
16044                 $test $i_sgtty = "$define" && xxx="sgtty.h"
16045                 $test $i_termio = "$define" && xxx="termio.h"
16046                 $test $i_termios = "$define" && xxx="termios.h"
16047 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
16048         fi
16049 fi
16050 set i_sysioctl
16051 eval $setvar
16052
16053 : see if socket ioctl defs are in sys/sockio.h
16054 echo " "
16055 xxx=`./findhdr sys/sockio.h`
16056 if $test "$xxx"; then
16057         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
16058                 val="$define"
16059                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
16060         else
16061                 val="$undef"
16062                 echo "No socket ioctls found in <sys/sockio.h>." >&4
16063         fi
16064 else
16065         val="$undef"
16066         $cat <<EOM
16067 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
16068 EOM
16069 fi
16070 set i_syssockio
16071 eval $setvar
16072
16073
16074 : see if this is a syslog.h system
16075 set syslog.h i_syslog
16076 eval $inhdr
16077
16078
16079 : see if this is a sys/mode.h system
16080 set sys/mode.h i_sysmode
16081 eval $inhdr
16082
16083 : see if sys/resource.h has to be included
16084 set sys/resource.h i_sysresrc
16085 eval $inhdr
16086
16087 : see if sys/security.h is available
16088 set sys/security.h i_syssecrt
16089 eval $inhdr
16090
16091 : see if this is a sys/statvfs.h system
16092 set sys/statvfs.h i_sysstatvfs
16093 eval $inhdr
16094
16095 : see if this is a sys/un.h system
16096 set sys/un.h i_sysun
16097 eval $inhdr
16098
16099
16100 : see if this is a sys/utsname.h system
16101 set sys/utsname.h i_sysutsname
16102 eval $inhdr
16103
16104 : see if this is a syswait system
16105 set sys/wait.h i_syswait
16106 eval $inhdr
16107
16108 : see if this is a ustat.h system
16109 set ustat.h i_ustat
16110 eval $inhdr
16111
16112 : see if this is an utime system
16113 set utime.h i_utime
16114 eval $inhdr
16115
16116 : see if this is a values.h system
16117 set values.h i_values
16118 eval $inhdr
16119
16120 : see if this is a vfork system
16121 case "$d_vfork" in
16122 "$define")
16123         set vfork.h i_vfork
16124         eval $inhdr
16125         ;;
16126 *)
16127         i_vfork="$undef"
16128         ;;
16129 esac
16130
16131 : see if gdbm.h is available
16132 set gdbm.h t_gdbm
16133 eval $inhdr
16134 case "$t_gdbm" in
16135 $define)
16136         : see if gdbm_open exists
16137         set gdbm_open d_gdbm_open
16138         eval $inlibc
16139         case "$d_gdbm_open" in
16140         $undef)
16141                 t_gdbm="$undef"
16142                 echo "We won't be including <gdbm.h>"
16143                 ;;
16144         esac
16145         ;;
16146 esac
16147 val="$t_gdbm"
16148 set i_gdbm
16149 eval $setvar
16150
16151 echo " "
16152 echo "Looking for extensions..." >&4
16153 : If we are using the old config.sh, known_extensions may contain
16154 : old or inaccurate or duplicate values.
16155 known_extensions=''
16156 nonxs_extensions=''
16157 : We do not use find because it might not be available.
16158 : We do not just use MANIFEST because the user may have dropped
16159 : some additional extensions into the source tree and expect them
16160 : to be built.
16161
16162 : Function to recursively find available extensions, ignoring DynaLoader
16163 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
16164 find_extensions='
16165     for xxx in *; do
16166        case "$xxx" in
16167            DynaLoader|dynaload) ;;
16168            *)
16169            if $test -f $xxx/$xxx.xs; then
16170                known_extensions="$known_extensions $1$xxx";
16171            elif $test -f $xxx/Makefile.PL; then
16172                nonxs_extensions="$nonxs_extensions $1$xxx";
16173            else
16174                if $test -d $xxx -a $# -lt 10; then
16175                    set $1$xxx/ $*;
16176                    cd $xxx;
16177                    eval $find_extensions;
16178                    cd ..;
16179                    shift;
16180                fi;
16181            fi
16182            ;;
16183        esac;
16184     done'
16185 tdir=`pwd`
16186 cd $rsrc/ext
16187 set X
16188 shift
16189 eval $find_extensions
16190 set X $nonxs_extensions
16191 shift
16192 nonxs_extensions="$*"
16193 set X $known_extensions
16194 shift
16195 known_extensions="$*"
16196 cd $tdir
16197
16198 : Now see which are supported on this system.
16199 avail_ext=''
16200 for xxx in $known_extensions ; do
16201         case "$xxx" in
16202         DB_File|db_file)
16203                 case "$i_db" in
16204                 $define) avail_ext="$avail_ext $xxx" ;;
16205                 esac
16206                 ;;
16207         GDBM_File|gdbm_fil)
16208                 case "$i_gdbm" in 
16209                 $define) avail_ext="$avail_ext $xxx" ;;
16210                 esac
16211                 ;;
16212         NDBM_File|ndbm_fil)
16213                 case "$i_ndbm" in
16214                 $define)
16215                     case "$osname-$use64bitint" in
16216                     cygwin-*|hpux-define)
16217                         case "$libs" in
16218                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
16219                         esac
16220                         ;;
16221                     *) avail_ext="$avail_ext $xxx" ;;
16222                     esac
16223                     ;;
16224                 esac
16225                 ;;
16226         ODBM_File|odbm_fil) 
16227                 case "${i_dbm}${i_rpcsvcdbm}" in
16228                 *"${define}"*)
16229                     case "$osname-$use64bitint" in
16230                     cygwin-*|hpux-define)
16231                         case "$libs" in
16232                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
16233                         esac
16234                         ;;
16235                     *) avail_ext="$avail_ext $xxx" ;;
16236                     esac
16237                     ;;
16238                 esac
16239                 ;;
16240         POSIX|posix)
16241                 case "$useposix" in
16242                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16243                 esac
16244                 ;;
16245         Opcode|opcode)
16246                 case "$useopcode" in
16247                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16248                 esac
16249                 ;;
16250         Socket|socket)
16251                 case "$d_socket" in 
16252                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16253                 esac
16254                 ;;
16255         Sys/Syslog|sys/syslog)
16256                 : XXX syslog requires socket
16257                 case "$d_socket" in 
16258                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16259                 esac
16260                 ;;
16261         Thread|thread)
16262                 case "$usethreads" in
16263                 true|$define|y)
16264                         case "$useithreads" in
16265                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
16266                         esac
16267                 esac
16268                 ;;
16269         IPC/SysV|ipc/sysv)
16270                 : XXX Do we need a useipcsysv variable here
16271                 case "${d_msg}${d_sem}${d_shm}" in 
16272                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
16273                 esac
16274                 ;;
16275         *)      avail_ext="$avail_ext $xxx"
16276                 ;;
16277         esac
16278 done
16279
16280 set X $avail_ext
16281 shift
16282 avail_ext="$*"
16283
16284 : Now see which nonxs extensions are supported on this system.
16285 : For now assume all are.
16286 nonxs_ext=''
16287 for xxx in $nonxs_extensions ; do
16288         case "$xxx" in
16289         *)      nonxs_ext="$nonxs_ext $xxx"
16290                 ;;
16291         esac
16292 done
16293
16294 set X $nonxs_ext
16295 shift
16296 nonxs_ext="$*"
16297
16298 case $usedl in
16299 $define)
16300         $cat <<EOM
16301 A number of extensions are supplied with $package.  You may choose to
16302 compile these extensions for dynamic loading (the default), compile
16303 them into the $package executable (static loading), or not include
16304 them at all.  Answer "none" to include no extensions.
16305 Note that DynaLoader is always built and need not be mentioned here.
16306
16307 EOM
16308         case "$dynamic_ext" in
16309         '') dflt="$avail_ext" ;;
16310         *)      dflt="$dynamic_ext"
16311                 # Perhaps we are reusing an old out-of-date config.sh.
16312                 case "$hint" in
16313                 previous)
16314                         if test X"$dynamic_ext" != X"$avail_ext"; then
16315                                 $cat <<EOM
16316 NOTICE:  Your previous config.sh list may be incorrect. 
16317 The extensions now available to you are 
16318         ${avail_ext}
16319 but the default list from your previous config.sh is
16320         ${dynamic_ext} 
16321
16322 EOM
16323                         fi
16324                         ;;
16325                 esac
16326                 ;;
16327         esac
16328         case "$dflt" in
16329         '')     dflt=none;;
16330         esac
16331         rp="What extensions do you wish to load dynamically?"
16332         . ./myread
16333         case "$ans" in
16334         none) dynamic_ext=' ' ;;
16335         *) dynamic_ext="$ans" ;;
16336         esac
16337
16338         case "$static_ext" in
16339         '')
16340                 : Exclude those already listed in dynamic linking
16341                 dflt=''
16342                 for xxx in $avail_ext; do
16343                         case " $dynamic_ext " in
16344                         *" $xxx "*) ;;
16345                         *) dflt="$dflt $xxx" ;;
16346                         esac
16347                 done
16348                 set X $dflt
16349                 shift
16350                 dflt="$*"
16351                 ;;
16352         *)  dflt="$static_ext" 
16353                 ;;
16354         esac
16355
16356         case "$dflt" in
16357         '')     dflt=none;;
16358         esac
16359         rp="What extensions do you wish to load statically?"
16360         . ./myread
16361         case "$ans" in
16362         none) static_ext=' ' ;;
16363         *) static_ext="$ans" ;;
16364         esac
16365         ;;
16366 *)
16367         $cat <<EOM
16368 A number of extensions are supplied with $package.  Answer "none" 
16369 to include no extensions. 
16370 Note that DynaLoader is always built and need not be mentioned here.
16371
16372 EOM
16373         case "$static_ext" in
16374         '') dflt="$avail_ext" ;;
16375         *)      dflt="$static_ext"
16376                 # Perhaps we are reusing an old out-of-date config.sh.
16377                 case "$hint" in
16378                 previous)
16379                         if test X"$static_ext" != X"$avail_ext"; then
16380                                 $cat <<EOM
16381 NOTICE:  Your previous config.sh list may be incorrect. 
16382 The extensions now available to you are 
16383         ${avail_ext}
16384 but the default list from your previous config.sh is
16385         ${static_ext} 
16386
16387 EOM
16388                         fi
16389                         ;;
16390                 esac
16391                 ;;
16392         esac
16393         : Exclude those that are not xs extensions
16394         case "$dflt" in
16395         '')     dflt=none;;
16396         esac
16397         rp="What extensions do you wish to include?"
16398         . ./myread
16399         case "$ans" in
16400         none) static_ext=' ' ;;
16401         *) static_ext="$ans" ;;
16402         esac
16403         ;;
16404 esac
16405
16406 set X $dynamic_ext $static_ext $nonxs_ext
16407 shift
16408 extensions="$*"
16409
16410 : Remove libraries needed only for extensions
16411 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16412 : The exception is SunOS 4.x, which needs them.
16413 case "${osname}X${osvers}" in
16414 sunos*X4*)
16415     perllibs="$libs"
16416     ;;
16417 *) case "$usedl" in
16418     $define|true|[yY]*)
16419             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16420             shift
16421             perllibs="$*"
16422             ;;
16423     *)  perllibs="$libs"
16424             ;;
16425     esac
16426     ;;
16427 esac
16428
16429 : Remove build directory name from cppstdin so it can be used from
16430 : either the present location or the final installed location.
16431 echo " "
16432 : Get out of the UU directory to get correct path name.
16433 cd ..
16434 case "$cppstdin" in
16435 `pwd`/cppstdin)
16436         echo "Stripping down cppstdin path name"
16437         cppstdin=cppstdin
16438         ;;
16439 esac
16440 cd UU
16441
16442 : end of configuration questions
16443 echo " "
16444 echo "End of configuration questions."
16445 echo " "
16446
16447 : back to where it started
16448 if test -d ../UU; then
16449         cd ..
16450 fi
16451
16452 : configuration may be patched via a 'config.over' file
16453 if $test -f config.over; then
16454         echo " "
16455         dflt=y
16456         rp='I see a config.over file.  Do you wish to load it?'
16457         . UU/myread
16458         case "$ans" in
16459         n*) echo "OK, I'll ignore it.";;
16460         *)      . ./config.over
16461                 echo "Configuration override changes have been loaded."
16462                 ;;
16463         esac
16464 fi
16465
16466 : in case they want portability, strip down executable paths
16467 case "$d_portable" in
16468 "$define")
16469         echo " "
16470         echo "Stripping down executable paths..." >&4
16471         for file in $loclist $trylist; do
16472                 eval temp=\$$file
16473                 eval $file=`basename $temp`
16474         done
16475         ;;
16476 esac
16477
16478 : create config.sh file
16479 echo " "
16480 echo "Creating config.sh..." >&4
16481 $spitshell <<EOT >config.sh
16482 $startsh
16483 #
16484 # This file was produced by running the Configure script. It holds all the
16485 # definitions figured out by Configure. Should you modify one of these values,
16486 # do not forget to propagate your changes by running "Configure -der". You may
16487 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16488 #
16489
16490 # Package name      : $package
16491 # Source directory  : $src
16492 # Configuration time: $cf_time
16493 # Configured by     : $cf_by
16494 # Target system     : $myuname
16495
16496 Author='$Author'
16497 Date='$Date'
16498 Header='$Header'
16499 Id='$Id'
16500 Locker='$Locker'
16501 Log='$Log'
16502 Mcc='$Mcc'
16503 RCSfile='$RCSfile'
16504 Revision='$Revision'
16505 Source='$Source'
16506 State='$State'
16507 _a='$_a'
16508 _exe='$_exe'
16509 _o='$_o'
16510 afs='$afs'
16511 afsroot='$afsroot'
16512 alignbytes='$alignbytes'
16513 ansi2knr='$ansi2knr'
16514 aphostname='$aphostname'
16515 api_revision='$api_revision'
16516 api_subversion='$api_subversion'
16517 api_version='$api_version'
16518 api_versionstring='$api_versionstring'
16519 ar='$ar'
16520 archlib='$archlib'
16521 archlibexp='$archlibexp'
16522 archname64='$archname64'
16523 archname='$archname'
16524 archobjs='$archobjs'
16525 awk='$awk'
16526 baserev='$baserev'
16527 bash='$bash'
16528 bin='$bin'
16529 bincompat5005='$bincompat5005'
16530 binexp='$binexp'
16531 bison='$bison'
16532 byacc='$byacc'
16533 byteorder='$byteorder'
16534 c='$c'
16535 castflags='$castflags'
16536 cat='$cat'
16537 cc='$cc'
16538 cccdlflags='$cccdlflags'
16539 ccdlflags='$ccdlflags'
16540 ccflags='$ccflags'
16541 ccflags_uselargefiles='$ccflags_uselargefiles'
16542 ccname='$ccname'
16543 ccsymbols='$ccsymbols'
16544 ccversion='$ccversion'
16545 cf_by='$cf_by'
16546 cf_email='$cf_email'
16547 cf_time='$cf_time'
16548 charsize='$charsize'
16549 chgrp='$chgrp'
16550 chmod='$chmod'
16551 chown='$chown'
16552 clocktype='$clocktype'
16553 comm='$comm'
16554 compress='$compress'
16555 contains='$contains'
16556 cp='$cp'
16557 cpio='$cpio'
16558 cpp='$cpp'
16559 cpp_stuff='$cpp_stuff'
16560 cppccsymbols='$cppccsymbols'
16561 cppflags='$cppflags'
16562 cpplast='$cpplast'
16563 cppminus='$cppminus'
16564 cpprun='$cpprun'
16565 cppstdin='$cppstdin'
16566 cppsymbols='$cppsymbols'
16567 cryptlib='$cryptlib'
16568 csh='$csh'
16569 d_Gconvert='$d_Gconvert'
16570 d_PRIEUldbl='$d_PRIEUldbl'
16571 d_PRIFUldbl='$d_PRIFUldbl'
16572 d_PRIGUldbl='$d_PRIGUldbl'
16573 d_PRIXU64='$d_PRIXU64'
16574 d_PRId64='$d_PRId64'
16575 d_PRIeldbl='$d_PRIeldbl'
16576 d_PRIfldbl='$d_PRIfldbl'
16577 d_PRIgldbl='$d_PRIgldbl'
16578 d_PRIi64='$d_PRIi64'
16579 d_PRIo64='$d_PRIo64'
16580 d_PRIu64='$d_PRIu64'
16581 d_PRIx64='$d_PRIx64'
16582 d_SCNfldbl='$d_SCNfldbl'
16583 d__fwalk='$d__fwalk'
16584 d_access='$d_access'
16585 d_accessx='$d_accessx'
16586 d_alarm='$d_alarm'
16587 d_archlib='$d_archlib'
16588 d_atolf='$d_atolf'
16589 d_atoll='$d_atoll'
16590 d_attribut='$d_attribut'
16591 d_bcmp='$d_bcmp'
16592 d_bcopy='$d_bcopy'
16593 d_bincompat5005='$d_bincompat5005'
16594 d_bsd='$d_bsd'
16595 d_bsdgetpgrp='$d_bsdgetpgrp'
16596 d_bsdsetpgrp='$d_bsdsetpgrp'
16597 d_bzero='$d_bzero'
16598 d_casti32='$d_casti32'
16599 d_castneg='$d_castneg'
16600 d_charvspr='$d_charvspr'
16601 d_chown='$d_chown'
16602 d_chroot='$d_chroot'
16603 d_chsize='$d_chsize'
16604 d_closedir='$d_closedir'
16605 d_cmsghdr_s='$d_cmsghdr_s'
16606 d_const='$d_const'
16607 d_crypt='$d_crypt'
16608 d_csh='$d_csh'
16609 d_cuserid='$d_cuserid'
16610 d_dbl_dig='$d_dbl_dig'
16611 d_dbminitproto='$d_dbminitproto'
16612 d_difftime='$d_difftime'
16613 d_dirnamlen='$d_dirnamlen'
16614 d_dlerror='$d_dlerror'
16615 d_dlopen='$d_dlopen'
16616 d_dlsymun='$d_dlsymun'
16617 d_dosuid='$d_dosuid'
16618 d_drand48proto='$d_drand48proto'
16619 d_dup2='$d_dup2'
16620 d_eaccess='$d_eaccess'
16621 d_endgrent='$d_endgrent'
16622 d_endhent='$d_endhent'
16623 d_endnent='$d_endnent'
16624 d_endpent='$d_endpent'
16625 d_endpwent='$d_endpwent'
16626 d_endsent='$d_endsent'
16627 d_eofnblk='$d_eofnblk'
16628 d_eunice='$d_eunice'
16629 d_fchdir='$d_fchdir'
16630 d_fchmod='$d_fchmod'
16631 d_fchown='$d_fchown'
16632 d_fcntl='$d_fcntl'
16633 d_fcntl_can_lock='$d_fcntl_can_lock'
16634 d_fd_macros='$d_fd_macros'
16635 d_fd_set='$d_fd_set'
16636 d_fds_bits='$d_fds_bits'
16637 d_fgetpos='$d_fgetpos'
16638 d_flexfnam='$d_flexfnam'
16639 d_flock='$d_flock'
16640 d_flockproto='$d_flockproto'
16641 d_fork='$d_fork'
16642 d_fpathconf='$d_fpathconf'
16643 d_fpos64_t='$d_fpos64_t'
16644 d_frexpl='$d_frexpl'
16645 d_fs_data_s='$d_fs_data_s'
16646 d_fseeko='$d_fseeko'
16647 d_fsetpos='$d_fsetpos'
16648 d_fstatfs='$d_fstatfs'
16649 d_fstatvfs='$d_fstatvfs'
16650 d_fsync='$d_fsync'
16651 d_ftello='$d_ftello'
16652 d_ftime='$d_ftime'
16653 d_getcwd='$d_getcwd'
16654 d_getespwnam='$d_getespwnam'
16655 d_getfsstat='$d_getfsstat'
16656 d_getgrent='$d_getgrent'
16657 d_getgrps='$d_getgrps'
16658 d_gethbyaddr='$d_gethbyaddr'
16659 d_gethbyname='$d_gethbyname'
16660 d_gethent='$d_gethent'
16661 d_gethname='$d_gethname'
16662 d_gethostprotos='$d_gethostprotos'
16663 d_getitimer='$d_getitimer'
16664 d_getlogin='$d_getlogin'
16665 d_getmnt='$d_getmnt'
16666 d_getmntent='$d_getmntent'
16667 d_getnbyaddr='$d_getnbyaddr'
16668 d_getnbyname='$d_getnbyname'
16669 d_getnent='$d_getnent'
16670 d_getnetprotos='$d_getnetprotos'
16671 d_getpagsz='$d_getpagsz'
16672 d_getpbyname='$d_getpbyname'
16673 d_getpbynumber='$d_getpbynumber'
16674 d_getpent='$d_getpent'
16675 d_getpgid='$d_getpgid'
16676 d_getpgrp2='$d_getpgrp2'
16677 d_getpgrp='$d_getpgrp'
16678 d_getppid='$d_getppid'
16679 d_getprior='$d_getprior'
16680 d_getprotoprotos='$d_getprotoprotos'
16681 d_getprpwnam='$d_getprpwnam'
16682 d_getpwent='$d_getpwent'
16683 d_getsbyname='$d_getsbyname'
16684 d_getsbyport='$d_getsbyport'
16685 d_getsent='$d_getsent'
16686 d_getservprotos='$d_getservprotos'
16687 d_getspnam='$d_getspnam'
16688 d_gettimeod='$d_gettimeod'
16689 d_gnulibc='$d_gnulibc'
16690 d_grpasswd='$d_grpasswd'
16691 d_hasmntopt='$d_hasmntopt'
16692 d_htonl='$d_htonl'
16693 d_iconv='$d_iconv'
16694 d_index='$d_index'
16695 d_inetaton='$d_inetaton'
16696 d_int64_t='$d_int64_t'
16697 d_isascii='$d_isascii'
16698 d_isnan='$d_isnan'
16699 d_isnanl='$d_isnanl'
16700 d_killpg='$d_killpg'
16701 d_lchown='$d_lchown'
16702 d_ldbl_dig='$d_ldbl_dig'
16703 d_link='$d_link'
16704 d_locconv='$d_locconv'
16705 d_lockf='$d_lockf'
16706 d_longdbl='$d_longdbl'
16707 d_longlong='$d_longlong'
16708 d_lseekproto='$d_lseekproto'
16709 d_lstat='$d_lstat'
16710 d_madvise='$d_madvise'
16711 d_mblen='$d_mblen'
16712 d_mbstowcs='$d_mbstowcs'
16713 d_mbtowc='$d_mbtowc'
16714 d_memchr='$d_memchr'
16715 d_memcmp='$d_memcmp'
16716 d_memcpy='$d_memcpy'
16717 d_memmove='$d_memmove'
16718 d_memset='$d_memset'
16719 d_mkdir='$d_mkdir'
16720 d_mkdtemp='$d_mkdtemp'
16721 d_mkfifo='$d_mkfifo'
16722 d_mkstemp='$d_mkstemp'
16723 d_mkstemps='$d_mkstemps'
16724 d_mktime='$d_mktime'
16725 d_mmap='$d_mmap'
16726 d_modfl='$d_modfl'
16727 d_modfl_pow32_bug='$d_modfl_pow32_bug'
16728 d_mprotect='$d_mprotect'
16729 d_msg='$d_msg'
16730 d_msg_ctrunc='$d_msg_ctrunc'
16731 d_msg_dontroute='$d_msg_dontroute'
16732 d_msg_oob='$d_msg_oob'
16733 d_msg_peek='$d_msg_peek'
16734 d_msg_proxy='$d_msg_proxy'
16735 d_msgctl='$d_msgctl'
16736 d_msgget='$d_msgget'
16737 d_msghdr_s='$d_msghdr_s'
16738 d_msgrcv='$d_msgrcv'
16739 d_msgsnd='$d_msgsnd'
16740 d_msync='$d_msync'
16741 d_munmap='$d_munmap'
16742 d_mymalloc='$d_mymalloc'
16743 d_nice='$d_nice'
16744 d_nv_preserves_uv='$d_nv_preserves_uv'
16745 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16746 d_off64_t='$d_off64_t'
16747 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16748 d_oldpthreads='$d_oldpthreads'
16749 d_oldsock='$d_oldsock'
16750 d_open3='$d_open3'
16751 d_pathconf='$d_pathconf'
16752 d_pause='$d_pause'
16753 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16754 d_phostname='$d_phostname'
16755 d_pipe='$d_pipe'
16756 d_poll='$d_poll'
16757 d_portable='$d_portable'
16758 d_pthread_yield='$d_pthread_yield'
16759 d_pwage='$d_pwage'
16760 d_pwchange='$d_pwchange'
16761 d_pwclass='$d_pwclass'
16762 d_pwcomment='$d_pwcomment'
16763 d_pwexpire='$d_pwexpire'
16764 d_pwgecos='$d_pwgecos'
16765 d_pwpasswd='$d_pwpasswd'
16766 d_pwquota='$d_pwquota'
16767 d_qgcvt='$d_qgcvt'
16768 d_quad='$d_quad'
16769 d_readdir='$d_readdir'
16770 d_readlink='$d_readlink'
16771 d_readv='$d_readv'
16772 d_recvmsg='$d_recvmsg'
16773 d_rename='$d_rename'
16774 d_rewinddir='$d_rewinddir'
16775 d_rmdir='$d_rmdir'
16776 d_safebcpy='$d_safebcpy'
16777 d_safemcpy='$d_safemcpy'
16778 d_sanemcmp='$d_sanemcmp'
16779 d_sbrkproto='$d_sbrkproto'
16780 d_sched_yield='$d_sched_yield'
16781 d_scm_rights='$d_scm_rights'
16782 d_seekdir='$d_seekdir'
16783 d_select='$d_select'
16784 d_sem='$d_sem'
16785 d_semctl='$d_semctl'
16786 d_semctl_semid_ds='$d_semctl_semid_ds'
16787 d_semctl_semun='$d_semctl_semun'
16788 d_semget='$d_semget'
16789 d_semop='$d_semop'
16790 d_sendmsg='$d_sendmsg'
16791 d_setegid='$d_setegid'
16792 d_seteuid='$d_seteuid'
16793 d_setgrent='$d_setgrent'
16794 d_setgrps='$d_setgrps'
16795 d_sethent='$d_sethent'
16796 d_setitimer='$d_setitimer'
16797 d_setlinebuf='$d_setlinebuf'
16798 d_setlocale='$d_setlocale'
16799 d_setnent='$d_setnent'
16800 d_setpent='$d_setpent'
16801 d_setpgid='$d_setpgid'
16802 d_setpgrp2='$d_setpgrp2'
16803 d_setpgrp='$d_setpgrp'
16804 d_setprior='$d_setprior'
16805 d_setproctitle='$d_setproctitle'
16806 d_setpwent='$d_setpwent'
16807 d_setregid='$d_setregid'
16808 d_setresgid='$d_setresgid'
16809 d_setresuid='$d_setresuid'
16810 d_setreuid='$d_setreuid'
16811 d_setrgid='$d_setrgid'
16812 d_setruid='$d_setruid'
16813 d_setsent='$d_setsent'
16814 d_setsid='$d_setsid'
16815 d_setvbuf='$d_setvbuf'
16816 d_sfio='$d_sfio'
16817 d_shm='$d_shm'
16818 d_shmat='$d_shmat'
16819 d_shmatprototype='$d_shmatprototype'
16820 d_shmctl='$d_shmctl'
16821 d_shmdt='$d_shmdt'
16822 d_shmget='$d_shmget'
16823 d_sigaction='$d_sigaction'
16824 d_sigprocmask='$d_sigprocmask'
16825 d_sigsetjmp='$d_sigsetjmp'
16826 d_sockatmark='$d_sockatmark'
16827 d_sockatmarkproto='$d_sockatmarkproto'
16828 d_socket='$d_socket'
16829 d_socklen_t='$d_socklen_t'
16830 d_sockpair='$d_sockpair'
16831 d_socks5_init='$d_socks5_init'
16832 d_sqrtl='$d_sqrtl'
16833 d_sresgproto='$d_sresgproto'
16834 d_sresuproto='$d_sresuproto'
16835 d_statblks='$d_statblks'
16836 d_statfs_f_flags='$d_statfs_f_flags'
16837 d_statfs_s='$d_statfs_s'
16838 d_statvfs='$d_statvfs'
16839 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16840 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16841 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16842 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16843 d_stdio_stream_array='$d_stdio_stream_array'
16844 d_stdiobase='$d_stdiobase'
16845 d_stdstdio='$d_stdstdio'
16846 d_strchr='$d_strchr'
16847 d_strcoll='$d_strcoll'
16848 d_strctcpy='$d_strctcpy'
16849 d_strerrm='$d_strerrm'
16850 d_strerror='$d_strerror'
16851 d_strftime='$d_strftime'
16852 d_strtod='$d_strtod'
16853 d_strtol='$d_strtol'
16854 d_strtold='$d_strtold'
16855 d_strtoll='$d_strtoll'
16856 d_strtoq='$d_strtoq'
16857 d_strtoul='$d_strtoul'
16858 d_strtoull='$d_strtoull'
16859 d_strtouq='$d_strtouq'
16860 d_strxfrm='$d_strxfrm'
16861 d_suidsafe='$d_suidsafe'
16862 d_symlink='$d_symlink'
16863 d_syscall='$d_syscall'
16864 d_syscallproto='$d_syscallproto'
16865 d_sysconf='$d_sysconf'
16866 d_sysernlst='$d_sysernlst'
16867 d_syserrlst='$d_syserrlst'
16868 d_system='$d_system'
16869 d_tcgetpgrp='$d_tcgetpgrp'
16870 d_tcsetpgrp='$d_tcsetpgrp'
16871 d_telldir='$d_telldir'
16872 d_telldirproto='$d_telldirproto'
16873 d_time='$d_time'
16874 d_times='$d_times'
16875 d_truncate='$d_truncate'
16876 d_tzname='$d_tzname'
16877 d_u32align='$d_u32align'
16878 d_ualarm='$d_ualarm'
16879 d_umask='$d_umask'
16880 d_uname='$d_uname'
16881 d_union_semun='$d_union_semun'
16882 d_usleep='$d_usleep'
16883 d_usleepproto='$d_usleepproto'
16884 d_ustat='$d_ustat'
16885 d_vendorarch='$d_vendorarch'
16886 d_vendorbin='$d_vendorbin'
16887 d_vendorlib='$d_vendorlib'
16888 d_vfork='$d_vfork'
16889 d_void_closedir='$d_void_closedir'
16890 d_voidsig='$d_voidsig'
16891 d_voidtty='$d_voidtty'
16892 d_volatile='$d_volatile'
16893 d_vprintf='$d_vprintf'
16894 d_wait4='$d_wait4'
16895 d_waitpid='$d_waitpid'
16896 d_wcstombs='$d_wcstombs'
16897 d_wctomb='$d_wctomb'
16898 d_writev='$d_writev'
16899 d_xenix='$d_xenix'
16900 date='$date'
16901 db_hashtype='$db_hashtype'
16902 db_prefixtype='$db_prefixtype'
16903 db_version_major='$db_version_major'
16904 db_version_minor='$db_version_minor'
16905 db_version_patch='$db_version_patch'
16906 defvoidused='$defvoidused'
16907 direntrytype='$direntrytype'
16908 dlext='$dlext'
16909 dlsrc='$dlsrc'
16910 doublesize='$doublesize'
16911 drand01='$drand01'
16912 dynamic_ext='$dynamic_ext'
16913 eagain='$eagain'
16914 ebcdic='$ebcdic'
16915 echo='$echo'
16916 egrep='$egrep'
16917 emacs='$emacs'
16918 eunicefix='$eunicefix'
16919 exe_ext='$exe_ext'
16920 expr='$expr'
16921 extensions='$extensions'
16922 fflushNULL='$fflushNULL'
16923 fflushall='$fflushall'
16924 find='$find'
16925 firstmakefile='$firstmakefile'
16926 flex='$flex'
16927 fpossize='$fpossize'
16928 fpostype='$fpostype'
16929 freetype='$freetype'
16930 from='$from'
16931 full_ar='$full_ar'
16932 full_csh='$full_csh'
16933 full_sed='$full_sed'
16934 gccosandvers='$gccosandvers'
16935 gccversion='$gccversion'
16936 gidformat='$gidformat'
16937 gidsign='$gidsign'
16938 gidsize='$gidsize'
16939 gidtype='$gidtype'
16940 glibpth='$glibpth'
16941 grep='$grep'
16942 groupcat='$groupcat'
16943 groupstype='$groupstype'
16944 gzip='$gzip'
16945 h_fcntl='$h_fcntl'
16946 h_sysfile='$h_sysfile'
16947 hint='$hint'
16948 hostcat='$hostcat'
16949 i16size='$i16size'
16950 i16type='$i16type'
16951 i32size='$i32size'
16952 i32type='$i32type'
16953 i64size='$i64size'
16954 i64type='$i64type'
16955 i8size='$i8size'
16956 i8type='$i8type'
16957 i_arpainet='$i_arpainet'
16958 i_bsdioctl='$i_bsdioctl'
16959 i_db='$i_db'
16960 i_dbm='$i_dbm'
16961 i_dirent='$i_dirent'
16962 i_dld='$i_dld'
16963 i_dlfcn='$i_dlfcn'
16964 i_fcntl='$i_fcntl'
16965 i_float='$i_float'
16966 i_gdbm='$i_gdbm'
16967 i_grp='$i_grp'
16968 i_iconv='$i_iconv'
16969 i_ieeefp='$i_ieeefp'
16970 i_inttypes='$i_inttypes'
16971 i_libutil='$i_libutil'
16972 i_limits='$i_limits'
16973 i_locale='$i_locale'
16974 i_machcthr='$i_machcthr'
16975 i_malloc='$i_malloc'
16976 i_math='$i_math'
16977 i_memory='$i_memory'
16978 i_mntent='$i_mntent'
16979 i_ndbm='$i_ndbm'
16980 i_netdb='$i_netdb'
16981 i_neterrno='$i_neterrno'
16982 i_netinettcp='$i_netinettcp'
16983 i_niin='$i_niin'
16984 i_poll='$i_poll'
16985 i_prot='$i_prot'
16986 i_pthread='$i_pthread'
16987 i_pwd='$i_pwd'
16988 i_rpcsvcdbm='$i_rpcsvcdbm'
16989 i_sfio='$i_sfio'
16990 i_sgtty='$i_sgtty'
16991 i_shadow='$i_shadow'
16992 i_socks='$i_socks'
16993 i_stdarg='$i_stdarg'
16994 i_stddef='$i_stddef'
16995 i_stdlib='$i_stdlib'
16996 i_string='$i_string'
16997 i_sunmath='$i_sunmath'
16998 i_sysaccess='$i_sysaccess'
16999 i_sysdir='$i_sysdir'
17000 i_sysfile='$i_sysfile'
17001 i_sysfilio='$i_sysfilio'
17002 i_sysin='$i_sysin'
17003 i_sysioctl='$i_sysioctl'
17004 i_syslog='$i_syslog'
17005 i_sysmman='$i_sysmman'
17006 i_sysmode='$i_sysmode'
17007 i_sysmount='$i_sysmount'
17008 i_sysndir='$i_sysndir'
17009 i_sysparam='$i_sysparam'
17010 i_sysresrc='$i_sysresrc'
17011 i_syssecrt='$i_syssecrt'
17012 i_sysselct='$i_sysselct'
17013 i_syssockio='$i_syssockio'
17014 i_sysstat='$i_sysstat'
17015 i_sysstatfs='$i_sysstatfs'
17016 i_sysstatvfs='$i_sysstatvfs'
17017 i_systime='$i_systime'
17018 i_systimek='$i_systimek'
17019 i_systimes='$i_systimes'
17020 i_systypes='$i_systypes'
17021 i_sysuio='$i_sysuio'
17022 i_sysun='$i_sysun'
17023 i_sysutsname='$i_sysutsname'
17024 i_sysvfs='$i_sysvfs'
17025 i_syswait='$i_syswait'
17026 i_termio='$i_termio'
17027 i_termios='$i_termios'
17028 i_time='$i_time'
17029 i_unistd='$i_unistd'
17030 i_ustat='$i_ustat'
17031 i_utime='$i_utime'
17032 i_values='$i_values'
17033 i_varargs='$i_varargs'
17034 i_varhdr='$i_varhdr'
17035 i_vfork='$i_vfork'
17036 ignore_versioned_solibs='$ignore_versioned_solibs'
17037 inc_version_list='$inc_version_list'
17038 inc_version_list_init='$inc_version_list_init'
17039 incpath='$incpath'
17040 inews='$inews'
17041 installarchlib='$installarchlib'
17042 installbin='$installbin'
17043 installman1dir='$installman1dir'
17044 installman3dir='$installman3dir'
17045 installprefix='$installprefix'
17046 installprefixexp='$installprefixexp'
17047 installprivlib='$installprivlib'
17048 installscript='$installscript'
17049 installsitearch='$installsitearch'
17050 installsitebin='$installsitebin'
17051 installsitelib='$installsitelib'
17052 installstyle='$installstyle'
17053 installusrbinperl='$installusrbinperl'
17054 installvendorarch='$installvendorarch'
17055 installvendorbin='$installvendorbin'
17056 installvendorlib='$installvendorlib'
17057 intsize='$intsize'
17058 issymlink='$issymlink'
17059 ivdformat='$ivdformat'
17060 ivsize='$ivsize'
17061 ivtype='$ivtype'
17062 known_extensions='$known_extensions'
17063 ksh='$ksh'
17064 ld='$ld'
17065 lddlflags='$lddlflags'
17066 ldflags='$ldflags'
17067 ldflags_uselargefiles='$ldflags_uselargefiles'
17068 ldlibpthname='$ldlibpthname'
17069 less='$less'
17070 lib_ext='$lib_ext'
17071 libc='$libc'
17072 libperl='$libperl'
17073 libpth='$libpth'
17074 libs='$libs'
17075 libsdirs='$libsdirs'
17076 libsfiles='$libsfiles'
17077 libsfound='$libsfound'
17078 libspath='$libspath'
17079 libswanted='$libswanted'
17080 libswanted_uselargefiles='$libswanted_uselargefiles'
17081 line='$line'
17082 lint='$lint'
17083 lkflags='$lkflags'
17084 ln='$ln'
17085 lns='$lns'
17086 locincpth='$locincpth'
17087 loclibpth='$loclibpth'
17088 longdblsize='$longdblsize'
17089 longlongsize='$longlongsize'
17090 longsize='$longsize'
17091 lp='$lp'
17092 lpr='$lpr'
17093 ls='$ls'
17094 lseeksize='$lseeksize'
17095 lseektype='$lseektype'
17096 mail='$mail'
17097 mailx='$mailx'
17098 make='$make'
17099 make_set_make='$make_set_make'
17100 mallocobj='$mallocobj'
17101 mallocsrc='$mallocsrc'
17102 malloctype='$malloctype'
17103 man1dir='$man1dir'
17104 man1direxp='$man1direxp'
17105 man1ext='$man1ext'
17106 man3dir='$man3dir'
17107 man3direxp='$man3direxp'
17108 man3ext='$man3ext'
17109 mips_type='$mips_type'
17110 mkdir='$mkdir'
17111 mmaptype='$mmaptype'
17112 modetype='$modetype'
17113 more='$more'
17114 multiarch='$multiarch'
17115 mv='$mv'
17116 myarchname='$myarchname'
17117 mydomain='$mydomain'
17118 myhostname='$myhostname'
17119 myuname='$myuname'
17120 n='$n'
17121 need_va_copy='$need_va_copy'
17122 netdb_hlen_type='$netdb_hlen_type'
17123 netdb_host_type='$netdb_host_type'
17124 netdb_name_type='$netdb_name_type'
17125 netdb_net_type='$netdb_net_type'
17126 nm='$nm'
17127 nm_opt='$nm_opt'
17128 nm_so_opt='$nm_so_opt'
17129 nonxs_ext='$nonxs_ext'
17130 nroff='$nroff'
17131 nvEUformat='$nvEUformat'
17132 nvFUformat='$nvFUformat'
17133 nvGUformat='$nvGUformat'
17134 nveformat='$nveformat'
17135 nvfformat='$nvfformat'
17136 nvgformat='$nvgformat'
17137 nvsize='$nvsize'
17138 nvtype='$nvtype'
17139 o_nonblock='$o_nonblock'
17140 obj_ext='$obj_ext'
17141 old_pthread_create_joinable='$old_pthread_create_joinable'
17142 optimize='$optimize'
17143 orderlib='$orderlib'
17144 osname='$osname'
17145 osvers='$osvers'
17146 otherlibdirs='$otherlibdirs'
17147 package='$package'
17148 pager='$pager'
17149 passcat='$passcat'
17150 patchlevel='$patchlevel'
17151 path_sep='$path_sep'
17152 perl5='$perl5'
17153 perl='$perl'
17154 perl_patchlevel='$perl_patchlevel'
17155 perladmin='$perladmin'
17156 perllibs='$perllibs'
17157 perlpath='$perlpath'
17158 pg='$pg'
17159 phostname='$phostname'
17160 pidtype='$pidtype'
17161 plibpth='$plibpth'
17162 pm_apiversion='$pm_apiversion'
17163 pmake='$pmake'
17164 pr='$pr'
17165 prefix='$prefix'
17166 prefixexp='$prefixexp'
17167 privlib='$privlib'
17168 privlibexp='$privlibexp'
17169 prototype='$prototype'
17170 ptrsize='$ptrsize'
17171 quadkind='$quadkind'
17172 quadtype='$quadtype'
17173 randbits='$randbits'
17174 randfunc='$randfunc'
17175 randseedtype='$randseedtype'
17176 ranlib='$ranlib'
17177 rd_nodata='$rd_nodata'
17178 revision='$revision'
17179 rm='$rm'
17180 rmail='$rmail'
17181 run='$run'
17182 runnm='$runnm'
17183 sPRIEUldbl='$sPRIEUldbl'
17184 sPRIFUldbl='$sPRIFUldbl'
17185 sPRIGUldbl='$sPRIGUldbl'
17186 sPRIXU64='$sPRIXU64'
17187 sPRId64='$sPRId64'
17188 sPRIeldbl='$sPRIeldbl'
17189 sPRIfldbl='$sPRIfldbl'
17190 sPRIgldbl='$sPRIgldbl'
17191 sPRIi64='$sPRIi64'
17192 sPRIo64='$sPRIo64'
17193 sPRIu64='$sPRIu64'
17194 sPRIx64='$sPRIx64'
17195 sSCNfldbl='$sSCNfldbl'
17196 sched_yield='$sched_yield'
17197 scriptdir='$scriptdir'
17198 scriptdirexp='$scriptdirexp'
17199 sed='$sed'
17200 seedfunc='$seedfunc'
17201 selectminbits='$selectminbits'
17202 selecttype='$selecttype'
17203 sendmail='$sendmail'
17204 sh='$sh'
17205 shar='$shar'
17206 sharpbang='$sharpbang'
17207 shmattype='$shmattype'
17208 shortsize='$shortsize'
17209 shrpenv='$shrpenv'
17210 shsharp='$shsharp'
17211 sig_count='$sig_count'
17212 sig_name='$sig_name'
17213 sig_name_init='$sig_name_init'
17214 sig_num='$sig_num'
17215 sig_num_init='$sig_num_init'
17216 sig_size='$sig_size'
17217 signal_t='$signal_t'
17218 sitearch='$sitearch'
17219 sitearchexp='$sitearchexp'
17220 sitebin='$sitebin'
17221 sitebinexp='$sitebinexp'
17222 sitelib='$sitelib'
17223 sitelib_stem='$sitelib_stem'
17224 sitelibexp='$sitelibexp'
17225 siteprefix='$siteprefix'
17226 siteprefixexp='$siteprefixexp'
17227 sizesize='$sizesize'
17228 sizetype='$sizetype'
17229 sleep='$sleep'
17230 smail='$smail'
17231 so='$so'
17232 sockethdr='$sockethdr'
17233 socketlib='$socketlib'
17234 socksizetype='$socksizetype'
17235 sort='$sort'
17236 spackage='$spackage'
17237 spitshell='$spitshell'
17238 src='$src'
17239 ssizetype='$ssizetype'
17240 startperl='$startperl'
17241 startsh='$startsh'
17242 static_ext='$static_ext'
17243 stdchar='$stdchar'
17244 stdio_base='$stdio_base'
17245 stdio_bufsiz='$stdio_bufsiz'
17246 stdio_cnt='$stdio_cnt'
17247 stdio_filbuf='$stdio_filbuf'
17248 stdio_ptr='$stdio_ptr'
17249 stdio_stream_array='$stdio_stream_array'
17250 strings='$strings'
17251 submit='$submit'
17252 subversion='$subversion'
17253 sysman='$sysman'
17254 tail='$tail'
17255 tar='$tar'
17256 targetarch='$targetarch'
17257 tbl='$tbl'
17258 tee='$tee'
17259 test='$test'
17260 timeincl='$timeincl'
17261 timetype='$timetype'
17262 to='$to'
17263 touch='$touch'
17264 tr='$tr'
17265 trnl='$trnl'
17266 troff='$troff'
17267 u16size='$u16size'
17268 u16type='$u16type'
17269 u32size='$u32size'
17270 u32type='$u32type'
17271 u64size='$u64size'
17272 u64type='$u64type'
17273 u8size='$u8size'
17274 u8type='$u8type'
17275 uidformat='$uidformat'
17276 uidsign='$uidsign'
17277 uidsize='$uidsize'
17278 uidtype='$uidtype'
17279 uname='$uname'
17280 uniq='$uniq'
17281 uquadtype='$uquadtype'
17282 use5005threads='$use5005threads'
17283 use64bitall='$use64bitall'
17284 use64bitint='$use64bitint'
17285 usecrosscompile='$usecrosscompile'
17286 usedl='$usedl'
17287 useithreads='$useithreads'
17288 uselargefiles='$uselargefiles'
17289 uselongdouble='$uselongdouble'
17290 usemorebits='$usemorebits'
17291 usemultiplicity='$usemultiplicity'
17292 usemymalloc='$usemymalloc'
17293 usenm='$usenm'
17294 useopcode='$useopcode'
17295 useperlio='$useperlio'
17296 useposix='$useposix'
17297 usereentrant='$usereentrant'
17298 usesfio='$usesfio'
17299 useshrplib='$useshrplib'
17300 usesocks='$usesocks'
17301 usethreads='$usethreads'
17302 usevendorprefix='$usevendorprefix'
17303 usevfork='$usevfork'
17304 usrinc='$usrinc'
17305 uuname='$uuname'
17306 uvXUformat='$uvXUformat'
17307 uvoformat='$uvoformat'
17308 uvsize='$uvsize'
17309 uvtype='$uvtype'
17310 uvuformat='$uvuformat'
17311 uvxformat='$uvxformat'
17312 vendorarch='$vendorarch'
17313 vendorarchexp='$vendorarchexp'
17314 vendorbin='$vendorbin'
17315 vendorbinexp='$vendorbinexp'
17316 vendorlib='$vendorlib'
17317 vendorlib_stem='$vendorlib_stem'
17318 vendorlibexp='$vendorlibexp'
17319 vendorprefix='$vendorprefix'
17320 vendorprefixexp='$vendorprefixexp'
17321 version='$version'
17322 versiononly='$versiononly'
17323 vi='$vi'
17324 voidflags='$voidflags'
17325 xlibpth='$xlibpth'
17326 xs_apiversion='$xs_apiversion'
17327 yacc='$yacc'
17328 yaccflags='$yaccflags'
17329 zcat='$zcat'
17330 zip='$zip'
17331 EOT
17332
17333 : Add in command line options if available
17334 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17335
17336 : add special variables
17337 $test -f $src/patchlevel.h && \
17338 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
17339 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
17340 echo "PERL_CONFIG_SH=true" >>config.sh
17341
17342 : propagate old symbols
17343 if $test -f UU/config.sh; then
17344         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
17345         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
17346         $sort | $uniq -u >UU/oldsyms
17347         set X `cat UU/oldsyms`
17348         shift
17349         case $# in
17350         0) ;;
17351         *)
17352                 cat <<EOM
17353 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17354 EOM
17355                 echo "# Variables propagated from previous config.sh file." >>config.sh
17356                 for sym in `cat UU/oldsyms`; do
17357                         echo "    Propagating $hint variable "'$'"$sym..."
17358                         eval 'tmp="$'"${sym}"'"'
17359                         echo "$tmp" | \
17360                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17361                 done
17362                 ;;
17363         esac
17364 fi
17365
17366 : Finish up by extracting the .SH files
17367 case "$alldone" in
17368 exit)
17369         $rm -rf UU
17370         echo "Extraction done."
17371         exit 0
17372         ;;
17373 cont)
17374         ;;
17375 '')
17376         dflt=''
17377         nostick=true
17378         $cat <<EOM
17379
17380 If you'd like to make any changes to the config.sh file before I begin
17381 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17382
17383 EOM
17384         rp="Press return or use a shell escape to edit config.sh:"
17385         . UU/myread
17386         nostick=''
17387         case "$ans" in
17388         '') ;;
17389         *) : in case they cannot read
17390                 sh 1>&4 -c "$ans";;
17391         esac
17392         ;;
17393 esac
17394
17395 : if this fails, just run all the .SH files by hand
17396 . ./config.sh
17397
17398 echo " "
17399 exec 1>&4
17400 pwd=`pwd`
17401 . ./UU/extract
17402 cd $pwd
17403
17404 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17405         dflt=y
17406         case "$silent" in
17407         true) ;;
17408         *)
17409                 $cat <<EOM
17410
17411 Now you need to generate make dependencies by running "$make depend".
17412 You might prefer to run it in background: "$make depend > makedepend.out &"
17413 It can take a while, so you might not want to run it right now.
17414
17415 EOM
17416                 ;;
17417         esac
17418         rp="Run $make depend now?"
17419         . UU/myread
17420         case "$ans" in
17421         y*)
17422                 $make depend && echo "Now you must run '$make'."
17423                 ;;
17424         *)
17425                 echo "You must run '$make depend' then '$make'."
17426                 ;;
17427         esac
17428 elif test -f [Mm]akefile; then
17429         echo " "
17430         echo "Now you must run a $make."
17431 else
17432         echo "Configure done."
17433 fi
17434
17435 if $test -f Policy.sh; then
17436     $cat <<EOM
17437
17438 If you compile $package on a different machine or from a different object
17439 directory, copy the Policy.sh file from this object directory to the
17440 new one before you run Configure -- this will help you with most of
17441 the policy defaults.
17442
17443 EOM
17444 fi
17445 if $test -f config.msg; then
17446     echo "Hmm.  I also noted the following information while running:"
17447     echo " "
17448     $cat config.msg >&4
17449     $rm -f config.msg
17450 fi
17451 $rm -f kit*isdone ark*isdone
17452 $rm -rf UU
17453
17454 : End of Configure
17455