The $sh_c didn't fly.
[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 Thu Jan  4 22:39:08 EET 2001 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 alignbytes=''
277 ansi2knr=''
278 archlib=''
279 archlibexp=''
280 d_archlib=''
281 installarchlib=''
282 archname=''
283 myarchname=''
284 d_atolf=''
285 d_atoll=''
286 baserev=''
287 bin=''
288 binexp=''
289 installbin=''
290 bincompat5005=''
291 d_bincompat5005=''
292 byteorder=''
293 cc=''
294 ccflags=''
295 cppflags=''
296 ldflags=''
297 lkflags=''
298 locincpth=''
299 optimize=''
300 cf_email=''
301 cf_by=''
302 cf_time=''
303 charsize=''
304 contains=''
305 cpp_stuff=''
306 cpplast=''
307 cppminus=''
308 cpprun=''
309 cppstdin=''
310 crosscompile=''
311 d__fwalk=''
312 d_access=''
313 d_accessx=''
314 d_alarm=''
315 d_attribut=''
316 d_bcmp=''
317 d_bcopy=''
318 d_bzero=''
319 d_casti32=''
320 castflags=''
321 d_castneg=''
322 d_chown=''
323 d_chroot=''
324 d_chsize=''
325 d_closedir=''
326 d_void_closedir=''
327 d_const=''
328 cryptlib=''
329 d_crypt=''
330 d_csh=''
331 full_csh=''
332 d_cuserid=''
333 d_dbl_dig=''
334 d_difftime=''
335 d_dlerror=''
336 d_dlopen=''
337 d_dlsymun=''
338 d_dosuid=''
339 d_suidsafe=''
340 d_drand48proto=''
341 d_dup2=''
342 d_eaccess=''
343 d_endgrent=''
344 d_endhent=''
345 d_endnent=''
346 d_endpent=''
347 d_endpwent=''
348 d_endsent=''
349 d_fchmod=''
350 d_fchown=''
351 d_fcntl=''
352 d_fcntl_can_lock=''
353 d_fd_macros=''
354 d_fd_set=''
355 d_fds_bits=''
356 d_fgetpos=''
357 d_flexfnam=''
358 d_flock=''
359 d_fork=''
360 d_fpos64_t=''
361 d_frexpl=''
362 d_fs_data_s=''
363 d_fseeko=''
364 d_fsetpos=''
365 d_fstatfs=''
366 d_fsync=''
367 d_ftello=''
368 d_ftime=''
369 d_gettimeod=''
370 d_Gconvert=''
371 d_getcwd=''
372 d_getespwnam=''
373 d_getfsstat=''
374 d_getgrent=''
375 d_getgrps=''
376 d_gethbyaddr=''
377 d_gethbyname=''
378 d_gethent=''
379 aphostname=''
380 d_gethname=''
381 d_phostname=''
382 d_uname=''
383 d_gethostprotos=''
384 d_getlogin=''
385 d_getmnt=''
386 d_getmntent=''
387 d_getnbyaddr=''
388 d_getnbyname=''
389 d_getnent=''
390 d_getnetprotos=''
391 d_getpagsz=''
392 d_getpent=''
393 d_getpgid=''
394 d_getpgrp2=''
395 d_bsdgetpgrp=''
396 d_getpgrp=''
397 d_getppid=''
398 d_getprior=''
399 d_getpbyname=''
400 d_getpbynumber=''
401 d_getprotoprotos=''
402 d_getprpwnam=''
403 d_getpwent=''
404 d_getsent=''
405 d_getservprotos=''
406 d_getspnam=''
407 d_getsbyname=''
408 d_getsbyport=''
409 d_gnulibc=''
410 d_hasmntopt=''
411 d_htonl=''
412 d_iconv=''
413 d_inetaton=''
414 d_int64_t=''
415 d_isascii=''
416 d_isnan=''
417 d_isnanl=''
418 d_killpg=''
419 d_lchown=''
420 d_ldbl_dig=''
421 d_link=''
422 d_locconv=''
423 d_lockf=''
424 d_longdbl=''
425 longdblsize=''
426 d_longlong=''
427 longlongsize=''
428 d_lseekproto=''
429 d_lstat=''
430 d_madvise=''
431 d_mblen=''
432 d_mbstowcs=''
433 d_mbtowc=''
434 d_memchr=''
435 d_memcmp=''
436 d_memcpy=''
437 d_memmove=''
438 d_memset=''
439 d_mkdir=''
440 d_mkdtemp=''
441 d_mkfifo=''
442 d_mkstemp=''
443 d_mkstemps=''
444 d_mktime=''
445 d_mmap=''
446 mmaptype=''
447 d_modfl=''
448 d_mprotect=''
449 d_msg=''
450 d_msgctl=''
451 d_msgget=''
452 d_msgrcv=''
453 d_msgsnd=''
454 d_msync=''
455 d_munmap=''
456 d_nice=''
457 d_off64_t=''
458 d_open3=''
459 d_fpathconf=''
460 d_pathconf=''
461 d_pause=''
462 d_pipe=''
463 d_poll=''
464 d_portable=''
465 d_old_pthread_create_joinable=''
466 old_pthread_create_joinable=''
467 d_pthread_yield=''
468 d_sched_yield=''
469 sched_yield=''
470 d_qgcvt=''
471 d_readdir=''
472 d_rewinddir=''
473 d_seekdir=''
474 d_telldir=''
475 d_readlink=''
476 d_rename=''
477 d_rmdir=''
478 d_safebcpy=''
479 d_safemcpy=''
480 d_sanemcmp=''
481 d_sbrkproto=''
482 d_select=''
483 d_sem=''
484 d_semctl=''
485 d_semget=''
486 d_semop=''
487 d_setegid=''
488 d_seteuid=''
489 d_setgrent=''
490 d_setgrps=''
491 d_sethent=''
492 d_setlinebuf=''
493 d_setlocale=''
494 d_setnent=''
495 d_setpent=''
496 d_setpgid=''
497 d_setpgrp2=''
498 d_bsdsetpgrp=''
499 d_setpgrp=''
500 d_setprior=''
501 d_setproctitle=''
502 d_setpwent=''
503 d_setregid=''
504 d_setresgid=''
505 d_setresuid=''
506 d_setreuid=''
507 d_setrgid=''
508 d_setruid=''
509 d_setsent=''
510 d_setsid=''
511 d_setvbuf=''
512 d_sfio=''
513 usesfio=''
514 d_shm=''
515 d_shmat=''
516 d_shmatprototype=''
517 shmattype=''
518 d_shmctl=''
519 d_shmdt=''
520 d_shmget=''
521 d_sigaction=''
522 d_sigsetjmp=''
523 d_msg_ctrunc=''
524 d_msg_dontroute=''
525 d_msg_oob=''
526 d_msg_peek=''
527 d_msg_proxy=''
528 d_oldsock=''
529 d_scm_rights=''
530 d_socket=''
531 d_sockpair=''
532 sockethdr=''
533 socketlib=''
534 d_socklen_t=''
535 d_socks5_init=''
536 d_sqrtl=''
537 d_statblks=''
538 d_statfs_f_flags=''
539 d_statfs_s=''
540 d_fstatvfs=''
541 d_statvfs=''
542 d_stdio_cnt_lval=''
543 d_stdio_ptr_lval=''
544 d_stdio_ptr_lval_nochange_cnt=''
545 d_stdio_ptr_lval_sets_cnt=''
546 d_stdiobase=''
547 d_stdstdio=''
548 stdio_base=''
549 stdio_bufsiz=''
550 stdio_cnt=''
551 stdio_filbuf=''
552 stdio_ptr=''
553 d_index=''
554 d_strchr=''
555 d_strcoll=''
556 d_strctcpy=''
557 d_strerrm=''
558 d_strerror=''
559 d_sysernlst=''
560 d_syserrlst=''
561 d_strtod=''
562 d_strtol=''
563 d_strtold=''
564 d_strtoll=''
565 d_strtoq=''
566 d_strtoul=''
567 d_strtoull=''
568 d_strtouq=''
569 d_strxfrm=''
570 d_symlink=''
571 d_syscall=''
572 d_sysconf=''
573 d_system=''
574 d_tcgetpgrp=''
575 d_tcsetpgrp=''
576 d_telldirproto=''
577 d_time=''
578 timetype=''
579 clocktype=''
580 d_times=''
581 d_truncate=''
582 d_tzname=''
583 d_umask=''
584 d_semctl_semid_ds=''
585 d_semctl_semun=''
586 d_union_semun=''
587 d_ustat=''
588 d_vfork=''
589 usevfork=''
590 d_voidsig=''
591 signal_t=''
592 d_volatile=''
593 d_charvspr=''
594 d_vprintf=''
595 d_wait4=''
596 d_waitpid=''
597 d_wcstombs=''
598 d_wctomb=''
599 dlext=''
600 cccdlflags=''
601 ccdlflags=''
602 dlsrc=''
603 ld=''
604 lddlflags=''
605 usedl=''
606 doublesize=''
607 ebcdic=''
608 fflushNULL=''
609 fflushall=''
610 fpossize=''
611 fpostype=''
612 gccosandvers=''
613 gccversion=''
614 gidformat=''
615 gidsign=''
616 gidsize=''
617 gidtype=''
618 groupstype=''
619 h_fcntl=''
620 h_sysfile=''
621 i_arpainet=''
622 db_hashtype=''
623 db_prefixtype=''
624 i_db=''
625 i_dbm=''
626 i_rpcsvcdbm=''
627 d_dirnamlen=''
628 direntrytype=''
629 i_dirent=''
630 i_dld=''
631 i_dlfcn=''
632 i_fcntl=''
633 i_float=''
634 i_gdbm=''
635 d_grpasswd=''
636 i_grp=''
637 i_iconv=''
638 i_ieeefp=''
639 i_inttypes=''
640 i_libutil=''
641 i_limits=''
642 i_locale=''
643 i_machcthr=''
644 i_malloc=''
645 i_math=''
646 i_memory=''
647 i_mntent=''
648 i_ndbm=''
649 i_netdb=''
650 i_neterrno=''
651 i_netinettcp=''
652 i_niin=''
653 i_sysin=''
654 i_poll=''
655 i_prot=''
656 i_pthread=''
657 d_pwage=''
658 d_pwchange=''
659 d_pwclass=''
660 d_pwcomment=''
661 d_pwexpire=''
662 d_pwgecos=''
663 d_pwpasswd=''
664 d_pwquota=''
665 i_pwd=''
666 i_sfio=''
667 i_shadow=''
668 i_socks=''
669 i_stddef=''
670 i_stdlib=''
671 i_string=''
672 strings=''
673 i_sunmath=''
674 i_sysaccess=''
675 i_sysdir=''
676 i_sysfile=''
677 d_voidtty=''
678 i_bsdioctl=''
679 i_sysfilio=''
680 i_sysioctl=''
681 i_syssockio=''
682 i_syslog=''
683 i_sysmman=''
684 i_sysmode=''
685 i_sysmount=''
686 i_sysndir=''
687 i_sysparam=''
688 i_sysresrc=''
689 i_syssecrt=''
690 i_sysselct=''
691 i_sysstat=''
692 i_sysstatfs=''
693 i_sysstatvfs=''
694 i_systimes=''
695 i_systypes=''
696 i_sysuio=''
697 i_sysun=''
698 i_sysutsname=''
699 i_sysvfs=''
700 i_syswait=''
701 i_sgtty=''
702 i_termio=''
703 i_termios=''
704 i_systime=''
705 i_systimek=''
706 i_time=''
707 timeincl=''
708 i_unistd=''
709 i_ustat=''
710 i_utime=''
711 i_values=''
712 i_stdarg=''
713 i_varargs=''
714 i_varhdr=''
715 i_vfork=''
716 inc_version_list=''
717 inc_version_list_init=''
718 installprefix=''
719 installprefixexp=''
720 installstyle=''
721 installusrbinperl=''
722 intsize=''
723 longsize=''
724 shortsize=''
725 issymlink=''
726 libc=''
727 ldlibpthname=''
728 libperl=''
729 shrpenv=''
730 useshrplib=''
731 glibpth=''
732 libpth=''
733 loclibpth=''
734 plibpth=''
735 xlibpth=''
736 ignore_versioned_solibs=''
737 libs=''
738 libsdirs=''
739 libsfiles=''
740 libsfound=''
741 libspath=''
742 lns=''
743 d_PRIEUldbl=''
744 d_PRIFUldbl=''
745 d_PRIGUldbl=''
746 d_PRIeldbl=''
747 d_PRIfldbl=''
748 d_PRIgldbl=''
749 d_SCNfldbl=''
750 sPRIEUldbl=''
751 sPRIFUldbl=''
752 sPRIGUldbl=''
753 sPRIeldbl=''
754 sPRIfldbl=''
755 sPRIgldbl=''
756 sSCNfldbl=''
757 lseeksize=''
758 lseektype=''
759 make_set_make=''
760 d_mymalloc=''
761 freetype=''
762 mallocobj=''
763 mallocsrc=''
764 malloctype=''
765 usemymalloc=''
766 installman1dir=''
767 man1dir=''
768 man1direxp=''
769 man1ext=''
770 installman3dir=''
771 man3dir=''
772 man3direxp=''
773 man3ext=''
774 modetype=''
775 multiarch=''
776 mydomain=''
777 myhostname=''
778 phostname=''
779 c=''
780 n=''
781 d_eofnblk=''
782 eagain=''
783 o_nonblock=''
784 rd_nodata=''
785 need_va_copy=''
786 netdb_hlen_type=''
787 netdb_host_type=''
788 netdb_name_type=''
789 netdb_net_type=''
790 groupcat=''
791 hostcat=''
792 passcat=''
793 orderlib=''
794 ranlib=''
795 d_perl_otherlibdirs=''
796 otherlibdirs=''
797 package=''
798 spackage=''
799 pager=''
800 api_revision=''
801 api_subversion=''
802 api_version=''
803 api_versionstring=''
804 patchlevel=''
805 revision=''
806 subversion=''
807 version=''
808 perl5=''
809 perladmin=''
810 perlpath=''
811 d_nv_preserves_uv=''
812 d_nv_preserves_uv_bits=''
813 i16size=''
814 i16type=''
815 i32size=''
816 i32type=''
817 i64size=''
818 i64type=''
819 i8size=''
820 i8type=''
821 ivsize=''
822 ivtype=''
823 nvsize=''
824 nvtype=''
825 u16size=''
826 u16type=''
827 u32size=''
828 u32type=''
829 u64size=''
830 u64type=''
831 u8size=''
832 u8type=''
833 uvsize=''
834 uvtype=''
835 ivdformat=''
836 nvEUformat=''
837 nvFUformat=''
838 nvGUformat=''
839 nveformat=''
840 nvfformat=''
841 nvgformat=''
842 uvXUformat=''
843 uvoformat=''
844 uvuformat=''
845 uvxformat=''
846 pidtype=''
847 prefix=''
848 prefixexp=''
849 installprivlib=''
850 privlib=''
851 privlibexp=''
852 prototype=''
853 ptrsize=''
854 d_PRIXU64=''
855 d_PRId64=''
856 d_PRIi64=''
857 d_PRIo64=''
858 d_PRIu64=''
859 d_PRIx64=''
860 sPRIXU64=''
861 sPRId64=''
862 sPRIi64=''
863 sPRIo64=''
864 sPRIu64=''
865 sPRIx64=''
866 d_quad=''
867 quadkind=''
868 quadtype=''
869 uquadtype=''
870 drand01=''
871 randbits=''
872 randfunc=''
873 randseedtype=''
874 seedfunc=''
875 installscript=''
876 scriptdir=''
877 scriptdirexp=''
878 selectminbits=''
879 selecttype=''
880 sh=''
881 sig_count=''
882 sig_name=''
883 sig_name_init=''
884 sig_num=''
885 sig_num_init=''
886 installsitearch=''
887 sitearch=''
888 sitearchexp=''
889 installsitebin=''
890 sitebin=''
891 sitebinexp=''
892 installsitelib=''
893 sitelib=''
894 sitelib_stem=''
895 sitelibexp=''
896 siteprefix=''
897 siteprefixexp=''
898 sizesize=''
899 sizetype=''
900 so=''
901 socksizetype=''
902 sharpbang=''
903 shsharp=''
904 spitshell=''
905 src=''
906 ssizetype=''
907 startperl=''
908 startsh=''
909 stdchar=''
910 d_stdio_stream_array=''
911 stdio_stream_array=''
912 sysman=''
913 trnl=''
914 uidformat=''
915 uidsign=''
916 uidsize=''
917 uidtype=''
918 archname64=''
919 use64bitall=''
920 use64bitint=''
921 ccflags_uselargefiles=''
922 ldflags_uselargefiles=''
923 libswanted_uselargefiles=''
924 uselargefiles=''
925 uselongdouble=''
926 usemorebits=''
927 usemultiplicity=''
928 nm_opt=''
929 nm_so_opt=''
930 runnm=''
931 usenm=''
932 useperlio=''
933 usesocks=''
934 d_oldpthreads=''
935 use5005threads=''
936 useithreads=''
937 usethreads=''
938 incpath=''
939 mips_type=''
940 usrinc=''
941 d_vendorarch=''
942 installvendorarch=''
943 vendorarch=''
944 vendorarchexp=''
945 d_vendorbin=''
946 installvendorbin=''
947 vendorbin=''
948 vendorbinexp=''
949 d_vendorlib=''
950 installvendorlib=''
951 vendorlib=''
952 vendorlib_stem=''
953 vendorlibexp=''
954 usevendorprefix=''
955 vendorprefix=''
956 vendorprefixexp=''
957 versiononly=''
958 defvoidused=''
959 voidflags=''
960 pm_apiversion=''
961 xs_apiversion=''
962 CONFIG=''
963
964 define='define'
965 undef='undef'
966 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
967 rmlist=''
968
969 : We must find out about Eunice early
970 eunicefix=':'
971 if test -f /etc/unixtovms; then
972         eunicefix=/etc/unixtovms
973 fi
974 if test -f /etc/unixtovms.exe; then
975         eunicefix=/etc/unixtovms.exe
976 fi
977
978 i_whoami=''
979 ccname=''
980 ccversion=''
981 perllibs=''
982 : set useposix=false in your hint file to disable the POSIX extension.
983 useposix=true
984 : set useopcode=false in your hint file to disable the Opcode extension.
985 useopcode=true
986 : Trailing extension.  Override this in a hint file, if needed.
987 _exe=''
988 : Extra object files, if any, needed on this platform.
989 archobjs=''
990 archname=''
991 : Possible local include directories to search.
992 : Set locincpth to "" in a hint file to defeat local include searches.
993 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
994 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
995 :
996 : no include file wanted by default
997 inclwanted=''
998
999 groupstype=''
1000 : change the next line if compiling for Xenix/286 on Xenix/386
1001 xlibpth='/usr/lib/386 /lib/386'
1002 : Possible local library directories to search.
1003 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1004 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1005
1006 : general looking path for locating libraries
1007 glibpth="/lib /usr/lib $xlibpth"
1008 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1009 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1010 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1011
1012 : Private path used by Configure to find libraries.  Its value
1013 : is prepended to libpth. This variable takes care of special
1014 : machines, like the mips.  Usually, it should be empty.
1015 plibpth=''
1016
1017 : default library list
1018 libswanted=''
1019 : some systems want to use only the non-versioned libso:s
1020 ignore_versioned_solibs=''
1021 archname64=''
1022 ccflags_uselargefiles=''
1023 ldflags_uselargefiles=''
1024 libswanted_uselargefiles=''
1025 : set usemultiplicity on the Configure command line to enable multiplicity.
1026 : set usesocks on the Configure command line to enable socks.
1027 : set usethreads on the Configure command line to enable threads.
1028 : full support for void wanted by default
1029 defvoidused=15
1030
1031 : List of libraries we want.
1032 : If anyone needs -lnet, put it in a hint file.
1033 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1034 libswanted="$libswanted dld ld sun m c cposix posix"
1035 libswanted="$libswanted ndir dir crypt sec"
1036 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1037 : We probably want to search /usr/shlib before most other libraries.
1038 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1039 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1040 glibpth="/usr/shlib $glibpth"
1041 : Do not use vfork unless overridden by a hint file.
1042 usevfork=false
1043
1044 : Find the basic shell for Bourne shell scripts
1045 case "$sh" in
1046 '')
1047         case "$SYSTYPE" in
1048         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1049         *) xxx='/bin/sh';;
1050         esac
1051         if test -f "$xxx"; then
1052                 sh="$xxx"
1053         else
1054                 : Build up a list and do a single loop so we can 'break' out.
1055                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1056                 for xxx in sh bash ksh pdksh ash; do
1057                         for p in $pth; do
1058                                 try="$try ${p}/${xxx}"
1059                         done
1060                 done
1061                 for xxx in $try; do
1062                         if test -f "$xxx"; then
1063                                 sh="$xxx";
1064                                 break
1065                         elif test -f "$xxx.exe"; then
1066                                 sh="$xxx";
1067                                 break
1068                         fi
1069                 done
1070         fi
1071         ;;
1072 esac
1073
1074 case "$sh" in
1075 '')     cat <<EOM >&2
1076 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1077
1078 Usually it's in /bin/sh.  How did you even get this far?
1079 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1080 we'll try to straighten this all out.
1081 EOM
1082         exit 1
1083         ;;
1084 esac
1085
1086 : see if sh knows # comments
1087 if `$sh -c '#' >/dev/null 2>&1`; then
1088         shsharp=true
1089         spitshell=cat
1090         xcat=/bin/cat
1091         test -f $xcat || xcat=/usr/bin/cat
1092         echo "#!$xcat" >try
1093         $eunicefix try
1094         chmod +x try
1095         ./try > today
1096         if test -s today; then
1097                 sharpbang='#!'
1098         else
1099                 echo "#! $xcat" > try
1100                 $eunicefix try
1101                 chmod +x try
1102                 ./try > today
1103                 if test -s today; then
1104                         sharpbang='#! '
1105                 else
1106                         sharpbang=': use '
1107                 fi
1108         fi
1109 else
1110         echo " "
1111         echo "Your $sh doesn't grok # comments--I will strip them later on."
1112         shsharp=false
1113         cd ..
1114         echo "exec grep -v '^[  ]*#'" >spitshell
1115         chmod +x spitshell
1116         $eunicefix spitshell
1117         spitshell=`pwd`/spitshell
1118         cd UU
1119         echo "I presume that if # doesn't work, #! won't work either!"
1120         sharpbang=': use '
1121 fi
1122 rm -f try today
1123
1124 : figure out how to guarantee sh startup
1125 case "$startsh" in
1126 '') startsh=${sharpbang}${sh} ;;
1127 *)
1128 esac
1129 cat >try <<EOSS
1130 $startsh
1131 set abc
1132 test "$?abc" != 1
1133 EOSS
1134
1135 chmod +x try
1136 $eunicefix try
1137 if ./try; then
1138         : echo "Yup, it does."
1139 else
1140         echo "Hmm... '$startsh' does not guarantee sh startup..."
1141         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1142 fi
1143 rm -f try
1144
1145
1146 : Save command line options in file UU/cmdline.opt for later use in
1147 : generating config.sh.
1148 cat > cmdline.opt <<EOSH
1149 # Configure command line arguments.
1150 config_arg0='$0'
1151 config_args='$*'
1152 config_argc=$#
1153 EOSH
1154 argn=1
1155 for arg in "$@"; do
1156         cat >>cmdline.opt <<EOSH
1157 config_arg$argn='$arg'
1158 EOSH
1159         argn=`expr $argn + 1`
1160 done
1161
1162 : produce awk script to parse command line options
1163 cat >options.awk <<'EOF'
1164 BEGIN {
1165         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1166
1167         len = length(optstr);
1168         for (i = 1; i <= len; i++) {
1169                 c = substr(optstr, i, 1);
1170                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1171                 if (a == ":") {
1172                         arg[c] = 1;
1173                         i++;
1174                 }
1175                 opt[c] = 1;
1176         }
1177 }
1178 {
1179         expect = 0;
1180         str = $0;
1181         if (substr(str, 1, 1) != "-") {
1182                 printf("'%s'\n", str);
1183                 next;
1184         }
1185         len = length($0);
1186         for (i = 2; i <= len; i++) {
1187                 c = substr(str, i, 1);
1188                 if (!opt[c]) {
1189                         printf("-%s\n", substr(str, i));
1190                         next;
1191                 }
1192                 printf("-%s\n", c);
1193                 if (arg[c]) {
1194                         if (i < len)
1195                                 printf("'%s'\n", substr(str, i + 1));
1196                         else
1197                                 expect = 1;
1198                         next;
1199                 }
1200         }
1201 }
1202 END {
1203         if (expect)
1204                 print "?";
1205 }
1206 EOF
1207
1208 : process the command line options
1209 set X `for arg in "$@"; do echo "X$arg"; done |
1210         sed -e s/X// | awk -f options.awk`
1211 eval "set $*"
1212 shift
1213 rm -f options.awk
1214
1215 : set up default values
1216 fastread=''
1217 reuseval=false
1218 config_sh=''
1219 alldone=''
1220 error=''
1221 silent=''
1222 extractsh=''
1223 override=''
1224 knowitall=''
1225 rm -f optdef.sh posthint.sh
1226 cat >optdef.sh <<EOS
1227 $startsh
1228 EOS
1229
1230
1231 : option parsing
1232 while test $# -gt 0; do
1233         case "$1" in
1234         -d) shift; fastread=yes;;
1235         -e) shift; alldone=cont;;
1236         -f)
1237                 shift
1238                 cd ..
1239                 if test -r "$1"; then
1240                         config_sh="$1"
1241                 else
1242                         echo "$me: cannot read config file $1." >&2
1243                         error=true
1244                 fi
1245                 cd UU
1246                 shift;;
1247         -h) shift; error=true;;
1248         -r) shift; reuseval=true;;
1249         -s) shift; silent=true; realsilent=true;;
1250         -E) shift; alldone=exit;;
1251         -K) shift; knowitall=true;;
1252         -O) shift; override=true;;
1253         -S) shift; silent=true; extractsh=true;;
1254         -D)
1255                 shift
1256                 case "$1" in
1257                 *=)
1258                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1259                         echo "$me: ignoring -D $1" >&2
1260                         ;;
1261                 *=*) echo "$1" | \
1262                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1263                 *) echo "$1='define'" >> optdef.sh;;
1264                 esac
1265                 shift
1266                 ;;
1267         -U)
1268                 shift
1269                 case "$1" in
1270                 *=) echo "$1" >> optdef.sh;;
1271                 *=*)
1272                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1273                         echo "$me: ignoring -U $1" >&2
1274                         ;;
1275                 *) echo "$1='undef'" >> optdef.sh;;
1276                 esac
1277                 shift
1278                 ;;
1279         -A)
1280             shift
1281             xxx=''
1282             yyy="$1"
1283             zzz=''
1284             uuu=undef
1285             case "$yyy" in
1286             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1287                  case "$zzz" in
1288                  *:*) zzz='' ;;
1289                  *)   xxx=append
1290                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1291                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1292                  esac
1293                  ;;
1294             esac
1295             case "$xxx" in
1296             '')  case "$yyy" in
1297                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1298                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1299                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1300                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1301                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1302                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1303                  esac
1304                  ;;       
1305             esac
1306             case "$xxx" in
1307             append)
1308                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1309             clear)
1310                 echo "$yyy=''"                  >> posthint.sh ;;
1311             define)
1312                 case "$zzz" in
1313                 '') zzz=define ;;
1314                 esac
1315                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1316             eval)
1317                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1318             prepend)
1319                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1320             undef)
1321                 case "$zzz" in
1322                 '') zzz="$uuu" ;;
1323                 esac
1324                 echo "$yyy=$zzz"                >> posthint.sh ;;
1325             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1326             esac
1327             shift
1328             ;;
1329         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1330             exit 0;;
1331         --) break;;
1332         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1333         *) break;;
1334         esac
1335 done
1336
1337 case "$error" in
1338 true)
1339         cat >&2 <<EOM
1340 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1341                  [-U symbol] [-U symbol=] [-A command:symbol...]
1342   -d : use defaults for all answers.
1343   -e : go on without questioning past the production of config.sh.
1344   -f : specify an alternate default configuration file.
1345   -h : print this help message and exit (with an error status).
1346   -r : reuse C symbols value if possible (skips costly nm extraction).
1347   -s : silent mode, only echoes questions and essential information.
1348   -D : define symbol to have some value:
1349          -D symbol         symbol gets the value 'define'
1350          -D symbol=value   symbol gets the value 'value'
1351   -E : stop at the end of questions, after having produced config.sh.
1352   -K : do not use unless you know what you are doing.
1353   -O : let -D and -U override definitions from loaded configuration file.
1354   -S : perform variable substitutions on all .SH files (can mix with -f)
1355   -U : undefine symbol:
1356          -U symbol    symbol gets the value 'undef'
1357          -U symbol=   symbol gets completely empty
1358   -A : manipulate symbol after the platform specific hints have been applied:
1359          -A symbol=value                append " "value to symbol
1360          -A append:symbol=value         append value to symbol
1361          -A define:symbol=value         define symbol to have value
1362          -A clear:symbol                define symbol to be ''
1363          -A define:symbol               define symbol to be 'define'
1364          -A eval:symbol=value           define symbol to be eval of value
1365          -A prepend:symbol=value        prepend value to symbol
1366          -A undef:symbol                define symbol to be 'undef'
1367          -A undef:symbol=               define symbol to be ''
1368   -V : print version number and exit (with a zero status).
1369 EOM
1370         exit 1
1371         ;;
1372 esac
1373
1374 : Sanity checks
1375 case "$fastread$alldone" in
1376 yescont|yesexit) ;;
1377 *)
1378         case "$extractsh" in
1379         true) ;;
1380         *)
1381                 if test ! -t 0; then
1382                         echo "Say 'sh Configure', not 'sh <Configure'"
1383                         exit 1
1384                 fi
1385                 ;;
1386         esac
1387         ;;
1388 esac
1389
1390 exec 4>&1
1391 case "$silent" in
1392 true) exec 1>/dev/null;;
1393 esac
1394
1395 : run the defines and the undefines, if any, but leave the file out there...
1396 touch optdef.sh
1397 . ./optdef.sh
1398 : create the posthint manipulation script and leave the file out there...
1399 touch posthint.sh
1400
1401 : set package name
1402 package=perl5
1403 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1404 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1405 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1406 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1407 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1408 esac
1409
1410 : Some greps do not return status, grrr.
1411 echo "grimblepritz" >grimble
1412 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1413         contains=contains
1414 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1415         contains=grep
1416 else
1417         contains=contains
1418 fi
1419 rm -f grimble
1420 : the following should work in any shell
1421 case "$contains" in
1422 contains*)
1423         echo " "
1424         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1425         cat >contains <<'EOSS'
1426 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1427 EOSS
1428 chmod +x contains
1429 esac
1430
1431 : Find the path to the source tree
1432 case "$src" in
1433 '') case "$0" in
1434     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1435          case "$src" in
1436          /*)    ;;
1437          *)     src=`cd ../$src && pwd` ;;
1438          esac
1439          ;;
1440     *)   src='.';;
1441     esac;;
1442 esac
1443 case "$src" in
1444 '')     src=/
1445         rsrc=/
1446         ;;
1447 /*) rsrc="$src";;
1448 *) rsrc="../$src";;
1449 esac
1450 if test -f $rsrc/Configure && \
1451         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1452 then
1453    : found it, so we are ok.
1454 else
1455         rsrc=''
1456         for src in . .. ../.. ../../.. ../../../..; do
1457                 if test -f ../$src/Configure && \
1458                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1459                 then
1460                         rsrc=../$src
1461                         break
1462                 fi
1463         done
1464 fi
1465 case "$rsrc" in
1466 '')
1467         cat <<EOM >&4
1468
1469 Sorry, I can't seem to locate the source dir for $package.  Please start
1470 Configure with an explicit path -- i.e. /some/path/Configure.
1471
1472 EOM
1473         exit 1
1474         ;;
1475 ../.)   rsrc='..';;
1476 *)
1477         echo " "
1478         echo "Sources for $package found in \"$src\"." >&4
1479         ;;
1480 esac
1481
1482 : script used to extract .SH files with variable substitutions
1483 cat >extract <<'EOS'
1484 CONFIGDOTSH=true
1485 echo "Doing variable substitutions on .SH files..."
1486 if test -f $src/MANIFEST; then
1487         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1488 else
1489         echo "(Looking for .SH files under the source directory.)"
1490         set x `(cd $src; find . -name "*.SH" -print)`
1491 fi
1492 shift
1493 case $# in
1494 0) set x `(cd $src; echo *.SH)`; shift;;
1495 esac
1496 if test ! -f $src/$1; then
1497         shift
1498 fi
1499 mkdir_p='
1500 name=$1;
1501 create="";
1502 while test $name; do
1503         if test ! -d "$name"; then
1504                 create="$name $create";
1505                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1506                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1507         else
1508                 name="";
1509         fi;
1510 done;
1511 for file in $create; do
1512         mkdir $file;
1513 done
1514 '
1515 for file in $*; do
1516         case "$src" in
1517         ".")
1518                 case "$file" in
1519                 */*)
1520                         dir=`expr X$file : 'X\(.*\)/'`
1521                         file=`expr X$file : 'X.*/\(.*\)'`
1522                         (cd $dir && . ./$file)
1523                         ;;
1524                 *)
1525                         . ./$file
1526                         ;;
1527                 esac
1528                 ;;
1529         *)
1530                 case "$file" in
1531                 */*)
1532                         dir=`expr X$file : 'X\(.*\)/'`
1533                         file=`expr X$file : 'X.*/\(.*\)'`
1534                         (set x $dir; shift; eval $mkdir_p)
1535                         sh <$src/$dir/$file
1536                         ;;
1537                 *)
1538                         sh <$src/$file
1539                         ;;
1540                 esac
1541                 ;;
1542         esac
1543 done
1544 if test -f $src/config_h.SH; then
1545         if test ! -f config.h; then
1546         : oops, they left it out of MANIFEST, probably, so do it anyway.
1547         . $src/config_h.SH
1548         fi
1549 fi
1550 EOS
1551
1552 : extract files and exit if asked to do so
1553 case "$extractsh" in
1554 true)
1555         case "$realsilent" in
1556         true) ;;
1557         *) exec 1>&4;;
1558         esac
1559         case "$config_sh" in
1560         '') config_sh='config.sh';;
1561         esac
1562         echo " "
1563         echo "Fetching answers from $config_sh..."
1564         cd ..
1565         . $config_sh
1566         test "$override" && . ./optdef.sh
1567         echo " "
1568         . UU/extract
1569         rm -rf UU
1570         echo "Done."
1571         exit 0
1572         ;;
1573 esac
1574
1575 : Eunice requires " " instead of "", can you believe it
1576 echo " "
1577 : Here we go...
1578 echo "Beginning of configuration questions for $package."
1579
1580 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1581
1582 : first determine how to suppress newline on echo command
1583 echo " "
1584 echo "Checking echo to see how to suppress newlines..."
1585 (echo "hi there\c" ; echo " ") >.echotmp
1586 if $contains c .echotmp >/dev/null 2>&1 ; then
1587         echo "...using -n."
1588         n='-n'
1589         c=''
1590 else
1591         cat <<'EOM'
1592 ...using \c
1593 EOM
1594         n=''
1595         c='\c'
1596 fi
1597 echo $n "The star should be here-->$c"
1598 echo '*'
1599 rm -f .echotmp
1600
1601 : Now test for existence of everything in MANIFEST
1602 echo " "
1603 if test -f $rsrc/MANIFEST; then
1604         echo "First let's make sure your kit is complete.  Checking..." >&4
1605         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1606         rm -f missing
1607         tmppwd=`pwd`
1608         for filelist in x??; do
1609                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1610         done
1611         if test -s missing; then
1612                 cat missing >&4
1613                 cat >&4 <<'EOM'
1614
1615 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1616
1617 You have the option of continuing the configuration process, despite the
1618 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1619 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1620 and contact the author (perlbug@perl.org).
1621
1622 EOM
1623                 echo $n "Continue? [n] $c" >&4
1624                 read ans
1625                 case "$ans" in
1626                 y*)
1627                         echo "Continuing..." >&4
1628                         rm -f missing
1629                         ;;
1630                 *)
1631                         echo "ABORTING..." >&4
1632                         kill $$
1633                         ;;
1634                 esac
1635         else
1636                 echo "Looks good..."
1637         fi
1638 else
1639         echo "There is no MANIFEST file.  I hope your kit is complete !"
1640 fi
1641 rm -f missing x??
1642
1643 echo " "
1644 : Find the appropriate value for a newline for tr
1645 if test -n "$DJGPP"; then
1646        trnl='\012'
1647 fi
1648 if test X"$trnl" = X; then
1649         case "`echo foo|tr '\n' x 2>/dev/null`" in
1650         foox) trnl='\n' ;;
1651         esac
1652 fi
1653 if test X"$trnl" = X; then
1654         case "`echo foo|tr '\012' x 2>/dev/null`" in
1655         foox) trnl='\012' ;;
1656         esac
1657 fi
1658 if test X"$trnl" = X; then
1659         cat <<EOM >&2
1660
1661 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1662
1663 EOM
1664         exit 1
1665 fi
1666
1667 : compute the number of columns on the terminal for proper question formatting
1668 case "$COLUMNS" in
1669 '') COLUMNS='80';;
1670 esac
1671
1672 : set up the echo used in my read
1673 myecho="case \"\$xxxm\" in
1674 '') echo $n \"\$rp $c\" >&4;;
1675 *) case \"\$rp\" in
1676         '') echo $n \"[\$xxxm] $c\";;
1677         *)
1678                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1679                         echo \"\$rp\" >&4
1680                         echo $n \"[\$xxxm] $c\" >&4
1681                 else
1682                         echo $n \"\$rp [\$xxxm] $c\" >&4
1683                 fi
1684                 ;;
1685         esac;;
1686 esac"
1687
1688 : now set up to do reads with possible shell escape and default assignment
1689 cat <<EOSC >myread
1690 $startsh
1691 xxxm=\$dflt
1692 $myecho
1693 ans='!'
1694 case "\$fastread" in
1695 yes) case "\$dflt" in
1696         '') ;;
1697         *) ans='';
1698                 case "\$silent-\$rp" in
1699                 true-) ;;
1700                 *) echo " " >&4;;
1701                 esac;;
1702         esac;;
1703 *) case "\$silent" in
1704         true) case "\$rp" in
1705                 '') ans='';;
1706                 esac;;
1707         esac;;
1708 esac
1709 while expr "X\$ans" : "X!" >/dev/null; do
1710         read answ
1711         set x \$xxxm
1712         shift
1713         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1714         case  "\$answ" in
1715         "!")
1716                 sh 1>&4
1717                 echo " "
1718                 $myecho
1719                 ;;
1720         !*)
1721                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1722                 shift
1723                 sh 1>&4 -c "\$*"
1724                 echo " "
1725                 $myecho
1726                 ;;
1727         "\$ans")
1728                 case "\$ans" in
1729                 \\&*)
1730                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1731                         shift
1732                         case "\$1" in
1733                         -d)
1734                                 fastread=yes
1735                                 echo "(OK, I'll run with -d after this question.)" >&4
1736                                 ;;
1737                         -*)
1738                                 echo "*** Sorry, \$1 not supported yet." >&4
1739                                 ;;
1740                         esac
1741                         $myecho
1742                         ans=!
1743                         ;;
1744                 esac;;
1745         *)
1746                 case "\$aok" in
1747                 y)
1748                         echo "*** Substitution done -- please confirm."
1749                         xxxm="\$ans"
1750                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1751                         xxxm="\$ans"
1752                         ans=!
1753                         ;;
1754                 *)
1755                         echo "*** Error -- try again."
1756                         ans=!
1757                         ;;
1758                 esac
1759                 $myecho
1760                 ;;
1761         esac
1762         case "\$ans\$xxxm\$nostick" in
1763         '')
1764                 ans=!
1765                 $myecho
1766                 ;;
1767         esac
1768 done
1769 case "\$ans" in
1770 '') ans="\$xxxm";;
1771 esac
1772 EOSC
1773
1774 : create .config dir to save info across Configure sessions
1775 test -d ../.config || mkdir ../.config
1776 cat >../.config/README <<EOF
1777 This directory created by Configure to save information that should
1778 persist across sessions for $package.
1779
1780 You may safely delete it if you wish.
1781 EOF
1782
1783 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1784 case "$usedevel" in
1785 $define|true|[yY]*) ;;
1786 *) case "$xversion" in
1787    *[13579])
1788         cat >&4 <<EOH
1789 *** WHOA THERE!!! ***
1790
1791     This is an UNSTABLE DEVELOPMENT release.
1792     The version of this $package distribution is $xversion, that is, odd,
1793     (as opposed to even) and that signifies a development release.
1794     If you want a maintenance release, you want an even-numbered version.
1795
1796     Do ***NOT*** install this into production use.
1797     Data corruption and crashes are possible.
1798
1799     It is most seriously suggested that you do not continue any further
1800     unless you want to help in developing and debugging Perl.
1801
1802 EOH
1803         rp='Do you really want to continue?'
1804         dflt='n'
1805         . ./myread
1806         case "$ans" in
1807         [yY]) echo >&4 "Okay, continuing." ;;
1808         *) echo >&4 "Okay, bye."
1809            exit 1
1810            ;;
1811         esac
1812         ;;
1813     esac
1814     ;;
1815 esac
1816
1817 : general instructions
1818 needman=true
1819 firsttime=true
1820 user=`(logname) 2>/dev/null`
1821 case "$user" in
1822 '') user=`whoami 2>&1`;;
1823 esac
1824 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1825         firsttime=false
1826         echo " "
1827         rp='Would you like to see the instructions?'
1828         dflt=n
1829         . ./myread
1830         case "$ans" in
1831         [yY]*) ;;
1832         *) needman=false;;
1833         esac
1834 fi
1835 if $needman; then
1836         cat <<EOH
1837
1838 This installation shell script will examine your system and ask you questions
1839 to determine how the perl5 package should be installed. If you get
1840 stuck on a question, you may use a ! shell escape to start a subshell or
1841 execute a command.  Many of the questions will have default answers in square
1842 brackets; typing carriage return will give you the default.
1843
1844 On some of the questions which ask for file or directory names you are allowed
1845 to use the ~name construct to specify the login directory belonging to "name",
1846 even if you don't have a shell which knows about that.  Questions where this is
1847 allowed will be marked "(~name ok)".
1848
1849 EOH
1850         rp=''
1851         dflt='Type carriage return to continue'
1852         . ./myread
1853         cat <<'EOH'
1854
1855 The prompter used in this script allows you to use shell variables and
1856 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1857 in the default answer, as if the default line was a set of arguments given to a
1858 script shell.  This means you may also use $* to repeat the whole default line,
1859 so you do not have to re-type everything to add something to the default.
1860
1861 Everytime there is a substitution, you will have to confirm.  If there is an
1862 error (e.g. an unmatched backtick), the default answer will remain unchanged
1863 and you will be prompted again.
1864
1865 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1866 the questions and use the computed defaults (or the previous answers if there
1867 was already a config.sh file). Type 'Configure -h' for a list of options.
1868 You may also start interactively and then answer '& -d' at any prompt to turn
1869 on the non-interactive behaviour for the remainder of the execution.
1870
1871 EOH
1872         . ./myread
1873         cat <<EOH
1874
1875 Much effort has been expended to ensure that this shell script will run on any
1876 Unix system.  If despite that it blows up on yours, your best bet is to edit
1877 Configure and run it again.  If you can't run Configure for some reason,
1878 you'll have to generate a config.sh file by hand.  Whatever problems you
1879 have, let me (perlbug@perl.org) know how I blew it.
1880
1881 This installation script affects things in two ways:
1882
1883 1) it may do direct variable substitutions on some of the files included
1884    in this kit.
1885 2) it builds a config.h file for inclusion in C programs.  You may edit
1886    any of these files as the need arises after running this script.
1887
1888 If you make a mistake on a question, there is no easy way to back up to it
1889 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1890 files.  Configure will offer to let you do this before it runs the SH files.
1891
1892 EOH
1893         dflt='Type carriage return to continue'
1894         . ./myread
1895         case "$firsttime" in
1896         true) echo $user >>../.config/instruct;;
1897         esac
1898 fi
1899
1900 : find out where common programs are
1901 echo " "
1902 echo "Locating common programs..." >&4
1903 cat <<EOSC >loc
1904 $startsh
1905 case \$# in
1906 0) exit 1;;
1907 esac
1908 thing=\$1
1909 shift
1910 dflt=\$1
1911 shift
1912 for dir in \$*; do
1913         case "\$thing" in
1914         .)
1915         if test -d \$dir/\$thing; then
1916                 echo \$dir
1917                 exit 0
1918         fi
1919         ;;
1920         *)
1921         for thisthing in \$dir/\$thing; do
1922                 : just loop through to pick last item
1923         done
1924         if test -f \$thisthing; then
1925                 echo \$thisthing
1926                 exit 0
1927         elif test -f \$dir/\$thing.exe; then
1928                 if test -n "$DJGPP"; then
1929                         echo \$dir/\$thing.exe
1930                 else
1931                         : on Eunice apparently
1932                         echo \$dir/\$thing
1933                 fi
1934                 exit 0
1935         fi
1936         ;;
1937         esac
1938 done
1939 echo \$dflt
1940 exit 1
1941 EOSC
1942 chmod +x loc
1943 $eunicefix loc
1944 loclist="
1945 awk
1946 cat
1947 comm
1948 cp
1949 echo
1950 expr
1951 grep
1952 ls
1953 make
1954 mkdir
1955 rm
1956 sed
1957 sort
1958 touch
1959 tr
1960 uniq
1961 "
1962 trylist="
1963 Mcc
1964 ar
1965 byacc
1966 cpp
1967 csh
1968 date
1969 egrep
1970 gzip
1971 less
1972 ln
1973 more
1974 nm
1975 nroff
1976 pg
1977 test
1978 uname
1979 zip
1980 "
1981 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1982 pth="$pth /lib /usr/lib"
1983 for file in $loclist; do
1984         eval xxx=\$$file
1985         case "$xxx" in
1986         /*|?:[\\/]*)
1987                 if test -f "$xxx"; then
1988                         : ok
1989                 else
1990                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1991                         xxx=`./loc $file $file $pth`
1992                 fi
1993                 ;;
1994         '') xxx=`./loc $file $file $pth`;;
1995         *) xxx=`./loc $xxx $xxx $pth`;;
1996         esac
1997         eval $file=$xxx
1998         eval _$file=$xxx
1999         case "$xxx" in
2000         /*)
2001                 echo $file is in $xxx.
2002                 ;;
2003         ?:[\\/]*)
2004                 echo $file is in $xxx.
2005                 ;;
2006         *)
2007                 echo "I don't know where '$file' is, and my life depends on it." >&4
2008                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2009                 exit 1
2010                 ;;
2011         esac
2012 done
2013 echo " "
2014 echo "Don't worry if any of the following aren't found..."
2015 say=offhand
2016 for file in $trylist; do
2017         eval xxx=\$$file
2018         case "$xxx" in
2019         /*|?:[\\/]*)
2020                 if test -f "$xxx"; then
2021                         : ok
2022                 else
2023                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2024                         xxx=`./loc $file $file $pth`
2025                 fi
2026                 ;;
2027         '') xxx=`./loc $file $file $pth`;;
2028         *) xxx=`./loc $xxx $xxx $pth`;;
2029         esac
2030         eval $file=$xxx
2031         eval _$file=$xxx
2032         case "$xxx" in
2033         /*)
2034                 echo $file is in $xxx.
2035                 ;;
2036         ?:[\\/]*)
2037                 echo $file is in $xxx.
2038                 ;;
2039         *)
2040                 echo "I don't see $file out there, $say."
2041                 say=either
2042                 ;;
2043         esac
2044 done
2045 case "$egrep" in
2046 egrep)
2047         echo "Substituting grep for egrep."
2048         egrep=$grep
2049         ;;
2050 esac
2051 case "$ln" in
2052 ln)
2053         echo "Substituting cp for ln."
2054         ln=$cp
2055         ;;
2056 esac
2057 case "$test" in
2058 test)
2059         echo "Hopefully test is built into your sh."
2060         ;;
2061 *)
2062         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2063                 echo "Using the test built into your sh."
2064                 echo "Using the test built into your sh."
2065                 test=test
2066                 _test=test
2067         fi
2068         ;;
2069 esac
2070 case "$echo" in
2071 echo)
2072         echo "Hopefully echo is built into your sh."
2073         ;;
2074 '') ;;
2075 *)
2076         echo " "
2077 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2078         $echo $n "hi there$c" >foo1
2079         echo $n "hi there$c" >foo2
2080         if cmp foo1 foo2 >/dev/null 2>&1; then
2081                 echo "They are compatible.  In fact, they may be identical."
2082         else
2083                 case "$n" in
2084                 '-n') n='' c='\c';;
2085                 *) n='-n' c='';;
2086                 esac
2087                 cat <<FOO
2088 They are not compatible!  You are probably running ksh on a non-USG system.
2089 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2090 have echo built in and we may have to run some Bourne shell scripts.  That
2091 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2092
2093 FOO
2094                 $echo $n "The star should be here-->$c"
2095                 $echo "*"
2096         fi
2097         $rm -f foo1 foo2
2098         ;;
2099 esac
2100
2101 cat <<EOS >checkcc
2102 $startsh
2103 EOS
2104 cat <<'EOSC' >>checkcc
2105 case "$cc" in
2106 '') ;;
2107 *)  $rm -f try try.*
2108     $cat >try.c <<EOM
2109 int main(int argc, char *argv[]) {
2110   return 0;
2111 }
2112 EOM
2113     if $cc -o try $ccflags try.c; then
2114        :
2115     else
2116         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2117         despair=yes
2118         trygcc=yes
2119         case "$cc" in
2120         *gcc*) trygcc=no ;;
2121         esac
2122         case "`$cc -v -c try.c 2>&1`" in
2123         *gcc*) trygcc=no ;;
2124         esac
2125         if $test X"$trygcc" = Xyes; then
2126             if gcc -o try -c try.c; then
2127                 echo " "
2128                 echo "You seem to have a working gcc, though." >&4
2129                 rp="Would you like to use it?"
2130                 dflt=y
2131                 if $test -f myread; then
2132                     . ./myread
2133                 else
2134                     if $test -f UU/myread; then
2135                         . ./UU/myread
2136                     else
2137                         echo "Cannot find myread, sorry.  Aborting." >&2
2138                         exit 1
2139                     fi
2140                 fi  
2141                 case "$ans" in
2142                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2143                 esac
2144             fi
2145         fi
2146         if $test X"$despair" = Xyes; then
2147             $cat >&4 <<EOM
2148 You need to find a working C compiler.
2149 Either (purchase and) install the C compiler supplied by your OS vendor,
2150 or for a free C compiler try http://gcc.gnu.org/
2151 I cannot continue any further, aborting.
2152 EOM
2153             exit 1
2154         fi
2155     fi
2156     $rm -f try try.*
2157     ;;
2158 esac
2159 EOSC
2160
2161 : determine whether symbolic links are supported
2162 echo " "
2163 $touch blurfl
2164 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2165         echo "Symbolic links are supported." >&4
2166         lns="$ln -s"
2167 else
2168         echo "Symbolic links are NOT supported." >&4
2169         lns="$ln"
2170 fi
2171 $rm -f blurfl sym
2172
2173 : determine whether symbolic links are supported
2174 echo " "
2175 case "$lns" in
2176 *"ln -s")
2177         echo "Checking how to test for symbolic links..." >&4
2178         $lns blurfl sym
2179         if $test "X$issymlink" = X; then
2180                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2181                 if test $? = 0; then
2182                         issymlink="test -h"
2183                 fi              
2184         fi
2185         if $test "X$issymlink" = X; then
2186                 if  $test -h >/dev/null 2>&1; then
2187                         issymlink="$test -h"
2188                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2189                 fi              
2190         fi
2191         if $test "X$issymlink" = X; then
2192                 if $test -L sym 2>/dev/null; then
2193                         issymlink="$test -L"
2194                 fi
2195         fi
2196         if $test "X$issymlink" != X; then
2197                 echo "You can test for symbolic links with '$issymlink'." >&4
2198         else
2199                 echo "I do not know how you can test for symbolic links." >&4
2200         fi
2201         $rm -f blurfl sym
2202         ;;
2203 *)      echo "No symbolic links, so not testing for their testing..." >&4
2204         ;;
2205 esac
2206 echo " "
2207
2208
2209 case "$mksymlinks" in
2210 $define|true|[yY]*)
2211         case "$src" in
2212         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2213                 exit 1
2214                 ;;
2215         *)      case "$lns:$issymlink" in
2216                 *"ln -s:-"?)
2217                         echo "Creating the symbolic links..." >&4
2218                         echo "(First creating the subdirectories...)" >&4
2219                         cd ..
2220                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2221                                 read directory
2222                                 test -z "$directory" && break
2223                                 mkdir -p $directory
2224                         done
2225                         # Sanity check 1.
2226                         if test ! -d t/base; then
2227                                 echo "Failed to create the subdirectories.  Aborting." >&4
2228                                 exit 1
2229                         fi
2230                         echo "(Then creating the symlinks...)" >&4
2231                         awk '{print $1}' $src/MANIFEST | while true; do
2232                                 read filename
2233                                 test -z "$filename" && break
2234                                 if test -f $filename; then
2235                                         if $issymlink $filename; then
2236                                                 rm -f $filename
2237                                         fi
2238                                 fi
2239                                 if test -f $filename; then
2240                                         echo "$filename already exists, not symlinking."
2241                                 else
2242                                         ln -s $src/$filename $filename
2243                                 fi
2244                         done
2245                         # Sanity check 2.
2246                         if test ! -f t/base/commonsense.t; then
2247                                 echo "Failed to create the symlinks.  Aborting." >&4
2248                                 exit 1
2249                         fi
2250                         cd UU
2251                         ;;
2252                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2253                         ;;
2254                 esac
2255                 ;;
2256         esac
2257         ;;
2258 esac
2259
2260 : see whether [:lower:] and [:upper:] are supported character classes
2261 echo " "
2262 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2263 ABYZ)
2264         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2265         up='[:upper:]'
2266         low='[:lower:]'
2267         ;;
2268 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2269         # (0xc9 and 0xd1), therefore that is a nice testing point.
2270         if test "X$up" = X -o "X$low" = X; then
2271             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2272             ij) up='[A-Z]'
2273                 low='[a-z]'
2274                 ;;
2275             esac
2276         fi
2277         if test "X$up" = X -o "X$low" = X; then
2278             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2279             ij) up='A-Z'
2280                 low='a-z'
2281                 ;;
2282             esac
2283         fi
2284         if test "X$up" = X -o "X$low" = X; then
2285             case "`echo IJ | od -x 2>/dev/null`" in
2286             *C9D1*|*c9d1*)
2287                 echo "Hey, this might be EBCDIC." >&4
2288                 if test "X$up" = X -o "X$low" = X; then
2289                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2290                     ij) up='[A-IJ-RS-Z]'
2291                         low='[a-ij-rs-z]'
2292                         ;;
2293                     esac
2294                 fi
2295                 if test "X$up" = X -o "X$low" = X; then
2296                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2297                     ij) up='A-IJ-RS-Z'
2298                         low='a-ij-rs-z'
2299                         ;;
2300                     esac
2301                 fi
2302                 ;;
2303             esac
2304         fi
2305 esac
2306 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2307 ij)
2308     echo "Using $up and $low to convert case." >&4
2309     ;;
2310 *)
2311     echo "I don't know how to translate letters from upper to lower case." >&4
2312     echo "Your tr is not acting any way I know of." >&4
2313     exit 1
2314     ;;
2315 esac
2316 : set up the translation script tr, must be called with ./tr of course
2317 cat >tr <<EOSC
2318 $startsh
2319 case "\$1\$2" in
2320 '[A-Z][a-z]') exec $tr '$up' '$low';;
2321 '[a-z][A-Z]') exec $tr '$low' '$up';;
2322 esac
2323 exec $tr "\$@"
2324 EOSC
2325 chmod +x tr
2326 $eunicefix tr
2327
2328 : Try to determine whether config.sh was made on this system
2329 case "$config_sh" in
2330 '')
2331 myuname=`$uname -a 2>/dev/null`
2332 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2333 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2334 # because the A-Z/a-z are not consecutive.
2335 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2336         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2337 newmyuname="$myuname"
2338 dflt=n
2339 case "$knowitall" in
2340 '')
2341         if test -f ../config.sh; then
2342                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2343                         eval "`grep myuname= ../config.sh`"
2344                 fi
2345                 if test "X$myuname" = "X$newmyuname"; then
2346                         dflt=y
2347                 fi
2348         fi
2349         ;;
2350 *) dflt=y;;
2351 esac
2352
2353 : Get old answers from old config file if Configure was run on the
2354 : same system, otherwise use the hints.
2355 hint=default
2356 cd ..
2357 if test -f config.sh; then
2358         echo " "
2359         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2360         . UU/myread
2361         case "$ans" in
2362         n*|N*) echo "OK, I'll ignore it."
2363                 mv config.sh config.sh.old
2364                 myuname="$newmyuname"
2365                 ;;
2366         *)  echo "Fetching default answers from your old config.sh file..." >&4
2367                 tmp_n="$n"
2368                 tmp_c="$c"
2369                 tmp_sh="$sh"
2370                 . ./config.sh
2371                 cp config.sh UU
2372                 n="$tmp_n"
2373                 c="$tmp_c"
2374                 : Older versions did not always set $sh.  Catch re-use of such
2375                 : an old config.sh.
2376                 case "$sh" in
2377                 '') sh="$tmp_sh" ;;
2378                 esac
2379                 hint=previous
2380                 ;;
2381         esac
2382 fi
2383 . ./UU/checkcc
2384 if test ! -f config.sh; then
2385         $cat <<EOM
2386
2387 First time through, eh?  I have some defaults handy for some systems
2388 that need some extra help getting the Configure answers right:
2389
2390 EOM
2391         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2392         dflt=''
2393         : Half the following guesses are probably wrong... If you have better
2394         : tests or hints, please send them to perlbug@perl.org
2395         : The metaconfig authors would also appreciate a copy...
2396         $test -f /irix && osname=irix
2397         $test -f /xenix && osname=sco_xenix
2398         $test -f /dynix && osname=dynix
2399         $test -f /dnix && osname=dnix
2400         $test -f /lynx.os && osname=lynxos
2401         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2402         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2403         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2404         $test -f /bin/mips && /bin/mips && osname=mips
2405         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2406                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2407         $test -d /usr/apollo/bin && osname=apollo
2408         $test -f /etc/saf/_sactab && osname=svr4
2409         $test -d /usr/include/minix && osname=minix
2410         if $test -d /MachTen -o -d /MachTen_Folder; then
2411                 osname=machten
2412                 if $test -x /sbin/version; then
2413                         osvers=`/sbin/version | $awk '{print $2}' |
2414                         $sed -e 's/[A-Za-z]$//'`
2415                 elif $test -x /usr/etc/version; then
2416                         osvers=`/usr/etc/version | $awk '{print $2}' |
2417                         $sed -e 's/[A-Za-z]$//'`
2418                 else
2419                         osvers="$2.$3"
2420                 fi
2421         fi
2422
2423         $test -f /sys/posix.dll &&
2424                 $test -f /usr/bin/what &&
2425                 set X `/usr/bin/what /sys/posix.dll` &&
2426                 $test "$3" = UWIN &&
2427                 osname=uwin &&
2428                 osvers="$5"
2429
2430         if $test -f $uname; then
2431                 set X $myuname
2432                 shift
2433
2434                 case "$5" in
2435                 fps*) osname=fps ;;
2436                 mips*)
2437                         case "$4" in
2438                         umips) osname=umips ;;
2439                         *) osname=mips ;;
2440                         esac;;
2441                 [23]100) osname=mips ;;
2442                 next*) osname=next ;;
2443                 i386*)
2444                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2445                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2446                                 osname='sco'
2447                                 osvers=$tmp
2448                         elif $test -f /etc/kconfig; then
2449                                 osname=isc
2450                                 if test "$lns" = "$ln -s"; then
2451                                         osvers=4
2452                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2453                                         osvers=3
2454                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2455                                         osvers=2
2456                                 fi
2457                         fi
2458                         tmp=''
2459                         ;;
2460                 pc*)
2461                         if test -n "$DJGPP"; then
2462                                 osname=dos
2463                                 osvers=djgpp
2464                         fi
2465                         ;;
2466                 esac
2467
2468                 case "$1" in
2469                 aix) osname=aix
2470                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2471                         case "$tmp" in
2472                         'not found') osvers="$4"."$3" ;;
2473                         '<3240'|'<>3240') osvers=3.2.0 ;;
2474                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2475                         '=3250'|'>3250') osvers=3.2.5 ;;
2476                         *) osvers=$tmp;;
2477                         esac
2478                         ;;
2479                 bsd386) osname=bsd386
2480                         osvers=`$uname -r`
2481                         ;;
2482                 cygwin*) osname=cygwin
2483                         osvers="$3"
2484                         ;;
2485                 *dc.osx) osname=dcosx
2486                         osvers="$3"
2487                         ;;
2488                 dnix) osname=dnix
2489                         osvers="$3"
2490                         ;;
2491                 domainos) osname=apollo
2492                         osvers="$3"
2493                         ;;
2494                 dgux) osname=dgux 
2495                         osvers="$3"
2496                         ;;
2497                 dynixptx*) osname=dynixptx
2498                         osvers=`echo "$4"|sed 's/^v//'`
2499                         ;;
2500                 freebsd) osname=freebsd 
2501                         osvers="$3" ;;
2502                 genix) osname=genix ;;
2503                 hp*) osname=hpux 
2504                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2505                         ;;
2506                 irix*) osname=irix
2507                         case "$3" in
2508                         4*) osvers=4 ;;
2509                         5*) osvers=5 ;;
2510                         *)      osvers="$3" ;;
2511                         esac
2512                         ;;
2513                 linux) osname=linux
2514                         case "$3" in
2515                         *)      osvers="$3" ;;
2516                         esac
2517                         ;;
2518                 MiNT) osname=mint
2519                         ;;
2520                 netbsd*) osname=netbsd
2521                         osvers="$3"
2522                         ;;
2523                 news-os) osvers="$3"
2524                         case "$3" in
2525                         4*) osname=newsos4 ;;
2526                         *) osname=newsos ;;
2527                         esac
2528                         ;;
2529                 next*) osname=next ;;
2530                 nonstop-ux) osname=nonstopux ;;
2531                 POSIX-BC | posix-bc ) osname=posix-bc
2532                         osvers="$3"
2533                         ;;
2534                 powerux | power_ux | powermax_os | powermaxos | \
2535                 powerunix | power_unix) osname=powerux
2536                         osvers="$3"
2537                         ;;
2538                 qnx) osname=qnx
2539                         osvers="$4"
2540                         ;;
2541                 solaris) osname=solaris
2542                         case "$3" in
2543                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2544                         *)      osvers="$3" ;;
2545                         esac
2546                         ;;
2547                 sunos) osname=sunos
2548                         case "$3" in
2549                         5*) osname=solaris
2550                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2551                         *)      osvers="$3" ;;
2552                         esac
2553                         ;;
2554                 titanos) osname=titanos
2555                         case "$3" in
2556                         1*) osvers=1 ;;
2557                         2*) osvers=2 ;;
2558                         3*) osvers=3 ;;
2559                         4*) osvers=4 ;;
2560                         *)      osvers="$3" ;;
2561                         esac
2562                         ;;
2563                 ultrix) osname=ultrix
2564                         osvers="$3"
2565                         ;;
2566                 osf1|mls+)      case "$5" in
2567                                 alpha)
2568                                         osname=dec_osf
2569                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2570                                         case "$osvers" in
2571                                         [1-9].[0-9]*) ;;
2572                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2573                                         esac
2574                                         ;;
2575                         hp*)    osname=hp_osf1  ;;
2576                         mips)   osname=mips_osf1 ;;
2577                         esac
2578                         ;;
2579                 unixware) osname=svr5
2580                         osvers="$4"
2581                         ;;
2582                 uts) osname=uts
2583                         osvers="$3"
2584                         ;;
2585                 $2) case "$osname" in
2586                         *isc*) ;;
2587                         *freebsd*) ;;
2588                         svr*)
2589                                 : svr4.x or possibly later
2590                                 case "svr$3" in 
2591                                 ${osname}*)
2592                                         osname=svr$3
2593                                         osvers=$4
2594                                         ;;
2595                                 esac
2596                                 case "$osname" in
2597                                 svr4.0)
2598                                         : Check for ESIX
2599                                         if test -f /stand/boot ; then
2600                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2601                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2602                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2603                                                         if test -n "$isesix"; then
2604                                                                 osname=esix4
2605                                                         fi
2606                                                 fi
2607                                         fi
2608                                         ;;
2609                                 esac
2610                                 ;;
2611                         *)      if test -f /etc/systemid; then
2612                                         osname=sco
2613                                         set `echo $3 | $sed 's/\./ /g'` $4
2614                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2615                                                 osvers=$1.$2.$3
2616                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2617                                                 osvers=$1.$2
2618                                         elif $test -f $src/hints/sco_$1.sh; then
2619                                                 osvers=$1
2620                                         fi
2621                                 else
2622                                         case "$osname" in
2623                                         '') : Still unknown.  Probably a generic Sys V.
2624                                                 osname="sysv"
2625                                                 osvers="$3"
2626                                                 ;;
2627                                         esac
2628                                 fi
2629                                 ;;
2630                         esac
2631                         ;;
2632                 *)      case "$osname" in
2633                         '') : Still unknown.  Probably a generic BSD.
2634                                 osname="$1"
2635                                 osvers="$3"
2636                                 ;;
2637                         esac
2638                         ;;
2639                 esac
2640         else
2641                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2642                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2643                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2644                                 osname=news_os
2645                         fi
2646                         $rm -f UU/kernel.what
2647                 elif test -d c:/.; then
2648                         set X $myuname
2649                         osname=os2
2650                         osvers="$5"
2651                 fi
2652         fi
2653         
2654         : Now look for a hint file osname_osvers, unless one has been
2655         : specified already.
2656         case "$hintfile" in
2657         ''|' ')
2658                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2659                 : Also try without trailing minor version numbers.
2660                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2661                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2662                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2663                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2664                 case "$file" in
2665                 '') dflt=none ;;
2666                 *)  case "$osvers" in
2667                         '') dflt=$file
2668                                 ;;
2669                         *)  if $test -f $src/hints/$file.sh ; then
2670                                         dflt=$file
2671                                 elif $test -f $src/hints/$xfile.sh ; then
2672                                         dflt=$xfile
2673                                 elif $test -f $src/hints/$xxfile.sh ; then
2674                                         dflt=$xxfile
2675                                 elif $test -f $src/hints/$xxxfile.sh ; then
2676                                         dflt=$xxxfile
2677                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2678                                         dflt=$xxxxfile
2679                                 elif $test -f "$src/hints/${osname}.sh" ; then
2680                                         dflt="${osname}"
2681                                 else
2682                                         dflt=none
2683                                 fi
2684                                 ;;
2685                         esac
2686                         ;;
2687                 esac
2688                 if $test -f Policy.sh ; then
2689                         case "$dflt" in
2690                         *Policy*) ;;
2691                         none) dflt="Policy" ;;
2692                         *) dflt="Policy $dflt" ;;
2693                         esac
2694                 fi
2695                 ;;
2696         *)
2697                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2698                 ;;
2699         esac
2700
2701         if $test -f Policy.sh ; then
2702                 $cat <<EOM
2703
2704 There's also a Policy hint file available, which should make the
2705 site-specific (policy) questions easier to answer.
2706 EOM
2707
2708         fi
2709
2710         $cat <<EOM
2711
2712 You may give one or more space-separated answers, or "none" if appropriate.
2713 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2714 is a good thing.  DO NOT give a wrong version or a wrong OS.
2715
2716 EOM
2717
2718         rp="Which of these apply, if any?"
2719         . UU/myread
2720         tans=$ans
2721         for file in $tans; do
2722                 if $test X$file = XPolicy -a -f Policy.sh; then
2723                         . Policy.sh
2724                         $cat Policy.sh >> UU/config.sh
2725                 elif $test -f $src/hints/$file.sh; then
2726                         . $src/hints/$file.sh
2727                         $cat $src/hints/$file.sh >> UU/config.sh
2728                 elif $test X$tans = X -o X$tans = Xnone ; then
2729                         : nothing
2730                 else
2731                         : Give one chance to correct a possible typo.
2732                         echo "$file.sh does not exist"
2733                         dflt=$file
2734                         rp="hint to use instead?"
2735                         . UU/myread
2736                         for file in $ans; do
2737                                 if $test -f "$src/hints/$file.sh"; then
2738                                         . $src/hints/$file.sh
2739                                         $cat $src/hints/$file.sh >> UU/config.sh
2740                                 elif $test X$ans = X -o X$ans = Xnone ; then
2741                                         : nothing
2742                                 else
2743                                         echo "$file.sh does not exist -- ignored."
2744                                 fi
2745                         done
2746                 fi
2747         done
2748
2749         hint=recommended
2750         : Remember our hint file for later.
2751         if $test -f "$src/hints/$file.sh" ; then
2752                 hintfile="$file"
2753         else
2754                 hintfile=''
2755         fi
2756 fi
2757 cd UU
2758 ;;
2759 *)
2760         echo " "
2761         echo "Fetching default answers from $config_sh..." >&4
2762         tmp_n="$n"
2763         tmp_c="$c"
2764         cd ..
2765         cp $config_sh config.sh 2>/dev/null
2766         chmod +w config.sh
2767         . ./config.sh
2768         cd UU
2769         cp ../config.sh .
2770         n="$tmp_n"
2771         c="$tmp_c"
2772         hint=previous
2773         ;;
2774 esac
2775 test "$override" && . ./optdef.sh
2776
2777 : Restore computed paths
2778 for file in $loclist $trylist; do
2779         eval $file="\$_$file"
2780 done
2781
2782 cat << EOM
2783
2784 Configure uses the operating system name and version to set some defaults.
2785 The default value is probably right if the name rings a bell. Otherwise,
2786 since spelling matters for me, either accept the default or answer "none"
2787 to leave it blank.
2788
2789 EOM
2790 case "$osname" in
2791         ''|' ')
2792                 case "$hintfile" in
2793                 ''|' '|none) dflt=none ;;
2794                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2795                 esac
2796                 ;;
2797         *) dflt="$osname" ;;
2798 esac
2799 rp="Operating system name?"
2800 . ./myread
2801 case "$ans" in
2802 none)  osname='' ;;
2803 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2804 esac
2805 echo " "
2806 case "$osvers" in
2807         ''|' ')
2808                 case "$hintfile" in
2809                 ''|' '|none) dflt=none ;;
2810                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2811                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2812                         case "$dflt" in
2813                         ''|' ') dflt=none ;;
2814                         esac
2815                         ;;
2816                 esac
2817                 ;;
2818         *) dflt="$osvers" ;;
2819 esac
2820 rp="Operating system version?"
2821 . ./myread
2822 case "$ans" in
2823 none)  osvers='' ;;
2824 *) osvers="$ans" ;;
2825 esac
2826
2827
2828 . ./posthint.sh
2829
2830 : who configured the system
2831 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2832 cf_by=`(logname) 2>/dev/null`
2833 case "$cf_by" in
2834 "")
2835         cf_by=`(whoami) 2>/dev/null`
2836         case "$cf_by" in
2837         "") cf_by=unknown ;;
2838         esac ;;
2839 esac
2840
2841 : set up the script used to warn in case of inconsistency
2842 cat <<EOS >whoa
2843 $startsh
2844 EOS
2845 cat <<'EOSC' >>whoa
2846 dflt=y
2847 echo " "
2848 echo "*** WHOA THERE!!! ***" >&4
2849 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2850 rp="    Keep the $hint value?"
2851 . ./myread
2852 case "$ans" in
2853 y) td=$was; tu=$was;;
2854 esac
2855 EOSC
2856
2857 : function used to set $1 to $val
2858 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2859 case "$val$was" in
2860 $define$undef) . ./whoa; eval "$var=\$td";;
2861 $undef$define) . ./whoa; eval "$var=\$tu";;
2862 *) eval "$var=$val";;
2863 esac'
2864
2865 case "$usethreads" in
2866 $define|true|[yY]*)     dflt='y';;
2867 *) dflt='n';;
2868 esac
2869 cat <<EOM
2870
2871 Perl can be built to take advantage of threads on some systems.
2872 To do so, Configure can be run with -Dusethreads.
2873
2874 Note that threading is a highly experimental feature, and
2875 some known race conditions still remain.  If you choose to try
2876 it, be very sure to not actually deploy it for production
2877 purposes.  README.threads has more details, and is required
2878 reading if you enable threads.
2879
2880 If this doesn't make any sense to you, just accept the default '$dflt'.
2881 EOM
2882 rp='Build a threading Perl?'
2883 . ./myread
2884 case "$ans" in
2885 y|Y)    val="$define" ;;
2886 *)      val="$undef" ;;
2887 esac
2888 set usethreads
2889 eval $setvar
2890
2891 case "$usethreads" in
2892 $define)
2893         $cat <<EOM
2894
2895 As of 5.5.640, Perl has two different internal threading implementations,
2896 the 5.005 version (5005threads) and an interpreter-based version
2897 (ithreads) that has one interpreter per thread.  Both are very 
2898 experimental.  This arrangement exists to help developers work out
2899 which one is better.
2900
2901 If you're a casual user, you probably don't want interpreter-threads
2902 at this time.  There doesn't yet exist a way to create threads from
2903 within Perl in this model, i.e., "use Thread;" will NOT work.
2904 EOM
2905         : Default to ithreads unless overridden on command line or with
2906         : old config.sh
2907         dflt='y'
2908         case "$use5005threads" in
2909                 $define|true|[yY]*) dflt='n';;
2910         esac
2911         case "$useithreads" in
2912                 $undef|false|[nN]*) dflt='n';;
2913         esac
2914         rp='Use interpreter-based ithreads?'
2915         . ./myread
2916         case "$ans" in
2917         y|Y)    val="$define" ;;
2918         *)      val="$undef" ;;
2919         esac
2920         set useithreads
2921         eval $setvar
2922         : Now set use5005threads to the opposite value.
2923         case "$useithreads" in
2924         $define) val="$undef" ;;
2925         *) val="$define" ;;
2926         esac
2927         set use5005threads
2928         eval $setvar
2929         ;;
2930 *)
2931         useithreads="$undef"
2932         use5005threads="$undef"
2933         ;;
2934 esac
2935
2936 case "$d_oldpthreads" in
2937 '')     : Configure tests would be welcome here.  For now, assume undef.
2938         val="$undef" ;;
2939 *)      val="$d_oldpthreads" ;;
2940 esac
2941 set d_oldpthreads
2942 eval $setvar
2943
2944
2945 case "$usethreads" in
2946 "$define"|true|[yY]*)
2947 : Look for a hint-file generated 'call-back-unit'.  If the
2948 : user has specified that a threading perl is to be built,
2949 : we may need to set or change some other defaults.
2950         if $test -f usethreads.cbu; then
2951                 echo "Your platform has some specific hints for threaded builds, using them..."
2952                 . ./usethreads.cbu
2953         else
2954                 $cat <<EOM
2955 (Your platform doesn't have any specific hints for threaded builds.
2956  Assuming POSIX threads, then.)
2957 EOM
2958         fi
2959         ;;
2960 esac
2961
2962 cat <<EOM
2963
2964 Perl can be built so that multiple Perl interpreters can coexist
2965 within the same Perl executable.
2966 EOM
2967
2968 case "$useithreads" in
2969 $define)
2970         cat <<EOM
2971 This multiple interpreter support is required for interpreter-based threads.
2972 EOM
2973         val="$define"
2974         ;;
2975 *)      case "$usemultiplicity" in
2976         $define|true|[yY]*)     dflt='y';;
2977         *) dflt='n';;
2978         esac
2979         echo " "
2980         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2981         rp='Build Perl for multiplicity?'
2982         . ./myread
2983         case "$ans" in
2984         y|Y)    val="$define" ;;
2985         *)      val="$undef" ;;
2986         esac
2987         ;;
2988 esac
2989 set usemultiplicity
2990 eval $setvar
2991
2992 : make some quick guesses about what we are up against
2993 echo " "
2994 $echo $n "Hmm...  $c"
2995 echo exit 1 >bsd
2996 echo exit 1 >usg
2997 echo exit 1 >v7
2998 echo exit 1 >osf1
2999 echo exit 1 >eunice
3000 echo exit 1 >xenix
3001 echo exit 1 >venix
3002 echo exit 1 >os2
3003 d_bsd="$undef"
3004 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3005 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3006 then
3007         echo "Looks kind of like an OSF/1 system, but we'll see..."
3008         echo exit 0 >osf1
3009 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3010         xxx=`./loc addbib blurfl $pth`
3011         if $test -f $xxx; then
3012         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3013                 echo exit 0 >bsd
3014                 echo exit 0 >usg
3015         else
3016                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3017                         echo "Looks kind of like an extended USG system, but we'll see..."
3018                 else
3019                         echo "Looks kind of like a USG system, but we'll see..."
3020                 fi
3021                 echo exit 0 >usg
3022         fi
3023 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3024         echo "Looks kind of like a BSD system, but we'll see..."
3025         d_bsd="$define"
3026         echo exit 0 >bsd
3027 else
3028         echo "Looks kind of like a Version 7 system, but we'll see..."
3029         echo exit 0 >v7
3030 fi
3031 case "$eunicefix" in
3032 *unixtovms*)
3033         $cat <<'EOI'
3034 There is, however, a strange, musty smell in the air that reminds me of
3035 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3036 EOI
3037         echo exit 0 >eunice
3038         d_eunice="$define"
3039 : it so happens the Eunice I know will not run shell scripts in Unix format
3040         ;;
3041 *)
3042         echo " "
3043         echo "Congratulations.  You aren't running Eunice."
3044         d_eunice="$undef"
3045         ;;
3046 esac
3047 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3048 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3049 : semicolon as a patch separator
3050 case "$p_" in
3051 :) ;;
3052 *)
3053         $cat <<'EOI'
3054 I have the feeling something is not exactly right, however...don't tell me...
3055 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3056 (Or you may be running DOS with DJGPP.)
3057 EOI
3058         echo exit 0 >os2
3059         ;;
3060 esac
3061 if test -f /xenix; then
3062         echo "Actually, this looks more like a XENIX system..."
3063         echo exit 0 >xenix
3064         d_xenix="$define"
3065 else
3066         echo " "
3067         echo "It's not Xenix..."
3068         d_xenix="$undef"
3069 fi
3070 chmod +x xenix
3071 $eunicefix xenix
3072 if test -f /venix; then
3073         echo "Actually, this looks more like a VENIX system..."
3074         echo exit 0 >venix
3075 else
3076         echo " "
3077         if ./xenix; then
3078                 : null
3079         else
3080                 echo "Nor is it Venix..."
3081         fi
3082 fi
3083 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3084 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3085 $rm -f foo
3086
3087 case "$cc" in
3088 '') dflt=cc;;
3089 *) dflt="$cc";;
3090 esac
3091 rp="Use which C compiler?"
3092 . ./myread
3093 cc="$ans"
3094 : Look for a hint-file generated 'call-back-unit'.  Now that the
3095 : user has specified the compiler, we may need to set or change some
3096 : other defaults.
3097 if $test -f cc.cbu; then
3098     . ./cc.cbu
3099 fi
3100 . ./checkcc
3101
3102 echo " "
3103 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3104 $cat >gccvers.c <<EOM
3105 #include <stdio.h>
3106 int main() {
3107 #ifdef __GNUC__
3108 #ifdef __VERSION__
3109         printf("%s\n", __VERSION__);
3110 #else
3111         printf("%s\n", "1");
3112 #endif
3113 #endif
3114         exit(0);
3115 }
3116 EOM
3117 if $cc -o gccvers $ldflags gccvers.c; then
3118         gccversion=`./gccvers`
3119         case "$gccversion" in
3120         '') echo "You are not using GNU cc." ;;
3121         *)  echo "You are using GNU cc $gccversion."
3122             ccname=gcc  
3123             ;;
3124         esac
3125 else
3126         echo " "
3127         echo "*** WHOA THERE!!! ***" >&4
3128         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3129         case "$knowitall" in
3130         '')
3131         echo "    You'd better start hunting for one and let me know about it." >&4
3132                 exit 1
3133                 ;;
3134         esac
3135 fi
3136 $rm -f gccvers*
3137 case "$gccversion" in
3138 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3139 esac
3140 case "$gccversion" in
3141 '') gccosandvers='' ;;
3142 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3143    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3144    gccshortvers=''
3145    case "$gccosandvers" in
3146    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3147    $osname$osvers) ;; # looking good
3148    $osname*) cat <<EOM >&4
3149
3150 *** WHOA THERE!!! ***
3151
3152     Your gcc has not been compiled for the exact release of
3153     your operating system ($gccosandvers versus $osname$osvers).
3154
3155     In general it is a good idea to keep gcc synchronized with
3156     the operating system because otherwise serious problems
3157     may ensue when trying to compile software, like Perl.
3158
3159     I'm trying to be optimistic here, though, and will continue.
3160     If later during the configuration and build icky compilation
3161     problems appear (headerfile conflicts being the most common
3162     manifestation), I suggest reinstalling the gcc to match
3163     your operating system release.
3164
3165 EOM
3166       ;;
3167    *) gccosandvers='' ;; # failed to parse, better be silent
3168    esac
3169    ;;
3170 esac
3171 case "$ccname" in
3172 '') ccname="$cc" ;;
3173 esac
3174
3175 : see how we invoke the C preprocessor
3176 echo " "
3177 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3178 cat <<'EOT' >testcpp.c
3179 #define ABC abc
3180 #define XYZ xyz
3181 ABC.XYZ
3182 EOT
3183 cd ..
3184 if test ! -f cppstdin; then
3185         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3186                 # AIX cc -E doesn't show the absolute headerfile
3187                 # locations but we'll cheat by using the -M flag.
3188                 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
3189         else
3190                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3191         fi
3192 else
3193         echo "Keeping your $hint cppstdin wrapper."
3194 fi
3195 chmod 755 cppstdin
3196 wrapper=`pwd`/cppstdin
3197 ok='false'
3198 cd UU
3199
3200 if $test "X$cppstdin" != "X" && \
3201         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3202         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3203 then
3204         echo "You used to use $cppstdin $cppminus so we'll use that again."
3205         case "$cpprun" in
3206         '') echo "But let's see if we can live without a wrapper..." ;;
3207         *)
3208                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3209                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3210                 then
3211                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3212                         ok='true'
3213                 else
3214                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3215                 fi
3216                 ;;
3217         esac
3218 else
3219         case "$cppstdin" in
3220         '') ;;
3221         *)
3222                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3223                 ;;
3224         esac
3225 fi
3226
3227 if $ok; then
3228         : nothing
3229 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3230         $cc -E <testcpp.c >testcpp.out 2>&1; \
3231         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3232         echo "Yup, it does."
3233         x_cpp="$cc -E"
3234         x_minus='';
3235 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3236         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3237         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3238         echo "Yup, it does."
3239         x_cpp="$cc -E"
3240         x_minus='-';
3241 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3242         $cc -P <testcpp.c >testcpp.out 2>&1; \
3243         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3244         echo "Yipee, that works!"
3245         x_cpp="$cc -P"
3246         x_minus='';
3247 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3248         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3249         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3250         echo "At long last!"
3251         x_cpp="$cc -P"
3252         x_minus='-';
3253 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3254         $cpp <testcpp.c >testcpp.out 2>&1; \
3255         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3256         echo "It works!"
3257         x_cpp="$cpp"
3258         x_minus='';
3259 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3260         $cpp - <testcpp.c >testcpp.out 2>&1; \
3261         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3262         echo "Hooray, it works!  I was beginning to wonder."
3263         x_cpp="$cpp"
3264         x_minus='-';
3265 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3266         $wrapper <testcpp.c >testcpp.out 2>&1; \
3267         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3268         x_cpp="$wrapper"
3269         x_minus=''
3270         echo "Eureka!"
3271 else
3272         dflt=''
3273         rp="No dice.  I can't find a C preprocessor.  Name one:"
3274         . ./myread
3275         x_cpp="$ans"
3276         x_minus=''
3277         $x_cpp <testcpp.c >testcpp.out 2>&1
3278         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3279                 echo "OK, that will do." >&4
3280         else
3281 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3282                 exit 1
3283         fi
3284 fi
3285
3286 case "$ok" in
3287 false)
3288         cppstdin="$x_cpp"
3289         cppminus="$x_minus"
3290         cpprun="$x_cpp"
3291         cpplast="$x_minus"
3292         set X $x_cpp
3293         shift
3294         case "$1" in
3295         "$cpp")
3296                 echo "Perhaps can we force $cc -E using a wrapper..."
3297                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3298                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3299                 then
3300                         echo "Yup, we can."
3301                         cppstdin="$wrapper"
3302                         cppminus='';
3303                 else
3304                         echo "Nope, we'll have to live without it..."
3305                 fi
3306                 ;;
3307         esac
3308         case "$cpprun" in
3309         "$wrapper")
3310                 cpprun=''
3311                 cpplast=''
3312                 ;;
3313         esac
3314         ;;
3315 esac
3316
3317 case "$cppstdin" in
3318 "$wrapper"|'cppstdin') ;;
3319 *) $rm -f $wrapper;;
3320 esac
3321 $rm -f testcpp.c testcpp.out
3322
3323 : decide how portable to be.  Allow command line overrides.
3324 case "$d_portable" in
3325 "$undef") ;;
3326 *)      d_portable="$define" ;;
3327 esac
3328
3329 : set up shell script to do ~ expansion
3330 cat >filexp <<EOSS
3331 $startsh
3332 : expand filename
3333 case "\$1" in
3334  ~/*|~)
3335         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3336         ;;
3337  ~*)
3338         if $test -f /bin/csh; then
3339                 /bin/csh -f -c "glob \$1"
3340                 failed=\$?
3341                 echo ""
3342                 exit \$failed
3343         else
3344                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3345                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3346                 if $test ! -d "\$dir"; then
3347                         me=\`basename \$0\`
3348                         echo "\$me: can't locate home directory for: \$name" >&2
3349                         exit 1
3350                 fi
3351                 case "\$1" in
3352                 */*)
3353                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3354                         ;;
3355                 *)
3356                         echo \$dir
3357                         ;;
3358                 esac
3359         fi
3360         ;;
3361 *)
3362         echo \$1
3363         ;;
3364 esac
3365 EOSS
3366 chmod +x filexp
3367 $eunicefix filexp
3368
3369 : now set up to get a file name
3370 cat <<EOS >getfile
3371 $startsh
3372 EOS
3373 cat <<'EOSC' >>getfile
3374 tilde=''
3375 fullpath=''
3376 already=''
3377 skip=''
3378 none_ok=''
3379 exp_file=''
3380 nopath_ok=''
3381 orig_rp="$rp"
3382 orig_dflt="$dflt"
3383 case "$gfpth" in
3384 '') gfpth='.' ;;
3385 esac
3386
3387 case "$fn" in
3388 *\(*)
3389         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3390         fn=`echo $fn | sed 's/(.*)//'`
3391         ;;
3392 esac
3393
3394 case "$fn" in
3395 *:*)
3396         loc_file=`expr $fn : '.*:\(.*\)'`
3397         fn=`expr $fn : '\(.*\):.*'`
3398         ;;
3399 esac
3400
3401 case "$fn" in
3402 *~*) tilde=true;;
3403 esac
3404 case "$fn" in
3405 */*) fullpath=true;;
3406 esac
3407 case "$fn" in
3408 *+*) skip=true;;
3409 esac
3410 case "$fn" in
3411 *n*) none_ok=true;;
3412 esac
3413 case "$fn" in
3414 *e*) exp_file=true;;
3415 esac
3416 case "$fn" in
3417 *p*) nopath_ok=true;;
3418 esac
3419
3420 case "$fn" in
3421 *f*) type='File';;
3422 *d*) type='Directory';;
3423 *l*) type='Locate';;
3424 esac
3425
3426 what="$type"
3427 case "$what" in
3428 Locate) what='File';;
3429 esac
3430
3431 case "$exp_file" in
3432 '')
3433         case "$d_portable" in
3434         "$define") ;;
3435         *) exp_file=true;;
3436         esac
3437         ;;
3438 esac
3439
3440 cd ..
3441 while test "$type"; do
3442         redo=''
3443         rp="$orig_rp"
3444         dflt="$orig_dflt"
3445         case "$tilde" in
3446         true) rp="$rp (~name ok)";;
3447         esac
3448         . UU/myread
3449         if test -f UU/getfile.ok && \
3450                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3451         then
3452                 value="$ans"
3453                 ansexp="$ans"
3454                 break
3455         fi
3456         case "$ans" in
3457         none)
3458                 value=''
3459                 ansexp=''
3460                 case "$none_ok" in
3461                 true) type='';;
3462                 esac
3463                 ;;
3464         *)
3465                 case "$tilde" in
3466                 '') value="$ans"
3467                         ansexp="$ans";;
3468                 *)
3469                         value=`UU/filexp $ans`
3470                         case $? in
3471                         0)
3472                                 if test "$ans" != "$value"; then
3473                                         echo "(That expands to $value on this system.)"
3474                                 fi
3475                                 ;;
3476                         *) value="$ans";;
3477                         esac
3478                         ansexp="$value"
3479                         case "$exp_file" in
3480                         '') value="$ans";;
3481                         esac
3482                         ;;
3483                 esac
3484                 case "$fullpath" in
3485                 true)
3486                         case "$ansexp" in
3487                         /*) value="$ansexp" ;;
3488                         [a-zA-Z]:/*) value="$ansexp" ;;
3489                         *)
3490                                 redo=true
3491                                 case "$already" in
3492                                 true)
3493                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3494                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3495                                         ;;
3496                                 *)
3497                                 echo "Please give a full path name, starting with slash." >&4
3498                                         case "$tilde" in
3499                                         true)
3500                                 echo "Note that using ~name is ok provided it expands well." >&4
3501                                                 already=true
3502                                                 ;;
3503                                         esac
3504                                 esac
3505                                 ;;
3506                         esac
3507                         ;;
3508                 esac
3509                 case "$redo" in
3510                 '')
3511                         case "$type" in
3512                         File)
3513                                 for fp in $gfpth; do
3514                                         if test "X$fp" = X.; then
3515                                             pf="$ansexp"
3516                                         else    
3517                                             pf="$fp/$ansexp"
3518                                         fi
3519                                         if test -f "$pf"; then
3520                                                 type=''
3521                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3522                                         then
3523                                                 echo "($value is not a plain file, but that's ok.)"
3524                                                 type=''
3525                                         fi
3526                                         if test X"$type" = X; then
3527                                             value="$pf"
3528                                             break
3529                                         fi
3530                                 done
3531                                 ;;
3532                         Directory)
3533                                 for fp in $gfpth; do
3534                                         if test "X$fp" = X.; then
3535                                             dir="$ans"
3536                                             direxp="$ansexp"
3537                                         else    
3538                                             dir="$fp/$ansexp"
3539                                             direxp="$fp/$ansexp"
3540                                         fi
3541                                         if test -d "$direxp"; then
3542                                                 type=''
3543                                                 value="$dir"
3544                                                 break
3545                                         fi
3546                                 done
3547                                 ;;
3548                         Locate)
3549                                 if test -d "$ansexp"; then
3550                                         echo "(Looking for $loc_file in directory $value.)"
3551                                         value="$value/$loc_file"
3552                                         ansexp="$ansexp/$loc_file"
3553                                 fi
3554                                 if test -f "$ansexp"; then
3555                                         type=''
3556                                 fi
3557                                 case "$nopath_ok" in
3558                                 true)   case "$value" in
3559                                         */*) ;;
3560                                         *)      echo "Assuming $value will be in people's path."
3561                                                 type=''
3562                                                 ;;
3563                                         esac
3564                                         ;;
3565                                 esac
3566                                 ;;
3567                         esac
3568
3569                         case "$skip" in
3570                         true) type='';
3571                         esac
3572
3573                         case "$type" in
3574                         '') ;;
3575                         *)
3576                                 if test "$fastread" = yes; then
3577                                         dflt=y
3578                                 else
3579                                         dflt=n
3580                                 fi
3581                                 rp="$what $value doesn't exist.  Use that name anyway?"
3582                                 . UU/myread
3583                                 dflt=''
3584                                 case "$ans" in
3585                                 y*) type='';;
3586                                 *) echo " ";;
3587                                 esac
3588                                 ;;
3589                         esac
3590                         ;;
3591                 esac
3592                 ;;
3593         esac
3594 done
3595 cd UU
3596 ans="$value"
3597 rp="$orig_rp"
3598 dflt="$orig_dflt"
3599 rm -f getfile.ok
3600 test "X$gfpthkeep" != Xy && gfpth=""
3601 EOSC
3602
3603 : What should the include directory be ?
3604 echo " "
3605 $echo $n "Hmm...  $c"
3606 dflt='/usr/include'
3607 incpath=''
3608 mips_type=''
3609 if $test -f /bin/mips && /bin/mips; then
3610         echo "Looks like a MIPS system..."
3611         $cat >usr.c <<'EOCP'
3612 #ifdef SYSTYPE_BSD43
3613 /bsd43
3614 #endif
3615 EOCP
3616         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3617                 dflt='/bsd43/usr/include'
3618                 incpath='/bsd43'
3619                 mips_type='BSD 4.3'
3620         else
3621                 mips_type='System V'
3622         fi
3623         $rm -f usr.c usr.out
3624         echo "and you're compiling with the $mips_type compiler and libraries."
3625         xxx_prompt=y
3626         echo "exit 0" >mips
3627 else
3628         echo "Doesn't look like a MIPS system."
3629         xxx_prompt=n
3630         echo "exit 1" >mips
3631 fi
3632 chmod +x mips
3633 $eunicefix mips
3634 case "$usrinc" in
3635 '') ;;
3636 *) dflt="$usrinc";;
3637 esac
3638 case "$xxx_prompt" in
3639 y)      fn=d/
3640         echo " "
3641         rp='Where are the include files you want to use?'
3642         . ./getfile
3643         usrinc="$ans"
3644         ;;
3645 *)      usrinc="$dflt"
3646         ;;
3647 esac
3648
3649 : Set private lib path
3650 case "$plibpth" in
3651 '') if ./mips; then
3652                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3653         fi;;
3654 esac
3655 case "$libpth" in
3656 ' ') dlist='';;
3657 '') dlist="$loclibpth $plibpth $glibpth";;
3658 *) dlist="$libpth";;
3659 esac
3660
3661 : Now check and see which directories actually exist, avoiding duplicates
3662 libpth=''
3663 for xxx in $dlist
3664 do
3665     if $test -d $xxx; then
3666                 case " $libpth " in
3667                 *" $xxx "*) ;;
3668                 *) libpth="$libpth $xxx";;
3669                 esac
3670     fi
3671 done
3672 $cat <<'EOM'
3673
3674 Some systems have incompatible or broken versions of libraries.  Among
3675 the directories listed in the question below, please remove any you
3676 know not to be holding relevant libraries, and add any that are needed.
3677 Say "none" for none.
3678
3679 EOM
3680 case "$libpth" in
3681 '') dflt='none';;
3682 *)
3683         set X $libpth
3684         shift
3685         dflt=${1+"$@"}
3686         ;;
3687 esac
3688 rp="Directories to use for library searches?"
3689 . ./myread
3690 case "$ans" in
3691 none) libpth=' ';;
3692 *) libpth="$ans";;
3693 esac
3694
3695 : compute shared library extension
3696 case "$so" in
3697 '')
3698         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3699                 dflt='sl'
3700         else
3701                 dflt='so'
3702         fi
3703         ;;
3704 *) dflt="$so";;
3705 esac
3706 $cat <<EOM
3707
3708 On some systems, shared libraries may be available.  Answer 'none' if
3709 you want to suppress searching of shared libraries for the remainder
3710 of this configuration.
3711
3712 EOM
3713 rp='What is the file extension used for shared libraries?'
3714 . ./myread
3715 so="$ans"
3716
3717 : Define several unixisms.
3718 : Hints files or command line option can be used to override them.
3719 : The convoluted testing is in case hints files set either the old
3720 : or the new name.
3721 case "$_exe" in
3722 '')     case "$exe_ext" in
3723     '') ;;
3724         *)      _exe="$exe_ext" ;;
3725         esac
3726         ;;
3727 esac
3728 case "$_a" in
3729 '')     case "$lib_ext" in
3730     '') _a='.a';;
3731         *)      _a="$lib_ext" ;;
3732         esac
3733         ;;
3734 esac
3735 case "$_o" in
3736 '') case "$obj_ext" in
3737         '')     _o='.o';;
3738         *)      _o="$obj_ext";;
3739         esac
3740         ;;
3741 esac
3742 case "$p_" in
3743 '') case "$path_sep" in
3744         '')     p_=':';;
3745         *)      p_="$path_sep";;
3746         esac
3747         ;;
3748 esac
3749 exe_ext=$_exe
3750 lib_ext=$_a
3751 obj_ext=$_o
3752 path_sep=$p_
3753
3754 : Which makefile gets called first.  This is used by make depend.
3755 case "$firstmakefile" in
3756 '') firstmakefile='makefile';;
3757 esac
3758
3759 case "$usesocks" in
3760 $define|true|[yY]*)     dflt='y';;
3761 *) dflt='n';;
3762 esac
3763 cat <<EOM
3764
3765 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3766 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3767 to use the PerlIO abstraction layer, this will be implicitly selected.
3768
3769 If this doesn't make any sense to you, just accept the default '$dflt'.
3770 EOM
3771 rp='Build Perl for SOCKS?'
3772 . ./myread
3773 case "$ans" in
3774 y|Y)    val="$define" ;;     
3775 *)      val="$undef" ;;
3776 esac
3777 set usesocks
3778 eval $setvar
3779
3780 case "$usesocks" in
3781 $define|true|[yY]*) useperlio="$define";;
3782 esac
3783
3784 : Looking for optional libraries
3785 echo " "
3786 echo "Checking for optional libraries..." >&4
3787 case "$libs" in
3788 ' '|'') dflt='';;
3789 *) dflt="$libs";;
3790 esac
3791 case "$libswanted" in
3792 '') libswanted='c_s';;
3793 esac
3794 case "$usesocks" in
3795 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3796 esac
3797 libsfound=''
3798 libsfiles=''
3799 libsdirs=''
3800 libspath=''
3801 for thisdir in $libpth $xlibpth; do
3802   test -d $thisdir && libspath="$libspath $thisdir"
3803 done
3804 for thislib in $libswanted; do
3805         for thisdir in $libspath; do
3806             xxx=''
3807             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3808                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3809                 $test -f "$xxx" && eval $libscheck
3810                 $test -f "$xxx" && libstyle=shared
3811             fi
3812             if test ! -f "$xxx"; then
3813                 xxx=$thisdir/lib$thislib.$so
3814                 $test -f "$xxx" && eval $libscheck
3815                 $test -f "$xxx" && libstyle=shared
3816             fi  
3817             if test ! -f "$xxx"; then
3818                 xxx=$thisdir/lib$thislib$_a
3819                 $test -f "$xxx" && eval $libscheck
3820                 $test -f "$xxx" && libstyle=static
3821             fi
3822             if test ! -f "$xxx"; then
3823                 xxx=$thisdir/$thislib$_a
3824                 $test -f "$xxx" && eval $libscheck
3825                 $test -f "$xxx" && libstyle=static
3826             fi
3827             if test ! -f "$xxx"; then
3828                 xxx=$thisdir/lib${thislib}_s$_a
3829                 $test -f "$xxx" && eval $libscheck
3830                 $test -f "$xxx" && libstyle=static
3831                 $test -f "$xxx" && thislib=${thislib}_s
3832             fi
3833             if test ! -f "$xxx"; then
3834                 xxx=$thisdir/Slib$thislib$_a
3835                 $test -f "$xxx" && eval $libscheck
3836                 $test -f "$xxx" && libstyle=static
3837             fi
3838             if $test -f "$xxx"; then
3839                 case "$libstyle" in
3840                 shared) echo "Found -l$thislib (shared)." ;;
3841                 static) echo "Found -l$thislib." ;;
3842                 *)      echo "Found -l$thislib ($libstyle)." ;;
3843                 esac
3844                 case " $dflt " in
3845                 *"-l$thislib "*);;
3846                 *) dflt="$dflt -l$thislib"
3847                    libsfound="$libsfound $xxx"
3848                    yyy=`basename $xxx`
3849                    libsfiles="$libsfiles $yyy"
3850                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3851                    case " $libsdirs " in
3852                    *" $yyy "*) ;;
3853                    *) libsdirs="$libsdirs $yyy" ;;
3854                    esac
3855                    ;;
3856                 esac
3857                 break
3858             fi  
3859         done
3860         if $test ! -f "$xxx"; then
3861             echo "No -l$thislib."
3862         fi
3863 done
3864 set X $dflt
3865 shift
3866 dflt="$*"
3867 case "$libs" in
3868 '') dflt="$dflt";;
3869 *) dflt="$libs";;
3870 esac
3871 case "$dflt" in
3872 ' '|'') dflt='none';;
3873 esac
3874
3875 $cat <<EOM
3876
3877 In order to compile $package on your machine, a number of libraries
3878 are usually needed.  Include any other special libraries here as well.
3879 Say "none" for none.  The default list is almost always right.
3880 EOM
3881
3882 echo " "
3883 rp="What libraries to use?"
3884 . ./myread
3885 case "$ans" in
3886 none) libs=' ';;
3887 *) libs="$ans";;
3888 esac
3889
3890 : determine optimization, if desired, or use for debug flag also
3891 case "$optimize" in
3892 ' '|$undef) dflt='none';;
3893 '') dflt='-O';;
3894 *) dflt="$optimize";;
3895 esac
3896 $cat <<EOH
3897
3898 By default, $package compiles with the -O flag to use the optimizer.
3899 Alternately, you might want to use the symbolic debugger, which uses
3900 the -g flag (on traditional Unix systems).  Either flag can be
3901 specified here.  To use neither flag, specify the word "none".
3902
3903 EOH
3904 rp="What optimizer/debugger flag should be used?"
3905 . ./myread
3906 optimize="$ans"
3907 case "$optimize" in
3908 'none') optimize=" ";;
3909 esac
3910
3911 dflt=''
3912 : We will not override a previous value, but we might want to
3913 : augment a hint file
3914 case "$hint" in
3915 default|recommended)
3916         case "$gccversion" in
3917         1*) dflt='-fpcc-struct-return' ;;
3918         esac
3919         case "$optimize" in
3920         *-g*) dflt="$dflt -DDEBUGGING";;
3921         esac
3922         case "$gccversion" in
3923         2*) if test -d /etc/conf/kconfig.d &&
3924                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3925                 then
3926                         dflt="$dflt -posix"
3927                 fi
3928                 ;;
3929         esac
3930         case "$gccversion" in
3931         1*) ;;
3932         2.[0-8]*) ;;
3933         ?*)     echo " "
3934                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3935                 echo 'int main(void) { return 0; }' > gcctest.c
3936                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3937                         echo "Yes, it does." 2>&1
3938                         case "$ccflags" in
3939                         *strict-aliasing*) 
3940                                 echo "Leaving current flags $ccflags alone." 2>&1
3941                                 ;;
3942                         *) dflt="$dflt -fno-strict-aliasing" ;;
3943                         esac
3944                 else
3945                         echo "Nope, it doesn't, but that's ok." 2>&1
3946                 fi
3947                 ;;
3948         esac
3949         ;;
3950 esac
3951
3952 case "$mips_type" in
3953 *BSD*|'') inclwanted="$locincpth $usrinc";;
3954 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3955 esac
3956 for thisincl in $inclwanted; do
3957         if $test -d $thisincl; then
3958                 if $test x$thisincl != x$usrinc; then
3959                         case "$dflt" in
3960                         *" -I$thisincl "*);;
3961                         *) dflt="$dflt -I$thisincl ";;
3962                         esac
3963                 fi
3964         fi
3965 done
3966
3967 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3968         xxx=true;
3969 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3970         xxx=true;
3971 else
3972         xxx=false;
3973 fi;
3974 if $xxx; then
3975         case "$dflt" in
3976         *$2*);;
3977         *) dflt="$dflt -D$2";;
3978         esac;
3979 fi'
3980
3981 set signal.h LANGUAGE_C; eval $inctest
3982
3983 case "$usesocks" in
3984 $define)
3985         ccflags="$ccflags -DSOCKS"
3986         ;;
3987 esac
3988
3989 case "$hint" in
3990 default|recommended) dflt="$ccflags $dflt" ;;
3991 *) dflt="$ccflags";;
3992 esac
3993
3994 case "$dflt" in
3995 ''|' ') dflt=none;;
3996 esac
3997
3998 $cat <<EOH
3999
4000 Your C compiler may want other flags.  For this question you should include
4001 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4002 but you should NOT include libraries or ld flags like -lwhatever.  If you
4003 want $package to honor its debug switch, you should include -DDEBUGGING here.
4004 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4005
4006 To use no flags, specify the word "none".
4007
4008 EOH
4009 set X $dflt
4010 shift
4011 dflt=${1+"$@"}
4012 rp="Any additional cc flags?"
4013 . ./myread
4014 case "$ans" in
4015 none) ccflags='';;
4016 *) ccflags="$ans";;
4017 esac
4018
4019 : the following weeds options from ccflags that are of no interest to cpp
4020 cppflags="$ccflags"
4021 case "$gccversion" in
4022 1*) cppflags="$cppflags -D__GNUC__"
4023 esac
4024 case "$mips_type" in
4025 '');;
4026 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4027 esac
4028 case "$cppflags" in
4029 '');;
4030 *)
4031         echo " "
4032         echo "Let me guess what the preprocessor flags are..." >&4
4033         set X $cppflags
4034         shift
4035         cppflags=''
4036         $cat >cpp.c <<'EOM'
4037 #define BLURFL foo
4038
4039 BLURFL xx LFRULB
4040 EOM
4041         previous=''
4042         for flag in $*
4043         do
4044                 case "$flag" in
4045                 -*) ftry="$flag";;
4046                 *) ftry="$previous $flag";;
4047                 esac
4048                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4049                         >cpp1.out 2>/dev/null && \
4050                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4051                         >cpp2.out 2>/dev/null && \
4052                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4053                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4054                 then
4055                         cppflags="$cppflags $ftry"
4056                         previous=''
4057                 else
4058                         previous="$flag"
4059                 fi
4060         done
4061         set X $cppflags
4062         shift
4063         cppflags=${1+"$@"}
4064         case "$cppflags" in
4065         *-*)  echo "They appear to be: $cppflags";;
4066         esac
4067         $rm -f cpp.c cpp?.out
4068         ;;
4069 esac
4070
4071 : flags used in final linking phase
4072 case "$ldflags" in
4073 '') if ./venix; then
4074                 dflt='-i -z'
4075         else
4076                 dflt=''
4077         fi
4078         case "$ccflags" in
4079         *-posix*) dflt="$dflt -posix" ;;
4080         esac
4081         ;;
4082 *) dflt="$ldflags";;
4083 esac
4084
4085 : Try to guess additional flags to pick up local libraries.
4086 for thislibdir in $libpth; do
4087         case " $loclibpth " in
4088         *" $thislibdir "*)
4089                 case "$dflt " in 
4090                 *"-L$thislibdir "*) ;;
4091                 *)  dflt="$dflt -L$thislibdir" ;;
4092                 esac
4093                 ;;
4094         esac
4095 done
4096
4097 case "$dflt" in
4098 '') dflt='none' ;;
4099 esac
4100
4101 $cat <<EOH
4102
4103 Your C linker may need flags.  For this question you should
4104 include -L/whatever and any other flags used by the C linker, but you
4105 should NOT include libraries like -lwhatever.
4106
4107 Make sure you include the appropriate -L/path flags if your C linker
4108 does not normally search all of the directories you specified above,
4109 namely
4110         $libpth
4111 To use no flags, specify the word "none".
4112
4113 EOH
4114
4115 rp="Any additional ld flags (NOT including libraries)?"
4116 . ./myread
4117 case "$ans" in
4118 none) ldflags='';;
4119 *) ldflags="$ans";;
4120 esac
4121 rmlist="$rmlist pdp11"
4122
4123 : coherency check
4124 echo " "
4125 echo "Checking your choice of C compiler and flags for coherency..." >&4
4126 $cat > try.c <<'EOF'
4127 #include <stdio.h>
4128 int main() { printf("Ok\n"); exit(0); }
4129 EOF
4130 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4131 shift
4132 $cat >try.msg <<'EOM'
4133 I've tried to compile and run the following simple program:
4134
4135 EOM
4136 $cat try.c >> try.msg
4137
4138 $cat >> try.msg <<EOM
4139
4140 I used the command:
4141
4142         $*
4143         ./try
4144
4145 and I got the following output:
4146
4147 EOM
4148 dflt=y
4149 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4150         if $sh -c './try' >>try.msg 2>&1; then
4151                 xxx=`./try`
4152                 case "$xxx" in
4153                 "Ok") dflt=n ;;
4154                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4155                         case " $libs " in
4156                         *" -lsfio "*)
4157                                 cat >> try.msg <<'EOQS'
4158 If $libs contains -lsfio, and sfio is mis-configured, then it
4159 sometimes (apparently) runs and exits with a 0 status, but with no
4160 output!  It may have to do with sfio's use of _exit vs. exit.
4161
4162 EOQS
4163                                 rp="You have a big problem.  Shall I abort Configure"
4164                                 dflt=y
4165                                 ;;
4166                         esac
4167                         ;;
4168                 esac
4169         else
4170                 echo "The program compiled OK, but exited with status $?." >>try.msg
4171                 rp="You have a problem.  Shall I abort Configure"
4172                 dflt=y
4173         fi
4174 else
4175         echo "I can't compile the test program." >>try.msg
4176         rp="You have a BIG problem.  Shall I abort Configure"
4177         dflt=y
4178 fi
4179 case "$dflt" in
4180 y)
4181         $cat try.msg >&4
4182         case "$knowitall" in
4183         '')
4184                 echo "(The supplied flags or libraries might be incorrect.)"
4185                 ;;
4186         *) dflt=n;;
4187         esac
4188         echo " "
4189         . ./myread
4190         case "$ans" in
4191         n*|N*) ;;
4192         *)      echo "Ok.  Stopping Configure." >&4
4193                 exit 1
4194                 ;;
4195         esac
4196         ;;
4197 n) echo "OK, that should do.";;
4198 esac
4199 $rm -f try try.* core
4200
4201 : define an is-a-typedef? function
4202 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4203 case "$inclist" in
4204 "") inclist="sys/types.h";;
4205 esac;
4206 eval "varval=\$$var";
4207 case "$varval" in
4208 "")
4209         $rm -f temp.c;
4210         for inc in $inclist; do
4211                 echo "#include <$inc>" >>temp.c;
4212         done;
4213         echo "#ifdef $type" >> temp.c;
4214         echo "printf(\"We have $type\");" >> temp.c;
4215         echo "#endif" >> temp.c;
4216         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4217         if $contains $type temp.E >/dev/null 2>&1; then
4218                 eval "$var=\$type";
4219         else
4220                 eval "$var=\$def";
4221         fi;
4222         $rm -f temp.?;;
4223 *) eval "$var=\$varval";;
4224 esac'
4225
4226 : define an is-a-typedef? function that prompts if the type is not available.
4227 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4228 case "$inclist" in
4229 "") inclist="sys/types.h";;
4230 esac;
4231 eval "varval=\$$var";
4232 case "$varval" in
4233 "")
4234         $rm -f temp.c;
4235         for inc in $inclist; do
4236                 echo "#include <$inc>" >>temp.c;
4237         done;
4238         echo "#ifdef $type" >> temp.c;
4239         echo "printf(\"We have $type\");" >> temp.c;
4240         echo "#endif" >> temp.c;
4241         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4242         echo " " ;
4243         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4244         if $contains $type temp.E >/dev/null 2>&1; then
4245                 echo "$type found." >&4;
4246                 eval "$var=\$type";
4247         else
4248                 echo "$type NOT found." >&4;
4249                 dflt="$def";
4250                 . ./myread ;
4251                 eval "$var=\$ans";
4252         fi;
4253         $rm -f temp.?;;
4254 *) eval "$var=\$varval";;
4255 esac'
4256
4257 : define a shorthand compile call
4258 compile='
4259 mc_file=$1;
4260 shift;
4261 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4262 : define a shorthand compile call for compilations that should be ok.
4263 compile_ok='
4264 mc_file=$1;
4265 shift;
4266 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4267
4268 : check for lengths of integral types
4269 echo " "
4270 case "$intsize" in
4271 '')
4272         echo "Checking to see how big your integers are..." >&4
4273         $cat >intsize.c <<'EOCP'
4274 #include <stdio.h>
4275 int main()
4276 {
4277         printf("intsize=%d;\n", (int)sizeof(int));
4278         printf("longsize=%d;\n", (int)sizeof(long));
4279         printf("shortsize=%d;\n", (int)sizeof(short));
4280         exit(0);
4281 }
4282 EOCP
4283         set intsize
4284         if eval $compile_ok && ./intsize > /dev/null; then
4285                 eval `./intsize`
4286                 echo "Your integers are $intsize bytes long."
4287                 echo "Your long integers are $longsize bytes long."
4288                 echo "Your short integers are $shortsize bytes long."
4289         else
4290                 $cat >&4 <<EOM
4291 !
4292 Help! I can't compile and run the intsize test program: please enlighten me!
4293 (This is probably a misconfiguration in your system or libraries, and
4294 you really ought to fix it.  Still, I'll try anyway.)
4295 !
4296 EOM
4297                 dflt=4
4298                 rp="What is the size of an integer (in bytes)?"
4299                 . ./myread
4300                 intsize="$ans"
4301                 dflt=$intsize
4302                 rp="What is the size of a long integer (in bytes)?"
4303                 . ./myread
4304                 longsize="$ans"
4305                 dflt=2
4306                 rp="What is the size of a short integer (in bytes)?"
4307                 . ./myread
4308                 shortsize="$ans"
4309         fi
4310         ;;
4311 esac
4312 $rm -f intsize intsize.*
4313
4314 : see what type lseek is declared as in the kernel
4315 rp="What is the type used for lseek's offset on this system?"
4316 set off_t lseektype long stdio.h sys/types.h
4317 eval $typedef_ask
4318
4319 echo " "
4320 echo "Checking to see how big your file offsets are..." >&4
4321 $cat >try.c <<EOCP
4322 #include <sys/types.h>
4323 #include <stdio.h>
4324 int main()
4325 {
4326     printf("%d\n", (int)sizeof($lseektype));
4327     return(0); 
4328 }
4329 EOCP
4330 set try
4331 if eval $compile_ok; then
4332         lseeksize=`./try`
4333         echo "Your file offsets are $lseeksize bytes long."
4334 else
4335         dflt=$longsize
4336         echo " "
4337         echo "(I can't seem to compile the test program.  Guessing...)"
4338         rp="What is the size of your file offsets (in bytes)?"
4339         . ./myread
4340         lseeksize="$ans"
4341 fi
4342 $rm -f try.c try
4343
4344 : see what type file positions are declared as in the library
4345 rp="What is the type for file position used by fsetpos()?"
4346 set fpos_t fpostype long stdio.h sys/types.h
4347 eval $typedef_ask
4348
4349 echo " "
4350 case "$fpostype" in
4351 *_t) zzz="$fpostype"    ;;
4352 *)   zzz="fpos_t"       ;;
4353 esac
4354 echo "Checking the size of $zzz..." >&4 
4355 cat > try.c <<EOCP
4356 #include <sys/types.h>
4357 #include <stdio.h>
4358 int main() {
4359     printf("%d\n", (int)sizeof($fpostype));
4360     exit(0);
4361 }
4362 EOCP
4363 set try
4364 if eval $compile_ok; then
4365         yyy=`./try`
4366         case "$yyy" in
4367         '')     fpossize=4
4368                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4369                 ;;
4370         *)      fpossize=$yyy
4371                 echo "Your $zzz is $fpossize bytes long."
4372                 ;;
4373         esac
4374 else
4375         dflt="$longsize"
4376         echo " " >&4
4377         echo "(I can't compile the test program.  Guessing...)" >&4
4378         rp="What is the size of your file positions (in bytes)?"
4379         . ./myread
4380         fpossize="$ans"
4381 fi
4382
4383
4384
4385 # Backward compatibility (uselfs is deprecated).
4386 case "$uselfs" in
4387 "$define"|true|[yY]*)
4388         cat <<EOM >&4
4389
4390 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4391 EOM
4392         uselargefiles="$define"
4393         ;;
4394 esac                          
4395
4396 case "$lseeksize:$fpossize" in
4397 8:8) cat <<EOM
4398
4399 You can have files larger than 2 gigabytes.
4400 EOM
4401    val="$define" ;;
4402 *)    case "$uselargefiles" in
4403    "$undef"|false|[nN]*) dflt='n' ;;
4404    *)   dflt='y' ;;
4405    esac
4406    cat <<EOM
4407
4408 Perl can be built to understand large files (files larger than 2 gigabytes)
4409 on some systems.  To do so, Configure can be run with -Duselargefiles.
4410
4411 If this doesn't make any sense to you, just accept the default '$dflt'.
4412 EOM
4413    rp='Try to understand large files, if available?'
4414    . ./myread
4415    case "$ans" in
4416    y|Y)         val="$define" ;;
4417    *)           val="$undef"  ;;
4418    esac
4419    ;;
4420 esac
4421 set uselargefiles
4422 eval $setvar
4423 case "$uselargefiles" in
4424 "$define")
4425 : Look for a hint-file generated 'call-back-unit'.  If the
4426 : user has specified that a large files perl is to be built,
4427 : we may need to set or change some other defaults.
4428         if $test -f uselargefiles.cbu; then
4429                 echo "Your platform has some specific hints for large file builds, using them..."
4430                 . ./uselargefiles.cbu
4431                 echo " "
4432                 echo "Rechecking to see how big your file offsets are..." >&4
4433                 $cat >try.c <<EOCP
4434 #include <sys/types.h>
4435 #include <stdio.h>
4436 int main()
4437 {
4438     printf("%d\n", (int)sizeof($lseektype));
4439     return(0); 
4440 }
4441 EOCP
4442                 set try
4443                 if eval $compile_ok; then
4444                         lseeksize=`./try`
4445                         $echo "Your file offsets are now $lseeksize bytes long."
4446                 else
4447                         dflt="$lseeksize"
4448                         echo " "
4449                         echo "(I can't seem to compile the test program.  Guessing...)"
4450                         rp="What is the size of your file offsets (in bytes)?"
4451                         . ./myread
4452                         lseeksize="$ans"
4453                 fi
4454                 case "$fpostype" in
4455                 *_t) zzz="$fpostype"    ;;
4456                 *)   zzz="fpos_t"       ;;
4457                 esac
4458                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4459                 $cat > try.c <<EOCP
4460 #include <sys/types.h>
4461 #include <stdio.h>
4462 int main() {
4463     printf("%d\n", (int)sizeof($fpostype));
4464     exit(0);
4465 }
4466 EOCP
4467                 set try
4468                 if eval $compile_ok; then
4469                         yyy=`./try`
4470                         dflt="$lseeksize"
4471                         case "$yyy" in
4472                         '')     echo " "
4473                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4474                                 ;;
4475                         *)      fpossize=$yyy
4476                                 echo " $fpossize bytes." >&4
4477                                 ;;
4478                         esac
4479                 else
4480                         dflt="$fpossize"
4481                         echo " "
4482                         echo "(I can't compile the test program.  Guessing...)" >&4
4483                         rp="What is the size of your file positions (in bytes)?"
4484                         . ./myread
4485                         fpossize="$ans"
4486                 fi
4487                 $rm -f try.c try
4488         fi
4489         ;;
4490 esac
4491
4492
4493 case "$usemorebits" in
4494 "$define"|true|[yY]*)
4495         use64bitint="$define"
4496         uselongdouble="$define"
4497         usemorebits="$define"
4498         ;;
4499 *)      usemorebits="$undef"
4500         ;;
4501 esac
4502
4503
4504 case "$uselonglong" in
4505 "$define"|true|[yY]*)
4506         cat <<EOM >&4
4507
4508 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4509 EOM
4510         use64bitint="$define"
4511         ;;
4512 esac                          
4513 case "$use64bits" in
4514 "$define"|true|[yY]*)
4515         cat <<EOM >&4
4516
4517 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4518 EOM
4519         use64bitint="$define"
4520         ;;
4521 esac                          
4522 case "$use64bitints" in
4523 "$define"|true|[yY]*)
4524         cat <<EOM >&4
4525
4526 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4527 EOM
4528         use64bitint="$define"
4529         ;;
4530 esac                          
4531 case "$use64bitsint" in
4532 "$define"|true|[yY]*)
4533         cat <<EOM >&4
4534
4535 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4536 EOM
4537         use64bitint="$define"
4538         ;;
4539 esac                          
4540 case "$uselonglongs" in
4541 "$define"|true|[yY]*)
4542         cat <<EOM >&4
4543
4544 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4545 EOM
4546         use64bitint="$define"
4547         ;;
4548 esac                          
4549 case "$use64bitsall" in
4550 "$define"|true|[yY]*)
4551         cat <<EOM >&4
4552
4553 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4554 EOM
4555         use64bitall="$define"
4556         ;;
4557 esac                          
4558
4559 case "$ccflags" in
4560 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4561 esac
4562 case "$use64bitall" in
4563 "$define"|true|[yY]*) use64bitint="$define" ;;
4564 esac
4565
4566 case "$longsize" in
4567 8) cat <<EOM
4568
4569 You have natively 64-bit long integers.
4570 EOM
4571    val="$define"
4572    ;;
4573 *) case "$use64bitint" in
4574    "$define"|true|[yY]*) dflt='y';;
4575    *) dflt='n';;
4576    esac
4577    cat <<EOM
4578
4579 Perl can be built to take advantage of 64-bit integer types
4580 on some systems.  To do so, Configure can be run with -Duse64bitint.
4581 Choosing this option will most probably introduce binary incompatibilities.
4582
4583 If this doesn't make any sense to you, just accept the default '$dflt'.
4584 EOM
4585    rp='Try to use 64-bit integers, if available?'
4586    . ./myread
4587    case "$ans" in
4588    [yY]*) val="$define" ;;
4589    *)     val="$undef"  ;;
4590    esac
4591    ;;
4592 esac
4593 set use64bitint
4594 eval $setvar
4595
4596 case "$use64bitall" in
4597 "$define"|true|[yY]*) dflt='y' ;;
4598 *) case "$longsize" in
4599    8) dflt='y' ;;
4600    *) dflt='n' ;;
4601    esac
4602    ;;
4603 esac    
4604 cat <<EOM
4605
4606 You may also choose to try maximal 64-bitness.  It means using as much
4607 64-bitness as possible on the platform.  This in turn means even more
4608 binary incompatibilities.  On the other hand, your platform may not
4609 have any more 64-bitness available than what you already have chosen.
4610
4611 If this doesn't make any sense to you, just accept the default '$dflt'.
4612 EOM
4613 rp='Try to use maximal 64-bit support, if available?'
4614 . ./myread
4615 case "$ans" in
4616 [yY]*) val="$define" ;;
4617 *)     val="$undef"  ;;
4618 esac
4619 set use64bitall
4620 eval $setvar
4621 case "$use64bitall" in
4622 "$define")
4623         case "$use64bitint" in
4624         "$undef")
4625                 cat <<EOM
4626
4627 Since you have chosen a maximally 64-bit build, I'm also turning on
4628 the use of 64-bit integers.
4629 EOM
4630                 use64bitint="$define" ;;
4631         esac
4632         ;;
4633 esac
4634
4635 case "$use64bitint" in
4636 "$define"|true|[yY]*)
4637 : Look for a hint-file generated 'call-back-unit'.  If the
4638 : user has specified that a 64-bit perl is to be built,
4639 : we may need to set or change some other defaults.
4640         if $test -f use64bitint.cbu; then
4641                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4642                 . ./use64bitint.cbu
4643         fi
4644         case "$longsize" in
4645         4) case "$archname64" in
4646            '') archname64=64int ;;
4647            esac
4648            ;;
4649         esac
4650         ;;
4651 esac
4652
4653 case "$use64bitall" in
4654 "$define"|true|[yY]*)
4655 : Look for a hint-file generated 'call-back-unit'.  If the
4656 : user has specified that a maximally 64-bit perl is to be built,
4657 : we may need to set or change some other defaults.
4658         if $test -f use64bitall.cbu; then
4659                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4660                 . ./use64bitall.cbu
4661         fi
4662         case "$longsize" in
4663         4) case "$archname64" in
4664            ''|64int) archname64=64all ;;
4665            esac
4666            ;;
4667         esac
4668         ;;
4669 esac
4670
4671 echo " "
4672 echo "Checking for GNU C Library..." >&4
4673 cat >gnulibc.c <<EOM
4674 #include <stdio.h>
4675 int main()
4676 {
4677 #ifdef __GLIBC__
4678     exit(0);
4679 #else
4680     exit(1);
4681 #endif
4682 }
4683 EOM
4684 set gnulibc
4685 if eval $compile_ok && ./gnulibc; then
4686         val="$define"
4687         echo "You are using the GNU C Library"
4688 else
4689         val="$undef"
4690         echo "You are not using the GNU C Library"
4691 fi
4692 $rm -f gnulibc*
4693 set d_gnulibc
4694 eval $setvar
4695
4696 : see if nm is to be used to determine whether a symbol is defined or not
4697 case "$usenm" in
4698 '')
4699         dflt=''
4700         case "$d_gnulibc" in
4701         "$define")
4702                 echo " "
4703                 echo "nm probably won't work on the GNU C Library." >&4
4704                 dflt=n
4705                 ;;
4706         esac
4707         case "$dflt" in
4708         '') 
4709                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4710                         echo " "
4711                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4712                         echo "'nm' won't be sufficient on this sytem." >&4
4713                         dflt=n
4714                 fi
4715                 ;;
4716         esac
4717         case "$dflt" in
4718         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4719                 if $test $dflt -gt 20; then
4720                         dflt=y
4721                 else
4722                         dflt=n
4723                 fi
4724                 ;;
4725         esac
4726         ;;
4727 *)
4728         case "$usenm" in
4729         true|$define) dflt=y;;
4730         *) dflt=n;;
4731         esac
4732         ;;
4733 esac
4734 $cat <<EOM
4735
4736 I can use $nm to extract the symbols from your C libraries. This
4737 is a time consuming task which may generate huge output on the disk (up
4738 to 3 megabytes) but that should make the symbols extraction faster. The
4739 alternative is to skip the 'nm' extraction part and to compile a small
4740 test program instead to determine whether each symbol is present. If
4741 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4742 this may be the best solution.
4743
4744 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4745
4746 EOM
4747 rp="Shall I use $nm to extract C symbols from the libraries?"
4748 . ./myread
4749 case "$ans" in
4750 [Nn]*) usenm=false;;
4751 *) usenm=true;;
4752 esac
4753
4754 runnm=$usenm
4755 case "$reuseval" in
4756 true) runnm=false;;
4757 esac
4758
4759 : nm options which may be necessary
4760 case "$nm_opt" in
4761 '') if $test -f /mach_boot; then
4762                 nm_opt=''       # Mach
4763         elif $test -d /usr/ccs/lib; then
4764                 nm_opt='-p'     # Solaris (and SunOS?)
4765         elif $test -f /dgux; then
4766                 nm_opt='-p'     # DG-UX
4767         elif $test -f /lib64/rld; then
4768                 nm_opt='-p'     # 64-bit Irix
4769         else
4770                 nm_opt=''
4771         fi;;
4772 esac
4773
4774 : nm options which may be necessary for shared libraries but illegal
4775 : for archive libraries.  Thank you, Linux.
4776 case "$nm_so_opt" in
4777 '')     case "$myuname" in
4778         *linux*)
4779                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4780                         nm_so_opt='--dynamic'
4781                 fi
4782                 ;;
4783         esac
4784         ;;
4785 esac
4786
4787 case "$runnm" in
4788 true)
4789 : get list of predefined functions in a handy place
4790 echo " "
4791 case "$libc" in
4792 '') libc=unknown
4793         case "$libs" in
4794         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4795         esac
4796         ;;
4797 esac
4798 libnames='';
4799 case "$libs" in
4800 '') ;;
4801 *)  for thislib in $libs; do
4802         case "$thislib" in
4803         -lc|-lc_s)
4804                 : Handle C library specially below.
4805                 ;;
4806         -l*)
4807                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4808                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4809                         :
4810                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4811                         :
4812                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4813                         :
4814                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4815                         :
4816                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4817                         :
4818                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4819                         :
4820                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4821                         :
4822                 else
4823                         try=''
4824                 fi
4825                 libnames="$libnames $try"
4826                 ;;
4827         *) libnames="$libnames $thislib" ;;
4828         esac
4829         done
4830         ;;
4831 esac
4832 xxx=normal
4833 case "$libc" in
4834 unknown)
4835         set /lib/libc.$so
4836         for xxx in $libpth; do
4837                 $test -r $1 || set $xxx/libc.$so
4838                 : The messy sed command sorts on library version numbers.
4839                 $test -r $1 || \
4840                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4841                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4842                                 h
4843                                 s/[0-9][0-9]*/0000&/g
4844                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4845                                 G
4846                                 s/\n/ /' | \
4847                          $sort | $sed -e 's/^.* //'`
4848                 eval set \$$#
4849         done
4850         $test -r $1 || set /usr/ccs/lib/libc.$so
4851         $test -r $1 || set /lib/libsys_s$_a
4852         ;;
4853 *)
4854         set blurfl
4855         ;;
4856 esac
4857 if $test -r "$1"; then
4858         echo "Your (shared) C library seems to be in $1."
4859         libc="$1"
4860 elif $test -r /lib/libc && $test -r /lib/clib; then
4861         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4862         xxx=apollo
4863         libc='/lib/clib /lib/libc'
4864         if $test -r /lib/syslib; then
4865                 echo "(Your math library is in /lib/syslib.)"
4866                 libc="$libc /lib/syslib"
4867         fi
4868 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4869         echo "Your C library seems to be in $libc, as you said before."
4870 elif $test -r $incpath/usr/lib/libc$_a; then
4871         libc=$incpath/usr/lib/libc$_a;
4872         echo "Your C library seems to be in $libc.  That's fine."
4873 elif $test -r /lib/libc$_a; then
4874         libc=/lib/libc$_a;
4875         echo "Your C library seems to be in $libc.  You're normal."
4876 else
4877         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4878                 :
4879         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4880                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4881         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4882                 :
4883         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4884                 :
4885         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4886                 :
4887         else
4888                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4889         fi
4890         if $test -r "$tans"; then
4891                 echo "Your C library seems to be in $tans, of all places."
4892                 libc=$tans
4893         else
4894                 libc='blurfl'
4895         fi
4896 fi
4897 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4898         dflt="$libc"
4899         cat <<EOM
4900
4901 If the guess above is wrong (which it might be if you're using a strange
4902 compiler, or your machine supports multiple models), you can override it here.
4903
4904 EOM
4905 else
4906         dflt=''
4907         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4908         cat >&4 <<EOM
4909 I can't seem to find your C library.  I've looked in the following places:
4910
4911 EOM
4912         $sed 's/^/      /' libpath
4913         cat <<EOM
4914
4915 None of these seems to contain your C library. I need to get its name...
4916
4917 EOM
4918 fi
4919 fn=f
4920 rp='Where is your C library?'
4921 . ./getfile
4922 libc="$ans"
4923
4924 echo " "
4925 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4926 set X `cat libnames`
4927 shift
4928 xxx=files
4929 case $# in 1) xxx=file; esac
4930 echo "Extracting names from the following $xxx for later perusal:" >&4
4931 echo " "
4932 $sed 's/^/      /' libnames >&4
4933 echo " "
4934 $echo $n "This may take a while...$c" >&4
4935
4936 for file in $*; do
4937         case $file in
4938         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4939         *) $nm $nm_opt $file 2>/dev/null;;
4940         esac
4941 done >libc.tmp
4942
4943 $echo $n ".$c"
4944 $grep fprintf libc.tmp > libc.ptf
4945 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4946 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4947 xxx='[ADTSIW]'
4948 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4949         eval $xscan;\
4950         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4951                 eval $xrun
4952 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4953         eval $xscan;\
4954         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4955                 eval $xrun
4956 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4957         eval $xscan;\
4958         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4959                 eval $xrun
4960 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4961         eval $xscan;\
4962         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4963                 eval $xrun
4964 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4965         eval $xscan;\
4966         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4967                 eval $xrun
4968 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4969         eval $xscan;\
4970         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4971                 eval $xrun
4972 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4973                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4974         eval $xscan;\
4975         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4976                 eval $xrun
4977 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4978         eval $xscan;\
4979         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4980                 eval $xrun
4981 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4982         eval $xscan;\
4983         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4984                 eval $xrun
4985 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4986         eval $xscan;\
4987         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4988                 eval $xrun
4989 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4990         eval $xscan;\
4991         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4992                 eval $xrun
4993 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4994         eval $xscan;\
4995         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4996                 eval $xrun
4997 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4998         eval $xscan;\
4999         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5000                 eval $xrun
5001 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5002         eval $xscan;\
5003         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5004                 eval $xrun
5005 else
5006         $nm -p $* 2>/dev/null >libc.tmp
5007         $grep fprintf libc.tmp > libc.ptf
5008         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5009                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5010         then
5011                 nm_opt='-p'
5012                 eval $xrun
5013         else
5014                 echo " "
5015                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5016                 com=''
5017                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5018                         for thisname in $libnames $libc; do
5019                                 $ar t $thisname >>libc.tmp
5020                         done
5021                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5022                         echo "Ok." >&4
5023                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5024                         # Repeat libc to extract forwarders to DLL entries too
5025                         for thisname in $libnames $libc; do
5026                                 $ar tv $thisname >>libc.tmp
5027                                 # Revision 50 of EMX has bug in $ar.
5028                                 # it will not extract forwarders to DLL entries
5029                                 # Use emximp which will extract exactly them.
5030                                 emximp -o tmp.imp $thisname \
5031                                     2>/dev/null && \
5032                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5033                                     < tmp.imp >>libc.tmp
5034                                 $rm tmp.imp
5035                         done
5036                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5037                         echo "Ok." >&4
5038                 else
5039                         echo "$ar didn't seem to work right." >&4
5040                         echo "Maybe this is a Cray...trying bld instead..." >&4
5041                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5042                         then
5043                                 for thisname in $libnames; do
5044                                         bld t $libnames | \
5045                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5046                                         $ar t $thisname >>libc.tmp
5047                                 done
5048                                 echo "Ok." >&4
5049                         else
5050                                 echo "That didn't work either.  Giving up." >&4
5051                                 exit 1
5052                         fi
5053                 fi
5054         fi
5055 fi
5056 nm_extract="$com"
5057 if $test -f /lib/syscalls.exp; then
5058         echo " "
5059         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5060         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5061 fi
5062 ;;
5063 esac
5064 $rm -f libnames libpath
5065
5066 : is a C symbol defined?
5067 csym='tlook=$1;
5068 case "$3" in
5069 -v) tf=libc.tmp; tc=""; tdc="";;
5070 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5071 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5072 esac;
5073 tx=yes;
5074 case "$reuseval-$4" in
5075 true-) ;;
5076 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5077 esac;
5078 case "$tx" in
5079 yes)
5080         case "$runnm" in
5081         true)
5082                 if $contains $tlook $tf >/dev/null 2>&1;
5083                 then tval=true;
5084                 else tval=false;
5085                 fi;;
5086         *)
5087                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5088                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5089                 then tval=true;
5090                 else tval=false;
5091                 fi;
5092                 $rm -f t t.c;;
5093         esac;;
5094 *)
5095         case "$tval" in
5096         $define) tval=true;;
5097         *) tval=false;;
5098         esac;;
5099 esac;
5100 eval "$2=$tval"'
5101
5102 : define an is-in-libc? function
5103 inlibc='echo " "; td=$define; tu=$undef;
5104 sym=$1; var=$2; eval "was=\$$2";
5105 tx=yes;
5106 case "$reuseval$was" in
5107 true) ;;
5108 true*) tx=no;;
5109 esac;
5110 case "$tx" in
5111 yes)
5112         set $sym tres -f;
5113         eval $csym;
5114         case "$tres" in
5115         true)
5116                 echo "$sym() found." >&4;
5117                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5118         *)
5119                 echo "$sym() NOT found." >&4;
5120                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5121         esac;;
5122 *)
5123         case "$was" in
5124         $define) echo "$sym() found." >&4;;
5125         *) echo "$sym() NOT found." >&4;;
5126         esac;;
5127 esac'
5128
5129 : see if sqrtl exists
5130 set sqrtl d_sqrtl
5131 eval $inlibc
5132
5133 case "$ccflags" in
5134 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5135 esac
5136
5137 case "$uselongdouble" in
5138 $define|true|[yY]*)     dflt='y';;
5139 *) dflt='n';;
5140 esac
5141 cat <<EOM
5142
5143 Perl can be built to take advantage of long doubles which
5144 (if available) may give more accuracy and range for floating point numbers.
5145
5146 If this doesn't make any sense to you, just accept the default '$dflt'.
5147 EOM
5148 rp='Try to use long doubles if available?'
5149 . ./myread
5150 case "$ans" in
5151 y|Y)    val="$define"   ;;
5152 *)      val="$undef"    ;;
5153 esac
5154 set uselongdouble
5155 eval $setvar
5156
5157 case "$uselongdouble" in
5158 true|[yY]*) uselongdouble="$define" ;;
5159 esac
5160
5161 case "$uselongdouble" in
5162 $define)
5163 : Look for a hint-file generated 'call-back-unit'.  If the
5164 : user has specified that long doubles should be used,
5165 : we may need to set or change some other defaults.
5166         if $test -f uselongdouble.cbu; then
5167                 echo "Your platform has some specific hints for long doubles, using them..."
5168                 . ./uselongdouble.cbu
5169         else
5170                 $cat <<EOM
5171 (Your platform doesn't have any specific hints for long doubles.)
5172 EOM
5173         fi
5174         ;;
5175 esac
5176
5177 case "$uselongdouble:$d_sqrtl" in
5178 $define:$undef)
5179                 $cat <<EOM >&4
5180
5181 *** You requested the use of long doubles but you do not seem to have
5182 *** the mathematic functions for long doubles.  I'm disabling the use
5183 *** of long doubles.
5184
5185 EOM
5186         uselongdouble=$undef
5187         ;;
5188 esac
5189
5190 : check for length of double
5191 echo " "
5192 case "$doublesize" in
5193 '')
5194         echo "Checking to see how big your double precision numbers are..." >&4
5195         $cat >try.c <<'EOCP'
5196 #include <stdio.h>
5197 int main()
5198 {
5199     printf("%d\n", (int)sizeof(double));
5200     exit(0);
5201 }
5202 EOCP
5203         set try
5204         if eval $compile_ok; then
5205                 doublesize=`./try`
5206                 echo "Your double is $doublesize bytes long."
5207         else
5208                 dflt='8'
5209                 echo "(I can't seem to compile the test program.  Guessing...)"
5210                 rp="What is the size of a double precision number (in bytes)?"
5211                 . ./myread
5212                 doublesize="$ans"
5213         fi
5214         ;;
5215 esac
5216 $rm -f try.c try
5217
5218 : check for long doubles
5219 echo " "
5220 echo "Checking to see if you have long double..." >&4
5221 echo 'int main() { long double x = 7.0; }' > try.c
5222 set try
5223 if eval $compile; then
5224         val="$define"
5225         echo "You have long double."
5226 else
5227         val="$undef"
5228         echo "You do not have long double."
5229 fi
5230 $rm try.*
5231 set d_longdbl
5232 eval $setvar
5233
5234 : check for length of long double
5235 case "${d_longdbl}${longdblsize}" in
5236 $define)
5237         echo " "
5238         echo "Checking to see how big your long doubles are..." >&4
5239         $cat >try.c <<'EOCP'
5240 #include <stdio.h>
5241 int main()
5242 {
5243         printf("%d\n", sizeof(long double));
5244 }
5245 EOCP
5246         set try
5247         set try
5248         if eval $compile; then
5249                 longdblsize=`./try$exe_ext`
5250                 echo "Your long doubles are $longdblsize bytes long."
5251         else
5252                 dflt='8'
5253                 echo " "
5254                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5255                 rp="What is the size of a long double (in bytes)?"
5256                 . ./myread
5257                 longdblsize="$ans"
5258         fi
5259         if $test "X$doublesize" = "X$longdblsize"; then
5260                 echo "(That isn't any different from an ordinary double.)"
5261         fi      
5262         ;;
5263 esac
5264 $rm -f try.* try
5265
5266 : determine the architecture name
5267 echo " "
5268 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5269         tarch=`arch`"-$osname"
5270 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5271         if uname -m > tmparch 2>&1 ; then
5272                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5273                         -e 's/$/'"-$osname/" tmparch`
5274         else
5275                 tarch="$osname"
5276         fi
5277         $rm -f tmparch
5278 else
5279         tarch="$osname"
5280 fi
5281 case "$myarchname" in
5282 ''|"$tarch") ;;
5283 *)
5284         echo "(Your architecture name used to be $myarchname.)"
5285         archname=''
5286         ;;
5287 esac
5288 myarchname="$tarch"
5289 case "$archname" in
5290 '') dflt="$tarch";;
5291 *) dflt="$archname";;
5292 esac
5293 rp='What is your architecture name'
5294 . ./myread
5295 archname="$ans"
5296 case "$usethreads" in
5297 $define)
5298         echo "Threads selected." >&4
5299         case "$archname" in
5300         *-thread*) echo "...and architecture name already has -thread." >&4
5301                 ;;
5302         *)      archname="$archname-thread"
5303                 echo "...setting architecture name to $archname." >&4
5304                 ;;
5305         esac
5306         ;;
5307 esac
5308 case "$usemultiplicity" in
5309 $define)
5310         echo "Multiplicity selected." >&4
5311         case "$archname" in
5312         *-multi*) echo "...and architecture name already has -multi." >&4
5313                 ;;
5314         *)      archname="$archname-multi"
5315                 echo "...setting architecture name to $archname." >&4
5316                 ;;
5317         esac
5318         ;;
5319 esac
5320 case "$use64bitint$use64bitall" in
5321 *"$define"*)
5322         case "$archname64" in
5323         '')
5324                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5325                 ;;
5326         *)
5327                 case "$use64bitint" in
5328                 "$define") echo "64 bit integers selected." >&4 ;;
5329                 esac
5330                 case "$use64bitall" in
5331                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5332                 esac
5333                 case "$archname" in
5334                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5335                         ;;
5336                 *)      archname="$archname-$archname64"
5337                         echo "...setting architecture name to $archname." >&4
5338                         ;;
5339                 esac
5340                 ;;
5341         esac
5342 esac
5343 case "$uselongdouble" in
5344 $define)
5345         echo "Long doubles selected." >&4
5346         case "$longdblsize" in
5347         $doublesize)
5348                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5349                 ;;
5350         *)
5351                 case "$archname" in
5352                 *-ld*) echo "...and architecture name already has -ld." >&4
5353                         ;;
5354                 *)      archname="$archname-ld"
5355                         echo "...setting architecture name to $archname." >&4
5356                         ;;
5357                 esac
5358                 ;;
5359         esac
5360         ;;
5361 esac
5362
5363 : determine root of directory hierarchy where package will be installed.
5364 case "$prefix" in
5365 '')
5366         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5367         ;;
5368 *)
5369         dflt="$prefix"
5370         ;;
5371 esac
5372 $cat <<EOM
5373
5374 By default, $package will be installed in $dflt/bin, manual pages
5375 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5376 installation directories. Typically this is something like /usr/local.
5377 If you wish to have binaries under /usr/bin but other parts of the
5378 installation under /usr/local, that's ok: you will be prompted
5379 separately for each of the installation directories, the prefix being
5380 only used to set the defaults.
5381
5382 EOM
5383 fn=d~
5384 rp='Installation prefix to use?'
5385 . ./getfile
5386 oldprefix=''
5387 case "$prefix" in
5388 '') ;;
5389 *)
5390         case "$ans" in
5391         "$prefix") ;;
5392         *) oldprefix="$prefix";;
5393         esac
5394         ;;
5395 esac
5396 prefix="$ans"
5397 prefixexp="$ansexp"
5398
5399 : is AFS running?
5400 echo " "
5401 case "$afs" in
5402 $define|true)   afs=true ;;
5403 $undef|false)   afs=false ;;
5404 *)      if test -d /afs; then
5405                 afs=true
5406         else
5407                 afs=false
5408         fi
5409         ;;
5410 esac
5411 if $afs; then
5412         echo "AFS may be running... I'll be extra cautious then..." >&4
5413 else
5414         echo "AFS does not seem to be running..." >&4
5415 fi
5416
5417 : determine installation prefix for where package is to be installed.
5418 if $afs; then 
5419 $cat <<EOM
5420
5421 Since you are running AFS, I need to distinguish the directory in which
5422 files will reside from the directory in which they are installed (and from
5423 which they are presumably copied to the former directory by occult means).
5424
5425 EOM
5426         case "$installprefix" in
5427         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5428         *) dflt="$installprefix";;
5429         esac
5430 else
5431 $cat <<EOM
5432
5433 In some special cases, particularly when building $package for distribution,
5434 it is convenient to distinguish between the directory in which files should 
5435 be installed from the directory ($prefix) in which they 
5436 will eventually reside.  For most users, these two directories are the same.
5437
5438 EOM
5439         case "$installprefix" in
5440         '') dflt=$prefix ;;
5441         *) dflt=$installprefix;;
5442         esac
5443 fi
5444 fn=d~
5445 rp='What installation prefix should I use for installing files?'
5446 . ./getfile
5447 installprefix="$ans"
5448 installprefixexp="$ansexp"
5449
5450 : set the prefixit variable, to compute a suitable default value
5451 prefixit='case "$3" in
5452 ""|none)
5453         case "$oldprefix" in
5454         "") eval "$1=\"\$$2\"";;
5455         *)
5456                 case "$3" in
5457                 "") eval "$1=";;
5458                 none)
5459                         eval "tp=\"\$$2\"";
5460                         case "$tp" in
5461                         ""|" ") eval "$1=\"\$$2\"";;
5462                         *) eval "$1=";;
5463                         esac;;
5464                 esac;;
5465         esac;;
5466 *)
5467         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5468         case "$tp" in
5469         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5470         /*-$oldprefix/*|\~*-$oldprefix/*)
5471                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5472         *) eval "$1=\"\$$2\"";;
5473         esac;;
5474 esac'
5475
5476
5477 : get the patchlevel
5478 echo " "
5479 echo "Getting the current patchlevel..." >&4
5480 if $test -r $rsrc/patchlevel.h;then
5481         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5482         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5483         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5484         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5485         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5486         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5487 else
5488         revision=0
5489         patchlevel=0
5490         subversion=0
5491         api_revision=0
5492         api_version=0
5493         api_subversion=0
5494 fi
5495 $echo "(You have $package version $patchlevel subversion $subversion.)"
5496 case "$osname" in
5497 dos|vms)
5498         : XXX Should be a Configure test for double-dots in filenames.
5499         version=`echo $revision $patchlevel $subversion | \
5500                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5501         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5502                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5503         ;;
5504 *)
5505         version=`echo $revision $patchlevel $subversion | \
5506                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5507         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5508                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5509         ;;
5510 esac
5511 : Special case the 5.005_xx maintenance series, which used 5.005
5512 : without any subversion label as a subdirectory in $sitelib
5513 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5514         api_versionstring='5.005'
5515 fi
5516
5517 : determine installation style
5518 : For now, try to deduce it from prefix unless it is already set.
5519 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5520 case "$installstyle" in
5521 '')     case "$prefix" in
5522                 *perl*) dflt='lib';;
5523                 *) dflt='lib/perl5' ;;
5524         esac
5525         ;;
5526 *)      dflt="$installstyle" ;;
5527 esac
5528 : Probably not worth prompting for this since we prompt for all
5529 : the directories individually, and the prompt would be too long and
5530 : confusing anyway.
5531 installstyle=$dflt
5532
5533 : determine where private library files go
5534 : Usual default is /usr/local/lib/perl5/$version.
5535 : Also allow things like /opt/perl/lib/$version, since 
5536 : /opt/perl/lib/perl5... would be redundant.
5537 : The default "style" setting is made in installstyle.U
5538 case "$installstyle" in
5539 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5540 *)       set dflt privlib lib/$version ;;
5541 esac
5542 eval $prefixit
5543 $cat <<EOM
5544
5545 There are some auxiliary files for $package that need to be put into a
5546 private library directory that is accessible by everyone.
5547
5548 EOM
5549 fn=d~+
5550 rp='Pathname where the private library files will reside?'
5551 . ./getfile
5552 privlib="$ans"
5553 privlibexp="$ansexp"
5554 : Change installation prefix, if necessary.
5555 if $test X"$prefix" != X"$installprefix"; then
5556         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5557 else
5558         installprivlib="$privlibexp"
5559 fi
5560
5561 : set the prefixup variable, to restore leading tilda escape
5562 prefixup='case "$prefixexp" in
5563 "$prefix") ;;
5564 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5565 esac'
5566
5567 : determine where public architecture dependent libraries go
5568 set archlib archlib
5569 eval $prefixit
5570 : privlib default is /usr/local/lib/$package/$version
5571 : archlib default is /usr/local/lib/$package/$version/$archname
5572 : privlib may have an optional trailing /share.
5573 tdflt=`echo $privlib | $sed 's,/share$,,'`
5574 tdflt=$tdflt/$archname
5575 case "$archlib" in
5576 '')     dflt=$tdflt
5577         ;;
5578 *)      dflt="$archlib"
5579     ;;
5580 esac
5581 $cat <<EOM
5582
5583 $spackage contains architecture-dependent library files.  If you are
5584 sharing libraries in a heterogeneous environment, you might store
5585 these files in a separate location.  Otherwise, you can just include
5586 them with the rest of the public library files.
5587
5588 EOM
5589 fn=d+~
5590 rp='Where do you want to put the public architecture-dependent libraries?'
5591 . ./getfile
5592 archlib="$ans"
5593 archlibexp="$ansexp"
5594 if $test X"$archlib" = X"$privlib"; then
5595         d_archlib="$undef"
5596 else
5597         d_archlib="$define"
5598 fi
5599 : Change installation prefix, if necessary.
5600 if $test X"$prefix" != X"$installprefix"; then
5601         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5602 else
5603         installarchlib="$archlibexp"
5604 fi
5605
5606
5607 : Binary compatibility with 5.005 is not possible for builds
5608 : with advanced features
5609 case "$usethreads$usemultiplicity" in
5610 *define*)
5611         bincompat5005="$undef"
5612         d_bincompat5005="$undef"
5613         ;;
5614 *)      $cat <<EOM
5615
5616 This version of Perl can be compiled for binary compatibility with 5.005.
5617 If you decide to do so, you will be able to continue using most of the
5618 extensions that were compiled for Perl 5.005.
5619
5620 EOM
5621         case "$bincompat5005$d_bincompat5005" in
5622         *"$undef"*) dflt=n ;;
5623         *) dflt=y ;;
5624         esac
5625         rp='Binary compatibility with Perl 5.005?'
5626         . ./myread
5627         case "$ans" in
5628         y*) val="$define" ;;
5629         *)  val="$undef" ;;
5630         esac
5631         set d_bincompat5005
5632         eval $setvar
5633         case "$d_bincompat5005" in
5634         "$define")
5635                 bincompat5005="$define"
5636                 ;;
5637         *)      bincompat5005="$undef"
5638                 d_bincompat5005="$undef"
5639                 ;;
5640         esac
5641         ;;
5642 esac
5643
5644
5645 : see if setuid scripts can be secure
5646 $cat <<EOM
5647
5648 Some kernels have a bug that prevents setuid #! scripts from being
5649 secure.  Some sites have disabled setuid #! scripts because of this.
5650
5651 First let's decide if your kernel supports secure setuid #! scripts.
5652 (If setuid #! scripts would be secure but have been disabled anyway,
5653 don't say that they are secure if asked.)
5654
5655 EOM
5656
5657 val="$undef"
5658 if $test -d /dev/fd; then
5659         echo "#!$ls" >reflect
5660         chmod +x,u+s reflect
5661         ./reflect >flect 2>&1
5662         if $contains "/dev/fd" flect >/dev/null; then
5663                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5664                 val="$define"
5665         else
5666                 $cat <<EOM
5667 If you are not sure if they are secure, I can check but I'll need a
5668 username and password different from the one you are using right now.
5669 If you don't have such a username or don't want me to test, simply
5670 enter 'none'.
5671
5672 EOM
5673                 rp='Other username to test security of setuid scripts with?'
5674                 dflt='none'
5675                 . ./myread
5676                 case "$ans" in
5677                 n|none)
5678                         case "$d_suidsafe" in
5679                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5680                                 dflt=n;;
5681                         "$undef")
5682                                 echo "Well, the $hint value is *not* secure." >&4
5683                                 dflt=n;;
5684                         *)      echo "Well, the $hint value *is* secure." >&4
5685                                 dflt=y;;
5686                         esac
5687                         ;;
5688                 *)
5689                         $rm -f reflect flect
5690                         echo "#!$ls" >reflect
5691                         chmod +x,u+s reflect
5692                         echo >flect
5693                         chmod a+w flect
5694                         echo '"su" will (probably) prompt you for '"$ans's password."
5695                         su $ans -c './reflect >flect'
5696                         if $contains "/dev/fd" flect >/dev/null; then
5697                                 echo "Okay, it looks like setuid scripts are secure." >&4
5698                                 dflt=y
5699                         else
5700                                 echo "I don't think setuid scripts are secure." >&4
5701                                 dflt=n
5702                         fi
5703                         ;;
5704                 esac
5705                 rp='Does your kernel have *secure* setuid scripts?'
5706                 . ./myread
5707                 case "$ans" in
5708                 [yY]*)  val="$define";;
5709                 *)      val="$undef";;
5710                 esac
5711         fi
5712 else
5713         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5714         echo "(That's for file descriptors, not floppy disks.)"
5715         val="$undef"
5716 fi
5717 set d_suidsafe
5718 eval $setvar
5719
5720 $rm -f reflect flect
5721
5722 : now see if they want to do setuid emulation
5723 echo " "
5724 val="$undef"
5725 case "$d_suidsafe" in
5726 "$define")
5727         val="$undef"
5728         echo "No need to emulate SUID scripts since they are secure here." >& 4
5729         ;;
5730 *)
5731         $cat <<EOM
5732 Some systems have disabled setuid scripts, especially systems where
5733 setuid scripts cannot be secure.  On systems where setuid scripts have
5734 been disabled, the setuid/setgid bits on scripts are currently
5735 useless.  It is possible for $package to detect those bits and emulate
5736 setuid/setgid in a secure fashion.  This emulation will only work if
5737 setuid scripts have been disabled in your kernel.
5738
5739 EOM
5740         case "$d_dosuid" in
5741         "$define") dflt=y ;;
5742         *) dflt=n ;;
5743         esac
5744         rp="Do you want to do setuid/setgid emulation?"
5745         . ./myread
5746         case "$ans" in
5747         [yY]*)  val="$define";;
5748         *)      val="$undef";;
5749         esac
5750         ;;
5751 esac
5752 set d_dosuid
5753 eval $setvar
5754
5755 : determine filename position in cpp output
5756 echo " "
5757 echo "Computing filename position in cpp output for #include directives..." >&4
5758 echo '#include <stdio.h>' > foo.c
5759 $cat >fieldn <<EOF
5760 $startsh
5761 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5762 $grep '^[       ]*#.*stdio\.h' | \
5763 while read cline; do
5764         pos=1
5765         set \$cline
5766         while $test \$# -gt 0; do
5767                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5768                         echo "\$pos"
5769                         exit 0
5770                 fi
5771                 shift
5772                 pos=\`expr \$pos + 1\`
5773         done
5774 done
5775 EOF
5776 chmod +x fieldn
5777 fieldn=`./fieldn`
5778 $rm -f foo.c fieldn
5779 case $fieldn in
5780 '') pos='???';;
5781 1) pos=first;;
5782 2) pos=second;;
5783 3) pos=third;;
5784 *) pos="${fieldn}th";;
5785 esac
5786 echo "Your cpp writes the filename in the $pos field of the line."
5787
5788 : locate header file
5789 $cat >findhdr <<EOF
5790 $startsh
5791 wanted=\$1
5792 name=''
5793 for usrincdir in $usrinc
5794 do
5795         if test -f \$usrincdir/\$wanted; then
5796                 echo "\$usrincdir/\$wanted"
5797                 exit 0
5798         fi
5799 done
5800 awkprg='{ print \$$fieldn }'
5801 echo "#include <\$wanted>" > foo\$\$.c
5802 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5803 $grep "^[       ]*#.*\$wanted" | \
5804 while read cline; do
5805         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5806         case "\$name" in
5807         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5808         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5809         *) exit 2;;
5810         esac;
5811 done;
5812 #
5813 # status = 0: grep returned 0 lines, case statement not executed
5814 # status = 1: headerfile found
5815 # status = 2: while loop executed, no headerfile found
5816 #
5817 status=\$?
5818 $rm -f foo\$\$.c;
5819 if test \$status -eq 1; then
5820         exit 0;
5821 fi
5822 exit 1
5823 EOF
5824 chmod +x findhdr
5825
5826 : define an alternate in-header-list? function
5827 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5828 cont=true; xxf="echo \"<\$1> found.\" >&4";
5829 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5830 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5831 esac;
5832 case $# in 4) instead=instead;; *) instead="at last";; esac;
5833 while $test "$cont"; do
5834         xxx=`./findhdr $1`
5835         var=$2; eval "was=\$$2";
5836         if $test "$xxx" && $test -r "$xxx";
5837         then eval $xxf;
5838         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5839                 cont="";
5840         else eval $xxnf;
5841         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5842         set $yyy; shift; shift; yyy=$@;
5843         case $# in 0) cont="";;
5844         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5845                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5846         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5847                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5848         esac;
5849 done;
5850 while $test "$yyy";
5851 do set $yyy; var=$2; eval "was=\$$2";
5852         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5853         set $yyy; shift; shift; yyy=$@;
5854 done'
5855
5856 : see if this is a malloc.h system
5857 set malloc.h i_malloc
5858 eval $inhdr
5859
5860 : see if stdlib is available
5861 set stdlib.h i_stdlib
5862 eval $inhdr
5863
5864 : determine which malloc to compile in
5865 echo " "
5866 case "$usemymalloc" in
5867 ''|[yY]*|true|$define)  dflt='y' ;;
5868 *)      dflt='n' ;;
5869 esac
5870 rp="Do you wish to attempt to use the malloc that comes with $package?"
5871 . ./myread
5872 usemymalloc="$ans"
5873 case "$ans" in
5874 y*|true)
5875         usemymalloc='y'
5876         mallocsrc='malloc.c'
5877         mallocobj="malloc$_o"
5878         d_mymalloc="$define"
5879         case "$libs" in
5880         *-lmalloc*)
5881                 : Remove malloc from list of libraries to use
5882                 echo "Removing unneeded -lmalloc from library list" >&4
5883                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5884                 shift
5885                 libs="$*"
5886                 echo "libs = $libs" >&4
5887                 ;;
5888         esac
5889         ;;
5890 *)
5891         usemymalloc='n'
5892         mallocsrc=''
5893         mallocobj=''
5894         d_mymalloc="$undef"
5895         ;;
5896 esac
5897
5898 : compute the return types of malloc and free
5899 echo " "
5900 $cat >malloc.c <<END
5901 #$i_malloc I_MALLOC
5902 #$i_stdlib I_STDLIB
5903 #include <stdio.h>
5904 #include <sys/types.h>
5905 #ifdef I_MALLOC
5906 #include <malloc.h>
5907 #endif
5908 #ifdef I_STDLIB
5909 #include <stdlib.h>
5910 #endif
5911 #ifdef TRY_MALLOC
5912 void *malloc();
5913 #endif
5914 #ifdef TRY_FREE
5915 void free();
5916 #endif
5917 END
5918 case "$malloctype" in
5919 '')
5920         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5921                 malloctype='void *'
5922         else
5923                 malloctype='char *'
5924         fi
5925         ;;
5926 esac
5927 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5928
5929 case "$freetype" in
5930 '')
5931         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5932                 freetype='void'
5933         else
5934                 freetype='int'
5935         fi
5936         ;;
5937 esac
5938 echo "Your system uses $freetype free(), it would seem." >&4
5939 $rm -f malloc.[co]
5940 $cat <<EOM
5941
5942 After $package is installed, you may wish to install various
5943 add-on modules and utilities.  Typically, these add-ons will
5944 be installed under $prefix with the rest
5945 of this package.  However, you may wish to install such add-ons
5946 elsewhere under a different prefix.
5947
5948 If you do not wish to put everything under a single prefix, that's
5949 ok.  You will be prompted for the individual locations; this siteprefix
5950 is only used to suggest the defaults.
5951
5952 The default should be fine for most people.
5953
5954 EOM
5955 fn=d~+
5956 rp='Installation prefix to use for add-on modules and utilities?'
5957 : XXX Here might be another good place for an installstyle setting.
5958 case "$siteprefix" in
5959 '') dflt=$prefix ;;
5960 *)  dflt=$siteprefix ;;
5961 esac
5962 . ./getfile
5963 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5964 oldsiteprefix=''
5965 case "$siteprefix" in
5966 '') ;;
5967 *)      case "$ans" in
5968         "$prefix") ;;
5969         *) oldsiteprefix="$prefix";;
5970         esac
5971         ;;
5972 esac
5973 siteprefix="$ans"
5974 siteprefixexp="$ansexp"
5975
5976 : determine where site specific libraries go.
5977 : Usual default is /usr/local/lib/perl5/site_perl/$version
5978 : The default "style" setting is made in installstyle.U
5979 : XXX No longer works with Prefixit stuff.
5980 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5981 case "$sitelib" in
5982 '') case "$installstyle" in
5983         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5984         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5985         esac
5986         ;;
5987 *)      dflt="$sitelib"
5988         ;;
5989 esac
5990 $cat <<EOM
5991
5992 The installation process will create a directory for
5993 site-specific extensions and modules.  Most users find it convenient
5994 to place all site-specific files in this directory rather than in the
5995 main distribution directory.
5996
5997 EOM
5998 fn=d~+
5999 rp='Pathname for the site-specific library files?'
6000 . ./getfile
6001 sitelib="$ans"
6002 sitelibexp="$ansexp"
6003 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6004 : Change installation prefix, if necessary.
6005 if $test X"$prefix" != X"$installprefix"; then
6006         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6007 else
6008         installsitelib="$sitelibexp"
6009 fi
6010
6011 : determine where site specific architecture-dependent libraries go.
6012 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6013 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6014 : sitelib may have an optional trailing /share.
6015 case "$sitearch" in
6016 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6017         dflt="$dflt/$archname"
6018         ;;
6019 *)      dflt="$sitearch"
6020         ;;
6021 esac
6022 set sitearch sitearch none
6023 eval $prefixit
6024 $cat <<EOM
6025
6026 The installation process will also create a directory for
6027 architecture-dependent site-specific extensions and modules.
6028
6029 EOM
6030 fn=d~+
6031 rp='Pathname for the site-specific architecture-dependent library files?'
6032 . ./getfile
6033 sitearch="$ans"
6034 sitearchexp="$ansexp"
6035 : Change installation prefix, if necessary.
6036 if $test X"$prefix" != X"$installprefix"; then
6037         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6038 else
6039         installsitearch="$sitearchexp"
6040 fi
6041
6042 $cat <<EOM
6043
6044 The installation process will also create a directory for
6045 vendor-supplied add-ons.  Vendors who supply perl with their system
6046 may find it convenient to place all vendor-supplied files in this
6047 directory rather than in the main distribution directory.  This will
6048 ease upgrades between binary-compatible maintenance versions of perl.
6049
6050 Of course you may also use these directories in whatever way you see
6051 fit.  For example, you might use them to access modules shared over a
6052 company-wide network.
6053
6054 The default answer should be fine for most people.
6055 This causes further questions about vendor add-ons to be skipped
6056 and no vendor-specific directories will be configured for perl.
6057
6058 EOM
6059 rp='Do you want to configure vendor-specific add-on directories?'
6060 case "$usevendorprefix" in
6061 define|true|[yY]*) dflt=y ;;
6062 *)      : User may have set vendorprefix directly on Configure command line.
6063         case "$vendorprefix" in
6064         ''|' ') dflt=n ;;
6065         *)      dflt=y ;;
6066         esac
6067         ;;
6068 esac
6069 . ./myread
6070 case "$ans" in
6071 [yY]*)  fn=d~+
6072         rp='Installation prefix to use for vendor-supplied add-ons?'
6073         case "$vendorprefix" in
6074         '') dflt='' ;;
6075         *)  dflt=$vendorprefix ;;
6076         esac
6077         . ./getfile
6078         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6079         oldvendorprefix=''
6080         case "$vendorprefix" in
6081         '') ;;
6082         *)      case "$ans" in
6083                 "$prefix") ;;
6084                 *) oldvendorprefix="$prefix";;
6085                 esac
6086                 ;;
6087         esac
6088         usevendorprefix="$define"
6089         vendorprefix="$ans"
6090         vendorprefixexp="$ansexp"
6091         ;;
6092 *)      usevendorprefix="$undef"
6093         vendorprefix=''
6094         vendorprefixexp=''
6095         ;;
6096 esac
6097
6098 case "$vendorprefix" in
6099 '')     d_vendorlib="$undef"
6100         vendorlib=''
6101         vendorlibexp=''
6102         ;;
6103 *)      d_vendorlib="$define"
6104         : determine where vendor-supplied modules go.
6105         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6106         case "$vendorlib" in
6107         '')
6108                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6109                 case "$installstyle" in
6110                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6111                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6112                 esac
6113                 ;;
6114         *)      dflt="$vendorlib"
6115                 ;;
6116         esac
6117         fn=d~+
6118         rp='Pathname for the vendor-supplied library files?'
6119         . ./getfile
6120         vendorlib="$ans"
6121         vendorlibexp="$ansexp"
6122         ;;
6123 esac
6124 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6125 : Change installation prefix, if necessary.
6126 if $test X"$prefix" != X"$installprefix"; then
6127         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6128 else
6129         installvendorlib="$vendorlibexp"
6130 fi
6131
6132 case "$vendorprefix" in
6133 '')     d_vendorarch="$undef"
6134         vendorarch=''
6135         vendorarchexp=''
6136         ;;
6137 *)      d_vendorarch="$define"
6138         : determine where vendor-supplied architecture-dependent libraries go.
6139         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6140         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6141         : vendorlib may have an optional trailing /share.
6142         case "$vendorarch" in
6143         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6144                 dflt="$dflt/$archname"
6145                 ;;
6146         *)      dflt="$vendorarch" ;;
6147         esac
6148         fn=d~+
6149         rp='Pathname for vendor-supplied architecture-dependent files?'
6150         . ./getfile
6151         vendorarch="$ans"
6152         vendorarchexp="$ansexp"
6153         ;;
6154 esac
6155 : Change installation prefix, if necessary.
6156 if $test X"$prefix" != X"$installprefix"; then
6157         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6158 else
6159         installvendorarch="$vendorarchexp"
6160 fi
6161
6162 : Final catch-all directories to search
6163 $cat <<EOM
6164
6165 Lastly, you can have perl look in other directories for extensions and
6166 modules in addition to those already specified.
6167 These directories will be searched after 
6168         $sitearch 
6169         $sitelib 
6170 EOM
6171 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6172 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6173 echo ' '
6174 case "$otherlibdirs" in
6175 ''|' ') dflt='none' ;;
6176 *)      dflt="$otherlibdirs" ;;
6177 esac
6178 $cat <<EOM
6179 Enter a colon-separated set of extra paths to include in perl's @INC
6180 search path, or enter 'none' for no extra paths.
6181
6182 EOM
6183
6184 rp='Colon-separated list of additional directories for perl to search?'
6185 . ./myread
6186 case "$ans" in
6187 ' '|''|none)    otherlibdirs=' ' ;;     
6188 *)      otherlibdirs="$ans" ;;
6189 esac
6190 case "$otherlibdirs" in
6191 ' ') val=$undef ;;
6192 *)      val=$define ;;
6193 esac
6194 set d_perl_otherlibdirs
6195 eval $setvar
6196
6197 : Cruising for prototypes
6198 echo " "
6199 echo "Checking out function prototypes..." >&4
6200 $cat >prototype.c <<'EOCP'
6201 int main(int argc, char *argv[]) {
6202         exit(0);}
6203 EOCP
6204 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6205         echo "Your C compiler appears to support function prototypes."
6206         val="$define"
6207 else
6208         echo "Your C compiler doesn't seem to understand function prototypes."
6209         val="$undef"
6210 fi
6211 set prototype
6212 eval $setvar
6213 $rm -f prototype*
6214
6215 case "$prototype" in
6216 "$define") ;;
6217 *)      ansi2knr='ansi2knr'
6218         echo " "
6219         cat <<EOM >&4
6220
6221 $me:  FATAL ERROR:
6222 This version of $package can only be compiled by a compiler that 
6223 understands function prototypes.  Unfortunately, your C compiler 
6224         $cc $ccflags
6225 doesn't seem to understand them.  Sorry about that.
6226
6227 If GNU cc is available for your system, perhaps you could try that instead.  
6228
6229 Eventually, we hope to support building Perl with pre-ANSI compilers.
6230 If you would like to help in that effort, please contact <perlbug@perl.org>.
6231
6232 Aborting Configure now.
6233 EOM
6234         exit 2
6235         ;;
6236 esac
6237
6238 : determine where public executables go
6239 echo " "
6240 set dflt bin bin
6241 eval $prefixit
6242 fn=d~
6243 rp='Pathname where the public executables will reside?'
6244 . ./getfile
6245 if $test "X$ansexp" != "X$binexp"; then
6246         installbin=''
6247 fi
6248 bin="$ans"
6249 binexp="$ansexp"
6250 : Change installation prefix, if necessary.
6251 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6252 if $test X"$prefix" != X"$installprefix"; then
6253         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6254 else
6255         installbin="$binexp"
6256 fi
6257
6258 : Find perl5.005 or later.
6259 echo "Looking for a previously installed perl5.005 or later... "
6260 case "$perl5" in
6261 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6262                 : Check if this perl is recent and can load a simple module
6263                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6264                         perl5=$tdir/perl
6265                         break;
6266                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6267                         perl5=$tdir/perl
6268                         break;
6269                 fi
6270         done
6271         ;;
6272 *)      perl5="$perl5"
6273         ;;
6274 esac
6275 case "$perl5" in
6276 '')     echo "None found.  That's ok.";;
6277 *)      echo "Using $perl5." ;;
6278 esac
6279
6280 : Determine list of previous versions to include in @INC
6281 $cat > getverlist <<EOPL
6282 #!$perl5 -w
6283 use File::Basename;
6284 \$api_versionstring = "$api_versionstring";
6285 \$version = "$version";
6286 \$stem = "$sitelib_stem";
6287 \$archname = "$archname";
6288 EOPL
6289         $cat >> getverlist <<'EOPL'
6290 # Can't have leading @ because metaconfig interprets it as a command!
6291 ;@inc_version_list=();
6292 # XXX Redo to do opendir/readdir? 
6293 if (-d $stem) {
6294     chdir($stem);
6295     ;@candidates = glob("5.*");
6296 }
6297 else {
6298     ;@candidates = ();
6299 }
6300
6301 # XXX ToDo:  These comparisons must be reworked when two-digit
6302 # subversions come along, so that 5.7.10 compares as greater than
6303 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6304 # widespread that we can use the built-in version vectors rather
6305 # than reinventing them here.  For 5.6.0, however, we must
6306 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6307 foreach $d (@candidates) {
6308     if ($d lt $version) {
6309         if ($d ge $api_versionstring) {
6310             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6311         }
6312         elsif ($d ge "5.005") {
6313             unshift(@inc_version_list, grep { -d } $d);
6314         }
6315     }
6316     else {
6317         # Skip newer version.  I.e. don't look in
6318         # 5.7.0 if we're installing 5.6.1.
6319     }
6320 }
6321
6322 if (@inc_version_list) {
6323     print join(' ', @inc_version_list);
6324 }
6325 else {
6326     # Blank space to preserve value for next Configure run.
6327     print " ";
6328 }
6329 EOPL
6330 chmod +x getverlist
6331 case "$inc_version_list" in
6332 '')     if test -x "$perl5"; then
6333                 dflt=`$perl5 getverlist`
6334         else
6335                 dflt='none'
6336         fi
6337         ;;
6338 $undef) dflt='none' ;;
6339 *)  dflt="$inc_version_list" ;;
6340 esac
6341 case "$dflt" in
6342 ''|' ') dflt=none ;;
6343 esac
6344 case "$dflt" in
6345 5.005) case "$bincompat5005" in
6346        $define|true|[yY]*) ;;
6347        *) dflt=none ;;
6348        esac
6349        ;;
6350 esac
6351 $cat <<'EOM'
6352
6353 In order to ease the process of upgrading, this version of perl 
6354 can be configured to use modules built and installed with earlier 
6355 versions of perl that were installed under $prefix.  Specify here
6356 the list of earlier versions that this version of perl should check.
6357 If Configure detected no earlier versions of perl installed under
6358 $prefix, then the list will be empty.  Answer 'none' to tell perl
6359 to not search earlier versions.
6360
6361 The default should almost always be sensible, so if you're not sure,
6362 just accept the default.
6363 EOM
6364
6365 rp='List of earlier versions to include in @INC?'
6366 . ./myread
6367 case "$ans" in
6368 [Nn]one|''|' ') inc_version_list=' ' ;;
6369 *) inc_version_list="$ans" ;;
6370 esac
6371 case "$inc_version_list" in
6372 ''|' ') 
6373         inc_version_list_init='0';;
6374 *)      inc_version_list_init=`echo $inc_version_list |
6375                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6376         ;;
6377 esac
6378 $rm -f getverlist
6379
6380 : determine whether to install perl also as /usr/bin/perl
6381
6382 echo " "
6383 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6384         $cat <<EOM
6385 Many scripts expect perl to be installed as /usr/bin/perl.
6386 I can install the perl you are about to compile also as /usr/bin/perl
6387 (in addition to $installbin/perl).
6388 EOM
6389         case "$installusrbinperl" in
6390         "$undef"|[nN]*) dflt='n';;
6391         *)              dflt='y';;
6392         esac
6393         rp="Do you want to install perl as /usr/bin/perl?"
6394         . ./myread
6395         case "$ans" in
6396         [yY]*)  val="$define";;
6397         *)      val="$undef" ;;
6398         esac
6399 else
6400         val="$undef"
6401 fi
6402 set installusrbinperl
6403 eval $setvar
6404
6405 : see if dld is available
6406 set dld.h i_dld
6407 eval $inhdr
6408
6409 : see if dlopen exists
6410 xxx_runnm="$runnm"
6411 runnm=false
6412 set dlopen d_dlopen
6413 eval $inlibc
6414 runnm="$xxx_runnm"
6415
6416 : determine which dynamic loading, if any, to compile in
6417 echo " "
6418 dldir="ext/DynaLoader"
6419 case "$usedl" in
6420 $define|y|true)
6421         dflt='y'
6422         usedl="$define"
6423         ;;
6424 $undef|n|false)
6425         dflt='n'
6426         usedl="$undef"
6427         ;;
6428 *) 
6429         dflt='n'
6430         case "$d_dlopen" in
6431             $define) dflt='y' ;;
6432         esac
6433         case "$i_dld" in
6434             $define) dflt='y' ;;
6435         esac
6436         : Does a dl_xxx.xs file exist for this operating system
6437         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6438         ;;
6439 esac
6440 rp="Do you wish to use dynamic loading?"
6441 . ./myread
6442 usedl="$ans"
6443 case "$ans" in
6444 y*) usedl="$define"
6445         case "$dlsrc" in
6446         '')
6447                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6448                         dflt="$dldir/dl_${osname}.xs"
6449                 elif $test "$d_dlopen" = "$define" ; then
6450                         dflt="$dldir/dl_dlopen.xs"
6451                 elif $test "$i_dld" = "$define" ; then
6452                         dflt="$dldir/dl_dld.xs"
6453                 else
6454                         dflt=''
6455                 fi
6456                 ;;
6457         *)      dflt="$dldir/$dlsrc"
6458                 ;;
6459         esac
6460     echo "The following dynamic loading files are available:"
6461         : Can not go over to $dldir because getfile has path hard-coded in.
6462         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6463         rp="Source file to use for dynamic loading"
6464         fn="fne"
6465         gfpth="$src"
6466         . ./getfile
6467         usedl="$define"
6468         : emulate basename
6469         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6470
6471         $cat << EOM
6472
6473 Some systems may require passing special flags to $cc -c to
6474 compile modules that will be used to create a shared library.
6475 To use no flags, say "none".
6476
6477 EOM
6478     case "$cccdlflags" in
6479     '') case "$gccversion" in
6480                 '') case "$osname" in
6481                         hpux)   dflt='+z' ;;
6482                         next)   dflt='none' ;;
6483                         irix*)  dflt='-KPIC' ;;
6484                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6485                         sunos)  dflt='-pic' ;;
6486                         *)      dflt='none' ;;
6487                     esac
6488                         ;;
6489                 *)  case "$osname" in
6490                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6491                         *)      dflt='-fpic' ;;
6492                     esac ;;
6493             esac ;;
6494         ' ') dflt='none' ;;
6495     *)  dflt="$cccdlflags" ;;
6496     esac
6497     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6498     . ./myread
6499     case "$ans" in
6500     none) cccdlflags=' ' ;;
6501     *) cccdlflags="$ans" ;;
6502     esac
6503
6504     cat << EOM
6505
6506 Some systems use ld to create libraries that can be dynamically loaded,
6507 while other systems (such as those using ELF) use $cc.
6508
6509 EOM
6510         case "$ld" in
6511         '')     $cat >try.c <<'EOM'
6512 /* Test for whether ELF binaries are produced */
6513 #include <fcntl.h>
6514 #include <stdlib.h>
6515 int main() {
6516         char b[4];
6517         int i = open("a.out",O_RDONLY);
6518         if(i == -1) 
6519                 exit(1); /* fail */
6520         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6521                 exit(0); /* succeed (yes, it's ELF) */
6522         else
6523                 exit(1); /* fail */
6524 }
6525 EOM
6526                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6527                         cat <<EOM
6528 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6529 EOM
6530                         dflt="$cc"
6531                 else
6532                         echo "I'll use ld to build dynamic libraries."
6533                         dflt='ld'
6534                 fi
6535                 rm -f try.c a.out
6536                 ;;
6537         *)      dflt="$ld"
6538                 ;;
6539         esac
6540
6541     rp="What command should be used to create dynamic libraries?"
6542     . ./myread
6543         ld="$ans"
6544
6545     cat << EOM
6546
6547 Some systems may require passing special flags to $ld to create a
6548 library that can be dynamically loaded.  If your ld flags include
6549 -L/other/path options to locate libraries outside your loader's normal
6550 search path, you may need to specify those -L options here as well.  To
6551 use no flags, say "none".
6552
6553 EOM
6554     case "$lddlflags" in
6555     '') case "$osname" in
6556                         beos) dflt='-nostart' ;;
6557                         hpux) dflt='-b';
6558                               case "$gccversion" in
6559                               '') dflt="$dflt +vnocompatwarnings" ;;
6560                               esac
6561                               ;;        
6562                         linux|irix*)    dflt='-shared' ;;
6563                         next)  dflt='none' ;;
6564                         solaris) dflt='-G' ;;
6565                         sunos) dflt='-assert nodefinitions' ;;
6566                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6567                 *)     dflt='none' ;;
6568                         esac
6569                         ;;
6570     *) dflt="$lddlflags" ;;
6571     esac
6572
6573         : Try to guess additional flags to pick up local libraries.
6574         : Be careful not to append to a plain 'none'
6575         case "$dflt" in
6576         none) dflt='' ;;
6577         esac
6578         for thisflag in $ldflags; do
6579                 case "$thisflag" in
6580                 -L*|-R*)
6581                         case " $dflt " in
6582                         *" $thisflag "*) ;;
6583                         *) dflt="$dflt $thisflag" ;;
6584                         esac
6585                         ;;
6586                 esac
6587         done
6588
6589         case "$dflt" in
6590         ''|' ') dflt='none' ;;
6591         esac
6592
6593     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6594     . ./myread
6595     case "$ans" in
6596     none) lddlflags=' ' ;;
6597     *) lddlflags="$ans" ;;
6598     esac
6599
6600         cat <<EOM
6601
6602 Some systems may require passing special flags to $cc to indicate that
6603 the resulting executable will use dynamic linking.  To use no flags,
6604 say "none".
6605
6606 EOM
6607     case "$ccdlflags" in
6608     '') case "$osname" in
6609                 hpux)   dflt='-Wl,-E' ;;
6610                 linux)  dflt='-rdynamic' ;;
6611                 next)   dflt='none' ;;
6612                 sunos)  dflt='none' ;;
6613                 *)      dflt='none' ;;
6614             esac ;;
6615     ' ')  dflt='none' ;;
6616     *)  dflt="$ccdlflags" ;;
6617     esac
6618     rp="Any special flags to pass to $cc to use dynamic linking?"
6619     . ./myread
6620     case "$ans" in
6621     none) ccdlflags=' ' ;;
6622     *) ccdlflags="$ans" ;;
6623     esac
6624     ;;
6625 *)  usedl="$undef"
6626         ld='ld'
6627     dlsrc='dl_none.xs'
6628     lddlflags=''
6629     ccdlflags=''
6630     ;;
6631 esac
6632
6633 also=''
6634 case "$usedl" in
6635 $undef)
6636         # No dynamic loading being used, so don't bother even to prompt.
6637         useshrplib='false'
6638         ;;
6639 *)      case "$useshrplib" in
6640         '')     case "$osname" in
6641                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6642                         dflt=y
6643                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6644                         ;;
6645                 next*)
6646                         case "$osvers" in
6647                         4*)     dflt=y
6648                                 also='Building a shared libperl is needed for MAB support.'
6649                                 ;;
6650                         *)      dflt=n
6651                                 ;;
6652                         esac
6653                         ;;
6654                 *)      dflt=n
6655                         ;;
6656                 esac
6657                 ;;
6658         $define|true|[Yy]*)
6659                 dflt=y
6660                 ;;
6661         *)      dflt=n
6662                 ;;
6663         esac
6664         $cat << EOM
6665
6666 The perl executable is normally obtained by linking perlmain.c with
6667 libperl${_a}, any static extensions (usually just DynaLoader), and
6668 any other libraries needed on this system (such as -lm, etc.).  Since
6669 your system supports dynamic loading, it is probably possible to build
6670 a shared libperl.$so.  If you will have more than one executable linked
6671 to libperl.$so, this will significantly reduce the size of each
6672 executable, but it may have a noticeable affect on performance.  The
6673 default is probably sensible for your system.
6674 $also
6675
6676 EOM
6677         rp="Build a shared libperl.$so (y/n)"
6678         . ./myread
6679         case "$ans" in
6680         true|$define|[Yy]*)
6681                 useshrplib='true'  ;;
6682         *)      useshrplib='false' ;;
6683         esac
6684         ;;
6685 esac
6686
6687 case "$useshrplib" in
6688 true)
6689         case "$libperl" in
6690         '')
6691                 # Figure out a good name for libperl.so.  Since it gets stored in
6692                 # a version-specific architecture-dependent library, the version
6693                 # number isn't really that important, except for making cc/ld happy.
6694                 #
6695                 # A name such as libperl.so.3.1
6696                 majmin="libperl.$so.$patchlevel.$subversion"
6697                 # A name such as libperl.so.301
6698                 majonly=`echo $patchlevel $subversion |
6699                         $awk '{printf "%d%02d", $1, $2}'`
6700                 majonly=libperl.$so.$majonly
6701                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6702                 # rely on figuring it out from the naming of libc.
6703                 case "${osname}${osvers}" in
6704                 next4*)
6705                         dflt=libperl.5.$so
6706                         # XXX How handle the --version stuff for MAB?
6707                         ;;
6708                 linux*)  # ld won't link with a bare -lperl otherwise.
6709                         dflt=libperl.$so
6710                         ;;
6711                 cygwin*) # include version
6712                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6713                         ;;
6714                 *)      # Try to guess based on whether libc has major.minor.
6715                         case "$libc" in
6716                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6717                         *libc.$so.[0-9]*) dflt=$majonly ;;
6718                         *)      dflt=libperl.$so ;;
6719                         esac
6720                         ;;
6721                 esac
6722                 ;;
6723         *)      dflt=$libperl
6724                 ;;
6725         esac
6726         cat << EOM
6727
6728 I need to select a good name for the shared libperl.  If your system uses
6729 library names with major and minor numbers, then you might want something
6730 like $majmin.  Alternatively, if your system uses a single version
6731 number for shared libraries, then you might want to use $majonly.
6732 Or, your system might be quite happy with a simple libperl.$so.
6733
6734 Since the shared libperl will get installed into a version-specific
6735 architecture-dependent directory, the version number of the shared perl
6736 library probably isn't important, so the default should be o.k.
6737
6738 EOM
6739         rp='What name do you want to give to the shared libperl?'
6740         . ./myread
6741         libperl=$ans
6742         echo "Ok, I'll use $libperl"
6743         ;;
6744 *)
6745         libperl="libperl${_a}"
6746         ;;
6747 esac
6748
6749 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6750 case "$shrpdir" in
6751 '') ;;
6752 *)      $cat >&4 <<EOM
6753 WARNING:  Use of the shrpdir variable for the installation location of
6754 the shared $libperl is not supported.  It was never documented and
6755 will not work in this version.  Let me (perlbug@perl.org)
6756 know of any problems this may cause.
6757
6758 EOM
6759         case "$shrpdir" in
6760         "$archlibexp/CORE")
6761                 $cat >&4 <<EOM
6762 But your current setting of $shrpdir is
6763 the default anyway, so it's harmless.
6764 EOM
6765                 ;;
6766         *)
6767                 $cat >&4 <<EOM
6768 Further, your current attempted setting of $shrpdir
6769 conflicts with the value of $archlibexp/CORE
6770 that installperl will use.
6771 EOM
6772                 ;;
6773         esac
6774         ;;
6775 esac
6776
6777 # How will the perl executable find the installed shared $libperl?
6778 # Add $xxx to ccdlflags.
6779 # If we can't figure out a command-line option, use $shrpenv to
6780 # set env LD_RUN_PATH.  The main perl makefile uses this.
6781 shrpdir=$archlibexp/CORE
6782 xxx=''
6783 tmp_shrpenv=''
6784 if "$useshrplib"; then
6785     case "$osname" in 
6786         aix)
6787                 # We'll set it in Makefile.SH...
6788                 ;;
6789         solaris|netbsd)
6790                 xxx="-R $shrpdir"
6791                 ;;
6792         freebsd)
6793                 xxx="-Wl,-R$shrpdir"
6794                 ;;
6795         linux|irix*|dec_osf)
6796                 xxx="-Wl,-rpath,$shrpdir"
6797                 ;;
6798         next)
6799                 # next doesn't like the default...
6800                 ;;
6801         beos)
6802                 # beos doesn't like the default, either.
6803                 ;;
6804         hpux*)
6805                 # hpux doesn't like the default, either.
6806                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6807                 ;;
6808         *)
6809                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6810                 ;;
6811         esac
6812         case "$xxx" in
6813         '') ;;
6814         *)      
6815                 # Only add $xxx if it isn't already in ccdlflags.
6816                 case " $ccdlflags " in
6817                 *" $xxx "*)     ;;
6818                 *)      ccdlflags="$ccdlflags $xxx"
6819                         cat <<EOM >&4
6820
6821 Adding $xxx to the flags
6822 passed to $ld so that the perl executable will find the 
6823 installed shared $libperl.
6824
6825 EOM
6826                         ;;
6827                 esac
6828                 ;;
6829         esac
6830 fi
6831 # Fix ccdlflags in AIX for building external extensions.
6832 # (For building Perl itself bare -bE:perl.exp is needed,
6833 #  Makefile.SH takes care of this.)
6834 case "$osname" in
6835 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6836 esac
6837 # Respect a hint or command-line value.
6838 case "$shrpenv" in
6839 '') shrpenv="$tmp_shrpenv" ;;
6840 esac
6841 case "$ldlibpthname" in
6842 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6843 none)   ldlibpthname='' ;;
6844 esac
6845
6846 : determine where manual pages are on this system
6847 echo " "
6848 case "$sysman" in
6849 '') 
6850         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6851         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6852         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6853         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6854         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6855         sysman=`./loc . /usr/man/man1 $syspath`
6856         ;;
6857 esac
6858 if $test -d "$sysman"; then
6859         echo "System manual is in $sysman." >&4
6860 else
6861         echo "Could not find manual pages in source form." >&4
6862 fi
6863
6864 : determine where manual pages go
6865 set man1dir man1dir none
6866 eval $prefixit
6867 $cat <<EOM
6868
6869 $spackage has manual pages available in source form.
6870 EOM
6871 case "$nroff" in
6872 nroff)
6873         echo "However, you don't have nroff, so they're probably useless to you."
6874         case "$man1dir" in
6875         '') man1dir="none";;
6876         esac;;
6877 esac
6878 echo "If you don't want the manual sources installed, answer 'none'."
6879 case "$man1dir" in
6880 ' ') dflt=none
6881         ;;
6882 '')
6883         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6884         lookpath="$lookpath $prefixexp/man/p_man/man1"
6885         lookpath="$lookpath $prefixexp/man/u_man/man1"
6886         lookpath="$lookpath $prefixexp/man/man.1"
6887         case "$sysman" in
6888         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6889         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6890         esac
6891         set dflt
6892         eval $prefixup
6893         ;;
6894 *)  dflt="$man1dir"
6895         ;;
6896 esac
6897 echo " "
6898 fn=dn+~
6899 rp="Where do the main $spackage manual pages (source) go?"
6900 . ./getfile
6901 if $test "X$man1direxp" != "X$ansexp"; then
6902         installman1dir=''
6903 fi
6904 man1dir="$ans"
6905 man1direxp="$ansexp"
6906 case "$man1dir" in
6907 '')     man1dir=' '
6908         installman1dir='';;
6909 esac
6910
6911 : Change installation prefix, if necessary.
6912 if $test X"$prefix" != X"$installprefix"; then
6913         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6914 else
6915         installman1dir="$man1direxp"
6916 fi
6917
6918 : What suffix to use on installed man pages
6919
6920 case "$man1dir" in
6921 ' ')
6922         man1ext='0'
6923         ;;
6924 *)
6925         rp="What suffix should be used for the main $spackage man pages?"
6926         case "$man1ext" in
6927         '')     case "$man1dir" in
6928                 *1)  dflt=1 ;;
6929                 *1p) dflt=1p ;;
6930                 *1pm) dflt=1pm ;;
6931                 *l) dflt=l;;
6932                 *n) dflt=n;;
6933                 *o) dflt=o;;
6934                 *p) dflt=p;;
6935                 *C) dflt=C;;
6936                 *L) dflt=L;;
6937                 *L1) dflt=L1;;
6938                 *) dflt=1;;
6939                 esac
6940                 ;;
6941         *)      dflt="$man1ext";;
6942         esac
6943         . ./myread
6944         man1ext="$ans"
6945         ;;
6946 esac
6947
6948 : see if we can have long filenames
6949 echo " "
6950 first=123456789abcdef
6951 $rm -f $first
6952 if (echo hi >$first) 2>/dev/null; then
6953         if $test -f 123456789abcde; then
6954                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6955                 val="$undef"
6956         else
6957                 echo 'You can have filenames longer than 14 characters.'>&4
6958                 val="$define"
6959         fi
6960 else
6961         $cat <<'EOM'
6962 You can't have filenames longer than 14 chars.
6963 You can't even think about them!
6964 EOM
6965         val="$undef"
6966 fi 
6967 set d_flexfnam
6968 eval $setvar
6969 $rm -rf 123456789abcde*
6970
6971 : determine where library module manual pages go
6972 set man3dir man3dir none
6973 eval $prefixit
6974 $cat <<EOM
6975
6976 $spackage has manual pages for many of the library modules.
6977 EOM
6978
6979 case "$nroff" in
6980 nroff)
6981         $cat <<'EOM'
6982 However, you don't have nroff, so they're probably useless to you.
6983 EOM
6984         case "$man3dir" in
6985         '') man3dir="none";;
6986         esac;;
6987 esac
6988
6989 case "$d_flexfnam" in
6990 undef)
6991         $cat <<'EOM'
6992 However, your system can't handle the long file names like File::Basename.3. 
6993 EOM
6994         case "$man3dir" in
6995         '') man3dir="none";;
6996         esac;;
6997 esac
6998
6999 echo "If you don't want the manual sources installed, answer 'none'."
7000 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7001 case "$man3dir" in
7002 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7003         if $test -d "$privlib/man/man3"; then
7004                 cat <<EOM >&4
7005
7006 WARNING:  Previous versions of perl installed man3 pages into
7007 $privlib/man/man3.  This version will suggest a 
7008 new default of $dflt.  
7009 EOM
7010                 tdflt=$dflt
7011                 dflt='n'
7012                 rp='Do you wish to preserve the old behavior?(y/n)'
7013                 . ./myread
7014                 case "$ans" in
7015                 y*) dflt="$privlib/man/man3" ;;
7016                 *)  dflt=$tdflt ;;
7017                 esac
7018     fi
7019         ;;
7020 *)      dflt="$man3dir" ;;
7021 esac
7022 case "$dflt" in
7023 ' ') dflt=none ;;
7024 esac
7025 echo " "
7026 fn=dn+~
7027 rp="Where do the $package library man pages (source) go?"
7028 . ./getfile
7029 man3dir="$ans"
7030 man3direxp="$ansexp"
7031 case "$man3dir" in
7032 '')     man3dir=' '
7033         installman3dir='';;
7034 esac
7035
7036 : Change installation prefix, if necessary.
7037 if $test X"$prefix" != X"$installprefix"; then
7038         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7039 else
7040         installman3dir="$man3direxp"
7041 fi
7042
7043 : What suffix to use on installed man pages
7044 case "$man3dir" in
7045 ' ')
7046         man3ext='0'
7047         ;;
7048 *)
7049         rp="What suffix should be used for the $package library man pages?"
7050         case "$man3ext" in
7051         '')     case "$man3dir" in
7052                 *3)  dflt=3 ;;
7053                 *3p) dflt=3p ;;
7054                 *3pm) dflt=3pm ;;
7055                 *l) dflt=l;;
7056                 *n) dflt=n;;
7057                 *o) dflt=o;;
7058                 *p) dflt=p;;
7059                 *C) dflt=C;;
7060                 *L) dflt=L;;
7061                 *L3) dflt=L3;;
7062                 *) dflt=3;;
7063                 esac
7064                 ;;
7065         *)      dflt="$man3ext";;
7066         esac
7067         . ./myread
7068         man3ext="$ans"
7069         ;;
7070 esac
7071
7072 : see if we have to deal with yellow pages, now NIS.
7073 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7074         if $test -f /usr/etc/nibindd; then
7075                 echo " "
7076                 echo "I'm fairly confident you're on a NeXT."
7077                 echo " "
7078                 rp='Do you get the hosts file via NetInfo?'
7079                 dflt=y
7080                 case "$hostcat" in
7081                 nidump*) ;;
7082                 '') ;;
7083                 *) dflt=n;;
7084                 esac
7085                 . ./myread
7086                 case "$ans" in
7087                 y*) hostcat='nidump hosts .';;
7088                 *)      case "$hostcat" in
7089                         nidump*) hostcat='';;
7090                         esac
7091                         ;;
7092                 esac
7093         fi
7094         case "$hostcat" in
7095         nidump*) ;;
7096         *)
7097                 case "$hostcat" in
7098                 *ypcat*) dflt=y;;
7099                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7100                                 dflt=y
7101                         else
7102                                 dflt=n
7103                         fi;;
7104                 *) dflt=n;;
7105                 esac
7106                 echo " "
7107                 rp='Are you getting the hosts file via yellow pages?'
7108                 . ./myread
7109                 case "$ans" in
7110                 y*) hostcat='ypcat hosts';;
7111                 *) hostcat='cat /etc/hosts';;
7112                 esac
7113                 ;;
7114         esac
7115 fi
7116 case "$hostcat" in
7117 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7118 esac
7119 case "$groupcat" in
7120 '') test -f /etc/group && groupcat='cat /etc/group';;
7121 esac
7122 case "$passcat" in
7123 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7124 esac
7125
7126 : now get the host name
7127 echo " "
7128 echo "Figuring out host name..." >&4
7129 case "$myhostname" in
7130 '') cont=true
7131         echo 'Maybe "hostname" will work...'
7132         if tans=`sh -c hostname 2>&1` ; then
7133                 myhostname=$tans
7134                 phostname=hostname
7135                 cont=''
7136         fi
7137         ;;
7138 *) cont='';;
7139 esac
7140 if $test "$cont"; then
7141         if ./xenix; then
7142                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7143                 if tans=`cat /etc/systemid 2>&1` ; then
7144                         myhostname=$tans
7145                         phostname='cat /etc/systemid'
7146                         echo "Whadyaknow.  Xenix always was a bit strange..."
7147                         cont=''
7148                 fi
7149         elif $test -r /etc/systemid; then
7150                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7151         fi
7152 fi
7153 if $test "$cont"; then
7154         echo 'No, maybe "uuname -l" will work...'
7155         if tans=`sh -c 'uuname -l' 2>&1` ; then
7156                 myhostname=$tans
7157                 phostname='uuname -l'
7158         else
7159                 echo 'Strange.  Maybe "uname -n" will work...'
7160                 if tans=`sh -c 'uname -n' 2>&1` ; then
7161                         myhostname=$tans
7162                         phostname='uname -n'
7163                 else
7164                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7165                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7166                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7167                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7168                         else
7169                                 case "$myhostname" in
7170                                 '') echo "Does this machine have an identity crisis or something?"
7171                                         phostname='';;
7172                                 *)
7173                                         echo "Well, you said $myhostname before..."
7174                                         phostname='echo $myhostname';;
7175                                 esac
7176                         fi
7177                 fi
7178         fi
7179 fi
7180 : you do not want to know about this
7181 set $myhostname
7182 myhostname=$1
7183
7184 : verify guess
7185 if $test "$myhostname" ; then
7186         dflt=y
7187         rp='Your host name appears to be "'$myhostname'".'" Right?"
7188         . ./myread
7189         case "$ans" in
7190         y*) ;;
7191         *) myhostname='';;
7192         esac
7193 fi
7194
7195 : bad guess or no guess
7196 while $test "X$myhostname" = X ; do
7197         dflt=''
7198         rp="Please type the (one word) name of your host:"
7199         . ./myread
7200         myhostname="$ans"
7201 done
7202
7203 : translate upper to lower if necessary
7204 case "$myhostname" in
7205 *[A-Z]*)
7206         echo "(Normalizing case in your host name)"
7207         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7208         ;;
7209 esac
7210
7211 case "$myhostname" in
7212 *.*)
7213         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7214         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7215         echo "(Trimming domain name from host name--host name is now $myhostname)"
7216         ;;
7217 *) case "$mydomain" in
7218         '')
7219                 {
7220                         test "X$hostcat" = "Xypcat hosts" &&
7221                         ypmatch "$myhostname" hosts 2>/dev/null |\
7222                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7223                         $test -s hosts
7224                 } || {
7225                         test "X$hostcat" != "X" &&
7226                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7227                                         /[       ]$myhostname[  . ]/p" > hosts
7228                 }
7229                 tmp_re="[       . ]"
7230                 if $test -f hosts; then
7231                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7232                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7233                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7234                                 hosts | $sort | $uniq | \
7235                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7236                         case `$echo X$dflt` in
7237                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7238                                 dflt=.
7239                                 ;;
7240                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7241                                 ;;
7242                         esac
7243                 else
7244                         echo "(I cannot locate a hosts database anywhere)"
7245                         dflt=.
7246                 fi
7247                 case "$dflt" in
7248                 .)
7249                         tans=`./loc resolv.conf X /etc /usr/etc`
7250                         if $test -f "$tans"; then
7251                                 echo "(Attempting domain name extraction from $tans)"
7252                                 dflt=.`$sed -n -e 's/   / /g' \
7253                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7254                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7255                                 case "$dflt" in
7256                                 .) dflt=.`$sed -n -e 's/        / /g' \
7257                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7258                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7259                                         ;;
7260                                 esac
7261                         fi
7262                         ;;
7263                 esac
7264                 case "$dflt" in
7265                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7266                         dflt=.`sh -c domainname 2>/dev/null`
7267                         case "$dflt" in
7268                         '') dflt='.';;
7269                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7270                         esac
7271                         ;;
7272                 esac
7273                 case "$dflt" in
7274                 .) echo "(Lost all hope -- silly guess then)"
7275                         dflt='.uucp'
7276                         ;;
7277                 esac
7278                 $rm -f hosts
7279                 ;;
7280         *) dflt="$mydomain";;
7281         esac;;
7282 esac
7283 echo " "
7284 rp="What is your domain name?"
7285 . ./myread
7286 tans="$ans"
7287 case "$ans" in
7288 '') ;;
7289 .*) ;;
7290 *) tans=".$tans";;
7291 esac
7292 mydomain="$tans"
7293
7294 : translate upper to lower if necessary
7295 case "$mydomain" in
7296 *[A-Z]*)
7297         echo "(Normalizing case in your domain name)"
7298         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7299         ;;
7300 esac
7301
7302 : a little sanity check here
7303 case "$phostname" in
7304 '') ;;
7305 *)
7306         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7307         $myhostname$mydomain|$myhostname) ;;
7308         *)
7309                 case "$phostname" in
7310                 sed*)
7311                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7312                         ;;
7313                 *)
7314                         echo "(That doesn't agree with your $phostname command, by the way.)"
7315                         ;;
7316                 esac
7317         ;;
7318         esac
7319         ;;
7320 esac
7321
7322 $cat <<EOM
7323
7324 I need to get your e-mail address in Internet format if possible, i.e.
7325 something like user@host.domain. Please answer accurately since I have
7326 no easy means to double check it. The default value provided below
7327 is most probably close to reality but may not be valid from outside
7328 your organization...
7329
7330 EOM
7331 cont=x
7332 while test "$cont"; do
7333         case "$cf_email" in
7334         '') dflt="$cf_by@$myhostname$mydomain";;
7335         *) dflt="$cf_email";;
7336         esac
7337         rp='What is your e-mail address?'
7338         . ./myread
7339         cf_email="$ans"
7340         case "$cf_email" in
7341         *@*.*) cont='' ;;
7342         *)
7343                 rp='Address does not look like an Internet one.  Use it anyway?'
7344                 case "$fastread" in
7345                 yes) dflt=y ;;
7346                 *) dflt=n ;;
7347                 esac
7348                 . ./myread
7349                 case "$ans" in
7350                 y*) cont='' ;;
7351                 *) echo " " ;;
7352                 esac
7353                 ;;
7354         esac
7355 done
7356
7357 $cat <<EOM
7358
7359 If you or somebody else will be maintaining perl at your site, please
7360 fill in the correct e-mail address here so that they may be contacted
7361 if necessary. Currently, the "perlbug" program included with perl
7362 will send mail to this address in addition to perlbug@perl.org. You may
7363 enter "none" for no administrator.
7364
7365 EOM
7366 case "$perladmin" in
7367 '') dflt="$cf_email";;
7368 *) dflt="$perladmin";;
7369 esac
7370 rp='Perl administrator e-mail address'
7371 . ./myread
7372 perladmin="$ans"
7373
7374 : determine whether to only install version-specific parts.
7375 echo " "
7376 $cat <<EOM
7377 Do you want to install only the version-specific parts of the perl
7378 distribution?  Usually you do *not* want to do this.
7379 EOM
7380 case "$versiononly" in
7381 "$define"|[Yy]*|true) dflt='y' ;;
7382 *) dflt='n';
7383 esac
7384 rp="Do you want to install only the version-specific parts of perl?"
7385 . ./myread
7386 case "$ans" in
7387 [yY]*)  val="$define";;
7388 *)      val="$undef" ;;
7389 esac
7390 set versiononly
7391 eval $setvar
7392
7393 : figure out how to guarantee perl startup
7394 case "$startperl" in
7395 '')
7396         case "$sharpbang" in
7397         *!)
7398                 $cat <<EOH
7399
7400 I can use the #! construct to start perl on your system. This will
7401 make startup of perl scripts faster, but may cause problems if you
7402 want to share those scripts and perl is not in a standard place
7403 ($binexp/perl) on all your platforms. The alternative is to force
7404 a shell by starting the script with a single ':' character.
7405
7406 EOH
7407                 case "$versiononly" in
7408                 "$define")      dflt="$binexp/perl$version";;  
7409                 *)              dflt="$binexp/perl";;
7410                 esac
7411                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7412                 . ./myread
7413                 case "$ans" in
7414                 none)   startperl=": # use perl";;
7415                 *)      startperl="#!$ans"
7416                         if $test 30 -lt `echo "$ans" | wc -c`; then
7417                                 $cat >&4 <<EOM
7418
7419 WARNING:  Some systems limit the #! command to 32 characters.
7420 If you experience difficulty running Perl scripts with #!, try
7421 installing Perl in a directory with a shorter pathname.
7422
7423 EOM
7424                         fi ;;
7425                 esac
7426                 ;;
7427         *) startperl=": # use perl"
7428                 ;;
7429         esac
7430         ;;
7431 esac
7432 echo "I'll use $startperl to start perl scripts."
7433
7434 : figure best path for perl in scripts
7435 case "$perlpath" in
7436 '')
7437         perlpath="$binexp/perl"
7438         case "$startperl" in
7439         *!*) ;;
7440         *)
7441                 $cat <<EOH
7442
7443 I will use the "eval 'exec'" idiom to start Perl on your system.
7444 I can use the full path of your Perl binary for this purpose, but
7445 doing so may cause problems if you want to share those scripts and
7446 Perl is not always in a standard place ($binexp/perl).
7447
7448 EOH
7449                 dflt="$binexp/perl"
7450                 rp="What path shall I use in \"eval 'exec'\"?"
7451                 . ./myread
7452                 perlpath="$ans"
7453                 ;;
7454         esac
7455         ;;
7456 esac
7457 case "$startperl" in
7458 *!*)    ;;
7459 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7460 esac
7461
7462 : determine where public executable scripts go
7463 set scriptdir scriptdir
7464 eval $prefixit
7465 case "$scriptdir" in
7466 '')
7467         dflt="$bin"
7468         : guess some guesses
7469         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7470         $test -d /usr/share/bin     && dflt=/usr/share/bin
7471         $test -d /usr/local/script  && dflt=/usr/local/script
7472         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7473         $test -d $prefixexp/script  && dflt=$prefixexp/script
7474         set dflt
7475         eval $prefixup
7476         ;;
7477 *)  dflt="$scriptdir"
7478         ;;
7479 esac
7480 $cat <<EOM
7481  
7482 Some installations have a separate directory just for executable scripts so
7483 that they can mount it across multiple architectures but keep the scripts in
7484 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7485 Or you might just lump your scripts in with all your other executables.
7486  
7487 EOM
7488 fn=d~
7489 rp='Where do you keep publicly executable scripts?'
7490 . ./getfile
7491 if $test "X$ansexp" != "X$scriptdirexp"; then
7492         installscript=''
7493 fi
7494 scriptdir="$ans"
7495 scriptdirexp="$ansexp"
7496 : Change installation prefix, if necessary.
7497 if $test X"$prefix" != X"$installprefix"; then
7498         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7499 else
7500         installscript="$scriptdirexp"
7501 fi
7502
7503 : determine where add-on public executables go
7504 case "$sitebin" in
7505 '')     dflt=$siteprefix/bin ;;
7506 *)      dflt=$sitebin ;;
7507 esac
7508 fn=d~
7509 rp='Pathname where the add-on public executables should be installed?'
7510 . ./getfile
7511 sitebin="$ans"
7512 sitebinexp="$ansexp"
7513 : Change installation prefix, if necessary.
7514 if $test X"$prefix" != X"$installprefix"; then
7515         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7516 else
7517         installsitebin="$sitebinexp"
7518 fi
7519
7520 case "$useperlio" in
7521 $define|true|[yY]*)     dflt='y';;
7522 *) dflt='n';;
7523 esac
7524 cat <<EOM
7525
7526 Previous version of $package used the standard IO mechanisms as
7527 defined in <stdio.h>.  Versions 5.003_02 and later of perl allow
7528 alternate IO mechanisms via the PerlIO abstraction layer, but the
7529 stdio mechanism is still the default.  This abstraction layer can
7530 use AT&T's sfio (if you already have sfio installed) or regular stdio.
7531 Using PerlIO with sfio may cause problems with some extension modules.
7532
7533 If this doesn't make any sense to you, just accept the default '$dflt'.
7534 EOM
7535 rp='Use the experimental PerlIO abstraction layer?'
7536 . ./myread
7537 case "$ans" in
7538 y|Y) 
7539         val="$define"
7540         ;;     
7541 *)      
7542         echo "Ok, doing things the stdio way."
7543         val="$undef"
7544         ;;
7545 esac
7546 set useperlio
7547 eval $setvar 
7548
7549 case "$usesocks" in
7550 $define|true|[yY]*)
7551         case "$useperlio" in
7552         $define|true|[yY]*) ;;
7553         *)      cat >&4 <<EOM
7554
7555 You are using the SOCKS proxy protocol library which means that you
7556 should also use the PerlIO layer.  You may be headed for trouble.
7557
7558 EOM
7559                 ;;
7560         esac
7561         ;;
7562 esac
7563
7564         
7565 case "$vendorprefix" in
7566 '')     d_vendorbin="$undef"
7567         vendorbin=''
7568         vendorbinexp=''
7569         ;;
7570 *)      d_vendorbin="$define"
7571         : determine where vendor-supplied executables go.
7572         case "$vendorbin" in
7573         '') dflt=$vendorprefix/bin ;;
7574         *)      dflt="$vendorbin" ;;
7575         esac
7576         fn=d~+
7577         rp='Pathname for the vendor-supplied executables directory?'
7578         . ./getfile
7579         vendorbin="$ans"
7580         vendorbinexp="$ansexp"
7581         ;;
7582 esac
7583 : Change installation prefix, if necessary.
7584 if $test X"$prefix" != X"$installprefix"; then
7585         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7586 else
7587         installvendorbin="$vendorbinexp"
7588 fi
7589
7590 : see if qgcvt exists
7591 set qgcvt d_qgcvt
7592 eval $inlibc
7593
7594 echo " "
7595
7596 if $test X"$d_longdbl" = X"$define"; then
7597
7598 echo "Checking how to print long doubles..." >&4
7599
7600 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7601         $cat >try.c <<'EOCP'
7602 #include <sys/types.h>
7603 #include <stdio.h>
7604 int main() {
7605   double d = 123.456;
7606   printf("%.3f\n", d);
7607 }
7608 EOCP
7609         set try
7610         if eval $compile; then
7611                 yyy=`./try$exe_ext`
7612                 case "$yyy" in
7613                 123.456)
7614                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7615                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7616                         echo "We will use %f."
7617                         ;;
7618                 esac
7619         fi
7620 fi
7621
7622 if $test X"$sPRIfldbl" = X; then
7623         $cat >try.c <<'EOCP'
7624 #include <sys/types.h>
7625 #include <stdio.h>
7626 int main() {
7627   long double d = 123.456;
7628   printf("%.3llf\n", d);
7629 }
7630 EOCP
7631         set try
7632         if eval $compile; then
7633                 yyy=`./try$exe_ext`
7634                 case "$yyy" in
7635                 123.456)
7636                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7637                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7638                         echo "We will use %llf."
7639                         ;;
7640                 esac
7641         fi
7642 fi
7643
7644 if $test X"$sPRIfldbl" = X; then
7645         $cat >try.c <<'EOCP'
7646 #include <sys/types.h>
7647 #include <stdio.h>
7648 int main() {
7649   long double d = 123.456;
7650   printf("%.3Lf\n", d);
7651 }
7652 EOCP
7653         set try
7654         if eval $compile; then
7655                 yyy=`./try$exe_ext`
7656                 case "$yyy" in
7657                 123.456)
7658                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7659                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7660                         echo "We will use %Lf."
7661                         ;;
7662                 esac
7663         fi
7664 fi
7665
7666 if $test X"$sPRIfldbl" = X; then
7667         $cat >try.c <<'EOCP'
7668 #include <sys/types.h>
7669 #include <stdio.h>
7670 int main() {
7671   long double d = 123.456;
7672   printf("%.3lf\n", d);
7673 }
7674 EOCP
7675         set try
7676         if eval $compile; then
7677                 yyy=`./try$exe_ext`
7678                 case "$yyy" in
7679                 123.456)
7680                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7681                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7682                         echo "We will use %lf."
7683                         ;;
7684                 esac
7685         fi
7686 fi
7687
7688 if $test X"$sPRIfldbl" = X; then
7689         echo "Cannot figure out how to print long doubles." >&4
7690 else
7691         sSCNfldbl=$sPRIfldbl    # expect consistency
7692 fi
7693
7694 $rm -f try try.*
7695
7696 fi # d_longdbl
7697
7698 case "$sPRIfldbl" in
7699 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7700         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7701         d_SCNfldbl="$undef";
7702         ;;
7703 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7704         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7705         d_SCNfldbl="$define";
7706         ;;
7707 esac
7708
7709 : Check how to convert floats to strings.
7710 echo " "
7711 echo "Checking for an efficient way to convert floats to strings."
7712 echo " " > try.c
7713 case "$uselongdouble" in
7714 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7715 esac
7716 case "$d_longdbl" in
7717 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7718 esac
7719 case "$d_PRIgldbl" in
7720 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7721 esac
7722 $cat >>try.c <<EOP
7723 #ifdef TRY_gconvert
7724 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7725 char *myname = "gconvert";
7726 #endif
7727 #ifdef TRY_gcvt
7728 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7729 char *myname = "gcvt";
7730 #endif
7731 #ifdef TRY_qgcvt
7732 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7733 char *myname = "qgcvt";
7734 #define DOUBLETYPE long double
7735 #endif
7736 #ifdef TRY_sprintf
7737 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7738 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7739 #else
7740 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7741 #endif
7742 char *myname = "sprintf";
7743 #endif
7744
7745 #ifndef DOUBLETYPE
7746 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7747 #define DOUBLETYPE long double
7748 #else
7749 #define DOUBLETYPE double
7750 #endif
7751 #endif
7752
7753 #include <stdio.h>
7754
7755 #define I_STDLIB $i_stdlib
7756 #ifdef I_STDLIB
7757 #include <stdlib.h>
7758 #endif
7759
7760 int
7761 checkit(expect, got)
7762 char *expect;
7763 char *got;
7764 {
7765     if (strcmp(expect, got)) {
7766                 printf("%s oddity:  Expected %s, got %s\n",
7767                         myname, expect, got);
7768                 exit(1);
7769         }
7770 }
7771
7772 int main()
7773
7774         char buf[64]; 
7775         buf[63] = '\0';
7776
7777         /* This must be 1st test on (which?) platform */
7778         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7779         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7780         checkit("0.1", buf);
7781
7782         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7783         checkit("1", buf);
7784
7785         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7786         checkit("1.1", buf);
7787
7788         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7789         checkit("1.01", buf);
7790
7791         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7792         checkit("1.001", buf);
7793
7794         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7795         checkit("1.0001", buf);
7796
7797         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7798         checkit("1.00001", buf);
7799
7800         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7801         checkit("1.000001", buf);
7802
7803         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7804         checkit("0", buf);
7805
7806         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7807         checkit("-1", buf);
7808
7809         /* Some Linux gcvt's give 1.e+5 here. */
7810         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7811         checkit("100000", buf);
7812         
7813         /* Some Linux gcvt's give -1.e+5 here. */
7814         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7815         checkit("-100000", buf);
7816
7817         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7818         checkit("123.456", buf);
7819
7820         exit(0);
7821 }
7822 EOP
7823 case "$d_Gconvert" in
7824 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7825 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7826 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7827 *) xxx_list='gconvert gcvt sprintf' ;;
7828 esac
7829
7830 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7831 "$define$define$define")
7832     # for long doubles prefer first qgcvt, then sprintf
7833     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7834     xxx_list="sprintf $xxx_list"
7835     case "$d_qgcvt" in
7836     "$define") xxx_list="qgcvt $xxx_list" ;;
7837     esac
7838     ;;
7839 esac
7840
7841 for xxx_convert in $xxx_list; do
7842         echo "Trying $xxx_convert..."
7843         $rm -f try try$_o
7844         set try -DTRY_$xxx_convert
7845         if eval $compile; then
7846                 echo "$xxx_convert() found." >&4
7847                 if ./try; then
7848                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7849                         break;
7850                 else
7851                         echo "...But $xxx_convert didn't work as I expected."
7852                 fi
7853         else
7854                 echo "$xxx_convert NOT found." >&4
7855         fi
7856 done
7857         
7858 case "$xxx_convert" in
7859 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7860 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7861 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7862 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7863    "$define$define$define")
7864       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7865    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7866    esac
7867    ;;  
7868 esac
7869
7870 : see if _fwalk exists
7871 set fwalk d__fwalk
7872 eval $inlibc
7873
7874 : Initialize h_fcntl
7875 h_fcntl=false
7876
7877 : Initialize h_sysfile
7878 h_sysfile=false
7879
7880 : access call always available on UNIX
7881 set access d_access
7882 eval $inlibc
7883
7884 : locate the flags for 'access()'
7885 case "$d_access" in
7886 "$define")
7887         echo " "
7888         $cat >access.c <<'EOCP'
7889 #include <sys/types.h>
7890 #ifdef I_FCNTL
7891 #include <fcntl.h>
7892 #endif
7893 #ifdef I_SYS_FILE
7894 #include <sys/file.h>
7895 #endif
7896 #ifdef I_UNISTD
7897 #include <unistd.h>
7898 #endif
7899 int main() {
7900         exit(R_OK);
7901 }
7902 EOCP
7903         : check sys/file.h first, no particular reason here
7904         if $test `./findhdr sys/file.h` && \
7905                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7906                 h_sysfile=true;
7907                 echo "<sys/file.h> defines the *_OK access constants." >&4
7908         elif $test `./findhdr fcntl.h` && \
7909                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7910                 h_fcntl=true;
7911                 echo "<fcntl.h> defines the *_OK access constants." >&4
7912         elif $test `./findhdr unistd.h` && \
7913                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7914                 echo "<unistd.h> defines the *_OK access constants." >&4
7915         else
7916                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7917         fi
7918         ;;
7919 esac
7920 $rm -f access*
7921
7922 : see if accessx exists
7923 set accessx d_accessx
7924 eval $inlibc
7925
7926 : see if alarm exists
7927 set alarm d_alarm
7928 eval $inlibc
7929
7930 : see if atolf exists
7931 set atolf d_atolf
7932 eval $inlibc
7933
7934 : see if atoll exists
7935 set atoll d_atoll
7936 eval $inlibc
7937
7938 : Look for GNU-cc style attribute checking
7939 echo " "
7940 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7941 $cat >attrib.c <<'EOCP'
7942 #include <stdio.h>
7943 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7944 EOCP
7945 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7946         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7947                 echo "Your C compiler doesn't fully support __attribute__."
7948                 val="$undef"
7949         else
7950                 echo "Your C compiler supports __attribute__."
7951                 val="$define"
7952         fi
7953 else
7954         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7955         val="$undef"
7956 fi
7957 set d_attribut
7958 eval $setvar
7959 $rm -f attrib*
7960
7961 : see if bcmp exists
7962 set bcmp d_bcmp
7963 eval $inlibc
7964
7965 : see if bcopy exists
7966 set bcopy d_bcopy
7967 eval $inlibc
7968
7969 : see if this is a unistd.h system
7970 set unistd.h i_unistd
7971 eval $inhdr
7972
7973 : see if getpgrp exists
7974 set getpgrp d_getpgrp
7975 eval $inlibc
7976
7977 case "$d_getpgrp" in
7978 "$define")
7979         echo " "
7980         echo "Checking to see which flavor of getpgrp is in use..."
7981         $cat >set.c <<EOP
7982 #$i_unistd I_UNISTD
7983 #include <sys/types.h>
7984 #ifdef I_UNISTD
7985 #  include <unistd.h>
7986 #endif
7987 int main()
7988 {
7989         if (getuid() == 0) {
7990                 printf("(I see you are running Configure as super-user...)\n");
7991                 setuid(1);
7992         }
7993 #ifdef TRY_BSD_PGRP
7994         if (getpgrp(1) == 0)
7995                 exit(0);
7996 #else
7997         if (getpgrp() > 0)
7998                 exit(0);
7999 #endif
8000         exit(1);
8001 }
8002 EOP
8003         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8004                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8005                 val="$define"
8006         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8007                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8008                 val="$undef"
8009         else
8010                 echo "I can't seem to compile and run the test program."
8011                 if ./usg; then
8012                         xxx="a USG one, i.e. you use getpgrp()."
8013                 else
8014                         # SVR4 systems can appear rather BSD-ish.
8015                         case "$i_unistd" in
8016                         $undef)
8017                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8018                                 val="$define"
8019                                 ;;
8020                         $define)
8021                                 xxx="probably a USG one, i.e. you use getpgrp()."
8022                                 val="$undef"
8023                                 ;;
8024                         esac
8025                 fi
8026                 echo "Assuming your getpgrp is $xxx" >&4
8027         fi
8028         ;;
8029 *) val="$undef";;
8030 esac
8031 set d_bsdgetpgrp
8032 eval $setvar
8033 $rm -f set set.c
8034
8035 : see if setpgrp exists
8036 set setpgrp d_setpgrp
8037 eval $inlibc
8038
8039 case "$d_setpgrp" in
8040 "$define")
8041         echo " "
8042         echo "Checking to see which flavor of setpgrp is in use..."
8043         $cat >set.c <<EOP
8044 #$i_unistd I_UNISTD
8045 #include <sys/types.h>
8046 #ifdef I_UNISTD
8047 #  include <unistd.h>
8048 #endif
8049 int main()
8050 {
8051         if (getuid() == 0) {
8052                 printf("(I see you are running Configure as super-user...)\n");
8053                 setuid(1);
8054         }
8055 #ifdef TRY_BSD_PGRP
8056         if (-1 == setpgrp(1, 1))
8057                 exit(0);
8058 #else
8059         if (setpgrp() != -1)
8060                 exit(0);
8061 #endif
8062         exit(1);
8063 }
8064 EOP
8065         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8066                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8067                 val="$define"
8068         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8069                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8070                 val="$undef"
8071         else
8072                 echo "(I can't seem to compile and run the test program.)"
8073                 if ./usg; then
8074                         xxx="a USG one, i.e. you use setpgrp()."
8075                 else
8076                         # SVR4 systems can appear rather BSD-ish.
8077                         case "$i_unistd" in
8078                         $undef)
8079                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8080                                 val="$define"
8081                                 ;;
8082                         $define)
8083                                 xxx="probably a USG one, i.e. you use setpgrp()."
8084                                 val="$undef"
8085                                 ;;
8086                         esac
8087                 fi
8088                 echo "Assuming your setpgrp is $xxx" >&4
8089         fi
8090         ;;
8091 *) val="$undef";;
8092 esac
8093 set d_bsdsetpgrp
8094 eval $setvar
8095 $rm -f set set.c
8096 : see if bzero exists
8097 set bzero d_bzero
8098 eval $inlibc
8099
8100 : see if signal is declared as pointer to function returning int or void
8101 echo " "
8102 xxx=`./findhdr signal.h`
8103 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8104 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8105         echo "You have int (*signal())() instead of void." >&4
8106         val="$undef"
8107 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8108         echo "You have void (*signal())()." >&4
8109         val="$define"
8110 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8111         echo "You have int (*signal())() instead of void." >&4
8112         val="$undef"
8113 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8114         echo "You have void (*signal())()." >&4
8115         val="$define"
8116 else
8117         case "$d_voidsig" in
8118         '')
8119         echo "I can't determine whether signal handler returns void or int..." >&4
8120                 dflt=void
8121                 rp="What type does your signal handler return?"
8122                 . ./myread
8123                 case "$ans" in
8124                 v*) val="$define";;
8125                 *) val="$undef";;
8126                 esac;;
8127         "$define")
8128                 echo "As you already told me, signal handler returns void." >&4
8129                 val="$define"
8130                 ;;
8131         *)      echo "As you already told me, signal handler returns int." >&4
8132                 val="$undef"
8133                 ;;
8134         esac
8135 fi
8136 set d_voidsig
8137 eval $setvar
8138 case "$d_voidsig" in
8139 "$define") signal_t="void";;
8140 *) signal_t="int";;
8141 esac
8142 $rm -f $$.tmp
8143
8144 : check for ability to cast large floats to 32-bit ints.
8145 echo " "
8146 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8147 if $test "$intsize" -ge 4; then
8148         xxx=int
8149 else
8150         xxx=long
8151 fi
8152 $cat >try.c <<EOCP
8153 #include <stdio.h>
8154 #include <sys/types.h>
8155 #include <signal.h>
8156 $signal_t blech(s) int s; { exit(3); }
8157 int main()
8158 {
8159         $xxx i32;
8160         double f, g;
8161         int result = 0;
8162         char str[16];
8163         signal(SIGFPE, blech);
8164
8165         /* Don't let compiler optimize the test away.  Store the number 
8166            in a writable string for gcc to pass to sscanf under HP/UX.
8167         */
8168         sprintf(str, "2147483647");
8169         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8170         g = 10 * f;
8171         i32  = ($xxx) g;
8172
8173         /* x86 processors will probably give 0x8000 0000, which is a
8174        sign change.  We don't want that.  We want to mimic SPARC
8175            behavior here, which is to preserve the sign and give
8176            back 0x7fff ffff.
8177         */
8178         if (i32 != ($xxx) f)
8179                 result |= 1;
8180         exit(result);
8181 }
8182 EOCP
8183 set try
8184 if eval $compile_ok; then
8185         ./try
8186         yyy=$?
8187 else
8188         echo "(I can't seem to compile the test program--assuming it can't)"
8189         yyy=1
8190 fi
8191 case "$yyy" in
8192 0)      val="$define"
8193         echo "Yup, it can."
8194         ;;
8195 *)      val="$undef"
8196         echo "Nope, it can't."
8197         ;;
8198 esac
8199 set d_casti32
8200 eval $setvar
8201 $rm -f try try.*
8202
8203 : check for ability to cast negative floats to unsigned
8204 echo " "
8205 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8206 $cat >try.c <<EOCP
8207 #include <stdio.h>
8208 #include <sys/types.h>
8209 #include <signal.h>
8210 $signal_t blech(s) int s; { exit(7); }
8211 $signal_t blech_in_list(s) int s; { exit(4); }
8212 unsigned long dummy_long(p) unsigned long p; { return p; }
8213 unsigned int dummy_int(p) unsigned int p; { return p; }
8214 unsigned short dummy_short(p) unsigned short p; { return p; }
8215 int main()
8216 {
8217         double f;
8218         unsigned long along;
8219         unsigned int aint;
8220         unsigned short ashort;
8221         int result = 0;
8222         char str[16];
8223         
8224         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8225            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8226            optimized the whole file away
8227         */
8228         /* Store the number in a writable string for gcc to pass to 
8229            sscanf under HP/UX.
8230         */
8231         sprintf(str, "-123");
8232         sscanf(str, "%lf", &f);  /* f = -123.; */
8233
8234         signal(SIGFPE, blech);
8235         along = (unsigned long)f;
8236         aint = (unsigned int)f;
8237         ashort = (unsigned short)f;
8238         if (along != (unsigned long)-123)
8239                 result |= 1;
8240         if (aint != (unsigned int)-123)
8241                 result |= 1;
8242         if (ashort != (unsigned short)-123)
8243                 result |= 1;
8244         sprintf(str, "1073741824.");
8245         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8246         f = f + f;
8247         along = 0;
8248         along = (unsigned long)f;
8249         if (along != 0x80000000)
8250                 result |= 2;
8251         f -= 1.;
8252         along = 0;
8253         along = (unsigned long)f;
8254         if (along != 0x7fffffff)
8255                 result |= 1;
8256         f += 2.;
8257         along = 0;
8258         along = (unsigned long)f;
8259         if (along != 0x80000001)
8260                 result |= 2;
8261         if (result)
8262                 exit(result);
8263         signal(SIGFPE, blech_in_list);
8264         sprintf(str, "123.");
8265         sscanf(str, "%lf", &f);  /* f = 123.; */
8266         along = dummy_long((unsigned long)f);
8267         aint = dummy_int((unsigned int)f);
8268         ashort = dummy_short((unsigned short)f);
8269         if (along != (unsigned long)123)
8270                 result |= 4;
8271         if (aint != (unsigned int)123)
8272                 result |= 4;
8273         if (ashort != (unsigned short)123)
8274                 result |= 4;
8275         exit(result);
8276
8277 }
8278 EOCP
8279 set try
8280 if eval $compile_ok; then
8281         ./try
8282         castflags=$?
8283 else
8284         echo "(I can't seem to compile the test program--assuming it can't)"
8285         castflags=7
8286 fi
8287 case "$castflags" in
8288 0)      val="$define"
8289         echo "Yup, it can."
8290         ;;
8291 *)      val="$undef"
8292         echo "Nope, it can't."
8293         ;;
8294 esac
8295 set d_castneg
8296 eval $setvar
8297 $rm -f try.*
8298
8299 : see if vprintf exists
8300 echo " "
8301 if set vprintf val -f d_vprintf; eval $csym; $val; then
8302         echo 'vprintf() found.' >&4
8303         val="$define"
8304         $cat >vprintf.c <<'EOF'
8305 #include <varargs.h>
8306
8307 int main() { xxx("foo"); }
8308
8309 xxx(va_alist)
8310 va_dcl
8311 {
8312         va_list args;
8313         char buf[10];
8314
8315         va_start(args);
8316         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8317 }
8318 EOF
8319         set vprintf
8320         if eval $compile && ./vprintf; then
8321                 echo "Your vsprintf() returns (int)." >&4
8322                 val2="$undef"
8323         else
8324                 echo "Your vsprintf() returns (char*)." >&4
8325                 val2="$define"
8326         fi
8327 else
8328         echo 'vprintf() NOT found.' >&4
8329                 val="$undef"
8330                 val2="$undef"
8331 fi
8332 set d_vprintf
8333 eval $setvar
8334 val=$val2
8335 set d_charvspr
8336 eval $setvar
8337
8338 : see if chown exists
8339 set chown d_chown
8340 eval $inlibc
8341
8342 : see if chroot exists
8343 set chroot d_chroot
8344 eval $inlibc
8345
8346 : see if chsize exists
8347 set chsize d_chsize
8348 eval $inlibc
8349
8350 : check for const keyword
8351 echo " "
8352 echo 'Checking to see if your C compiler knows about "const"...' >&4
8353 $cat >const.c <<'EOCP'
8354 typedef struct spug { int drokk; } spug;
8355 int main()
8356 {
8357         const char *foo;
8358         const spug y;
8359 }
8360 EOCP
8361 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8362         val="$define"
8363         echo "Yup, it does."
8364 else
8365         val="$undef"
8366         echo "Nope, it doesn't."
8367 fi
8368 set d_const
8369 eval $setvar
8370
8371 : see if crypt exists
8372 echo " "
8373 if set crypt val -f d_crypt; eval $csym; $val; then
8374         echo 'crypt() found.' >&4
8375         val="$define"
8376         cryptlib=''
8377 else
8378         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8379         if $test -z "$cryptlib"; then
8380                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8381         else
8382                 cryptlib=-lcrypt
8383         fi
8384         if $test -z "$cryptlib"; then
8385                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8386         else
8387                 cryptlib=-lcrypt
8388         fi
8389         if $test -z "$cryptlib"; then
8390                 cryptlib=`./loc libcrypt$_a "" $libpth`
8391         else
8392                 cryptlib=-lcrypt
8393         fi
8394         if $test -z "$cryptlib"; then
8395                 echo 'crypt() NOT found.' >&4
8396                 val="$undef"
8397         else
8398                 val="$define"
8399         fi
8400 fi
8401 set d_crypt
8402 eval $setvar
8403
8404 : get csh whereabouts
8405 case "$csh" in
8406 'csh') val="$undef" ;;
8407 *) val="$define" ;;
8408 esac
8409 set d_csh
8410 eval $setvar
8411 : Respect a hint or command line value for full_csh.
8412 case "$full_csh" in
8413 '') full_csh=$csh ;;
8414 esac
8415
8416 : see if cuserid exists
8417 set cuserid d_cuserid
8418 eval $inlibc
8419
8420 : see if this is a limits.h system
8421 set limits.h i_limits
8422 eval $inhdr
8423
8424 : see if this is a float.h system
8425 set float.h i_float
8426 eval $inhdr
8427
8428 : See if number of significant digits in a double precision number is known
8429 echo " "
8430 $cat >dbl_dig.c <<EOM
8431 #$i_limits I_LIMITS
8432 #$i_float I_FLOAT
8433 #ifdef I_LIMITS
8434 #include <limits.h>
8435 #endif
8436 #ifdef I_FLOAT
8437 #include <float.h>
8438 #endif
8439 #ifdef DBL_DIG
8440 printf("Contains DBL_DIG");
8441 #endif
8442 EOM
8443 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8444 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8445         echo "DBL_DIG found." >&4
8446         val="$define"
8447 else
8448         echo "DBL_DIG NOT found." >&4
8449         val="$undef"
8450 fi
8451 $rm -f dbl_dig.?
8452 set d_dbl_dig
8453 eval $setvar
8454
8455 : see if difftime exists
8456 set difftime d_difftime
8457 eval $inlibc
8458
8459 : see if this is a dirent system
8460 echo " "
8461 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8462         val="$define"
8463         echo "<dirent.h> found." >&4
8464 else
8465         val="$undef"
8466         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8467                 echo "<sys/dir.h> found." >&4
8468                 echo " "
8469         else
8470                 xinc=`./findhdr sys/ndir.h`
8471         fi
8472         echo "<dirent.h> NOT found." >&4
8473 fi
8474 set i_dirent
8475 eval $setvar
8476
8477 : Look for type of directory structure.
8478 echo " "
8479 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8480
8481 case "$direntrytype" in
8482 ''|' ')
8483         case "$i_dirent" in
8484         $define) guess1='struct dirent' ;;
8485         *) guess1='struct direct'  ;;
8486         esac
8487         ;;
8488 *)      guess1="$direntrytype"
8489         ;;
8490 esac
8491
8492 case "$guess1" in
8493 'struct dirent') guess2='struct direct' ;;
8494 *) guess2='struct dirent' ;;
8495 esac
8496                 
8497 if $contains "$guess1" try.c >/dev/null 2>&1; then
8498         direntrytype="$guess1"
8499         echo "Your directory entries are $direntrytype." >&4
8500 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8501         direntrytype="$guess2"
8502         echo "Your directory entries seem to be $direntrytype." >&4
8503 else
8504         echo "I don't recognize your system's directory entries." >&4
8505         rp="What type is used for directory entries on this system?"
8506         dflt="$guess1"
8507         . ./myread
8508         direntrytype="$ans"
8509 fi
8510 $rm -f try.c
8511
8512
8513 : see if the directory entry stores field length
8514 echo " "
8515 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8516 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8517         echo "Good, your directory entry keeps length information in d_namlen." >&4
8518         val="$define"
8519 else
8520         echo "Your directory entry does not know about the d_namlen field." >&4
8521         val="$undef"
8522 fi
8523 set d_dirnamlen
8524 eval $setvar
8525 $rm -f try.c
8526
8527 : see if dlerror exists
8528 xxx_runnm="$runnm"
8529 runnm=false
8530 set dlerror d_dlerror
8531 eval $inlibc
8532 runnm="$xxx_runnm"
8533
8534 : see if dlfcn is available
8535 set dlfcn.h i_dlfcn
8536 eval $inhdr
8537
8538 case "$usedl" in
8539 $define|y|true)
8540         $cat << EOM
8541
8542 On a few systems, the dynamically loaded modules that perl generates and uses
8543 will need a different extension than shared libs. The default will probably
8544 be appropriate.
8545
8546 EOM
8547         case "$dlext" in
8548         '')     dflt="$so" ;;
8549         *)      dflt="$dlext" ;;
8550         esac
8551         rp='What is the extension of dynamically loaded modules'
8552         . ./myread
8553         dlext="$ans"
8554         ;;
8555 *)
8556         dlext="none"
8557         ;;
8558 esac
8559
8560 : Check if dlsym need a leading underscore
8561 echo " "
8562 val="$undef"
8563
8564 case "$dlsrc" in
8565 dl_dlopen.xs)
8566         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8567         $cat >dyna.c <<'EOM'
8568 fred () { }
8569 EOM
8570
8571 $cat >fred.c<<EOM
8572
8573 #include <stdio.h>
8574 #$i_dlfcn I_DLFCN
8575 #ifdef I_DLFCN
8576 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8577 #else
8578 #include <sys/types.h>
8579 #include <nlist.h>
8580 #include <link.h>
8581 #endif
8582
8583 extern int fred() ;
8584
8585 int main()
8586 {
8587     void * handle ;
8588     void * symbol ;
8589 #ifndef RTLD_LAZY
8590     int mode = 1 ;
8591 #else
8592     int mode = RTLD_LAZY ;
8593 #endif
8594     handle = dlopen("./dyna.$dlext", mode) ;
8595     if (handle == NULL) {
8596         printf ("1\n") ;
8597         fflush (stdout) ;
8598         exit(0);
8599     }
8600     symbol = dlsym(handle, "fred") ;
8601     if (symbol == NULL) {
8602         /* try putting a leading underscore */
8603         symbol = dlsym(handle, "_fred") ;
8604         if (symbol == NULL) {
8605             printf ("2\n") ;
8606             fflush (stdout) ;
8607             exit(0);
8608         }
8609         printf ("3\n") ;
8610     }
8611     else
8612         printf ("4\n") ;
8613     fflush (stdout) ;
8614     exit(0);
8615 }
8616 EOM
8617         : Call the object file tmp-dyna.o in case dlext=o.
8618         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8619                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8620                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8621                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8622                 xxx=`./fred`
8623                 case $xxx in
8624                 1)      echo "Test program failed using dlopen." >&4
8625                         echo "Perhaps you should not use dynamic loading." >&4;;
8626                 2)      echo "Test program failed using dlsym." >&4
8627                         echo "Perhaps you should not use dynamic loading." >&4;;
8628                 3)      echo "dlsym needs a leading underscore" >&4
8629                         val="$define" ;;
8630                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8631                 esac
8632         else
8633                 echo "I can't compile and run the test program." >&4
8634                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8635         fi
8636         ;;
8637 esac
8638                 
8639 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8640
8641 set d_dlsymun
8642 eval $setvar
8643
8644 hasproto='varname=$1; func=$2; shift; shift;
8645 while $test $# -ge 2; do
8646         case "$1" in
8647         $define) echo "#include <$2>";;
8648         esac ;
8649     shift 2;
8650 done > try.c;
8651 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8652 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8653         echo "$func() prototype found.";
8654         val="$define";
8655 else
8656         echo "$func() prototype NOT found.";
8657         val="$undef";
8658 fi;
8659 set $varname;
8660 eval $setvar;
8661 $rm -f try.c tryout.c'
8662
8663 : see if prototype for drand48 is available
8664 echo " "
8665 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8666 eval $hasproto
8667
8668 : see if dup2 exists
8669 set dup2 d_dup2
8670 eval $inlibc
8671
8672 : see if eaccess exists
8673 set eaccess d_eaccess
8674 eval $inlibc
8675
8676 : see if endgrent exists
8677 set endgrent d_endgrent
8678 eval $inlibc
8679
8680 : see if endhostent exists
8681 set endhostent d_endhent
8682 eval $inlibc
8683
8684 : see if endnetent exists
8685 set endnetent d_endnent
8686 eval $inlibc
8687
8688 : see if endprotoent exists
8689 set endprotoent d_endpent
8690 eval $inlibc
8691
8692 : see if endpwent exists
8693 set endpwent d_endpwent
8694 eval $inlibc
8695
8696 : see if endservent exists
8697 set endservent d_endsent
8698 eval $inlibc
8699
8700 : Locate the flags for 'open()'
8701 echo " "
8702 $cat >open3.c <<'EOCP'
8703 #include <sys/types.h>
8704 #ifdef I_FCNTL
8705 #include <fcntl.h>
8706 #endif
8707 #ifdef I_SYS_FILE
8708 #include <sys/file.h>
8709 #endif
8710 int main() {
8711         if(O_RDONLY);
8712 #ifdef O_TRUNC
8713         exit(0);
8714 #else
8715         exit(1);
8716 #endif
8717 }
8718 EOCP
8719 : check sys/file.h first to get FREAD on Sun
8720 if $test `./findhdr sys/file.h` && \
8721                 set open3 -DI_SYS_FILE && eval $compile; then
8722         h_sysfile=true;
8723         echo "<sys/file.h> defines the O_* constants..." >&4
8724         if ./open3; then
8725                 echo "and you have the 3 argument form of open()." >&4
8726                 val="$define"
8727         else
8728                 echo "but not the 3 argument form of open().  Oh, well." >&4
8729                 val="$undef"
8730         fi
8731 elif $test `./findhdr fcntl.h` && \
8732                 set open3 -DI_FCNTL && eval $compile; then
8733         h_fcntl=true;
8734         echo "<fcntl.h> defines the O_* constants..." >&4
8735         if ./open3; then
8736                 echo "and you have the 3 argument form of open()." >&4
8737                 val="$define"
8738         else
8739                 echo "but not the 3 argument form of open().  Oh, well." >&4
8740                 val="$undef"
8741         fi
8742 else
8743         val="$undef"
8744         echo "I can't find the O_* constant definitions!  You got problems." >&4
8745 fi
8746 set d_open3
8747 eval $setvar
8748 $rm -f open3*
8749
8750 : see which of string.h or strings.h is needed
8751 echo " "
8752 strings=`./findhdr string.h`
8753 if $test "$strings" && $test -r "$strings"; then
8754         echo "Using <string.h> instead of <strings.h>." >&4
8755         val="$define"
8756 else
8757         val="$undef"
8758         strings=`./findhdr strings.h`
8759         if $test "$strings" && $test -r "$strings"; then
8760                 echo "Using <strings.h> instead of <string.h>." >&4
8761         else
8762                 echo "No string header found -- You'll surely have problems." >&4
8763         fi
8764 fi
8765 set i_string
8766 eval $setvar
8767 case "$i_string" in
8768 "$undef") strings=`./findhdr strings.h`;;
8769 *)        strings=`./findhdr string.h`;;
8770 esac
8771
8772 : check for non-blocking I/O stuff
8773 case "$h_sysfile" in
8774 true) echo "#include <sys/file.h>" > head.c;;
8775 *)
8776         case "$h_fcntl" in
8777         true) echo "#include <fcntl.h>" > head.c;;
8778         *) echo "#include <sys/fcntl.h>" > head.c;;
8779         esac
8780         ;;
8781 esac
8782 echo " "
8783 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8784 case "$o_nonblock" in
8785 '')
8786         $cat head.c > try.c
8787         $cat >>try.c <<'EOCP'
8788 #include <stdio.h>
8789 int main() {
8790 #ifdef O_NONBLOCK
8791         printf("O_NONBLOCK\n");
8792         exit(0);
8793 #endif
8794 #ifdef O_NDELAY
8795         printf("O_NDELAY\n");
8796         exit(0);
8797 #endif
8798 #ifdef FNDELAY
8799         printf("FNDELAY\n");
8800         exit(0);
8801 #endif
8802         exit(0);
8803 }
8804 EOCP
8805         set try
8806         if eval $compile_ok; then
8807                 o_nonblock=`./try`
8808                 case "$o_nonblock" in
8809                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8810                 *) echo "Seems like we can use $o_nonblock.";;
8811                 esac
8812         else
8813                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8814         fi
8815         ;;
8816 *) echo "Using $hint value $o_nonblock.";;
8817 esac
8818 $rm -f try try.* .out core
8819
8820 echo " "
8821 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8822 case "$eagain" in
8823 '')
8824         $cat head.c > try.c
8825         $cat >>try.c <<EOCP
8826 #include <errno.h>
8827 #include <sys/types.h>
8828 #include <signal.h>
8829 #include <stdio.h> 
8830 #define MY_O_NONBLOCK $o_nonblock
8831 #ifndef errno  /* XXX need better Configure test */
8832 extern int errno;
8833 #endif
8834 #$i_unistd I_UNISTD
8835 #ifdef I_UNISTD
8836 #include <unistd.h>
8837 #endif
8838 #$i_string I_STRING
8839 #ifdef I_STRING
8840 #include <string.h>
8841 #else
8842 #include <strings.h>
8843 #endif
8844 $signal_t blech(x) int x; { exit(3); }
8845 EOCP
8846         $cat >> try.c <<'EOCP'
8847 int main()
8848 {
8849         int pd[2];
8850         int pu[2];
8851         char buf[1];
8852         char string[100];
8853
8854         pipe(pd);       /* Down: child -> parent */
8855         pipe(pu);       /* Up: parent -> child */
8856         if (0 != fork()) {
8857                 int ret;
8858                 close(pd[1]);   /* Parent reads from pd[0] */
8859                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8860                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8861                         exit(1);
8862                 signal(SIGALRM, blech);
8863                 alarm(5);
8864                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8865                         exit(2);
8866                 sprintf(string, "%d\n", ret);
8867                 write(2, string, strlen(string));
8868                 alarm(0);
8869 #ifdef EAGAIN
8870                 if (errno == EAGAIN) {
8871                         printf("EAGAIN\n");
8872                         goto ok;
8873                 }
8874 #endif
8875 #ifdef EWOULDBLOCK
8876                 if (errno == EWOULDBLOCK)
8877                         printf("EWOULDBLOCK\n");
8878 #endif
8879         ok:
8880                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8881                 sleep(2);                               /* Give it time to close our pipe */
8882                 alarm(5);
8883                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8884                 alarm(0);
8885                 sprintf(string, "%d\n", ret);
8886                 write(3, string, strlen(string));
8887                 exit(0);
8888         }
8889
8890         close(pd[0]);                   /* We write to pd[1] */
8891         close(pu[1]);                   /* We read from pu[0] */
8892         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8893         close(pd[1]);                   /* Pipe pd is now fully closed! */
8894         exit(0);                                /* Bye bye, thank you for playing! */
8895 }
8896 EOCP
8897         set try
8898         if eval $compile_ok; then
8899                 echo "$startsh" >mtry
8900                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8901                 chmod +x mtry
8902                 ./mtry >/dev/null 2>&1
8903                 case $? in
8904                 0) eagain=`$cat try.out`;;
8905                 1) echo "Could not perform non-blocking setting!";;
8906                 2) echo "I did a successful read() for something that was not there!";;
8907                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8908                 *) echo "Something terribly wrong happened during testing.";;
8909                 esac
8910                 rd_nodata=`$cat try.ret`
8911                 echo "A read() system call with no data present returns $rd_nodata."
8912                 case "$rd_nodata" in
8913                 0|-1) ;;
8914                 *)
8915                         echo "(That's peculiar, fixing that to be -1.)"
8916                         rd_nodata=-1
8917                         ;;
8918                 esac
8919                 case "$eagain" in
8920                 '')
8921                         echo "Forcing errno EAGAIN on read() with no data available."
8922                         eagain=EAGAIN
8923                         ;;
8924                 *)
8925                         echo "Your read() sets errno to $eagain when no data is available."
8926                         ;;
8927                 esac
8928                 status=`$cat try.err`
8929                 case "$status" in
8930                 0) echo "And it correctly returns 0 to signal EOF.";;
8931                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8932                 *) echo "However, your read() returns '$status' on EOF??";;
8933                 esac
8934                 val="$define"
8935                 if test "$status" = "$rd_nodata"; then
8936                         echo "WARNING: you can't distinguish between EOF and no data!"
8937                         val="$undef"
8938                 fi
8939         else
8940                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8941                 eagain=EAGAIN
8942         fi
8943         set d_eofnblk
8944         eval $setvar
8945         ;;
8946 *)
8947         echo "Using $hint value $eagain."
8948         echo "Your read() returns $rd_nodata when no data is present."
8949         case "$d_eofnblk" in
8950         "$define") echo "And you can see EOF because read() returns 0.";;
8951         "$undef") echo "But you can't see EOF status from read() returned value.";;
8952         *)
8953                 echo "(Assuming you can't see EOF status from read anyway.)"
8954                 d_eofnblk=$undef
8955                 ;;
8956         esac
8957         ;;
8958 esac
8959 $rm -f try try.* .out core head.c mtry
8960
8961 : see if fchmod exists
8962 set fchmod d_fchmod
8963 eval $inlibc
8964
8965 : see if fchown exists
8966 set fchown d_fchown
8967 eval $inlibc
8968
8969 : see if this is an fcntl system
8970 set fcntl d_fcntl
8971 eval $inlibc
8972
8973 echo " "
8974 : See if fcntl-based locking works.
8975 $cat >try.c <<'EOCP'
8976 #include <stdlib.h>
8977 #include <unistd.h>
8978 #include <fcntl.h>
8979 int main() {
8980 #if defined(F_SETLK) && defined(F_SETLKW)
8981      struct flock flock;
8982      int retval, fd;
8983      fd = open("try.c", O_RDONLY);
8984      flock.l_type = F_RDLCK;
8985      flock.l_whence = SEEK_SET;
8986      flock.l_start = flock.l_len = 0;
8987      retval = fcntl(fd, F_SETLK, &flock);
8988      close(fd);
8989      (retval < 0 ? exit(2) : exit(0));
8990 #else
8991      exit(2);
8992 #endif
8993 }
8994 EOCP
8995 echo "Checking if fcntl-based file locking works... "
8996 case "$d_fcntl" in
8997 "$define")
8998         set try
8999         if eval $compile_ok; then
9000                 if ./try; then
9001                         echo "Yes, it seems to work."
9002                         val="$define"
9003                 else
9004                         echo "Nope, it didn't work."
9005                         val="$undef"
9006                 fi
9007         else
9008                 echo "I'm unable to compile the test program, so I'll assume not."
9009                 val="$undef"
9010         fi
9011         ;;
9012 *) val="$undef";
9013         echo "Nope, since you don't even have fcntl()."
9014         ;;
9015 esac
9016 set d_fcntl_can_lock
9017 eval $setvar
9018 $rm -f try*
9019
9020
9021 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9022 while $test $# -ge 2; do
9023         case "$1" in
9024         $define) echo "#include <$2>";;
9025         esac ;
9026     shift 2;
9027 done > try.c;
9028 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9029 set try;
9030 if eval $compile; then
9031         val="$define";
9032 else
9033         val="$undef";
9034 fi;
9035 set $varname;
9036 eval $setvar;
9037 $rm -f try.c try.o'
9038
9039 socketlib=''
9040 sockethdr=''
9041 : see whether socket exists
9042 echo " "
9043 $echo $n "Hmm... $c" >&4
9044 if set socket val -f d_socket; eval $csym; $val; then
9045         echo "Looks like you have Berkeley networking support." >&4
9046         d_socket="$define"
9047         if set setsockopt val -f; eval $csym; $val; then
9048                 d_oldsock="$undef"
9049         else
9050                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9051                 d_oldsock="$define"
9052         fi
9053 else
9054         if $contains socklib libc.list >/dev/null 2>&1; then
9055                 echo "Looks like you have Berkeley networking support." >&4
9056                 d_socket="$define"
9057                 : we will have to assume that it supports the 4.2 BSD interface
9058                 d_oldsock="$undef"
9059         else
9060                 echo "You don't have Berkeley networking in libc$_a..." >&4
9061                 if test "X$d_socket" = "X$define"; then
9062                    echo "...but you seem to believe that you have sockets." >&4
9063                 else
9064                         for net in net socket
9065                         do
9066                                 if test -f /usr/lib/lib$net$_a; then
9067                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9068                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9069                                         if $contains socket libc.list >/dev/null 2>&1; then
9070                                                 d_socket="$define"
9071                                                 socketlib="-l$net"
9072                                                 case "$net" in
9073                                                 net)
9074                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9075                                                         sockethdr="-I/usr/netinclude"
9076                                                         ;;
9077                                                 esac
9078                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9079                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9080                                                         d_oldsock="$undef"
9081                                                 else
9082                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9083                                                         d_oldsock="$define"
9084                                                 fi
9085                                                 break
9086                                         fi
9087                                 fi
9088                         done
9089                         if test "X$d_socket" != "X$define"; then
9090                            echo "or anywhere else I see." >&4
9091                            d_socket="$undef"
9092                            d_oldsock="$undef"
9093                         fi
9094                 fi
9095         fi
9096 fi
9097
9098 : see if socketpair exists
9099 set socketpair d_sockpair
9100 eval $inlibc
9101
9102
9103 echo " "
9104 echo "Checking the availability of certain socket constants..." >& 4
9105 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9106         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9107         $cat >try.c <<EOF
9108 #include <sys/types.h>
9109 #include <sys/socket.h>
9110 int main() {
9111     int i = $ENUM;
9112 }
9113 EOF
9114         val="$undef"
9115         set try; if eval $compile; then
9116                 val="$define"
9117         fi
9118         set d_${enum}; eval $setvar
9119         $rm -f try.c try
9120 done
9121
9122 : see if sys/select.h has to be included
9123 set sys/select.h i_sysselct
9124 eval $inhdr
9125
9126 : see if we should include time.h, sys/time.h, or both
9127 echo " "
9128 if test "X$timeincl" = X; then
9129         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9130         $echo $n "I'm now running the test program...$c"
9131         $cat >try.c <<'EOCP'
9132 #include <sys/types.h>
9133 #ifdef I_TIME
9134 #include <time.h>
9135 #endif
9136 #ifdef I_SYSTIME
9137 #ifdef SYSTIMEKERNEL
9138 #define KERNEL
9139 #endif
9140 #include <sys/time.h>
9141 #endif
9142 #ifdef I_SYSSELECT
9143 #include <sys/select.h>
9144 #endif
9145 int main()
9146 {
9147         struct tm foo;
9148 #ifdef S_TIMEVAL
9149         struct timeval bar;
9150 #endif
9151 #ifdef S_TIMEZONE
9152         struct timezone tzp;
9153 #endif
9154         if (foo.tm_sec == foo.tm_sec)
9155                 exit(0);
9156 #ifdef S_TIMEVAL
9157         if (bar.tv_sec == bar.tv_sec)
9158                 exit(0);
9159 #endif
9160         exit(1);
9161 }
9162 EOCP
9163         flags=''
9164         for s_timezone in '-DS_TIMEZONE' ''; do
9165         sysselect=''
9166         for s_timeval in '-DS_TIMEVAL' ''; do
9167         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9168         for i_time in '' '-DI_TIME'; do
9169         for i_systime in '-DI_SYSTIME' ''; do
9170                 case "$flags" in
9171                 '') $echo $n ".$c"
9172                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9173                         if eval $compile; then
9174                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9175                                 shift
9176                                 flags="$*"
9177                                 echo " "
9178                                 $echo $n "Succeeded with $flags$c"
9179                         fi
9180                         ;;
9181                 esac
9182         done
9183         done
9184         done
9185         done
9186         done
9187         timeincl=''
9188         echo " "
9189         case "$flags" in
9190         *SYSTIMEKERNEL*) i_systimek="$define"
9191                 timeincl=`./findhdr sys/time.h`
9192                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9193         *) i_systimek="$undef";;
9194         esac
9195         case "$flags" in
9196         *I_TIME*) i_time="$define"
9197                 timeincl=`./findhdr time.h`" $timeincl"
9198                 echo "We'll include <time.h>." >&4;;
9199         *) i_time="$undef";;
9200         esac
9201         case "$flags" in
9202         *I_SYSTIME*) i_systime="$define"
9203                 timeincl=`./findhdr sys/time.h`" $timeincl"
9204                 echo "We'll include <sys/time.h>." >&4;;
9205         *) i_systime="$undef";;
9206         esac
9207         $rm -f try.c try
9208 fi
9209
9210 : check for fd_set items
9211 $cat <<EOM
9212
9213 Checking to see how well your C compiler handles fd_set and friends ...
9214 EOM
9215 $cat >fd_set.c <<EOCP
9216 #$i_systime I_SYS_TIME
9217 #$i_sysselct I_SYS_SELECT
9218 #$d_socket HAS_SOCKET
9219 #include <sys/types.h>
9220 #ifdef HAS_SOCKET
9221 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9222 #endif
9223 #ifdef I_SYS_TIME
9224 #include <sys/time.h>
9225 #endif
9226 #ifdef I_SYS_SELECT
9227 #include <sys/select.h>
9228 #endif
9229 int main() {
9230         fd_set fds;
9231
9232 #ifdef TRYBITS
9233         if(fds.fds_bits);
9234 #endif
9235
9236 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9237         exit(0);
9238 #else
9239         exit(1);
9240 #endif
9241 }
9242 EOCP
9243 set fd_set -DTRYBITS
9244 if eval $compile; then
9245         d_fds_bits="$define"
9246         d_fd_set="$define"
9247         echo "Well, your system knows about the normal fd_set typedef..." >&4
9248         if ./fd_set; then
9249                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9250                 d_fd_macros="$define"
9251         else
9252                 $cat >&4 <<'EOM'
9253 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9254 EOM
9255                 d_fd_macros="$undef"
9256         fi
9257 else
9258         $cat <<'EOM'
9259 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9260 EOM
9261         set fd_set
9262         if eval $compile; then
9263                 d_fds_bits="$undef"
9264                 d_fd_set="$define"
9265                 echo "Well, your system has some sort of fd_set available..." >&4
9266                 if ./fd_set; then
9267                         echo "and you have the normal fd_set macros." >&4
9268                         d_fd_macros="$define"
9269                 else
9270                         $cat <<'EOM'
9271 but not the normal fd_set macros!  Gross!  More work for me...
9272 EOM
9273                         d_fd_macros="$undef"
9274                 fi
9275         else
9276         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9277                 d_fd_set="$undef"
9278                 d_fds_bits="$undef"
9279                 d_fd_macros="$undef"
9280         fi
9281 fi
9282 $rm -f fd_set*
9283
9284 : see if fgetpos exists
9285 set fgetpos d_fgetpos
9286 eval $inlibc
9287
9288 : see if flock exists
9289 set flock d_flock
9290 eval $inlibc
9291
9292 : see if fork exists
9293 set fork d_fork
9294 eval $inlibc
9295
9296 : see if pathconf exists
9297 set pathconf d_pathconf
9298 eval $inlibc
9299
9300 : see if fpathconf exists
9301 set fpathconf d_fpathconf
9302 eval $inlibc
9303
9304
9305 : check for fpos64_t
9306 echo " "
9307 echo "Checking to see if you have fpos64_t..." >&4
9308 $cat >try.c <<EOCP
9309 #include <stdio.h>
9310 int main() { fpos64_t x = 7; }
9311 EOCP
9312 set try
9313 if eval $compile; then
9314         val="$define"
9315         echo "You have fpos64_t."
9316 else
9317         val="$undef"
9318         echo "You do not have fpos64_t."
9319         case "$fpossize" in
9320         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9321         esac
9322 fi
9323 $rm -f try.* try
9324 set d_fpos64_t
9325 eval $setvar
9326
9327 : see if frexpl exists
9328 set frexpl d_frexpl
9329 eval $inlibc
9330
9331 hasstruct='varname=$1; struct=$2; shift; shift;
9332 while $test $# -ge 2; do
9333         case "$1" in
9334         $define) echo "#include <$2>";;
9335         esac ;
9336     shift 2;
9337 done > try.c;
9338 echo "int main () { struct $struct foo; }" >> try.c;
9339 set try;
9340 if eval $compile; then
9341         val="$define";
9342 else
9343         val="$undef";
9344 fi;
9345 set $varname;
9346 eval $setvar;
9347 $rm -f try.c try.o'
9348
9349 : see if this is a sys/param system
9350 set sys/param.h i_sysparam
9351 eval $inhdr
9352
9353 : see if this is a sys/mount.h system
9354 set sys/mount.h i_sysmount
9355 eval $inhdr
9356
9357 : see if sys/types.h has to be included
9358 set sys/types.h i_systypes
9359 eval $inhdr
9360
9361
9362 echo " "
9363 echo "Checking to see if your system supports struct fs_data..." >&4
9364 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9365 eval $hasstruct
9366 case "$d_fs_data_s" in
9367 "$define")      echo "Yes, it does."   ;;
9368 *)              echo "No, it doesn't." ;;
9369 esac
9370
9371 : see if fseeko exists
9372 set fseeko d_fseeko
9373 eval $inlibc
9374 case "$longsize" in
9375 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9376 esac
9377
9378 : see if fsetpos exists
9379 set fsetpos d_fsetpos
9380 eval $inlibc
9381
9382
9383 : see if fstatfs exists
9384 set fstatfs d_fstatfs
9385 eval $inlibc
9386
9387
9388 : see if statvfs exists
9389 set statvfs d_statvfs
9390 eval $inlibc
9391
9392 : see if fstatvfs exists
9393 set fstatvfs d_fstatvfs
9394 eval $inlibc
9395
9396
9397 : see if fsync exists
9398 set fsync d_fsync
9399 eval $inlibc
9400
9401 : see if ftello exists
9402 set ftello d_ftello
9403 eval $inlibc
9404 case "$longsize" in
9405 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9406 esac
9407
9408 : see if getcwd exists
9409 set getcwd d_getcwd
9410 eval $inlibc
9411
9412 : see if getespwnam exists
9413 set getespwnam d_getespwnam
9414 eval $inlibc
9415
9416
9417 : see if getfsstat exists
9418 set getfsstat d_getfsstat
9419 eval $inlibc
9420
9421 : see if getgrent exists
9422 set getgrent d_getgrent
9423 eval $inlibc
9424
9425 : see if gethostbyaddr exists
9426 set gethostbyaddr d_gethbyaddr
9427 eval $inlibc
9428
9429 : see if gethostbyname exists
9430 set gethostbyname d_gethbyname
9431 eval $inlibc
9432
9433 : see if gethostent exists
9434 set gethostent d_gethent
9435 eval $inlibc
9436
9437 : see how we will look up host name
9438 echo " "
9439 call=''
9440 if set gethostname val -f d_gethname; eval $csym; $val; then
9441         echo 'gethostname() found.' >&4
9442         d_gethname="$define"
9443         call=gethostname
9444 fi
9445 if set uname val -f d_uname; eval $csym; $val; then
9446         if ./xenix; then
9447                 $cat <<'EOM'
9448 uname() was found, but you're running xenix, and older versions of xenix
9449 have a broken uname(). If you don't really know whether your xenix is old
9450 enough to have a broken system call, use the default answer.
9451
9452 EOM
9453                 dflt=y
9454                 case "$d_uname" in
9455                 "$define") dflt=n;;
9456                 esac
9457                 rp='Is your uname() broken?'
9458                 . ./myread
9459                 case "$ans" in
9460                 n*) d_uname="$define"; call=uname;;
9461                 esac
9462         else
9463                 echo 'uname() found.' >&4
9464                 d_uname="$define"
9465                 case "$call" in
9466                 '') call=uname ;;
9467                 esac
9468         fi
9469 fi
9470 case "$d_gethname" in
9471 '') d_gethname="$undef";;
9472 esac
9473 case "$d_uname" in
9474 '') d_uname="$undef";;
9475 esac
9476 case "$d_uname$d_gethname" in
9477 *define*)
9478         dflt=n
9479         cat <<EOM
9480  
9481 Every now and then someone has a $call() that lies about the hostname
9482 but can't be fixed for political or economic reasons.  If you wish, I can
9483 pretend $call() isn't there and maybe compute hostname at run-time
9484 thanks to the '$phostname' command.
9485
9486 EOM
9487         rp="Shall I ignore $call() from now on?"
9488         . ./myread
9489         case "$ans" in
9490         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9491         esac;;
9492 esac
9493 case "$phostname" in
9494 '') aphostname='';;
9495 *) case "$aphostname" in
9496         /*) ;;
9497         *) set X $phostname
9498                 shift
9499                 file=$1
9500                 shift
9501                 file=`./loc $file $file $pth`
9502                 aphostname=`echo $file $*`
9503                 ;;
9504         esac
9505         ;;
9506 esac
9507 case "$d_uname$d_gethname" in
9508 *define*) ;;
9509 *)
9510         case "$phostname" in
9511         '')
9512                 echo "There will be no way for $package to get your hostname." >&4;;
9513         *)
9514         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9515                 ;;
9516         esac;;
9517 esac
9518 case "$d_phostname" in
9519 '') d_phostname="$undef";;
9520 esac
9521
9522 : see if this is a netdb.h system
9523 set netdb.h i_netdb
9524 eval $inhdr
9525
9526 : see if prototypes for various gethostxxx netdb.h functions are available
9527 echo " "
9528 set d_gethostprotos gethostent $i_netdb netdb.h
9529 eval $hasproto
9530
9531 : see if getlogin exists
9532 set getlogin d_getlogin
9533 eval $inlibc
9534
9535 : see if getmnt exists
9536 set getmnt d_getmnt
9537 eval $inlibc
9538
9539 : see if getmntent exists
9540 set getmntent d_getmntent
9541 eval $inlibc
9542
9543 : see if getnetbyaddr exists
9544 set getnetbyaddr d_getnbyaddr
9545 eval $inlibc
9546
9547 : see if getnetbyname exists
9548 set getnetbyname d_getnbyname
9549 eval $inlibc
9550
9551 : see if getnetent exists
9552 set getnetent d_getnent
9553 eval $inlibc
9554
9555 : see if prototypes for various getnetxxx netdb.h functions are available
9556 echo " "
9557 set d_getnetprotos getnetent $i_netdb netdb.h
9558 eval $hasproto
9559
9560 : see if getpagesize exists
9561 set getpagesize d_getpagsz
9562 eval $inlibc
9563
9564
9565 : see if getprotobyname exists
9566 set getprotobyname d_getpbyname
9567 eval $inlibc
9568
9569 : see if getprotobynumber exists
9570 set getprotobynumber d_getpbynumber
9571 eval $inlibc
9572
9573 : see if getprotoent exists
9574 set getprotoent d_getpent
9575 eval $inlibc
9576
9577 : see if getpgid exists
9578 set getpgid d_getpgid
9579 eval $inlibc
9580
9581 : see if getpgrp2 exists
9582 set getpgrp2 d_getpgrp2
9583 eval $inlibc
9584
9585 : see if getppid exists
9586 set getppid d_getppid
9587 eval $inlibc
9588
9589 : see if getpriority exists
9590 set getpriority d_getprior
9591 eval $inlibc
9592
9593 : see if prototypes for various getprotoxxx netdb.h functions are available
9594 echo " "
9595 set d_getprotoprotos getprotoent $i_netdb netdb.h
9596 eval $hasproto
9597
9598 : see if getprpwnam exists
9599 set getprpwnam d_getprpwnam
9600 eval $inlibc
9601
9602 : see if getpwent exists
9603 set getpwent d_getpwent
9604 eval $inlibc
9605
9606
9607 : see if getservbyname exists
9608 set getservbyname d_getsbyname
9609 eval $inlibc
9610
9611 : see if getservbyport exists
9612 set getservbyport d_getsbyport
9613 eval $inlibc
9614
9615 : see if getservent exists
9616 set getservent d_getsent
9617 eval $inlibc
9618
9619 : see if prototypes for various getservxxx netdb.h functions are available
9620 echo " "
9621 set d_getservprotos getservent $i_netdb netdb.h
9622 eval $hasproto
9623
9624 : see if getspnam exists
9625 set getspnam d_getspnam
9626 eval $inlibc
9627
9628 : see if gettimeofday or ftime exists
9629 set gettimeofday d_gettimeod
9630 eval $inlibc
9631 case "$d_gettimeod" in
9632 "$undef")
9633         set ftime d_ftime 
9634         eval $inlibc
9635         ;;
9636 *)
9637         val="$undef"; set d_ftime; eval $setvar
9638         ;;
9639 esac
9640 case "$d_gettimeod$d_ftime" in
9641 "$undef$undef")
9642         echo " "
9643         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9644         ;;
9645 esac
9646
9647 : see if this is an grp system
9648 set grp.h i_grp
9649 eval $inhdr
9650
9651 case "$i_grp" in
9652 $define)
9653         xxx=`./findhdr grp.h`
9654         $cppstdin $cppflags $cppminus < $xxx >$$.h
9655
9656         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9657                 val="$define"
9658         else
9659                 val="$undef"
9660         fi
9661         set d_grpasswd
9662         eval $setvar
9663
9664         $rm -f $$.h
9665         ;;
9666 *)
9667         val="$undef";
9668         set d_grpasswd; eval $setvar
9669         ;;
9670 esac
9671
9672 : see if hasmntopt exists
9673 set hasmntopt d_hasmntopt
9674 eval $inlibc
9675
9676 : see if this is a netinet/in.h or sys/in.h system
9677 set netinet/in.h i_niin sys/in.h i_sysin
9678 eval $inhdr
9679
9680 : see if arpa/inet.h has to be included
9681 set arpa/inet.h i_arpainet
9682 eval $inhdr
9683
9684 : see if htonl --and friends-- exists
9685 val=''
9686 set htonl val
9687 eval $inlibc
9688
9689 : Maybe they are macros.
9690 case "$val" in
9691 $undef)
9692         $cat >htonl.c <<EOM
9693 #include <stdio.h>
9694 #include <sys/types.h>
9695 #$i_niin I_NETINET_IN
9696 #$i_sysin I_SYS_IN
9697 #$i_arpainet I_ARPA_INET
9698 #ifdef I_NETINET_IN
9699 #include <netinet/in.h>
9700 #endif
9701 #ifdef I_SYS_IN
9702 #include <sys/in.h>
9703 #endif
9704 #ifdef I_ARPA_INET
9705 #include <arpa/inet.h>
9706 #endif
9707 #ifdef htonl
9708 printf("Defined as a macro.");
9709 #endif
9710 EOM
9711         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9712         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9713                 val="$define"
9714                 echo "But it seems to be defined as a macro." >&4
9715         fi
9716         $rm -f htonl.?
9717         ;;
9718 esac
9719 set d_htonl
9720 eval $setvar
9721
9722 : see if iconv exists
9723 set iconv d_iconv
9724 eval $inlibc
9725
9726 : index or strchr
9727 echo " "
9728 if set index val -f; eval $csym; $val; then
9729         if set strchr val -f d_strchr; eval $csym; $val; then
9730                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9731                         val="$define"
9732                         vali="$undef"
9733                         echo "strchr() found." >&4
9734                 else
9735                         val="$undef"
9736                         vali="$define"
9737                         echo "index() found." >&4
9738                 fi
9739         else
9740                 val="$undef"
9741                 vali="$define"
9742                 echo "index() found." >&4
9743         fi
9744 else
9745         if set strchr val -f d_strchr; eval $csym; $val; then
9746                 val="$define"
9747                 vali="$undef"
9748                 echo "strchr() found." >&4
9749         else
9750                 echo "No index() or strchr() found!" >&4
9751                 val="$undef"
9752                 vali="$undef"
9753         fi
9754 fi
9755 set d_strchr; eval $setvar
9756 val="$vali"
9757 set d_index; eval $setvar
9758
9759 : check whether inet_aton exists
9760 set inet_aton d_inetaton
9761 eval $inlibc
9762
9763 : see if inttypes.h is available
9764 : we want a real compile instead of Inhdr because some systems
9765 : have an inttypes.h which includes non-existent headers
9766 echo " "
9767 $cat >try.c <<EOCP
9768 #include <inttypes.h>
9769 int main() {
9770         static int32_t foo32 = 0x12345678;
9771 }
9772 EOCP
9773 set try
9774 if eval $compile; then
9775         echo "<inttypes.h> found." >&4
9776         val="$define"
9777 else
9778         echo "<inttypes.h> NOT found." >&4
9779         val="$undef"
9780 fi
9781 $rm -f try.c try
9782 set i_inttypes
9783 eval $setvar
9784
9785 : check for int64_t
9786 echo " "
9787 echo "Checking to see if you have int64_t..." >&4
9788 $cat >try.c <<EOCP
9789 #include <sys/types.h>
9790 #$i_inttypes I_INTTYPES
9791 #ifdef I_INTTYPES
9792 #include <inttypes.h>
9793 #endif
9794 int main() { int64_t x = 7; }
9795 EOCP
9796 set try
9797 if eval $compile; then
9798         val="$define"
9799         echo "You have int64_t."
9800 else
9801         val="$undef"
9802         echo "You do not have int64_t."
9803 fi
9804 $rm -f try try.*
9805 set d_int64_t
9806 eval $setvar
9807
9808 : Look for isascii
9809 echo " "
9810 $cat >isascii.c <<'EOCP'
9811 #include <stdio.h>
9812 #include <ctype.h>
9813 int main() {
9814         int c = 'A';
9815         if (isascii(c))
9816                 exit(0);
9817         else
9818                 exit(1);
9819 }
9820 EOCP
9821 set isascii
9822 if eval $compile; then
9823         echo "isascii() found." >&4
9824         val="$define"
9825 else
9826         echo "isascii() NOT found." >&4
9827         val="$undef"
9828 fi
9829 set d_isascii
9830 eval $setvar
9831 $rm -f isascii*
9832
9833 : see if isnan exists
9834 set isnan d_isnan
9835 eval $inlibc
9836
9837 : see if isnanl exists
9838 set isnanl d_isnanl
9839 eval $inlibc
9840
9841 : see if killpg exists
9842 set killpg d_killpg
9843 eval $inlibc
9844
9845 : see if lchown exists
9846 echo " "
9847 $cat > try.c <<'EOCP'
9848 /* System header to define __stub macros and hopefully few prototypes,
9849     which can conflict with char lchown(); below.  */
9850 #include <assert.h>
9851 /* Override any gcc2 internal prototype to avoid an error.  */
9852 /* We use char because int might match the return type of a gcc2
9853    builtin and then its argument prototype would still apply.  */
9854 char lchown();
9855 int main() {
9856     /*  The GNU C library defines this for functions which it implements
9857         to always fail with ENOSYS.  Some functions are actually named
9858         something starting with __ and the normal name is an alias.  */
9859 #if defined (__stub_lchown) || defined (__stub___lchown)
9860 choke me
9861 #else
9862 lchown();
9863 #endif
9864 ; return 0; }
9865 EOCP
9866 set try
9867 if eval $compile; then
9868     $echo "lchown() found." >&4
9869     val="$define"
9870 else
9871     $echo "lchown() NOT found." >&4
9872     val="$undef"
9873 fi
9874 set d_lchown
9875 eval $setvar
9876
9877 : See if number of significant digits in a double precision number is known
9878 echo " "
9879 $cat >ldbl_dig.c <<EOM
9880 #$i_limits I_LIMITS
9881 #$i_float I_FLOAT
9882 #ifdef I_LIMITS
9883 #include <limits.h>
9884 #endif
9885 #ifdef I_FLOAT
9886 #include <float.h>
9887 #endif
9888 #ifdef LDBL_DIG
9889 printf("Contains LDBL_DIG");
9890 #endif
9891 EOM
9892 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9893 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9894         echo "LDBL_DIG found." >&4
9895         val="$define"
9896 else
9897         echo "LDBL_DIG NOT found." >&4
9898         val="$undef"
9899 fi
9900 $rm -f ldbl_dig.?
9901 set d_ldbl_dig
9902 eval $setvar
9903
9904 : see if link exists
9905 set link d_link
9906 eval $inlibc
9907
9908 : see if localeconv exists
9909 set localeconv d_locconv
9910 eval $inlibc
9911
9912 : see if lockf exists
9913 set lockf d_lockf
9914 eval $inlibc
9915
9916 : check for long long
9917 echo " "
9918 echo "Checking to see if you have long long..." >&4
9919 echo 'int main() { long long x = 7; return 0; }' > try.c
9920 set try
9921 if eval $compile; then
9922         val="$define"
9923         echo "You have long long."
9924 else
9925         val="$undef"
9926         echo "You do not have long long."
9927 fi
9928 $rm try.*
9929 set d_longlong
9930 eval $setvar
9931
9932 : check for length of long long
9933 case "${d_longlong}${longlongsize}" in
9934 $define)
9935         echo " "
9936         echo "Checking to see how big your long longs are..." >&4
9937         $cat >try.c <<'EOCP'
9938 #include <stdio.h>
9939 int main()
9940 {
9941     printf("%d\n", (int)sizeof(long long));
9942     return(0);
9943 }
9944 EOCP
9945         set try
9946         if eval $compile_ok; then
9947                 longlongsize=`./try$exe_ext`
9948                 echo "Your long longs are $longlongsize bytes long."
9949         else
9950                 dflt='8'
9951                 echo " "
9952                 echo "(I can't seem to compile the test program.  Guessing...)"
9953                 rp="What is the size of a long long (in bytes)?"
9954                 . ./myread
9955                 longlongsize="$ans"
9956         fi
9957         if $test "X$longsize" = "X$longlongsize"; then
9958                 echo "(That isn't any different from an ordinary long.)"
9959         fi      
9960         ;;
9961 esac
9962 $rm -f try.* try
9963
9964 : see if prototype for lseek is available
9965 echo " "
9966 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9967 eval $hasproto
9968
9969 : see if lstat exists
9970 set lstat d_lstat
9971 eval $inlibc
9972
9973 : see if madvise exists
9974 set madvise d_madvise
9975 eval $inlibc
9976
9977 : see if mblen exists
9978 set mblen d_mblen
9979 eval $inlibc
9980
9981 : see if mbstowcs exists
9982 set mbstowcs d_mbstowcs
9983 eval $inlibc
9984
9985 : see if mbtowc exists
9986 set mbtowc d_mbtowc
9987 eval $inlibc
9988
9989 : see if memchr exists
9990 set memchr d_memchr
9991 eval $inlibc
9992
9993 : see if memcmp exists
9994 set memcmp d_memcmp
9995 eval $inlibc
9996
9997 : see if memcpy exists
9998 set memcpy d_memcpy
9999 eval $inlibc
10000
10001 : see if memmove exists
10002 set memmove d_memmove
10003 eval $inlibc
10004
10005 : see if memset exists
10006 set memset d_memset
10007 eval $inlibc
10008
10009 : see if mkdir exists
10010 set mkdir d_mkdir
10011 eval $inlibc
10012
10013 : see if mkdtemp exists
10014 set mkdtemp d_mkdtemp
10015 eval $inlibc
10016
10017 : see if mkfifo exists
10018 set mkfifo d_mkfifo
10019 eval $inlibc
10020
10021 : see if mkstemp exists
10022 set mkstemp d_mkstemp
10023 eval $inlibc
10024
10025 : see if mkstemps exists
10026 set mkstemps d_mkstemps
10027 eval $inlibc
10028
10029 : see if mktime exists
10030 set mktime d_mktime
10031 eval $inlibc
10032
10033 : see if this is a sys/mman.h system
10034 set sys/mman.h i_sysmman
10035 eval $inhdr
10036
10037 : see if mmap exists
10038 set mmap d_mmap
10039 eval $inlibc
10040 : see what shmat returns
10041 : default to something harmless
10042 mmaptype='void *'
10043 case "$i_sysmman$d_mmap" in
10044 "$define$define")
10045         $cat >mmap.c <<'END'
10046 #include <sys/mman.h>
10047 void *mmap();
10048 END
10049         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10050                 mmaptype='void *'
10051         else
10052                 mmaptype='caddr_t'
10053         fi
10054         echo "and it returns ($mmaptype)." >&4
10055         ;;
10056 esac
10057
10058
10059
10060 : see if modfl exists
10061 set modfl d_modfl
10062 eval $inlibc
10063
10064 : see if mprotect exists
10065 set mprotect d_mprotect
10066 eval $inlibc
10067
10068 : see if msgctl exists
10069 set msgctl d_msgctl
10070 eval $inlibc
10071
10072 : see if msgget exists
10073 set msgget d_msgget
10074 eval $inlibc
10075
10076 : see if msgsnd exists
10077 set msgsnd d_msgsnd
10078 eval $inlibc
10079
10080 : see if msgrcv exists
10081 set msgrcv d_msgrcv
10082 eval $inlibc
10083
10084 : see how much of the 'msg*(2)' library is present.
10085 h_msg=true
10086 echo " "
10087 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10088 *"$undef"*) h_msg=false;;
10089 esac
10090 case "$osname" in
10091 freebsd)
10092     case "`ipcs 2>&1`" in
10093     "SVID messages"*"not configured"*)
10094         echo "Your $osname does not have the msg*(2) configured." >&4
10095         h_msg=false
10096         val="$undef"
10097         set msgctl d_msgctl
10098         eval $setvar
10099         set msgget d_msgget
10100         eval $setvar
10101         set msgsnd d_msgsnd
10102         eval $setvar
10103         set msgrcv d_msgrcv
10104         eval $setvar
10105         ;;
10106     esac
10107     ;;
10108 esac
10109 : we could also check for sys/ipc.h ...
10110 if $h_msg && $test `./findhdr sys/msg.h`; then
10111         echo "You have the full msg*(2) library." >&4
10112         val="$define"
10113 else
10114         echo "You don't have the full msg*(2) library." >&4
10115         val="$undef"
10116 fi
10117 set d_msg
10118 eval $setvar
10119
10120 : see if msync exists
10121 set msync d_msync
10122 eval $inlibc
10123
10124 : see if munmap exists
10125 set munmap d_munmap
10126 eval $inlibc
10127
10128 : see if nice exists
10129 set nice d_nice
10130 eval $inlibc
10131
10132
10133 echo " "
10134 echo "Checking which 64-bit integer type we could use..." >&4
10135
10136 case "$intsize" in
10137 8) val=int
10138    set quadtype
10139    eval $setvar
10140    val='"unsigned int"'
10141    set uquadtype
10142    eval $setvar
10143    quadkind=1
10144    ;;
10145 *) case "$longsize" in
10146    8) val=long
10147       set quadtype
10148       eval $setvar
10149       val='"unsigned long"'
10150       set uquadtype
10151       eval $setvar
10152       quadkind=2
10153       ;;
10154    *) case "$d_longlong:$longlongsize" in
10155       define:8)
10156         val='"long long"'
10157         set quadtype
10158         eval $setvar
10159         val='"unsigned long long"'
10160         set uquadtype
10161         eval $setvar
10162         quadkind=3
10163         ;;
10164       *) case "$d_int64_t" in
10165          define)
10166            val=int64_t
10167            set quadtype
10168            eval $setvar
10169            val=uint64_t
10170            set uquadtype
10171            eval $setvar
10172            quadkind=4
10173            ;;
10174          esac
10175          ;;
10176       esac
10177       ;;
10178    esac
10179    ;;
10180 esac
10181
10182 case "$quadtype" in
10183 '')     echo "Alas, no 64-bit integer types in sight." >&4
10184         d_quad="$undef"
10185         ;;
10186 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10187             verb="will"
10188         else
10189             verb="could"
10190         fi
10191         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10192         d_quad="$define"
10193         ;;
10194 esac
10195
10196 : check for length of character
10197 echo " "
10198 case "$charsize" in
10199 '')
10200         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10201         $cat >try.c <<'EOCP'
10202 #include <stdio.h>
10203 int main()
10204 {
10205     printf("%d\n", (int)sizeof(char));
10206     exit(0);
10207 }
10208 EOCP
10209         set try
10210         if eval $compile_ok; then
10211                 dflt=`./try`
10212         else
10213                 dflt='1'
10214                 echo "(I can't seem to compile the test program.  Guessing...)"
10215         fi
10216         ;;
10217 *)
10218         dflt="$charsize"
10219         ;;
10220 esac
10221 rp="What is the size of a character (in bytes)?"
10222 . ./myread
10223 charsize="$ans"
10224 $rm -f try.c try
10225
10226 : check for volatile keyword
10227 echo " "
10228 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10229 $cat >try.c <<'EOCP'
10230 int main()
10231 {
10232         typedef struct _goo_struct goo_struct;
10233         goo_struct * volatile goo = ((goo_struct *)0);
10234         struct _goo_struct {
10235                 long long_int;
10236                 int reg_int;
10237                 char char_var;
10238         };
10239         typedef unsigned short foo_t;
10240         char *volatile foo;
10241         volatile int bar;
10242         volatile foo_t blech;
10243         foo = foo;
10244 }
10245 EOCP
10246 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10247         val="$define"
10248         echo "Yup, it does."
10249 else
10250         val="$undef"
10251         echo "Nope, it doesn't."
10252 fi
10253 set d_volatile
10254 eval $setvar
10255 $rm -f try.*
10256
10257
10258 echo " "
10259 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10260
10261 case "$use64bitint:$d_quad:$quadtype" in
10262 define:define:?*)
10263         ivtype="$quadtype"
10264         uvtype="$uquadtype"
10265         ivsize=8
10266         uvsize=8
10267         ;;
10268 *)      ivtype="long"
10269         uvtype="unsigned long"
10270         ivsize=$longsize
10271         uvsize=$longsize
10272         ;;
10273 esac
10274
10275 case "$uselongdouble:$d_longdbl" in
10276 define:define)
10277         nvtype="long double"
10278         nvsize=$longdblsize
10279         ;;
10280 *)      nvtype=double
10281         nvsize=$doublesize
10282         ;;
10283 esac
10284
10285 $echo "(IV will be "$ivtype", $ivsize bytes)"
10286 $echo "(UV will be "$uvtype", $uvsize bytes)"
10287 $echo "(NV will be "$nvtype", $nvsize bytes)"
10288
10289 $cat >try.c <<EOCP
10290 #$i_inttypes I_INTTYPES
10291 #ifdef I_INTTYPES
10292 #include <inttypes.h>
10293 #endif
10294 #include <stdio.h>
10295 int main() {
10296 #ifdef INT8
10297    int8_t i =  INT8_MAX;
10298   uint8_t u = UINT8_MAX;
10299   printf("int8_t\n");
10300 #endif
10301 #ifdef INT16
10302    int16_t i =  INT16_MAX;
10303   uint16_t i = UINT16_MAX;
10304   printf("int16_t\n");
10305 #endif
10306 #ifdef INT32
10307    int32_t i =  INT32_MAX;
10308   uint32_t u = UINT32_MAX;
10309   printf("int32_t\n");
10310 #endif
10311 }
10312 EOCP
10313
10314 case "$i8type" in
10315 '')     case "$charsize" in
10316         1)      i8type=char
10317                 u8type="unsigned char"
10318                 i8size=$charsize
10319                 u8size=$charsize
10320                 ;;
10321         esac
10322         ;;
10323 esac
10324 case "$i8type" in
10325 '')     set try -DINT8
10326         if eval $compile; then
10327                 case "`./try$exe_ext`" in
10328                 int8_t) i8type=int8_t
10329                         u8type=uint8_t
10330                         i8size=1
10331                         u8size=1
10332                         ;;
10333                 esac
10334         fi
10335         ;;
10336 esac
10337 case "$i8type" in
10338 '')     if $test $charsize -ge 1; then
10339                 i8type=char
10340                 u8type="unsigned char"
10341                 i8size=$charsize
10342                 u8size=$charsize
10343         fi
10344         ;;
10345 esac
10346
10347 case "$i16type" in
10348 '')     case "$shortsize" in
10349         2)      i16type=short
10350                 u16type="unsigned short"
10351                 i16size=$shortsize
10352                 u16size=$shortsize
10353                 ;;
10354         esac
10355         ;;
10356 esac
10357 case "$i16type" in
10358 '')     set try -DINT16
10359         if eval $compile; then
10360                 case "`./try$exe_ext`" in
10361                 int16_t)
10362                         i16type=int16_t
10363                         u16type=uint16_t
10364                         i16size=2
10365                         u16size=2
10366                         ;;
10367                 esac
10368         fi
10369         ;;
10370 esac
10371 case "$i16type" in
10372 '')     if $test $shortsize -ge 2; then
10373                 i16type=short
10374                 u16type="unsigned short"
10375                 i16size=$shortsize
10376                 u16size=$shortsize
10377         fi
10378         ;;
10379 esac
10380
10381 case "$i32type" in
10382 '')     case "$longsize" in
10383         4)      i32type=long
10384                 u32type="unsigned long"
10385                 i32size=$longsize
10386                 u32size=$longsize
10387                 ;;
10388         *)      case "$intsize" in
10389                 4)      i32type=int
10390                         u32type="unsigned int"
10391                         i32size=$intsize
10392                         u32size=$intsize
10393                         ;;
10394                 esac
10395                 ;;
10396         esac
10397         ;;
10398 esac
10399 case "$i32type" in
10400 '')     set try -DINT32
10401         if eval $compile; then
10402                 case "`./try$exe_ext`" in
10403                 int32_t)
10404                         i32type=int32_t
10405                         u32type=uint32_t
10406                         i32size=4
10407                         u32size=4
10408                         ;;
10409                 esac
10410         fi
10411         ;;
10412 esac
10413 case "$i32type" in
10414 '')     if $test $intsize -ge 4; then
10415                 i32type=int
10416                 u32type="unsigned int"
10417                 i32size=$intsize
10418                 u32size=$intsize
10419         fi
10420         ;;
10421 esac
10422
10423 case "$i64type" in
10424 '')     case "$d_quad:$quadtype" in
10425         define:?*)
10426                 i64type="$quadtype"
10427                 u64type="$uquadtype"
10428                 i64size=8
10429                 u64size=8
10430                 ;;
10431         esac
10432         ;;
10433 esac
10434
10435 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10436 : volatile so that the compiler has to store it out to memory.
10437 if test X"$d_volatile" = X"$define"; then
10438         volatile=volatile
10439 fi
10440 $cat <<EOP >try.c
10441 #include <stdio.h>
10442 #include <sys/types.h>
10443 #include <signal.h>
10444 #ifdef SIGFPE
10445 $volatile int bletched = 0;
10446 $signal_t blech(s) int s; { bletched = 1; }
10447 #endif
10448 int main() {
10449     $uvtype u = 0;
10450     $nvtype d;
10451     int     n = 8 * $uvsize;
10452     int     i;
10453 #ifdef SIGFPE
10454     signal(SIGFPE, blech);
10455 #endif
10456
10457     for (i = 0; i < n; i++) {
10458       u = u << 1 | ($uvtype)1;
10459       d = ($nvtype)u;
10460       if (($uvtype)d != u)
10461         break;
10462       if (d <= 0)
10463         break;
10464       d = ($nvtype)(u - 1);
10465       if (($uvtype)d != (u - 1))
10466         break;
10467 #ifdef SIGFPE
10468       if (bletched) {
10469         break;
10470 #endif
10471       } 
10472     }
10473     printf("%d\n", ((i == n) ? -n : i));
10474     exit(0);
10475 }
10476 EOP
10477 set try
10478
10479 d_nv_preserves_uv="$undef"
10480 if eval $compile; then
10481         d_nv_preserves_uv_bits="`./try$exe_ext`"
10482 fi
10483 case "$d_nv_preserves_uv_bits" in
10484 \-[1-9]*)       
10485         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10486         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10487         d_nv_preserves_uv="$define"
10488         ;;
10489 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10490         d_nv_preserves_uv="$undef" ;;
10491 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10492         d_nv_preserves_uv_bits="$undef" ;;
10493 esac
10494
10495 $rm -f try.* try
10496
10497
10498 : check for off64_t
10499 echo " "
10500 echo "Checking to see if you have off64_t..." >&4
10501 $cat >try.c <<EOCP
10502 #include <sys/types.h>
10503 #include <unistd.h>
10504 int main() { off64_t x = 7; }
10505 EOCP
10506 set try
10507 if eval $compile; then
10508         val="$define"
10509         echo "You have off64_t."
10510 else
10511         val="$undef"
10512         echo "You do not have off64_t."
10513         case "$lseeksize" in
10514         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10515         esac
10516 fi
10517 $rm -f try.* try
10518 set d_off64_t
10519 eval $setvar
10520
10521 : see if POSIX threads are available
10522 set pthread.h i_pthread
10523 eval $inhdr
10524
10525
10526
10527
10528 : how to create joinable pthreads
10529 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10530         echo " "
10531         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10532         $cat >try.c <<'EOCP'
10533 #include <pthread.h>
10534 int main() {
10535     int detachstate = JOINABLE;
10536 }
10537 EOCP
10538         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10539         if eval $compile; then
10540                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10541                 val="$undef" # Yes, undef.
10542                 set d_old_pthread_create_joinable
10543                 eval $setvar
10544                 val=""
10545                 set old_pthread_create_joinable
10546                 eval $setvar
10547         else
10548                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10549                 if eval $compile; then
10550                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10551                         val="$define"
10552                         set d_old_pthread_create_joinable
10553                         eval $setvar
10554                         val=PTHREAD_CREATE_UNDETACHED
10555                         set old_pthread_create_joinable
10556                         eval $setvar
10557                 else            
10558                         set try -DJOINABLE=__UNDETACHED
10559                         if eval $compile; then
10560                                 echo "You seem to use __UNDETACHED." >&4
10561                                 val="$define"
10562                                 set d_old_pthread_create_joinable
10563                                 eval $setvar
10564                                 val=__UNDETACHED
10565                                 set old_pthread_create_joinable
10566                                 eval $setvar
10567                         else
10568                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10569                                 val="$define"
10570                                 set d_old_pthread_create_joinable
10571                                 eval $setvar
10572                                 val=0
10573                                 set old_pthread_create_joinable
10574                                 eval $setvar
10575                         fi
10576                 fi
10577         fi
10578         $rm -f try try.*
10579 else
10580     d_old_pthread_create_joinable="$undef"
10581     old_pthread_create_joinable=""
10582 fi
10583
10584 : see if pause exists
10585 set pause d_pause
10586 eval $inlibc
10587
10588 : see if pipe exists
10589 set pipe d_pipe
10590 eval $inlibc
10591
10592 : see if poll exists
10593 set poll d_poll
10594 eval $inlibc
10595
10596
10597 : see whether the various POSIXish _yields exist
10598 $cat >try.c <<EOP
10599 #include <pthread.h>
10600 #include <stdio.h>
10601 int main() {
10602 #ifdef SCHED_YIELD
10603         sched_yield();
10604 #else
10605 #ifdef PTHREAD_YIELD
10606         pthread_yield();
10607 #else
10608 #ifdef PTHREAD_YIELD_NULL
10609         pthread_yield(NULL);
10610 #endif
10611 #endif
10612 #endif
10613 }
10614 EOP
10615 : see if sched_yield exists
10616 set try -DSCHED_YIELD
10617 if eval $compile; then
10618     val="$define"
10619     sched_yield='sched_yield()'
10620 else
10621     val="$undef"
10622 fi
10623 case "$usethreads" in
10624 $define)
10625         case "$val" in
10626         $define) echo 'sched_yield() found.' >&4        ;;
10627         *)       echo 'sched_yield() NOT found.' >&4    ;;
10628         esac
10629 esac
10630 set d_sched_yield
10631 eval $setvar
10632
10633 : see if pthread_yield exists
10634 set try -DPTHREAD_YIELD
10635 if eval $compile; then
10636     val="$define"
10637     case "$sched_yield" in
10638     '') sched_yield='pthread_yield()' ;;
10639     esac
10640 else
10641     set try -DPTHREAD_YIELD_NULL
10642     if eval $compile; then
10643         val="$define"
10644         case "$sched_yield" in
10645         '') sched_yield='pthread_yield(NULL)' ;;
10646         esac
10647     else
10648         val="$undef"
10649     fi
10650 fi
10651 case "$usethreads" in
10652 $define)
10653         case "$val" in
10654         $define) echo 'pthread_yield() found.' >&4      ;;
10655         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10656         esac
10657         ;;
10658 esac
10659 set d_pthread_yield
10660 eval $setvar
10661
10662 case "$sched_yield" in
10663 '') sched_yield=undef ;;
10664 esac
10665
10666 $rm -f try try.*
10667
10668 : see if this is a pwd.h system
10669 set pwd.h i_pwd
10670 eval $inhdr
10671
10672 case "$i_pwd" in
10673 $define)
10674         xxx=`./findhdr pwd.h`
10675         $cppstdin $cppflags $cppminus < $xxx >$$.h
10676
10677         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10678                 val="$define"
10679         else
10680                 val="$undef"
10681         fi
10682         set d_pwquota
10683         eval $setvar
10684
10685         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10686                 val="$define"
10687         else
10688                 val="$undef"
10689         fi
10690         set d_pwage
10691         eval $setvar
10692
10693         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10694                 val="$define"
10695         else
10696                 val="$undef"
10697         fi
10698         set d_pwchange
10699         eval $setvar
10700
10701         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10702                 val="$define"
10703         else
10704                 val="$undef"
10705         fi
10706         set d_pwclass
10707         eval $setvar
10708
10709         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10710                 val="$define"
10711         else
10712                 val="$undef"
10713         fi
10714         set d_pwexpire
10715         eval $setvar
10716
10717         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10718                 val="$define"
10719         else
10720                 val="$undef"
10721         fi
10722         set d_pwcomment
10723         eval $setvar
10724
10725         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10726                 val="$define"
10727         else
10728                 val="$undef"
10729         fi
10730         set d_pwgecos
10731         eval $setvar
10732
10733         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10734                 val="$define"
10735         else
10736                 val="$undef"
10737         fi
10738         set d_pwpasswd
10739         eval $setvar
10740
10741         $rm -f $$.h
10742         ;;
10743 *)
10744         val="$undef"; 
10745         set d_pwquota; eval $setvar
10746         set d_pwage; eval $setvar
10747         set d_pwchange; eval $setvar
10748         set d_pwclass; eval $setvar
10749         set d_pwexpire; eval $setvar
10750         set d_pwcomment; eval $setvar
10751         set d_pwgecos; eval $setvar
10752         set d_pwpasswd; eval $setvar
10753         ;;
10754 esac
10755
10756 : see if readdir and friends exist
10757 set readdir d_readdir
10758 eval $inlibc
10759 set seekdir d_seekdir
10760 eval $inlibc
10761 set telldir d_telldir
10762 eval $inlibc
10763 set rewinddir d_rewinddir
10764 eval $inlibc
10765
10766 : see if readlink exists
10767 set readlink d_readlink
10768 eval $inlibc
10769
10770 : see if rename exists
10771 set rename d_rename
10772 eval $inlibc
10773
10774 : see if rmdir exists
10775 set rmdir d_rmdir
10776 eval $inlibc
10777
10778 : see if memory.h is available.
10779 val=''
10780 set memory.h val
10781 eval $inhdr
10782
10783 : See if it conflicts with string.h
10784 case "$val" in
10785 $define)
10786         case "$strings" in
10787         '') ;;
10788         *)
10789                 $cppstdin $cppflags $cppminus < $strings > mem.h
10790                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10791                         echo " "
10792                         echo "We won't be including <memory.h>."
10793                         val="$undef"
10794                 fi
10795                 $rm -f mem.h
10796                 ;;
10797         esac
10798 esac
10799 set i_memory
10800 eval $setvar
10801
10802 : can bcopy handle overlapping blocks?
10803 val="$undef"
10804 case "$d_bcopy" in
10805 "$define")
10806         echo " "
10807         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10808         $cat >try.c <<EOCP
10809 #$i_memory I_MEMORY
10810 #$i_stdlib I_STDLIB
10811 #$i_string I_STRING
10812 #$i_unistd I_UNISTD
10813 EOCP
10814         $cat >>try.c <<'EOCP'
10815 #include <stdio.h>
10816 #ifdef I_MEMORY
10817 #  include <memory.h>
10818 #endif
10819 #ifdef I_STDLIB
10820 #  include <stdlib.h>
10821 #endif
10822 #ifdef I_STRING
10823 #  include <string.h>
10824 #else
10825 #  include <strings.h>
10826 #endif
10827 #ifdef I_UNISTD
10828 #  include <unistd.h>  /* Needed for NetBSD */
10829 #endif
10830 int main()
10831 {
10832 char buf[128], abc[128];
10833 char *b;
10834 int len;
10835 int off;
10836 int align;
10837
10838 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10839
10840 for (align = 7; align >= 0; align--) {
10841         for (len = 36; len; len--) {
10842                 b = buf+align;
10843                 bcopy(abc, b, len);
10844                 for (off = 1; off <= len; off++) {
10845                         bcopy(b, b+off, len);
10846                         bcopy(b+off, b, len);
10847                         if (bcmp(b, abc, len))
10848                                 exit(1);
10849                 }
10850         }
10851 }
10852 exit(0);
10853 }
10854 EOCP
10855         set try
10856         if eval $compile_ok; then
10857                 if ./try 2>/dev/null; then
10858                         echo "Yes, it can."
10859                         val="$define"
10860                 else
10861                         echo "It can't, sorry."
10862                         case "$d_memmove" in
10863                         "$define") echo "But that's Ok since you have memmove()." ;;
10864                         esac
10865                 fi
10866         else
10867                 echo "(I can't compile the test program, so we'll assume not...)"
10868                 case "$d_memmove" in
10869                 "$define") echo "But that's Ok since you have memmove()." ;;
10870                 esac
10871         fi
10872         ;;
10873 esac
10874 $rm -f try.* try core
10875 set d_safebcpy
10876 eval $setvar
10877
10878 : can memcpy handle overlapping blocks?
10879 val="$undef"
10880 case "$d_memcpy" in
10881 "$define")
10882         echo " "
10883         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10884         $cat >try.c <<EOCP
10885 #$i_memory I_MEMORY
10886 #$i_stdlib I_STDLIB
10887 #$i_string I_STRING
10888 #$i_unistd I_UNISTD
10889 EOCP
10890         $cat >>try.c <<'EOCP'
10891 #include <stdio.h>
10892 #ifdef I_MEMORY
10893 #  include <memory.h>
10894 #endif
10895 #ifdef I_STDLIB
10896 #  include <stdlib.h>
10897 #endif
10898 #ifdef I_STRING
10899 #  include <string.h>
10900 #else
10901 #  include <strings.h>
10902 #endif
10903 #ifdef I_UNISTD
10904 #  include <unistd.h>  /* Needed for NetBSD */
10905 #endif
10906 int main()
10907 {
10908 char buf[128], abc[128];
10909 char *b;
10910 int len;
10911 int off;
10912 int align;
10913
10914 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10915    try to store the string in read-only memory. */
10916 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10917
10918 for (align = 7; align >= 0; align--) {
10919         for (len = 36; len; len--) {
10920                 b = buf+align;
10921                 memcpy(b, abc, len);
10922                 for (off = 1; off <= len; off++) {
10923                         memcpy(b+off, b, len);
10924                         memcpy(b, b+off, len);
10925                         if (memcmp(b, abc, len))
10926                                 exit(1);
10927                 }
10928         }
10929 }
10930 exit(0);
10931 }
10932 EOCP
10933         set try
10934         if eval $compile_ok; then
10935                 if ./try 2>/dev/null; then
10936                         echo "Yes, it can."
10937                         val="$define"
10938                 else
10939                         echo "It can't, sorry."
10940                         case "$d_memmove" in
10941                         "$define") echo "But that's Ok since you have memmove()." ;;
10942                         esac
10943                 fi
10944         else
10945                 echo "(I can't compile the test program, so we'll assume not...)"
10946                 case "$d_memmove" in
10947                 "$define") echo "But that's Ok since you have memmove()." ;;
10948                 esac
10949         fi
10950         ;;
10951 esac
10952 $rm -f try.* try core
10953 set d_safemcpy
10954 eval $setvar
10955
10956 : can memcmp be trusted to compare relative magnitude?
10957 val="$undef"
10958 case "$d_memcmp" in
10959 "$define")
10960         echo " "
10961         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10962         $cat >try.c <<EOCP
10963 #$i_memory I_MEMORY
10964 #$i_stdlib I_STDLIB
10965 #$i_string I_STRING
10966 #$i_unistd I_UNISTD
10967 EOCP
10968         $cat >>try.c <<'EOCP'
10969 #include <stdio.h>
10970 #ifdef I_MEMORY
10971 #  include <memory.h>
10972 #endif
10973 #ifdef I_STDLIB
10974 #  include <stdlib.h>
10975 #endif
10976 #ifdef I_STRING
10977 #  include <string.h>
10978 #else
10979 #  include <strings.h>
10980 #endif
10981 #ifdef I_UNISTD
10982 #  include <unistd.h>  /* Needed for NetBSD */
10983 #endif
10984 int main()
10985 {
10986 char a = -1;
10987 char b = 0;
10988 if ((a < b) && memcmp(&a, &b, 1) < 0)
10989         exit(1);
10990 exit(0);
10991 }
10992 EOCP
10993         set try
10994         if eval $compile_ok; then
10995                 if ./try 2>/dev/null; then
10996                         echo "Yes, it can."
10997                         val="$define"
10998                 else
10999                         echo "No, it can't (it uses signed chars)."
11000                 fi
11001         else
11002                 echo "(I can't compile the test program, so we'll assume not...)"
11003         fi
11004         ;;
11005 esac
11006 $rm -f try.* try core
11007 set d_sanemcmp
11008 eval $setvar
11009
11010 : see if prototype for sbrk is available
11011 echo " "
11012 set d_sbrkproto sbrk $i_unistd unistd.h
11013 eval $hasproto
11014
11015 : see if select exists
11016 set select d_select
11017 eval $inlibc
11018
11019 : see if semctl exists
11020 set semctl d_semctl
11021 eval $inlibc
11022
11023 : see if semget exists
11024 set semget d_semget
11025 eval $inlibc
11026
11027 : see if semop exists
11028 set semop d_semop
11029 eval $inlibc
11030
11031 : see how much of the 'sem*(2)' library is present.
11032 h_sem=true
11033 echo " "
11034 case "$d_semctl$d_semget$d_semop" in
11035 *"$undef"*) h_sem=false;;
11036 esac
11037 case "$osname" in
11038 freebsd)
11039     case "`ipcs 2>&1`" in
11040     "SVID messages"*"not configured"*)
11041         echo "Your $osname does not have the sem*(2) configured." >&4
11042         h_sem=false
11043         val="$undef"
11044         set semctl d_semctl
11045         eval $setvar
11046         set semget d_semget
11047         eval $setvar
11048         set semop d_semop
11049         eval $setvar
11050         ;;
11051     esac
11052     ;;
11053 esac
11054 : we could also check for sys/ipc.h ...
11055 if $h_sem && $test `./findhdr sys/sem.h`; then
11056         echo "You have the full sem*(2) library." >&4
11057         val="$define"
11058 else
11059         echo "You don't have the full sem*(2) library." >&4
11060         val="$undef"
11061 fi
11062 set d_sem
11063 eval $setvar
11064
11065 : see whether sys/sem.h defines union semun
11066 echo " "
11067 $cat > try.c <<'END'
11068 #include <sys/types.h>
11069 #include <sys/ipc.h>
11070 #include <sys/sem.h>
11071 int main () { union semun semun; semun.buf = 0; }
11072 END
11073 set try
11074 if eval $compile; then
11075     echo "You have union semun in <sys/sem.h>." >&4
11076     val="$define"
11077 else
11078     echo "You do not have union semun in <sys/sem.h>." >&4
11079     val="$undef"
11080 fi
11081 $rm -f try try.c try.h
11082 set d_union_semun
11083 eval $setvar
11084
11085 : see how to do semctl IPC_STAT
11086 case "$d_sem" in
11087 $define)
11088     : see whether semctl IPC_STAT can use union semun
11089     echo " "
11090     $cat > try.h <<END
11091 #ifndef S_IRUSR
11092 #   ifdef S_IREAD
11093 #       define S_IRUSR S_IREAD
11094 #       define S_IWUSR S_IWRITE
11095 #       define S_IXUSR S_IEXEC
11096 #   else
11097 #       define S_IRUSR 0400
11098 #       define S_IWUSR 0200
11099 #       define S_IXUSR 0100
11100 #   endif
11101 #   define S_IRGRP (S_IRUSR>>3)
11102 #   define S_IWGRP (S_IWUSR>>3)
11103 #   define S_IXGRP (S_IXUSR>>3)
11104 #   define S_IROTH (S_IRUSR>>6)
11105 #   define S_IWOTH (S_IWUSR>>6)
11106 #   define S_IXOTH (S_IXUSR>>6)
11107 #endif
11108 #ifndef S_IRWXU
11109 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11110 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11111 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11112 #endif
11113 END
11114
11115     $cat > try.c <<END
11116 #include <sys/types.h>
11117 #include <sys/ipc.h>
11118 #include <sys/sem.h>
11119 #include <sys/stat.h>
11120 #include <stdio.h>
11121 #include <errno.h>
11122 #include "try.h"
11123 #ifndef errno
11124 extern int errno;
11125 #endif
11126 #$d_union_semun HAS_UNION_SEMUN
11127 int main() {
11128     union semun
11129 #ifndef HAS_UNION_SEMUN
11130     {
11131         int val;
11132         struct semid_ds *buf;
11133         unsigned short *array;
11134     }
11135 #endif
11136     arg;
11137     int sem, st;
11138
11139 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11140     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11141     if (sem > -1) {
11142         struct semid_ds argbuf;
11143         arg.buf = &argbuf;
11144 #       ifdef IPC_STAT
11145         st = semctl(sem, 0, IPC_STAT, arg);
11146         if (st == 0)
11147             printf("semun\n");
11148         else
11149 #       endif /* IPC_STAT */
11150             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11151 #       ifdef IPC_RMID
11152         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11153 #       endif /* IPC_RMID */
11154             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11155     } else
11156 #endif /* IPC_PRIVATE && ... */
11157         printf("semget failed: errno = %d\n", errno);
11158   return 0;
11159 }
11160 END
11161     val="$undef"
11162     set try
11163     if eval $compile; then
11164         xxx=`./try`
11165         case "$xxx" in
11166         semun) val="$define" ;;
11167         esac
11168     fi
11169     $rm -f try try.c
11170     set d_semctl_semun
11171     eval $setvar
11172     case "$d_semctl_semun" in
11173     $define)
11174         echo "You can use union semun for semctl IPC_STAT." >&4
11175         also='also'
11176         ;;
11177     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11178         also=''
11179         ;;
11180     esac
11181
11182     : see whether semctl IPC_STAT can use struct semid_ds pointer
11183     $cat > try.c <<'END'
11184 #include <sys/types.h>
11185 #include <sys/ipc.h>
11186 #include <sys/sem.h>
11187 #include <sys/stat.h>
11188 #include "try.h"
11189 #include <stdio.h>
11190 #include <errno.h>
11191 #ifndef errno
11192 extern int errno;
11193 #endif
11194 int main() {
11195     struct semid_ds arg;
11196     int sem, st;
11197
11198 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11199     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11200     if (sem > -1) {
11201 #       ifdef IPC_STAT
11202         st = semctl(sem, 0, IPC_STAT, &arg);
11203         if (st == 0)
11204             printf("semid_ds\n");
11205         else
11206 #       endif /* IPC_STAT */
11207             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11208 #       ifdef IPC_RMID
11209         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11210 #       endif /* IPC_RMID */
11211             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11212     } else
11213 #endif /* IPC_PRIVATE && ... */
11214         printf("semget failed: errno = %d\n", errno);
11215
11216     return 0;
11217 }
11218 END
11219     val="$undef"
11220     set try
11221     if eval $compile; then
11222         xxx=`./try`
11223         case "$xxx" in
11224         semid_ds) val="$define" ;;
11225         esac
11226     fi
11227     $rm -f try try.c
11228     set d_semctl_semid_ds
11229     eval $setvar
11230     case "$d_semctl_semid_ds" in
11231     $define)
11232         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11233         ;;
11234     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11235         ;;
11236     esac
11237     $rm -f try.h
11238     ;;
11239 *)  val="$undef"
11240
11241     # We do not have the full sem*(2) library, so assume we can not
11242     # use either.
11243
11244     set d_semctl_semun
11245     eval $setvar
11246
11247     set d_semctl_semid_ds
11248     eval $setvar
11249     ;;
11250 esac
11251
11252 : see if setegid exists
11253 set setegid d_setegid
11254 eval $inlibc
11255
11256 : see if seteuid exists
11257 set seteuid d_seteuid
11258 eval $inlibc
11259
11260 : see if setgrent exists
11261 set setgrent d_setgrent
11262 eval $inlibc
11263
11264 : see if sethostent exists
11265 set sethostent d_sethent
11266 eval $inlibc
11267
11268 : see if setlinebuf exists
11269 set setlinebuf d_setlinebuf
11270 eval $inlibc
11271
11272 : see if setlocale exists
11273 set setlocale d_setlocale
11274 eval $inlibc
11275
11276 : see if setnetent exists
11277 set setnetent d_setnent
11278 eval $inlibc
11279
11280 : see if setprotoent exists
11281 set setprotoent d_setpent
11282 eval $inlibc
11283
11284 : see if setpgid exists
11285 set setpgid d_setpgid
11286 eval $inlibc
11287
11288 : see if setpgrp2 exists
11289 set setpgrp2 d_setpgrp2
11290 eval $inlibc
11291
11292 : see if setpriority exists
11293 set setpriority d_setprior
11294 eval $inlibc
11295
11296 : see if setproctitle exists
11297 set setproctitle d_setproctitle
11298 eval $inlibc
11299
11300 : see if setpwent exists
11301 set setpwent d_setpwent
11302 eval $inlibc
11303
11304 : see if setregid exists
11305 set setregid d_setregid
11306 eval $inlibc
11307 set setresgid d_setresgid
11308 eval $inlibc
11309
11310 : see if setreuid exists
11311 set setreuid d_setreuid
11312 eval $inlibc
11313 set setresuid d_setresuid
11314 eval $inlibc
11315
11316 : see if setrgid exists
11317 set setrgid d_setrgid
11318 eval $inlibc
11319
11320 : see if setruid exists
11321 set setruid d_setruid
11322 eval $inlibc
11323
11324 : see if setservent exists
11325 set setservent d_setsent
11326 eval $inlibc
11327
11328 : see if setsid exists
11329 set setsid d_setsid
11330 eval $inlibc
11331
11332 : see if setvbuf exists
11333 set setvbuf d_setvbuf
11334 eval $inlibc
11335
11336 : see if sfio.h is available
11337 set sfio.h i_sfio
11338 eval $inhdr
11339
11340
11341 : see if sfio library is available
11342 case "$i_sfio" in
11343 $define)
11344         val=''
11345         set sfreserve val
11346         eval $inlibc
11347         ;;
11348 *)
11349         val="$undef"
11350         ;;
11351 esac
11352 : Ok, but do we want to use it.
11353 case "$val" in
11354 $define)
11355         case "$usesfio" in
11356         true|$define|[yY]*) dflt='y';;
11357         *) dflt='n';;
11358         esac
11359         echo "$package can use the sfio library, but it is experimental."
11360         case "$useperlio" in
11361         "$undef")
11362             echo "For sfio also the PerlIO abstraction layer is needed."
11363             echo "Earlier you said you wouldn't want that."
11364             ;;
11365         esac
11366         rp="You seem to have sfio available, do you want to try using it?"
11367         . ./myread
11368         case "$ans" in
11369         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11370                 useperlio="$define"
11371                 val="$define"
11372                 ;;
11373         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11374                 val="$undef"
11375                 : Remove sfio from list of libraries to use
11376                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11377                 shift
11378                 libs="$*"
11379                 echo "libs = $libs" >&4
11380                 ;;
11381         esac
11382         ;;
11383 *)      case "$usesfio" in
11384         true|$define|[yY]*)
11385                 echo "Sorry, cannot find sfio on this machine." >&4
11386                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11387                 val="$undef"
11388                 ;;
11389         esac
11390         ;;
11391 esac
11392 set d_sfio
11393 eval $setvar
11394 case "$d_sfio" in
11395 $define) usesfio='true';;
11396 *) usesfio='false';;
11397 esac
11398
11399 : see if shmctl exists
11400 set shmctl d_shmctl
11401 eval $inlibc
11402
11403 : see if shmget exists
11404 set shmget d_shmget
11405 eval $inlibc
11406
11407 : see if shmat exists
11408 set shmat d_shmat
11409 eval $inlibc
11410 : see what shmat returns
11411 case "$d_shmat" in
11412 "$define")
11413         $cat >shmat.c <<'END'
11414 #include <sys/shm.h>
11415 void *shmat();
11416 END
11417         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11418                 shmattype='void *'
11419         else
11420                 shmattype='char *'
11421         fi
11422         echo "and it returns ($shmattype)." >&4
11423         : see if a prototype for shmat is available
11424         xxx=`./findhdr sys/shm.h`
11425         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11426         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11427                 val="$define"
11428         else
11429                 val="$undef"
11430         fi
11431         $rm -f shmat.[co]
11432         ;;
11433 *)
11434         val="$undef"
11435         ;;
11436 esac
11437 set d_shmatprototype
11438 eval $setvar
11439
11440 : see if shmdt exists
11441 set shmdt d_shmdt
11442 eval $inlibc
11443
11444 : see how much of the 'shm*(2)' library is present.
11445 h_shm=true
11446 echo " "
11447 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11448 *"$undef"*) h_shm=false;;
11449 esac
11450 case "$osname" in
11451 freebsd)
11452     case "`ipcs 2>&1`" in
11453     "SVID shared memory"*"not configured"*)
11454         echo "Your $osname does not have the shm*(2) configured." >&4
11455         h_shm=false
11456         val="$undef"
11457         set shmctl d_shmctl
11458         evat $setvar
11459         set shmget d_shmget
11460         evat $setvar
11461         set shmat d_shmat
11462         evat $setvar
11463         set shmdt d_shmdt
11464         evat $setvar
11465         ;;
11466     esac
11467     ;;
11468 esac
11469 : we could also check for sys/ipc.h ...
11470 if $h_shm && $test `./findhdr sys/shm.h`; then
11471         echo "You have the full shm*(2) library." >&4
11472         val="$define"
11473 else
11474         echo "You don't have the full shm*(2) library." >&4
11475         val="$undef"
11476 fi
11477 set d_shm
11478 eval $setvar
11479
11480 echo " "
11481 : see if we have sigaction
11482 if set sigaction val -f d_sigaction; eval $csym; $val; then
11483         echo 'sigaction() found.' >&4
11484         $cat > try.c <<'EOP'
11485 #include <stdio.h>
11486 #include <sys/types.h>
11487 #include <signal.h>
11488 int main()
11489 {
11490     struct sigaction act, oact;
11491     act.sa_flags = 0;
11492     oact.sa_handler = 0;
11493     /* so that act and oact are used */
11494     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11495 }
11496 EOP
11497         set try
11498         if eval $compile_ok; then
11499                 val="$define"
11500         else
11501                 echo "But you don't seem to have a useable struct sigaction." >&4
11502                 val="$undef"
11503         fi
11504 else
11505         echo 'sigaction NOT found.' >&4
11506         val="$undef"
11507 fi
11508 set d_sigaction; eval $setvar
11509 $rm -f try try$_o try.c
11510
11511 : see if sigsetjmp exists
11512 echo " "
11513 case "$d_sigsetjmp" in
11514 '')
11515         $cat >try.c <<'EOP'
11516 #include <setjmp.h>
11517 sigjmp_buf env;
11518 int set = 1;
11519 int main()
11520 {
11521         if (sigsetjmp(env,1))
11522                 exit(set);
11523         set = 0;
11524         siglongjmp(env, 1);
11525         exit(1);
11526 }
11527 EOP
11528         set try
11529         if eval $compile; then
11530                 if ./try >/dev/null 2>&1; then
11531                         echo "POSIX sigsetjmp found." >&4
11532                         val="$define"
11533                 else
11534                         $cat >&4 <<EOM
11535 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11536 I'll ignore them.
11537 EOM
11538                         val="$undef"
11539                 fi
11540         else
11541                 echo "sigsetjmp not found." >&4
11542                 val="$undef"
11543         fi
11544         ;;
11545 *) val="$d_sigsetjmp"
11546         case "$d_sigsetjmp" in
11547         $define) echo "POSIX sigsetjmp found." >&4;;
11548         $undef) echo "sigsetjmp not found." >&4;;
11549         esac
11550         ;;
11551 esac
11552 set d_sigsetjmp
11553 eval $setvar
11554 $rm -f try.c try
11555
11556 : see if socks5_init exists
11557 set socks5_init d_socks5_init
11558 eval $inlibc
11559
11560 : see if sys/stat.h is available
11561 set sys/stat.h i_sysstat
11562 eval $inhdr
11563
11564
11565 : see if stat knows about block sizes
11566 echo " "
11567 echo "Checking to see if your struct stat has st_blocks field..." >&4
11568 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11569 eval $hasfield
11570
11571
11572 : see if this is a sys/vfs.h system
11573 set sys/vfs.h i_sysvfs
11574 eval $inhdr
11575
11576
11577 : see if this is a sys/statfs.h system
11578 set sys/statfs.h i_sysstatfs
11579 eval $inhdr
11580
11581
11582 echo " "
11583 echo "Checking to see if your system supports struct statfs..." >&4
11584 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
11585 eval $hasstruct
11586 case "$d_statfs_s" in
11587 "$define")      echo "Yes, it does."   ;;
11588 *)              echo "No, it doesn't." ;;
11589 esac
11590
11591
11592
11593 : see if struct statfs knows about f_flags
11594 case "$d_statfs_s" in
11595 define) 
11596         echo " "
11597         echo "Checking to see if your struct statfs has f_flags field..." >&4
11598         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
11599         eval $hasfield
11600         ;;
11601 *)      val="$undef"
11602         set d_statfs_f_flags
11603         eval $setvar
11604         ;;
11605 esac
11606 case "$d_statfs_f_flags" in
11607 "$define")      echo "Yes, it does."   ;;
11608 *)              echo "No, it doesn't." ;;
11609 esac
11610
11611 : see if _ptr and _cnt from stdio act std
11612 echo " "
11613
11614 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11615         echo "(Looks like you have stdio.h from BSD.)"
11616         case "$stdio_ptr" in
11617         '') stdio_ptr='((fp)->_p)'
11618                 ptr_lval=$define
11619                 ;;
11620         *)      ptr_lval=$d_stdio_ptr_lval;;
11621         esac
11622         case "$stdio_cnt" in
11623         '') stdio_cnt='((fp)->_r)'
11624                 cnt_lval=$define
11625                 ;;
11626         *)      cnt_lval=$d_stdio_cnt_lval;;
11627         esac
11628         case "$stdio_base" in
11629         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11630         esac
11631         case "$stdio_bufsiz" in
11632         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11633         esac
11634 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11635         echo "(Looks like you have stdio.h from Linux.)"
11636         case "$stdio_ptr" in
11637         '') stdio_ptr='((fp)->_IO_read_ptr)'
11638                 ptr_lval=$define
11639                 ;;
11640         *)      ptr_lval=$d_stdio_ptr_lval;;
11641         esac
11642         case "$stdio_cnt" in
11643         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11644                 cnt_lval=$undef
11645                 ;;
11646         *)      cnt_lval=$d_stdio_cnt_lval;;
11647         esac
11648         case "$stdio_base" in
11649         '') stdio_base='((fp)->_IO_read_base)';;
11650         esac
11651         case "$stdio_bufsiz" in
11652         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11653         esac
11654 else
11655         case "$stdio_ptr" in
11656         '') stdio_ptr='((fp)->_ptr)'
11657                 ptr_lval=$define
11658                 ;;
11659         *)      ptr_lval=$d_stdio_ptr_lval;;
11660         esac
11661         case "$stdio_cnt" in
11662         '') stdio_cnt='((fp)->_cnt)'
11663                 cnt_lval=$define
11664                 ;;
11665         *)      cnt_lval=$d_stdio_cnt_lval;;
11666         esac
11667         case "$stdio_base" in
11668         '') stdio_base='((fp)->_base)';;
11669         esac
11670         case "$stdio_bufsiz" in
11671         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11672         esac
11673 fi
11674
11675 : test whether _ptr and _cnt really work
11676 echo "Checking how std your stdio is..." >&4
11677 $cat >try.c <<EOP
11678 #include <stdio.h>
11679 #define FILE_ptr(fp)    $stdio_ptr
11680 #define FILE_cnt(fp)    $stdio_cnt
11681 int main() {
11682         FILE *fp = fopen("try.c", "r");
11683         char c = getc(fp);
11684         if (
11685                 18 <= FILE_cnt(fp) &&
11686                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11687         )
11688                 exit(0);
11689         exit(1);
11690 }
11691 EOP
11692 val="$undef"
11693 set try
11694 if eval $compile; then
11695         if ./try; then
11696                 echo "Your stdio acts pretty std."
11697                 val="$define"
11698         else
11699                 echo "Your stdio isn't very std."
11700         fi
11701 else
11702         echo "Your stdio doesn't appear very std."
11703 fi
11704 $rm -f try.c try
11705 set d_stdstdio
11706 eval $setvar
11707
11708 : Can _ptr be used as an lvalue?
11709 case "$d_stdstdio$ptr_lval" in
11710 $define$define) val=$define ;;
11711 *) val=$undef ;;
11712 esac
11713 set d_stdio_ptr_lval
11714 eval $setvar
11715
11716 : Can _cnt be used as an lvalue?
11717 case "$d_stdstdio$cnt_lval" in
11718 $define$define) val=$define ;;
11719 *) val=$undef ;;
11720 esac
11721 set d_stdio_cnt_lval
11722 eval $setvar
11723
11724
11725 : test whether setting _ptr sets _cnt as a side effect
11726 d_stdio_ptr_lval_sets_cnt="$undef"
11727 d_stdio_ptr_lval_nochange_cnt="$undef"
11728 case "$d_stdio_ptr_lval$d_stdstdio" in
11729 $define$define)
11730         echo "Checking to see what happens if we set the stdio ptr..." >&4
11731 $cat >try.c <<EOP
11732 #include <stdio.h>
11733 /* Can we scream? */
11734 /* Eat dust sed :-) */
11735 /* In the buffer space, no one can hear you scream. */
11736 #define FILE_ptr(fp)    $stdio_ptr
11737 #define FILE_cnt(fp)    $stdio_cnt
11738 #include <sys/types.h>
11739 int main() {
11740         FILE *fp = fopen("try.c", "r");
11741         int c;
11742         char *ptr;
11743         size_t cnt;
11744         if (!fp) {
11745             puts("Fail even to read");
11746             exit(1);
11747         }
11748         c = getc(fp); /* Read away the first # */
11749         if (c == EOF) {
11750             puts("Fail even to read");
11751             exit(1);
11752         }
11753         if (!(
11754                 18 <= FILE_cnt(fp) &&
11755                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11756         )) {
11757                 puts("Fail even to read");
11758                 exit (1);
11759         }
11760         ptr = (char*) FILE_ptr(fp);
11761         cnt = (size_t)FILE_cnt(fp);
11762
11763         FILE_ptr(fp) += 42;
11764
11765         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11766                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11767                 exit (1);
11768         }
11769         if (FILE_cnt(fp) <= 20) {
11770                 printf ("Fail (<20 chars to test)");
11771                 exit (1);
11772         }
11773         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11774                 puts("Fail compare");
11775                 exit (1);
11776         }
11777         if (cnt == FILE_cnt(fp)) {
11778                 puts("Pass_unchanged");
11779                 exit (0);
11780         }       
11781         if (FILE_cnt(fp) == (cnt - 42)) {
11782                 puts("Pass_changed");
11783                 exit (0);
11784         }
11785         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11786         return 1;
11787
11788 }
11789 EOP
11790         set try
11791         if eval $compile; then
11792                 case `./try$exe_ext` in
11793                 Pass_changed)
11794                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11795                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11796                 Pass_unchanged)
11797                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11798                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11799                 Fail*)
11800                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11801                 *)
11802                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11803         esac
11804         else
11805                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11806         fi
11807         $rm -f try.c try
11808         ;;
11809 esac
11810
11811 : see if _base is also standard
11812 val="$undef"
11813 case "$d_stdstdio" in
11814 $define)
11815         $cat >try.c <<EOP
11816 #include <stdio.h>
11817 #define FILE_base(fp)   $stdio_base
11818 #define FILE_bufsiz(fp) $stdio_bufsiz
11819 int main() {
11820         FILE *fp = fopen("try.c", "r");
11821         char c = getc(fp);
11822         if (
11823                 19 <= FILE_bufsiz(fp) &&
11824                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11825         )
11826                 exit(0);
11827         exit(1);
11828 }
11829 EOP
11830         set try
11831         if eval $compile; then
11832                 if ./try; then
11833                         echo "And its _base field acts std."
11834                         val="$define"
11835                 else
11836                         echo "But its _base field isn't std."
11837                 fi
11838         else
11839                 echo "However, it seems to be lacking the _base field."
11840         fi
11841         $rm -f try.c try
11842         ;;
11843 esac
11844 set d_stdiobase
11845 eval $setvar
11846
11847 $cat >&4 <<EOM
11848 Checking how to access stdio streams by file descriptor number...
11849 EOM
11850 case "$stdio_stream_array" in
11851 '')     $cat >try.c <<EOCP
11852 #include <stdio.h>
11853 int main() {
11854   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11855     printf("yes\n");
11856 }
11857 EOCP
11858         for s in _iob __iob __sF
11859         do
11860                 set try -DSTDIO_STREAM_ARRAY=$s
11861                 if eval $compile; then
11862                         case "`./try$exe_ext`" in
11863                         yes)    stdio_stream_array=$s; break ;;
11864                         esac
11865                 fi
11866         done
11867         $rm -f try.* try$exe_ext
11868 esac
11869 case "$stdio_stream_array" in
11870 '')     $cat >&4 <<EOM
11871 I can't figure out how to access stdio streams by file descriptor number.
11872 EOM
11873         d_stdio_stream_array="$undef"
11874         ;;
11875 *)      $cat >&4 <<EOM
11876 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11877 EOM
11878         d_stdio_stream_array="$define"
11879         ;;
11880 esac
11881
11882 : see if strcoll exists
11883 set strcoll d_strcoll
11884 eval $inlibc
11885
11886 : check for structure copying
11887 echo " "
11888 echo "Checking to see if your C compiler can copy structs..." >&4
11889 $cat >try.c <<'EOCP'
11890 int main()
11891 {
11892         struct blurfl {
11893                 int dyick;
11894         } foo, bar;
11895
11896         foo = bar;
11897 }
11898 EOCP
11899 if $cc -c try.c >/dev/null 2>&1 ; then
11900         val="$define"
11901         echo "Yup, it can."
11902 else
11903         val="$undef"
11904         echo "Nope, it can't."
11905 fi
11906 set d_strctcpy
11907 eval $setvar
11908 $rm -f try.*
11909
11910 : see if strerror and/or sys_errlist[] exist
11911 echo " "
11912 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11913     if set strerror val -f d_strerror; eval $csym; $val; then
11914                 echo 'strerror() found.' >&4
11915                 d_strerror="$define"
11916                 d_strerrm='strerror(e)'
11917                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11918                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11919                         d_syserrlst="$define"
11920                 else
11921                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11922                         d_syserrlst="$undef"
11923                 fi
11924     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11925                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11926                 echo 'strerror() found in string header.' >&4
11927                 d_strerror="$define"
11928                 d_strerrm='strerror(e)'
11929                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11930                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11931                                 d_syserrlst="$define"
11932                 else
11933                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11934                         d_syserrlst="$undef"
11935                 fi
11936     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11937                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11938                 d_strerror="$undef"
11939                 d_syserrlst="$define"
11940                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11941     else
11942                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11943                 d_strerror="$undef"
11944                 d_syserrlst="$undef"
11945                 d_strerrm='"unknown"'
11946     fi
11947 fi
11948
11949 : see if strtod exists
11950 set strtod d_strtod
11951 eval $inlibc
11952
11953 : see if strtol exists
11954 set strtol d_strtol
11955 eval $inlibc
11956
11957 : see if strtold exists
11958 set strtold d_strtold
11959 eval $inlibc
11960
11961 : see if strtoll exists
11962 set strtoll d_strtoll
11963 eval $inlibc
11964
11965 case "$d_longlong-$d_strtoll" in
11966 "$define-$define")
11967         $cat <<EOM
11968 Checking whether your strtoll() works okay...
11969 EOM
11970         $cat >try.c <<'EOCP'
11971 #include <errno.h>
11972 #ifdef __hpux
11973 #define strtoll __strtoll
11974 #endif
11975 #ifdef __EMX__
11976 #define strtoll _strtoll
11977 #endif
11978 #include <stdio.h>
11979 extern long long int strtoll(char *s, char **, int); 
11980 static int bad = 0;
11981 int check(char *s, long long ell, int een) {
11982         long long gll;
11983         errno = 0;
11984         gll = strtoll(s, 0, 10);
11985         if (!((gll == ell) && (errno == een)))
11986                 bad++;
11987 }
11988 int main() {
11989         check(" 1",                                      1LL, 0);
11990         check(" 0",                                      0LL, 0);
11991         check("-1",                                     -1LL, 0);
11992         check("-9223372036854775808", -9223372036854775808LL, 0);
11993         check("-9223372036854775808", -9223372036854775808LL, 0);
11994         check(" 9223372036854775807",  9223372036854775807LL, 0);
11995         check("-9223372036854775808", -9223372036854775808LL, 0);
11996         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11997         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11998         if (!bad)
11999                 printf("ok\n");
12000 }
12001 EOCP
12002         set try
12003         if eval $compile; then
12004                 yyy=`./try`
12005                 case "$yyy" in
12006                 ok) echo "Your strtoll() seems to be working okay." ;;
12007                 *) cat <<EOM >&4
12008 Your strtoll() doesn't seem to be working okay.
12009 EOM
12010                    d_strtoll="$undef"
12011                    ;;
12012                 esac
12013         else
12014                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12015                 d_strtoll="$undef"
12016         fi
12017         ;;
12018 esac
12019
12020 : see if strtoq exists
12021 set strtoq d_strtoq
12022 eval $inlibc
12023
12024 : see if strtoul exists
12025 set strtoul d_strtoul
12026 eval $inlibc
12027
12028 case "$d_strtoul" in
12029 "$define")
12030         $cat <<EOM
12031 Checking whether your strtoul() works okay...
12032 EOM
12033         $cat >try.c <<'EOCP'
12034 #include <errno.h>
12035 #include <stdio.h>
12036 extern unsigned long int strtoul(char *s, char **, int); 
12037 static int bad = 0;
12038 void check(char *s, unsigned long eul, int een) {
12039         unsigned long gul;
12040         errno = 0;
12041         gul = strtoul(s, 0, 10);
12042         if (!((gul == eul) && (errno == een)))
12043                 bad++;
12044 }
12045 int main() {
12046         check(" 1", 1L, 0);
12047         check(" 0", 0L, 0);
12048 EOCP
12049         case "$longsize" in
12050         8)
12051             $cat >>try.c <<'EOCP'
12052         check("18446744073709551615", 18446744073709551615UL, 0);
12053         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12054 #if 0 /* strtoul() for /^-/ strings is undefined. */
12055         check("-1", 18446744073709551615UL, 0);
12056         check("-18446744073709551614", 2, 0);
12057         check("-18446744073709551615", 1, 0);
12058         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12059         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12060 #endif
12061 EOCP
12062                 ;;
12063         4)
12064                     $cat >>try.c <<'EOCP'
12065         check("4294967295", 4294967295UL, 0);
12066         check("4294967296", 4294967295UL, ERANGE);
12067 #if 0 /* strtoul() for /^-/ strings is undefined. */
12068         check("-1", 4294967295UL, 0);
12069         check("-4294967294", 2, 0);
12070         check("-4294967295", 1, 0);
12071         check("-4294967296", 4294967295UL, ERANGE);
12072         check("-4294967297", 4294967295UL, ERANGE);
12073 #endif
12074 EOCP
12075                 ;;
12076         *)
12077 : Should we write these tests to be more portable by sprintf-ing
12078 : ~0 and then manipulating that char string as input for strtol?
12079                 ;;
12080         esac
12081         $cat >>try.c <<'EOCP'
12082         if (!bad)
12083                 printf("ok\n");
12084         return 0;
12085 }
12086 EOCP
12087         set try
12088         if eval $compile; then
12089                 case "`./try`" in
12090                 ok) echo "Your strtoul() seems to be working okay." ;;
12091                 *) cat <<EOM >&4
12092 Your strtoul() doesn't seem to be working okay.
12093 EOM
12094                    d_strtoul="$undef"
12095                    ;;
12096                 esac
12097         fi
12098         ;;
12099 esac
12100
12101 : see if strtoull exists
12102 set strtoull d_strtoull
12103 eval $inlibc
12104
12105 case "$d_longlong-$d_strtoull" in
12106 "$define-$define")
12107         $cat <<EOM
12108 Checking whether your strtoull() works okay...
12109 EOM
12110         $cat >try.c <<'EOCP'
12111 #include <errno.h>
12112 #ifdef __hpux
12113 #define strtoull __strtoull
12114 #endif
12115 #include <stdio.h>
12116 extern unsigned long long int strtoull(char *s, char **, int); 
12117 static int bad = 0;
12118 int check(char *s, long long eull, int een) {
12119         long long gull;
12120         errno = 0;
12121         gull = strtoull(s, 0, 10);
12122         if (!((gull == eull) && (errno == een)))
12123                 bad++;
12124 }
12125 int main() {
12126         check(" 1",                                        1LL, 0);
12127         check(" 0",                                        0LL, 0);
12128         check("18446744073709551615",  18446744073709551615ULL, 0);
12129         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12130 #if 0 /* strtoull() for /^-/ strings is undefined. */
12131         check("-1",                    18446744073709551615ULL, 0);
12132         check("-18446744073709551614",                     2LL, 0);
12133         check("-18446744073709551615",                     1LL, 0);
12134         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12135         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12136 #endif
12137         if (!bad)
12138                 printf("ok\n");
12139 }
12140 EOCP
12141         set try
12142         if eval $compile; then
12143                 case "`./try`" in
12144                 ok) echo "Your strtoull() seems to be working okay." ;;
12145                 *) cat <<EOM >&4
12146 Your strtoull() doesn't seem to be working okay.
12147 EOM
12148                    d_strtoull="$undef"
12149                    ;;
12150                 esac
12151         fi
12152         ;;
12153 esac
12154
12155 : see if strtouq exists
12156 set strtouq d_strtouq
12157 eval $inlibc
12158
12159 case "$d_strtouq" in
12160 "$define")
12161         $cat <<EOM
12162 Checking whether your strtouq() works okay...
12163 EOM
12164         $cat >try.c <<'EOCP'
12165 #include <errno.h>
12166 #include <stdio.h>
12167 extern unsigned long long int strtouq(char *s, char **, int); 
12168 static int bad = 0;
12169 void check(char *s, unsigned long long eull, int een) {
12170         unsigned long long gull;
12171         errno = 0;
12172         gull = strtouq(s, 0, 10);
12173         if (!((gull == eull) && (errno == een)))
12174                 bad++;
12175 }
12176 int main() {
12177         check(" 1",                                        1LL, 0);
12178         check(" 0",                                        0LL, 0);
12179         check("18446744073709551615",  18446744073709551615ULL, 0);
12180         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12181 #if 0 /* strtouq() for /^-/ strings is undefined. */
12182         check("-1",                    18446744073709551615ULL, 0);
12183         check("-18446744073709551614",                     2LL, 0);
12184         check("-18446744073709551615",                     1LL, 0);
12185         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12186         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12187 #endif
12188         if (!bad)
12189                 printf("ok\n");
12190         return 0;
12191 }
12192 EOCP
12193         set try
12194         if eval $compile; then
12195                 case "`./try`" in
12196                 ok) echo "Your strtouq() seems to be working okay." ;;
12197                 *) cat <<EOM >&4
12198 Your strtouq() doesn't seem to be working okay.
12199 EOM
12200                    d_strtouq="$undef"
12201                    ;;
12202                 esac
12203         fi
12204         ;;
12205 esac
12206
12207 : see if strxfrm exists
12208 set strxfrm d_strxfrm
12209 eval $inlibc
12210
12211 : see if symlink exists
12212 set symlink d_symlink
12213 eval $inlibc
12214
12215 : see if syscall exists
12216 set syscall d_syscall
12217 eval $inlibc
12218
12219 : see if sysconf exists
12220 set sysconf d_sysconf
12221 eval $inlibc
12222
12223 : see if system exists
12224 set system d_system
12225 eval $inlibc
12226
12227 : see if tcgetpgrp exists
12228 set tcgetpgrp d_tcgetpgrp
12229 eval $inlibc
12230
12231 : see if tcsetpgrp exists
12232 set tcsetpgrp d_tcsetpgrp
12233 eval $inlibc
12234
12235 : see if prototype for telldir is available
12236 echo " "
12237 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12238 eval $hasproto
12239
12240 : see if this is a sys/times.h system
12241 set sys/times.h i_systimes
12242 eval $inhdr
12243
12244 : see if times exists
12245 echo " "
12246 if set times val -f d_times; eval $csym; $val; then
12247         echo 'times() found.' >&4
12248         d_times="$define"
12249         inc=''
12250         case "$i_systimes" in
12251         "$define") inc='sys/times.h';;
12252         esac
12253         rp="What is the type returned by times() on this system?"
12254         set clock_t clocktype long stdio.h sys/types.h $inc
12255         eval $typedef_ask
12256 else
12257         echo 'times() NOT found, hope that will do.' >&4
12258         d_times="$undef"
12259         clocktype='int'
12260 fi
12261
12262 : see if truncate exists
12263 set truncate d_truncate
12264 eval $inlibc
12265
12266 : see if tzname[] exists
12267 echo " "
12268 if set tzname val -a d_tzname; eval $csym; $val; then
12269         val="$define"
12270         echo 'tzname[] found.' >&4
12271 else
12272         val="$undef"
12273         echo 'tzname[] NOT found.' >&4
12274 fi
12275 set d_tzname
12276 eval $setvar
12277
12278 : see if umask exists
12279 set umask d_umask
12280 eval $inlibc
12281
12282 : see if ustat exists
12283 set ustat d_ustat
12284 eval $inlibc
12285
12286 : backward compatibility for d_hvfork
12287 if test X$d_hvfork != X; then
12288         d_vfork="$d_hvfork"
12289         d_hvfork=''
12290 fi
12291 : see if there is a vfork
12292 val=''
12293 set vfork val
12294 eval $inlibc
12295
12296 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12297 : perl on Solaris 2.x, and probably elsewhere.
12298 case "$val" in
12299 $define)
12300         echo " "
12301         case "$usevfork" in
12302         false) dflt='n';;
12303         *) dflt='y';;
12304         esac
12305         cat <<'EOM'
12306  
12307 Perl can only use a vfork() that doesn't suffer from strict
12308 restrictions on calling functions or modifying global data in
12309 the child.  For example, glibc-2.1 contains such a vfork()
12310 that is unsuitable.  If your system provides a proper fork()
12311 call, chances are that you do NOT want perl to use vfork().
12312
12313 EOM
12314         rp="Do you still want to use vfork()?"
12315         . ./myread
12316         case "$ans" in
12317         y|Y) ;;
12318         *)
12319                 echo "Ok, we won't use vfork()."
12320                 val="$undef"
12321                 ;;
12322         esac
12323         ;;
12324 esac
12325 set d_vfork
12326 eval $setvar
12327 case "$d_vfork" in
12328 $define) usevfork='true';;
12329 *) usevfork='false';;
12330 esac
12331
12332 : see if this is an sysdir system
12333 set sys/dir.h i_sysdir
12334 eval $inhdr
12335
12336 : see if this is an sysndir system
12337 set sys/ndir.h i_sysndir
12338 eval $inhdr
12339
12340 : see if closedir exists
12341 set closedir d_closedir
12342 eval $inlibc
12343
12344 case "$d_closedir" in
12345 "$define")
12346         echo " "
12347         echo "Checking whether closedir() returns a status..." >&4
12348         cat > closedir.c <<EOM
12349 #$i_dirent I_DIRENT             /**/
12350 #$i_sysdir I_SYS_DIR            /**/
12351 #$i_sysndir I_SYS_NDIR          /**/
12352 #$i_systypes I_SYS_TYPES        /**/
12353
12354 #if defined(I_SYS_TYPES)
12355 #include <sys/types.h>
12356 #endif
12357 #if defined(I_DIRENT)
12358 #include <dirent.h>
12359 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12360 #include <sys/dir.h>
12361 #endif
12362 #else
12363 #ifdef I_SYS_NDIR
12364 #include <sys/ndir.h>
12365 #else
12366 #ifdef I_SYS_DIR
12367 #ifdef hp9000s500
12368 #include <ndir.h>       /* may be wrong in the future */
12369 #else
12370 #include <sys/dir.h>
12371 #endif
12372 #endif
12373 #endif
12374 #endif 
12375 int main() { return closedir(opendir(".")); }
12376 EOM
12377         set closedir
12378         if eval $compile_ok; then
12379                 if ./closedir > /dev/null 2>&1 ; then
12380                         echo "Yes, it does."
12381                         val="$undef"
12382                 else
12383                         echo "No, it doesn't."
12384                         val="$define"
12385                 fi
12386         else
12387                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12388                 val="$define"
12389         fi
12390         ;;
12391 *)
12392         val="$undef";
12393         ;;
12394 esac
12395 set d_void_closedir
12396 eval $setvar
12397 $rm -f closedir*
12398 : see if there is a wait4
12399 set wait4 d_wait4
12400 eval $inlibc
12401
12402 : see if waitpid exists
12403 set waitpid d_waitpid
12404 eval $inlibc
12405
12406 : see if wcstombs exists
12407 set wcstombs d_wcstombs
12408 eval $inlibc
12409
12410 : see if wctomb exists
12411 set wctomb d_wctomb
12412 eval $inlibc
12413
12414 : preserve RCS keywords in files with variable substitution, grrr
12415 Date='$Date'
12416 Id='$Id'
12417 Log='$Log'
12418 RCSfile='$RCSfile'
12419 Revision='$Revision'
12420
12421 case "$crosscompile" in
12422 ''|[nN]*) crosscompile="$undef" ;;
12423 esac
12424
12425 case "$osname" in
12426 next|rhapsody|darwin) multiarch="$define" ;;
12427 esac
12428 case "$multiarch" in
12429 ''|[nN]*) multiarch="$undef" ;;
12430 esac
12431
12432 : check for alignment requirements
12433 echo " "
12434 case "$crosscompile$multiarch" in
12435 *$define*)
12436         $cat <<EOM
12437 You seem to be either cross-compiling or doing a multiarchitecture build,
12438 skipping the memory alignment check.
12439
12440 EOM
12441         case "$alignbytes" in
12442         '') alignbytes=8 ;;
12443         esac
12444         ;;
12445 *)
12446         case "$alignbytes" in
12447         '') echo "Checking alignment constraints..." >&4
12448                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12449                         $cat >try.c <<'EOCP'
12450 typedef long double NV;
12451 EOCP
12452                 else
12453                         $cat >try.c <<'EOCP'
12454 typedef double NV;
12455 EOCP
12456                 fi
12457                 $cat >>try.c <<'EOCP'
12458 #include <stdio.h>
12459 struct foobar {
12460         char foo;
12461         NV bar;
12462 } try_algn;
12463 int main()
12464 {
12465     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12466     return(0);
12467 }
12468 EOCP
12469                 set try
12470                 if eval $compile_ok; then
12471                         dflt=`./try`
12472                 else
12473                         dflt='8'
12474                         echo "(I can't seem to compile the test program...)"
12475                 fi
12476                 ;;
12477         *) dflt="$alignbytes"
12478                 ;;
12479         esac
12480         rp="Doubles must be aligned on a how-many-byte boundary?"
12481         . ./myread
12482         alignbytes="$ans"
12483         $rm -f try.c try
12484         ;;
12485 esac
12486
12487
12488 : set the base revision
12489 baserev=5.0
12490
12491 : check for ordering of bytes in a long
12492 echo " "
12493 case "$crosscompile$multiarch" in
12494 *$define*)
12495         $cat <<EOM
12496 You seem to be either cross-compiling or doing a multiarchitecture build,
12497 skipping the byteorder check.
12498
12499 EOM
12500         byteorder='0xffff'
12501         ;;
12502 *)
12503         case "$byteorder" in
12504         '')
12505                 $cat <<'EOM'
12506 In the following, larger digits indicate more significance.  A big-endian
12507 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12508 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12509 machines may have weird orders like 3412.  A Cray will report 87654321,
12510 an Alpha will report 12345678. If the test program works the default is
12511 probably right.
12512 I'm now running the test program...
12513 EOM
12514                 $cat >try.c <<'EOCP'
12515 #include <stdio.h>
12516 int main()
12517 {
12518         int i;
12519         union {
12520                 unsigned long l;
12521                 char c[sizeof(long)];
12522         } u;
12523
12524         if (sizeof(long) > 4)
12525                 u.l = (0x08070605L << 32) | 0x04030201L;
12526         else
12527                 u.l = 0x04030201L;
12528         for (i = 0; i < sizeof(long); i++)
12529                 printf("%c", u.c[i]+'0');
12530         printf("\n");
12531         exit(0);
12532 }
12533 EOCP
12534                 xxx_prompt=y
12535                 set try
12536                 if eval $compile && ./try > /dev/null; then
12537                         dflt=`./try`
12538                         case "$dflt" in
12539                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12540                                 echo "(The test program ran ok.)"
12541                                 echo "byteorder=$dflt"
12542                                 xxx_prompt=n
12543                         ;;
12544                         ????|????????) echo "(The test program ran ok.)" ;;
12545                         *) echo "(The test program didn't run right for some reason.)" ;;
12546                         esac
12547                 else
12548                         dflt='4321'
12549                         cat <<'EOM'
12550 (I can't seem to compile the test program.  Guessing big-endian...)
12551 EOM
12552                 fi
12553                 case "$xxx_prompt" in
12554                 y)
12555                         rp="What is the order of bytes in a long?"
12556                         . ./myread
12557                         byteorder="$ans"
12558                         ;;
12559                 *)      byteorder=$dflt
12560                         ;;
12561                 esac
12562                 ;;
12563         esac
12564         $rm -f try.c try
12565         ;;
12566 esac
12567
12568
12569 : how do we catenate cpp tokens here?
12570 echo " "
12571 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12572 $cat >cpp_stuff.c <<'EOCP'
12573 #define RCAT(a,b)a/**/b
12574 #define ACAT(a,b)a ## b
12575 RCAT(Rei,ser)
12576 ACAT(Cir,cus)
12577 EOCP
12578 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12579 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12580         echo "Oh!  Smells like ANSI's been here." >&4
12581         echo "We can catify or stringify, separately or together!"
12582         cpp_stuff=42
12583 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12584         echo "Ah, yes!  The good old days!" >&4
12585         echo "However, in the good old days we don't know how to stringify and"
12586         echo "catify at the same time."
12587         cpp_stuff=1
12588 else
12589         $cat >&4 <<EOM
12590 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12591 to have to edit the values of CAT[2-5] in config.h...
12592 EOM
12593         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12594 fi
12595 $rm -f cpp_stuff.*
12596
12597 : see if this is a db.h system
12598 set db.h i_db
12599 eval $inhdr
12600
12601 case "$i_db" in
12602 $define)
12603         : Check db version.
12604         echo " "
12605         echo "Checking Berkeley DB version ..." >&4
12606         $cat >try.c <<EOCP
12607 #$d_const HASCONST
12608 #ifndef HASCONST
12609 #define const
12610 #endif
12611 #include <sys/types.h>
12612 #include <stdio.h>
12613 #include <db.h>
12614 int main()
12615 {
12616 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12617     int Major, Minor, Patch ;
12618     unsigned long Version ;
12619     (void)db_version(&Major, &Minor, &Patch) ;
12620     printf("You have Berkeley DB Version 2 or greater\n");
12621
12622     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12623                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12624     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12625                 Major, Minor, Patch) ;
12626
12627     /* check that db.h & libdb are compatible */
12628     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12629         printf("db.h and libdb are incompatible\n") ;
12630         exit(3);        
12631     }
12632
12633     printf("db.h and libdb are compatible\n") ;
12634
12635     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12636                 + DB_VERSION_PATCH ;
12637
12638     /* needs to be >= 2.3.4 */
12639     if (Version < 2003004) {
12640     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12641         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12642         exit(2);        
12643     }
12644
12645     exit(0);
12646 #else
12647 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12648     printf("You have Berkeley DB Version 1\n");
12649     exit(0);    /* DB version < 2: the coast is clear. */
12650 #else
12651     exit(1);    /* <db.h> not Berkeley DB? */
12652 #endif
12653 #endif
12654 }
12655 EOCP
12656         set try
12657         if eval $compile_ok && ./try; then
12658                 echo 'Looks OK.' >&4
12659         else
12660                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12661                 i_db=$undef
12662                 case " $libs " in
12663                 *"-ldb "*)
12664                         : Remove db from list of libraries to use
12665                         echo "Removing unusable -ldb from library list" >&4
12666                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12667                         shift
12668                         libs="$*"
12669                         echo "libs = $libs" >&4
12670                         ;;
12671                 esac
12672         fi
12673         $rm -f try.*
12674         ;;
12675 esac
12676
12677 case "$i_db" in
12678 define)
12679         : Check the return type needed for hash 
12680         echo " "
12681         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12682         $cat >try.c <<EOCP
12683 #$d_const HASCONST
12684 #ifndef HASCONST
12685 #define const
12686 #endif
12687 #include <sys/types.h>
12688 #include <db.h>
12689
12690 #ifndef DB_VERSION_MAJOR
12691 u_int32_t hash_cb (ptr, size)
12692 const void *ptr;
12693 size_t size;
12694 {
12695 }
12696 HASHINFO info;
12697 int main()
12698 {
12699         info.hash = hash_cb;
12700 }
12701 #endif
12702 EOCP
12703         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12704                 if $contains warning try.out >>/dev/null 2>&1 ; then
12705                         db_hashtype='int'
12706                 else
12707                         db_hashtype='u_int32_t'
12708                 fi
12709         else
12710                 : XXX Maybe we should just give up here.
12711                 db_hashtype=u_int32_t
12712                 $cat try.out >&4
12713                 echo "Help:  I can't seem to compile the db test program." >&4
12714                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12715         fi
12716         $rm -f try.*
12717         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12718         ;;
12719 *)      db_hashtype=u_int32_t
12720         ;;
12721 esac
12722 case "$i_db" in
12723 define)
12724         : Check the return type needed for prefix 
12725         echo " "
12726         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12727         cat >try.c <<EOCP
12728 #$d_const HASCONST
12729 #ifndef HASCONST
12730 #define const
12731 #endif
12732 #include <sys/types.h>
12733 #include <db.h>
12734
12735 #ifndef DB_VERSION_MAJOR
12736 size_t prefix_cb (key1, key2)
12737 const DBT *key1;
12738 const DBT *key2;
12739 {
12740 }
12741 BTREEINFO info;
12742 int main()
12743 {
12744         info.prefix = prefix_cb;
12745 }
12746 #endif
12747 EOCP
12748         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12749                 if $contains warning try.out >>/dev/null 2>&1 ; then
12750                         db_prefixtype='int'
12751                 else
12752                         db_prefixtype='size_t'
12753                 fi
12754         else
12755                 db_prefixtype='size_t'
12756                 : XXX Maybe we should just give up here.
12757                 $cat try.out >&4
12758                 echo "Help:  I can't seem to compile the db test program." >&4
12759                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12760         fi
12761         $rm -f try.*
12762         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12763         ;;
12764 *)      db_prefixtype='size_t'
12765         ;;
12766 esac
12767
12768 : check for void type
12769 echo " "
12770 echo "Checking to see how well your C compiler groks the void type..." >&4
12771 case "$voidflags" in
12772 '')
12773         $cat >try.c <<'EOCP'
12774 #if TRY & 1
12775 void sub() {
12776 #else
12777 sub() {
12778 #endif
12779         extern void moo();      /* function returning void */
12780         void (*goo)();          /* ptr to func returning void */
12781 #if TRY & 8
12782         void *hue;              /* generic ptr */
12783 #endif
12784 #if TRY & 2
12785         void (*foo[10])();
12786 #endif
12787
12788 #if TRY & 4
12789         if(goo == moo) {
12790                 exit(0);
12791         }
12792 #endif
12793         exit(0);
12794 }
12795 int main() { sub(); }
12796 EOCP
12797         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12798                 voidflags=$defvoidused
12799         echo "Good.  It appears to support void to the level $package wants.">&4
12800                 if $contains warning .out >/dev/null 2>&1; then
12801                         echo "However, you might get some warnings that look like this:"
12802                         $cat .out
12803                 fi
12804         else
12805 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12806                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12807                         echo "It supports 1..."
12808                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12809                                 echo "It also supports 2..."
12810                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12811                                         voidflags=7
12812                                         echo "And it supports 4 but not 8 definitely."
12813                                 else
12814                                         echo "It doesn't support 4..."
12815                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12816                                                 voidflags=11
12817                                                 echo "But it supports 8."
12818                                         else
12819                                                 voidflags=3
12820                                                 echo "Neither does it support 8."
12821                                         fi
12822                                 fi
12823                         else
12824                                 echo "It does not support 2..."
12825                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12826                                         voidflags=13
12827                                         echo "But it supports 4 and 8."
12828                                 else
12829                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12830                                                 voidflags=5
12831                                                 echo "And it supports 4 but has not heard about 8."
12832                                         else
12833                                                 echo "However it supports 8 but not 4."
12834                                         fi
12835                                 fi
12836                         fi
12837                 else
12838                         echo "There is no support at all for void."
12839                         voidflags=0
12840                 fi
12841         fi
12842 esac
12843 case "$voidflags" in
12844 "$defvoidused") ;;
12845 *)      $cat >&4 <<'EOM'
12846   Support flag bits are:
12847     1: basic void declarations.
12848     2: arrays of pointers to functions returning void.
12849     4: operations between pointers to and addresses of void functions.
12850     8: generic void pointers.
12851 EOM
12852         dflt="$voidflags";
12853         rp="Your void support flags add up to what?"
12854         . ./myread
12855         voidflags="$ans"
12856         ;;
12857 esac
12858 $rm -f try.* .out
12859
12860
12861 : How can we generate normalized random numbers ?
12862 echo " "
12863 echo "Looking for a random number function..." >&4
12864 case "$randfunc" in
12865 '')
12866         if set drand48 val -f; eval $csym; $val; then
12867                 dflt="drand48"
12868                 echo "Good, found drand48()." >&4
12869         elif set random val -f; eval $csym; $val; then
12870                 dflt="random"
12871                 echo "OK, found random()." >&4
12872         else
12873                 dflt="rand"
12874                 echo "Yick, looks like I have to use rand()." >&4
12875         fi
12876         echo " "
12877         ;;
12878 *)
12879         dflt="$randfunc"
12880         ;;
12881 esac
12882 cont=true
12883
12884 case "$ccflags" in
12885 *-Dmy_rand=*|*-Dmy_srand=*)
12886         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12887         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12888         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12889         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12890         ;;
12891 esac
12892
12893 while $test "$cont"; do
12894         rp="Use which function to generate random numbers?"
12895         . ./myread
12896         if $test "$ans" = "$dflt"; then
12897                 : null
12898         else
12899                 randbits=''
12900         fi
12901         randfunc="$ans"
12902         if set $ans val -f; eval $csym; $val; then
12903                 cont=''
12904         else
12905                 dflt=y
12906                 rp="I cannot find function $ans. Use that name anyway?"
12907                 . ./myread
12908                 dflt=rand
12909                 case "$ans" in
12910                         [yY]*) cont='';;
12911                 esac
12912         fi
12913         case "$cont" in
12914         '')
12915                 case "$randfunc" in
12916                 drand48)
12917                         drand01="drand48()"
12918                         seedfunc="srand48"
12919                         randbits=48
12920                         randseedtype=long
12921                         ;;
12922                 rand|random)
12923                         case "$randbits" in
12924                         '')
12925 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12926                                 $cat >try.c <<EOCP
12927 #$i_unistd I_UNISTD
12928 #$i_stdlib I_STDLIB
12929 #include <stdio.h>
12930 #ifdef I_UNISTD
12931 #  include <unistd.h>
12932 #endif
12933 #ifdef I_STDLIB
12934 #  include <stdlib.h>
12935 #endif
12936 int main()
12937 {
12938         register int i;
12939         register unsigned long tmp;
12940         register unsigned long max = 0L;
12941
12942         for (i = 1000; i; i--) {
12943                 tmp = (unsigned long) $randfunc();
12944                 if (tmp > max) max = tmp;
12945         }
12946         for (i = 0; max; i++)
12947                 max /= 2;
12948         printf("%d\n",i);
12949 }
12950 EOCP
12951                                 set try
12952                                 if eval $compile_ok; then
12953                                         dflt=`try`
12954                                 else
12955                                         dflt='?'
12956                                         echo "(I can't seem to compile the test program...)"
12957                                 fi
12958                                 ;;
12959                         *)
12960                                 dflt="$randbits"
12961                                 ;;
12962                         esac
12963                         rp="How many bits does your $randfunc() function produce?"
12964                         . ./myread
12965                         randbits="$ans"
12966                         $rm -f try.c try
12967                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12968                         seedfunc="s$randfunc"
12969                         randseedtype=unsigned
12970                         ;;
12971                 *)
12972                         dflt="31"
12973                         rp="How many bits does your $randfunc() function produce?"
12974                         . ./myread
12975                         randbits="$ans"
12976                         seedfunc="s$randfunc"
12977                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12978                         if set $seedfunc val -f; eval $csym; $val; then
12979                                 echo "(Using $seedfunc() to seed random generator)"
12980                         else
12981                                 echo "(Warning: no $seedfunc() to seed random generator)"
12982                                 seedfunc=rand
12983                         fi
12984                         randseedtype=unsigned
12985                         ;;
12986                 esac
12987                 ;;
12988         esac
12989 done
12990
12991 echo " "
12992 echo "Determining whether or not we are on an EBCDIC system..." >&4
12993 $cat >tebcdic.c <<'EOM'
12994 int main()
12995 {
12996   if ('M'==0xd4) return 0;
12997   return 1;
12998 }
12999 EOM
13000
13001 val=$undef
13002 set tebcdic
13003 if eval $compile_ok; then
13004         if ./tebcdic; then
13005                 echo "You seem to speak EBCDIC." >&4
13006                 val="$define"
13007         else
13008                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13009         fi
13010 else
13011         echo "I'm unable to compile the test program." >&4
13012         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13013 fi
13014 $rm -f tebcdic.c tebcdic
13015 set ebcdic
13016 eval $setvar
13017
13018 echo " "
13019 $cat >&4 <<EOM
13020 Checking how to flush all pending stdio output...
13021 EOM
13022 # I only know how to find the first 32 possibly open files on SunOS.
13023 # See also hints/sunos_4_1.sh and util.c  --AD
13024 case "$osname" in
13025 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13026 esac
13027 $cat >>try.c <<EOCP
13028 #include <stdio.h>
13029 #$i_unistd I_UNISTD
13030 #ifdef I_UNISTD
13031 # include <unistd.h>
13032 #endif
13033 #$d_sysconf HAS_SYSCONF
13034 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13035 #ifdef HAS_STDIO_STREAM_ARRAY
13036 # define STDIO_STREAM_ARRAY $stdio_stream_array
13037 #endif
13038 int main() {
13039   FILE* p = fopen("try.out", "w");
13040 #ifdef TRY_FPUTC
13041   fputc('x', p);
13042 #else
13043 # ifdef TRY_FPRINTF
13044   fprintf(p, "x");
13045 # endif
13046 #endif
13047 #ifdef TRY_FFLUSH_NULL
13048   fflush(NULL);
13049 #endif
13050 #ifdef TRY_FFLUSH_ALL
13051   {
13052     long open_max = -1;
13053 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13054     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13055 # else
13056 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13057     open_max = sysconf(_SC_OPEN_MAX);
13058 #  else
13059 #   ifdef FOPEN_MAX
13060     open_max = FOPEN_MAX;
13061 #   else
13062 #    ifdef OPEN_MAX
13063     open_max = OPEN_MAX;
13064 #    else
13065 #     ifdef _NFILE
13066     open_max = _NFILE;
13067 #     endif
13068 #    endif
13069 #   endif
13070 #  endif
13071 # endif 
13072 # ifdef HAS_STDIO_STREAM_ARRAY
13073     if (open_max > 0) {
13074       long i;
13075       for (i = 0; i < open_max; i++)
13076             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13077                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13078                 STDIO_STREAM_ARRAY[i]._flag)
13079                 fflush(&STDIO_STREAM_ARRAY[i]);
13080     }   
13081   }
13082 # endif
13083 #endif
13084   _exit(42);
13085 }
13086 EOCP
13087 : first we have to find out how _not_ to flush
13088 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13089     output=''
13090     set try -DTRY_FPUTC
13091     if eval $compile; then
13092             $rm -f try.out
13093             ./try$exe_ext 2>/dev/null
13094             if $test ! -s try.out -a "X$?" = X42; then
13095                 output=-DTRY_FPUTC
13096             fi
13097     fi
13098     case "$output" in
13099     '')
13100             set try -DTRY_FPRINTF
13101             $rm -f try.out
13102             if eval $compile; then
13103                     $rm -f try.out
13104                     ./try$exe_ext 2>/dev/null
13105                     if $test ! -s try.out -a "X$?" = X42; then
13106                         output=-DTRY_FPRINTF
13107                     fi
13108             fi
13109         ;;
13110     esac
13111 fi
13112 : check for fflush NULL behaviour
13113 case "$fflushNULL" in
13114 '')     set try -DTRY_FFLUSH_NULL $output
13115         if eval $compile; then
13116                 $rm -f try.out
13117                 ./try$exe_ext 2>/dev/null
13118                 code="$?"
13119                 if $test -s try.out -a "X$code" = X42; then
13120                         fflushNULL="`$cat try.out`"
13121                 else
13122                         if $test "X$code" != X42; then
13123                                 $cat >&4 <<EOM
13124 (If this test failed, don't worry, we'll try another method shortly.)
13125 EOM
13126                         fi
13127                 fi
13128         fi
13129         $rm -f core try.core core.try.*
13130         case "$fflushNULL" in
13131         x)      $cat >&4 <<EOM
13132 Your fflush(NULL) works okay for output streams.
13133 Let's see if it clobbers input pipes...
13134 EOM
13135 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13136 # bug that improperly flushes the input end of pipes.  So we avoid the
13137 # autoflush on fork/system/exec support for now. :-(
13138 $cat >tryp.c <<EOCP
13139 #include <stdio.h>
13140 int
13141 main(int argc, char **argv)
13142 {
13143     char buf[1024];
13144     int i;
13145     char *bp = buf;
13146     while (1) {
13147         while ((i = getc(stdin)) != -1
13148                && (*bp++ = i) != '\n'
13149                && bp < &buf[1024])
13150         /* DO NOTHING */ ;
13151         *bp = '\0';
13152         fprintf(stdout, "%s", buf);
13153         fflush(NULL);
13154         if (i == -1)
13155             return 0;
13156         bp = buf;
13157     }
13158 }
13159 EOCP
13160                 fflushNULL="$define"
13161                 set tryp
13162                 if eval $compile; then
13163                     $rm -f tryp.out
13164                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13165                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13166                        $cat >&4 <<EOM
13167 fflush(NULL) seems to behave okay with input streams.
13168 EOM
13169                         fflushNULL="$define"
13170                     else
13171                         $cat >&4 <<EOM
13172 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13173 EOM
13174                         fflushNULL="$undef"
13175                     fi
13176                 fi
13177                 $rm -f core tryp.c tryp.core core.tryp.*
13178                 ;;
13179         '')     $cat >&4 <<EOM
13180 Your fflush(NULL) isn't working (contrary to ANSI C).
13181 EOM
13182                 fflushNULL="$undef"
13183                 ;;
13184         *)      $cat >&4 <<EOM
13185 Cannot figure out whether your fflush(NULL) works or not.
13186 I'm assuming it doesn't (contrary to ANSI C).
13187 EOM
13188                 fflushNULL="$undef"
13189                 ;;
13190         esac
13191         ;;
13192 $define|true|[yY]*)
13193         fflushNULL="$define"
13194         ;;
13195 *)
13196         fflushNULL="$undef"
13197         ;;
13198 esac
13199 : check explicit looping only if NULL did not work, and if the pipe
13200 : bug does not show up on an explicit flush too
13201 case "$fflushNULL" in
13202 "$undef")
13203         $cat >tryp.c <<EOCP
13204 #include <stdio.h>
13205 int
13206 main(int argc, char **argv)
13207 {
13208     char buf[1024];
13209     int i;
13210     char *bp = buf;
13211     while (1) {
13212         while ((i = getc(stdin)) != -1
13213                && (*bp++ = i) != '\n'
13214                && bp < &buf[1024])
13215         /* DO NOTHING */ ;
13216         *bp = '\0';
13217         fprintf(stdout, "%s", buf);
13218         fflush(stdin);
13219         if (i == -1)
13220             return 0;
13221         bp = buf;
13222     }
13223 }
13224 EOCP
13225         set tryp
13226         if eval $compile; then
13227             $rm -f tryp.out
13228             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13229             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13230                $cat >&4 <<EOM
13231 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13232 EOM
13233                 : now check for fflushall behaviour
13234                 case "$fflushall" in
13235                 '')     set try -DTRY_FFLUSH_ALL $output
13236                         if eval $compile; then
13237                                 $cat >&4 <<EOM
13238 (Now testing the other method--but note that this also may fail.)
13239 EOM
13240                                 $rm -f try.out
13241                                 ./try$exe_ext 2>/dev/null
13242                                 if $test -s try.out -a "X$?" = X42; then
13243                                         fflushall="`$cat try.out`"
13244                                 fi
13245                         fi
13246                         $rm -f core try.core core.try.*
13247                         case "$fflushall" in
13248                         x)      $cat >&4 <<EOM
13249 Whew. Flushing explicitly all the stdio streams works.
13250 EOM
13251                                 fflushall="$define"
13252                                 ;;
13253                         '')     $cat >&4 <<EOM
13254 Sigh. Flushing explicitly all the stdio streams doesn't work.
13255 EOM
13256                                 fflushall="$undef"
13257                                 ;;
13258                         *)      $cat >&4 <<EOM
13259 Cannot figure out whether flushing stdio streams explicitly works or not.
13260 I'm assuming it doesn't.
13261 EOM
13262                                 fflushall="$undef"
13263                                 ;;
13264                         esac
13265                         ;;
13266                 "$define"|true|[yY]*)
13267                         fflushall="$define"
13268                         ;;
13269                 *)
13270                         fflushall="$undef"
13271                         ;;
13272                 esac
13273             else
13274                 $cat >&4 <<EOM
13275 All is futile.  Even fflush(stdin) clobbers input pipes!
13276 EOM
13277                 fflushall="$undef"
13278             fi
13279         else
13280             fflushall="$undef"
13281         fi
13282         $rm -f core tryp.c tryp.core core.tryp.*
13283         ;;
13284 *)      fflushall="$undef"
13285         ;;
13286 esac
13287
13288 case "$fflushNULL$fflushall" in
13289 undefundef)
13290         $cat <<EOM
13291 OK, I give up.  I cannot figure out how to flush pending stdio output.
13292 We won't be flushing handles at all before fork/exec/popen.
13293 EOM
13294         ;;
13295 esac
13296 $rm -f try.* try$exe_ext
13297
13298 : Store the full pathname to the ar program for use in the C program
13299 : Respect a hint or command line value for full_ar.
13300 case "$full_ar" in
13301 '') full_ar=$ar ;;
13302 esac
13303
13304 : Store the full pathname to the sed program for use in the C program
13305 full_sed=$sed
13306
13307 : see what type gids are declared as in the kernel
13308 echo " "
13309 echo "Looking for the type for group ids returned by getgid()."
13310 set gid_t gidtype xxx stdio.h sys/types.h
13311 eval $typedef
13312 case "$gidtype" in
13313 xxx)
13314         xxx=`./findhdr sys/user.h`
13315         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13316         case $1 in
13317         unsigned) dflt="$1 $2" ;;
13318         *) dflt="$1" ;;
13319         esac
13320         ;;
13321 *) dflt="$gidtype";;
13322 esac
13323 case "$gidtype" in
13324 gid_t) echo "gid_t found." ;;
13325 *)      rp="What is the type for group ids returned by getgid()?"
13326         . ./myread
13327         gidtype="$ans"
13328         ;;
13329 esac
13330
13331 echo " "
13332 case "$gidtype" in
13333 *_t) zzz="$gidtype"     ;;
13334 *)   zzz="gid"          ;;
13335 esac
13336 echo "Checking the size of $zzz..." >&4 
13337 cat > try.c <<EOCP
13338 #include <sys/types.h>
13339 #include <stdio.h>
13340 int main() {
13341     printf("%d\n", (int)sizeof($gidtype));
13342     exit(0);
13343 }
13344 EOCP
13345 set try
13346 if eval $compile_ok; then
13347         yyy=`./try`
13348         case "$yyy" in
13349         '')     gidsize=4
13350                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13351                 ;;
13352         *)      gidsize=$yyy
13353                 echo "Your $zzz is $gidsize bytes long."
13354                 ;;
13355         esac
13356 else
13357         gidsize=4
13358         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13359 fi
13360
13361
13362 echo " "
13363 case "$gidtype" in
13364 *_t) zzz="$gidtype"     ;;
13365 *)   zzz="gid"          ;;
13366 esac
13367 echo "Checking the sign of $zzz..." >&4 
13368 cat > try.c <<EOCP
13369 #include <sys/types.h>
13370 #include <stdio.h>
13371 int main() {
13372         $gidtype foo = -1;
13373         if (foo < 0)
13374                 printf("-1\n");
13375         else
13376                 printf("1\n");
13377 }
13378 EOCP
13379 set try
13380 if eval $compile; then
13381         yyy=`./try`
13382         case "$yyy" in
13383         '')     gidsign=1
13384                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13385                 ;;
13386         *)      gidsign=$yyy
13387                 case "$gidsign" in
13388                  1) echo "Your $zzz is unsigned." ;;
13389                 -1) echo "Your $zzz is signed."   ;;
13390                 esac
13391                 ;;
13392         esac
13393 else
13394         gidsign=1
13395         echo "(I can't compile the test program--guessing unsigned.)" >&4
13396 fi
13397
13398
13399 echo " "
13400
13401 if $test X"$quadtype" != X; then
13402
13403 echo "Checking how to print 64-bit integers..." >&4
13404
13405 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13406         $cat >try.c <<'EOCP'
13407 #include <sys/types.h>
13408 #include <stdio.h>
13409 int main() {
13410   int q = 12345678901;
13411   printf("%ld\n", q);
13412 }
13413 EOCP
13414         set try
13415         if eval $compile; then
13416                 yyy=`./try$exe_ext`
13417                 case "$yyy" in
13418                 12345678901)
13419                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13420                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13421                         echo "We will use %d."
13422                         ;;
13423                 esac
13424         fi
13425 fi
13426
13427 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13428         $cat >try.c <<'EOCP'
13429 #include <sys/types.h>
13430 #include <stdio.h>
13431 int main() {
13432   long q = 12345678901;
13433   printf("%ld\n", q);
13434 }
13435 EOCP
13436         set try
13437         if eval $compile; then
13438                 yyy=`./try$exe_ext`
13439                 case "$yyy" in
13440                 12345678901)
13441                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13442                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13443                         echo "We will use %ld."
13444                         ;;
13445                 esac
13446         fi
13447 fi
13448
13449 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13450         $cat >try.c <<'EOCP'
13451 #include <sys/types.h>
13452 #include <inttypes.h>
13453 #include <stdio.h>
13454 int main() {
13455   int64_t q = 12345678901;
13456   printf("%" PRId64 "\n", q);
13457 }
13458 EOCP
13459         set try
13460         if eval $compile; then
13461                 yyy=`./try$exe_ext`
13462                 case "$yyy" in
13463                 12345678901)
13464                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13465                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13466                         echo "We will use the C9X style."
13467                         ;;
13468                 esac
13469         fi
13470 fi
13471
13472 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13473         $cat >try.c <<'EOCP'
13474 #include <sys/types.h>
13475 #include <stdio.h>
13476 int main() {
13477   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13478   printf("%lld\n", q);
13479 }
13480 EOCP
13481         set try
13482         if eval $compile; then
13483                 yyy=`./try$exe_ext`
13484                 case "$yyy" in
13485                 12345678901)
13486                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13487                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13488                         echo "We will use the %lld style."
13489                         ;;
13490                 esac
13491         fi
13492 fi
13493
13494 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13495         $cat >try.c <<EOCP
13496 #include <sys/types.h>
13497 #include <stdio.h>
13498 int main() {
13499   $quadtype q = 12345678901;
13500   printf("%Ld\n", q);
13501 }
13502 EOCP
13503         set try
13504         if eval $compile; then
13505                 yyy=`./try$exe_ext`
13506                 case "$yyy" in
13507                 12345678901)
13508                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13509                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13510                         echo "We will use %Ld."
13511                         ;;
13512                 esac
13513         fi
13514 fi
13515
13516 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13517         $cat >try.c <<EOCP
13518 #include <sys/types.h>
13519 #include <stdio.h>
13520 int main() {
13521   $quadtype q = 12345678901;
13522   printf("%qd\n", q);
13523 }
13524 EOCP
13525         set try
13526         if eval $compile; then
13527                 yyy=`./try$exe_ext`
13528                 case "$yyy" in
13529                 12345678901)
13530                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13531                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13532                         echo "We will use %qd."
13533                         ;;
13534                 esac
13535         fi
13536 fi
13537
13538 if $test X"$sPRId64" = X; then
13539         echo "Cannot figure out how to print 64-bit integers." >&4
13540 fi
13541
13542 $rm -f try try.*
13543
13544 fi
13545
13546 case "$sPRId64" in
13547 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13548         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13549         ;;
13550 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13551         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13552         ;;
13553 esac
13554
13555
13556 echo " "
13557 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13558
13559 if $test X"$ivsize" = X8; then
13560         ivdformat="$sPRId64"
13561         uvuformat="$sPRIu64"
13562         uvoformat="$sPRIo64"
13563         uvxformat="$sPRIx64"
13564         uvXUformat="$sPRIXU64"
13565 else
13566         if $test X"$ivsize" = X"$longsize"; then
13567                 ivdformat='"ld"'
13568                 uvuformat='"lu"'
13569                 uvoformat='"lo"'
13570                 uvxformat='"lx"'
13571                 uvXUformat='"lX"'
13572         else
13573                 if $test X"$ivsize" = X"$intsize"; then
13574                         ivdformat='"d"'
13575                         uvuformat='"u"'
13576                         uvoformat='"o"'
13577                         uvxformat='"x"'
13578                         uvXUformat='"X"'
13579                 else
13580                         : far out
13581                         if $test X"$ivsize" = X"$shortsize"; then
13582                                 ivdformat='"hd"'
13583                                 uvuformat='"hu"'
13584                                 uvoformat='"ho"'
13585                                 uvxformat='"hx"'
13586                                 uvXUformat='"hX"'
13587                         fi
13588                 fi
13589         fi
13590 fi
13591
13592 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13593         nveformat="$sPRIeldbl"
13594         nvfformat="$sPRIfldbl"
13595         nvgformat="$sPRIgldbl"
13596         nvEUformat="$sPRIEUldbl"
13597         nvFUformat="$sPRIFUldbl"
13598         nvGUformat="$sPRIGUldbl"
13599 else
13600         nveformat='"e"'
13601         nvfformat='"f"'
13602         nvgformat='"g"'
13603         nvEUformat='"E"'
13604         nvFUformat='"F"'
13605         nvGUformat='"G"'
13606 fi
13607
13608 case "$ivdformat" in
13609 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13610     exit 1
13611     ;;
13612 esac
13613
13614
13615 echo " "
13616 $echo "Checking the format string to be used for gids..." >&4
13617
13618 case "$gidsign" in
13619 -1)     if $test X"$gidsize" = X"$ivsize"; then
13620                 gidformat="$ivdformat"
13621         else
13622                 if $test X"$gidsize" = X"$longsize"; then
13623                         gidformat='"ld"'
13624                 else
13625                         if $test X"$gidsize" = X"$intsize"; then
13626                                 gidformat='"d"'
13627                         else
13628                                 if $test X"$gidsize" = X"$shortsize"; then
13629                                         gidformat='"hd"'
13630                                 fi
13631                         fi
13632                 fi
13633         fi
13634         ;;
13635 *)      if $test X"$gidsize" = X"$uvsize"; then
13636                 gidformat="$uvuformat"
13637         else
13638                 if $test X"$gidsize" = X"$longsize"; then
13639                         gidformat='"lu"'
13640                 else
13641                         if $test X"$gidsize" = X"$intsize"; then
13642                                 gidformat='"u"'
13643                         else
13644                                 if $test X"$gidsize" = X"$shortsize"; then
13645                                         gidformat='"hu"'
13646                                 fi
13647                         fi
13648                 fi
13649         fi
13650         ;;
13651 esac
13652
13653 : see if getgroups exists
13654 set getgroups d_getgrps
13655 eval $inlibc
13656
13657 : see if setgroups exists
13658 set setgroups d_setgrps
13659 eval $inlibc
13660
13661
13662 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13663 echo " "
13664 case "$d_getgrps$d_setgrps" in
13665 *define*)
13666         case "$groupstype" in
13667         '') dflt="$gidtype" ;;
13668         *)  dflt="$groupstype" ;;
13669         esac
13670         $cat <<EOM
13671 What type of pointer is the second argument to getgroups() and setgroups()?
13672 Usually this is the same as group ids, $gidtype, but not always.
13673
13674 EOM
13675         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13676         . ./myread
13677         groupstype="$ans"
13678         ;;
13679 *)  groupstype="$gidtype";;
13680 esac
13681
13682 echo " "
13683 echo "Checking if your $make program sets \$(MAKE)..." >&4
13684 case "$make_set_make" in
13685 '')
13686         $sed 's/^X //' > testmake.mak << 'EOF'
13687 Xall:
13688 X       @echo 'maketemp="$(MAKE)"'
13689 EOF
13690         case "`$make -f testmake.mak 2>/dev/null`" in
13691         *maketemp=*) make_set_make='#' ;;
13692         *)      make_set_make="MAKE=$make" ;;
13693         esac
13694         $rm -f testmake.mak
13695         ;;
13696 esac
13697 case "$make_set_make" in
13698 '#') echo "Yup, it does.";;
13699 *) echo "Nope, it doesn't.";;
13700 esac
13701
13702 : see what type is used for mode_t
13703 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13704 set mode_t modetype int stdio.h sys/types.h
13705 eval $typedef_ask
13706
13707 : see if stdarg is available
13708 echo " "
13709 if $test `./findhdr stdarg.h`; then
13710         echo "<stdarg.h> found." >&4
13711         valstd="$define"
13712 else
13713         echo "<stdarg.h> NOT found." >&4
13714         valstd="$undef"
13715 fi
13716
13717 : see if varags is available
13718 echo " "
13719 if $test `./findhdr varargs.h`; then
13720         echo "<varargs.h> found." >&4
13721 else
13722         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13723 fi
13724
13725 : set up the varargs testing programs
13726 $cat > varargs.c <<EOP
13727 #ifdef I_STDARG
13728 #include <stdarg.h>
13729 #endif
13730 #ifdef I_VARARGS
13731 #include <varargs.h>
13732 #endif
13733
13734 #ifdef I_STDARG
13735 int f(char *p, ...)
13736 #else
13737 int f(va_alist)
13738 va_dcl
13739 #endif
13740 {
13741         va_list ap;
13742 #ifndef I_STDARG
13743         char *p;
13744 #endif
13745 #ifdef I_STDARG
13746         va_start(ap,p);
13747 #else
13748         va_start(ap);
13749         p = va_arg(ap, char *);
13750 #endif
13751         va_end(ap);
13752 }
13753 EOP
13754 $cat > varargs <<EOP
13755 $startsh
13756 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13757         echo "true"
13758 else
13759         echo "false"
13760 fi
13761 $rm -f varargs$_o
13762 EOP
13763 chmod +x varargs
13764
13765 : now check which varargs header should be included
13766 echo " "
13767 i_varhdr=''
13768 case "$valstd" in
13769 "$define")
13770         if `./varargs I_STDARG`; then
13771                 val='stdarg.h'
13772         elif `./varargs I_VARARGS`; then
13773                 val='varargs.h'
13774         fi
13775         ;;
13776 *)
13777         if `./varargs I_VARARGS`; then
13778                 val='varargs.h'
13779         fi
13780         ;;
13781 esac
13782 case "$val" in
13783 '')
13784 echo "I could not find the definition for va_dcl... You have problems..." >&4
13785         val="$undef"; set i_stdarg; eval $setvar
13786         val="$undef"; set i_varargs; eval $setvar
13787         ;;
13788 *) 
13789         set i_varhdr
13790         eval $setvar
13791         case "$i_varhdr" in
13792         stdarg.h)
13793                 val="$define"; set i_stdarg; eval $setvar
13794                 val="$undef"; set i_varargs; eval $setvar
13795                 ;;
13796         varargs.h)
13797                 val="$undef"; set i_stdarg; eval $setvar
13798                 val="$define"; set i_varargs; eval $setvar
13799                 ;;
13800         esac
13801         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13802 esac
13803 $rm -f varargs*
13804
13805 : see if we need va_copy
13806 echo " "
13807 case "$i_stdarg" in
13808 "$define")
13809         $cat >try.c <<EOCP
13810 #include <stdarg.h>
13811 #include <stdio.h>
13812 #$i_stdlib I_STDLIB
13813 #ifdef I_STDLIB
13814 #include <stdlib.h>
13815 #endif
13816 #include <signal.h>
13817
13818 int
13819 ivfprintf(FILE *f, const char *fmt, va_list *valp)
13820 {
13821   return vfprintf(f, fmt, *valp);
13822 }
13823  
13824 int    
13825 myvfprintf(FILE *f, const  char *fmt, va_list val)
13826 {
13827   return ivfprintf(f, fmt, &val);
13828 }
13829       
13830 int
13831 myprintf(char *fmt, ...) 
13832 {
13833   va_list val;
13834   va_start(val, fmt);
13835   return myvfprintf(stdout, fmt, val); 
13836 }         
13837
13838 int
13839 main(int ac, char **av)
13840 {
13841   signal(SIGSEGV, exit);
13842
13843   myprintf("%s%cs all right, then\n", "that", '\'');                            
13844   exit(0);      
13845 }
13846 EOCP
13847         set try
13848         if eval $compile && ./try 2>&1 >/dev/null; then
13849                 case "`./try`" in
13850                 "that's all right, then")
13851                         okay=yes
13852                         ;;
13853                 esac
13854         fi
13855         case "$okay" in
13856         yes)    echo "It seems that you don't need va_copy()." >&4
13857                 need_va_copy="$undef"
13858                 ;;
13859         *)      echo "It seems that va_copy() or similar will be needed." >&4
13860                 need_va_copy="$define"
13861                 ;;
13862         esac
13863         $rm -f try.* core core.* *.core *.core.*
13864         ;;
13865 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
13866         ;;
13867 esac
13868
13869 : define a fucntion to check prototypes
13870 $cat > protochk <<EOSH
13871 $startsh
13872 cc="$cc"
13873 optimize="$optimize"
13874 ccflags="$ccflags"
13875 prototype="$prototype"
13876 define="$define"
13877 rm=$rm
13878 EOSH
13879
13880 $cat >> protochk <<'EOSH'
13881
13882 $rm -f try.c
13883 foo="$1"
13884 shift
13885 while test $# -ge 2; do
13886         case "$1" in
13887                 $define) echo "#include <$2>" >> try.c ;;
13888                 literal) echo "$2" >> try.c ;;
13889         esac
13890     shift 2
13891 done
13892 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13893 cat >> try.c <<'EOCP'
13894 #ifdef CAN_PROTOTYPE
13895 #define _(args) args
13896 #else
13897 #define _(args) ()
13898 #endif
13899 EOCP
13900 echo "$foo" >> try.c
13901 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13902 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13903 status=$?
13904 $rm -f try.[co]
13905 exit $status
13906 EOSH
13907 chmod +x protochk
13908 $eunicefix protochk
13909
13910 : see what type is used for size_t
13911 rp="What is the type used for the length parameter for string functions?"
13912 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13913 eval $typedef_ask
13914
13915 : check for type of arguments to gethostbyaddr. 
13916 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13917         case "$d_gethbyaddr" in
13918         $define)
13919                 $cat <<EOM
13920
13921 Checking to see what type of arguments are accepted by gethostbyaddr().
13922 EOM
13923                 hdrs="$define sys/types.h
13924                         $d_socket sys/socket.h 
13925                         $i_niin netinet/in.h 
13926                         $i_netdb netdb.h
13927                         $i_unistd unistd.h"
13928                 : The first arg can 'char *' or 'void *'
13929                 : The second arg is some of integral type
13930                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13931                         for yyy in size_t long int; do
13932                                 case "$netdb_host_type" in
13933                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13934                                         if ./protochk "$try" $hdrs; then
13935                                                 echo "Your system accepts $xxx for the first arg."
13936                                                 echo "...and $yyy for the second arg."
13937                                                 netdb_host_type="$xxx"
13938                                                 netdb_hlen_type="$yyy"
13939                                         fi
13940                                         ;;
13941                                 esac
13942                         done
13943                 done
13944                 : In case none of those worked, prompt the user.
13945                 case "$netdb_host_type" in
13946                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13947                         dflt='char *'
13948                         . ./myread
13949                         netdb_host_type=$ans
13950                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13951                         dflt="$sizetype"
13952                         . ./myread
13953                         netdb_hlen_type=$ans
13954                         ;;
13955                 esac
13956                 ;;
13957         *)      : no gethostbyaddr, so pick harmless defaults
13958                 netdb_host_type='char *'
13959                 netdb_hlen_type="$sizetype"
13960                 ;;
13961         esac
13962         # Remove the "const" if needed. -- but then we'll have a 
13963         # prototype clash!
13964         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13965 fi
13966
13967 : check for type of argument to gethostbyname. 
13968 if test "X$netdb_name_type" = X ; then
13969         case "$d_gethbyname" in
13970         $define)
13971                 $cat <<EOM
13972
13973 Checking to see what type of argument is accepted by gethostbyname().
13974 EOM
13975                 hdrs="$define sys/types.h
13976                         $d_socket sys/socket.h 
13977                         $i_niin netinet/in.h 
13978                         $i_netdb netdb.h
13979                         $i_unistd unistd.h"
13980                 for xxx in "const char *" "char *"; do
13981                         case "$netdb_name_type" in
13982                         '')     try="extern struct hostent *gethostbyname($xxx);"
13983                                 if ./protochk "$try" $hdrs; then
13984                                         echo "Your system accepts $xxx."
13985                                         netdb_name_type="$xxx"
13986                                 fi
13987                                 ;;
13988                         esac
13989                 done
13990                 : In case none of those worked, prompt the user.
13991                 case "$netdb_name_type" in
13992                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13993                         dflt='char *'
13994                         . ./myread
13995                         netdb_name_type=$ans
13996                         ;;
13997                 esac
13998                 ;;
13999         *)      : no gethostbyname, so pick harmless default
14000                 netdb_name_type='char *'
14001                 ;;
14002         esac
14003 fi
14004
14005 : check for type of 1st argument to getnetbyaddr. 
14006 if test "X$netdb_net_type" = X ; then
14007         case "$d_getnbyaddr" in
14008         $define)
14009                 $cat <<EOM
14010
14011 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14012 EOM
14013                 hdrs="$define sys/types.h
14014                         $d_socket sys/socket.h 
14015                         $i_niin netinet/in.h 
14016                         $i_netdb netdb.h
14017                         $i_unistd unistd.h"
14018                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14019                         case "$netdb_net_type" in
14020                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14021                                 if ./protochk "$try" $hdrs; then
14022                                         echo "Your system accepts $xxx."
14023                                         netdb_net_type="$xxx"
14024                                 fi
14025                                 ;;
14026                         esac
14027                 done
14028                 : In case none of those worked, prompt the user.
14029                 case "$netdb_net_type" in
14030                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14031                         dflt='long'
14032                         . ./myread
14033                         netdb_net_type=$ans
14034                         ;;
14035                 esac
14036                 ;;
14037         *)      : no getnetbyaddr, so pick harmless default
14038                 netdb_net_type='long'
14039                 ;;
14040         esac
14041 fi
14042 : locate the preferred pager for this system
14043 case "$pager" in
14044 '')
14045         dflt=''
14046         case "$pg" in
14047         /*) dflt=$pg;;
14048         [a-zA-Z]:/*) dflt=$pg;;
14049         esac
14050         case "$more" in
14051         /*) dflt=$more;;
14052         [a-zA-Z]:/*) dflt=$more;;
14053         esac
14054         case "$less" in
14055         /*) dflt=$less;;
14056         [a-zA-Z]:/*) dflt=$less;;
14057         esac
14058         case "$dflt" in
14059         '') dflt=/usr/ucb/more;;
14060         esac
14061         ;;
14062 *) dflt="$pager";;
14063 esac
14064 echo " "
14065 fn=f/
14066 rp='What pager is used on your system?'
14067 . ./getfile
14068 pager="$ans"
14069
14070 : see what type pids are declared as in the kernel
14071 rp="What is the type of process ids on this system?"
14072 set pid_t pidtype int stdio.h sys/types.h
14073 eval $typedef_ask
14074
14075 : Find earliest binary compatible site_perl subdirectory perl can use.
14076 case "$bincompat5005" in
14077 "$define") xs_apiversion='5.005' ;;
14078 *) xs_apiversion=$version ;;   # The current site_perl version.
14079 esac
14080 : Find earliest pure perl site_perl subdirectory perl can use.
14081 : The versioned directories started at 5.005.
14082 pm_apiversion='5.005'
14083
14084 : check for length of pointer
14085 echo " "
14086 case "$ptrsize" in
14087 '')
14088         echo "Checking to see how big your pointers are..." >&4
14089         if test "$voidflags" -gt 7; then
14090                 echo '#define VOID_PTR char *' > try.c
14091         else
14092                 echo '#define VOID_PTR void *' > try.c
14093         fi
14094         $cat >>try.c <<'EOCP'
14095 #include <stdio.h>
14096 int main()
14097 {
14098     printf("%d\n", (int)sizeof(VOID_PTR));
14099     exit(0);
14100 }
14101 EOCP
14102         set try
14103         if eval $compile_ok; then
14104                 ptrsize=`./try`
14105                 echo "Your pointers are $ptrsize bytes long."
14106         else
14107                 dflt='4'
14108                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
14109                 rp="What is the size of a pointer (in bytes)?"
14110                 . ./myread
14111                 ptrsize="$ans"
14112         fi
14113         ;;
14114 esac
14115 $rm -f try.c try
14116
14117 : see if ar generates random libraries by itself
14118 echo " "
14119 echo "Checking how to generate random libraries on your machine..." >&4
14120 echo 'int bar1() { return bar2(); }' > bar1.c
14121 echo 'int bar2() { return 2; }' > bar2.c
14122 $cat > foo.c <<'EOP'
14123 int main() { printf("%d\n", bar1()); exit(0); }
14124 EOP
14125 $cc $ccflags -c bar1.c >/dev/null 2>&1
14126 $cc $ccflags -c bar2.c >/dev/null 2>&1
14127 $cc $ccflags -c foo.c >/dev/null 2>&1
14128 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14129 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14130         ./foobar >/dev/null 2>&1; then
14131         echo "$ar appears to generate random libraries itself."
14132         orderlib=false
14133         ranlib=":"
14134 elif $ar ts bar$_a >/dev/null 2>&1 &&
14135         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14136         ./foobar >/dev/null 2>&1; then
14137                 echo "a table of contents needs to be added with '$ar ts'."
14138                 orderlib=false
14139                 ranlib="$ar ts"
14140 else
14141         case "$ranlib" in
14142         :) ranlib='';;
14143         '')
14144                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14145                 $test -f $ranlib || ranlib=''
14146                 ;;
14147         esac
14148         if $test -n "$ranlib"; then
14149                 echo "your system has '$ranlib'; we'll use that."
14150                 orderlib=false
14151         else
14152                 echo "your system doesn't seem to support random libraries"
14153                 echo "so we'll use lorder and tsort to order the libraries."
14154                 orderlib=true
14155                 ranlib=":"
14156         fi
14157 fi
14158 $rm -f foo* bar* 
14159
14160 : check for type of arguments to select. 
14161 case "$selecttype" in
14162 '') case "$d_select" in
14163         $define)
14164                 echo " "
14165                 $cat <<EOM
14166 Checking to see what type of arguments are accepted by select().
14167 EOM
14168                 hdrs="$define sys/types.h
14169                         $i_systime sys/time.h 
14170                         $i_sysselct sys/select.h
14171                         $d_socket sys/socket.h"
14172                 : The first arg can be int, unsigned, or size_t
14173                 : The last arg may or may not be 'const'
14174                 val=''
14175                 : void pointer has been seen but using that
14176                 : breaks the selectminbits test
14177                 for xxx in 'fd_set *' 'int *'; do
14178                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14179                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14180                                         case "$val" in
14181                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14182                                                 if ./protochk "$try" $hdrs; then
14183                                                         echo "Your system accepts $xxx."
14184                                                         val="$xxx"
14185                                                 fi
14186                                                 ;;
14187                                         esac
14188                                 done
14189                         done
14190                 done
14191                 case "$val" in
14192                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14193                         case "$d_fd_set" in
14194                                 $define) dflt="fd_set *" ;;
14195                                 *)              dflt="int *" ;;
14196                         esac
14197                         . ./myread
14198                         val=$ans
14199                         ;;
14200                 esac
14201                 selecttype="$val"
14202                 ;;
14203         *)      : no select, so pick a harmless default
14204                 selecttype='int *'
14205                 ;;
14206         esac
14207         ;;
14208 esac
14209
14210 : check for the select 'width'
14211 case "$selectminbits" in
14212 '') case "$d_select" in
14213         $define)
14214                 $cat <<EOM
14215
14216 Checking to see on how many bits at a time your select() operates...
14217 EOM
14218                 $cat >try.c <<EOCP
14219 #include <sys/types.h>
14220 #$i_time I_TIME
14221 #$i_systime I_SYS_TIME
14222 #$i_systimek I_SYS_TIME_KERNEL
14223 #ifdef I_TIME
14224 #   include <time.h>
14225 #endif
14226 #ifdef I_SYS_TIME
14227 #   ifdef I_SYS_TIME_KERNEL
14228 #       define KERNEL
14229 #   endif
14230 #   include <sys/time.h>
14231 #   ifdef I_SYS_TIME_KERNEL
14232 #       undef KERNEL
14233 #   endif
14234 #endif
14235 #$i_sysselct I_SYS_SELECT
14236 #ifdef I_SYS_SELECT
14237 #include <sys/select.h>
14238 #endif
14239 #$d_socket HAS_SOCKET
14240 #ifdef HAS_SOCKET
14241 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14242 #endif
14243 #include <stdio.h>
14244 $selecttype b;
14245 #define S sizeof(*(b))
14246 #define MINBITS 64
14247 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14248 #define NBITS  (NBYTES * 8)
14249 int main() {
14250     char s[NBYTES];
14251     struct timeval t;
14252     int i;
14253     FILE* fp;
14254     int fd;
14255
14256     fclose(stdin);
14257     fp = fopen("try.c", "r");
14258     if (fp == 0)
14259       exit(1);
14260     fd = fileno(fp);
14261     if (fd < 0)
14262       exit(2);
14263     b = ($selecttype)s;
14264     for (i = 0; i < NBITS; i++)
14265         FD_SET(i, b);
14266     t.tv_sec  = 0;
14267     t.tv_usec = 0;
14268     select(fd + 1, b, 0, 0, &t);
14269     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14270     printf("%d\n", i + 1);
14271     return 0;
14272 }
14273 EOCP
14274                 set try
14275                 if eval $compile_ok; then
14276                         selectminbits=`./try`
14277                         case "$selectminbits" in
14278                         '')     cat >&4 <<EOM
14279 Cannot figure out on how many bits at a time your select() operates.
14280 I'll play safe and guess it is 32 bits.
14281 EOM
14282                                 selectminbits=32
14283                                 bits="32 bits"
14284                                 ;;
14285                         1)      bits="1 bit" ;;
14286                         *)      bits="$selectminbits bits" ;;
14287                         esac
14288                         echo "Your select() operates on $bits at a time." >&4
14289                 else
14290                         rp='What is the minimum number of bits your select() operates on?'
14291                         case "$byteorder" in
14292                         1234|12345678)  dflt=32 ;;
14293                         *)              dflt=1  ;;
14294                         esac
14295                         . ./myread
14296                         val=$ans
14297                         selectminbits="$val"
14298                 fi
14299                 $rm -f try.* try
14300                 ;;
14301         *)      : no select, so pick a harmless default
14302                 selectminbits='32'
14303                 ;;
14304         esac
14305         ;;
14306 esac
14307
14308 : Trace out the files included by signal.h, then look for SIGxxx names.
14309 : Remove SIGARRAYSIZE used by HPUX.
14310 : Remove SIGSTKSIZE used by Linux.
14311 : Remove SIGSTKSZ used by Posix.
14312 : Remove SIGTYP void lines used by OS2.
14313 : Some cpps, like os390, dont give the file name anywhere
14314 if [ "X$fieldn" = X ]; then
14315         : Just make some guesses.  We check them later.
14316         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14317 else
14318         xxx=`echo '#include <signal.h>' |
14319         $cppstdin $cppminus $cppflags 2>/dev/null |
14320         $grep '^[       ]*#.*include' | 
14321         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14322 fi
14323 : Check this list of files to be sure we have parsed the cpp output ok.
14324 : This will also avoid potentially non-existent files, such 
14325 : as ../foo/bar.h
14326 xxxfiles=''
14327 for xx in $xxx /dev/null ; do
14328         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14329 done
14330 : If we have found no files, at least try signal.h
14331 case "$xxxfiles" in
14332 '')     xxxfiles=`./findhdr signal.h` ;;
14333 esac
14334 xxx=`awk '
14335 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14336         print substr($2, 4, 20)
14337 }
14338 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14339         print substr($3, 4, 20)
14340 }' $xxxfiles`
14341 : Append some common names just in case the awk scan failed.
14342 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14343 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14344 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14345 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14346 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14347
14348 : generate a few handy files for later
14349 $cat > signal.c <<'EOCP'
14350 #include <sys/types.h>
14351 #include <signal.h>
14352 #include <stdio.h>
14353 int main() {
14354
14355 /* Strange style to avoid deeply-nested #if/#else/#endif */
14356 #ifndef NSIG
14357 #  ifdef _NSIG
14358 #    define NSIG (_NSIG)
14359 #  endif
14360 #endif
14361
14362 #ifndef NSIG
14363 #  ifdef SIGMAX
14364 #    define NSIG (SIGMAX+1)
14365 #  endif
14366 #endif
14367
14368 #ifndef NSIG
14369 #  ifdef SIG_MAX
14370 #    define NSIG (SIG_MAX+1)
14371 #  endif
14372 #endif
14373
14374 #ifndef NSIG
14375 #  ifdef MAXSIG
14376 #    define NSIG (MAXSIG+1)
14377 #  endif
14378 #endif
14379
14380 #ifndef NSIG
14381 #  ifdef MAX_SIG
14382 #    define NSIG (MAX_SIG+1)
14383 #  endif
14384 #endif
14385
14386 #ifndef NSIG
14387 #  ifdef SIGARRAYSIZE
14388 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14389 #  endif
14390 #endif
14391
14392 #ifndef NSIG
14393 #  ifdef _sys_nsig
14394 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14395 #  endif
14396 #endif
14397
14398 /* Default to some arbitrary number that's big enough to get most
14399    of the common signals.
14400 */
14401 #ifndef NSIG
14402 #    define NSIG 50
14403 #endif
14404
14405 printf("NSIG %d\n", NSIG);
14406
14407 #ifndef JUST_NSIG
14408
14409 EOCP
14410
14411 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14412 {
14413         printf "#ifdef SIG"; printf $1; printf "\n"
14414         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14415         printf $1; printf ");\n"
14416         printf "#endif\n"
14417 }
14418 END {
14419         printf "#endif /* JUST_NSIG */\n";
14420         printf "exit(0);\n}\n";
14421 }
14422 ' >>signal.c
14423 $cat >signal.awk <<'EOP'
14424 BEGIN { ndups = 0 }
14425 $1 ~ /^NSIG$/ { nsig = $2 }
14426 ($1 !~ /^NSIG$/) && (NF == 2) {
14427     if ($2 > maxsig) { maxsig = $2 }
14428     if (sig_name[$2]) {
14429         dup_name[ndups] = $1
14430         dup_num[ndups] = $2
14431         ndups++ 
14432     }
14433     else {
14434         sig_name[$2] = $1
14435         sig_num[$2] = $2
14436     }
14437 }
14438 END { 
14439     if (nsig == 0) {
14440         nsig = maxsig + 1
14441     }
14442     printf("NSIG %d\n", nsig);
14443     for (n = 1; n < nsig; n++) {
14444         if (sig_name[n]) {
14445             printf("%s %d\n", sig_name[n], sig_num[n])
14446         }
14447         else {
14448             printf("NUM%d %d\n", n, n) 
14449         }
14450     }
14451     for (n = 0; n < ndups; n++) {
14452         printf("%s %d\n", dup_name[n], dup_num[n])
14453     }
14454 }
14455 EOP
14456 $cat >signal_cmd <<EOS
14457 $startsh
14458 if $test -s signal.lst; then
14459     echo "Using your existing signal.lst file"
14460         exit 0
14461 fi
14462 xxx="$xxx"
14463 EOS
14464 $cat >>signal_cmd <<'EOS'
14465
14466 set signal
14467 if eval $compile_ok; then
14468         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14469 else
14470         echo "(I can't seem be able to compile the whole test program)" >&4
14471         echo "(I'll try it in little pieces.)" >&4
14472         set signal -DJUST_NSIG
14473         if eval $compile_ok; then
14474                 ./signal$_exe > signal.nsg
14475                 $cat signal.nsg
14476         else
14477                 echo "I can't seem to figure out how many signals you have." >&4
14478                 echo "Guessing 50." >&4
14479                 echo 'NSIG 50' > signal.nsg
14480         fi
14481         : Now look at all the signal names, one at a time.
14482         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14483                 $cat > signal.c <<EOCP
14484 #include <sys/types.h>
14485 #include <signal.h>
14486 #include <stdio.h>
14487 int main() {
14488 printf("$xx %d\n", SIG${xx});
14489 return 0;
14490 }
14491 EOCP
14492                 set signal
14493                 if eval $compile; then
14494                         echo "SIG${xx} found."
14495                         ./signal$_exe  >> signal.ls1
14496                 else
14497                         echo "SIG${xx} NOT found."
14498                 fi
14499         done
14500         if $test -s signal.ls1; then
14501                 $cat signal.nsg signal.ls1 |
14502                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14503         fi
14504
14505 fi
14506 if $test -s signal.lst; then
14507         :
14508 else
14509         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14510         echo 'kill -l' >signal
14511         set X `csh -f <signal`
14512         $rm -f signal
14513         shift
14514         case $# in
14515         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14516         esac
14517         echo $@ | $tr ' ' $trnl | \
14518             $awk '{ printf "%s %d\n", $1, ++s; }
14519                   END { printf "NSIG %d\n", ++s }' >signal.lst
14520 fi
14521 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14522 EOS
14523 chmod a+x signal_cmd
14524 $eunicefix signal_cmd
14525
14526 : generate list of signal names
14527 echo " "
14528 case "$sig_name_init" in
14529 '') doinit=yes ;;
14530 *)  case "$sig_num_init" in
14531     ''|*,*) doinit=yes ;;
14532     esac ;;
14533 esac
14534 case "$doinit" in
14535 yes)
14536         echo "Generating a list of signal names and numbers..." >&4
14537         . ./signal_cmd
14538         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14539         sig_name=`$awk 'BEGIN { printf "ZERO " }
14540                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14541         sig_num=`$awk  'BEGIN { printf "0 " }
14542                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14543         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14544                              !/^NSIG/   { printf "\"%s\", ", $1 }
14545                              END        { printf "0\n" }' signal.lst`
14546         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14547                              !/^NSIG/   { printf "%d, ", $2}
14548                              END        { printf "0\n"}' signal.lst`
14549         ;;
14550 esac
14551 echo "The following $sig_count signals are available:"
14552 echo " "
14553 echo $sig_name | $awk \
14554 'BEGIN { linelen = 0 }
14555 {
14556         for (i = 1; i <= NF; i++) {
14557                 name = "SIG" $i " "
14558                 linelen = linelen + length(name)
14559                 if (linelen > 70) {
14560                         printf "\n"
14561                         linelen = length(name)
14562                 }
14563                 printf "%s", name
14564         }
14565         printf "\n"
14566 }'
14567 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14568
14569 echo " "
14570 case "$sizetype" in
14571 *_t) zzz="$sizetype"    ;;
14572 *)   zzz="filesize"     ;;
14573 esac
14574 echo "Checking the size of $zzz..." >&4 
14575 cat > try.c <<EOCP
14576 #include <sys/types.h>
14577 #include <stdio.h>
14578 int main() {
14579     printf("%d\n", (int)sizeof($sizetype));
14580     exit(0);
14581 }
14582 EOCP
14583 set try
14584 if eval $compile_ok; then
14585         yyy=`./try`
14586         case "$yyy" in
14587         '')     sizesize=4
14588                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14589                 ;;
14590         *)      sizesize=$yyy
14591                 echo "Your $zzz size is $sizesize bytes."
14592                 ;;
14593         esac
14594 else
14595         sizesize=4
14596         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14597 fi
14598
14599
14600 : check for socklen_t
14601 echo " "
14602 echo "Checking to see if you have socklen_t..." >&4
14603 $cat >try.c <<EOCP
14604 #include <sys/types.h>
14605 #$d_socket HAS_SOCKET
14606 #ifdef HAS_SOCKET
14607 #include <sys/socket.h>
14608 #endif
14609 int main() { socklen_t x = 16; }
14610 EOCP
14611 set try
14612 if eval $compile; then
14613         val="$define"
14614         echo "You have socklen_t."
14615 else
14616         val="$undef"
14617         echo "You do not have socklen_t."
14618         case "$sizetype" in
14619         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14620         esac
14621 fi
14622 $rm -f try try.*
14623 set d_socklen_t
14624 eval $setvar
14625
14626 : see if this is a socks.h system
14627 set socks.h i_socks
14628 eval $inhdr
14629
14630 : check for type of the size argument to socket calls
14631 case "$d_socket" in
14632 "$define")
14633         $cat <<EOM
14634
14635 Checking to see what type is the last argument of accept().
14636 EOM
14637         yyy=''
14638         case "$d_socklen_t" in
14639         "$define") yyy="$yyy socklen_t"
14640         esac
14641         yyy="$yyy $sizetype int long unsigned"
14642         for xxx in $yyy; do
14643                 case "$socksizetype" in
14644                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14645                         case "$usesocks" in
14646                         "$define")
14647                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14648                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14649                                         socksizetype="$xxx"
14650                                 fi
14651                                 ;;
14652                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14653                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14654                                         socksizetype="$xxx"
14655                                 fi
14656                                 ;;
14657                         esac
14658                         ;;
14659                 esac
14660         done
14661 : In case none of those worked, prompt the user.
14662         case "$socksizetype" in
14663         '')     rp='What is the type for socket address structure sizes?'
14664                 dflt='int'
14665                 . ./myread
14666                 socksizetype=$ans
14667                 ;;
14668         esac
14669         ;;
14670 *)      : no sockets, so pick relatively harmless default
14671         socksizetype='int'
14672         ;;
14673 esac
14674
14675 : see what type is used for signed size_t
14676 set ssize_t ssizetype int stdio.h sys/types.h
14677 eval $typedef
14678 dflt="$ssizetype"
14679 $cat > ssize.c <<EOM
14680 #include <stdio.h>
14681 #include <sys/types.h>
14682 #define Size_t $sizetype
14683 #define SSize_t $dflt
14684 int main()
14685 {
14686         if (sizeof(Size_t) == sizeof(SSize_t))
14687                 printf("$dflt\n");
14688         else if (sizeof(Size_t) == sizeof(int))
14689                 printf("int\n");
14690         else 
14691                 printf("long\n");
14692         exit(0);
14693 }
14694 EOM
14695 echo " "
14696 set ssize
14697 if eval $compile_ok && ./ssize > /dev/null; then
14698         ssizetype=`./ssize`
14699         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14700 else
14701         $cat >&4 <<EOM
14702 Help! I can't compile and run the ssize_t test program: please enlighten me!
14703 (This is probably a misconfiguration in your system or libraries, and
14704 you really ought to fix it.  Still, I'll try anyway.)
14705
14706 I need a type that is the same size as $sizetype, but is guaranteed to
14707 be signed.  Common values are ssize_t, int and long.
14708
14709 EOM
14710         rp="What signed type is the same size as $sizetype?"
14711         . ./myread
14712         ssizetype="$ans"
14713 fi
14714 $rm -f ssize ssize.*
14715
14716 : see what type of char stdio uses.
14717 echo " "
14718 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14719 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14720         echo "Your stdio uses unsigned chars." >&4
14721         stdchar="unsigned char"
14722 else
14723         echo "Your stdio uses signed chars." >&4
14724         stdchar="char"
14725 fi
14726 $rm -f stdioh
14727
14728
14729
14730 : see if time exists
14731 echo " "
14732 if test "X$d_time" = X -o X"$timetype" = X; then
14733     if set time val -f d_time; eval $csym; $val; then
14734                 echo 'time() found.' >&4
14735                 val="$define"
14736                 rp="What is the type returned by time() on this system?"
14737                 set time_t timetype long stdio.h sys/types.h
14738                 eval $typedef_ask
14739     else
14740                 echo 'time() not found, hope that will do.' >&4
14741                 val="$undef"
14742                 timetype='int';
14743     fi
14744     set d_time
14745     eval $setvar
14746 fi
14747
14748 : see what type uids are declared as in the kernel
14749 echo " "
14750 echo "Looking for the type for user ids returned by getuid()."
14751 set uid_t uidtype xxx stdio.h sys/types.h
14752 eval $typedef
14753 case "$uidtype" in
14754 xxx)
14755         xxx=`./findhdr sys/user.h`
14756         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14757         case $1 in
14758         unsigned) dflt="$1 $2" ;;
14759         *) dflt="$1" ;;
14760         esac
14761         ;;
14762 *) dflt="$uidtype";;
14763 esac
14764 case "$uidtype" in
14765 uid_t)  echo "uid_t found." ;;
14766 *)      rp="What is the type for user ids returned by getuid()?"
14767         . ./myread
14768         uidtype="$ans"
14769         ;;
14770 esac
14771
14772 echo " "
14773 case "$uidtype" in
14774 *_t) zzz="$uidtype"     ;;
14775 *)   zzz="uid"          ;;
14776 esac
14777 echo "Checking the size of $zzz..." >&4 
14778 cat > try.c <<EOCP
14779 #include <sys/types.h>
14780 #include <stdio.h>
14781 int main() {
14782     printf("%d\n", (int)sizeof($uidtype));
14783     exit(0);
14784 }
14785 EOCP
14786 set try
14787 if eval $compile_ok; then
14788         yyy=`./try`
14789         case "$yyy" in
14790         '')     uidsize=4
14791                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14792                 ;;
14793         *)      uidsize=$yyy
14794                 echo "Your $zzz is $uidsize bytes long."
14795                 ;;
14796         esac
14797 else
14798         uidsize=4
14799         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14800 fi
14801
14802 echo " "
14803 case "$uidtype" in
14804 *_t) zzz="$uidtype"     ;;
14805 *)   zzz="uid"          ;;
14806 esac
14807 echo "Checking the sign of $zzz..." >&4
14808 cat > try.c <<EOCP
14809 #include <sys/types.h>
14810 #include <stdio.h>
14811 int main() {
14812         $uidtype foo = -1;
14813         if (foo < 0)
14814                 printf("-1\n");
14815         else
14816                 printf("1\n");
14817 }
14818 EOCP
14819 set try
14820 if eval $compile; then
14821         yyy=`./try`
14822         case "$yyy" in
14823         '')     uidsign=1
14824                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14825                 ;;
14826         *)      uidsign=$yyy
14827                 case "$uidsign" in
14828                  1) echo "Your $zzz is unsigned." ;;
14829                 -1) echo "Your $zzz is signed."   ;;
14830                 esac
14831                 ;;
14832         esac
14833 else
14834         uidsign=1
14835         echo "(I can't compile the test program--guessing unsigned.)" >&4
14836 fi
14837
14838
14839
14840 echo " "
14841 $echo "Checking the format string to be used for uids..." >&4
14842
14843 case "$uidsign" in
14844 -1)     if $test X"$uidsize" = X"$ivsize"; then
14845                 uidformat="$ivdformat"
14846         else
14847                 if $test X"$uidsize" = X"$longsize"; then
14848                         uidformat='"ld"'
14849                 else
14850                         if $test X"$uidsize" = X"$intsize"; then
14851                                 uidformat='"d"'
14852                         else
14853                                 if $test X"$uidsize" = X"$shortsize"; then
14854                                         uidformat='"hd"'
14855                                 fi
14856                         fi
14857                 fi
14858         fi
14859         ;;
14860 *)      if $test X"$uidsize" = X"$uvsize"; then
14861                 uidformat="$uvuformat"
14862         else
14863                 if $test X"$uidsize" = X"$longsize"; then
14864                         uidformat='"lu"'
14865                 else
14866                         if $test X"$uidsize" = X"$intsize"; then
14867                                 uidformat='"u"'
14868                         else
14869                                 if $test X"$uidsize" = X"$shortsize"; then
14870                                         uidformat='"hu"'
14871                                 fi
14872                         fi
14873                 fi
14874         fi
14875         ;;
14876 esac
14877
14878 : see if dbm.h is available
14879 : see if dbmclose exists
14880 set dbmclose d_dbmclose
14881 eval $inlibc
14882
14883 case "$d_dbmclose" in
14884 $define)
14885         set dbm.h i_dbm
14886         eval $inhdr
14887         case "$i_dbm" in
14888         $define)
14889                 val="$undef"
14890                 set i_rpcsvcdbm
14891                 eval $setvar
14892                 ;;
14893         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14894                 eval $inhdr
14895                 ;;
14896         esac
14897         ;;
14898 *)      echo "We won't be including <dbm.h>"
14899         val="$undef"
14900         set i_dbm
14901         eval $setvar
14902         val="$undef"
14903         set i_rpcsvcdbm
14904         eval $setvar
14905         ;;
14906 esac
14907
14908 : see if this is a sys/file.h system
14909 val=''
14910 set sys/file.h val
14911 eval $inhdr
14912
14913 : do we need to include sys/file.h ?
14914 case "$val" in
14915 "$define")
14916         echo " "
14917         if $h_sysfile; then
14918                 val="$define"
14919                 echo "We'll be including <sys/file.h>." >&4
14920         else
14921                 val="$undef"
14922                 echo "We won't be including <sys/file.h>." >&4
14923         fi
14924         ;;
14925 *)
14926         h_sysfile=false
14927         ;;
14928 esac
14929 set i_sysfile
14930 eval $setvar
14931
14932 : see if fcntl.h is there
14933 val=''
14934 set fcntl.h val
14935 eval $inhdr
14936
14937 : see if we can include fcntl.h
14938 case "$val" in
14939 "$define")
14940         echo " "
14941         if $h_fcntl; then
14942                 val="$define"
14943                 echo "We'll be including <fcntl.h>." >&4
14944         else
14945                 val="$undef"
14946                 if $h_sysfile; then
14947         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14948                 else
14949                         echo "We won't be including <fcntl.h>." >&4
14950                 fi
14951         fi
14952         ;;
14953 *)
14954         h_fcntl=false
14955         val="$undef"
14956         ;;
14957 esac
14958 set i_fcntl
14959 eval $setvar
14960
14961 : see if this is a iconv.h system
14962 set iconv.h i_iconv
14963 eval $inhdr
14964
14965 : see if this is a ieeefp.h system
14966 set ieeefp.h i_ieeefp
14967 eval $inhdr
14968
14969 : see if this is a libutil.h system
14970 set libutil.h i_libutil
14971 eval $inhdr
14972
14973 : see if locale.h is available
14974 set locale.h i_locale
14975 eval $inhdr
14976
14977 : see if mach cthreads are available
14978 if test "X$usethreads" = "X$define"; then
14979         set mach/cthreads.h i_machcthr
14980         eval $inhdr
14981 else
14982         i_machcthr="$undef"
14983 fi
14984
14985
14986
14987 : see if this is a math.h system
14988 set math.h i_math
14989 eval $inhdr
14990
14991 : see if this is a mntent.h system
14992 set mntent.h i_mntent
14993 eval $inhdr
14994
14995 : see if ndbm.h is available
14996 set ndbm.h t_ndbm
14997 eval $inhdr
14998 case "$t_ndbm" in
14999 $define)
15000         : see if dbm_open exists
15001         set dbm_open d_dbm_open
15002         eval $inlibc
15003         case "$d_dbm_open" in
15004         $undef)
15005                 t_ndbm="$undef"
15006                 echo "We won't be including <ndbm.h>"
15007                 ;;
15008         esac
15009         ;;
15010 esac
15011 val="$t_ndbm"
15012 set i_ndbm
15013 eval $setvar
15014
15015 : see if net/errno.h is available
15016 val=''
15017 set net/errno.h val
15018 eval $inhdr
15019
15020 : Unfortunately, it causes problems on some systems.  Arrgh.
15021 case "$val" in
15022 $define)
15023         cat > try.c <<'EOM'
15024 #include <stdio.h>
15025 #include <errno.h>
15026 #include <net/errno.h>
15027 int func()
15028 {
15029         return ENOTSOCK;
15030 }
15031 EOM
15032         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15033                 echo "We'll be including <net/errno.h>." >&4
15034         else
15035                 echo "We won't be including <net/errno.h>." >&4
15036                 val="$undef"
15037         fi
15038         $rm -f try.* try
15039         ;;
15040 esac
15041 set i_neterrno
15042 eval $setvar
15043
15044 : see if netinet/tcp.h is available
15045 set netinet/tcp.h i_netinettcp
15046 eval $inhdr
15047
15048 : see if this is a poll.h system
15049 set poll.h i_poll
15050 eval $inhdr
15051
15052 : see if this is a prot.h system
15053 set prot.h i_prot
15054 eval $inhdr
15055
15056 echo " "
15057 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15058 $cat <<'EOSH' > Cppsym.know
15059 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15060 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15061 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
15062 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
15063 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15064 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15065 bull c cadmus clipper CMU COFF COMPILER_VERSION
15066 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15067 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15068 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15069 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15070 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15071 H3050R H3050RX hbullx20 hcx host_mips
15072 hp200 hp300 hp700 HP700 hp800 hp9000
15073 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15074 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15075 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15076 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15077 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15078 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15079 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15080 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15081 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15082 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15083 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15084 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15085 MATH_HAS_NO_SIDE_EFFECTS
15086 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15087 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15088 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15089 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15090 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15091 NetBSD news1500 news1700 news1800 news1900 news3700
15092 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15093 ns32016 ns32332 ns32k nsc32000
15094 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15095 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15096 pc532 pdp11 PGC PIC plexus PORTAR posix
15097 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15098 POSIX_C_SOURCE POSIX_SOURCE POWER
15099 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15100 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
15101 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15102 sony sony_news sonyrisc sparc sparclite spectrum
15103 stardent stdc STDC_EXT stratos sun sun3 sun386
15104 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15105 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15106 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15107 sysV68 sysV88 Tek4132 Tek4300 titan
15108 tower tower32 tower32_200 tower32_600 tower32_700
15109 tower32_800 tower32_850 tss
15110 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15111 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15112 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15113 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15114 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15115 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15116 z8000
15117 EOSH
15118 # Maybe put other stuff here too.
15119 cat <<EOSH >>Cppsym.know
15120 $osname
15121 EOSH
15122 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15123 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15124 $cat Cppsym.know > Cppsym.c
15125 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15126 $rm -f Cppsym.a Cppsym.b Cppsym.c
15127 cat <<EOSH > Cppsym
15128 $startsh
15129 if $test \$# -gt 0; then
15130     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15131     if $test -s Cppsym.got; then
15132         $rm -f Cppsym.got
15133         exit 0
15134     fi
15135     $rm -f Cppsym.got
15136     exit 1
15137 else
15138     $tr " " "$trnl" | ./Cppsym.try
15139     exit 0
15140 fi
15141 EOSH
15142 chmod +x Cppsym
15143 $eunicefix Cppsym
15144 cat <<EOSH > Cppsym.try
15145 $startsh
15146 cat <<'EOCP' > try.c
15147 #include <stdio.h>
15148 int main() {
15149 EOCP
15150 $awk \\
15151 EOSH
15152 cat <<'EOSH' >> Cppsym.try
15153 'length($1) > 0 {
15154     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15155     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15156     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15157     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15158 }'       >> try.c
15159 echo '}' >> try.c
15160 EOSH
15161 cat <<EOSH >> Cppsym.try
15162 ccflags="$ccflags"
15163 case "$osname-$gccversion" in
15164 irix-) ccflags="\$ccflags -woff 1178" ;;
15165 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15166 esac
15167 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15168 EOSH
15169 chmod +x Cppsym.try
15170 $eunicefix Cppsym.try
15171 ./Cppsym < Cppsym.know > Cppsym.true
15172 : now check the C compiler for additional symbols
15173 postprocess_cc_v=''
15174 case "$osname" in
15175 aix) postprocess_cc_v="|$tr , ' '" ;;
15176 esac
15177 $cat >ccsym <<EOS
15178 $startsh
15179 $cat >tmp.c <<EOF
15180 extern int foo;
15181 EOF
15182 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15183 do
15184         case "\$i" in
15185         -D*) echo "\$i" | $sed 's/^-D//';;
15186         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15187         esac
15188 done
15189 $rm -f try.c
15190 EOS
15191 postprocess_cc_v=''
15192 chmod +x ccsym
15193 $eunicefix ccsym
15194 ./ccsym > ccsym1.raw
15195 if $test -s ccsym1.raw; then
15196        $sort ccsym1.raw | $uniq >ccsym.raw
15197 else
15198        mv ccsym1.raw ccsym.raw
15199 fi
15200
15201 $awk '/\=/ { print $0; next }
15202         { print $0"=1" }' ccsym.raw >ccsym.list
15203 $awk '/\=/ { print $0; next }
15204         { print $0"=1" }' Cppsym.true >ccsym.true
15205 $comm -13 ccsym.true ccsym.list >ccsym.own
15206 $comm -12 ccsym.true ccsym.list >ccsym.com
15207 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15208 also=''
15209 if $test -z ccsym.raw; then
15210         echo "Your C compiler doesn't seem to define any symbols!" >&4
15211         echo " "
15212         echo "However, your C preprocessor defines the following symbols:"
15213         $cat Cppsym.true
15214         ccsymbols=''
15215         cppsymbols=`$cat Cppsym.true`
15216         cppsymbols=`echo $cppsymbols`
15217         cppccsymbols="$cppsymbols"
15218 else
15219         if $test -s ccsym.com; then
15220                 echo "Your C compiler and pre-processor define these symbols:"
15221                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15222                 also='also '
15223                 symbols='ones'
15224                 cppccsymbols=`$cat ccsym.com`
15225                 cppccsymbols=`echo $cppccsymbols`
15226                 $test "$silent" || sleep 1
15227         fi
15228         if $test -s ccsym.cpp; then
15229                 $test "$also" && echo " "
15230                 echo "Your C pre-processor ${also}defines the following symbols:"
15231                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15232                 also='further '
15233                 cppsymbols=`$cat ccsym.cpp`
15234                 cppsymbols=`echo $cppsymbols`
15235                 $test "$silent" || sleep 1
15236         fi
15237         if $test -s ccsym.own; then
15238                 $test "$also" && echo " "
15239                 echo "Your C compiler ${also}defines the following cpp symbols:"
15240                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15241                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15242                 ccsymbols=`$cat ccsym.own`
15243                 ccsymbols=`echo $ccsymbols`
15244                 $test "$silent" || sleep 1
15245         fi
15246 fi
15247 $rm -f ccsym* Cppsym.*
15248
15249 : see if this is a termio system
15250 val="$undef"
15251 val2="$undef"
15252 val3="$undef"
15253 if $test `./findhdr termios.h`; then
15254         set tcsetattr i_termios
15255         eval $inlibc
15256         val3="$i_termios"
15257 fi
15258 echo " "
15259 case "$val3" in
15260 "$define") echo "You have POSIX termios.h... good!" >&4;;
15261 *) if ./Cppsym pyr; then
15262                 case "`/bin/universe`" in
15263                 ucb) if $test `./findhdr sgtty.h`; then
15264                                 val2="$define"
15265                                 echo "<sgtty.h> found." >&4
15266                         else
15267                                 echo "System is pyramid with BSD universe."
15268                                 echo "<sgtty.h> not found--you could have problems." >&4
15269                         fi;;
15270                 *) if $test `./findhdr termio.h`; then
15271                                 val="$define"
15272                                 echo "<termio.h> found." >&4
15273                         else
15274                                 echo "System is pyramid with USG universe."
15275                                 echo "<termio.h> not found--you could have problems." >&4
15276                         fi;;
15277                 esac
15278         elif ./usg; then
15279                 if $test `./findhdr termio.h`; then
15280                         echo "<termio.h> found." >&4
15281                         val="$define"
15282                 elif $test `./findhdr sgtty.h`; then
15283                         echo "<sgtty.h> found." >&4
15284                         val2="$define"
15285                 else
15286 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15287                 fi
15288         else
15289                 if $test `./findhdr sgtty.h`; then
15290                         echo "<sgtty.h> found." >&4
15291                         val2="$define"
15292                 elif $test `./findhdr termio.h`; then
15293                         echo "<termio.h> found." >&4
15294                         val="$define"
15295                 else
15296 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15297                 fi
15298         fi;;
15299 esac
15300 set i_termio; eval $setvar
15301 val=$val2; set i_sgtty; eval $setvar
15302 val=$val3; set i_termios; eval $setvar
15303
15304 : see if this is a shadow.h system
15305 set shadow.h i_shadow
15306 eval $inhdr
15307
15308 : see if stddef is available
15309 set stddef.h i_stddef
15310 eval $inhdr
15311
15312 : see if this is a sunmath.h system
15313 set sunmath.h i_sunmath
15314 eval $inhdr
15315
15316 : see if sys/access.h is available
15317 set sys/access.h i_sysaccess
15318 eval $inhdr
15319
15320 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15321 set sys/filio.h i_sysfilio
15322 eval $inhdr
15323 echo " "
15324 if $test `./findhdr sys/ioctl.h`; then
15325         val="$define"
15326         echo '<sys/ioctl.h> found.' >&4
15327 else
15328         val="$undef"
15329         if $test $i_sysfilio = "$define"; then
15330             echo '<sys/ioctl.h> NOT found.' >&4
15331         else
15332                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15333                 $test $i_termio = "$define" && xxx="termio.h"
15334                 $test $i_termios = "$define" && xxx="termios.h"
15335 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15336         fi
15337 fi
15338 set i_sysioctl
15339 eval $setvar
15340
15341
15342 : see if this is a syslog.h system
15343 set syslog.h i_syslog
15344 eval $inhdr
15345
15346
15347 : see if this is a sys/mode.h system
15348 set sys/mode.h i_sysmode
15349 eval $inhdr
15350
15351 : see if sys/resource.h has to be included
15352 set sys/resource.h i_sysresrc
15353 eval $inhdr
15354
15355 : see if sys/security.h is available
15356 set sys/security.h i_syssecrt
15357 eval $inhdr
15358
15359 : see if this is a sys/statvfs.h system
15360 set sys/statvfs.h i_sysstatvfs
15361 eval $inhdr
15362
15363 : see if this is a sys/uio.h system
15364 set sys/uio.h i_sysuio
15365 eval $inhdr
15366
15367 : see if this is a sys/un.h system
15368 set sys/un.h i_sysun
15369 eval $inhdr
15370
15371
15372 : see if this is a sys/utsname.h system
15373 set sys/utsname.h i_sysutsname
15374 eval $inhdr
15375
15376 : see if this is a syswait system
15377 set sys/wait.h i_syswait
15378 eval $inhdr
15379
15380 : see if this is a ustat.h system
15381 set ustat.h i_ustat
15382 eval $inhdr
15383
15384 : see if this is an utime system
15385 set utime.h i_utime
15386 eval $inhdr
15387
15388 : see if this is a values.h system
15389 set values.h i_values
15390 eval $inhdr
15391
15392 : see if this is a vfork system
15393 case "$d_vfork" in
15394 "$define")
15395         set vfork.h i_vfork
15396         eval $inhdr
15397         ;;
15398 *)
15399         i_vfork="$undef"
15400         ;;
15401 esac
15402
15403 : see if gdbm.h is available
15404 set gdbm.h t_gdbm
15405 eval $inhdr
15406 case "$t_gdbm" in
15407 $define)
15408         : see if gdbm_open exists
15409         set gdbm_open d_gdbm_open
15410         eval $inlibc
15411         case "$d_gdbm_open" in
15412         $undef)
15413                 t_gdbm="$undef"
15414                 echo "We won't be including <gdbm.h>"
15415                 ;;
15416         esac
15417         ;;
15418 esac
15419 val="$t_gdbm"
15420 set i_gdbm
15421 eval $setvar
15422
15423 echo " "
15424 echo "Looking for extensions..." >&4
15425 : If we are using the old config.sh, known_extensions may contain
15426 : old or inaccurate or duplicate values.
15427 known_extensions=''
15428 nonxs_extensions=''
15429 : We do not use find because it might not be available.
15430 : We do not just use MANIFEST because the user may have dropped
15431 : some additional extensions into the source tree and expect them
15432 : to be built.
15433
15434 : Function to recursively find available extensions, ignoring DynaLoader
15435 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15436 find_extensions='
15437     for xxx in *; do
15438        case "$xxx" in
15439            DynaLoader|dynaload) ;;
15440            *)
15441            if $test -f $xxx/$xxx.xs; then
15442                known_extensions="$known_extensions $1$xxx";
15443            elif $test -f $xxx/Makefile.PL; then
15444                nonxs_extensions="$nonxs_extensions $1$xxx";
15445            else
15446                if $test -d $xxx -a $# -lt 10; then
15447                    set $1$xxx/ $*;
15448                    cd $xxx;
15449                    eval $find_extensions;
15450                    cd ..;
15451                    shift;
15452                fi;
15453            fi
15454            ;;
15455        esac;
15456     done'
15457 tdir=`pwd`
15458 cd $rsrc/ext
15459 set X
15460 shift
15461 eval $find_extensions
15462 set X $nonxs_extensions
15463 shift
15464 nonxs_extensions="$*"
15465 set X $known_extensions
15466 shift
15467 known_extensions="$*"
15468 cd $tdir
15469
15470 : Now see which are supported on this system.
15471 avail_ext=''
15472 for xxx in $known_extensions ; do
15473         case "$xxx" in
15474         DB_File|db_file)
15475                 case "$i_db" in
15476                 $define) avail_ext="$avail_ext $xxx" ;;
15477                 esac
15478                 ;;
15479         GDBM_File|gdbm_fil)
15480                 case "$i_gdbm" in 
15481                 $define) avail_ext="$avail_ext $xxx" ;;
15482                 esac
15483                 ;;
15484         NDBM_File|ndbm_fil)
15485                 case "$i_ndbm" in
15486                 $define)
15487                     case "$osname-$use64bitint" in
15488                     hpux-define)
15489                         case "$libs" in
15490                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15491                         esac
15492                         ;;
15493                     *) avail_ext="$avail_ext $xxx" ;;
15494                     esac
15495                     ;;
15496                 esac
15497                 ;;
15498         ODBM_File|odbm_fil) 
15499                 case "${i_dbm}${i_rpcsvcdbm}" in
15500                 *"${define}"*)
15501                     case "$osname-$use64bitint" in
15502                     hpux-define)
15503                         case "$libs" in
15504                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15505                         esac
15506                         ;;
15507                     *) avail_ext="$avail_ext $xxx" ;;
15508                     esac
15509                     ;;
15510                 esac
15511                 ;;
15512         POSIX|posix)
15513                 case "$useposix" in
15514                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15515                 esac
15516                 ;;
15517         Opcode|opcode)
15518                 case "$useopcode" in
15519                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15520                 esac
15521                 ;;
15522         Socket|socket)
15523                 case "$d_socket" in 
15524                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15525                 esac
15526                 ;;
15527         Sys/Syslog|sys/syslog)
15528                 : XXX syslog requires socket
15529                 case "$d_socket" in 
15530                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15531                 esac
15532                 ;;
15533         Thread|thread)
15534                 case "$usethreads" in 
15535                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15536                 esac
15537                 ;;
15538         IPC/SysV|ipc/sysv)
15539                 : XXX Do we need a useipcsysv variable here
15540                 case "${d_msg}${d_sem}${d_shm}" in 
15541                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15542                 esac
15543                 ;;
15544         *)      avail_ext="$avail_ext $xxx"
15545                 ;;
15546         esac
15547 done
15548
15549 set X $avail_ext
15550 shift
15551 avail_ext="$*"
15552
15553 : Now see which nonxs extensions are supported on this system.
15554 : For now assume all are.
15555 nonxs_ext=''
15556 for xxx in $nonxs_extensions ; do
15557         case "$xxx" in
15558         *)      nonxs_ext="$nonxs_ext $xxx"
15559                 ;;
15560         esac
15561 done
15562
15563 set X $nonxs_ext
15564 shift
15565 nonxs_ext="$*"
15566
15567 case $usedl in
15568 $define)
15569         $cat <<EOM
15570 A number of extensions are supplied with $package.  You may choose to
15571 compile these extensions for dynamic loading (the default), compile
15572 them into the $package executable (static loading), or not include
15573 them at all.  Answer "none" to include no extensions.
15574 Note that DynaLoader is always built and need not be mentioned here.
15575
15576 EOM
15577         case "$dynamic_ext" in
15578         '') dflt="$avail_ext" ;;
15579         *)      dflt="$dynamic_ext"
15580                 # Perhaps we are reusing an old out-of-date config.sh.
15581                 case "$hint" in
15582                 previous)
15583                         if test X"$dynamic_ext" != X"$avail_ext"; then
15584                                 $cat <<EOM
15585 NOTICE:  Your previous config.sh list may be incorrect. 
15586 The extensions now available to you are 
15587         ${avail_ext}
15588 but the default list from your previous config.sh is
15589         ${dynamic_ext} 
15590
15591 EOM
15592                         fi
15593                         ;;
15594                 esac
15595                 ;;
15596         esac
15597         case "$dflt" in
15598         '')     dflt=none;;
15599         esac
15600         rp="What extensions do you wish to load dynamically?"
15601         . ./myread
15602         case "$ans" in
15603         none) dynamic_ext=' ' ;;
15604         *) dynamic_ext="$ans" ;;
15605         esac
15606
15607         case "$static_ext" in
15608         '')
15609                 : Exclude those already listed in dynamic linking
15610                 dflt=''
15611                 for xxx in $avail_ext; do
15612                         case " $dynamic_ext " in
15613                         *" $xxx "*) ;;
15614                         *) dflt="$dflt $xxx" ;;
15615                         esac
15616                 done
15617                 set X $dflt
15618                 shift
15619                 dflt="$*"
15620                 ;;
15621         *)  dflt="$static_ext" 
15622                 ;;
15623         esac
15624
15625         case "$dflt" in
15626         '')     dflt=none;;
15627         esac
15628         rp="What extensions do you wish to load statically?"
15629         . ./myread
15630         case "$ans" in
15631         none) static_ext=' ' ;;
15632         *) static_ext="$ans" ;;
15633         esac
15634         ;;
15635 *)
15636         $cat <<EOM
15637 A number of extensions are supplied with $package.  Answer "none" 
15638 to include no extensions. 
15639 Note that DynaLoader is always built and need not be mentioned here.
15640
15641 EOM
15642         case "$static_ext" in
15643         '') dflt="$avail_ext" ;;
15644         *)      dflt="$static_ext"
15645                 # Perhaps we are reusing an old out-of-date config.sh.
15646                 case "$hint" in
15647                 previous)
15648                         if test X"$static_ext" != X"$avail_ext"; then
15649                                 $cat <<EOM
15650 NOTICE:  Your previous config.sh list may be incorrect. 
15651 The extensions now available to you are 
15652         ${avail_ext}
15653 but the default list from your previous config.sh is
15654         ${static_ext} 
15655
15656 EOM
15657                         fi
15658                         ;;
15659                 esac
15660                 ;;
15661         esac
15662         : Exclude those that are not xs extensions
15663         case "$dflt" in
15664         '')     dflt=none;;
15665         esac
15666         rp="What extensions do you wish to include?"
15667         . ./myread
15668         case "$ans" in
15669         none) static_ext=' ' ;;
15670         *) static_ext="$ans" ;;
15671         esac
15672         ;;
15673 esac
15674
15675 set X $dynamic_ext $static_ext $nonxs_ext
15676 shift
15677 extensions="$*"
15678
15679 : Remove libraries needed only for extensions
15680 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15681 : The exception is SunOS 4.x, which needs them.
15682 case "${osname}X${osvers}" in
15683 sunos*X4*)
15684     perllibs="$libs"
15685     ;;
15686 *) case "$usedl" in
15687     $define|true|[yY]*)
15688             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15689             shift
15690             perllibs="$*"
15691             ;;
15692     *)  perllibs="$libs"
15693             ;;
15694     esac
15695     ;;
15696 esac
15697
15698 : Remove build directory name from cppstdin so it can be used from
15699 : either the present location or the final installed location.
15700 echo " "
15701 : Get out of the UU directory to get correct path name.
15702 cd ..
15703 case "$cppstdin" in
15704 `pwd`/cppstdin)
15705         echo "Stripping down cppstdin path name"
15706         cppstdin=cppstdin
15707         ;;
15708 esac
15709 cd UU
15710
15711 : end of configuration questions
15712 echo " "
15713 echo "End of configuration questions."
15714 echo " "
15715
15716 : back to where it started
15717 if test -d ../UU; then
15718         cd ..
15719 fi
15720
15721 : configuration may be patched via a 'config.over' file
15722 if $test -f config.over; then
15723         echo " "
15724         dflt=y
15725         rp='I see a config.over file.  Do you wish to load it?'
15726         . UU/myread
15727         case "$ans" in
15728         n*) echo "OK, I'll ignore it.";;
15729         *)      . ./config.over
15730                 echo "Configuration override changes have been loaded."
15731                 ;;
15732         esac
15733 fi
15734
15735 : in case they want portability, strip down executable paths
15736 case "$d_portable" in
15737 "$define")
15738         echo " "
15739         echo "Stripping down executable paths..." >&4
15740         for file in $loclist $trylist; do
15741                 eval temp=\$$file
15742                 eval $file=`basename $temp`
15743         done
15744         ;;
15745 esac
15746
15747 : create config.sh file
15748 echo " "
15749 echo "Creating config.sh..." >&4
15750 $spitshell <<EOT >config.sh
15751 $startsh
15752 #
15753 # This file was produced by running the Configure script. It holds all the
15754 # definitions figured out by Configure. Should you modify one of these values,
15755 # do not forget to propagate your changes by running "Configure -der". You may
15756 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15757 #
15758
15759 # Package name      : $package
15760 # Source directory  : $src
15761 # Configuration time: $cf_time
15762 # Configured by     : $cf_by
15763 # Target system     : $myuname
15764
15765 Author='$Author'
15766 Date='$Date'
15767 Header='$Header'
15768 Id='$Id'
15769 Locker='$Locker'
15770 Log='$Log'
15771 Mcc='$Mcc'
15772 RCSfile='$RCSfile'
15773 Revision='$Revision'
15774 Source='$Source'
15775 State='$State'
15776 _a='$_a'
15777 _exe='$_exe'
15778 _o='$_o'
15779 afs='$afs'
15780 alignbytes='$alignbytes'
15781 ansi2knr='$ansi2knr'
15782 aphostname='$aphostname'
15783 api_revision='$api_revision'
15784 api_subversion='$api_subversion'
15785 api_version='$api_version'
15786 api_versionstring='$api_versionstring'
15787 ar='$ar'
15788 archlib='$archlib'
15789 archlibexp='$archlibexp'
15790 archname64='$archname64'
15791 archname='$archname'
15792 archobjs='$archobjs'
15793 awk='$awk'
15794 baserev='$baserev'
15795 bash='$bash'
15796 bin='$bin'
15797 bincompat5005='$bincompat5005'
15798 binexp='$binexp'
15799 bison='$bison'
15800 byacc='$byacc'
15801 byteorder='$byteorder'
15802 c='$c'
15803 castflags='$castflags'
15804 cat='$cat'
15805 cc='$cc'
15806 cccdlflags='$cccdlflags'
15807 ccdlflags='$ccdlflags'
15808 ccflags='$ccflags'
15809 ccflags_uselargefiles='$ccflags_uselargefiles'
15810 ccname='$ccname'
15811 ccsymbols='$ccsymbols'
15812 ccversion='$ccversion'
15813 cf_by='$cf_by'
15814 cf_email='$cf_email'
15815 cf_time='$cf_time'
15816 charsize='$charsize'
15817 chgrp='$chgrp'
15818 chmod='$chmod'
15819 chown='$chown'
15820 clocktype='$clocktype'
15821 comm='$comm'
15822 compress='$compress'
15823 contains='$contains'
15824 cp='$cp'
15825 cpio='$cpio'
15826 cpp='$cpp'
15827 cpp_stuff='$cpp_stuff'
15828 cppccsymbols='$cppccsymbols'
15829 cppflags='$cppflags'
15830 cpplast='$cpplast'
15831 cppminus='$cppminus'
15832 cpprun='$cpprun'
15833 cppstdin='$cppstdin'
15834 cppsymbols='$cppsymbols'
15835 crosscompile='$crosscompile'
15836 cryptlib='$cryptlib'
15837 csh='$csh'
15838 d_Gconvert='$d_Gconvert'
15839 d_PRIEUldbl='$d_PRIEUldbl'
15840 d_PRIFUldbl='$d_PRIFUldbl'
15841 d_PRIGUldbl='$d_PRIGUldbl'
15842 d_PRIXU64='$d_PRIXU64'
15843 d_PRId64='$d_PRId64'
15844 d_PRIeldbl='$d_PRIeldbl'
15845 d_PRIfldbl='$d_PRIfldbl'
15846 d_PRIgldbl='$d_PRIgldbl'
15847 d_PRIi64='$d_PRIi64'
15848 d_PRIo64='$d_PRIo64'
15849 d_PRIu64='$d_PRIu64'
15850 d_PRIx64='$d_PRIx64'
15851 d_SCNfldbl='$d_SCNfldbl'
15852 d__fwalk='$d__fwalk'
15853 d_access='$d_access'
15854 d_accessx='$d_accessx'
15855 d_alarm='$d_alarm'
15856 d_archlib='$d_archlib'
15857 d_atolf='$d_atolf'
15858 d_atoll='$d_atoll'
15859 d_attribut='$d_attribut'
15860 d_bcmp='$d_bcmp'
15861 d_bcopy='$d_bcopy'
15862 d_bincompat5005='$d_bincompat5005'
15863 d_bsd='$d_bsd'
15864 d_bsdgetpgrp='$d_bsdgetpgrp'
15865 d_bsdsetpgrp='$d_bsdsetpgrp'
15866 d_bzero='$d_bzero'
15867 d_casti32='$d_casti32'
15868 d_castneg='$d_castneg'
15869 d_charvspr='$d_charvspr'
15870 d_chown='$d_chown'
15871 d_chroot='$d_chroot'
15872 d_chsize='$d_chsize'
15873 d_closedir='$d_closedir'
15874 d_const='$d_const'
15875 d_crypt='$d_crypt'
15876 d_csh='$d_csh'
15877 d_cuserid='$d_cuserid'
15878 d_dbl_dig='$d_dbl_dig'
15879 d_difftime='$d_difftime'
15880 d_dirnamlen='$d_dirnamlen'
15881 d_dlerror='$d_dlerror'
15882 d_dlopen='$d_dlopen'
15883 d_dlsymun='$d_dlsymun'
15884 d_dosuid='$d_dosuid'
15885 d_drand48proto='$d_drand48proto'
15886 d_dup2='$d_dup2'
15887 d_eaccess='$d_eaccess'
15888 d_endgrent='$d_endgrent'
15889 d_endhent='$d_endhent'
15890 d_endnent='$d_endnent'
15891 d_endpent='$d_endpent'
15892 d_endpwent='$d_endpwent'
15893 d_endsent='$d_endsent'
15894 d_eofnblk='$d_eofnblk'
15895 d_eunice='$d_eunice'
15896 d_fchmod='$d_fchmod'
15897 d_fchown='$d_fchown'
15898 d_fcntl='$d_fcntl'
15899 d_fcntl_can_lock='$d_fcntl_can_lock'
15900 d_fd_macros='$d_fd_macros'
15901 d_fd_set='$d_fd_set'
15902 d_fds_bits='$d_fds_bits'
15903 d_fgetpos='$d_fgetpos'
15904 d_flexfnam='$d_flexfnam'
15905 d_flock='$d_flock'
15906 d_fork='$d_fork'
15907 d_fpathconf='$d_fpathconf'
15908 d_fpos64_t='$d_fpos64_t'
15909 d_frexpl='$d_frexpl'
15910 d_fs_data_s='$d_fs_data_s'
15911 d_fseeko='$d_fseeko'
15912 d_fsetpos='$d_fsetpos'
15913 d_fstatfs='$d_fstatfs'
15914 d_fstatvfs='$d_fstatvfs'
15915 d_fsync='$d_fsync'
15916 d_ftello='$d_ftello'
15917 d_ftime='$d_ftime'
15918 d_getcwd='$d_getcwd'
15919 d_getespwnam='$d_getespwnam'
15920 d_getfsstat='$d_getfsstat'
15921 d_getgrent='$d_getgrent'
15922 d_getgrps='$d_getgrps'
15923 d_gethbyaddr='$d_gethbyaddr'
15924 d_gethbyname='$d_gethbyname'
15925 d_gethent='$d_gethent'
15926 d_gethname='$d_gethname'
15927 d_gethostprotos='$d_gethostprotos'
15928 d_getlogin='$d_getlogin'
15929 d_getmnt='$d_getmnt'
15930 d_getmntent='$d_getmntent'
15931 d_getnbyaddr='$d_getnbyaddr'
15932 d_getnbyname='$d_getnbyname'
15933 d_getnent='$d_getnent'
15934 d_getnetprotos='$d_getnetprotos'
15935 d_getpagsz='$d_getpagsz'
15936 d_getpbyname='$d_getpbyname'
15937 d_getpbynumber='$d_getpbynumber'
15938 d_getpent='$d_getpent'
15939 d_getpgid='$d_getpgid'
15940 d_getpgrp2='$d_getpgrp2'
15941 d_getpgrp='$d_getpgrp'
15942 d_getppid='$d_getppid'
15943 d_getprior='$d_getprior'
15944 d_getprotoprotos='$d_getprotoprotos'
15945 d_getprpwnam='$d_getprpwnam'
15946 d_getpwent='$d_getpwent'
15947 d_getsbyname='$d_getsbyname'
15948 d_getsbyport='$d_getsbyport'
15949 d_getsent='$d_getsent'
15950 d_getservprotos='$d_getservprotos'
15951 d_getspnam='$d_getspnam'
15952 d_gettimeod='$d_gettimeod'
15953 d_gnulibc='$d_gnulibc'
15954 d_grpasswd='$d_grpasswd'
15955 d_hasmntopt='$d_hasmntopt'
15956 d_htonl='$d_htonl'
15957 d_iconv='$d_iconv'
15958 d_index='$d_index'
15959 d_inetaton='$d_inetaton'
15960 d_int64_t='$d_int64_t'
15961 d_isascii='$d_isascii'
15962 d_isnan='$d_isnan'
15963 d_isnanl='$d_isnanl'
15964 d_killpg='$d_killpg'
15965 d_lchown='$d_lchown'
15966 d_ldbl_dig='$d_ldbl_dig'
15967 d_link='$d_link'
15968 d_locconv='$d_locconv'
15969 d_lockf='$d_lockf'
15970 d_longdbl='$d_longdbl'
15971 d_longlong='$d_longlong'
15972 d_lseekproto='$d_lseekproto'
15973 d_lstat='$d_lstat'
15974 d_madvise='$d_madvise'
15975 d_mblen='$d_mblen'
15976 d_mbstowcs='$d_mbstowcs'
15977 d_mbtowc='$d_mbtowc'
15978 d_memchr='$d_memchr'
15979 d_memcmp='$d_memcmp'
15980 d_memcpy='$d_memcpy'
15981 d_memmove='$d_memmove'
15982 d_memset='$d_memset'
15983 d_mkdir='$d_mkdir'
15984 d_mkdtemp='$d_mkdtemp'
15985 d_mkfifo='$d_mkfifo'
15986 d_mkstemp='$d_mkstemp'
15987 d_mkstemps='$d_mkstemps'
15988 d_mktime='$d_mktime'
15989 d_mmap='$d_mmap'
15990 d_modfl='$d_modfl'
15991 d_mprotect='$d_mprotect'
15992 d_msg='$d_msg'
15993 d_msg_ctrunc='$d_msg_ctrunc'
15994 d_msg_dontroute='$d_msg_dontroute'
15995 d_msg_oob='$d_msg_oob'
15996 d_msg_peek='$d_msg_peek'
15997 d_msg_proxy='$d_msg_proxy'
15998 d_msgctl='$d_msgctl'
15999 d_msgget='$d_msgget'
16000 d_msgrcv='$d_msgrcv'
16001 d_msgsnd='$d_msgsnd'
16002 d_msync='$d_msync'
16003 d_munmap='$d_munmap'
16004 d_mymalloc='$d_mymalloc'
16005 d_nice='$d_nice'
16006 d_nv_preserves_uv='$d_nv_preserves_uv'
16007 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16008 d_off64_t='$d_off64_t'
16009 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16010 d_oldpthreads='$d_oldpthreads'
16011 d_oldsock='$d_oldsock'
16012 d_open3='$d_open3'
16013 d_pathconf='$d_pathconf'
16014 d_pause='$d_pause'
16015 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16016 d_phostname='$d_phostname'
16017 d_pipe='$d_pipe'
16018 d_poll='$d_poll'
16019 d_portable='$d_portable'
16020 d_pthread_yield='$d_pthread_yield'
16021 d_pwage='$d_pwage'
16022 d_pwchange='$d_pwchange'
16023 d_pwclass='$d_pwclass'
16024 d_pwcomment='$d_pwcomment'
16025 d_pwexpire='$d_pwexpire'
16026 d_pwgecos='$d_pwgecos'
16027 d_pwpasswd='$d_pwpasswd'
16028 d_pwquota='$d_pwquota'
16029 d_qgcvt='$d_qgcvt'
16030 d_quad='$d_quad'
16031 d_readdir='$d_readdir'
16032 d_readlink='$d_readlink'
16033 d_rename='$d_rename'
16034 d_rewinddir='$d_rewinddir'
16035 d_rmdir='$d_rmdir'
16036 d_safebcpy='$d_safebcpy'
16037 d_safemcpy='$d_safemcpy'
16038 d_sanemcmp='$d_sanemcmp'
16039 d_sbrkproto='$d_sbrkproto'
16040 d_sched_yield='$d_sched_yield'
16041 d_scm_rights='$d_scm_rights'
16042 d_seekdir='$d_seekdir'
16043 d_select='$d_select'
16044 d_sem='$d_sem'
16045 d_semctl='$d_semctl'
16046 d_semctl_semid_ds='$d_semctl_semid_ds'
16047 d_semctl_semun='$d_semctl_semun'
16048 d_semget='$d_semget'
16049 d_semop='$d_semop'
16050 d_setegid='$d_setegid'
16051 d_seteuid='$d_seteuid'
16052 d_setgrent='$d_setgrent'
16053 d_setgrps='$d_setgrps'
16054 d_sethent='$d_sethent'
16055 d_setlinebuf='$d_setlinebuf'
16056 d_setlocale='$d_setlocale'
16057 d_setnent='$d_setnent'
16058 d_setpent='$d_setpent'
16059 d_setpgid='$d_setpgid'
16060 d_setpgrp2='$d_setpgrp2'
16061 d_setpgrp='$d_setpgrp'
16062 d_setprior='$d_setprior'
16063 d_setproctitle='$d_setproctitle'
16064 d_setpwent='$d_setpwent'
16065 d_setregid='$d_setregid'
16066 d_setresgid='$d_setresgid'
16067 d_setresuid='$d_setresuid'
16068 d_setreuid='$d_setreuid'
16069 d_setrgid='$d_setrgid'
16070 d_setruid='$d_setruid'
16071 d_setsent='$d_setsent'
16072 d_setsid='$d_setsid'
16073 d_setvbuf='$d_setvbuf'
16074 d_sfio='$d_sfio'
16075 d_shm='$d_shm'
16076 d_shmat='$d_shmat'
16077 d_shmatprototype='$d_shmatprototype'
16078 d_shmctl='$d_shmctl'
16079 d_shmdt='$d_shmdt'
16080 d_shmget='$d_shmget'
16081 d_sigaction='$d_sigaction'
16082 d_sigsetjmp='$d_sigsetjmp'
16083 d_socket='$d_socket'
16084 d_socklen_t='$d_socklen_t'
16085 d_sockpair='$d_sockpair'
16086 d_socks5_init='$d_socks5_init'
16087 d_sqrtl='$d_sqrtl'
16088 d_statblks='$d_statblks'
16089 d_statfs_f_flags='$d_statfs_f_flags'
16090 d_statfs_s='$d_statfs_s'
16091 d_statvfs='$d_statvfs'
16092 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16093 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16094 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16095 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16096 d_stdio_stream_array='$d_stdio_stream_array'
16097 d_stdiobase='$d_stdiobase'
16098 d_stdstdio='$d_stdstdio'
16099 d_strchr='$d_strchr'
16100 d_strcoll='$d_strcoll'
16101 d_strctcpy='$d_strctcpy'
16102 d_strerrm='$d_strerrm'
16103 d_strerror='$d_strerror'
16104 d_strtod='$d_strtod'
16105 d_strtol='$d_strtol'
16106 d_strtold='$d_strtold'
16107 d_strtoll='$d_strtoll'
16108 d_strtoq='$d_strtoq'
16109 d_strtoul='$d_strtoul'
16110 d_strtoull='$d_strtoull'
16111 d_strtouq='$d_strtouq'
16112 d_strxfrm='$d_strxfrm'
16113 d_suidsafe='$d_suidsafe'
16114 d_symlink='$d_symlink'
16115 d_syscall='$d_syscall'
16116 d_sysconf='$d_sysconf'
16117 d_sysernlst='$d_sysernlst'
16118 d_syserrlst='$d_syserrlst'
16119 d_system='$d_system'
16120 d_tcgetpgrp='$d_tcgetpgrp'
16121 d_tcsetpgrp='$d_tcsetpgrp'
16122 d_telldir='$d_telldir'
16123 d_telldirproto='$d_telldirproto'
16124 d_time='$d_time'
16125 d_times='$d_times'
16126 d_truncate='$d_truncate'
16127 d_tzname='$d_tzname'
16128 d_umask='$d_umask'
16129 d_uname='$d_uname'
16130 d_union_semun='$d_union_semun'
16131 d_ustat='$d_ustat'
16132 d_vendorarch='$d_vendorarch'
16133 d_vendorbin='$d_vendorbin'
16134 d_vendorlib='$d_vendorlib'
16135 d_vfork='$d_vfork'
16136 d_void_closedir='$d_void_closedir'
16137 d_voidsig='$d_voidsig'
16138 d_voidtty='$d_voidtty'
16139 d_volatile='$d_volatile'
16140 d_vprintf='$d_vprintf'
16141 d_wait4='$d_wait4'
16142 d_waitpid='$d_waitpid'
16143 d_wcstombs='$d_wcstombs'
16144 d_wctomb='$d_wctomb'
16145 d_xenix='$d_xenix'
16146 date='$date'
16147 db_hashtype='$db_hashtype'
16148 db_prefixtype='$db_prefixtype'
16149 defvoidused='$defvoidused'
16150 direntrytype='$direntrytype'
16151 dlext='$dlext'
16152 dlsrc='$dlsrc'
16153 doublesize='$doublesize'
16154 drand01='$drand01'
16155 dynamic_ext='$dynamic_ext'
16156 eagain='$eagain'
16157 ebcdic='$ebcdic'
16158 echo='$echo'
16159 egrep='$egrep'
16160 emacs='$emacs'
16161 eunicefix='$eunicefix'
16162 exe_ext='$exe_ext'
16163 expr='$expr'
16164 extensions='$extensions'
16165 fflushNULL='$fflushNULL'
16166 fflushall='$fflushall'
16167 find='$find'
16168 firstmakefile='$firstmakefile'
16169 flex='$flex'
16170 fpossize='$fpossize'
16171 fpostype='$fpostype'
16172 freetype='$freetype'
16173 full_ar='$full_ar'
16174 full_csh='$full_csh'
16175 full_sed='$full_sed'
16176 gccosandvers='$gccosandvers'
16177 gccversion='$gccversion'
16178 gidformat='$gidformat'
16179 gidsign='$gidsign'
16180 gidsize='$gidsize'
16181 gidtype='$gidtype'
16182 glibpth='$glibpth'
16183 grep='$grep'
16184 groupcat='$groupcat'
16185 groupstype='$groupstype'
16186 gzip='$gzip'
16187 h_fcntl='$h_fcntl'
16188 h_sysfile='$h_sysfile'
16189 hint='$hint'
16190 hostcat='$hostcat'
16191 i16size='$i16size'
16192 i16type='$i16type'
16193 i32size='$i32size'
16194 i32type='$i32type'
16195 i64size='$i64size'
16196 i64type='$i64type'
16197 i8size='$i8size'
16198 i8type='$i8type'
16199 i_arpainet='$i_arpainet'
16200 i_bsdioctl='$i_bsdioctl'
16201 i_db='$i_db'
16202 i_dbm='$i_dbm'
16203 i_dirent='$i_dirent'
16204 i_dld='$i_dld'
16205 i_dlfcn='$i_dlfcn'
16206 i_fcntl='$i_fcntl'
16207 i_float='$i_float'
16208 i_gdbm='$i_gdbm'
16209 i_grp='$i_grp'
16210 i_iconv='$i_iconv'
16211 i_ieeefp='$i_ieeefp'
16212 i_inttypes='$i_inttypes'
16213 i_libutil='$i_libutil'
16214 i_limits='$i_limits'
16215 i_locale='$i_locale'
16216 i_machcthr='$i_machcthr'
16217 i_malloc='$i_malloc'
16218 i_math='$i_math'
16219 i_memory='$i_memory'
16220 i_mntent='$i_mntent'
16221 i_ndbm='$i_ndbm'
16222 i_netdb='$i_netdb'
16223 i_neterrno='$i_neterrno'
16224 i_netinettcp='$i_netinettcp'
16225 i_niin='$i_niin'
16226 i_poll='$i_poll'
16227 i_prot='$i_prot'
16228 i_pthread='$i_pthread'
16229 i_pwd='$i_pwd'
16230 i_rpcsvcdbm='$i_rpcsvcdbm'
16231 i_sfio='$i_sfio'
16232 i_sgtty='$i_sgtty'
16233 i_shadow='$i_shadow'
16234 i_socks='$i_socks'
16235 i_stdarg='$i_stdarg'
16236 i_stddef='$i_stddef'
16237 i_stdlib='$i_stdlib'
16238 i_string='$i_string'
16239 i_sunmath='$i_sunmath'
16240 i_sysaccess='$i_sysaccess'
16241 i_sysdir='$i_sysdir'
16242 i_sysfile='$i_sysfile'
16243 i_sysfilio='$i_sysfilio'
16244 i_sysin='$i_sysin'
16245 i_sysioctl='$i_sysioctl'
16246 i_syslog='$i_syslog'
16247 i_sysmman='$i_sysmman'
16248 i_sysmode='$i_sysmode'
16249 i_sysmount='$i_sysmount'
16250 i_sysndir='$i_sysndir'
16251 i_sysparam='$i_sysparam'
16252 i_sysresrc='$i_sysresrc'
16253 i_syssecrt='$i_syssecrt'
16254 i_sysselct='$i_sysselct'
16255 i_syssockio='$i_syssockio'
16256 i_sysstat='$i_sysstat'
16257 i_sysstatfs='$i_sysstatfs'
16258 i_sysstatvfs='$i_sysstatvfs'
16259 i_systime='$i_systime'
16260 i_systimek='$i_systimek'
16261 i_systimes='$i_systimes'
16262 i_systypes='$i_systypes'
16263 i_sysuio='$i_sysuio'
16264 i_sysun='$i_sysun'
16265 i_sysutsname='$i_sysutsname'
16266 i_sysvfs='$i_sysvfs'
16267 i_syswait='$i_syswait'
16268 i_termio='$i_termio'
16269 i_termios='$i_termios'
16270 i_time='$i_time'
16271 i_unistd='$i_unistd'
16272 i_ustat='$i_ustat'
16273 i_utime='$i_utime'
16274 i_values='$i_values'
16275 i_varargs='$i_varargs'
16276 i_varhdr='$i_varhdr'
16277 i_vfork='$i_vfork'
16278 ignore_versioned_solibs='$ignore_versioned_solibs'
16279 inc_version_list='$inc_version_list'
16280 inc_version_list_init='$inc_version_list_init'
16281 incpath='$incpath'
16282 inews='$inews'
16283 installarchlib='$installarchlib'
16284 installbin='$installbin'
16285 installman1dir='$installman1dir'
16286 installman3dir='$installman3dir'
16287 installprefix='$installprefix'
16288 installprefixexp='$installprefixexp'
16289 installprivlib='$installprivlib'
16290 installscript='$installscript'
16291 installsitearch='$installsitearch'
16292 installsitebin='$installsitebin'
16293 installsitelib='$installsitelib'
16294 installstyle='$installstyle'
16295 installusrbinperl='$installusrbinperl'
16296 installvendorarch='$installvendorarch'
16297 installvendorbin='$installvendorbin'
16298 installvendorlib='$installvendorlib'
16299 intsize='$intsize'
16300 issymlink='$issymlink'
16301 ivdformat='$ivdformat'
16302 ivsize='$ivsize'
16303 ivtype='$ivtype'
16304 known_extensions='$known_extensions'
16305 ksh='$ksh'
16306 ld='$ld'
16307 lddlflags='$lddlflags'
16308 ldflags='$ldflags'
16309 ldflags_uselargefiles='$ldflags_uselargefiles'
16310 ldlibpthname='$ldlibpthname'
16311 less='$less'
16312 lib_ext='$lib_ext'
16313 libc='$libc'
16314 libperl='$libperl'
16315 libpth='$libpth'
16316 libs='$libs'
16317 libsdirs='$libsdirs'
16318 libsfiles='$libsfiles'
16319 libsfound='$libsfound'
16320 libspath='$libspath'
16321 libswanted='$libswanted'
16322 libswanted_uselargefiles='$libswanted_uselargefiles'
16323 line='$line'
16324 lint='$lint'
16325 lkflags='$lkflags'
16326 ln='$ln'
16327 lns='$lns'
16328 locincpth='$locincpth'
16329 loclibpth='$loclibpth'
16330 longdblsize='$longdblsize'
16331 longlongsize='$longlongsize'
16332 longsize='$longsize'
16333 lp='$lp'
16334 lpr='$lpr'
16335 ls='$ls'
16336 lseeksize='$lseeksize'
16337 lseektype='$lseektype'
16338 mail='$mail'
16339 mailx='$mailx'
16340 make='$make'
16341 make_set_make='$make_set_make'
16342 mallocobj='$mallocobj'
16343 mallocsrc='$mallocsrc'
16344 malloctype='$malloctype'
16345 man1dir='$man1dir'
16346 man1direxp='$man1direxp'
16347 man1ext='$man1ext'
16348 man3dir='$man3dir'
16349 man3direxp='$man3direxp'
16350 man3ext='$man3ext'
16351 mips_type='$mips_type'
16352 mkdir='$mkdir'
16353 mmaptype='$mmaptype'
16354 modetype='$modetype'
16355 more='$more'
16356 multiarch='$multiarch'
16357 mv='$mv'
16358 myarchname='$myarchname'
16359 mydomain='$mydomain'
16360 myhostname='$myhostname'
16361 myuname='$myuname'
16362 n='$n'
16363 need_va_copy='$need_va_copy'
16364 netdb_hlen_type='$netdb_hlen_type'
16365 netdb_host_type='$netdb_host_type'
16366 netdb_name_type='$netdb_name_type'
16367 netdb_net_type='$netdb_net_type'
16368 nm='$nm'
16369 nm_opt='$nm_opt'
16370 nm_so_opt='$nm_so_opt'
16371 nonxs_ext='$nonxs_ext'
16372 nroff='$nroff'
16373 nvEUformat='$nvEUformat'
16374 nvFUformat='$nvFUformat'
16375 nvGUformat='$nvGUformat'
16376 nveformat='$nveformat'
16377 nvfformat='$nvfformat'
16378 nvgformat='$nvgformat'
16379 nvsize='$nvsize'
16380 nvtype='$nvtype'
16381 o_nonblock='$o_nonblock'
16382 obj_ext='$obj_ext'
16383 old_pthread_create_joinable='$old_pthread_create_joinable'
16384 optimize='$optimize'
16385 orderlib='$orderlib'
16386 osname='$osname'
16387 osvers='$osvers'
16388 otherlibdirs='$otherlibdirs'
16389 package='$package'
16390 pager='$pager'
16391 passcat='$passcat'
16392 patchlevel='$patchlevel'
16393 path_sep='$path_sep'
16394 perl5='$perl5'
16395 perl='$perl'
16396 perladmin='$perladmin'
16397 perllibs='$perllibs'
16398 perlpath='$perlpath'
16399 pg='$pg'
16400 phostname='$phostname'
16401 pidtype='$pidtype'
16402 plibpth='$plibpth'
16403 pm_apiversion='$pm_apiversion'
16404 pmake='$pmake'
16405 pr='$pr'
16406 prefix='$prefix'
16407 prefixexp='$prefixexp'
16408 privlib='$privlib'
16409 privlibexp='$privlibexp'
16410 prototype='$prototype'
16411 ptrsize='$ptrsize'
16412 quadkind='$quadkind'
16413 quadtype='$quadtype'
16414 randbits='$randbits'
16415 randfunc='$randfunc'
16416 randseedtype='$randseedtype'
16417 ranlib='$ranlib'
16418 rd_nodata='$rd_nodata'
16419 revision='$revision'
16420 rm='$rm'
16421 rmail='$rmail'
16422 runnm='$runnm'
16423 sPRIEUldbl='$sPRIEUldbl'
16424 sPRIFUldbl='$sPRIFUldbl'
16425 sPRIGUldbl='$sPRIGUldbl'
16426 sPRIXU64='$sPRIXU64'
16427 sPRId64='$sPRId64'
16428 sPRIeldbl='$sPRIeldbl'
16429 sPRIfldbl='$sPRIfldbl'
16430 sPRIgldbl='$sPRIgldbl'
16431 sPRIi64='$sPRIi64'
16432 sPRIo64='$sPRIo64'
16433 sPRIu64='$sPRIu64'
16434 sPRIx64='$sPRIx64'
16435 sSCNfldbl='$sSCNfldbl'
16436 sched_yield='$sched_yield'
16437 scriptdir='$scriptdir'
16438 scriptdirexp='$scriptdirexp'
16439 sed='$sed'
16440 seedfunc='$seedfunc'
16441 selectminbits='$selectminbits'
16442 selecttype='$selecttype'
16443 sendmail='$sendmail'
16444 sh='$sh'
16445 shar='$shar'
16446 sharpbang='$sharpbang'
16447 shmattype='$shmattype'
16448 shortsize='$shortsize'
16449 shrpenv='$shrpenv'
16450 shsharp='$shsharp'
16451 sig_count='$sig_count'
16452 sig_name='$sig_name'
16453 sig_name_init='$sig_name_init'
16454 sig_num='$sig_num'
16455 sig_num_init='$sig_num_init'
16456 signal_t='$signal_t'
16457 sitearch='$sitearch'
16458 sitearchexp='$sitearchexp'
16459 sitebin='$sitebin'
16460 sitebinexp='$sitebinexp'
16461 sitelib='$sitelib'
16462 sitelib_stem='$sitelib_stem'
16463 sitelibexp='$sitelibexp'
16464 siteprefix='$siteprefix'
16465 siteprefixexp='$siteprefixexp'
16466 sizesize='$sizesize'
16467 sizetype='$sizetype'
16468 sleep='$sleep'
16469 smail='$smail'
16470 so='$so'
16471 sockethdr='$sockethdr'
16472 socketlib='$socketlib'
16473 socksizetype='$socksizetype'
16474 sort='$sort'
16475 spackage='$spackage'
16476 spitshell='$spitshell'
16477 src='$src'
16478 ssizetype='$ssizetype'
16479 startperl='$startperl'
16480 startsh='$startsh'
16481 static_ext='$static_ext'
16482 stdchar='$stdchar'
16483 stdio_base='$stdio_base'
16484 stdio_bufsiz='$stdio_bufsiz'
16485 stdio_cnt='$stdio_cnt'
16486 stdio_filbuf='$stdio_filbuf'
16487 stdio_ptr='$stdio_ptr'
16488 stdio_stream_array='$stdio_stream_array'
16489 strings='$strings'
16490 submit='$submit'
16491 subversion='$subversion'
16492 sysman='$sysman'
16493 tail='$tail'
16494 tar='$tar'
16495 tbl='$tbl'
16496 tee='$tee'
16497 test='$test'
16498 timeincl='$timeincl'
16499 timetype='$timetype'
16500 touch='$touch'
16501 tr='$tr'
16502 trnl='$trnl'
16503 troff='$troff'
16504 u16size='$u16size'
16505 u16type='$u16type'
16506 u32size='$u32size'
16507 u32type='$u32type'
16508 u64size='$u64size'
16509 u64type='$u64type'
16510 u8size='$u8size'
16511 u8type='$u8type'
16512 uidformat='$uidformat'
16513 uidsign='$uidsign'
16514 uidsize='$uidsize'
16515 uidtype='$uidtype'
16516 uname='$uname'
16517 uniq='$uniq'
16518 uquadtype='$uquadtype'
16519 use5005threads='$use5005threads'
16520 use64bitall='$use64bitall'
16521 use64bitint='$use64bitint'
16522 usedl='$usedl'
16523 useithreads='$useithreads'
16524 uselargefiles='$uselargefiles'
16525 uselongdouble='$uselongdouble'
16526 usemorebits='$usemorebits'
16527 usemultiplicity='$usemultiplicity'
16528 usemymalloc='$usemymalloc'
16529 usenm='$usenm'
16530 useopcode='$useopcode'
16531 useperlio='$useperlio'
16532 useposix='$useposix'
16533 usesfio='$usesfio'
16534 useshrplib='$useshrplib'
16535 usesocks='$usesocks'
16536 usethreads='$usethreads'
16537 usevendorprefix='$usevendorprefix'
16538 usevfork='$usevfork'
16539 usrinc='$usrinc'
16540 uuname='$uuname'
16541 uvXUformat='$uvXUformat'
16542 uvoformat='$uvoformat'
16543 uvsize='$uvsize'
16544 uvtype='$uvtype'
16545 uvuformat='$uvuformat'
16546 uvxformat='$uvxformat'
16547 vendorarch='$vendorarch'
16548 vendorarchexp='$vendorarchexp'
16549 vendorbin='$vendorbin'
16550 vendorbinexp='$vendorbinexp'
16551 vendorlib='$vendorlib'
16552 vendorlib_stem='$vendorlib_stem'
16553 vendorlibexp='$vendorlibexp'
16554 vendorprefix='$vendorprefix'
16555 vendorprefixexp='$vendorprefixexp'
16556 version='$version'
16557 versiononly='$versiononly'
16558 vi='$vi'
16559 voidflags='$voidflags'
16560 xlibpth='$xlibpth'
16561 xs_apiversion='$xs_apiversion'
16562 zcat='$zcat'
16563 zip='$zip'
16564 EOT
16565
16566 : Add in command line options if available
16567 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16568
16569 : add special variables
16570 $test -f $src/patchlevel.h && \
16571 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16572 echo "CONFIGDOTSH=true" >>config.sh
16573
16574 : propagate old symbols
16575 if $test -f UU/config.sh; then
16576         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16577         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16578         $sort | $uniq -u >UU/oldsyms
16579         set X `cat UU/oldsyms`
16580         shift
16581         case $# in
16582         0) ;;
16583         *)
16584                 cat <<EOM
16585 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16586 EOM
16587                 echo "# Variables propagated from previous config.sh file." >>config.sh
16588                 for sym in `cat UU/oldsyms`; do
16589                         echo "    Propagating $hint variable "'$'"$sym..."
16590                         eval 'tmp="$'"${sym}"'"'
16591                         echo "$tmp" | \
16592                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16593                 done
16594                 ;;
16595         esac
16596 fi
16597
16598 : Finish up by extracting the .SH files
16599 case "$alldone" in
16600 exit)
16601         $rm -rf UU
16602         echo "Done."
16603         exit 0
16604         ;;
16605 cont)
16606         ;;
16607 '')
16608         dflt=''
16609         nostick=true
16610         $cat <<EOM
16611
16612 If you'd like to make any changes to the config.sh file before I begin
16613 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16614
16615 EOM
16616         rp="Press return or use a shell escape to edit config.sh:"
16617         . UU/myread
16618         nostick=''
16619         case "$ans" in
16620         '') ;;
16621         *) : in case they cannot read
16622                 sh 1>&4 -c "$ans";;
16623         esac
16624         ;;
16625 esac
16626
16627 : if this fails, just run all the .SH files by hand
16628 . ./config.sh
16629
16630 echo " "
16631 exec 1>&4
16632 . ./UU/extract
16633
16634 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16635         dflt=y
16636         case "$silent" in
16637         true) ;;
16638         *)
16639                 $cat <<EOM
16640
16641 Now you need to generate make dependencies by running "$make depend".
16642 You might prefer to run it in background: "$make depend > makedepend.out &"
16643 It can take a while, so you might not want to run it right now.
16644
16645 EOM
16646                 ;;
16647         esac
16648         rp="Run $make depend now?"
16649         . UU/myread
16650         case "$ans" in
16651         y*)
16652                 $make depend && echo "Now you must run '$make'."
16653                 ;;
16654         *)
16655                 echo "You must run '$make depend' then '$make'."
16656                 ;;
16657         esac
16658 elif test -f [Mm]akefile; then
16659         echo " "
16660         echo "Now you must run a $make."
16661 else
16662         echo "Done."
16663 fi
16664
16665 if $test -f Policy.sh; then
16666     $cat <<EOM
16667
16668 If you compile $package on a different machine or from a different object
16669 directory, copy the Policy.sh file from this object directory to the
16670 new one before you run Configure -- this will help you with most of
16671 the policy defaults.
16672
16673 EOM
16674 fi
16675 if $test -f config.msg; then
16676     echo "Hmm.  I also noted the following information while running:"
16677     echo " "
16678     $cat config.msg >&4
16679     $rm -f config.msg
16680 fi
16681 $rm -f kit*isdone ark*isdone
16682 $rm -rf UU
16683
16684 : End of Configure
16685