d5b354a29dca86441de59a1620a41abc36989387
[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 21:51:16 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 case "$newsh" in
150 '') sh_c="sh -c" ;;
151 *)  sh_c="$newsh -c" ;;
152 esac
153
154 : if needed set CDPATH to a harmless value that is not chatty
155 : avoid bash 2.02 problems with empty CDPATH.
156 case "$CDPATH" in
157 '')     ;;
158 *)      case "$SHELL" in
159         *bash*) CDPATH='.' ;;
160         *)              CDPATH='' ;;
161         esac
162         ;;
163 esac
164 : Configure runs within the UU subdirectory
165 test -d UU || mkdir UU
166 cd UU && rm -f ./*
167
168 ccname=''
169 ccversion=''
170 ccsymbols=''
171 cppccsymbols=''
172 cppsymbols=''
173 perllibs=''
174 dynamic_ext=''
175 extensions=''
176 known_extensions=''
177 nonxs_ext=''
178 static_ext=''
179 useopcode=''
180 useposix=''
181 d_bsd=''
182 d_eunice=''
183 d_xenix=''
184 sh_c=''
185 eunicefix=''
186 Mcc=''
187 ar=''
188 awk=''
189 bash=''
190 bison=''
191 byacc=''
192 cat=''
193 chgrp=''
194 chmod=''
195 chown=''
196 comm=''
197 compress=''
198 cp=''
199 cpio=''
200 cpp=''
201 csh=''
202 date=''
203 echo=''
204 egrep=''
205 emacs=''
206 expr=''
207 find=''
208 flex=''
209 grep=''
210 gzip=''
211 inews=''
212 ksh=''
213 less=''
214 line=''
215 lint=''
216 ln=''
217 lp=''
218 lpr=''
219 ls=''
220 mail=''
221 mailx=''
222 make=''
223 mkdir=''
224 more=''
225 mv=''
226 nm=''
227 nroff=''
228 perl=''
229 pg=''
230 pmake=''
231 pr=''
232 rm=''
233 rmail=''
234 sed=''
235 sendmail=''
236 shar=''
237 sleep=''
238 smail=''
239 sort=''
240 submit=''
241 tail=''
242 tar=''
243 tbl=''
244 tee=''
245 test=''
246 touch=''
247 tr=''
248 troff=''
249 uname=''
250 uniq=''
251 uuname=''
252 vi=''
253 zcat=''
254 zip=''
255 full_ar=''
256 full_sed=''
257 libswanted=''
258 hint=''
259 myuname=''
260 osname=''
261 osvers=''
262 Author=''
263 Date=''
264 Header=''
265 Id=''
266 Locker=''
267 Log=''
268 RCSfile=''
269 Revision=''
270 Source=''
271 State=''
272 _a=''
273 _exe=''
274 _o=''
275 archobjs=''
276 exe_ext=''
277 firstmakefile=''
278 lib_ext=''
279 obj_ext=''
280 path_sep=''
281 afs=''
282 alignbytes=''
283 ansi2knr=''
284 archlib=''
285 archlibexp=''
286 d_archlib=''
287 installarchlib=''
288 archname=''
289 myarchname=''
290 d_atolf=''
291 d_atoll=''
292 baserev=''
293 bin=''
294 binexp=''
295 installbin=''
296 bincompat5005=''
297 d_bincompat5005=''
298 byteorder=''
299 cc=''
300 ccflags=''
301 cppflags=''
302 ldflags=''
303 lkflags=''
304 locincpth=''
305 optimize=''
306 cf_email=''
307 cf_by=''
308 cf_time=''
309 charsize=''
310 contains=''
311 cpp_stuff=''
312 cpplast=''
313 cppminus=''
314 cpprun=''
315 cppstdin=''
316 crosscompile=''
317 d__fwalk=''
318 d_access=''
319 d_accessx=''
320 d_alarm=''
321 d_attribut=''
322 d_bcmp=''
323 d_bcopy=''
324 d_bzero=''
325 d_casti32=''
326 castflags=''
327 d_castneg=''
328 d_chown=''
329 d_chroot=''
330 d_chsize=''
331 d_closedir=''
332 d_void_closedir=''
333 d_const=''
334 cryptlib=''
335 d_crypt=''
336 d_csh=''
337 full_csh=''
338 d_cuserid=''
339 d_dbl_dig=''
340 d_difftime=''
341 d_dlerror=''
342 d_dlopen=''
343 d_dlsymun=''
344 d_dosuid=''
345 d_suidsafe=''
346 d_drand48proto=''
347 d_dup2=''
348 d_eaccess=''
349 d_endgrent=''
350 d_endhent=''
351 d_endnent=''
352 d_endpent=''
353 d_endpwent=''
354 d_endsent=''
355 d_fchmod=''
356 d_fchown=''
357 d_fcntl=''
358 d_fcntl_can_lock=''
359 d_fd_macros=''
360 d_fd_set=''
361 d_fds_bits=''
362 d_fgetpos=''
363 d_flexfnam=''
364 d_flock=''
365 d_fork=''
366 d_fpos64_t=''
367 d_frexpl=''
368 d_fs_data_s=''
369 d_fseeko=''
370 d_fsetpos=''
371 d_fstatfs=''
372 d_fsync=''
373 d_ftello=''
374 d_ftime=''
375 d_gettimeod=''
376 d_Gconvert=''
377 d_getcwd=''
378 d_getespwnam=''
379 d_getfsstat=''
380 d_getgrent=''
381 d_getgrps=''
382 d_gethbyaddr=''
383 d_gethbyname=''
384 d_gethent=''
385 aphostname=''
386 d_gethname=''
387 d_phostname=''
388 d_uname=''
389 d_gethostprotos=''
390 d_getlogin=''
391 d_getmnt=''
392 d_getmntent=''
393 d_getnbyaddr=''
394 d_getnbyname=''
395 d_getnent=''
396 d_getnetprotos=''
397 d_getpagsz=''
398 d_getpent=''
399 d_getpgid=''
400 d_getpgrp2=''
401 d_bsdgetpgrp=''
402 d_getpgrp=''
403 d_getppid=''
404 d_getprior=''
405 d_getpbyname=''
406 d_getpbynumber=''
407 d_getprotoprotos=''
408 d_getprpwnam=''
409 d_getpwent=''
410 d_getsent=''
411 d_getservprotos=''
412 d_getspnam=''
413 d_getsbyname=''
414 d_getsbyport=''
415 d_gnulibc=''
416 d_hasmntopt=''
417 d_htonl=''
418 d_iconv=''
419 d_inetaton=''
420 d_int64_t=''
421 d_isascii=''
422 d_isnan=''
423 d_isnanl=''
424 d_killpg=''
425 d_lchown=''
426 d_ldbl_dig=''
427 d_link=''
428 d_locconv=''
429 d_lockf=''
430 d_longdbl=''
431 longdblsize=''
432 d_longlong=''
433 longlongsize=''
434 d_lseekproto=''
435 d_lstat=''
436 d_madvise=''
437 d_mblen=''
438 d_mbstowcs=''
439 d_mbtowc=''
440 d_memchr=''
441 d_memcmp=''
442 d_memcpy=''
443 d_memmove=''
444 d_memset=''
445 d_mkdir=''
446 d_mkdtemp=''
447 d_mkfifo=''
448 d_mkstemp=''
449 d_mkstemps=''
450 d_mktime=''
451 d_mmap=''
452 mmaptype=''
453 d_modfl=''
454 d_mprotect=''
455 d_msg=''
456 d_msgctl=''
457 d_msgget=''
458 d_msgrcv=''
459 d_msgsnd=''
460 d_msync=''
461 d_munmap=''
462 d_nice=''
463 d_off64_t=''
464 d_open3=''
465 d_fpathconf=''
466 d_pathconf=''
467 d_pause=''
468 d_pipe=''
469 d_poll=''
470 d_portable=''
471 d_old_pthread_create_joinable=''
472 old_pthread_create_joinable=''
473 d_pthread_yield=''
474 d_sched_yield=''
475 sched_yield=''
476 d_qgcvt=''
477 d_readdir=''
478 d_rewinddir=''
479 d_seekdir=''
480 d_telldir=''
481 d_readlink=''
482 d_rename=''
483 d_rmdir=''
484 d_safebcpy=''
485 d_safemcpy=''
486 d_sanemcmp=''
487 d_sbrkproto=''
488 d_select=''
489 d_sem=''
490 d_semctl=''
491 d_semget=''
492 d_semop=''
493 d_setegid=''
494 d_seteuid=''
495 d_setgrent=''
496 d_setgrps=''
497 d_sethent=''
498 d_setlinebuf=''
499 d_setlocale=''
500 d_setnent=''
501 d_setpent=''
502 d_setpgid=''
503 d_setpgrp2=''
504 d_bsdsetpgrp=''
505 d_setpgrp=''
506 d_setprior=''
507 d_setproctitle=''
508 d_setpwent=''
509 d_setregid=''
510 d_setresgid=''
511 d_setresuid=''
512 d_setreuid=''
513 d_setrgid=''
514 d_setruid=''
515 d_setsent=''
516 d_setsid=''
517 d_setvbuf=''
518 d_sfio=''
519 usesfio=''
520 d_shm=''
521 d_shmat=''
522 d_shmatprototype=''
523 shmattype=''
524 d_shmctl=''
525 d_shmdt=''
526 d_shmget=''
527 d_sigaction=''
528 d_sigsetjmp=''
529 d_msg_ctrunc=''
530 d_msg_dontroute=''
531 d_msg_oob=''
532 d_msg_peek=''
533 d_msg_proxy=''
534 d_oldsock=''
535 d_scm_rights=''
536 d_socket=''
537 d_sockpair=''
538 sockethdr=''
539 socketlib=''
540 d_socklen_t=''
541 d_socks5_init=''
542 d_sqrtl=''
543 d_statblks=''
544 d_statfs_f_flags=''
545 d_statfs_s=''
546 d_fstatvfs=''
547 d_statvfs=''
548 d_stdio_cnt_lval=''
549 d_stdio_ptr_lval=''
550 d_stdio_ptr_lval_nochange_cnt=''
551 d_stdio_ptr_lval_sets_cnt=''
552 d_stdiobase=''
553 d_stdstdio=''
554 stdio_base=''
555 stdio_bufsiz=''
556 stdio_cnt=''
557 stdio_filbuf=''
558 stdio_ptr=''
559 d_index=''
560 d_strchr=''
561 d_strcoll=''
562 d_strctcpy=''
563 d_strerrm=''
564 d_strerror=''
565 d_sysernlst=''
566 d_syserrlst=''
567 d_strtod=''
568 d_strtol=''
569 d_strtold=''
570 d_strtoll=''
571 d_strtoq=''
572 d_strtoul=''
573 d_strtoull=''
574 d_strtouq=''
575 d_strxfrm=''
576 d_symlink=''
577 d_syscall=''
578 d_sysconf=''
579 d_system=''
580 d_tcgetpgrp=''
581 d_tcsetpgrp=''
582 d_telldirproto=''
583 d_time=''
584 timetype=''
585 clocktype=''
586 d_times=''
587 d_truncate=''
588 d_tzname=''
589 d_umask=''
590 d_semctl_semid_ds=''
591 d_semctl_semun=''
592 d_union_semun=''
593 d_ustat=''
594 d_vfork=''
595 usevfork=''
596 d_voidsig=''
597 signal_t=''
598 d_volatile=''
599 d_charvspr=''
600 d_vprintf=''
601 d_wait4=''
602 d_waitpid=''
603 d_wcstombs=''
604 d_wctomb=''
605 dlext=''
606 cccdlflags=''
607 ccdlflags=''
608 dlsrc=''
609 ld=''
610 lddlflags=''
611 usedl=''
612 doublesize=''
613 ebcdic=''
614 fflushNULL=''
615 fflushall=''
616 fpossize=''
617 fpostype=''
618 gccosandvers=''
619 gccversion=''
620 gidformat=''
621 gidsign=''
622 gidsize=''
623 gidtype=''
624 groupstype=''
625 h_fcntl=''
626 h_sysfile=''
627 i_arpainet=''
628 db_hashtype=''
629 db_prefixtype=''
630 i_db=''
631 i_dbm=''
632 i_rpcsvcdbm=''
633 d_dirnamlen=''
634 direntrytype=''
635 i_dirent=''
636 i_dld=''
637 i_dlfcn=''
638 i_fcntl=''
639 i_float=''
640 i_gdbm=''
641 d_grpasswd=''
642 i_grp=''
643 i_iconv=''
644 i_ieeefp=''
645 i_inttypes=''
646 i_libutil=''
647 i_limits=''
648 i_locale=''
649 i_machcthr=''
650 i_malloc=''
651 i_math=''
652 i_memory=''
653 i_mntent=''
654 i_ndbm=''
655 i_netdb=''
656 i_neterrno=''
657 i_netinettcp=''
658 i_niin=''
659 i_sysin=''
660 i_poll=''
661 i_prot=''
662 i_pthread=''
663 d_pwage=''
664 d_pwchange=''
665 d_pwclass=''
666 d_pwcomment=''
667 d_pwexpire=''
668 d_pwgecos=''
669 d_pwpasswd=''
670 d_pwquota=''
671 i_pwd=''
672 i_sfio=''
673 i_shadow=''
674 i_socks=''
675 i_stddef=''
676 i_stdlib=''
677 i_string=''
678 strings=''
679 i_sunmath=''
680 i_sysaccess=''
681 i_sysdir=''
682 i_sysfile=''
683 d_voidtty=''
684 i_bsdioctl=''
685 i_sysfilio=''
686 i_sysioctl=''
687 i_syssockio=''
688 i_syslog=''
689 i_sysmman=''
690 i_sysmode=''
691 i_sysmount=''
692 i_sysndir=''
693 i_sysparam=''
694 i_sysresrc=''
695 i_syssecrt=''
696 i_sysselct=''
697 i_sysstat=''
698 i_sysstatfs=''
699 i_sysstatvfs=''
700 i_systimes=''
701 i_systypes=''
702 i_sysuio=''
703 i_sysun=''
704 i_sysutsname=''
705 i_sysvfs=''
706 i_syswait=''
707 i_sgtty=''
708 i_termio=''
709 i_termios=''
710 i_systime=''
711 i_systimek=''
712 i_time=''
713 timeincl=''
714 i_unistd=''
715 i_ustat=''
716 i_utime=''
717 i_values=''
718 i_stdarg=''
719 i_varargs=''
720 i_varhdr=''
721 i_vfork=''
722 inc_version_list=''
723 inc_version_list_init=''
724 installprefix=''
725 installprefixexp=''
726 installstyle=''
727 installusrbinperl=''
728 intsize=''
729 longsize=''
730 shortsize=''
731 issymlink=''
732 libc=''
733 ldlibpthname=''
734 libperl=''
735 shrpenv=''
736 useshrplib=''
737 glibpth=''
738 libpth=''
739 loclibpth=''
740 plibpth=''
741 xlibpth=''
742 ignore_versioned_solibs=''
743 libs=''
744 libsdirs=''
745 libsfiles=''
746 libsfound=''
747 libspath=''
748 lns=''
749 d_PRIEUldbl=''
750 d_PRIFUldbl=''
751 d_PRIGUldbl=''
752 d_PRIeldbl=''
753 d_PRIfldbl=''
754 d_PRIgldbl=''
755 d_SCNfldbl=''
756 sPRIEUldbl=''
757 sPRIFUldbl=''
758 sPRIGUldbl=''
759 sPRIeldbl=''
760 sPRIfldbl=''
761 sPRIgldbl=''
762 sSCNfldbl=''
763 lseeksize=''
764 lseektype=''
765 make_set_make=''
766 d_mymalloc=''
767 freetype=''
768 mallocobj=''
769 mallocsrc=''
770 malloctype=''
771 usemymalloc=''
772 installman1dir=''
773 man1dir=''
774 man1direxp=''
775 man1ext=''
776 installman3dir=''
777 man3dir=''
778 man3direxp=''
779 man3ext=''
780 modetype=''
781 multiarch=''
782 mydomain=''
783 myhostname=''
784 phostname=''
785 c=''
786 n=''
787 d_eofnblk=''
788 eagain=''
789 o_nonblock=''
790 rd_nodata=''
791 need_va_copy=''
792 netdb_hlen_type=''
793 netdb_host_type=''
794 netdb_name_type=''
795 netdb_net_type=''
796 groupcat=''
797 hostcat=''
798 passcat=''
799 orderlib=''
800 ranlib=''
801 d_perl_otherlibdirs=''
802 otherlibdirs=''
803 package=''
804 spackage=''
805 pager=''
806 api_revision=''
807 api_subversion=''
808 api_version=''
809 api_versionstring=''
810 patchlevel=''
811 revision=''
812 subversion=''
813 version=''
814 perl5=''
815 perladmin=''
816 perlpath=''
817 d_nv_preserves_uv=''
818 d_nv_preserves_uv_bits=''
819 i16size=''
820 i16type=''
821 i32size=''
822 i32type=''
823 i64size=''
824 i64type=''
825 i8size=''
826 i8type=''
827 ivsize=''
828 ivtype=''
829 nvsize=''
830 nvtype=''
831 u16size=''
832 u16type=''
833 u32size=''
834 u32type=''
835 u64size=''
836 u64type=''
837 u8size=''
838 u8type=''
839 uvsize=''
840 uvtype=''
841 ivdformat=''
842 nvEUformat=''
843 nvFUformat=''
844 nvGUformat=''
845 nveformat=''
846 nvfformat=''
847 nvgformat=''
848 uvXUformat=''
849 uvoformat=''
850 uvuformat=''
851 uvxformat=''
852 pidtype=''
853 prefix=''
854 prefixexp=''
855 installprivlib=''
856 privlib=''
857 privlibexp=''
858 prototype=''
859 ptrsize=''
860 d_PRIXU64=''
861 d_PRId64=''
862 d_PRIi64=''
863 d_PRIo64=''
864 d_PRIu64=''
865 d_PRIx64=''
866 sPRIXU64=''
867 sPRId64=''
868 sPRIi64=''
869 sPRIo64=''
870 sPRIu64=''
871 sPRIx64=''
872 d_quad=''
873 quadkind=''
874 quadtype=''
875 uquadtype=''
876 drand01=''
877 randbits=''
878 randfunc=''
879 randseedtype=''
880 seedfunc=''
881 installscript=''
882 scriptdir=''
883 scriptdirexp=''
884 selectminbits=''
885 selecttype=''
886 sh=''
887 sig_count=''
888 sig_name=''
889 sig_name_init=''
890 sig_num=''
891 sig_num_init=''
892 installsitearch=''
893 sitearch=''
894 sitearchexp=''
895 installsitebin=''
896 sitebin=''
897 sitebinexp=''
898 installsitelib=''
899 sitelib=''
900 sitelib_stem=''
901 sitelibexp=''
902 siteprefix=''
903 siteprefixexp=''
904 sizesize=''
905 sizetype=''
906 so=''
907 socksizetype=''
908 sharpbang=''
909 shsharp=''
910 spitshell=''
911 src=''
912 ssizetype=''
913 startperl=''
914 startsh=''
915 stdchar=''
916 d_stdio_stream_array=''
917 stdio_stream_array=''
918 sysman=''
919 trnl=''
920 uidformat=''
921 uidsign=''
922 uidsize=''
923 uidtype=''
924 archname64=''
925 use64bitall=''
926 use64bitint=''
927 ccflags_uselargefiles=''
928 ldflags_uselargefiles=''
929 libswanted_uselargefiles=''
930 uselargefiles=''
931 uselongdouble=''
932 usemorebits=''
933 usemultiplicity=''
934 nm_opt=''
935 nm_so_opt=''
936 runnm=''
937 usenm=''
938 useperlio=''
939 usesocks=''
940 d_oldpthreads=''
941 use5005threads=''
942 useithreads=''
943 usethreads=''
944 incpath=''
945 mips_type=''
946 usrinc=''
947 d_vendorarch=''
948 installvendorarch=''
949 vendorarch=''
950 vendorarchexp=''
951 d_vendorbin=''
952 installvendorbin=''
953 vendorbin=''
954 vendorbinexp=''
955 d_vendorlib=''
956 installvendorlib=''
957 vendorlib=''
958 vendorlib_stem=''
959 vendorlibexp=''
960 usevendorprefix=''
961 vendorprefix=''
962 vendorprefixexp=''
963 versiononly=''
964 defvoidused=''
965 voidflags=''
966 pm_apiversion=''
967 xs_apiversion=''
968 CONFIG=''
969
970 define='define'
971 undef='undef'
972 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
973 rmlist=''
974
975 : We must find out about Eunice early
976 eunicefix=':'
977 if test -f /etc/unixtovms; then
978         eunicefix=/etc/unixtovms
979 fi
980 if test -f /etc/unixtovms.exe; then
981         eunicefix=/etc/unixtovms.exe
982 fi
983
984 i_whoami=''
985 ccname=''
986 ccversion=''
987 perllibs=''
988 : set useposix=false in your hint file to disable the POSIX extension.
989 useposix=true
990 : set useopcode=false in your hint file to disable the Opcode extension.
991 useopcode=true
992 : Trailing extension.  Override this in a hint file, if needed.
993 _exe=''
994 : Extra object files, if any, needed on this platform.
995 archobjs=''
996 archname=''
997 : Possible local include directories to search.
998 : Set locincpth to "" in a hint file to defeat local include searches.
999 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1000 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1001 :
1002 : no include file wanted by default
1003 inclwanted=''
1004
1005 groupstype=''
1006 : change the next line if compiling for Xenix/286 on Xenix/386
1007 xlibpth='/usr/lib/386 /lib/386'
1008 : Possible local library directories to search.
1009 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1010 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1011
1012 : general looking path for locating libraries
1013 glibpth="/lib /usr/lib $xlibpth"
1014 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1015 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1016 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1017
1018 : Private path used by Configure to find libraries.  Its value
1019 : is prepended to libpth. This variable takes care of special
1020 : machines, like the mips.  Usually, it should be empty.
1021 plibpth=''
1022
1023 : default library list
1024 libswanted=''
1025 : some systems want to use only the non-versioned libso:s
1026 ignore_versioned_solibs=''
1027 archname64=''
1028 ccflags_uselargefiles=''
1029 ldflags_uselargefiles=''
1030 libswanted_uselargefiles=''
1031 : set usemultiplicity on the Configure command line to enable multiplicity.
1032 : set usesocks on the Configure command line to enable socks.
1033 : set usethreads on the Configure command line to enable threads.
1034 : full support for void wanted by default
1035 defvoidused=15
1036
1037 : List of libraries we want.
1038 : If anyone needs -lnet, put it in a hint file.
1039 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1040 libswanted="$libswanted dld ld sun m c cposix posix"
1041 libswanted="$libswanted ndir dir crypt sec"
1042 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1043 : We probably want to search /usr/shlib before most other libraries.
1044 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1045 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1046 glibpth="/usr/shlib $glibpth"
1047 : Do not use vfork unless overridden by a hint file.
1048 usevfork=false
1049
1050 : Find the basic shell for Bourne shell scripts
1051 case "$sh" in
1052 '')
1053         case "$SYSTYPE" in
1054         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1055         *) xxx='/bin/sh';;
1056         esac
1057         if test -f "$xxx"; then
1058                 sh="$xxx"
1059         else
1060                 : Build up a list and do a single loop so we can 'break' out.
1061                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1062                 for xxx in sh bash ksh pdksh ash; do
1063                         for p in $pth; do
1064                                 try="$try ${p}/${xxx}"
1065                         done
1066                 done
1067                 for xxx in $try; do
1068                         if test -f "$xxx"; then
1069                                 sh="$xxx";
1070                                 break
1071                         elif test -f "$xxx.exe"; then
1072                                 sh="$xxx";
1073                                 break
1074                         fi
1075                 done
1076         fi
1077         ;;
1078 esac
1079
1080 case "$sh" in
1081 '')     cat <<EOM >&2
1082 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1083
1084 Usually it's in /bin/sh.  How did you even get this far?
1085 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1086 we'll try to straighten this all out.
1087 EOM
1088         exit 1
1089         ;;
1090 esac
1091
1092 : see if sh knows # comments
1093 if `$sh_c '#' >/dev/null 2>&1`; then
1094         shsharp=true
1095         spitshell=cat
1096         xcat=/bin/cat
1097         test -f $xcat || xcat=/usr/bin/cat
1098         echo "#!$xcat" >try
1099         $eunicefix try
1100         chmod +x try
1101         ./try > today
1102         if test -s today; then
1103                 sharpbang='#!'
1104         else
1105                 echo "#! $xcat" > try
1106                 $eunicefix try
1107                 chmod +x try
1108                 ./try > today
1109                 if test -s today; then
1110                         sharpbang='#! '
1111                 else
1112                         sharpbang=': use '
1113                 fi
1114         fi
1115 else
1116         echo " "
1117         echo "Your $sh doesn't grok # comments--I will strip them later on."
1118         shsharp=false
1119         cd ..
1120         echo "exec grep -v '^[  ]*#'" >spitshell
1121         chmod +x spitshell
1122         $eunicefix spitshell
1123         spitshell=`pwd`/spitshell
1124         cd UU
1125         echo "I presume that if # doesn't work, #! won't work either!"
1126         sharpbang=': use '
1127 fi
1128 rm -f try today
1129
1130 : figure out how to guarantee sh startup
1131 case "$startsh" in
1132 '') startsh=${sharpbang}${sh} ;;
1133 *)
1134 esac
1135 cat >try <<EOSS
1136 $startsh
1137 set abc
1138 test "$?abc" != 1
1139 EOSS
1140
1141 chmod +x try
1142 $eunicefix try
1143 if ./try; then
1144         : echo "Yup, it does."
1145 else
1146         echo "Hmm... '$startsh' does not guarantee sh startup..."
1147         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1148 fi
1149 rm -f try
1150
1151
1152 : Save command line options in file UU/cmdline.opt for later use in
1153 : generating config.sh.
1154 cat > cmdline.opt <<EOSH
1155 # Configure command line arguments.
1156 config_arg0='$0'
1157 config_args='$*'
1158 config_argc=$#
1159 EOSH
1160 argn=1
1161 for arg in "$@"; do
1162         cat >>cmdline.opt <<EOSH
1163 config_arg$argn='$arg'
1164 EOSH
1165         argn=`expr $argn + 1`
1166 done
1167
1168 : produce awk script to parse command line options
1169 cat >options.awk <<'EOF'
1170 BEGIN {
1171         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1172
1173         len = length(optstr);
1174         for (i = 1; i <= len; i++) {
1175                 c = substr(optstr, i, 1);
1176                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1177                 if (a == ":") {
1178                         arg[c] = 1;
1179                         i++;
1180                 }
1181                 opt[c] = 1;
1182         }
1183 }
1184 {
1185         expect = 0;
1186         str = $0;
1187         if (substr(str, 1, 1) != "-") {
1188                 printf("'%s'\n", str);
1189                 next;
1190         }
1191         len = length($0);
1192         for (i = 2; i <= len; i++) {
1193                 c = substr(str, i, 1);
1194                 if (!opt[c]) {
1195                         printf("-%s\n", substr(str, i));
1196                         next;
1197                 }
1198                 printf("-%s\n", c);
1199                 if (arg[c]) {
1200                         if (i < len)
1201                                 printf("'%s'\n", substr(str, i + 1));
1202                         else
1203                                 expect = 1;
1204                         next;
1205                 }
1206         }
1207 }
1208 END {
1209         if (expect)
1210                 print "?";
1211 }
1212 EOF
1213
1214 : process the command line options
1215 set X `for arg in "$@"; do echo "X$arg"; done |
1216         sed -e s/X// | awk -f options.awk`
1217 eval "set $*"
1218 shift
1219 rm -f options.awk
1220
1221 : set up default values
1222 fastread=''
1223 reuseval=false
1224 config_sh=''
1225 alldone=''
1226 error=''
1227 silent=''
1228 extractsh=''
1229 override=''
1230 knowitall=''
1231 rm -f optdef.sh posthint.sh
1232 cat >optdef.sh <<EOS
1233 $startsh
1234 EOS
1235
1236
1237 : option parsing
1238 while test $# -gt 0; do
1239         case "$1" in
1240         -d) shift; fastread=yes;;
1241         -e) shift; alldone=cont;;
1242         -f)
1243                 shift
1244                 cd ..
1245                 if test -r "$1"; then
1246                         config_sh="$1"
1247                 else
1248                         echo "$me: cannot read config file $1." >&2
1249                         error=true
1250                 fi
1251                 cd UU
1252                 shift;;
1253         -h) shift; error=true;;
1254         -r) shift; reuseval=true;;
1255         -s) shift; silent=true; realsilent=true;;
1256         -E) shift; alldone=exit;;
1257         -K) shift; knowitall=true;;
1258         -O) shift; override=true;;
1259         -S) shift; silent=true; extractsh=true;;
1260         -D)
1261                 shift
1262                 case "$1" in
1263                 *=)
1264                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1265                         echo "$me: ignoring -D $1" >&2
1266                         ;;
1267                 *=*) echo "$1" | \
1268                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1269                 *) echo "$1='define'" >> optdef.sh;;
1270                 esac
1271                 shift
1272                 ;;
1273         -U)
1274                 shift
1275                 case "$1" in
1276                 *=) echo "$1" >> optdef.sh;;
1277                 *=*)
1278                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1279                         echo "$me: ignoring -U $1" >&2
1280                         ;;
1281                 *) echo "$1='undef'" >> optdef.sh;;
1282                 esac
1283                 shift
1284                 ;;
1285         -A)
1286             shift
1287             xxx=''
1288             yyy="$1"
1289             zzz=''
1290             uuu=undef
1291             case "$yyy" in
1292             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1293                  case "$zzz" in
1294                  *:*) zzz='' ;;
1295                  *)   xxx=append
1296                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1297                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1298                  esac
1299                  ;;
1300             esac
1301             case "$xxx" in
1302             '')  case "$yyy" in
1303                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1304                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1305                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1306                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1307                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1308                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1309                  esac
1310                  ;;       
1311             esac
1312             case "$xxx" in
1313             append)
1314                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1315             clear)
1316                 echo "$yyy=''"                  >> posthint.sh ;;
1317             define)
1318                 case "$zzz" in
1319                 '') zzz=define ;;
1320                 esac
1321                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1322             eval)
1323                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1324             prepend)
1325                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1326             undef)
1327                 case "$zzz" in
1328                 '') zzz="$uuu" ;;
1329                 esac
1330                 echo "$yyy=$zzz"                >> posthint.sh ;;
1331             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1332             esac
1333             shift
1334             ;;
1335         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1336             exit 0;;
1337         --) break;;
1338         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1339         *) break;;
1340         esac
1341 done
1342
1343 case "$error" in
1344 true)
1345         cat >&2 <<EOM
1346 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1347                  [-U symbol] [-U symbol=] [-A command:symbol...]
1348   -d : use defaults for all answers.
1349   -e : go on without questioning past the production of config.sh.
1350   -f : specify an alternate default configuration file.
1351   -h : print this help message and exit (with an error status).
1352   -r : reuse C symbols value if possible (skips costly nm extraction).
1353   -s : silent mode, only echoes questions and essential information.
1354   -D : define symbol to have some value:
1355          -D symbol         symbol gets the value 'define'
1356          -D symbol=value   symbol gets the value 'value'
1357   -E : stop at the end of questions, after having produced config.sh.
1358   -K : do not use unless you know what you are doing.
1359   -O : let -D and -U override definitions from loaded configuration file.
1360   -S : perform variable substitutions on all .SH files (can mix with -f)
1361   -U : undefine symbol:
1362          -U symbol    symbol gets the value 'undef'
1363          -U symbol=   symbol gets completely empty
1364   -A : manipulate symbol after the platform specific hints have been applied:
1365          -A symbol=value                append " "value to symbol
1366          -A append:symbol=value         append value to symbol
1367          -A define:symbol=value         define symbol to have value
1368          -A clear:symbol                define symbol to be ''
1369          -A define:symbol               define symbol to be 'define'
1370          -A eval:symbol=value           define symbol to be eval of value
1371          -A prepend:symbol=value        prepend value to symbol
1372          -A undef:symbol                define symbol to be 'undef'
1373          -A undef:symbol=               define symbol to be ''
1374   -V : print version number and exit (with a zero status).
1375 EOM
1376         exit 1
1377         ;;
1378 esac
1379
1380 : Sanity checks
1381 case "$fastread$alldone" in
1382 yescont|yesexit) ;;
1383 *)
1384         case "$extractsh" in
1385         true) ;;
1386         *)
1387                 if test ! -t 0; then
1388                         echo "Say 'sh Configure', not 'sh <Configure'"
1389                         exit 1
1390                 fi
1391                 ;;
1392         esac
1393         ;;
1394 esac
1395
1396 exec 4>&1
1397 case "$silent" in
1398 true) exec 1>/dev/null;;
1399 esac
1400
1401 : run the defines and the undefines, if any, but leave the file out there...
1402 touch optdef.sh
1403 . ./optdef.sh
1404 : create the posthint manipulation script and leave the file out there...
1405 touch posthint.sh
1406
1407 : set package name
1408 package=perl5
1409 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1410 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1411 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1412 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1413 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1414 esac
1415
1416 : Some greps do not return status, grrr.
1417 echo "grimblepritz" >grimble
1418 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1419         contains=contains
1420 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1421         contains=grep
1422 else
1423         contains=contains
1424 fi
1425 rm -f grimble
1426 : the following should work in any shell
1427 case "$contains" in
1428 contains*)
1429         echo " "
1430         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1431         cat >contains <<'EOSS'
1432 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1433 EOSS
1434 chmod +x contains
1435 esac
1436
1437 : Find the path to the source tree
1438 case "$src" in
1439 '') case "$0" in
1440     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1441          case "$src" in
1442          /*)    ;;
1443          *)     src=`cd ../$src && pwd` ;;
1444          esac
1445          ;;
1446     *)   src='.';;
1447     esac;;
1448 esac
1449 case "$src" in
1450 '')     src=/
1451         rsrc=/
1452         ;;
1453 /*) rsrc="$src";;
1454 *) rsrc="../$src";;
1455 esac
1456 if test -f $rsrc/Configure && \
1457         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1458 then
1459    : found it, so we are ok.
1460 else
1461         rsrc=''
1462         for src in . .. ../.. ../../.. ../../../..; do
1463                 if test -f ../$src/Configure && \
1464                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1465                 then
1466                         rsrc=../$src
1467                         break
1468                 fi
1469         done
1470 fi
1471 case "$rsrc" in
1472 '')
1473         cat <<EOM >&4
1474
1475 Sorry, I can't seem to locate the source dir for $package.  Please start
1476 Configure with an explicit path -- i.e. /some/path/Configure.
1477
1478 EOM
1479         exit 1
1480         ;;
1481 ../.)   rsrc='..';;
1482 *)
1483         echo " "
1484         echo "Sources for $package found in \"$src\"." >&4
1485         ;;
1486 esac
1487
1488 : script used to extract .SH files with variable substitutions
1489 cat >extract <<'EOS'
1490 CONFIGDOTSH=true
1491 echo "Doing variable substitutions on .SH files..."
1492 if test -f $src/MANIFEST; then
1493         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1494 else
1495         echo "(Looking for .SH files under the source directory.)"
1496         set x `(cd $src; find . -name "*.SH" -print)`
1497 fi
1498 shift
1499 case $# in
1500 0) set x `(cd $src; echo *.SH)`; shift;;
1501 esac
1502 if test ! -f $src/$1; then
1503         shift
1504 fi
1505 mkdir_p='
1506 name=$1;
1507 create="";
1508 while test $name; do
1509         if test ! -d "$name"; then
1510                 create="$name $create";
1511                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1512                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1513         else
1514                 name="";
1515         fi;
1516 done;
1517 for file in $create; do
1518         mkdir $file;
1519 done
1520 '
1521 for file in $*; do
1522         case "$src" in
1523         ".")
1524                 case "$file" in
1525                 */*)
1526                         dir=`expr X$file : 'X\(.*\)/'`
1527                         file=`expr X$file : 'X.*/\(.*\)'`
1528                         (cd $dir && . ./$file)
1529                         ;;
1530                 *)
1531                         . ./$file
1532                         ;;
1533                 esac
1534                 ;;
1535         *)
1536                 case "$file" in
1537                 */*)
1538                         dir=`expr X$file : 'X\(.*\)/'`
1539                         file=`expr X$file : 'X.*/\(.*\)'`
1540                         (set x $dir; shift; eval $mkdir_p)
1541                         sh <$src/$dir/$file
1542                         ;;
1543                 *)
1544                         sh <$src/$file
1545                         ;;
1546                 esac
1547                 ;;
1548         esac
1549 done
1550 if test -f $src/config_h.SH; then
1551         if test ! -f config.h; then
1552         : oops, they left it out of MANIFEST, probably, so do it anyway.
1553         . $src/config_h.SH
1554         fi
1555 fi
1556 EOS
1557
1558 : extract files and exit if asked to do so
1559 case "$extractsh" in
1560 true)
1561         case "$realsilent" in
1562         true) ;;
1563         *) exec 1>&4;;
1564         esac
1565         case "$config_sh" in
1566         '') config_sh='config.sh';;
1567         esac
1568         echo " "
1569         echo "Fetching answers from $config_sh..."
1570         cd ..
1571         . $config_sh
1572         test "$override" && . ./optdef.sh
1573         echo " "
1574         . UU/extract
1575         rm -rf UU
1576         echo "Done."
1577         exit 0
1578         ;;
1579 esac
1580
1581 : Eunice requires " " instead of "", can you believe it
1582 echo " "
1583 : Here we go...
1584 echo "Beginning of configuration questions for $package."
1585
1586 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1587
1588 : first determine how to suppress newline on echo command
1589 echo " "
1590 echo "Checking echo to see how to suppress newlines..."
1591 (echo "hi there\c" ; echo " ") >.echotmp
1592 if $contains c .echotmp >/dev/null 2>&1 ; then
1593         echo "...using -n."
1594         n='-n'
1595         c=''
1596 else
1597         cat <<'EOM'
1598 ...using \c
1599 EOM
1600         n=''
1601         c='\c'
1602 fi
1603 echo $n "The star should be here-->$c"
1604 echo '*'
1605 rm -f .echotmp
1606
1607 : Now test for existence of everything in MANIFEST
1608 echo " "
1609 if test -f $rsrc/MANIFEST; then
1610         echo "First let's make sure your kit is complete.  Checking..." >&4
1611         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1612         rm -f missing
1613         tmppwd=`pwd`
1614         for filelist in x??; do
1615                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1616         done
1617         if test -s missing; then
1618                 cat missing >&4
1619                 cat >&4 <<'EOM'
1620
1621 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1622
1623 You have the option of continuing the configuration process, despite the
1624 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1625 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1626 and contact the author (perlbug@perl.org).
1627
1628 EOM
1629                 echo $n "Continue? [n] $c" >&4
1630                 read ans
1631                 case "$ans" in
1632                 y*)
1633                         echo "Continuing..." >&4
1634                         rm -f missing
1635                         ;;
1636                 *)
1637                         echo "ABORTING..." >&4
1638                         kill $$
1639                         ;;
1640                 esac
1641         else
1642                 echo "Looks good..."
1643         fi
1644 else
1645         echo "There is no MANIFEST file.  I hope your kit is complete !"
1646 fi
1647 rm -f missing x??
1648
1649 echo " "
1650 : Find the appropriate value for a newline for tr
1651 if test -n "$DJGPP"; then
1652        trnl='\012'
1653 fi
1654 if test X"$trnl" = X; then
1655         case "`echo foo|tr '\n' x 2>/dev/null`" in
1656         foox) trnl='\n' ;;
1657         esac
1658 fi
1659 if test X"$trnl" = X; then
1660         case "`echo foo|tr '\012' x 2>/dev/null`" in
1661         foox) trnl='\012' ;;
1662         esac
1663 fi
1664 if test X"$trnl" = X; then
1665         cat <<EOM >&2
1666
1667 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1668
1669 EOM
1670         exit 1
1671 fi
1672
1673 : compute the number of columns on the terminal for proper question formatting
1674 case "$COLUMNS" in
1675 '') COLUMNS='80';;
1676 esac
1677
1678 : set up the echo used in my read
1679 myecho="case \"\$xxxm\" in
1680 '') echo $n \"\$rp $c\" >&4;;
1681 *) case \"\$rp\" in
1682         '') echo $n \"[\$xxxm] $c\";;
1683         *)
1684                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1685                         echo \"\$rp\" >&4
1686                         echo $n \"[\$xxxm] $c\" >&4
1687                 else
1688                         echo $n \"\$rp [\$xxxm] $c\" >&4
1689                 fi
1690                 ;;
1691         esac;;
1692 esac"
1693
1694 : now set up to do reads with possible shell escape and default assignment
1695 cat <<EOSC >myread
1696 $startsh
1697 xxxm=\$dflt
1698 $myecho
1699 ans='!'
1700 case "\$fastread" in
1701 yes) case "\$dflt" in
1702         '') ;;
1703         *) ans='';
1704                 case "\$silent-\$rp" in
1705                 true-) ;;
1706                 *) echo " " >&4;;
1707                 esac;;
1708         esac;;
1709 *) case "\$silent" in
1710         true) case "\$rp" in
1711                 '') ans='';;
1712                 esac;;
1713         esac;;
1714 esac
1715 while expr "X\$ans" : "X!" >/dev/null; do
1716         read answ
1717         set x \$xxxm
1718         shift
1719         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1720         case  "\$answ" in
1721         "!")
1722                 sh 1>&4
1723                 echo " "
1724                 $myecho
1725                 ;;
1726         !*)
1727                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1728                 shift
1729                 sh 1>&4 -c "\$*"
1730                 echo " "
1731                 $myecho
1732                 ;;
1733         "\$ans")
1734                 case "\$ans" in
1735                 \\&*)
1736                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1737                         shift
1738                         case "\$1" in
1739                         -d)
1740                                 fastread=yes
1741                                 echo "(OK, I'll run with -d after this question.)" >&4
1742                                 ;;
1743                         -*)
1744                                 echo "*** Sorry, \$1 not supported yet." >&4
1745                                 ;;
1746                         esac
1747                         $myecho
1748                         ans=!
1749                         ;;
1750                 esac;;
1751         *)
1752                 case "\$aok" in
1753                 y)
1754                         echo "*** Substitution done -- please confirm."
1755                         xxxm="\$ans"
1756                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1757                         xxxm="\$ans"
1758                         ans=!
1759                         ;;
1760                 *)
1761                         echo "*** Error -- try again."
1762                         ans=!
1763                         ;;
1764                 esac
1765                 $myecho
1766                 ;;
1767         esac
1768         case "\$ans\$xxxm\$nostick" in
1769         '')
1770                 ans=!
1771                 $myecho
1772                 ;;
1773         esac
1774 done
1775 case "\$ans" in
1776 '') ans="\$xxxm";;
1777 esac
1778 EOSC
1779
1780 : create .config dir to save info across Configure sessions
1781 test -d ../.config || mkdir ../.config
1782 cat >../.config/README <<EOF
1783 This directory created by Configure to save information that should
1784 persist across sessions for $package.
1785
1786 You may safely delete it if you wish.
1787 EOF
1788
1789 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1790 case "$usedevel" in
1791 $define|true|[yY]*) ;;
1792 *) case "$xversion" in
1793    *[13579])
1794         cat >&4 <<EOH
1795 *** WHOA THERE!!! ***
1796
1797     This is an UNSTABLE DEVELOPMENT release.
1798     The version of this $package distribution is $xversion, that is, odd,
1799     (as opposed to even) and that signifies a development release.
1800     If you want a maintenance release, you want an even-numbered version.
1801
1802     Do ***NOT*** install this into production use.
1803     Data corruption and crashes are possible.
1804
1805     It is most seriously suggested that you do not continue any further
1806     unless you want to help in developing and debugging Perl.
1807
1808 EOH
1809         rp='Do you really want to continue?'
1810         dflt='n'
1811         . ./myread
1812         case "$ans" in
1813         [yY]) echo >&4 "Okay, continuing." ;;
1814         *) echo >&4 "Okay, bye."
1815            exit 1
1816            ;;
1817         esac
1818         ;;
1819     esac
1820     ;;
1821 esac
1822
1823 : general instructions
1824 needman=true
1825 firsttime=true
1826 user=`(logname) 2>/dev/null`
1827 case "$user" in
1828 '') user=`whoami 2>&1`;;
1829 esac
1830 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1831         firsttime=false
1832         echo " "
1833         rp='Would you like to see the instructions?'
1834         dflt=n
1835         . ./myread
1836         case "$ans" in
1837         [yY]*) ;;
1838         *) needman=false;;
1839         esac
1840 fi
1841 if $needman; then
1842         cat <<EOH
1843
1844 This installation shell script will examine your system and ask you questions
1845 to determine how the perl5 package should be installed. If you get
1846 stuck on a question, you may use a ! shell escape to start a subshell or
1847 execute a command.  Many of the questions will have default answers in square
1848 brackets; typing carriage return will give you the default.
1849
1850 On some of the questions which ask for file or directory names you are allowed
1851 to use the ~name construct to specify the login directory belonging to "name",
1852 even if you don't have a shell which knows about that.  Questions where this is
1853 allowed will be marked "(~name ok)".
1854
1855 EOH
1856         rp=''
1857         dflt='Type carriage return to continue'
1858         . ./myread
1859         cat <<'EOH'
1860
1861 The prompter used in this script allows you to use shell variables and
1862 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1863 in the default answer, as if the default line was a set of arguments given to a
1864 script shell.  This means you may also use $* to repeat the whole default line,
1865 so you do not have to re-type everything to add something to the default.
1866
1867 Everytime there is a substitution, you will have to confirm.  If there is an
1868 error (e.g. an unmatched backtick), the default answer will remain unchanged
1869 and you will be prompted again.
1870
1871 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1872 the questions and use the computed defaults (or the previous answers if there
1873 was already a config.sh file). Type 'Configure -h' for a list of options.
1874 You may also start interactively and then answer '& -d' at any prompt to turn
1875 on the non-interactive behaviour for the remainder of the execution.
1876
1877 EOH
1878         . ./myread
1879         cat <<EOH
1880
1881 Much effort has been expended to ensure that this shell script will run on any
1882 Unix system.  If despite that it blows up on yours, your best bet is to edit
1883 Configure and run it again.  If you can't run Configure for some reason,
1884 you'll have to generate a config.sh file by hand.  Whatever problems you
1885 have, let me (perlbug@perl.org) know how I blew it.
1886
1887 This installation script affects things in two ways:
1888
1889 1) it may do direct variable substitutions on some of the files included
1890    in this kit.
1891 2) it builds a config.h file for inclusion in C programs.  You may edit
1892    any of these files as the need arises after running this script.
1893
1894 If you make a mistake on a question, there is no easy way to back up to it
1895 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1896 files.  Configure will offer to let you do this before it runs the SH files.
1897
1898 EOH
1899         dflt='Type carriage return to continue'
1900         . ./myread
1901         case "$firsttime" in
1902         true) echo $user >>../.config/instruct;;
1903         esac
1904 fi
1905
1906 : find out where common programs are
1907 echo " "
1908 echo "Locating common programs..." >&4
1909 cat <<EOSC >loc
1910 $startsh
1911 case \$# in
1912 0) exit 1;;
1913 esac
1914 thing=\$1
1915 shift
1916 dflt=\$1
1917 shift
1918 for dir in \$*; do
1919         case "\$thing" in
1920         .)
1921         if test -d \$dir/\$thing; then
1922                 echo \$dir
1923                 exit 0
1924         fi
1925         ;;
1926         *)
1927         for thisthing in \$dir/\$thing; do
1928                 : just loop through to pick last item
1929         done
1930         if test -f \$thisthing; then
1931                 echo \$thisthing
1932                 exit 0
1933         elif test -f \$dir/\$thing.exe; then
1934                 if test -n "$DJGPP"; then
1935                         echo \$dir/\$thing.exe
1936                 else
1937                         : on Eunice apparently
1938                         echo \$dir/\$thing
1939                 fi
1940                 exit 0
1941         fi
1942         ;;
1943         esac
1944 done
1945 echo \$dflt
1946 exit 1
1947 EOSC
1948 chmod +x loc
1949 $eunicefix loc
1950 loclist="
1951 awk
1952 cat
1953 comm
1954 cp
1955 echo
1956 expr
1957 grep
1958 ls
1959 make
1960 mkdir
1961 rm
1962 sed
1963 sort
1964 touch
1965 tr
1966 uniq
1967 "
1968 trylist="
1969 Mcc
1970 ar
1971 byacc
1972 cpp
1973 csh
1974 date
1975 egrep
1976 gzip
1977 less
1978 ln
1979 more
1980 nm
1981 nroff
1982 pg
1983 test
1984 uname
1985 zip
1986 "
1987 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1988 pth="$pth /lib /usr/lib"
1989 for file in $loclist; do
1990         eval xxx=\$$file
1991         case "$xxx" in
1992         /*|?:[\\/]*)
1993                 if test -f "$xxx"; then
1994                         : ok
1995                 else
1996                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1997                         xxx=`./loc $file $file $pth`
1998                 fi
1999                 ;;
2000         '') xxx=`./loc $file $file $pth`;;
2001         *) xxx=`./loc $xxx $xxx $pth`;;
2002         esac
2003         eval $file=$xxx
2004         eval _$file=$xxx
2005         case "$xxx" in
2006         /*)
2007                 echo $file is in $xxx.
2008                 ;;
2009         ?:[\\/]*)
2010                 echo $file is in $xxx.
2011                 ;;
2012         *)
2013                 echo "I don't know where '$file' is, and my life depends on it." >&4
2014                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2015                 exit 1
2016                 ;;
2017         esac
2018 done
2019 echo " "
2020 echo "Don't worry if any of the following aren't found..."
2021 say=offhand
2022 for file in $trylist; do
2023         eval xxx=\$$file
2024         case "$xxx" in
2025         /*|?:[\\/]*)
2026                 if test -f "$xxx"; then
2027                         : ok
2028                 else
2029                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2030                         xxx=`./loc $file $file $pth`
2031                 fi
2032                 ;;
2033         '') xxx=`./loc $file $file $pth`;;
2034         *) xxx=`./loc $xxx $xxx $pth`;;
2035         esac
2036         eval $file=$xxx
2037         eval _$file=$xxx
2038         case "$xxx" in
2039         /*)
2040                 echo $file is in $xxx.
2041                 ;;
2042         ?:[\\/]*)
2043                 echo $file is in $xxx.
2044                 ;;
2045         *)
2046                 echo "I don't see $file out there, $say."
2047                 say=either
2048                 ;;
2049         esac
2050 done
2051 case "$egrep" in
2052 egrep)
2053         echo "Substituting grep for egrep."
2054         egrep=$grep
2055         ;;
2056 esac
2057 case "$ln" in
2058 ln)
2059         echo "Substituting cp for ln."
2060         ln=$cp
2061         ;;
2062 esac
2063 case "$test" in
2064 test)
2065         echo "Hopefully test is built into your sh."
2066         ;;
2067 *)
2068         if `$sh_c "PATH= test true" >/dev/null 2>&1`; then
2069                 echo "Using the test built into your sh."
2070                 echo "Using the test built into your sh."
2071                 test=test
2072                 _test=test
2073         fi
2074         ;;
2075 esac
2076 case "$echo" in
2077 echo)
2078         echo "Hopefully echo is built into your sh."
2079         ;;
2080 '') ;;
2081 *)
2082         echo " "
2083 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2084         $echo $n "hi there$c" >foo1
2085         echo $n "hi there$c" >foo2
2086         if cmp foo1 foo2 >/dev/null 2>&1; then
2087                 echo "They are compatible.  In fact, they may be identical."
2088         else
2089                 case "$n" in
2090                 '-n') n='' c='\c';;
2091                 *) n='-n' c='';;
2092                 esac
2093                 cat <<FOO
2094 They are not compatible!  You are probably running ksh on a non-USG system.
2095 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2096 have echo built in and we may have to run some Bourne shell scripts.  That
2097 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2098
2099 FOO
2100                 $echo $n "The star should be here-->$c"
2101                 $echo "*"
2102         fi
2103         $rm -f foo1 foo2
2104         ;;
2105 esac
2106
2107 cat <<EOS >checkcc
2108 $startsh
2109 EOS
2110 cat <<'EOSC' >>checkcc
2111 case "$cc" in
2112 '') ;;
2113 *)  $rm -f try try.*
2114     $cat >try.c <<EOM
2115 int main(int argc, char *argv[]) {
2116   return 0;
2117 }
2118 EOM
2119     if $cc -o try $ccflags try.c; then
2120        :
2121     else
2122         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2123         despair=yes
2124         trygcc=yes
2125         case "$cc" in
2126         *gcc*) trygcc=no ;;
2127         esac
2128         case "`$cc -v -c try.c 2>&1`" in
2129         *gcc*) trygcc=no ;;
2130         esac
2131         if $test X"$trygcc" = Xyes; then
2132             if gcc -o try -c try.c; then
2133                 echo " "
2134                 echo "You seem to have a working gcc, though." >&4
2135                 rp="Would you like to use it?"
2136                 dflt=y
2137                 if $test -f myread; then
2138                     . ./myread
2139                 else
2140                     if $test -f UU/myread; then
2141                         . ./UU/myread
2142                     else
2143                         echo "Cannot find myread, sorry.  Aborting." >&2
2144                         exit 1
2145                     fi
2146                 fi  
2147                 case "$ans" in
2148                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2149                 esac
2150             fi
2151         fi
2152         if $test X"$despair" = Xyes; then
2153             $cat >&4 <<EOM
2154 You need to find a working C compiler.
2155 Either (purchase and) install the C compiler supplied by your OS vendor,
2156 or for a free C compiler try http://gcc.gnu.org/
2157 I cannot continue any further, aborting.
2158 EOM
2159             exit 1
2160         fi
2161     fi
2162     $rm -f try try.*
2163     ;;
2164 esac
2165 EOSC
2166
2167 : determine whether symbolic links are supported
2168 echo " "
2169 $touch blurfl
2170 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2171         echo "Symbolic links are supported." >&4
2172         lns="$ln -s"
2173 else
2174         echo "Symbolic links are NOT supported." >&4
2175         lns="$ln"
2176 fi
2177 $rm -f blurfl sym
2178
2179 : determine whether symbolic links are supported
2180 echo " "
2181 case "$lns" in
2182 *"ln -s")
2183         echo "Checking how to test for symbolic links..." >&4
2184         $lns blurfl sym
2185         if $test "X$issymlink" = X; then
2186                 $sh_c "PATH= test -h sym" >/dev/null 2>&1
2187                 if test $? = 0; then
2188                         issymlink="test -h"
2189                 fi              
2190         fi
2191         if $test "X$issymlink" = X; then
2192                 $sh_c "$test -h sym" >/dev/null 2>&1
2193                 if test $? = 0; then
2194                         issymlink="$test -h"
2195                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2196                 fi              
2197         fi
2198         if $test "X$issymlink" = X; then
2199                 if $test -L sym 2>/dev/null; then
2200                         issymlink="$test -L"
2201                 fi
2202         fi
2203         if $test "X$issymlink" != X; then
2204                 echo "You can test for symbolic links with '$issymlink'." >&4
2205         else
2206                 echo "I do not know how you can test for symbolic links." >&4
2207         fi
2208         $rm -f blurfl sym
2209         ;;
2210 *)      echo "No symbolic links, so not testing for their testing..." >&4
2211         ;;
2212 esac
2213 echo " "
2214
2215
2216 case "$mksymlinks" in
2217 $define|true|[yY]*)
2218         case "$src" in
2219         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2220                 exit 1
2221                 ;;
2222         *)      case "$lns:$issymlink" in
2223                 *"ln -s:-"?)
2224                         echo "Creating the symbolic links..." >&4
2225                         echo "(First creating the subdirectories...)" >&4
2226                         cd ..
2227                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2228                                 read directory
2229                                 test -z "$directory" && break
2230                                 mkdir -p $directory
2231                         done
2232                         # Sanity check 1.
2233                         if test ! -d t/base; then
2234                                 echo "Failed to create the subdirectories.  Aborting." >&4
2235                                 exit 1
2236                         fi
2237                         echo "(Then creating the symlinks...)" >&4
2238                         awk '{print $1}' $src/MANIFEST | while true; do
2239                                 read filename
2240                                 test -z "$filename" && break
2241                                 if test -f $filename; then
2242                                         if $issymlink $filename; then
2243                                                 rm -f $filename
2244                                         fi
2245                                 fi
2246                                 if test -f $filename; then
2247                                         echo "$filename already exists, not symlinking."
2248                                 else
2249                                         ln -s $src/$filename $filename
2250                                 fi
2251                         done
2252                         # Sanity check 2.
2253                         if test ! -f t/base/commonsense.t; then
2254                                 echo "Failed to create the symlinks.  Aborting." >&4
2255                                 exit 1
2256                         fi
2257                         cd UU
2258                         ;;
2259                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2260                         ;;
2261                 esac
2262                 ;;
2263         esac
2264         ;;
2265 esac
2266
2267 : see whether [:lower:] and [:upper:] are supported character classes
2268 echo " "
2269 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2270 ABYZ)
2271         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2272         up='[:upper:]'
2273         low='[:lower:]'
2274         ;;
2275 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2276         # (0xc9 and 0xd1), therefore that is a nice testing point.
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 | $tr I-J i-j 2>/dev/null`" in
2286             ij) up='A-Z'
2287                 low='a-z'
2288                 ;;
2289             esac
2290         fi
2291         if test "X$up" = X -o "X$low" = X; then
2292             case "`echo IJ | od -x 2>/dev/null`" in
2293             *C9D1*|*c9d1*)
2294                 echo "Hey, this might be EBCDIC." >&4
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                 if test "X$up" = X -o "X$low" = X; then
2303                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2304                     ij) up='A-IJ-RS-Z'
2305                         low='a-ij-rs-z'
2306                         ;;
2307                     esac
2308                 fi
2309                 ;;
2310             esac
2311         fi
2312 esac
2313 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2314 ij)
2315     echo "Using $up and $low to convert case." >&4
2316     ;;
2317 *)
2318     echo "I don't know how to translate letters from upper to lower case." >&4
2319     echo "Your tr is not acting any way I know of." >&4
2320     exit 1
2321     ;;
2322 esac
2323 : set up the translation script tr, must be called with ./tr of course
2324 cat >tr <<EOSC
2325 $startsh
2326 case "\$1\$2" in
2327 '[A-Z][a-z]') exec $tr '$up' '$low';;
2328 '[a-z][A-Z]') exec $tr '$low' '$up';;
2329 esac
2330 exec $tr "\$@"
2331 EOSC
2332 chmod +x tr
2333 $eunicefix tr
2334
2335 : Try to determine whether config.sh was made on this system
2336 case "$config_sh" in
2337 '')
2338 myuname=`$uname -a 2>/dev/null`
2339 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2340 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2341 # because the A-Z/a-z are not consecutive.
2342 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2343         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2344 newmyuname="$myuname"
2345 dflt=n
2346 case "$knowitall" in
2347 '')
2348         if test -f ../config.sh; then
2349                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2350                         eval "`grep myuname= ../config.sh`"
2351                 fi
2352                 if test "X$myuname" = "X$newmyuname"; then
2353                         dflt=y
2354                 fi
2355         fi
2356         ;;
2357 *) dflt=y;;
2358 esac
2359
2360 : Get old answers from old config file if Configure was run on the
2361 : same system, otherwise use the hints.
2362 hint=default
2363 cd ..
2364 if test -f config.sh; then
2365         echo " "
2366         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2367         . UU/myread
2368         case "$ans" in
2369         n*|N*) echo "OK, I'll ignore it."
2370                 mv config.sh config.sh.old
2371                 myuname="$newmyuname"
2372                 ;;
2373         *)  echo "Fetching default answers from your old config.sh file..." >&4
2374                 tmp_n="$n"
2375                 tmp_c="$c"
2376                 tmp_sh="$sh"
2377                 . ./config.sh
2378                 cp config.sh UU
2379                 n="$tmp_n"
2380                 c="$tmp_c"
2381                 : Older versions did not always set $sh.  Catch re-use of such
2382                 : an old config.sh.
2383                 case "$sh" in
2384                 '') sh="$tmp_sh" ;;
2385                 esac
2386                 hint=previous
2387                 ;;
2388         esac
2389 fi
2390 . ./UU/checkcc
2391 if test ! -f config.sh; then
2392         $cat <<EOM
2393
2394 First time through, eh?  I have some defaults handy for some systems
2395 that need some extra help getting the Configure answers right:
2396
2397 EOM
2398         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2399         dflt=''
2400         : Half the following guesses are probably wrong... If you have better
2401         : tests or hints, please send them to perlbug@perl.org
2402         : The metaconfig authors would also appreciate a copy...
2403         $test -f /irix && osname=irix
2404         $test -f /xenix && osname=sco_xenix
2405         $test -f /dynix && osname=dynix
2406         $test -f /dnix && osname=dnix
2407         $test -f /lynx.os && osname=lynxos
2408         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2409         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2410         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2411         $test -f /bin/mips && /bin/mips && osname=mips
2412         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2413                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2414         $test -d /usr/apollo/bin && osname=apollo
2415         $test -f /etc/saf/_sactab && osname=svr4
2416         $test -d /usr/include/minix && osname=minix
2417         if $test -d /MachTen -o -d /MachTen_Folder; then
2418                 osname=machten
2419                 if $test -x /sbin/version; then
2420                         osvers=`/sbin/version | $awk '{print $2}' |
2421                         $sed -e 's/[A-Za-z]$//'`
2422                 elif $test -x /usr/etc/version; then
2423                         osvers=`/usr/etc/version | $awk '{print $2}' |
2424                         $sed -e 's/[A-Za-z]$//'`
2425                 else
2426                         osvers="$2.$3"
2427                 fi
2428         fi
2429
2430         $test -f /sys/posix.dll &&
2431                 $test -f /usr/bin/what &&
2432                 set X `/usr/bin/what /sys/posix.dll` &&
2433                 $test "$3" = UWIN &&
2434                 osname=uwin &&
2435                 osvers="$5"
2436
2437         if $test -f $uname; then
2438                 set X $myuname
2439                 shift
2440
2441                 case "$5" in
2442                 fps*) osname=fps ;;
2443                 mips*)
2444                         case "$4" in
2445                         umips) osname=umips ;;
2446                         *) osname=mips ;;
2447                         esac;;
2448                 [23]100) osname=mips ;;
2449                 next*) osname=next ;;
2450                 i386*)
2451                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2452                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2453                                 osname='sco'
2454                                 osvers=$tmp
2455                         elif $test -f /etc/kconfig; then
2456                                 osname=isc
2457                                 if test "$lns" = "$ln -s"; then
2458                                         osvers=4
2459                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2460                                         osvers=3
2461                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2462                                         osvers=2
2463                                 fi
2464                         fi
2465                         tmp=''
2466                         ;;
2467                 pc*)
2468                         if test -n "$DJGPP"; then
2469                                 osname=dos
2470                                 osvers=djgpp
2471                         fi
2472                         ;;
2473                 esac
2474
2475                 case "$1" in
2476                 aix) osname=aix
2477                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2478                         case "$tmp" in
2479                         'not found') osvers="$4"."$3" ;;
2480                         '<3240'|'<>3240') osvers=3.2.0 ;;
2481                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2482                         '=3250'|'>3250') osvers=3.2.5 ;;
2483                         *) osvers=$tmp;;
2484                         esac
2485                         ;;
2486                 bsd386) osname=bsd386
2487                         osvers=`$uname -r`
2488                         ;;
2489                 cygwin*) osname=cygwin
2490                         osvers="$3"
2491                         ;;
2492                 *dc.osx) osname=dcosx
2493                         osvers="$3"
2494                         ;;
2495                 dnix) osname=dnix
2496                         osvers="$3"
2497                         ;;
2498                 domainos) osname=apollo
2499                         osvers="$3"
2500                         ;;
2501                 dgux) osname=dgux 
2502                         osvers="$3"
2503                         ;;
2504                 dynixptx*) osname=dynixptx
2505                         osvers=`echo "$4"|sed 's/^v//'`
2506                         ;;
2507                 freebsd) osname=freebsd 
2508                         osvers="$3" ;;
2509                 genix) osname=genix ;;
2510                 hp*) osname=hpux 
2511                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2512                         ;;
2513                 irix*) osname=irix
2514                         case "$3" in
2515                         4*) osvers=4 ;;
2516                         5*) osvers=5 ;;
2517                         *)      osvers="$3" ;;
2518                         esac
2519                         ;;
2520                 linux) osname=linux
2521                         case "$3" in
2522                         *)      osvers="$3" ;;
2523                         esac
2524                         ;;
2525                 MiNT) osname=mint
2526                         ;;
2527                 netbsd*) osname=netbsd
2528                         osvers="$3"
2529                         ;;
2530                 news-os) osvers="$3"
2531                         case "$3" in
2532                         4*) osname=newsos4 ;;
2533                         *) osname=newsos ;;
2534                         esac
2535                         ;;
2536                 next*) osname=next ;;
2537                 nonstop-ux) osname=nonstopux ;;
2538                 POSIX-BC | posix-bc ) osname=posix-bc
2539                         osvers="$3"
2540                         ;;
2541                 powerux | power_ux | powermax_os | powermaxos | \
2542                 powerunix | power_unix) osname=powerux
2543                         osvers="$3"
2544                         ;;
2545                 qnx) osname=qnx
2546                         osvers="$4"
2547                         ;;
2548                 solaris) osname=solaris
2549                         case "$3" in
2550                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2551                         *)      osvers="$3" ;;
2552                         esac
2553                         ;;
2554                 sunos) osname=sunos
2555                         case "$3" in
2556                         5*) osname=solaris
2557                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2558                         *)      osvers="$3" ;;
2559                         esac
2560                         ;;
2561                 titanos) osname=titanos
2562                         case "$3" in
2563                         1*) osvers=1 ;;
2564                         2*) osvers=2 ;;
2565                         3*) osvers=3 ;;
2566                         4*) osvers=4 ;;
2567                         *)      osvers="$3" ;;
2568                         esac
2569                         ;;
2570                 ultrix) osname=ultrix
2571                         osvers="$3"
2572                         ;;
2573                 osf1|mls+)      case "$5" in
2574                                 alpha)
2575                                         osname=dec_osf
2576                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2577                                         case "$osvers" in
2578                                         [1-9].[0-9]*) ;;
2579                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2580                                         esac
2581                                         ;;
2582                         hp*)    osname=hp_osf1  ;;
2583                         mips)   osname=mips_osf1 ;;
2584                         esac
2585                         ;;
2586                 unixware) osname=svr5
2587                         osvers="$4"
2588                         ;;
2589                 uts) osname=uts
2590                         osvers="$3"
2591                         ;;
2592                 $2) case "$osname" in
2593                         *isc*) ;;
2594                         *freebsd*) ;;
2595                         svr*)
2596                                 : svr4.x or possibly later
2597                                 case "svr$3" in 
2598                                 ${osname}*)
2599                                         osname=svr$3
2600                                         osvers=$4
2601                                         ;;
2602                                 esac
2603                                 case "$osname" in
2604                                 svr4.0)
2605                                         : Check for ESIX
2606                                         if test -f /stand/boot ; then
2607                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2608                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2609                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2610                                                         if test -n "$isesix"; then
2611                                                                 osname=esix4
2612                                                         fi
2613                                                 fi
2614                                         fi
2615                                         ;;
2616                                 esac
2617                                 ;;
2618                         *)      if test -f /etc/systemid; then
2619                                         osname=sco
2620                                         set `echo $3 | $sed 's/\./ /g'` $4
2621                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2622                                                 osvers=$1.$2.$3
2623                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2624                                                 osvers=$1.$2
2625                                         elif $test -f $src/hints/sco_$1.sh; then
2626                                                 osvers=$1
2627                                         fi
2628                                 else
2629                                         case "$osname" in
2630                                         '') : Still unknown.  Probably a generic Sys V.
2631                                                 osname="sysv"
2632                                                 osvers="$3"
2633                                                 ;;
2634                                         esac
2635                                 fi
2636                                 ;;
2637                         esac
2638                         ;;
2639                 *)      case "$osname" in
2640                         '') : Still unknown.  Probably a generic BSD.
2641                                 osname="$1"
2642                                 osvers="$3"
2643                                 ;;
2644                         esac
2645                         ;;
2646                 esac
2647         else
2648                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2649                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2650                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2651                                 osname=news_os
2652                         fi
2653                         $rm -f UU/kernel.what
2654                 elif test -d c:/.; then
2655                         set X $myuname
2656                         osname=os2
2657                         osvers="$5"
2658                 fi
2659         fi
2660         
2661         : Now look for a hint file osname_osvers, unless one has been
2662         : specified already.
2663         case "$hintfile" in
2664         ''|' ')
2665                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2666                 : Also try without trailing minor version numbers.
2667                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2668                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2669                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2670                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2671                 case "$file" in
2672                 '') dflt=none ;;
2673                 *)  case "$osvers" in
2674                         '') dflt=$file
2675                                 ;;
2676                         *)  if $test -f $src/hints/$file.sh ; then
2677                                         dflt=$file
2678                                 elif $test -f $src/hints/$xfile.sh ; then
2679                                         dflt=$xfile
2680                                 elif $test -f $src/hints/$xxfile.sh ; then
2681                                         dflt=$xxfile
2682                                 elif $test -f $src/hints/$xxxfile.sh ; then
2683                                         dflt=$xxxfile
2684                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2685                                         dflt=$xxxxfile
2686                                 elif $test -f "$src/hints/${osname}.sh" ; then
2687                                         dflt="${osname}"
2688                                 else
2689                                         dflt=none
2690                                 fi
2691                                 ;;
2692                         esac
2693                         ;;
2694                 esac
2695                 if $test -f Policy.sh ; then
2696                         case "$dflt" in
2697                         *Policy*) ;;
2698                         none) dflt="Policy" ;;
2699                         *) dflt="Policy $dflt" ;;
2700                         esac
2701                 fi
2702                 ;;
2703         *)
2704                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2705                 ;;
2706         esac
2707
2708         if $test -f Policy.sh ; then
2709                 $cat <<EOM
2710
2711 There's also a Policy hint file available, which should make the
2712 site-specific (policy) questions easier to answer.
2713 EOM
2714
2715         fi
2716
2717         $cat <<EOM
2718
2719 You may give one or more space-separated answers, or "none" if appropriate.
2720 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2721 is a good thing.  DO NOT give a wrong version or a wrong OS.
2722
2723 EOM
2724
2725         rp="Which of these apply, if any?"
2726         . UU/myread
2727         tans=$ans
2728         for file in $tans; do
2729                 if $test X$file = XPolicy -a -f Policy.sh; then
2730                         . Policy.sh
2731                         $cat Policy.sh >> UU/config.sh
2732                 elif $test -f $src/hints/$file.sh; then
2733                         . $src/hints/$file.sh
2734                         $cat $src/hints/$file.sh >> UU/config.sh
2735                 elif $test X$tans = X -o X$tans = Xnone ; then
2736                         : nothing
2737                 else
2738                         : Give one chance to correct a possible typo.
2739                         echo "$file.sh does not exist"
2740                         dflt=$file
2741                         rp="hint to use instead?"
2742                         . UU/myread
2743                         for file in $ans; do
2744                                 if $test -f "$src/hints/$file.sh"; then
2745                                         . $src/hints/$file.sh
2746                                         $cat $src/hints/$file.sh >> UU/config.sh
2747                                 elif $test X$ans = X -o X$ans = Xnone ; then
2748                                         : nothing
2749                                 else
2750                                         echo "$file.sh does not exist -- ignored."
2751                                 fi
2752                         done
2753                 fi
2754         done
2755
2756         hint=recommended
2757         : Remember our hint file for later.
2758         if $test -f "$src/hints/$file.sh" ; then
2759                 hintfile="$file"
2760         else
2761                 hintfile=''
2762         fi
2763 fi
2764 cd UU
2765 ;;
2766 *)
2767         echo " "
2768         echo "Fetching default answers from $config_sh..." >&4
2769         tmp_n="$n"
2770         tmp_c="$c"
2771         cd ..
2772         cp $config_sh config.sh 2>/dev/null
2773         chmod +w config.sh
2774         . ./config.sh
2775         cd UU
2776         cp ../config.sh .
2777         n="$tmp_n"
2778         c="$tmp_c"
2779         hint=previous
2780         ;;
2781 esac
2782 test "$override" && . ./optdef.sh
2783
2784 : Restore computed paths
2785 for file in $loclist $trylist; do
2786         eval $file="\$_$file"
2787 done
2788
2789 cat << EOM
2790
2791 Configure uses the operating system name and version to set some defaults.
2792 The default value is probably right if the name rings a bell. Otherwise,
2793 since spelling matters for me, either accept the default or answer "none"
2794 to leave it blank.
2795
2796 EOM
2797 case "$osname" in
2798         ''|' ')
2799                 case "$hintfile" in
2800                 ''|' '|none) dflt=none ;;
2801                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2802                 esac
2803                 ;;
2804         *) dflt="$osname" ;;
2805 esac
2806 rp="Operating system name?"
2807 . ./myread
2808 case "$ans" in
2809 none)  osname='' ;;
2810 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2811 esac
2812 echo " "
2813 case "$osvers" in
2814         ''|' ')
2815                 case "$hintfile" in
2816                 ''|' '|none) dflt=none ;;
2817                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2818                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2819                         case "$dflt" in
2820                         ''|' ') dflt=none ;;
2821                         esac
2822                         ;;
2823                 esac
2824                 ;;
2825         *) dflt="$osvers" ;;
2826 esac
2827 rp="Operating system version?"
2828 . ./myread
2829 case "$ans" in
2830 none)  osvers='' ;;
2831 *) osvers="$ans" ;;
2832 esac
2833
2834
2835 . ./posthint.sh
2836
2837 : who configured the system
2838 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2839 cf_by=`(logname) 2>/dev/null`
2840 case "$cf_by" in
2841 "")
2842         cf_by=`(whoami) 2>/dev/null`
2843         case "$cf_by" in
2844         "") cf_by=unknown ;;
2845         esac ;;
2846 esac
2847
2848 : set up the script used to warn in case of inconsistency
2849 cat <<EOS >whoa
2850 $startsh
2851 EOS
2852 cat <<'EOSC' >>whoa
2853 dflt=y
2854 echo " "
2855 echo "*** WHOA THERE!!! ***" >&4
2856 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2857 rp="    Keep the $hint value?"
2858 . ./myread
2859 case "$ans" in
2860 y) td=$was; tu=$was;;
2861 esac
2862 EOSC
2863
2864 : function used to set $1 to $val
2865 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2866 case "$val$was" in
2867 $define$undef) . ./whoa; eval "$var=\$td";;
2868 $undef$define) . ./whoa; eval "$var=\$tu";;
2869 *) eval "$var=$val";;
2870 esac'
2871
2872 case "$usethreads" in
2873 $define|true|[yY]*)     dflt='y';;
2874 *) dflt='n';;
2875 esac
2876 cat <<EOM
2877
2878 Perl can be built to take advantage of threads on some systems.
2879 To do so, Configure can be run with -Dusethreads.
2880
2881 Note that threading is a highly experimental feature, and
2882 some known race conditions still remain.  If you choose to try
2883 it, be very sure to not actually deploy it for production
2884 purposes.  README.threads has more details, and is required
2885 reading if you enable threads.
2886
2887 If this doesn't make any sense to you, just accept the default '$dflt'.
2888 EOM
2889 rp='Build a threading Perl?'
2890 . ./myread
2891 case "$ans" in
2892 y|Y)    val="$define" ;;
2893 *)      val="$undef" ;;
2894 esac
2895 set usethreads
2896 eval $setvar
2897
2898 case "$usethreads" in
2899 $define)
2900         $cat <<EOM
2901
2902 As of 5.5.640, Perl has two different internal threading implementations,
2903 the 5.005 version (5005threads) and an interpreter-based version
2904 (ithreads) that has one interpreter per thread.  Both are very 
2905 experimental.  This arrangement exists to help developers work out
2906 which one is better.
2907
2908 If you're a casual user, you probably don't want interpreter-threads
2909 at this time.  There doesn't yet exist a way to create threads from
2910 within Perl in this model, i.e., "use Thread;" will NOT work.
2911 EOM
2912         : Default to ithreads unless overridden on command line or with
2913         : old config.sh
2914         dflt='y'
2915         case "$use5005threads" in
2916                 $define|true|[yY]*) dflt='n';;
2917         esac
2918         case "$useithreads" in
2919                 $undef|false|[nN]*) dflt='n';;
2920         esac
2921         rp='Use interpreter-based ithreads?'
2922         . ./myread
2923         case "$ans" in
2924         y|Y)    val="$define" ;;
2925         *)      val="$undef" ;;
2926         esac
2927         set useithreads
2928         eval $setvar
2929         : Now set use5005threads to the opposite value.
2930         case "$useithreads" in
2931         $define) val="$undef" ;;
2932         *) val="$define" ;;
2933         esac
2934         set use5005threads
2935         eval $setvar
2936         ;;
2937 *)
2938         useithreads="$undef"
2939         use5005threads="$undef"
2940         ;;
2941 esac
2942
2943 case "$d_oldpthreads" in
2944 '')     : Configure tests would be welcome here.  For now, assume undef.
2945         val="$undef" ;;
2946 *)      val="$d_oldpthreads" ;;
2947 esac
2948 set d_oldpthreads
2949 eval $setvar
2950
2951
2952 case "$usethreads" in
2953 "$define"|true|[yY]*)
2954 : Look for a hint-file generated 'call-back-unit'.  If the
2955 : user has specified that a threading perl is to be built,
2956 : we may need to set or change some other defaults.
2957         if $test -f usethreads.cbu; then
2958                 echo "Your platform has some specific hints for threaded builds, using them..."
2959                 . ./usethreads.cbu
2960         else
2961                 $cat <<EOM
2962 (Your platform doesn't have any specific hints for threaded builds.
2963  Assuming POSIX threads, then.)
2964 EOM
2965         fi
2966         ;;
2967 esac
2968
2969 cat <<EOM
2970
2971 Perl can be built so that multiple Perl interpreters can coexist
2972 within the same Perl executable.
2973 EOM
2974
2975 case "$useithreads" in
2976 $define)
2977         cat <<EOM
2978 This multiple interpreter support is required for interpreter-based threads.
2979 EOM
2980         val="$define"
2981         ;;
2982 *)      case "$usemultiplicity" in
2983         $define|true|[yY]*)     dflt='y';;
2984         *) dflt='n';;
2985         esac
2986         echo " "
2987         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2988         rp='Build Perl for multiplicity?'
2989         . ./myread
2990         case "$ans" in
2991         y|Y)    val="$define" ;;
2992         *)      val="$undef" ;;
2993         esac
2994         ;;
2995 esac
2996 set usemultiplicity
2997 eval $setvar
2998
2999 : make some quick guesses about what we are up against
3000 echo " "
3001 $echo $n "Hmm...  $c"
3002 echo exit 1 >bsd
3003 echo exit 1 >usg
3004 echo exit 1 >v7
3005 echo exit 1 >osf1
3006 echo exit 1 >eunice
3007 echo exit 1 >xenix
3008 echo exit 1 >venix
3009 echo exit 1 >os2
3010 d_bsd="$undef"
3011 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3012 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3013 then
3014         echo "Looks kind of like an OSF/1 system, but we'll see..."
3015         echo exit 0 >osf1
3016 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3017         xxx=`./loc addbib blurfl $pth`
3018         if $test -f $xxx; then
3019         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3020                 echo exit 0 >bsd
3021                 echo exit 0 >usg
3022         else
3023                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3024                         echo "Looks kind of like an extended USG system, but we'll see..."
3025                 else
3026                         echo "Looks kind of like a USG system, but we'll see..."
3027                 fi
3028                 echo exit 0 >usg
3029         fi
3030 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3031         echo "Looks kind of like a BSD system, but we'll see..."
3032         d_bsd="$define"
3033         echo exit 0 >bsd
3034 else
3035         echo "Looks kind of like a Version 7 system, but we'll see..."
3036         echo exit 0 >v7
3037 fi
3038 case "$eunicefix" in
3039 *unixtovms*)
3040         $cat <<'EOI'
3041 There is, however, a strange, musty smell in the air that reminds me of
3042 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3043 EOI
3044         echo exit 0 >eunice
3045         d_eunice="$define"
3046 : it so happens the Eunice I know will not run shell scripts in Unix format
3047         ;;
3048 *)
3049         echo " "
3050         echo "Congratulations.  You aren't running Eunice."
3051         d_eunice="$undef"
3052         ;;
3053 esac
3054 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3055 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3056 : semicolon as a patch separator
3057 case "$p_" in
3058 :) ;;
3059 *)
3060         $cat <<'EOI'
3061 I have the feeling something is not exactly right, however...don't tell me...
3062 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3063 (Or you may be running DOS with DJGPP.)
3064 EOI
3065         echo exit 0 >os2
3066         ;;
3067 esac
3068 if test -f /xenix; then
3069         echo "Actually, this looks more like a XENIX system..."
3070         echo exit 0 >xenix
3071         d_xenix="$define"
3072 else
3073         echo " "
3074         echo "It's not Xenix..."
3075         d_xenix="$undef"
3076 fi
3077 chmod +x xenix
3078 $eunicefix xenix
3079 if test -f /venix; then
3080         echo "Actually, this looks more like a VENIX system..."
3081         echo exit 0 >venix
3082 else
3083         echo " "
3084         if ./xenix; then
3085                 : null
3086         else
3087                 echo "Nor is it Venix..."
3088         fi
3089 fi
3090 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3091 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3092 $rm -f foo
3093
3094 case "$cc" in
3095 '') dflt=cc;;
3096 *) dflt="$cc";;
3097 esac
3098 rp="Use which C compiler?"
3099 . ./myread
3100 cc="$ans"
3101 : Look for a hint-file generated 'call-back-unit'.  Now that the
3102 : user has specified the compiler, we may need to set or change some
3103 : other defaults.
3104 if $test -f cc.cbu; then
3105     . ./cc.cbu
3106 fi
3107 . ./checkcc
3108
3109 echo " "
3110 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3111 $cat >gccvers.c <<EOM
3112 #include <stdio.h>
3113 int main() {
3114 #ifdef __GNUC__
3115 #ifdef __VERSION__
3116         printf("%s\n", __VERSION__);
3117 #else
3118         printf("%s\n", "1");
3119 #endif
3120 #endif
3121         exit(0);
3122 }
3123 EOM
3124 if $cc -o gccvers $ldflags gccvers.c; then
3125         gccversion=`./gccvers`
3126         case "$gccversion" in
3127         '') echo "You are not using GNU cc." ;;
3128         *)  echo "You are using GNU cc $gccversion."
3129             ccname=gcc  
3130             ;;
3131         esac
3132 else
3133         echo " "
3134         echo "*** WHOA THERE!!! ***" >&4
3135         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3136         case "$knowitall" in
3137         '')
3138         echo "    You'd better start hunting for one and let me know about it." >&4
3139                 exit 1
3140                 ;;
3141         esac
3142 fi
3143 $rm -f gccvers*
3144 case "$gccversion" in
3145 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3146 esac
3147 case "$gccversion" in
3148 '') gccosandvers='' ;;
3149 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3150    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3151    gccshortvers=''
3152    case "$gccosandvers" in
3153    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3154    $osname$osvers) ;; # looking good
3155    $osname*) cat <<EOM >&4
3156
3157 *** WHOA THERE!!! ***
3158
3159     Your gcc has not been compiled for the exact release of
3160     your operating system ($gccosandvers versus $osname$osvers).
3161
3162     In general it is a good idea to keep gcc synchronized with
3163     the operating system because otherwise serious problems
3164     may ensue when trying to compile software, like Perl.
3165
3166     I'm trying to be optimistic here, though, and will continue.
3167     If later during the configuration and build icky compilation
3168     problems appear (headerfile conflicts being the most common
3169     manifestation), I suggest reinstalling the gcc to match
3170     your operating system release.
3171
3172 EOM
3173       ;;
3174    *) gccosandvers='' ;; # failed to parse, better be silent
3175    esac
3176    ;;
3177 esac
3178 case "$ccname" in
3179 '') ccname="$cc" ;;
3180 esac
3181
3182 : see how we invoke the C preprocessor
3183 echo " "
3184 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3185 cat <<'EOT' >testcpp.c
3186 #define ABC abc
3187 #define XYZ xyz
3188 ABC.XYZ
3189 EOT
3190 cd ..
3191 if test ! -f cppstdin; then
3192         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3193                 # AIX cc -E doesn't show the absolute headerfile
3194                 # locations but we'll cheat by using the -M flag.
3195                 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
3196         else
3197                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3198         fi
3199 else
3200         echo "Keeping your $hint cppstdin wrapper."
3201 fi
3202 chmod 755 cppstdin
3203 wrapper=`pwd`/cppstdin
3204 ok='false'
3205 cd UU
3206
3207 if $test "X$cppstdin" != "X" && \
3208         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3209         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3210 then
3211         echo "You used to use $cppstdin $cppminus so we'll use that again."
3212         case "$cpprun" in
3213         '') echo "But let's see if we can live without a wrapper..." ;;
3214         *)
3215                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3216                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3217                 then
3218                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3219                         ok='true'
3220                 else
3221                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3222                 fi
3223                 ;;
3224         esac
3225 else
3226         case "$cppstdin" in
3227         '') ;;
3228         *)
3229                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3230                 ;;
3231         esac
3232 fi
3233
3234 if $ok; then
3235         : nothing
3236 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3237         $cc -E <testcpp.c >testcpp.out 2>&1; \
3238         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3239         echo "Yup, it does."
3240         x_cpp="$cc -E"
3241         x_minus='';
3242 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3243         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3244         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3245         echo "Yup, it does."
3246         x_cpp="$cc -E"
3247         x_minus='-';
3248 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3249         $cc -P <testcpp.c >testcpp.out 2>&1; \
3250         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3251         echo "Yipee, that works!"
3252         x_cpp="$cc -P"
3253         x_minus='';
3254 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3255         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3256         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3257         echo "At long last!"
3258         x_cpp="$cc -P"
3259         x_minus='-';
3260 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3261         $cpp <testcpp.c >testcpp.out 2>&1; \
3262         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3263         echo "It works!"
3264         x_cpp="$cpp"
3265         x_minus='';
3266 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3267         $cpp - <testcpp.c >testcpp.out 2>&1; \
3268         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3269         echo "Hooray, it works!  I was beginning to wonder."
3270         x_cpp="$cpp"
3271         x_minus='-';
3272 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3273         $wrapper <testcpp.c >testcpp.out 2>&1; \
3274         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3275         x_cpp="$wrapper"
3276         x_minus=''
3277         echo "Eureka!"
3278 else
3279         dflt=''
3280         rp="No dice.  I can't find a C preprocessor.  Name one:"
3281         . ./myread
3282         x_cpp="$ans"
3283         x_minus=''
3284         $x_cpp <testcpp.c >testcpp.out 2>&1
3285         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3286                 echo "OK, that will do." >&4
3287         else
3288 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3289                 exit 1
3290         fi
3291 fi
3292
3293 case "$ok" in
3294 false)
3295         cppstdin="$x_cpp"
3296         cppminus="$x_minus"
3297         cpprun="$x_cpp"
3298         cpplast="$x_minus"
3299         set X $x_cpp
3300         shift
3301         case "$1" in
3302         "$cpp")
3303                 echo "Perhaps can we force $cc -E using a wrapper..."
3304                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3305                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3306                 then
3307                         echo "Yup, we can."
3308                         cppstdin="$wrapper"
3309                         cppminus='';
3310                 else
3311                         echo "Nope, we'll have to live without it..."
3312                 fi
3313                 ;;
3314         esac
3315         case "$cpprun" in
3316         "$wrapper")
3317                 cpprun=''
3318                 cpplast=''
3319                 ;;
3320         esac
3321         ;;
3322 esac
3323
3324 case "$cppstdin" in
3325 "$wrapper"|'cppstdin') ;;
3326 *) $rm -f $wrapper;;
3327 esac
3328 $rm -f testcpp.c testcpp.out
3329
3330 : decide how portable to be.  Allow command line overrides.
3331 case "$d_portable" in
3332 "$undef") ;;
3333 *)      d_portable="$define" ;;
3334 esac
3335
3336 : set up shell script to do ~ expansion
3337 cat >filexp <<EOSS
3338 $startsh
3339 : expand filename
3340 case "\$1" in
3341  ~/*|~)
3342         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3343         ;;
3344  ~*)
3345         if $test -f /bin/csh; then
3346                 /bin/csh -f -c "glob \$1"
3347                 failed=\$?
3348                 echo ""
3349                 exit \$failed
3350         else
3351                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3352                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3353                 if $test ! -d "\$dir"; then
3354                         me=\`basename \$0\`
3355                         echo "\$me: can't locate home directory for: \$name" >&2
3356                         exit 1
3357                 fi
3358                 case "\$1" in
3359                 */*)
3360                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3361                         ;;
3362                 *)
3363                         echo \$dir
3364                         ;;
3365                 esac
3366         fi
3367         ;;
3368 *)
3369         echo \$1
3370         ;;
3371 esac
3372 EOSS
3373 chmod +x filexp
3374 $eunicefix filexp
3375
3376 : now set up to get a file name
3377 cat <<EOS >getfile
3378 $startsh
3379 EOS
3380 cat <<'EOSC' >>getfile
3381 tilde=''
3382 fullpath=''
3383 already=''
3384 skip=''
3385 none_ok=''
3386 exp_file=''
3387 nopath_ok=''
3388 orig_rp="$rp"
3389 orig_dflt="$dflt"
3390 case "$gfpth" in
3391 '') gfpth='.' ;;
3392 esac
3393
3394 case "$fn" in
3395 *\(*)
3396         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3397         fn=`echo $fn | sed 's/(.*)//'`
3398         ;;
3399 esac
3400
3401 case "$fn" in
3402 *:*)
3403         loc_file=`expr $fn : '.*:\(.*\)'`
3404         fn=`expr $fn : '\(.*\):.*'`
3405         ;;
3406 esac
3407
3408 case "$fn" in
3409 *~*) tilde=true;;
3410 esac
3411 case "$fn" in
3412 */*) fullpath=true;;
3413 esac
3414 case "$fn" in
3415 *+*) skip=true;;
3416 esac
3417 case "$fn" in
3418 *n*) none_ok=true;;
3419 esac
3420 case "$fn" in
3421 *e*) exp_file=true;;
3422 esac
3423 case "$fn" in
3424 *p*) nopath_ok=true;;
3425 esac
3426
3427 case "$fn" in
3428 *f*) type='File';;
3429 *d*) type='Directory';;
3430 *l*) type='Locate';;
3431 esac
3432
3433 what="$type"
3434 case "$what" in
3435 Locate) what='File';;
3436 esac
3437
3438 case "$exp_file" in
3439 '')
3440         case "$d_portable" in
3441         "$define") ;;
3442         *) exp_file=true;;
3443         esac
3444         ;;
3445 esac
3446
3447 cd ..
3448 while test "$type"; do
3449         redo=''
3450         rp="$orig_rp"
3451         dflt="$orig_dflt"
3452         case "$tilde" in
3453         true) rp="$rp (~name ok)";;
3454         esac
3455         . UU/myread
3456         if test -f UU/getfile.ok && \
3457                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3458         then
3459                 value="$ans"
3460                 ansexp="$ans"
3461                 break
3462         fi
3463         case "$ans" in
3464         none)
3465                 value=''
3466                 ansexp=''
3467                 case "$none_ok" in
3468                 true) type='';;
3469                 esac
3470                 ;;
3471         *)
3472                 case "$tilde" in
3473                 '') value="$ans"
3474                         ansexp="$ans";;
3475                 *)
3476                         value=`UU/filexp $ans`
3477                         case $? in
3478                         0)
3479                                 if test "$ans" != "$value"; then
3480                                         echo "(That expands to $value on this system.)"
3481                                 fi
3482                                 ;;
3483                         *) value="$ans";;
3484                         esac
3485                         ansexp="$value"
3486                         case "$exp_file" in
3487                         '') value="$ans";;
3488                         esac
3489                         ;;
3490                 esac
3491                 case "$fullpath" in
3492                 true)
3493                         case "$ansexp" in
3494                         /*) value="$ansexp" ;;
3495                         [a-zA-Z]:/*) value="$ansexp" ;;
3496                         *)
3497                                 redo=true
3498                                 case "$already" in
3499                                 true)
3500                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3501                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3502                                         ;;
3503                                 *)
3504                                 echo "Please give a full path name, starting with slash." >&4
3505                                         case "$tilde" in
3506                                         true)
3507                                 echo "Note that using ~name is ok provided it expands well." >&4
3508                                                 already=true
3509                                                 ;;
3510                                         esac
3511                                 esac
3512                                 ;;
3513                         esac
3514                         ;;
3515                 esac
3516                 case "$redo" in
3517                 '')
3518                         case "$type" in
3519                         File)
3520                                 for fp in $gfpth; do
3521                                         if test "X$fp" = X.; then
3522                                             pf="$ansexp"
3523                                         else    
3524                                             pf="$fp/$ansexp"
3525                                         fi
3526                                         if test -f "$pf"; then
3527                                                 type=''
3528                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3529                                         then
3530                                                 echo "($value is not a plain file, but that's ok.)"
3531                                                 type=''
3532                                         fi
3533                                         if test X"$type" = X; then
3534                                             value="$pf"
3535                                             break
3536                                         fi
3537                                 done
3538                                 ;;
3539                         Directory)
3540                                 for fp in $gfpth; do
3541                                         if test "X$fp" = X.; then
3542                                             dir="$ans"
3543                                             direxp="$ansexp"
3544                                         else    
3545                                             dir="$fp/$ansexp"
3546                                             direxp="$fp/$ansexp"
3547                                         fi
3548                                         if test -d "$direxp"; then
3549                                                 type=''
3550                                                 value="$dir"
3551                                                 break
3552                                         fi
3553                                 done
3554                                 ;;
3555                         Locate)
3556                                 if test -d "$ansexp"; then
3557                                         echo "(Looking for $loc_file in directory $value.)"
3558                                         value="$value/$loc_file"
3559                                         ansexp="$ansexp/$loc_file"
3560                                 fi
3561                                 if test -f "$ansexp"; then
3562                                         type=''
3563                                 fi
3564                                 case "$nopath_ok" in
3565                                 true)   case "$value" in
3566                                         */*) ;;
3567                                         *)      echo "Assuming $value will be in people's path."
3568                                                 type=''
3569                                                 ;;
3570                                         esac
3571                                         ;;
3572                                 esac
3573                                 ;;
3574                         esac
3575
3576                         case "$skip" in
3577                         true) type='';
3578                         esac
3579
3580                         case "$type" in
3581                         '') ;;
3582                         *)
3583                                 if test "$fastread" = yes; then
3584                                         dflt=y
3585                                 else
3586                                         dflt=n
3587                                 fi
3588                                 rp="$what $value doesn't exist.  Use that name anyway?"
3589                                 . UU/myread
3590                                 dflt=''
3591                                 case "$ans" in
3592                                 y*) type='';;
3593                                 *) echo " ";;
3594                                 esac
3595                                 ;;
3596                         esac
3597                         ;;
3598                 esac
3599                 ;;
3600         esac
3601 done
3602 cd UU
3603 ans="$value"
3604 rp="$orig_rp"
3605 dflt="$orig_dflt"
3606 rm -f getfile.ok
3607 test "X$gfpthkeep" != Xy && gfpth=""
3608 EOSC
3609
3610 : What should the include directory be ?
3611 echo " "
3612 $echo $n "Hmm...  $c"
3613 dflt='/usr/include'
3614 incpath=''
3615 mips_type=''
3616 if $test -f /bin/mips && /bin/mips; then
3617         echo "Looks like a MIPS system..."
3618         $cat >usr.c <<'EOCP'
3619 #ifdef SYSTYPE_BSD43
3620 /bsd43
3621 #endif
3622 EOCP
3623         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3624                 dflt='/bsd43/usr/include'
3625                 incpath='/bsd43'
3626                 mips_type='BSD 4.3'
3627         else
3628                 mips_type='System V'
3629         fi
3630         $rm -f usr.c usr.out
3631         echo "and you're compiling with the $mips_type compiler and libraries."
3632         xxx_prompt=y
3633         echo "exit 0" >mips
3634 else
3635         echo "Doesn't look like a MIPS system."
3636         xxx_prompt=n
3637         echo "exit 1" >mips
3638 fi
3639 chmod +x mips
3640 $eunicefix mips
3641 case "$usrinc" in
3642 '') ;;
3643 *) dflt="$usrinc";;
3644 esac
3645 case "$xxx_prompt" in
3646 y)      fn=d/
3647         echo " "
3648         rp='Where are the include files you want to use?'
3649         . ./getfile
3650         usrinc="$ans"
3651         ;;
3652 *)      usrinc="$dflt"
3653         ;;
3654 esac
3655
3656 : Set private lib path
3657 case "$plibpth" in
3658 '') if ./mips; then
3659                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3660         fi;;
3661 esac
3662 case "$libpth" in
3663 ' ') dlist='';;
3664 '') dlist="$loclibpth $plibpth $glibpth";;
3665 *) dlist="$libpth";;
3666 esac
3667
3668 : Now check and see which directories actually exist, avoiding duplicates
3669 libpth=''
3670 for xxx in $dlist
3671 do
3672     if $test -d $xxx; then
3673                 case " $libpth " in
3674                 *" $xxx "*) ;;
3675                 *) libpth="$libpth $xxx";;
3676                 esac
3677     fi
3678 done
3679 $cat <<'EOM'
3680
3681 Some systems have incompatible or broken versions of libraries.  Among
3682 the directories listed in the question below, please remove any you
3683 know not to be holding relevant libraries, and add any that are needed.
3684 Say "none" for none.
3685
3686 EOM
3687 case "$libpth" in
3688 '') dflt='none';;
3689 *)
3690         set X $libpth
3691         shift
3692         dflt=${1+"$@"}
3693         ;;
3694 esac
3695 rp="Directories to use for library searches?"
3696 . ./myread
3697 case "$ans" in
3698 none) libpth=' ';;
3699 *) libpth="$ans";;
3700 esac
3701
3702 : compute shared library extension
3703 case "$so" in
3704 '')
3705         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3706                 dflt='sl'
3707         else
3708                 dflt='so'
3709         fi
3710         ;;
3711 *) dflt="$so";;
3712 esac
3713 $cat <<EOM
3714
3715 On some systems, shared libraries may be available.  Answer 'none' if
3716 you want to suppress searching of shared libraries for the remainder
3717 of this configuration.
3718
3719 EOM
3720 rp='What is the file extension used for shared libraries?'
3721 . ./myread
3722 so="$ans"
3723
3724 : Define several unixisms.
3725 : Hints files or command line option can be used to override them.
3726 : The convoluted testing is in case hints files set either the old
3727 : or the new name.
3728 case "$_exe" in
3729 '')     case "$exe_ext" in
3730     '') ;;
3731         *)      _exe="$exe_ext" ;;
3732         esac
3733         ;;
3734 esac
3735 case "$_a" in
3736 '')     case "$lib_ext" in
3737     '') _a='.a';;
3738         *)      _a="$lib_ext" ;;
3739         esac
3740         ;;
3741 esac
3742 case "$_o" in
3743 '') case "$obj_ext" in
3744         '')     _o='.o';;
3745         *)      _o="$obj_ext";;
3746         esac
3747         ;;
3748 esac
3749 case "$p_" in
3750 '') case "$path_sep" in
3751         '')     p_=':';;
3752         *)      p_="$path_sep";;
3753         esac
3754         ;;
3755 esac
3756 exe_ext=$_exe
3757 lib_ext=$_a
3758 obj_ext=$_o
3759 path_sep=$p_
3760
3761 : Which makefile gets called first.  This is used by make depend.
3762 case "$firstmakefile" in
3763 '') firstmakefile='makefile';;
3764 esac
3765
3766 case "$usesocks" in
3767 $define|true|[yY]*)     dflt='y';;
3768 *) dflt='n';;
3769 esac
3770 cat <<EOM
3771
3772 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3773 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3774 to use the PerlIO abstraction layer, this will be implicitly selected.
3775
3776 If this doesn't make any sense to you, just accept the default '$dflt'.
3777 EOM
3778 rp='Build Perl for SOCKS?'
3779 . ./myread
3780 case "$ans" in
3781 y|Y)    val="$define" ;;     
3782 *)      val="$undef" ;;
3783 esac
3784 set usesocks
3785 eval $setvar
3786
3787 case "$usesocks" in
3788 $define|true|[yY]*) useperlio="$define";;
3789 esac
3790
3791 : Looking for optional libraries
3792 echo " "
3793 echo "Checking for optional libraries..." >&4
3794 case "$libs" in
3795 ' '|'') dflt='';;
3796 *) dflt="$libs";;
3797 esac
3798 case "$libswanted" in
3799 '') libswanted='c_s';;
3800 esac
3801 case "$usesocks" in
3802 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3803 esac
3804 libsfound=''
3805 libsfiles=''
3806 libsdirs=''
3807 libspath=''
3808 for thisdir in $libpth $xlibpth; do
3809   test -d $thisdir && libspath="$libspath $thisdir"
3810 done
3811 for thislib in $libswanted; do
3812         for thisdir in $libspath; do
3813             xxx=''
3814             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3815                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3816                 $test -f "$xxx" && eval $libscheck
3817                 $test -f "$xxx" && libstyle=shared
3818             fi
3819             if test ! -f "$xxx"; then
3820                 xxx=$thisdir/lib$thislib.$so
3821                 $test -f "$xxx" && eval $libscheck
3822                 $test -f "$xxx" && libstyle=shared
3823             fi  
3824             if test ! -f "$xxx"; then
3825                 xxx=$thisdir/lib$thislib$_a
3826                 $test -f "$xxx" && eval $libscheck
3827                 $test -f "$xxx" && libstyle=static
3828             fi
3829             if test ! -f "$xxx"; then
3830                 xxx=$thisdir/$thislib$_a
3831                 $test -f "$xxx" && eval $libscheck
3832                 $test -f "$xxx" && libstyle=static
3833             fi
3834             if test ! -f "$xxx"; then
3835                 xxx=$thisdir/lib${thislib}_s$_a
3836                 $test -f "$xxx" && eval $libscheck
3837                 $test -f "$xxx" && libstyle=static
3838                 $test -f "$xxx" && thislib=${thislib}_s
3839             fi
3840             if test ! -f "$xxx"; then
3841                 xxx=$thisdir/Slib$thislib$_a
3842                 $test -f "$xxx" && eval $libscheck
3843                 $test -f "$xxx" && libstyle=static
3844             fi
3845             if $test -f "$xxx"; then
3846                 case "$libstyle" in
3847                 shared) echo "Found -l$thislib (shared)." ;;
3848                 static) echo "Found -l$thislib." ;;
3849                 *)      echo "Found -l$thislib ($libstyle)." ;;
3850                 esac
3851                 case " $dflt " in
3852                 *"-l$thislib "*);;
3853                 *) dflt="$dflt -l$thislib"
3854                    libsfound="$libsfound $xxx"
3855                    yyy=`basename $xxx`
3856                    libsfiles="$libsfiles $yyy"
3857                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3858                    case " $libsdirs " in
3859                    *" $yyy "*) ;;
3860                    *) libsdirs="$libsdirs $yyy" ;;
3861                    esac
3862                    ;;
3863                 esac
3864                 break
3865             fi  
3866         done
3867         if $test ! -f "$xxx"; then
3868             echo "No -l$thislib."
3869         fi
3870 done
3871 set X $dflt
3872 shift
3873 dflt="$*"
3874 case "$libs" in
3875 '') dflt="$dflt";;
3876 *) dflt="$libs";;
3877 esac
3878 case "$dflt" in
3879 ' '|'') dflt='none';;
3880 esac
3881
3882 $cat <<EOM
3883
3884 In order to compile $package on your machine, a number of libraries
3885 are usually needed.  Include any other special libraries here as well.
3886 Say "none" for none.  The default list is almost always right.
3887 EOM
3888
3889 echo " "
3890 rp="What libraries to use?"
3891 . ./myread
3892 case "$ans" in
3893 none) libs=' ';;
3894 *) libs="$ans";;
3895 esac
3896
3897 : determine optimization, if desired, or use for debug flag also
3898 case "$optimize" in
3899 ' '|$undef) dflt='none';;
3900 '') dflt='-O';;
3901 *) dflt="$optimize";;
3902 esac
3903 $cat <<EOH
3904
3905 By default, $package compiles with the -O flag to use the optimizer.
3906 Alternately, you might want to use the symbolic debugger, which uses
3907 the -g flag (on traditional Unix systems).  Either flag can be
3908 specified here.  To use neither flag, specify the word "none".
3909
3910 EOH
3911 rp="What optimizer/debugger flag should be used?"
3912 . ./myread
3913 optimize="$ans"
3914 case "$optimize" in
3915 'none') optimize=" ";;
3916 esac
3917
3918 dflt=''
3919 : We will not override a previous value, but we might want to
3920 : augment a hint file
3921 case "$hint" in
3922 default|recommended)
3923         case "$gccversion" in
3924         1*) dflt='-fpcc-struct-return' ;;
3925         esac
3926         case "$optimize" in
3927         *-g*) dflt="$dflt -DDEBUGGING";;
3928         esac
3929         case "$gccversion" in
3930         2*) if test -d /etc/conf/kconfig.d &&
3931                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3932                 then
3933                         dflt="$dflt -posix"
3934                 fi
3935                 ;;
3936         esac
3937         case "$gccversion" in
3938         1*) ;;
3939         2.[0-8]*) ;;
3940         ?*)     echo " "
3941                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3942                 echo 'int main(void) { return 0; }' > gcctest.c
3943                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3944                         echo "Yes, it does." 2>&1
3945                         case "$ccflags" in
3946                         *strict-aliasing*) 
3947                                 echo "Leaving current flags $ccflags alone." 2>&1
3948                                 ;;
3949                         *) dflt="$dflt -fno-strict-aliasing" ;;
3950                         esac
3951                 else
3952                         echo "Nope, it doesn't, but that's ok." 2>&1
3953                 fi
3954                 ;;
3955         esac
3956         ;;
3957 esac
3958
3959 case "$mips_type" in
3960 *BSD*|'') inclwanted="$locincpth $usrinc";;
3961 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3962 esac
3963 for thisincl in $inclwanted; do
3964         if $test -d $thisincl; then
3965                 if $test x$thisincl != x$usrinc; then
3966                         case "$dflt" in
3967                         *" -I$thisincl "*);;
3968                         *) dflt="$dflt -I$thisincl ";;
3969                         esac
3970                 fi
3971         fi
3972 done
3973
3974 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3975         xxx=true;
3976 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3977         xxx=true;
3978 else
3979         xxx=false;
3980 fi;
3981 if $xxx; then
3982         case "$dflt" in
3983         *$2*);;
3984         *) dflt="$dflt -D$2";;
3985         esac;
3986 fi'
3987
3988 set signal.h LANGUAGE_C; eval $inctest
3989
3990 case "$usesocks" in
3991 $define)
3992         ccflags="$ccflags -DSOCKS"
3993         ;;
3994 esac
3995
3996 case "$hint" in
3997 default|recommended) dflt="$ccflags $dflt" ;;
3998 *) dflt="$ccflags";;
3999 esac
4000
4001 case "$dflt" in
4002 ''|' ') dflt=none;;
4003 esac
4004
4005 $cat <<EOH
4006
4007 Your C compiler may want other flags.  For this question you should include
4008 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4009 but you should NOT include libraries or ld flags like -lwhatever.  If you
4010 want $package to honor its debug switch, you should include -DDEBUGGING here.
4011 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4012
4013 To use no flags, specify the word "none".
4014
4015 EOH
4016 set X $dflt
4017 shift
4018 dflt=${1+"$@"}
4019 rp="Any additional cc flags?"
4020 . ./myread
4021 case "$ans" in
4022 none) ccflags='';;
4023 *) ccflags="$ans";;
4024 esac
4025
4026 : the following weeds options from ccflags that are of no interest to cpp
4027 cppflags="$ccflags"
4028 case "$gccversion" in
4029 1*) cppflags="$cppflags -D__GNUC__"
4030 esac
4031 case "$mips_type" in
4032 '');;
4033 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4034 esac
4035 case "$cppflags" in
4036 '');;
4037 *)
4038         echo " "
4039         echo "Let me guess what the preprocessor flags are..." >&4
4040         set X $cppflags
4041         shift
4042         cppflags=''
4043         $cat >cpp.c <<'EOM'
4044 #define BLURFL foo
4045
4046 BLURFL xx LFRULB
4047 EOM
4048         previous=''
4049         for flag in $*
4050         do
4051                 case "$flag" in
4052                 -*) ftry="$flag";;
4053                 *) ftry="$previous $flag";;
4054                 esac
4055                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4056                         >cpp1.out 2>/dev/null && \
4057                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4058                         >cpp2.out 2>/dev/null && \
4059                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4060                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4061                 then
4062                         cppflags="$cppflags $ftry"
4063                         previous=''
4064                 else
4065                         previous="$flag"
4066                 fi
4067         done
4068         set X $cppflags
4069         shift
4070         cppflags=${1+"$@"}
4071         case "$cppflags" in
4072         *-*)  echo "They appear to be: $cppflags";;
4073         esac
4074         $rm -f cpp.c cpp?.out
4075         ;;
4076 esac
4077
4078 : flags used in final linking phase
4079 case "$ldflags" in
4080 '') if ./venix; then
4081                 dflt='-i -z'
4082         else
4083                 dflt=''
4084         fi
4085         case "$ccflags" in
4086         *-posix*) dflt="$dflt -posix" ;;
4087         esac
4088         ;;
4089 *) dflt="$ldflags";;
4090 esac
4091
4092 : Try to guess additional flags to pick up local libraries.
4093 for thislibdir in $libpth; do
4094         case " $loclibpth " in
4095         *" $thislibdir "*)
4096                 case "$dflt " in 
4097                 *"-L$thislibdir "*) ;;
4098                 *)  dflt="$dflt -L$thislibdir" ;;
4099                 esac
4100                 ;;
4101         esac
4102 done
4103
4104 case "$dflt" in
4105 '') dflt='none' ;;
4106 esac
4107
4108 $cat <<EOH
4109
4110 Your C linker may need flags.  For this question you should
4111 include -L/whatever and any other flags used by the C linker, but you
4112 should NOT include libraries like -lwhatever.
4113
4114 Make sure you include the appropriate -L/path flags if your C linker
4115 does not normally search all of the directories you specified above,
4116 namely
4117         $libpth
4118 To use no flags, specify the word "none".
4119
4120 EOH
4121
4122 rp="Any additional ld flags (NOT including libraries)?"
4123 . ./myread
4124 case "$ans" in
4125 none) ldflags='';;
4126 *) ldflags="$ans";;
4127 esac
4128 rmlist="$rmlist pdp11"
4129
4130 : coherency check
4131 echo " "
4132 echo "Checking your choice of C compiler and flags for coherency..." >&4
4133 $cat > try.c <<'EOF'
4134 #include <stdio.h>
4135 int main() { printf("Ok\n"); exit(0); }
4136 EOF
4137 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4138 shift
4139 $cat >try.msg <<'EOM'
4140 I've tried to compile and run the following simple program:
4141
4142 EOM
4143 $cat try.c >> try.msg
4144
4145 $cat >> try.msg <<EOM
4146
4147 I used the command:
4148
4149         $*
4150         ./try
4151
4152 and I got the following output:
4153
4154 EOM
4155 dflt=y
4156 if $sh_c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4157         if $sh_c './try' >>try.msg 2>&1; then
4158                 xxx=`./try`
4159                 case "$xxx" in
4160                 "Ok") dflt=n ;;
4161                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4162                         case " $libs " in
4163                         *" -lsfio "*)
4164                                 cat >> try.msg <<'EOQS'
4165 If $libs contains -lsfio, and sfio is mis-configured, then it
4166 sometimes (apparently) runs and exits with a 0 status, but with no
4167 output!  It may have to do with sfio's use of _exit vs. exit.
4168
4169 EOQS
4170                                 rp="You have a big problem.  Shall I abort Configure"
4171                                 dflt=y
4172                                 ;;
4173                         esac
4174                         ;;
4175                 esac
4176         else
4177                 echo "The program compiled OK, but exited with status $?." >>try.msg
4178                 rp="You have a problem.  Shall I abort Configure"
4179                 dflt=y
4180         fi
4181 else
4182         echo "I can't compile the test program." >>try.msg
4183         rp="You have a BIG problem.  Shall I abort Configure"
4184         dflt=y
4185 fi
4186 case "$dflt" in
4187 y)
4188         $cat try.msg >&4
4189         case "$knowitall" in
4190         '')
4191                 echo "(The supplied flags or libraries might be incorrect.)"
4192                 ;;
4193         *) dflt=n;;
4194         esac
4195         echo " "
4196         . ./myread
4197         case "$ans" in
4198         n*|N*) ;;
4199         *)      echo "Ok.  Stopping Configure." >&4
4200                 exit 1
4201                 ;;
4202         esac
4203         ;;
4204 n) echo "OK, that should do.";;
4205 esac
4206 $rm -f try try.* core
4207
4208 : define an is-a-typedef? function
4209 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4210 case "$inclist" in
4211 "") inclist="sys/types.h";;
4212 esac;
4213 eval "varval=\$$var";
4214 case "$varval" in
4215 "")
4216         $rm -f temp.c;
4217         for inc in $inclist; do
4218                 echo "#include <$inc>" >>temp.c;
4219         done;
4220         echo "#ifdef $type" >> temp.c;
4221         echo "printf(\"We have $type\");" >> temp.c;
4222         echo "#endif" >> temp.c;
4223         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4224         if $contains $type temp.E >/dev/null 2>&1; then
4225                 eval "$var=\$type";
4226         else
4227                 eval "$var=\$def";
4228         fi;
4229         $rm -f temp.?;;
4230 *) eval "$var=\$varval";;
4231 esac'
4232
4233 : define an is-a-typedef? function that prompts if the type is not available.
4234 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4235 case "$inclist" in
4236 "") inclist="sys/types.h";;
4237 esac;
4238 eval "varval=\$$var";
4239 case "$varval" in
4240 "")
4241         $rm -f temp.c;
4242         for inc in $inclist; do
4243                 echo "#include <$inc>" >>temp.c;
4244         done;
4245         echo "#ifdef $type" >> temp.c;
4246         echo "printf(\"We have $type\");" >> temp.c;
4247         echo "#endif" >> temp.c;
4248         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4249         echo " " ;
4250         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4251         if $contains $type temp.E >/dev/null 2>&1; then
4252                 echo "$type found." >&4;
4253                 eval "$var=\$type";
4254         else
4255                 echo "$type NOT found." >&4;
4256                 dflt="$def";
4257                 . ./myread ;
4258                 eval "$var=\$ans";
4259         fi;
4260         $rm -f temp.?;;
4261 *) eval "$var=\$varval";;
4262 esac'
4263
4264 : define a shorthand compile call
4265 compile='
4266 mc_file=$1;
4267 shift;
4268 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4269 : define a shorthand compile call for compilations that should be ok.
4270 compile_ok='
4271 mc_file=$1;
4272 shift;
4273 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4274
4275 : check for lengths of integral types
4276 echo " "
4277 case "$intsize" in
4278 '')
4279         echo "Checking to see how big your integers are..." >&4
4280         $cat >intsize.c <<'EOCP'
4281 #include <stdio.h>
4282 int main()
4283 {
4284         printf("intsize=%d;\n", (int)sizeof(int));
4285         printf("longsize=%d;\n", (int)sizeof(long));
4286         printf("shortsize=%d;\n", (int)sizeof(short));
4287         exit(0);
4288 }
4289 EOCP
4290         set intsize
4291         if eval $compile_ok && ./intsize > /dev/null; then
4292                 eval `./intsize`
4293                 echo "Your integers are $intsize bytes long."
4294                 echo "Your long integers are $longsize bytes long."
4295                 echo "Your short integers are $shortsize bytes long."
4296         else
4297                 $cat >&4 <<EOM
4298 !
4299 Help! I can't compile and run the intsize test program: please enlighten me!
4300 (This is probably a misconfiguration in your system or libraries, and
4301 you really ought to fix it.  Still, I'll try anyway.)
4302 !
4303 EOM
4304                 dflt=4
4305                 rp="What is the size of an integer (in bytes)?"
4306                 . ./myread
4307                 intsize="$ans"
4308                 dflt=$intsize
4309                 rp="What is the size of a long integer (in bytes)?"
4310                 . ./myread
4311                 longsize="$ans"
4312                 dflt=2
4313                 rp="What is the size of a short integer (in bytes)?"
4314                 . ./myread
4315                 shortsize="$ans"
4316         fi
4317         ;;
4318 esac
4319 $rm -f intsize intsize.*
4320
4321 : see what type lseek is declared as in the kernel
4322 rp="What is the type used for lseek's offset on this system?"
4323 set off_t lseektype long stdio.h sys/types.h
4324 eval $typedef_ask
4325
4326 echo " "
4327 echo "Checking to see how big your file offsets are..." >&4
4328 $cat >try.c <<EOCP
4329 #include <sys/types.h>
4330 #include <stdio.h>
4331 int main()
4332 {
4333     printf("%d\n", (int)sizeof($lseektype));
4334     return(0); 
4335 }
4336 EOCP
4337 set try
4338 if eval $compile_ok; then
4339         lseeksize=`./try`
4340         echo "Your file offsets are $lseeksize bytes long."
4341 else
4342         dflt=$longsize
4343         echo " "
4344         echo "(I can't seem to compile the test program.  Guessing...)"
4345         rp="What is the size of your file offsets (in bytes)?"
4346         . ./myread
4347         lseeksize="$ans"
4348 fi
4349 $rm -f try.c try
4350
4351 : see what type file positions are declared as in the library
4352 rp="What is the type for file position used by fsetpos()?"
4353 set fpos_t fpostype long stdio.h sys/types.h
4354 eval $typedef_ask
4355
4356 echo " "
4357 case "$fpostype" in
4358 *_t) zzz="$fpostype"    ;;
4359 *)   zzz="fpos_t"       ;;
4360 esac
4361 echo "Checking the size of $zzz..." >&4 
4362 cat > try.c <<EOCP
4363 #include <sys/types.h>
4364 #include <stdio.h>
4365 int main() {
4366     printf("%d\n", (int)sizeof($fpostype));
4367     exit(0);
4368 }
4369 EOCP
4370 set try
4371 if eval $compile_ok; then
4372         yyy=`./try`
4373         case "$yyy" in
4374         '')     fpossize=4
4375                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4376                 ;;
4377         *)      fpossize=$yyy
4378                 echo "Your $zzz is $fpossize bytes long."
4379                 ;;
4380         esac
4381 else
4382         dflt="$longsize"
4383         echo " " >&4
4384         echo "(I can't compile the test program.  Guessing...)" >&4
4385         rp="What is the size of your file positions (in bytes)?"
4386         . ./myread
4387         fpossize="$ans"
4388 fi
4389
4390
4391
4392 # Backward compatibility (uselfs is deprecated).
4393 case "$uselfs" in
4394 "$define"|true|[yY]*)
4395         cat <<EOM >&4
4396
4397 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4398 EOM
4399         uselargefiles="$define"
4400         ;;
4401 esac                          
4402
4403 case "$lseeksize:$fpossize" in
4404 8:8) cat <<EOM
4405
4406 You can have files larger than 2 gigabytes.
4407 EOM
4408    val="$define" ;;
4409 *)    case "$uselargefiles" in
4410    "$undef"|false|[nN]*) dflt='n' ;;
4411    *)   dflt='y' ;;
4412    esac
4413    cat <<EOM
4414
4415 Perl can be built to understand large files (files larger than 2 gigabytes)
4416 on some systems.  To do so, Configure can be run with -Duselargefiles.
4417
4418 If this doesn't make any sense to you, just accept the default '$dflt'.
4419 EOM
4420    rp='Try to understand large files, if available?'
4421    . ./myread
4422    case "$ans" in
4423    y|Y)         val="$define" ;;
4424    *)           val="$undef"  ;;
4425    esac
4426    ;;
4427 esac
4428 set uselargefiles
4429 eval $setvar
4430 case "$uselargefiles" in
4431 "$define")
4432 : Look for a hint-file generated 'call-back-unit'.  If the
4433 : user has specified that a large files perl is to be built,
4434 : we may need to set or change some other defaults.
4435         if $test -f uselargefiles.cbu; then
4436                 echo "Your platform has some specific hints for large file builds, using them..."
4437                 . ./uselargefiles.cbu
4438                 echo " "
4439                 echo "Rechecking to see how big your file offsets are..." >&4
4440                 $cat >try.c <<EOCP
4441 #include <sys/types.h>
4442 #include <stdio.h>
4443 int main()
4444 {
4445     printf("%d\n", (int)sizeof($lseektype));
4446     return(0); 
4447 }
4448 EOCP
4449                 set try
4450                 if eval $compile_ok; then
4451                         lseeksize=`./try`
4452                         $echo "Your file offsets are now $lseeksize bytes long."
4453                 else
4454                         dflt="$lseeksize"
4455                         echo " "
4456                         echo "(I can't seem to compile the test program.  Guessing...)"
4457                         rp="What is the size of your file offsets (in bytes)?"
4458                         . ./myread
4459                         lseeksize="$ans"
4460                 fi
4461                 case "$fpostype" in
4462                 *_t) zzz="$fpostype"    ;;
4463                 *)   zzz="fpos_t"       ;;
4464                 esac
4465                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4466                 $cat > try.c <<EOCP
4467 #include <sys/types.h>
4468 #include <stdio.h>
4469 int main() {
4470     printf("%d\n", (int)sizeof($fpostype));
4471     exit(0);
4472 }
4473 EOCP
4474                 set try
4475                 if eval $compile_ok; then
4476                         yyy=`./try`
4477                         dflt="$lseeksize"
4478                         case "$yyy" in
4479                         '')     echo " "
4480                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4481                                 ;;
4482                         *)      fpossize=$yyy
4483                                 echo " $fpossize bytes." >&4
4484                                 ;;
4485                         esac
4486                 else
4487                         dflt="$fpossize"
4488                         echo " "
4489                         echo "(I can't compile the test program.  Guessing...)" >&4
4490                         rp="What is the size of your file positions (in bytes)?"
4491                         . ./myread
4492                         fpossize="$ans"
4493                 fi
4494                 $rm -f try.c try
4495         fi
4496         ;;
4497 esac
4498
4499
4500 case "$usemorebits" in
4501 "$define"|true|[yY]*)
4502         use64bitint="$define"
4503         uselongdouble="$define"
4504         usemorebits="$define"
4505         ;;
4506 *)      usemorebits="$undef"
4507         ;;
4508 esac
4509
4510
4511 case "$uselonglong" in
4512 "$define"|true|[yY]*)
4513         cat <<EOM >&4
4514
4515 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4516 EOM
4517         use64bitint="$define"
4518         ;;
4519 esac                          
4520 case "$use64bits" in
4521 "$define"|true|[yY]*)
4522         cat <<EOM >&4
4523
4524 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4525 EOM
4526         use64bitint="$define"
4527         ;;
4528 esac                          
4529 case "$use64bitints" in
4530 "$define"|true|[yY]*)
4531         cat <<EOM >&4
4532
4533 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4534 EOM
4535         use64bitint="$define"
4536         ;;
4537 esac                          
4538 case "$use64bitsint" in
4539 "$define"|true|[yY]*)
4540         cat <<EOM >&4
4541
4542 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4543 EOM
4544         use64bitint="$define"
4545         ;;
4546 esac                          
4547 case "$uselonglongs" in
4548 "$define"|true|[yY]*)
4549         cat <<EOM >&4
4550
4551 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4552 EOM
4553         use64bitint="$define"
4554         ;;
4555 esac                          
4556 case "$use64bitsall" in
4557 "$define"|true|[yY]*)
4558         cat <<EOM >&4
4559
4560 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4561 EOM
4562         use64bitall="$define"
4563         ;;
4564 esac                          
4565
4566 case "$ccflags" in
4567 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4568 esac
4569 case "$use64bitall" in
4570 "$define"|true|[yY]*) use64bitint="$define" ;;
4571 esac
4572
4573 case "$longsize" in
4574 8) cat <<EOM
4575
4576 You have natively 64-bit long integers.
4577 EOM
4578    val="$define"
4579    ;;
4580 *) case "$use64bitint" in
4581    "$define"|true|[yY]*) dflt='y';;
4582    *) dflt='n';;
4583    esac
4584    cat <<EOM
4585
4586 Perl can be built to take advantage of 64-bit integer types
4587 on some systems.  To do so, Configure can be run with -Duse64bitint.
4588 Choosing this option will most probably introduce binary incompatibilities.
4589
4590 If this doesn't make any sense to you, just accept the default '$dflt'.
4591 EOM
4592    rp='Try to use 64-bit integers, if available?'
4593    . ./myread
4594    case "$ans" in
4595    [yY]*) val="$define" ;;
4596    *)     val="$undef"  ;;
4597    esac
4598    ;;
4599 esac
4600 set use64bitint
4601 eval $setvar
4602
4603 case "$use64bitall" in
4604 "$define"|true|[yY]*) dflt='y' ;;
4605 *) case "$longsize" in
4606    8) dflt='y' ;;
4607    *) dflt='n' ;;
4608    esac
4609    ;;
4610 esac    
4611 cat <<EOM
4612
4613 You may also choose to try maximal 64-bitness.  It means using as much
4614 64-bitness as possible on the platform.  This in turn means even more
4615 binary incompatibilities.  On the other hand, your platform may not
4616 have any more 64-bitness available than what you already have chosen.
4617
4618 If this doesn't make any sense to you, just accept the default '$dflt'.
4619 EOM
4620 rp='Try to use maximal 64-bit support, if available?'
4621 . ./myread
4622 case "$ans" in
4623 [yY]*) val="$define" ;;
4624 *)     val="$undef"  ;;
4625 esac
4626 set use64bitall
4627 eval $setvar
4628 case "$use64bitall" in
4629 "$define")
4630         case "$use64bitint" in
4631         "$undef")
4632                 cat <<EOM
4633
4634 Since you have chosen a maximally 64-bit build, I'm also turning on
4635 the use of 64-bit integers.
4636 EOM
4637                 use64bitint="$define" ;;
4638         esac
4639         ;;
4640 esac
4641
4642 case "$use64bitint" in
4643 "$define"|true|[yY]*)
4644 : Look for a hint-file generated 'call-back-unit'.  If the
4645 : user has specified that a 64-bit perl is to be built,
4646 : we may need to set or change some other defaults.
4647         if $test -f use64bitint.cbu; then
4648                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4649                 . ./use64bitint.cbu
4650         fi
4651         case "$longsize" in
4652         4) case "$archname64" in
4653            '') archname64=64int ;;
4654            esac
4655            ;;
4656         esac
4657         ;;
4658 esac
4659
4660 case "$use64bitall" in
4661 "$define"|true|[yY]*)
4662 : Look for a hint-file generated 'call-back-unit'.  If the
4663 : user has specified that a maximally 64-bit perl is to be built,
4664 : we may need to set or change some other defaults.
4665         if $test -f use64bitall.cbu; then
4666                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4667                 . ./use64bitall.cbu
4668         fi
4669         case "$longsize" in
4670         4) case "$archname64" in
4671            ''|64int) archname64=64all ;;
4672            esac
4673            ;;
4674         esac
4675         ;;
4676 esac
4677
4678 echo " "
4679 echo "Checking for GNU C Library..." >&4
4680 cat >gnulibc.c <<EOM
4681 #include <stdio.h>
4682 int main()
4683 {
4684 #ifdef __GLIBC__
4685     exit(0);
4686 #else
4687     exit(1);
4688 #endif
4689 }
4690 EOM
4691 set gnulibc
4692 if eval $compile_ok && ./gnulibc; then
4693         val="$define"
4694         echo "You are using the GNU C Library"
4695 else
4696         val="$undef"
4697         echo "You are not using the GNU C Library"
4698 fi
4699 $rm -f gnulibc*
4700 set d_gnulibc
4701 eval $setvar
4702
4703 : see if nm is to be used to determine whether a symbol is defined or not
4704 case "$usenm" in
4705 '')
4706         dflt=''
4707         case "$d_gnulibc" in
4708         "$define")
4709                 echo " "
4710                 echo "nm probably won't work on the GNU C Library." >&4
4711                 dflt=n
4712                 ;;
4713         esac
4714         case "$dflt" in
4715         '') 
4716                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4717                         echo " "
4718                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4719                         echo "'nm' won't be sufficient on this sytem." >&4
4720                         dflt=n
4721                 fi
4722                 ;;
4723         esac
4724         case "$dflt" in
4725         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4726                 if $test $dflt -gt 20; then
4727                         dflt=y
4728                 else
4729                         dflt=n
4730                 fi
4731                 ;;
4732         esac
4733         ;;
4734 *)
4735         case "$usenm" in
4736         true|$define) dflt=y;;
4737         *) dflt=n;;
4738         esac
4739         ;;
4740 esac
4741 $cat <<EOM
4742
4743 I can use $nm to extract the symbols from your C libraries. This
4744 is a time consuming task which may generate huge output on the disk (up
4745 to 3 megabytes) but that should make the symbols extraction faster. The
4746 alternative is to skip the 'nm' extraction part and to compile a small
4747 test program instead to determine whether each symbol is present. If
4748 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4749 this may be the best solution.
4750
4751 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4752
4753 EOM
4754 rp="Shall I use $nm to extract C symbols from the libraries?"
4755 . ./myread
4756 case "$ans" in
4757 [Nn]*) usenm=false;;
4758 *) usenm=true;;
4759 esac
4760
4761 runnm=$usenm
4762 case "$reuseval" in
4763 true) runnm=false;;
4764 esac
4765
4766 : nm options which may be necessary
4767 case "$nm_opt" in
4768 '') if $test -f /mach_boot; then
4769                 nm_opt=''       # Mach
4770         elif $test -d /usr/ccs/lib; then
4771                 nm_opt='-p'     # Solaris (and SunOS?)
4772         elif $test -f /dgux; then
4773                 nm_opt='-p'     # DG-UX
4774         elif $test -f /lib64/rld; then
4775                 nm_opt='-p'     # 64-bit Irix
4776         else
4777                 nm_opt=''
4778         fi;;
4779 esac
4780
4781 : nm options which may be necessary for shared libraries but illegal
4782 : for archive libraries.  Thank you, Linux.
4783 case "$nm_so_opt" in
4784 '')     case "$myuname" in
4785         *linux*)
4786                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4787                         nm_so_opt='--dynamic'
4788                 fi
4789                 ;;
4790         esac
4791         ;;
4792 esac
4793
4794 case "$runnm" in
4795 true)
4796 : get list of predefined functions in a handy place
4797 echo " "
4798 case "$libc" in
4799 '') libc=unknown
4800         case "$libs" in
4801         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4802         esac
4803         ;;
4804 esac
4805 libnames='';
4806 case "$libs" in
4807 '') ;;
4808 *)  for thislib in $libs; do
4809         case "$thislib" in
4810         -lc|-lc_s)
4811                 : Handle C library specially below.
4812                 ;;
4813         -l*)
4814                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4815                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4816                         :
4817                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4818                         :
4819                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4820                         :
4821                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4822                         :
4823                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4824                         :
4825                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4826                         :
4827                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4828                         :
4829                 else
4830                         try=''
4831                 fi
4832                 libnames="$libnames $try"
4833                 ;;
4834         *) libnames="$libnames $thislib" ;;
4835         esac
4836         done
4837         ;;
4838 esac
4839 xxx=normal
4840 case "$libc" in
4841 unknown)
4842         set /lib/libc.$so
4843         for xxx in $libpth; do
4844                 $test -r $1 || set $xxx/libc.$so
4845                 : The messy sed command sorts on library version numbers.
4846                 $test -r $1 || \
4847                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4848                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4849                                 h
4850                                 s/[0-9][0-9]*/0000&/g
4851                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4852                                 G
4853                                 s/\n/ /' | \
4854                          $sort | $sed -e 's/^.* //'`
4855                 eval set \$$#
4856         done
4857         $test -r $1 || set /usr/ccs/lib/libc.$so
4858         $test -r $1 || set /lib/libsys_s$_a
4859         ;;
4860 *)
4861         set blurfl
4862         ;;
4863 esac
4864 if $test -r "$1"; then
4865         echo "Your (shared) C library seems to be in $1."
4866         libc="$1"
4867 elif $test -r /lib/libc && $test -r /lib/clib; then
4868         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4869         xxx=apollo
4870         libc='/lib/clib /lib/libc'
4871         if $test -r /lib/syslib; then
4872                 echo "(Your math library is in /lib/syslib.)"
4873                 libc="$libc /lib/syslib"
4874         fi
4875 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4876         echo "Your C library seems to be in $libc, as you said before."
4877 elif $test -r $incpath/usr/lib/libc$_a; then
4878         libc=$incpath/usr/lib/libc$_a;
4879         echo "Your C library seems to be in $libc.  That's fine."
4880 elif $test -r /lib/libc$_a; then
4881         libc=/lib/libc$_a;
4882         echo "Your C library seems to be in $libc.  You're normal."
4883 else
4884         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4885                 :
4886         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4887                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4888         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4889                 :
4890         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4891                 :
4892         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4893                 :
4894         else
4895                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4896         fi
4897         if $test -r "$tans"; then
4898                 echo "Your C library seems to be in $tans, of all places."
4899                 libc=$tans
4900         else
4901                 libc='blurfl'
4902         fi
4903 fi
4904 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4905         dflt="$libc"
4906         cat <<EOM
4907
4908 If the guess above is wrong (which it might be if you're using a strange
4909 compiler, or your machine supports multiple models), you can override it here.
4910
4911 EOM
4912 else
4913         dflt=''
4914         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4915         cat >&4 <<EOM
4916 I can't seem to find your C library.  I've looked in the following places:
4917
4918 EOM
4919         $sed 's/^/      /' libpath
4920         cat <<EOM
4921
4922 None of these seems to contain your C library. I need to get its name...
4923
4924 EOM
4925 fi
4926 fn=f
4927 rp='Where is your C library?'
4928 . ./getfile
4929 libc="$ans"
4930
4931 echo " "
4932 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4933 set X `cat libnames`
4934 shift
4935 xxx=files
4936 case $# in 1) xxx=file; esac
4937 echo "Extracting names from the following $xxx for later perusal:" >&4
4938 echo " "
4939 $sed 's/^/      /' libnames >&4
4940 echo " "
4941 $echo $n "This may take a while...$c" >&4
4942
4943 for file in $*; do
4944         case $file in
4945         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4946         *) $nm $nm_opt $file 2>/dev/null;;
4947         esac
4948 done >libc.tmp
4949
4950 $echo $n ".$c"
4951 $grep fprintf libc.tmp > libc.ptf
4952 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4953 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4954 xxx='[ADTSIW]'
4955 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4956         eval $xscan;\
4957         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4958                 eval $xrun
4959 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4960         eval $xscan;\
4961         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4962                 eval $xrun
4963 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4964         eval $xscan;\
4965         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4966                 eval $xrun
4967 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4968         eval $xscan;\
4969         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4970                 eval $xrun
4971 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4972         eval $xscan;\
4973         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4974                 eval $xrun
4975 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4976         eval $xscan;\
4977         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4978                 eval $xrun
4979 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4980                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4981         eval $xscan;\
4982         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4983                 eval $xrun
4984 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4985         eval $xscan;\
4986         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4987                 eval $xrun
4988 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4989         eval $xscan;\
4990         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4991                 eval $xrun
4992 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4993         eval $xscan;\
4994         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4995                 eval $xrun
4996 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4997         eval $xscan;\
4998         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4999                 eval $xrun
5000 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5001         eval $xscan;\
5002         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5003                 eval $xrun
5004 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5005         eval $xscan;\
5006         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5007                 eval $xrun
5008 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5009         eval $xscan;\
5010         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5011                 eval $xrun
5012 else
5013         $nm -p $* 2>/dev/null >libc.tmp
5014         $grep fprintf libc.tmp > libc.ptf
5015         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5016                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5017         then
5018                 nm_opt='-p'
5019                 eval $xrun
5020         else
5021                 echo " "
5022                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5023                 com=''
5024                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5025                         for thisname in $libnames $libc; do
5026                                 $ar t $thisname >>libc.tmp
5027                         done
5028                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5029                         echo "Ok." >&4
5030                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5031                         # Repeat libc to extract forwarders to DLL entries too
5032                         for thisname in $libnames $libc; do
5033                                 $ar tv $thisname >>libc.tmp
5034                                 # Revision 50 of EMX has bug in $ar.
5035                                 # it will not extract forwarders to DLL entries
5036                                 # Use emximp which will extract exactly them.
5037                                 emximp -o tmp.imp $thisname \
5038                                     2>/dev/null && \
5039                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5040                                     < tmp.imp >>libc.tmp
5041                                 $rm tmp.imp
5042                         done
5043                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5044                         echo "Ok." >&4
5045                 else
5046                         echo "$ar didn't seem to work right." >&4
5047                         echo "Maybe this is a Cray...trying bld instead..." >&4
5048                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5049                         then
5050                                 for thisname in $libnames; do
5051                                         bld t $libnames | \
5052                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5053                                         $ar t $thisname >>libc.tmp
5054                                 done
5055                                 echo "Ok." >&4
5056                         else
5057                                 echo "That didn't work either.  Giving up." >&4
5058                                 exit 1
5059                         fi
5060                 fi
5061         fi
5062 fi
5063 nm_extract="$com"
5064 if $test -f /lib/syscalls.exp; then
5065         echo " "
5066         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5067         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5068 fi
5069 ;;
5070 esac
5071 $rm -f libnames libpath
5072
5073 : is a C symbol defined?
5074 csym='tlook=$1;
5075 case "$3" in
5076 -v) tf=libc.tmp; tc=""; tdc="";;
5077 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5078 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5079 esac;
5080 tx=yes;
5081 case "$reuseval-$4" in
5082 true-) ;;
5083 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5084 esac;
5085 case "$tx" in
5086 yes)
5087         case "$runnm" in
5088         true)
5089                 if $contains $tlook $tf >/dev/null 2>&1;
5090                 then tval=true;
5091                 else tval=false;
5092                 fi;;
5093         *)
5094                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5095                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5096                 then tval=true;
5097                 else tval=false;
5098                 fi;
5099                 $rm -f t t.c;;
5100         esac;;
5101 *)
5102         case "$tval" in
5103         $define) tval=true;;
5104         *) tval=false;;
5105         esac;;
5106 esac;
5107 eval "$2=$tval"'
5108
5109 : define an is-in-libc? function
5110 inlibc='echo " "; td=$define; tu=$undef;
5111 sym=$1; var=$2; eval "was=\$$2";
5112 tx=yes;
5113 case "$reuseval$was" in
5114 true) ;;
5115 true*) tx=no;;
5116 esac;
5117 case "$tx" in
5118 yes)
5119         set $sym tres -f;
5120         eval $csym;
5121         case "$tres" in
5122         true)
5123                 echo "$sym() found." >&4;
5124                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5125         *)
5126                 echo "$sym() NOT found." >&4;
5127                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5128         esac;;
5129 *)
5130         case "$was" in
5131         $define) echo "$sym() found." >&4;;
5132         *) echo "$sym() NOT found." >&4;;
5133         esac;;
5134 esac'
5135
5136 : see if sqrtl exists
5137 set sqrtl d_sqrtl
5138 eval $inlibc
5139
5140 case "$ccflags" in
5141 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5142 esac
5143
5144 case "$uselongdouble" in
5145 $define|true|[yY]*)     dflt='y';;
5146 *) dflt='n';;
5147 esac
5148 cat <<EOM
5149
5150 Perl can be built to take advantage of long doubles which
5151 (if available) may give more accuracy and range for floating point numbers.
5152
5153 If this doesn't make any sense to you, just accept the default '$dflt'.
5154 EOM
5155 rp='Try to use long doubles if available?'
5156 . ./myread
5157 case "$ans" in
5158 y|Y)    val="$define"   ;;
5159 *)      val="$undef"    ;;
5160 esac
5161 set uselongdouble
5162 eval $setvar
5163
5164 case "$uselongdouble" in
5165 true|[yY]*) uselongdouble="$define" ;;
5166 esac
5167
5168 case "$uselongdouble" in
5169 $define)
5170 : Look for a hint-file generated 'call-back-unit'.  If the
5171 : user has specified that long doubles should be used,
5172 : we may need to set or change some other defaults.
5173         if $test -f uselongdouble.cbu; then
5174                 echo "Your platform has some specific hints for long doubles, using them..."
5175                 . ./uselongdouble.cbu
5176         else
5177                 $cat <<EOM
5178 (Your platform doesn't have any specific hints for long doubles.)
5179 EOM
5180         fi
5181         ;;
5182 esac
5183
5184 case "$uselongdouble:$d_sqrtl" in
5185 $define:$undef)
5186                 $cat <<EOM >&4
5187
5188 *** You requested the use of long doubles but you do not seem to have
5189 *** the mathematic functions for long doubles.  I'm disabling the use
5190 *** of long doubles.
5191
5192 EOM
5193         uselongdouble=$undef
5194         ;;
5195 esac
5196
5197 : check for length of double
5198 echo " "
5199 case "$doublesize" in
5200 '')
5201         echo "Checking to see how big your double precision numbers are..." >&4
5202         $cat >try.c <<'EOCP'
5203 #include <stdio.h>
5204 int main()
5205 {
5206     printf("%d\n", (int)sizeof(double));
5207     exit(0);
5208 }
5209 EOCP
5210         set try
5211         if eval $compile_ok; then
5212                 doublesize=`./try`
5213                 echo "Your double is $doublesize bytes long."
5214         else
5215                 dflt='8'
5216                 echo "(I can't seem to compile the test program.  Guessing...)"
5217                 rp="What is the size of a double precision number (in bytes)?"
5218                 . ./myread
5219                 doublesize="$ans"
5220         fi
5221         ;;
5222 esac
5223 $rm -f try.c try
5224
5225 : check for long doubles
5226 echo " "
5227 echo "Checking to see if you have long double..." >&4
5228 echo 'int main() { long double x = 7.0; }' > try.c
5229 set try
5230 if eval $compile; then
5231         val="$define"
5232         echo "You have long double."
5233 else
5234         val="$undef"
5235         echo "You do not have long double."
5236 fi
5237 $rm try.*
5238 set d_longdbl
5239 eval $setvar
5240
5241 : check for length of long double
5242 case "${d_longdbl}${longdblsize}" in
5243 $define)
5244         echo " "
5245         echo "Checking to see how big your long doubles are..." >&4
5246         $cat >try.c <<'EOCP'
5247 #include <stdio.h>
5248 int main()
5249 {
5250         printf("%d\n", sizeof(long double));
5251 }
5252 EOCP
5253         set try
5254         set try
5255         if eval $compile; then
5256                 longdblsize=`./try$exe_ext`
5257                 echo "Your long doubles are $longdblsize bytes long."
5258         else
5259                 dflt='8'
5260                 echo " "
5261                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5262                 rp="What is the size of a long double (in bytes)?"
5263                 . ./myread
5264                 longdblsize="$ans"
5265         fi
5266         if $test "X$doublesize" = "X$longdblsize"; then
5267                 echo "(That isn't any different from an ordinary double.)"
5268         fi      
5269         ;;
5270 esac
5271 $rm -f try.* try
5272
5273 : determine the architecture name
5274 echo " "
5275 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5276         tarch=`arch`"-$osname"
5277 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5278         if uname -m > tmparch 2>&1 ; then
5279                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5280                         -e 's/$/'"-$osname/" tmparch`
5281         else
5282                 tarch="$osname"
5283         fi
5284         $rm -f tmparch
5285 else
5286         tarch="$osname"
5287 fi
5288 case "$myarchname" in
5289 ''|"$tarch") ;;
5290 *)
5291         echo "(Your architecture name used to be $myarchname.)"
5292         archname=''
5293         ;;
5294 esac
5295 myarchname="$tarch"
5296 case "$archname" in
5297 '') dflt="$tarch";;
5298 *) dflt="$archname";;
5299 esac
5300 rp='What is your architecture name'
5301 . ./myread
5302 archname="$ans"
5303 case "$usethreads" in
5304 $define)
5305         echo "Threads selected." >&4
5306         case "$archname" in
5307         *-thread*) echo "...and architecture name already has -thread." >&4
5308                 ;;
5309         *)      archname="$archname-thread"
5310                 echo "...setting architecture name to $archname." >&4
5311                 ;;
5312         esac
5313         ;;
5314 esac
5315 case "$usemultiplicity" in
5316 $define)
5317         echo "Multiplicity selected." >&4
5318         case "$archname" in
5319         *-multi*) echo "...and architecture name already has -multi." >&4
5320                 ;;
5321         *)      archname="$archname-multi"
5322                 echo "...setting architecture name to $archname." >&4
5323                 ;;
5324         esac
5325         ;;
5326 esac
5327 case "$use64bitint$use64bitall" in
5328 *"$define"*)
5329         case "$archname64" in
5330         '')
5331                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5332                 ;;
5333         *)
5334                 case "$use64bitint" in
5335                 "$define") echo "64 bit integers selected." >&4 ;;
5336                 esac
5337                 case "$use64bitall" in
5338                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5339                 esac
5340                 case "$archname" in
5341                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5342                         ;;
5343                 *)      archname="$archname-$archname64"
5344                         echo "...setting architecture name to $archname." >&4
5345                         ;;
5346                 esac
5347                 ;;
5348         esac
5349 esac
5350 case "$uselongdouble" in
5351 $define)
5352         echo "Long doubles selected." >&4
5353         case "$longdblsize" in
5354         $doublesize)
5355                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5356                 ;;
5357         *)
5358                 case "$archname" in
5359                 *-ld*) echo "...and architecture name already has -ld." >&4
5360                         ;;
5361                 *)      archname="$archname-ld"
5362                         echo "...setting architecture name to $archname." >&4
5363                         ;;
5364                 esac
5365                 ;;
5366         esac
5367         ;;
5368 esac
5369
5370 : determine root of directory hierarchy where package will be installed.
5371 case "$prefix" in
5372 '')
5373         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5374         ;;
5375 *)
5376         dflt="$prefix"
5377         ;;
5378 esac
5379 $cat <<EOM
5380
5381 By default, $package will be installed in $dflt/bin, manual pages
5382 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5383 installation directories. Typically this is something like /usr/local.
5384 If you wish to have binaries under /usr/bin but other parts of the
5385 installation under /usr/local, that's ok: you will be prompted
5386 separately for each of the installation directories, the prefix being
5387 only used to set the defaults.
5388
5389 EOM
5390 fn=d~
5391 rp='Installation prefix to use?'
5392 . ./getfile
5393 oldprefix=''
5394 case "$prefix" in
5395 '') ;;
5396 *)
5397         case "$ans" in
5398         "$prefix") ;;
5399         *) oldprefix="$prefix";;
5400         esac
5401         ;;
5402 esac
5403 prefix="$ans"
5404 prefixexp="$ansexp"
5405
5406 : is AFS running?
5407 echo " "
5408 case "$afs" in
5409 $define|true)   afs=true ;;
5410 $undef|false)   afs=false ;;
5411 *)      if test -d /afs; then
5412                 afs=true
5413         else
5414                 afs=false
5415         fi
5416         ;;
5417 esac
5418 if $afs; then
5419         echo "AFS may be running... I'll be extra cautious then..." >&4
5420 else
5421         echo "AFS does not seem to be running..." >&4
5422 fi
5423
5424 : determine installation prefix for where package is to be installed.
5425 if $afs; then 
5426 $cat <<EOM
5427
5428 Since you are running AFS, I need to distinguish the directory in which
5429 files will reside from the directory in which they are installed (and from
5430 which they are presumably copied to the former directory by occult means).
5431
5432 EOM
5433         case "$installprefix" in
5434         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5435         *) dflt="$installprefix";;
5436         esac
5437 else
5438 $cat <<EOM
5439
5440 In some special cases, particularly when building $package for distribution,
5441 it is convenient to distinguish between the directory in which files should 
5442 be installed from the directory ($prefix) in which they 
5443 will eventually reside.  For most users, these two directories are the same.
5444
5445 EOM
5446         case "$installprefix" in
5447         '') dflt=$prefix ;;
5448         *) dflt=$installprefix;;
5449         esac
5450 fi
5451 fn=d~
5452 rp='What installation prefix should I use for installing files?'
5453 . ./getfile
5454 installprefix="$ans"
5455 installprefixexp="$ansexp"
5456
5457 : set the prefixit variable, to compute a suitable default value
5458 prefixit='case "$3" in
5459 ""|none)
5460         case "$oldprefix" in
5461         "") eval "$1=\"\$$2\"";;
5462         *)
5463                 case "$3" in
5464                 "") eval "$1=";;
5465                 none)
5466                         eval "tp=\"\$$2\"";
5467                         case "$tp" in
5468                         ""|" ") eval "$1=\"\$$2\"";;
5469                         *) eval "$1=";;
5470                         esac;;
5471                 esac;;
5472         esac;;
5473 *)
5474         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5475         case "$tp" in
5476         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5477         /*-$oldprefix/*|\~*-$oldprefix/*)
5478                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5479         *) eval "$1=\"\$$2\"";;
5480         esac;;
5481 esac'
5482
5483
5484 : get the patchlevel
5485 echo " "
5486 echo "Getting the current patchlevel..." >&4
5487 if $test -r $rsrc/patchlevel.h;then
5488         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5489         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5490         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5491         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5492         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5493         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5494 else
5495         revision=0
5496         patchlevel=0
5497         subversion=0
5498         api_revision=0
5499         api_version=0
5500         api_subversion=0
5501 fi
5502 $echo "(You have $package version $patchlevel subversion $subversion.)"
5503 case "$osname" in
5504 dos|vms)
5505         : XXX Should be a Configure test for double-dots in filenames.
5506         version=`echo $revision $patchlevel $subversion | \
5507                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5508         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5509                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5510         ;;
5511 *)
5512         version=`echo $revision $patchlevel $subversion | \
5513                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5514         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5515                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5516         ;;
5517 esac
5518 : Special case the 5.005_xx maintenance series, which used 5.005
5519 : without any subversion label as a subdirectory in $sitelib
5520 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5521         api_versionstring='5.005'
5522 fi
5523
5524 : determine installation style
5525 : For now, try to deduce it from prefix unless it is already set.
5526 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5527 case "$installstyle" in
5528 '')     case "$prefix" in
5529                 *perl*) dflt='lib';;
5530                 *) dflt='lib/perl5' ;;
5531         esac
5532         ;;
5533 *)      dflt="$installstyle" ;;
5534 esac
5535 : Probably not worth prompting for this since we prompt for all
5536 : the directories individually, and the prompt would be too long and
5537 : confusing anyway.
5538 installstyle=$dflt
5539
5540 : determine where private library files go
5541 : Usual default is /usr/local/lib/perl5/$version.
5542 : Also allow things like /opt/perl/lib/$version, since 
5543 : /opt/perl/lib/perl5... would be redundant.
5544 : The default "style" setting is made in installstyle.U
5545 case "$installstyle" in
5546 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5547 *)       set dflt privlib lib/$version ;;
5548 esac
5549 eval $prefixit
5550 $cat <<EOM
5551
5552 There are some auxiliary files for $package that need to be put into a
5553 private library directory that is accessible by everyone.
5554
5555 EOM
5556 fn=d~+
5557 rp='Pathname where the private library files will reside?'
5558 . ./getfile
5559 privlib="$ans"
5560 privlibexp="$ansexp"
5561 : Change installation prefix, if necessary.
5562 if $test X"$prefix" != X"$installprefix"; then
5563         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5564 else
5565         installprivlib="$privlibexp"
5566 fi
5567
5568 : set the prefixup variable, to restore leading tilda escape
5569 prefixup='case "$prefixexp" in
5570 "$prefix") ;;
5571 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5572 esac'
5573
5574 : determine where public architecture dependent libraries go
5575 set archlib archlib
5576 eval $prefixit
5577 : privlib default is /usr/local/lib/$package/$version
5578 : archlib default is /usr/local/lib/$package/$version/$archname
5579 : privlib may have an optional trailing /share.
5580 tdflt=`echo $privlib | $sed 's,/share$,,'`
5581 tdflt=$tdflt/$archname
5582 case "$archlib" in
5583 '')     dflt=$tdflt
5584         ;;
5585 *)      dflt="$archlib"
5586     ;;
5587 esac
5588 $cat <<EOM
5589
5590 $spackage contains architecture-dependent library files.  If you are
5591 sharing libraries in a heterogeneous environment, you might store
5592 these files in a separate location.  Otherwise, you can just include
5593 them with the rest of the public library files.
5594
5595 EOM
5596 fn=d+~
5597 rp='Where do you want to put the public architecture-dependent libraries?'
5598 . ./getfile
5599 archlib="$ans"
5600 archlibexp="$ansexp"
5601 if $test X"$archlib" = X"$privlib"; then
5602         d_archlib="$undef"
5603 else
5604         d_archlib="$define"
5605 fi
5606 : Change installation prefix, if necessary.
5607 if $test X"$prefix" != X"$installprefix"; then
5608         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5609 else
5610         installarchlib="$archlibexp"
5611 fi
5612
5613
5614 : Binary compatibility with 5.005 is not possible for builds
5615 : with advanced features
5616 case "$usethreads$usemultiplicity" in
5617 *define*)
5618         bincompat5005="$undef"
5619         d_bincompat5005="$undef"
5620         ;;
5621 *)      $cat <<EOM
5622
5623 This version of Perl can be compiled for binary compatibility with 5.005.
5624 If you decide to do so, you will be able to continue using most of the
5625 extensions that were compiled for Perl 5.005.
5626
5627 EOM
5628         case "$bincompat5005$d_bincompat5005" in
5629         *"$undef"*) dflt=n ;;
5630         *) dflt=y ;;
5631         esac
5632         rp='Binary compatibility with Perl 5.005?'
5633         . ./myread
5634         case "$ans" in
5635         y*) val="$define" ;;
5636         *)  val="$undef" ;;
5637         esac
5638         set d_bincompat5005
5639         eval $setvar
5640         case "$d_bincompat5005" in
5641         "$define")
5642                 bincompat5005="$define"
5643                 ;;
5644         *)      bincompat5005="$undef"
5645                 d_bincompat5005="$undef"
5646                 ;;
5647         esac
5648         ;;
5649 esac
5650
5651
5652 : see if setuid scripts can be secure
5653 $cat <<EOM
5654
5655 Some kernels have a bug that prevents setuid #! scripts from being
5656 secure.  Some sites have disabled setuid #! scripts because of this.
5657
5658 First let's decide if your kernel supports secure setuid #! scripts.
5659 (If setuid #! scripts would be secure but have been disabled anyway,
5660 don't say that they are secure if asked.)
5661
5662 EOM
5663
5664 val="$undef"
5665 if $test -d /dev/fd; then
5666         echo "#!$ls" >reflect
5667         chmod +x,u+s reflect
5668         ./reflect >flect 2>&1
5669         if $contains "/dev/fd" flect >/dev/null; then
5670                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5671                 val="$define"
5672         else
5673                 $cat <<EOM
5674 If you are not sure if they are secure, I can check but I'll need a
5675 username and password different from the one you are using right now.
5676 If you don't have such a username or don't want me to test, simply
5677 enter 'none'.
5678
5679 EOM
5680                 rp='Other username to test security of setuid scripts with?'
5681                 dflt='none'
5682                 . ./myread
5683                 case "$ans" in
5684                 n|none)
5685                         case "$d_suidsafe" in
5686                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5687                                 dflt=n;;
5688                         "$undef")
5689                                 echo "Well, the $hint value is *not* secure." >&4
5690                                 dflt=n;;
5691                         *)      echo "Well, the $hint value *is* secure." >&4
5692                                 dflt=y;;
5693                         esac
5694                         ;;
5695                 *)
5696                         $rm -f reflect flect
5697                         echo "#!$ls" >reflect
5698                         chmod +x,u+s reflect
5699                         echo >flect
5700                         chmod a+w flect
5701                         echo '"su" will (probably) prompt you for '"$ans's password."
5702                         su $ans -c './reflect >flect'
5703                         if $contains "/dev/fd" flect >/dev/null; then
5704                                 echo "Okay, it looks like setuid scripts are secure." >&4
5705                                 dflt=y
5706                         else
5707                                 echo "I don't think setuid scripts are secure." >&4
5708                                 dflt=n
5709                         fi
5710                         ;;
5711                 esac
5712                 rp='Does your kernel have *secure* setuid scripts?'
5713                 . ./myread
5714                 case "$ans" in
5715                 [yY]*)  val="$define";;
5716                 *)      val="$undef";;
5717                 esac
5718         fi
5719 else
5720         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5721         echo "(That's for file descriptors, not floppy disks.)"
5722         val="$undef"
5723 fi
5724 set d_suidsafe
5725 eval $setvar
5726
5727 $rm -f reflect flect
5728
5729 : now see if they want to do setuid emulation
5730 echo " "
5731 val="$undef"
5732 case "$d_suidsafe" in
5733 "$define")
5734         val="$undef"
5735         echo "No need to emulate SUID scripts since they are secure here." >& 4
5736         ;;
5737 *)
5738         $cat <<EOM
5739 Some systems have disabled setuid scripts, especially systems where
5740 setuid scripts cannot be secure.  On systems where setuid scripts have
5741 been disabled, the setuid/setgid bits on scripts are currently
5742 useless.  It is possible for $package to detect those bits and emulate
5743 setuid/setgid in a secure fashion.  This emulation will only work if
5744 setuid scripts have been disabled in your kernel.
5745
5746 EOM
5747         case "$d_dosuid" in
5748         "$define") dflt=y ;;
5749         *) dflt=n ;;
5750         esac
5751         rp="Do you want to do setuid/setgid emulation?"
5752         . ./myread
5753         case "$ans" in
5754         [yY]*)  val="$define";;
5755         *)      val="$undef";;
5756         esac
5757         ;;
5758 esac
5759 set d_dosuid
5760 eval $setvar
5761
5762 : determine filename position in cpp output
5763 echo " "
5764 echo "Computing filename position in cpp output for #include directives..." >&4
5765 echo '#include <stdio.h>' > foo.c
5766 $cat >fieldn <<EOF
5767 $startsh
5768 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5769 $grep '^[       ]*#.*stdio\.h' | \
5770 while read cline; do
5771         pos=1
5772         set \$cline
5773         while $test \$# -gt 0; do
5774                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5775                         echo "\$pos"
5776                         exit 0
5777                 fi
5778                 shift
5779                 pos=\`expr \$pos + 1\`
5780         done
5781 done
5782 EOF
5783 chmod +x fieldn
5784 fieldn=`./fieldn`
5785 $rm -f foo.c fieldn
5786 case $fieldn in
5787 '') pos='???';;
5788 1) pos=first;;
5789 2) pos=second;;
5790 3) pos=third;;
5791 *) pos="${fieldn}th";;
5792 esac
5793 echo "Your cpp writes the filename in the $pos field of the line."
5794
5795 : locate header file
5796 $cat >findhdr <<EOF
5797 $startsh
5798 wanted=\$1
5799 name=''
5800 for usrincdir in $usrinc
5801 do
5802         if test -f \$usrincdir/\$wanted; then
5803                 echo "\$usrincdir/\$wanted"
5804                 exit 0
5805         fi
5806 done
5807 awkprg='{ print \$$fieldn }'
5808 echo "#include <\$wanted>" > foo\$\$.c
5809 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5810 $grep "^[       ]*#.*\$wanted" | \
5811 while read cline; do
5812         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5813         case "\$name" in
5814         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5815         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5816         *) exit 2;;
5817         esac;
5818 done;
5819 #
5820 # status = 0: grep returned 0 lines, case statement not executed
5821 # status = 1: headerfile found
5822 # status = 2: while loop executed, no headerfile found
5823 #
5824 status=\$?
5825 $rm -f foo\$\$.c;
5826 if test \$status -eq 1; then
5827         exit 0;
5828 fi
5829 exit 1
5830 EOF
5831 chmod +x findhdr
5832
5833 : define an alternate in-header-list? function
5834 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5835 cont=true; xxf="echo \"<\$1> found.\" >&4";
5836 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5837 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5838 esac;
5839 case $# in 4) instead=instead;; *) instead="at last";; esac;
5840 while $test "$cont"; do
5841         xxx=`./findhdr $1`
5842         var=$2; eval "was=\$$2";
5843         if $test "$xxx" && $test -r "$xxx";
5844         then eval $xxf;
5845         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5846                 cont="";
5847         else eval $xxnf;
5848         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5849         set $yyy; shift; shift; yyy=$@;
5850         case $# in 0) cont="";;
5851         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5852                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5853         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5854                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5855         esac;
5856 done;
5857 while $test "$yyy";
5858 do set $yyy; var=$2; eval "was=\$$2";
5859         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5860         set $yyy; shift; shift; yyy=$@;
5861 done'
5862
5863 : see if this is a malloc.h system
5864 set malloc.h i_malloc
5865 eval $inhdr
5866
5867 : see if stdlib is available
5868 set stdlib.h i_stdlib
5869 eval $inhdr
5870
5871 : determine which malloc to compile in
5872 echo " "
5873 case "$usemymalloc" in
5874 ''|[yY]*|true|$define)  dflt='y' ;;
5875 *)      dflt='n' ;;
5876 esac
5877 rp="Do you wish to attempt to use the malloc that comes with $package?"
5878 . ./myread
5879 usemymalloc="$ans"
5880 case "$ans" in
5881 y*|true)
5882         usemymalloc='y'
5883         mallocsrc='malloc.c'
5884         mallocobj="malloc$_o"
5885         d_mymalloc="$define"
5886         case "$libs" in
5887         *-lmalloc*)
5888                 : Remove malloc from list of libraries to use
5889                 echo "Removing unneeded -lmalloc from library list" >&4
5890                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5891                 shift
5892                 libs="$*"
5893                 echo "libs = $libs" >&4
5894                 ;;
5895         esac
5896         ;;
5897 *)
5898         usemymalloc='n'
5899         mallocsrc=''
5900         mallocobj=''
5901         d_mymalloc="$undef"
5902         ;;
5903 esac
5904
5905 : compute the return types of malloc and free
5906 echo " "
5907 $cat >malloc.c <<END
5908 #$i_malloc I_MALLOC
5909 #$i_stdlib I_STDLIB
5910 #include <stdio.h>
5911 #include <sys/types.h>
5912 #ifdef I_MALLOC
5913 #include <malloc.h>
5914 #endif
5915 #ifdef I_STDLIB
5916 #include <stdlib.h>
5917 #endif
5918 #ifdef TRY_MALLOC
5919 void *malloc();
5920 #endif
5921 #ifdef TRY_FREE
5922 void free();
5923 #endif
5924 END
5925 case "$malloctype" in
5926 '')
5927         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5928                 malloctype='void *'
5929         else
5930                 malloctype='char *'
5931         fi
5932         ;;
5933 esac
5934 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5935
5936 case "$freetype" in
5937 '')
5938         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5939                 freetype='void'
5940         else
5941                 freetype='int'
5942         fi
5943         ;;
5944 esac
5945 echo "Your system uses $freetype free(), it would seem." >&4
5946 $rm -f malloc.[co]
5947 $cat <<EOM
5948
5949 After $package is installed, you may wish to install various
5950 add-on modules and utilities.  Typically, these add-ons will
5951 be installed under $prefix with the rest
5952 of this package.  However, you may wish to install such add-ons
5953 elsewhere under a different prefix.
5954
5955 If you do not wish to put everything under a single prefix, that's
5956 ok.  You will be prompted for the individual locations; this siteprefix
5957 is only used to suggest the defaults.
5958
5959 The default should be fine for most people.
5960
5961 EOM
5962 fn=d~+
5963 rp='Installation prefix to use for add-on modules and utilities?'
5964 : XXX Here might be another good place for an installstyle setting.
5965 case "$siteprefix" in
5966 '') dflt=$prefix ;;
5967 *)  dflt=$siteprefix ;;
5968 esac
5969 . ./getfile
5970 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5971 oldsiteprefix=''
5972 case "$siteprefix" in
5973 '') ;;
5974 *)      case "$ans" in
5975         "$prefix") ;;
5976         *) oldsiteprefix="$prefix";;
5977         esac
5978         ;;
5979 esac
5980 siteprefix="$ans"
5981 siteprefixexp="$ansexp"
5982
5983 : determine where site specific libraries go.
5984 : Usual default is /usr/local/lib/perl5/site_perl/$version
5985 : The default "style" setting is made in installstyle.U
5986 : XXX No longer works with Prefixit stuff.
5987 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5988 case "$sitelib" in
5989 '') case "$installstyle" in
5990         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5991         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5992         esac
5993         ;;
5994 *)      dflt="$sitelib"
5995         ;;
5996 esac
5997 $cat <<EOM
5998
5999 The installation process will create a directory for
6000 site-specific extensions and modules.  Most users find it convenient
6001 to place all site-specific files in this directory rather than in the
6002 main distribution directory.
6003
6004 EOM
6005 fn=d~+
6006 rp='Pathname for the site-specific library files?'
6007 . ./getfile
6008 sitelib="$ans"
6009 sitelibexp="$ansexp"
6010 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6011 : Change installation prefix, if necessary.
6012 if $test X"$prefix" != X"$installprefix"; then
6013         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6014 else
6015         installsitelib="$sitelibexp"
6016 fi
6017
6018 : determine where site specific architecture-dependent libraries go.
6019 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6020 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6021 : sitelib may have an optional trailing /share.
6022 case "$sitearch" in
6023 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6024         dflt="$dflt/$archname"
6025         ;;
6026 *)      dflt="$sitearch"
6027         ;;
6028 esac
6029 set sitearch sitearch none
6030 eval $prefixit
6031 $cat <<EOM
6032
6033 The installation process will also create a directory for
6034 architecture-dependent site-specific extensions and modules.
6035
6036 EOM
6037 fn=d~+
6038 rp='Pathname for the site-specific architecture-dependent library files?'
6039 . ./getfile
6040 sitearch="$ans"
6041 sitearchexp="$ansexp"
6042 : Change installation prefix, if necessary.
6043 if $test X"$prefix" != X"$installprefix"; then
6044         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6045 else
6046         installsitearch="$sitearchexp"
6047 fi
6048
6049 $cat <<EOM
6050
6051 The installation process will also create a directory for
6052 vendor-supplied add-ons.  Vendors who supply perl with their system
6053 may find it convenient to place all vendor-supplied files in this
6054 directory rather than in the main distribution directory.  This will
6055 ease upgrades between binary-compatible maintenance versions of perl.
6056
6057 Of course you may also use these directories in whatever way you see
6058 fit.  For example, you might use them to access modules shared over a
6059 company-wide network.
6060
6061 The default answer should be fine for most people.
6062 This causes further questions about vendor add-ons to be skipped
6063 and no vendor-specific directories will be configured for perl.
6064
6065 EOM
6066 rp='Do you want to configure vendor-specific add-on directories?'
6067 case "$usevendorprefix" in
6068 define|true|[yY]*) dflt=y ;;
6069 *)      : User may have set vendorprefix directly on Configure command line.
6070         case "$vendorprefix" in
6071         ''|' ') dflt=n ;;
6072         *)      dflt=y ;;
6073         esac
6074         ;;
6075 esac
6076 . ./myread
6077 case "$ans" in
6078 [yY]*)  fn=d~+
6079         rp='Installation prefix to use for vendor-supplied add-ons?'
6080         case "$vendorprefix" in
6081         '') dflt='' ;;
6082         *)  dflt=$vendorprefix ;;
6083         esac
6084         . ./getfile
6085         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6086         oldvendorprefix=''
6087         case "$vendorprefix" in
6088         '') ;;
6089         *)      case "$ans" in
6090                 "$prefix") ;;
6091                 *) oldvendorprefix="$prefix";;
6092                 esac
6093                 ;;
6094         esac
6095         usevendorprefix="$define"
6096         vendorprefix="$ans"
6097         vendorprefixexp="$ansexp"
6098         ;;
6099 *)      usevendorprefix="$undef"
6100         vendorprefix=''
6101         vendorprefixexp=''
6102         ;;
6103 esac
6104
6105 case "$vendorprefix" in
6106 '')     d_vendorlib="$undef"
6107         vendorlib=''
6108         vendorlibexp=''
6109         ;;
6110 *)      d_vendorlib="$define"
6111         : determine where vendor-supplied modules go.
6112         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6113         case "$vendorlib" in
6114         '')
6115                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6116                 case "$installstyle" in
6117                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6118                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6119                 esac
6120                 ;;
6121         *)      dflt="$vendorlib"
6122                 ;;
6123         esac
6124         fn=d~+
6125         rp='Pathname for the vendor-supplied library files?'
6126         . ./getfile
6127         vendorlib="$ans"
6128         vendorlibexp="$ansexp"
6129         ;;
6130 esac
6131 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6132 : Change installation prefix, if necessary.
6133 if $test X"$prefix" != X"$installprefix"; then
6134         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6135 else
6136         installvendorlib="$vendorlibexp"
6137 fi
6138
6139 case "$vendorprefix" in
6140 '')     d_vendorarch="$undef"
6141         vendorarch=''
6142         vendorarchexp=''
6143         ;;
6144 *)      d_vendorarch="$define"
6145         : determine where vendor-supplied architecture-dependent libraries go.
6146         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6147         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6148         : vendorlib may have an optional trailing /share.
6149         case "$vendorarch" in
6150         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6151                 dflt="$dflt/$archname"
6152                 ;;
6153         *)      dflt="$vendorarch" ;;
6154         esac
6155         fn=d~+
6156         rp='Pathname for vendor-supplied architecture-dependent files?'
6157         . ./getfile
6158         vendorarch="$ans"
6159         vendorarchexp="$ansexp"
6160         ;;
6161 esac
6162 : Change installation prefix, if necessary.
6163 if $test X"$prefix" != X"$installprefix"; then
6164         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6165 else
6166         installvendorarch="$vendorarchexp"
6167 fi
6168
6169 : Final catch-all directories to search
6170 $cat <<EOM
6171
6172 Lastly, you can have perl look in other directories for extensions and
6173 modules in addition to those already specified.
6174 These directories will be searched after 
6175         $sitearch 
6176         $sitelib 
6177 EOM
6178 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6179 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6180 echo ' '
6181 case "$otherlibdirs" in
6182 ''|' ') dflt='none' ;;
6183 *)      dflt="$otherlibdirs" ;;
6184 esac
6185 $cat <<EOM
6186 Enter a colon-separated set of extra paths to include in perl's @INC
6187 search path, or enter 'none' for no extra paths.
6188
6189 EOM
6190
6191 rp='Colon-separated list of additional directories for perl to search?'
6192 . ./myread
6193 case "$ans" in
6194 ' '|''|none)    otherlibdirs=' ' ;;     
6195 *)      otherlibdirs="$ans" ;;
6196 esac
6197 case "$otherlibdirs" in
6198 ' ') val=$undef ;;
6199 *)      val=$define ;;
6200 esac
6201 set d_perl_otherlibdirs
6202 eval $setvar
6203
6204 : Cruising for prototypes
6205 echo " "
6206 echo "Checking out function prototypes..." >&4
6207 $cat >prototype.c <<'EOCP'
6208 int main(int argc, char *argv[]) {
6209         exit(0);}
6210 EOCP
6211 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6212         echo "Your C compiler appears to support function prototypes."
6213         val="$define"
6214 else
6215         echo "Your C compiler doesn't seem to understand function prototypes."
6216         val="$undef"
6217 fi
6218 set prototype
6219 eval $setvar
6220 $rm -f prototype*
6221
6222 case "$prototype" in
6223 "$define") ;;
6224 *)      ansi2knr='ansi2knr'
6225         echo " "
6226         cat <<EOM >&4
6227
6228 $me:  FATAL ERROR:
6229 This version of $package can only be compiled by a compiler that 
6230 understands function prototypes.  Unfortunately, your C compiler 
6231         $cc $ccflags
6232 doesn't seem to understand them.  Sorry about that.
6233
6234 If GNU cc is available for your system, perhaps you could try that instead.  
6235
6236 Eventually, we hope to support building Perl with pre-ANSI compilers.
6237 If you would like to help in that effort, please contact <perlbug@perl.org>.
6238
6239 Aborting Configure now.
6240 EOM
6241         exit 2
6242         ;;
6243 esac
6244
6245 : determine where public executables go
6246 echo " "
6247 set dflt bin bin
6248 eval $prefixit
6249 fn=d~
6250 rp='Pathname where the public executables will reside?'
6251 . ./getfile
6252 if $test "X$ansexp" != "X$binexp"; then
6253         installbin=''
6254 fi
6255 bin="$ans"
6256 binexp="$ansexp"
6257 : Change installation prefix, if necessary.
6258 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6259 if $test X"$prefix" != X"$installprefix"; then
6260         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6261 else
6262         installbin="$binexp"
6263 fi
6264
6265 : Find perl5.005 or later.
6266 echo "Looking for a previously installed perl5.005 or later... "
6267 case "$perl5" in
6268 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6269                 : Check if this perl is recent and can load a simple module
6270                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6271                         perl5=$tdir/perl
6272                         break;
6273                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6274                         perl5=$tdir/perl
6275                         break;
6276                 fi
6277         done
6278         ;;
6279 *)      perl5="$perl5"
6280         ;;
6281 esac
6282 case "$perl5" in
6283 '')     echo "None found.  That's ok.";;
6284 *)      echo "Using $perl5." ;;
6285 esac
6286
6287 : Determine list of previous versions to include in @INC
6288 $cat > getverlist <<EOPL
6289 #!$perl5 -w
6290 use File::Basename;
6291 \$api_versionstring = "$api_versionstring";
6292 \$version = "$version";
6293 \$stem = "$sitelib_stem";
6294 \$archname = "$archname";
6295 EOPL
6296         $cat >> getverlist <<'EOPL'
6297 # Can't have leading @ because metaconfig interprets it as a command!
6298 ;@inc_version_list=();
6299 # XXX Redo to do opendir/readdir? 
6300 if (-d $stem) {
6301     chdir($stem);
6302     ;@candidates = glob("5.*");
6303 }
6304 else {
6305     ;@candidates = ();
6306 }
6307
6308 # XXX ToDo:  These comparisons must be reworked when two-digit
6309 # subversions come along, so that 5.7.10 compares as greater than
6310 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6311 # widespread that we can use the built-in version vectors rather
6312 # than reinventing them here.  For 5.6.0, however, we must
6313 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6314 foreach $d (@candidates) {
6315     if ($d lt $version) {
6316         if ($d ge $api_versionstring) {
6317             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6318         }
6319         elsif ($d ge "5.005") {
6320             unshift(@inc_version_list, grep { -d } $d);
6321         }
6322     }
6323     else {
6324         # Skip newer version.  I.e. don't look in
6325         # 5.7.0 if we're installing 5.6.1.
6326     }
6327 }
6328
6329 if (@inc_version_list) {
6330     print join(' ', @inc_version_list);
6331 }
6332 else {
6333     # Blank space to preserve value for next Configure run.
6334     print " ";
6335 }
6336 EOPL
6337 chmod +x getverlist
6338 case "$inc_version_list" in
6339 '')     if test -x "$perl5"; then
6340                 dflt=`$perl5 getverlist`
6341         else
6342                 dflt='none'
6343         fi
6344         ;;
6345 $undef) dflt='none' ;;
6346 *)  dflt="$inc_version_list" ;;
6347 esac
6348 case "$dflt" in
6349 ''|' ') dflt=none ;;
6350 esac
6351 case "$dflt" in
6352 5.005) case "$bincompat5005" in
6353        $define|true|[yY]*) ;;
6354        *) dflt=none ;;
6355        esac
6356        ;;
6357 esac
6358 $cat <<'EOM'
6359
6360 In order to ease the process of upgrading, this version of perl 
6361 can be configured to use modules built and installed with earlier 
6362 versions of perl that were installed under $prefix.  Specify here
6363 the list of earlier versions that this version of perl should check.
6364 If Configure detected no earlier versions of perl installed under
6365 $prefix, then the list will be empty.  Answer 'none' to tell perl
6366 to not search earlier versions.
6367
6368 The default should almost always be sensible, so if you're not sure,
6369 just accept the default.
6370 EOM
6371
6372 rp='List of earlier versions to include in @INC?'
6373 . ./myread
6374 case "$ans" in
6375 [Nn]one|''|' ') inc_version_list=' ' ;;
6376 *) inc_version_list="$ans" ;;
6377 esac
6378 case "$inc_version_list" in
6379 ''|' ') 
6380         inc_version_list_init='0';;
6381 *)      inc_version_list_init=`echo $inc_version_list |
6382                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6383         ;;
6384 esac
6385 $rm -f getverlist
6386
6387 : determine whether to install perl also as /usr/bin/perl
6388
6389 echo " "
6390 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6391         $cat <<EOM
6392 Many scripts expect perl to be installed as /usr/bin/perl.
6393 I can install the perl you are about to compile also as /usr/bin/perl
6394 (in addition to $installbin/perl).
6395 EOM
6396         case "$installusrbinperl" in
6397         "$undef"|[nN]*) dflt='n';;
6398         *)              dflt='y';;
6399         esac
6400         rp="Do you want to install perl as /usr/bin/perl?"
6401         . ./myread
6402         case "$ans" in
6403         [yY]*)  val="$define";;
6404         *)      val="$undef" ;;
6405         esac
6406 else
6407         val="$undef"
6408 fi
6409 set installusrbinperl
6410 eval $setvar
6411
6412 : see if dld is available
6413 set dld.h i_dld
6414 eval $inhdr
6415
6416 : see if dlopen exists
6417 xxx_runnm="$runnm"
6418 runnm=false
6419 set dlopen d_dlopen
6420 eval $inlibc
6421 runnm="$xxx_runnm"
6422
6423 : determine which dynamic loading, if any, to compile in
6424 echo " "
6425 dldir="ext/DynaLoader"
6426 case "$usedl" in
6427 $define|y|true)
6428         dflt='y'
6429         usedl="$define"
6430         ;;
6431 $undef|n|false)
6432         dflt='n'
6433         usedl="$undef"
6434         ;;
6435 *) 
6436         dflt='n'
6437         case "$d_dlopen" in
6438             $define) dflt='y' ;;
6439         esac
6440         case "$i_dld" in
6441             $define) dflt='y' ;;
6442         esac
6443         : Does a dl_xxx.xs file exist for this operating system
6444         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6445         ;;
6446 esac
6447 rp="Do you wish to use dynamic loading?"
6448 . ./myread
6449 usedl="$ans"
6450 case "$ans" in
6451 y*) usedl="$define"
6452         case "$dlsrc" in
6453         '')
6454                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6455                         dflt="$dldir/dl_${osname}.xs"
6456                 elif $test "$d_dlopen" = "$define" ; then
6457                         dflt="$dldir/dl_dlopen.xs"
6458                 elif $test "$i_dld" = "$define" ; then
6459                         dflt="$dldir/dl_dld.xs"
6460                 else
6461                         dflt=''
6462                 fi
6463                 ;;
6464         *)      dflt="$dldir/$dlsrc"
6465                 ;;
6466         esac
6467     echo "The following dynamic loading files are available:"
6468         : Can not go over to $dldir because getfile has path hard-coded in.
6469         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6470         rp="Source file to use for dynamic loading"
6471         fn="fne"
6472         gfpth="$src"
6473         . ./getfile
6474         usedl="$define"
6475         : emulate basename
6476         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6477
6478         $cat << EOM
6479
6480 Some systems may require passing special flags to $cc -c to
6481 compile modules that will be used to create a shared library.
6482 To use no flags, say "none".
6483
6484 EOM
6485     case "$cccdlflags" in
6486     '') case "$gccversion" in
6487                 '') case "$osname" in
6488                         hpux)   dflt='+z' ;;
6489                         next)   dflt='none' ;;
6490                         irix*)  dflt='-KPIC' ;;
6491                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6492                         sunos)  dflt='-pic' ;;
6493                         *)      dflt='none' ;;
6494                     esac
6495                         ;;
6496                 *)  case "$osname" in
6497                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6498                         *)      dflt='-fpic' ;;
6499                     esac ;;
6500             esac ;;
6501         ' ') dflt='none' ;;
6502     *)  dflt="$cccdlflags" ;;
6503     esac
6504     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6505     . ./myread
6506     case "$ans" in
6507     none) cccdlflags=' ' ;;
6508     *) cccdlflags="$ans" ;;
6509     esac
6510
6511     cat << EOM
6512
6513 Some systems use ld to create libraries that can be dynamically loaded,
6514 while other systems (such as those using ELF) use $cc.
6515
6516 EOM
6517         case "$ld" in
6518         '')     $cat >try.c <<'EOM'
6519 /* Test for whether ELF binaries are produced */
6520 #include <fcntl.h>
6521 #include <stdlib.h>
6522 int main() {
6523         char b[4];
6524         int i = open("a.out",O_RDONLY);
6525         if(i == -1) 
6526                 exit(1); /* fail */
6527         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6528                 exit(0); /* succeed (yes, it's ELF) */
6529         else
6530                 exit(1); /* fail */
6531 }
6532 EOM
6533                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6534                         cat <<EOM
6535 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6536 EOM
6537                         dflt="$cc"
6538                 else
6539                         echo "I'll use ld to build dynamic libraries."
6540                         dflt='ld'
6541                 fi
6542                 rm -f try.c a.out
6543                 ;;
6544         *)      dflt="$ld"
6545                 ;;
6546         esac
6547
6548     rp="What command should be used to create dynamic libraries?"
6549     . ./myread
6550         ld="$ans"
6551
6552     cat << EOM
6553
6554 Some systems may require passing special flags to $ld to create a
6555 library that can be dynamically loaded.  If your ld flags include
6556 -L/other/path options to locate libraries outside your loader's normal
6557 search path, you may need to specify those -L options here as well.  To
6558 use no flags, say "none".
6559
6560 EOM
6561     case "$lddlflags" in
6562     '') case "$osname" in
6563                         beos) dflt='-nostart' ;;
6564                         hpux) dflt='-b';
6565                               case "$gccversion" in
6566                               '') dflt="$dflt +vnocompatwarnings" ;;
6567                               esac
6568                               ;;        
6569                         linux|irix*)    dflt='-shared' ;;
6570                         next)  dflt='none' ;;
6571                         solaris) dflt='-G' ;;
6572                         sunos) dflt='-assert nodefinitions' ;;
6573                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6574                 *)     dflt='none' ;;
6575                         esac
6576                         ;;
6577     *) dflt="$lddlflags" ;;
6578     esac
6579
6580         : Try to guess additional flags to pick up local libraries.
6581         : Be careful not to append to a plain 'none'
6582         case "$dflt" in
6583         none) dflt='' ;;
6584         esac
6585         for thisflag in $ldflags; do
6586                 case "$thisflag" in
6587                 -L*|-R*)
6588                         case " $dflt " in
6589                         *" $thisflag "*) ;;
6590                         *) dflt="$dflt $thisflag" ;;
6591                         esac
6592                         ;;
6593                 esac
6594         done
6595
6596         case "$dflt" in
6597         ''|' ') dflt='none' ;;
6598         esac
6599
6600     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6601     . ./myread
6602     case "$ans" in
6603     none) lddlflags=' ' ;;
6604     *) lddlflags="$ans" ;;
6605     esac
6606
6607         cat <<EOM
6608
6609 Some systems may require passing special flags to $cc to indicate that
6610 the resulting executable will use dynamic linking.  To use no flags,
6611 say "none".
6612
6613 EOM
6614     case "$ccdlflags" in
6615     '') case "$osname" in
6616                 hpux)   dflt='-Wl,-E' ;;
6617                 linux)  dflt='-rdynamic' ;;
6618                 next)   dflt='none' ;;
6619                 sunos)  dflt='none' ;;
6620                 *)      dflt='none' ;;
6621             esac ;;
6622     ' ')  dflt='none' ;;
6623     *)  dflt="$ccdlflags" ;;
6624     esac
6625     rp="Any special flags to pass to $cc to use dynamic linking?"
6626     . ./myread
6627     case "$ans" in
6628     none) ccdlflags=' ' ;;
6629     *) ccdlflags="$ans" ;;
6630     esac
6631     ;;
6632 *)  usedl="$undef"
6633         ld='ld'
6634     dlsrc='dl_none.xs'
6635     lddlflags=''
6636     ccdlflags=''
6637     ;;
6638 esac
6639
6640 also=''
6641 case "$usedl" in
6642 $undef)
6643         # No dynamic loading being used, so don't bother even to prompt.
6644         useshrplib='false'
6645         ;;
6646 *)      case "$useshrplib" in
6647         '')     case "$osname" in
6648                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6649                         dflt=y
6650                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6651                         ;;
6652                 next*)
6653                         case "$osvers" in
6654                         4*)     dflt=y
6655                                 also='Building a shared libperl is needed for MAB support.'
6656                                 ;;
6657                         *)      dflt=n
6658                                 ;;
6659                         esac
6660                         ;;
6661                 *)      dflt=n
6662                         ;;
6663                 esac
6664                 ;;
6665         $define|true|[Yy]*)
6666                 dflt=y
6667                 ;;
6668         *)      dflt=n
6669                 ;;
6670         esac
6671         $cat << EOM
6672
6673 The perl executable is normally obtained by linking perlmain.c with
6674 libperl${_a}, any static extensions (usually just DynaLoader), and
6675 any other libraries needed on this system (such as -lm, etc.).  Since
6676 your system supports dynamic loading, it is probably possible to build
6677 a shared libperl.$so.  If you will have more than one executable linked
6678 to libperl.$so, this will significantly reduce the size of each
6679 executable, but it may have a noticeable affect on performance.  The
6680 default is probably sensible for your system.
6681 $also
6682
6683 EOM
6684         rp="Build a shared libperl.$so (y/n)"
6685         . ./myread
6686         case "$ans" in
6687         true|$define|[Yy]*)
6688                 useshrplib='true'  ;;
6689         *)      useshrplib='false' ;;
6690         esac
6691         ;;
6692 esac
6693
6694 case "$useshrplib" in
6695 true)
6696         case "$libperl" in
6697         '')
6698                 # Figure out a good name for libperl.so.  Since it gets stored in
6699                 # a version-specific architecture-dependent library, the version
6700                 # number isn't really that important, except for making cc/ld happy.
6701                 #
6702                 # A name such as libperl.so.3.1
6703                 majmin="libperl.$so.$patchlevel.$subversion"
6704                 # A name such as libperl.so.301
6705                 majonly=`echo $patchlevel $subversion |
6706                         $awk '{printf "%d%02d", $1, $2}'`
6707                 majonly=libperl.$so.$majonly
6708                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6709                 # rely on figuring it out from the naming of libc.
6710                 case "${osname}${osvers}" in
6711                 next4*)
6712                         dflt=libperl.5.$so
6713                         # XXX How handle the --version stuff for MAB?
6714                         ;;
6715                 linux*)  # ld won't link with a bare -lperl otherwise.
6716                         dflt=libperl.$so
6717                         ;;
6718                 cygwin*) # include version
6719                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6720                         ;;
6721                 *)      # Try to guess based on whether libc has major.minor.
6722                         case "$libc" in
6723                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6724                         *libc.$so.[0-9]*) dflt=$majonly ;;
6725                         *)      dflt=libperl.$so ;;
6726                         esac
6727                         ;;
6728                 esac
6729                 ;;
6730         *)      dflt=$libperl
6731                 ;;
6732         esac
6733         cat << EOM
6734
6735 I need to select a good name for the shared libperl.  If your system uses
6736 library names with major and minor numbers, then you might want something
6737 like $majmin.  Alternatively, if your system uses a single version
6738 number for shared libraries, then you might want to use $majonly.
6739 Or, your system might be quite happy with a simple libperl.$so.
6740
6741 Since the shared libperl will get installed into a version-specific
6742 architecture-dependent directory, the version number of the shared perl
6743 library probably isn't important, so the default should be o.k.
6744
6745 EOM
6746         rp='What name do you want to give to the shared libperl?'
6747         . ./myread
6748         libperl=$ans
6749         echo "Ok, I'll use $libperl"
6750         ;;
6751 *)
6752         libperl="libperl${_a}"
6753         ;;
6754 esac
6755
6756 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6757 case "$shrpdir" in
6758 '') ;;
6759 *)      $cat >&4 <<EOM
6760 WARNING:  Use of the shrpdir variable for the installation location of
6761 the shared $libperl is not supported.  It was never documented and
6762 will not work in this version.  Let me (perlbug@perl.org)
6763 know of any problems this may cause.
6764
6765 EOM
6766         case "$shrpdir" in
6767         "$archlibexp/CORE")
6768                 $cat >&4 <<EOM
6769 But your current setting of $shrpdir is
6770 the default anyway, so it's harmless.
6771 EOM
6772                 ;;
6773         *)
6774                 $cat >&4 <<EOM
6775 Further, your current attempted setting of $shrpdir
6776 conflicts with the value of $archlibexp/CORE
6777 that installperl will use.
6778 EOM
6779                 ;;
6780         esac
6781         ;;
6782 esac
6783
6784 # How will the perl executable find the installed shared $libperl?
6785 # Add $xxx to ccdlflags.
6786 # If we can't figure out a command-line option, use $shrpenv to
6787 # set env LD_RUN_PATH.  The main perl makefile uses this.
6788 shrpdir=$archlibexp/CORE
6789 xxx=''
6790 tmp_shrpenv=''
6791 if "$useshrplib"; then
6792     case "$osname" in 
6793         aix)
6794                 # We'll set it in Makefile.SH...
6795                 ;;
6796         solaris|netbsd)
6797                 xxx="-R $shrpdir"
6798                 ;;
6799         freebsd)
6800                 xxx="-Wl,-R$shrpdir"
6801                 ;;
6802         linux|irix*|dec_osf)
6803                 xxx="-Wl,-rpath,$shrpdir"
6804                 ;;
6805         next)
6806                 # next doesn't like the default...
6807                 ;;
6808         beos)
6809                 # beos doesn't like the default, either.
6810                 ;;
6811         hpux*)
6812                 # hpux doesn't like the default, either.
6813                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6814                 ;;
6815         *)
6816                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6817                 ;;
6818         esac
6819         case "$xxx" in
6820         '') ;;
6821         *)      
6822                 # Only add $xxx if it isn't already in ccdlflags.
6823                 case " $ccdlflags " in
6824                 *" $xxx "*)     ;;
6825                 *)      ccdlflags="$ccdlflags $xxx"
6826                         cat <<EOM >&4
6827
6828 Adding $xxx to the flags
6829 passed to $ld so that the perl executable will find the 
6830 installed shared $libperl.
6831
6832 EOM
6833                         ;;
6834                 esac
6835                 ;;
6836         esac
6837 fi
6838 # Fix ccdlflags in AIX for building external extensions.
6839 # (For building Perl itself bare -bE:perl.exp is needed,
6840 #  Makefile.SH takes care of this.)
6841 case "$osname" in
6842 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6843 esac
6844 # Respect a hint or command-line value.
6845 case "$shrpenv" in
6846 '') shrpenv="$tmp_shrpenv" ;;
6847 esac
6848 case "$ldlibpthname" in
6849 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6850 none)   ldlibpthname='' ;;
6851 esac
6852
6853 : determine where manual pages are on this system
6854 echo " "
6855 case "$sysman" in
6856 '') 
6857         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6858         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6859         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6860         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6861         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6862         sysman=`./loc . /usr/man/man1 $syspath`
6863         ;;
6864 esac
6865 if $test -d "$sysman"; then
6866         echo "System manual is in $sysman." >&4
6867 else
6868         echo "Could not find manual pages in source form." >&4
6869 fi
6870
6871 : determine where manual pages go
6872 set man1dir man1dir none
6873 eval $prefixit
6874 $cat <<EOM
6875
6876 $spackage has manual pages available in source form.
6877 EOM
6878 case "$nroff" in
6879 nroff)
6880         echo "However, you don't have nroff, so they're probably useless to you."
6881         case "$man1dir" in
6882         '') man1dir="none";;
6883         esac;;
6884 esac
6885 echo "If you don't want the manual sources installed, answer 'none'."
6886 case "$man1dir" in
6887 ' ') dflt=none
6888         ;;
6889 '')
6890         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6891         lookpath="$lookpath $prefixexp/man/p_man/man1"
6892         lookpath="$lookpath $prefixexp/man/u_man/man1"
6893         lookpath="$lookpath $prefixexp/man/man.1"
6894         case "$sysman" in
6895         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6896         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6897         esac
6898         set dflt
6899         eval $prefixup
6900         ;;
6901 *)  dflt="$man1dir"
6902         ;;
6903 esac
6904 echo " "
6905 fn=dn+~
6906 rp="Where do the main $spackage manual pages (source) go?"
6907 . ./getfile
6908 if $test "X$man1direxp" != "X$ansexp"; then
6909         installman1dir=''
6910 fi
6911 man1dir="$ans"
6912 man1direxp="$ansexp"
6913 case "$man1dir" in
6914 '')     man1dir=' '
6915         installman1dir='';;
6916 esac
6917
6918 : Change installation prefix, if necessary.
6919 if $test X"$prefix" != X"$installprefix"; then
6920         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6921 else
6922         installman1dir="$man1direxp"
6923 fi
6924
6925 : What suffix to use on installed man pages
6926
6927 case "$man1dir" in
6928 ' ')
6929         man1ext='0'
6930         ;;
6931 *)
6932         rp="What suffix should be used for the main $spackage man pages?"
6933         case "$man1ext" in
6934         '')     case "$man1dir" in
6935                 *1)  dflt=1 ;;
6936                 *1p) dflt=1p ;;
6937                 *1pm) dflt=1pm ;;
6938                 *l) dflt=l;;
6939                 *n) dflt=n;;
6940                 *o) dflt=o;;
6941                 *p) dflt=p;;
6942                 *C) dflt=C;;
6943                 *L) dflt=L;;
6944                 *L1) dflt=L1;;
6945                 *) dflt=1;;
6946                 esac
6947                 ;;
6948         *)      dflt="$man1ext";;
6949         esac
6950         . ./myread
6951         man1ext="$ans"
6952         ;;
6953 esac
6954
6955 : see if we can have long filenames
6956 echo " "
6957 first=123456789abcdef
6958 $rm -f $first
6959 if (echo hi >$first) 2>/dev/null; then
6960         if $test -f 123456789abcde; then
6961                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6962                 val="$undef"
6963         else
6964                 echo 'You can have filenames longer than 14 characters.'>&4
6965                 val="$define"
6966         fi
6967 else
6968         $cat <<'EOM'
6969 You can't have filenames longer than 14 chars.
6970 You can't even think about them!
6971 EOM
6972         val="$undef"
6973 fi 
6974 set d_flexfnam
6975 eval $setvar
6976 $rm -rf 123456789abcde*
6977
6978 : determine where library module manual pages go
6979 set man3dir man3dir none
6980 eval $prefixit
6981 $cat <<EOM
6982
6983 $spackage has manual pages for many of the library modules.
6984 EOM
6985
6986 case "$nroff" in
6987 nroff)
6988         $cat <<'EOM'
6989 However, you don't have nroff, so they're probably useless to you.
6990 EOM
6991         case "$man3dir" in
6992         '') man3dir="none";;
6993         esac;;
6994 esac
6995
6996 case "$d_flexfnam" in
6997 undef)
6998         $cat <<'EOM'
6999 However, your system can't handle the long file names like File::Basename.3. 
7000 EOM
7001         case "$man3dir" in
7002         '') man3dir="none";;
7003         esac;;
7004 esac
7005
7006 echo "If you don't want the manual sources installed, answer 'none'."
7007 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7008 case "$man3dir" in
7009 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7010         if $test -d "$privlib/man/man3"; then
7011                 cat <<EOM >&4
7012
7013 WARNING:  Previous versions of perl installed man3 pages into
7014 $privlib/man/man3.  This version will suggest a 
7015 new default of $dflt.  
7016 EOM
7017                 tdflt=$dflt
7018                 dflt='n'
7019                 rp='Do you wish to preserve the old behavior?(y/n)'
7020                 . ./myread
7021                 case "$ans" in
7022                 y*) dflt="$privlib/man/man3" ;;
7023                 *)  dflt=$tdflt ;;
7024                 esac
7025     fi
7026         ;;
7027 *)      dflt="$man3dir" ;;
7028 esac
7029 case "$dflt" in
7030 ' ') dflt=none ;;
7031 esac
7032 echo " "
7033 fn=dn+~
7034 rp="Where do the $package library man pages (source) go?"
7035 . ./getfile
7036 man3dir="$ans"
7037 man3direxp="$ansexp"
7038 case "$man3dir" in
7039 '')     man3dir=' '
7040         installman3dir='';;
7041 esac
7042
7043 : Change installation prefix, if necessary.
7044 if $test X"$prefix" != X"$installprefix"; then
7045         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7046 else
7047         installman3dir="$man3direxp"
7048 fi
7049
7050 : What suffix to use on installed man pages
7051 case "$man3dir" in
7052 ' ')
7053         man3ext='0'
7054         ;;
7055 *)
7056         rp="What suffix should be used for the $package library man pages?"
7057         case "$man3ext" in
7058         '')     case "$man3dir" in
7059                 *3)  dflt=3 ;;
7060                 *3p) dflt=3p ;;
7061                 *3pm) dflt=3pm ;;
7062                 *l) dflt=l;;
7063                 *n) dflt=n;;
7064                 *o) dflt=o;;
7065                 *p) dflt=p;;
7066                 *C) dflt=C;;
7067                 *L) dflt=L;;
7068                 *L3) dflt=L3;;
7069                 *) dflt=3;;
7070                 esac
7071                 ;;
7072         *)      dflt="$man3ext";;
7073         esac
7074         . ./myread
7075         man3ext="$ans"
7076         ;;
7077 esac
7078
7079 : see if we have to deal with yellow pages, now NIS.
7080 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7081         if $test -f /usr/etc/nibindd; then
7082                 echo " "
7083                 echo "I'm fairly confident you're on a NeXT."
7084                 echo " "
7085                 rp='Do you get the hosts file via NetInfo?'
7086                 dflt=y
7087                 case "$hostcat" in
7088                 nidump*) ;;
7089                 '') ;;
7090                 *) dflt=n;;
7091                 esac
7092                 . ./myread
7093                 case "$ans" in
7094                 y*) hostcat='nidump hosts .';;
7095                 *)      case "$hostcat" in
7096                         nidump*) hostcat='';;
7097                         esac
7098                         ;;
7099                 esac
7100         fi
7101         case "$hostcat" in
7102         nidump*) ;;
7103         *)
7104                 case "$hostcat" in
7105                 *ypcat*) dflt=y;;
7106                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7107                                 dflt=y
7108                         else
7109                                 dflt=n
7110                         fi;;
7111                 *) dflt=n;;
7112                 esac
7113                 echo " "
7114                 rp='Are you getting the hosts file via yellow pages?'
7115                 . ./myread
7116                 case "$ans" in
7117                 y*) hostcat='ypcat hosts';;
7118                 *) hostcat='cat /etc/hosts';;
7119                 esac
7120                 ;;
7121         esac
7122 fi
7123 case "$hostcat" in
7124 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7125 esac
7126 case "$groupcat" in
7127 '') test -f /etc/group && groupcat='cat /etc/group';;
7128 esac
7129 case "$passcat" in
7130 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7131 esac
7132
7133 : now get the host name
7134 echo " "
7135 echo "Figuring out host name..." >&4
7136 case "$myhostname" in
7137 '') cont=true
7138         echo 'Maybe "hostname" will work...'
7139         if tans=`$sh_c hostname 2>&1` ; then
7140                 myhostname=$tans
7141                 phostname=hostname
7142                 cont=''
7143         fi
7144         ;;
7145 *) cont='';;
7146 esac
7147 if $test "$cont"; then
7148         if ./xenix; then
7149                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7150                 if tans=`cat /etc/systemid 2>&1` ; then
7151                         myhostname=$tans
7152                         phostname='cat /etc/systemid'
7153                         echo "Whadyaknow.  Xenix always was a bit strange..."
7154                         cont=''
7155                 fi
7156         elif $test -r /etc/systemid; then
7157                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7158         fi
7159 fi
7160 if $test "$cont"; then
7161         echo 'No, maybe "uuname -l" will work...'
7162         if tans=`$sh_c 'uuname -l' 2>&1` ; then
7163                 myhostname=$tans
7164                 phostname='uuname -l'
7165         else
7166                 echo 'Strange.  Maybe "uname -n" will work...'
7167                 if tans=`$sh_c 'uname -n' 2>&1` ; then
7168                         myhostname=$tans
7169                         phostname='uname -n'
7170                 else
7171                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7172                         if tans=`$sh_c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7173                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7174                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7175                         else
7176                                 case "$myhostname" in
7177                                 '') echo "Does this machine have an identity crisis or something?"
7178                                         phostname='';;
7179                                 *)
7180                                         echo "Well, you said $myhostname before..."
7181                                         phostname='echo $myhostname';;
7182                                 esac
7183                         fi
7184                 fi
7185         fi
7186 fi
7187 : you do not want to know about this
7188 set $myhostname
7189 myhostname=$1
7190
7191 : verify guess
7192 if $test "$myhostname" ; then
7193         dflt=y
7194         rp='Your host name appears to be "'$myhostname'".'" Right?"
7195         . ./myread
7196         case "$ans" in
7197         y*) ;;
7198         *) myhostname='';;
7199         esac
7200 fi
7201
7202 : bad guess or no guess
7203 while $test "X$myhostname" = X ; do
7204         dflt=''
7205         rp="Please type the (one word) name of your host:"
7206         . ./myread
7207         myhostname="$ans"
7208 done
7209
7210 : translate upper to lower if necessary
7211 case "$myhostname" in
7212 *[A-Z]*)
7213         echo "(Normalizing case in your host name)"
7214         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7215         ;;
7216 esac
7217
7218 case "$myhostname" in
7219 *.*)
7220         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7221         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7222         echo "(Trimming domain name from host name--host name is now $myhostname)"
7223         ;;
7224 *) case "$mydomain" in
7225         '')
7226                 {
7227                         test "X$hostcat" = "Xypcat hosts" &&
7228                         ypmatch "$myhostname" hosts 2>/dev/null |\
7229                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7230                         $test -s hosts
7231                 } || {
7232                         test "X$hostcat" != "X" &&
7233                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7234                                         /[       ]$myhostname[  . ]/p" > hosts
7235                 }
7236                 tmp_re="[       . ]"
7237                 if $test -f hosts; then
7238                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7239                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7240                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7241                                 hosts | $sort | $uniq | \
7242                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7243                         case `$echo X$dflt` in
7244                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7245                                 dflt=.
7246                                 ;;
7247                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7248                                 ;;
7249                         esac
7250                 else
7251                         echo "(I cannot locate a hosts database anywhere)"
7252                         dflt=.
7253                 fi
7254                 case "$dflt" in
7255                 .)
7256                         tans=`./loc resolv.conf X /etc /usr/etc`
7257                         if $test -f "$tans"; then
7258                                 echo "(Attempting domain name extraction from $tans)"
7259                                 dflt=.`$sed -n -e 's/   / /g' \
7260                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7261                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7262                                 case "$dflt" in
7263                                 .) dflt=.`$sed -n -e 's/        / /g' \
7264                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7265                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7266                                         ;;
7267                                 esac
7268                         fi
7269                         ;;
7270                 esac
7271                 case "$dflt" in
7272                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7273                         dflt=.`$sh_c domainname 2>/dev/null`
7274                         case "$dflt" in
7275                         '') dflt='.';;
7276                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7277                         esac
7278                         ;;
7279                 esac
7280                 case "$dflt" in
7281                 .) echo "(Lost all hope -- silly guess then)"
7282                         dflt='.uucp'
7283                         ;;
7284                 esac
7285                 $rm -f hosts
7286                 ;;
7287         *) dflt="$mydomain";;
7288         esac;;
7289 esac
7290 echo " "
7291 rp="What is your domain name?"
7292 . ./myread
7293 tans="$ans"
7294 case "$ans" in
7295 '') ;;
7296 .*) ;;
7297 *) tans=".$tans";;
7298 esac
7299 mydomain="$tans"
7300
7301 : translate upper to lower if necessary
7302 case "$mydomain" in
7303 *[A-Z]*)
7304         echo "(Normalizing case in your domain name)"
7305         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7306         ;;
7307 esac
7308
7309 : a little sanity check here
7310 case "$phostname" in
7311 '') ;;
7312 *)
7313         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7314         $myhostname$mydomain|$myhostname) ;;
7315         *)
7316                 case "$phostname" in
7317                 sed*)
7318                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7319                         ;;
7320                 *)
7321                         echo "(That doesn't agree with your $phostname command, by the way.)"
7322                         ;;
7323                 esac
7324         ;;
7325         esac
7326         ;;
7327 esac
7328
7329 $cat <<EOM
7330
7331 I need to get your e-mail address in Internet format if possible, i.e.
7332 something like user@host.domain. Please answer accurately since I have
7333 no easy means to double check it. The default value provided below
7334 is most probably close to reality but may not be valid from outside
7335 your organization...
7336
7337 EOM
7338 cont=x
7339 while test "$cont"; do
7340         case "$cf_email" in
7341         '') dflt="$cf_by@$myhostname$mydomain";;
7342         *) dflt="$cf_email";;
7343         esac
7344         rp='What is your e-mail address?'
7345         . ./myread
7346         cf_email="$ans"
7347         case "$cf_email" in
7348         *@*.*) cont='' ;;
7349         *)
7350                 rp='Address does not look like an Internet one.  Use it anyway?'
7351                 case "$fastread" in
7352                 yes) dflt=y ;;
7353                 *) dflt=n ;;
7354                 esac
7355                 . ./myread
7356                 case "$ans" in
7357                 y*) cont='' ;;
7358                 *) echo " " ;;
7359                 esac
7360                 ;;
7361         esac
7362 done
7363
7364 $cat <<EOM
7365
7366 If you or somebody else will be maintaining perl at your site, please
7367 fill in the correct e-mail address here so that they may be contacted
7368 if necessary. Currently, the "perlbug" program included with perl
7369 will send mail to this address in addition to perlbug@perl.org. You may
7370 enter "none" for no administrator.
7371
7372 EOM
7373 case "$perladmin" in
7374 '') dflt="$cf_email";;
7375 *) dflt="$perladmin";;
7376 esac
7377 rp='Perl administrator e-mail address'
7378 . ./myread
7379 perladmin="$ans"
7380
7381 : determine whether to only install version-specific parts.
7382 echo " "
7383 $cat <<EOM
7384 Do you want to install only the version-specific parts of the perl
7385 distribution?  Usually you do *not* want to do this.
7386 EOM
7387 case "$versiononly" in
7388 "$define"|[Yy]*|true) dflt='y' ;;
7389 *) dflt='n';
7390 esac
7391 rp="Do you want to install only the version-specific parts of perl?"
7392 . ./myread
7393 case "$ans" in
7394 [yY]*)  val="$define";;
7395 *)      val="$undef" ;;
7396 esac
7397 set versiononly
7398 eval $setvar
7399
7400 : figure out how to guarantee perl startup
7401 case "$startperl" in
7402 '')
7403         case "$sharpbang" in
7404         *!)
7405                 $cat <<EOH
7406
7407 I can use the #! construct to start perl on your system. This will
7408 make startup of perl scripts faster, but may cause problems if you
7409 want to share those scripts and perl is not in a standard place
7410 ($binexp/perl) on all your platforms. The alternative is to force
7411 a shell by starting the script with a single ':' character.
7412
7413 EOH
7414                 case "$versiononly" in
7415                 "$define")      dflt="$binexp/perl$version";;  
7416                 *)              dflt="$binexp/perl";;
7417                 esac
7418                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7419                 . ./myread
7420                 case "$ans" in
7421                 none)   startperl=": # use perl";;
7422                 *)      startperl="#!$ans"
7423                         if $test 30 -lt `echo "$ans" | wc -c`; then
7424                                 $cat >&4 <<EOM
7425
7426 WARNING:  Some systems limit the #! command to 32 characters.
7427 If you experience difficulty running Perl scripts with #!, try
7428 installing Perl in a directory with a shorter pathname.
7429
7430 EOM
7431                         fi ;;
7432                 esac
7433                 ;;
7434         *) startperl=": # use perl"
7435                 ;;
7436         esac
7437         ;;
7438 esac
7439 echo "I'll use $startperl to start perl scripts."
7440
7441 : figure best path for perl in scripts
7442 case "$perlpath" in
7443 '')
7444         perlpath="$binexp/perl"
7445         case "$startperl" in
7446         *!*) ;;
7447         *)
7448                 $cat <<EOH
7449
7450 I will use the "eval 'exec'" idiom to start Perl on your system.
7451 I can use the full path of your Perl binary for this purpose, but
7452 doing so may cause problems if you want to share those scripts and
7453 Perl is not always in a standard place ($binexp/perl).
7454
7455 EOH
7456                 dflt="$binexp/perl"
7457                 rp="What path shall I use in \"eval 'exec'\"?"
7458                 . ./myread
7459                 perlpath="$ans"
7460                 ;;
7461         esac
7462         ;;
7463 esac
7464 case "$startperl" in
7465 *!*)    ;;
7466 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7467 esac
7468
7469 : determine where public executable scripts go
7470 set scriptdir scriptdir
7471 eval $prefixit
7472 case "$scriptdir" in
7473 '')
7474         dflt="$bin"
7475         : guess some guesses
7476         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7477         $test -d /usr/share/bin     && dflt=/usr/share/bin
7478         $test -d /usr/local/script  && dflt=/usr/local/script
7479         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7480         $test -d $prefixexp/script  && dflt=$prefixexp/script
7481         set dflt
7482         eval $prefixup
7483         ;;
7484 *)  dflt="$scriptdir"
7485         ;;
7486 esac
7487 $cat <<EOM
7488  
7489 Some installations have a separate directory just for executable scripts so
7490 that they can mount it across multiple architectures but keep the scripts in
7491 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7492 Or you might just lump your scripts in with all your other executables.
7493  
7494 EOM
7495 fn=d~
7496 rp='Where do you keep publicly executable scripts?'
7497 . ./getfile
7498 if $test "X$ansexp" != "X$scriptdirexp"; then
7499         installscript=''
7500 fi
7501 scriptdir="$ans"
7502 scriptdirexp="$ansexp"
7503 : Change installation prefix, if necessary.
7504 if $test X"$prefix" != X"$installprefix"; then
7505         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7506 else
7507         installscript="$scriptdirexp"
7508 fi
7509
7510 : determine where add-on public executables go
7511 case "$sitebin" in
7512 '')     dflt=$siteprefix/bin ;;
7513 *)      dflt=$sitebin ;;
7514 esac
7515 fn=d~
7516 rp='Pathname where the add-on public executables should be installed?'
7517 . ./getfile
7518 sitebin="$ans"
7519 sitebinexp="$ansexp"
7520 : Change installation prefix, if necessary.
7521 if $test X"$prefix" != X"$installprefix"; then
7522         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7523 else
7524         installsitebin="$sitebinexp"
7525 fi
7526
7527 case "$useperlio" in
7528 $define|true|[yY]*)     dflt='y';;
7529 *) dflt='n';;
7530 esac
7531 cat <<EOM
7532
7533 Previous version of $package used the standard IO mechanisms as
7534 defined in <stdio.h>.  Versions 5.003_02 and later of perl allow
7535 alternate IO mechanisms via the PerlIO abstraction layer, but the
7536 stdio mechanism is still the default.  This abstraction layer can
7537 use AT&T's sfio (if you already have sfio installed) or regular stdio.
7538 Using PerlIO with sfio may cause problems with some extension modules.
7539
7540 If this doesn't make any sense to you, just accept the default '$dflt'.
7541 EOM
7542 rp='Use the experimental PerlIO abstraction layer?'
7543 . ./myread
7544 case "$ans" in
7545 y|Y) 
7546         val="$define"
7547         ;;     
7548 *)      
7549         echo "Ok, doing things the stdio way."
7550         val="$undef"
7551         ;;
7552 esac
7553 set useperlio
7554 eval $setvar 
7555
7556 case "$usesocks" in
7557 $define|true|[yY]*)
7558         case "$useperlio" in
7559         $define|true|[yY]*) ;;
7560         *)      cat >&4 <<EOM
7561
7562 You are using the SOCKS proxy protocol library which means that you
7563 should also use the PerlIO layer.  You may be headed for trouble.
7564
7565 EOM
7566                 ;;
7567         esac
7568         ;;
7569 esac
7570
7571         
7572 case "$vendorprefix" in
7573 '')     d_vendorbin="$undef"
7574         vendorbin=''
7575         vendorbinexp=''
7576         ;;
7577 *)      d_vendorbin="$define"
7578         : determine where vendor-supplied executables go.
7579         case "$vendorbin" in
7580         '') dflt=$vendorprefix/bin ;;
7581         *)      dflt="$vendorbin" ;;
7582         esac
7583         fn=d~+
7584         rp='Pathname for the vendor-supplied executables directory?'
7585         . ./getfile
7586         vendorbin="$ans"
7587         vendorbinexp="$ansexp"
7588         ;;
7589 esac
7590 : Change installation prefix, if necessary.
7591 if $test X"$prefix" != X"$installprefix"; then
7592         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7593 else
7594         installvendorbin="$vendorbinexp"
7595 fi
7596
7597 : see if qgcvt exists
7598 set qgcvt d_qgcvt
7599 eval $inlibc
7600
7601 echo " "
7602
7603 if $test X"$d_longdbl" = X"$define"; then
7604
7605 echo "Checking how to print long doubles..." >&4
7606
7607 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7608         $cat >try.c <<'EOCP'
7609 #include <sys/types.h>
7610 #include <stdio.h>
7611 int main() {
7612   double d = 123.456;
7613   printf("%.3f\n", d);
7614 }
7615 EOCP
7616         set try
7617         if eval $compile; then
7618                 yyy=`./try$exe_ext`
7619                 case "$yyy" in
7620                 123.456)
7621                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7622                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7623                         echo "We will use %f."
7624                         ;;
7625                 esac
7626         fi
7627 fi
7628
7629 if $test X"$sPRIfldbl" = X; then
7630         $cat >try.c <<'EOCP'
7631 #include <sys/types.h>
7632 #include <stdio.h>
7633 int main() {
7634   long double d = 123.456;
7635   printf("%.3llf\n", d);
7636 }
7637 EOCP
7638         set try
7639         if eval $compile; then
7640                 yyy=`./try$exe_ext`
7641                 case "$yyy" in
7642                 123.456)
7643                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7644                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7645                         echo "We will use %llf."
7646                         ;;
7647                 esac
7648         fi
7649 fi
7650
7651 if $test X"$sPRIfldbl" = X; then
7652         $cat >try.c <<'EOCP'
7653 #include <sys/types.h>
7654 #include <stdio.h>
7655 int main() {
7656   long double d = 123.456;
7657   printf("%.3Lf\n", d);
7658 }
7659 EOCP
7660         set try
7661         if eval $compile; then
7662                 yyy=`./try$exe_ext`
7663                 case "$yyy" in
7664                 123.456)
7665                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7666                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7667                         echo "We will use %Lf."
7668                         ;;
7669                 esac
7670         fi
7671 fi
7672
7673 if $test X"$sPRIfldbl" = X; then
7674         $cat >try.c <<'EOCP'
7675 #include <sys/types.h>
7676 #include <stdio.h>
7677 int main() {
7678   long double d = 123.456;
7679   printf("%.3lf\n", d);
7680 }
7681 EOCP
7682         set try
7683         if eval $compile; then
7684                 yyy=`./try$exe_ext`
7685                 case "$yyy" in
7686                 123.456)
7687                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7688                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7689                         echo "We will use %lf."
7690                         ;;
7691                 esac
7692         fi
7693 fi
7694
7695 if $test X"$sPRIfldbl" = X; then
7696         echo "Cannot figure out how to print long doubles." >&4
7697 else
7698         sSCNfldbl=$sPRIfldbl    # expect consistency
7699 fi
7700
7701 $rm -f try try.*
7702
7703 fi # d_longdbl
7704
7705 case "$sPRIfldbl" in
7706 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7707         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7708         d_SCNfldbl="$undef";
7709         ;;
7710 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7711         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7712         d_SCNfldbl="$define";
7713         ;;
7714 esac
7715
7716 : Check how to convert floats to strings.
7717 echo " "
7718 echo "Checking for an efficient way to convert floats to strings."
7719 echo " " > try.c
7720 case "$uselongdouble" in
7721 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7722 esac
7723 case "$d_longdbl" in
7724 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7725 esac
7726 case "$d_PRIgldbl" in
7727 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7728 esac
7729 $cat >>try.c <<EOP
7730 #ifdef TRY_gconvert
7731 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7732 char *myname = "gconvert";
7733 #endif
7734 #ifdef TRY_gcvt
7735 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7736 char *myname = "gcvt";
7737 #endif
7738 #ifdef TRY_qgcvt
7739 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7740 char *myname = "qgcvt";
7741 #define DOUBLETYPE long double
7742 #endif
7743 #ifdef TRY_sprintf
7744 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7745 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7746 #else
7747 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7748 #endif
7749 char *myname = "sprintf";
7750 #endif
7751
7752 #ifndef DOUBLETYPE
7753 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7754 #define DOUBLETYPE long double
7755 #else
7756 #define DOUBLETYPE double
7757 #endif
7758 #endif
7759
7760 #include <stdio.h>
7761
7762 #define I_STDLIB $i_stdlib
7763 #ifdef I_STDLIB
7764 #include <stdlib.h>
7765 #endif
7766
7767 int
7768 checkit(expect, got)
7769 char *expect;
7770 char *got;
7771 {
7772     if (strcmp(expect, got)) {
7773                 printf("%s oddity:  Expected %s, got %s\n",
7774                         myname, expect, got);
7775                 exit(1);
7776         }
7777 }
7778
7779 int main()
7780
7781         char buf[64]; 
7782         buf[63] = '\0';
7783
7784         /* This must be 1st test on (which?) platform */
7785         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7786         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7787         checkit("0.1", buf);
7788
7789         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7790         checkit("1", buf);
7791
7792         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7793         checkit("1.1", buf);
7794
7795         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7796         checkit("1.01", buf);
7797
7798         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7799         checkit("1.001", buf);
7800
7801         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7802         checkit("1.0001", buf);
7803
7804         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7805         checkit("1.00001", buf);
7806
7807         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7808         checkit("1.000001", buf);
7809
7810         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7811         checkit("0", buf);
7812
7813         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7814         checkit("-1", buf);
7815
7816         /* Some Linux gcvt's give 1.e+5 here. */
7817         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7818         checkit("100000", buf);
7819         
7820         /* Some Linux gcvt's give -1.e+5 here. */
7821         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7822         checkit("-100000", buf);
7823
7824         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7825         checkit("123.456", buf);
7826
7827         exit(0);
7828 }
7829 EOP
7830 case "$d_Gconvert" in
7831 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7832 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7833 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7834 *) xxx_list='gconvert gcvt sprintf' ;;
7835 esac
7836
7837 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7838 "$define$define$define")
7839     # for long doubles prefer first qgcvt, then sprintf
7840     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7841     xxx_list="sprintf $xxx_list"
7842     case "$d_qgcvt" in
7843     "$define") xxx_list="qgcvt $xxx_list" ;;
7844     esac
7845     ;;
7846 esac
7847
7848 for xxx_convert in $xxx_list; do
7849         echo "Trying $xxx_convert..."
7850         $rm -f try try$_o
7851         set try -DTRY_$xxx_convert
7852         if eval $compile; then
7853                 echo "$xxx_convert() found." >&4
7854                 if ./try; then
7855                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7856                         break;
7857                 else
7858                         echo "...But $xxx_convert didn't work as I expected."
7859                 fi
7860         else
7861                 echo "$xxx_convert NOT found." >&4
7862         fi
7863 done
7864         
7865 case "$xxx_convert" in
7866 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7867 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7868 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7869 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7870    "$define$define$define")
7871       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7872    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7873    esac
7874    ;;  
7875 esac
7876
7877 : see if _fwalk exists
7878 set fwalk d__fwalk
7879 eval $inlibc
7880
7881 : Initialize h_fcntl
7882 h_fcntl=false
7883
7884 : Initialize h_sysfile
7885 h_sysfile=false
7886
7887 : access call always available on UNIX
7888 set access d_access
7889 eval $inlibc
7890
7891 : locate the flags for 'access()'
7892 case "$d_access" in
7893 "$define")
7894         echo " "
7895         $cat >access.c <<'EOCP'
7896 #include <sys/types.h>
7897 #ifdef I_FCNTL
7898 #include <fcntl.h>
7899 #endif
7900 #ifdef I_SYS_FILE
7901 #include <sys/file.h>
7902 #endif
7903 #ifdef I_UNISTD
7904 #include <unistd.h>
7905 #endif
7906 int main() {
7907         exit(R_OK);
7908 }
7909 EOCP
7910         : check sys/file.h first, no particular reason here
7911         if $test `./findhdr sys/file.h` && \
7912                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7913                 h_sysfile=true;
7914                 echo "<sys/file.h> defines the *_OK access constants." >&4
7915         elif $test `./findhdr fcntl.h` && \
7916                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7917                 h_fcntl=true;
7918                 echo "<fcntl.h> defines the *_OK access constants." >&4
7919         elif $test `./findhdr unistd.h` && \
7920                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7921                 echo "<unistd.h> defines the *_OK access constants." >&4
7922         else
7923                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7924         fi
7925         ;;
7926 esac
7927 $rm -f access*
7928
7929 : see if accessx exists
7930 set accessx d_accessx
7931 eval $inlibc
7932
7933 : see if alarm exists
7934 set alarm d_alarm
7935 eval $inlibc
7936
7937 : see if atolf exists
7938 set atolf d_atolf
7939 eval $inlibc
7940
7941 : see if atoll exists
7942 set atoll d_atoll
7943 eval $inlibc
7944
7945 : Look for GNU-cc style attribute checking
7946 echo " "
7947 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7948 $cat >attrib.c <<'EOCP'
7949 #include <stdio.h>
7950 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7951 EOCP
7952 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7953         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7954                 echo "Your C compiler doesn't fully support __attribute__."
7955                 val="$undef"
7956         else
7957                 echo "Your C compiler supports __attribute__."
7958                 val="$define"
7959         fi
7960 else
7961         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7962         val="$undef"
7963 fi
7964 set d_attribut
7965 eval $setvar
7966 $rm -f attrib*
7967
7968 : see if bcmp exists
7969 set bcmp d_bcmp
7970 eval $inlibc
7971
7972 : see if bcopy exists
7973 set bcopy d_bcopy
7974 eval $inlibc
7975
7976 : see if this is a unistd.h system
7977 set unistd.h i_unistd
7978 eval $inhdr
7979
7980 : see if getpgrp exists
7981 set getpgrp d_getpgrp
7982 eval $inlibc
7983
7984 case "$d_getpgrp" in
7985 "$define")
7986         echo " "
7987         echo "Checking to see which flavor of getpgrp is in use..."
7988         $cat >set.c <<EOP
7989 #$i_unistd I_UNISTD
7990 #include <sys/types.h>
7991 #ifdef I_UNISTD
7992 #  include <unistd.h>
7993 #endif
7994 int main()
7995 {
7996         if (getuid() == 0) {
7997                 printf("(I see you are running Configure as super-user...)\n");
7998                 setuid(1);
7999         }
8000 #ifdef TRY_BSD_PGRP
8001         if (getpgrp(1) == 0)
8002                 exit(0);
8003 #else
8004         if (getpgrp() > 0)
8005                 exit(0);
8006 #endif
8007         exit(1);
8008 }
8009 EOP
8010         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8011                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8012                 val="$define"
8013         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8014                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8015                 val="$undef"
8016         else
8017                 echo "I can't seem to compile and run the test program."
8018                 if ./usg; then
8019                         xxx="a USG one, i.e. you use getpgrp()."
8020                 else
8021                         # SVR4 systems can appear rather BSD-ish.
8022                         case "$i_unistd" in
8023                         $undef)
8024                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8025                                 val="$define"
8026                                 ;;
8027                         $define)
8028                                 xxx="probably a USG one, i.e. you use getpgrp()."
8029                                 val="$undef"
8030                                 ;;
8031                         esac
8032                 fi
8033                 echo "Assuming your getpgrp is $xxx" >&4
8034         fi
8035         ;;
8036 *) val="$undef";;
8037 esac
8038 set d_bsdgetpgrp
8039 eval $setvar
8040 $rm -f set set.c
8041
8042 : see if setpgrp exists
8043 set setpgrp d_setpgrp
8044 eval $inlibc
8045
8046 case "$d_setpgrp" in
8047 "$define")
8048         echo " "
8049         echo "Checking to see which flavor of setpgrp is in use..."
8050         $cat >set.c <<EOP
8051 #$i_unistd I_UNISTD
8052 #include <sys/types.h>
8053 #ifdef I_UNISTD
8054 #  include <unistd.h>
8055 #endif
8056 int main()
8057 {
8058         if (getuid() == 0) {
8059                 printf("(I see you are running Configure as super-user...)\n");
8060                 setuid(1);
8061         }
8062 #ifdef TRY_BSD_PGRP
8063         if (-1 == setpgrp(1, 1))
8064                 exit(0);
8065 #else
8066         if (setpgrp() != -1)
8067                 exit(0);
8068 #endif
8069         exit(1);
8070 }
8071 EOP
8072         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8073                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8074                 val="$define"
8075         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8076                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8077                 val="$undef"
8078         else
8079                 echo "(I can't seem to compile and run the test program.)"
8080                 if ./usg; then
8081                         xxx="a USG one, i.e. you use setpgrp()."
8082                 else
8083                         # SVR4 systems can appear rather BSD-ish.
8084                         case "$i_unistd" in
8085                         $undef)
8086                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8087                                 val="$define"
8088                                 ;;
8089                         $define)
8090                                 xxx="probably a USG one, i.e. you use setpgrp()."
8091                                 val="$undef"
8092                                 ;;
8093                         esac
8094                 fi
8095                 echo "Assuming your setpgrp is $xxx" >&4
8096         fi
8097         ;;
8098 *) val="$undef";;
8099 esac
8100 set d_bsdsetpgrp
8101 eval $setvar
8102 $rm -f set set.c
8103 : see if bzero exists
8104 set bzero d_bzero
8105 eval $inlibc
8106
8107 : see if signal is declared as pointer to function returning int or void
8108 echo " "
8109 xxx=`./findhdr signal.h`
8110 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8111 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8112         echo "You have int (*signal())() instead of void." >&4
8113         val="$undef"
8114 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8115         echo "You have void (*signal())()." >&4
8116         val="$define"
8117 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8118         echo "You have int (*signal())() instead of void." >&4
8119         val="$undef"
8120 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8121         echo "You have void (*signal())()." >&4
8122         val="$define"
8123 else
8124         case "$d_voidsig" in
8125         '')
8126         echo "I can't determine whether signal handler returns void or int..." >&4
8127                 dflt=void
8128                 rp="What type does your signal handler return?"
8129                 . ./myread
8130                 case "$ans" in
8131                 v*) val="$define";;
8132                 *) val="$undef";;
8133                 esac;;
8134         "$define")
8135                 echo "As you already told me, signal handler returns void." >&4
8136                 val="$define"
8137                 ;;
8138         *)      echo "As you already told me, signal handler returns int." >&4
8139                 val="$undef"
8140                 ;;
8141         esac
8142 fi
8143 set d_voidsig
8144 eval $setvar
8145 case "$d_voidsig" in
8146 "$define") signal_t="void";;
8147 *) signal_t="int";;
8148 esac
8149 $rm -f $$.tmp
8150
8151 : check for ability to cast large floats to 32-bit ints.
8152 echo " "
8153 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8154 if $test "$intsize" -ge 4; then
8155         xxx=int
8156 else
8157         xxx=long
8158 fi
8159 $cat >try.c <<EOCP
8160 #include <stdio.h>
8161 #include <sys/types.h>
8162 #include <signal.h>
8163 $signal_t blech(s) int s; { exit(3); }
8164 int main()
8165 {
8166         $xxx i32;
8167         double f, g;
8168         int result = 0;
8169         char str[16];
8170         signal(SIGFPE, blech);
8171
8172         /* Don't let compiler optimize the test away.  Store the number 
8173            in a writable string for gcc to pass to sscanf under HP/UX.
8174         */
8175         sprintf(str, "2147483647");
8176         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8177         g = 10 * f;
8178         i32  = ($xxx) g;
8179
8180         /* x86 processors will probably give 0x8000 0000, which is a
8181        sign change.  We don't want that.  We want to mimic SPARC
8182            behavior here, which is to preserve the sign and give
8183            back 0x7fff ffff.
8184         */
8185         if (i32 != ($xxx) f)
8186                 result |= 1;
8187         exit(result);
8188 }
8189 EOCP
8190 set try
8191 if eval $compile_ok; then
8192         ./try
8193         yyy=$?
8194 else
8195         echo "(I can't seem to compile the test program--assuming it can't)"
8196         yyy=1
8197 fi
8198 case "$yyy" in
8199 0)      val="$define"
8200         echo "Yup, it can."
8201         ;;
8202 *)      val="$undef"
8203         echo "Nope, it can't."
8204         ;;
8205 esac
8206 set d_casti32
8207 eval $setvar
8208 $rm -f try try.*
8209
8210 : check for ability to cast negative floats to unsigned
8211 echo " "
8212 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8213 $cat >try.c <<EOCP
8214 #include <stdio.h>
8215 #include <sys/types.h>
8216 #include <signal.h>
8217 $signal_t blech(s) int s; { exit(7); }
8218 $signal_t blech_in_list(s) int s; { exit(4); }
8219 unsigned long dummy_long(p) unsigned long p; { return p; }
8220 unsigned int dummy_int(p) unsigned int p; { return p; }
8221 unsigned short dummy_short(p) unsigned short p; { return p; }
8222 int main()
8223 {
8224         double f;
8225         unsigned long along;
8226         unsigned int aint;
8227         unsigned short ashort;
8228         int result = 0;
8229         char str[16];
8230         
8231         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8232            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8233            optimized the whole file away
8234         */
8235         /* Store the number in a writable string for gcc to pass to 
8236            sscanf under HP/UX.
8237         */
8238         sprintf(str, "-123");
8239         sscanf(str, "%lf", &f);  /* f = -123.; */
8240
8241         signal(SIGFPE, blech);
8242         along = (unsigned long)f;
8243         aint = (unsigned int)f;
8244         ashort = (unsigned short)f;
8245         if (along != (unsigned long)-123)
8246                 result |= 1;
8247         if (aint != (unsigned int)-123)
8248                 result |= 1;
8249         if (ashort != (unsigned short)-123)
8250                 result |= 1;
8251         sprintf(str, "1073741824.");
8252         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8253         f = f + f;
8254         along = 0;
8255         along = (unsigned long)f;
8256         if (along != 0x80000000)
8257                 result |= 2;
8258         f -= 1.;
8259         along = 0;
8260         along = (unsigned long)f;
8261         if (along != 0x7fffffff)
8262                 result |= 1;
8263         f += 2.;
8264         along = 0;
8265         along = (unsigned long)f;
8266         if (along != 0x80000001)
8267                 result |= 2;
8268         if (result)
8269                 exit(result);
8270         signal(SIGFPE, blech_in_list);
8271         sprintf(str, "123.");
8272         sscanf(str, "%lf", &f);  /* f = 123.; */
8273         along = dummy_long((unsigned long)f);
8274         aint = dummy_int((unsigned int)f);
8275         ashort = dummy_short((unsigned short)f);
8276         if (along != (unsigned long)123)
8277                 result |= 4;
8278         if (aint != (unsigned int)123)
8279                 result |= 4;
8280         if (ashort != (unsigned short)123)
8281                 result |= 4;
8282         exit(result);
8283
8284 }
8285 EOCP
8286 set try
8287 if eval $compile_ok; then
8288         ./try
8289         castflags=$?
8290 else
8291         echo "(I can't seem to compile the test program--assuming it can't)"
8292         castflags=7
8293 fi
8294 case "$castflags" in
8295 0)      val="$define"
8296         echo "Yup, it can."
8297         ;;
8298 *)      val="$undef"
8299         echo "Nope, it can't."
8300         ;;
8301 esac
8302 set d_castneg
8303 eval $setvar
8304 $rm -f try.*
8305
8306 : see if vprintf exists
8307 echo " "
8308 if set vprintf val -f d_vprintf; eval $csym; $val; then
8309         echo 'vprintf() found.' >&4
8310         val="$define"
8311         $cat >vprintf.c <<'EOF'
8312 #include <varargs.h>
8313
8314 int main() { xxx("foo"); }
8315
8316 xxx(va_alist)
8317 va_dcl
8318 {
8319         va_list args;
8320         char buf[10];
8321
8322         va_start(args);
8323         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8324 }
8325 EOF
8326         set vprintf
8327         if eval $compile && ./vprintf; then
8328                 echo "Your vsprintf() returns (int)." >&4
8329                 val2="$undef"
8330         else
8331                 echo "Your vsprintf() returns (char*)." >&4
8332                 val2="$define"
8333         fi
8334 else
8335         echo 'vprintf() NOT found.' >&4
8336                 val="$undef"
8337                 val2="$undef"
8338 fi
8339 set d_vprintf
8340 eval $setvar
8341 val=$val2
8342 set d_charvspr
8343 eval $setvar
8344
8345 : see if chown exists
8346 set chown d_chown
8347 eval $inlibc
8348
8349 : see if chroot exists
8350 set chroot d_chroot
8351 eval $inlibc
8352
8353 : see if chsize exists
8354 set chsize d_chsize
8355 eval $inlibc
8356
8357 : check for const keyword
8358 echo " "
8359 echo 'Checking to see if your C compiler knows about "const"...' >&4
8360 $cat >const.c <<'EOCP'
8361 typedef struct spug { int drokk; } spug;
8362 int main()
8363 {
8364         const char *foo;
8365         const spug y;
8366 }
8367 EOCP
8368 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8369         val="$define"
8370         echo "Yup, it does."
8371 else
8372         val="$undef"
8373         echo "Nope, it doesn't."
8374 fi
8375 set d_const
8376 eval $setvar
8377
8378 : see if crypt exists
8379 echo " "
8380 if set crypt val -f d_crypt; eval $csym; $val; then
8381         echo 'crypt() found.' >&4
8382         val="$define"
8383         cryptlib=''
8384 else
8385         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8386         if $test -z "$cryptlib"; then
8387                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8388         else
8389                 cryptlib=-lcrypt
8390         fi
8391         if $test -z "$cryptlib"; then
8392                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8393         else
8394                 cryptlib=-lcrypt
8395         fi
8396         if $test -z "$cryptlib"; then
8397                 cryptlib=`./loc libcrypt$_a "" $libpth`
8398         else
8399                 cryptlib=-lcrypt
8400         fi
8401         if $test -z "$cryptlib"; then
8402                 echo 'crypt() NOT found.' >&4
8403                 val="$undef"
8404         else
8405                 val="$define"
8406         fi
8407 fi
8408 set d_crypt
8409 eval $setvar
8410
8411 : get csh whereabouts
8412 case "$csh" in
8413 'csh') val="$undef" ;;
8414 *) val="$define" ;;
8415 esac
8416 set d_csh
8417 eval $setvar
8418 : Respect a hint or command line value for full_csh.
8419 case "$full_csh" in
8420 '') full_csh=$csh ;;
8421 esac
8422
8423 : see if cuserid exists
8424 set cuserid d_cuserid
8425 eval $inlibc
8426
8427 : see if this is a limits.h system
8428 set limits.h i_limits
8429 eval $inhdr
8430
8431 : see if this is a float.h system
8432 set float.h i_float
8433 eval $inhdr
8434
8435 : See if number of significant digits in a double precision number is known
8436 echo " "
8437 $cat >dbl_dig.c <<EOM
8438 #$i_limits I_LIMITS
8439 #$i_float I_FLOAT
8440 #ifdef I_LIMITS
8441 #include <limits.h>
8442 #endif
8443 #ifdef I_FLOAT
8444 #include <float.h>
8445 #endif
8446 #ifdef DBL_DIG
8447 printf("Contains DBL_DIG");
8448 #endif
8449 EOM
8450 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8451 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8452         echo "DBL_DIG found." >&4
8453         val="$define"
8454 else
8455         echo "DBL_DIG NOT found." >&4
8456         val="$undef"
8457 fi
8458 $rm -f dbl_dig.?
8459 set d_dbl_dig
8460 eval $setvar
8461
8462 : see if difftime exists
8463 set difftime d_difftime
8464 eval $inlibc
8465
8466 : see if this is a dirent system
8467 echo " "
8468 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8469         val="$define"
8470         echo "<dirent.h> found." >&4
8471 else
8472         val="$undef"
8473         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8474                 echo "<sys/dir.h> found." >&4
8475                 echo " "
8476         else
8477                 xinc=`./findhdr sys/ndir.h`
8478         fi
8479         echo "<dirent.h> NOT found." >&4
8480 fi
8481 set i_dirent
8482 eval $setvar
8483
8484 : Look for type of directory structure.
8485 echo " "
8486 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8487
8488 case "$direntrytype" in
8489 ''|' ')
8490         case "$i_dirent" in
8491         $define) guess1='struct dirent' ;;
8492         *) guess1='struct direct'  ;;
8493         esac
8494         ;;
8495 *)      guess1="$direntrytype"
8496         ;;
8497 esac
8498
8499 case "$guess1" in
8500 'struct dirent') guess2='struct direct' ;;
8501 *) guess2='struct dirent' ;;
8502 esac
8503                 
8504 if $contains "$guess1" try.c >/dev/null 2>&1; then
8505         direntrytype="$guess1"
8506         echo "Your directory entries are $direntrytype." >&4
8507 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8508         direntrytype="$guess2"
8509         echo "Your directory entries seem to be $direntrytype." >&4
8510 else
8511         echo "I don't recognize your system's directory entries." >&4
8512         rp="What type is used for directory entries on this system?"
8513         dflt="$guess1"
8514         . ./myread
8515         direntrytype="$ans"
8516 fi
8517 $rm -f try.c
8518
8519
8520 : see if the directory entry stores field length
8521 echo " "
8522 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8523 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8524         echo "Good, your directory entry keeps length information in d_namlen." >&4
8525         val="$define"
8526 else
8527         echo "Your directory entry does not know about the d_namlen field." >&4
8528         val="$undef"
8529 fi
8530 set d_dirnamlen
8531 eval $setvar
8532 $rm -f try.c
8533
8534 : see if dlerror exists
8535 xxx_runnm="$runnm"
8536 runnm=false
8537 set dlerror d_dlerror
8538 eval $inlibc
8539 runnm="$xxx_runnm"
8540
8541 : see if dlfcn is available
8542 set dlfcn.h i_dlfcn
8543 eval $inhdr
8544
8545 case "$usedl" in
8546 $define|y|true)
8547         $cat << EOM
8548
8549 On a few systems, the dynamically loaded modules that perl generates and uses
8550 will need a different extension than shared libs. The default will probably
8551 be appropriate.
8552
8553 EOM
8554         case "$dlext" in
8555         '')     dflt="$so" ;;
8556         *)      dflt="$dlext" ;;
8557         esac
8558         rp='What is the extension of dynamically loaded modules'
8559         . ./myread
8560         dlext="$ans"
8561         ;;
8562 *)
8563         dlext="none"
8564         ;;
8565 esac
8566
8567 : Check if dlsym need a leading underscore
8568 echo " "
8569 val="$undef"
8570
8571 case "$dlsrc" in
8572 dl_dlopen.xs)
8573         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8574         $cat >dyna.c <<'EOM'
8575 fred () { }
8576 EOM
8577
8578 $cat >fred.c<<EOM
8579
8580 #include <stdio.h>
8581 #$i_dlfcn I_DLFCN
8582 #ifdef I_DLFCN
8583 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8584 #else
8585 #include <sys/types.h>
8586 #include <nlist.h>
8587 #include <link.h>
8588 #endif
8589
8590 extern int fred() ;
8591
8592 int main()
8593 {
8594     void * handle ;
8595     void * symbol ;
8596 #ifndef RTLD_LAZY
8597     int mode = 1 ;
8598 #else
8599     int mode = RTLD_LAZY ;
8600 #endif
8601     handle = dlopen("./dyna.$dlext", mode) ;
8602     if (handle == NULL) {
8603         printf ("1\n") ;
8604         fflush (stdout) ;
8605         exit(0);
8606     }
8607     symbol = dlsym(handle, "fred") ;
8608     if (symbol == NULL) {
8609         /* try putting a leading underscore */
8610         symbol = dlsym(handle, "_fred") ;
8611         if (symbol == NULL) {
8612             printf ("2\n") ;
8613             fflush (stdout) ;
8614             exit(0);
8615         }
8616         printf ("3\n") ;
8617     }
8618     else
8619         printf ("4\n") ;
8620     fflush (stdout) ;
8621     exit(0);
8622 }
8623 EOM
8624         : Call the object file tmp-dyna.o in case dlext=o.
8625         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8626                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8627                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8628                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8629                 xxx=`./fred`
8630                 case $xxx in
8631                 1)      echo "Test program failed using dlopen." >&4
8632                         echo "Perhaps you should not use dynamic loading." >&4;;
8633                 2)      echo "Test program failed using dlsym." >&4
8634                         echo "Perhaps you should not use dynamic loading." >&4;;
8635                 3)      echo "dlsym needs a leading underscore" >&4
8636                         val="$define" ;;
8637                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8638                 esac
8639         else
8640                 echo "I can't compile and run the test program." >&4
8641                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8642         fi
8643         ;;
8644 esac
8645                 
8646 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8647
8648 set d_dlsymun
8649 eval $setvar
8650
8651 hasproto='varname=$1; func=$2; shift; shift;
8652 while $test $# -ge 2; do
8653         case "$1" in
8654         $define) echo "#include <$2>";;
8655         esac ;
8656     shift 2;
8657 done > try.c;
8658 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8659 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8660         echo "$func() prototype found.";
8661         val="$define";
8662 else
8663         echo "$func() prototype NOT found.";
8664         val="$undef";
8665 fi;
8666 set $varname;
8667 eval $setvar;
8668 $rm -f try.c tryout.c'
8669
8670 : see if prototype for drand48 is available
8671 echo " "
8672 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8673 eval $hasproto
8674
8675 : see if dup2 exists
8676 set dup2 d_dup2
8677 eval $inlibc
8678
8679 : see if eaccess exists
8680 set eaccess d_eaccess
8681 eval $inlibc
8682
8683 : see if endgrent exists
8684 set endgrent d_endgrent
8685 eval $inlibc
8686
8687 : see if endhostent exists
8688 set endhostent d_endhent
8689 eval $inlibc
8690
8691 : see if endnetent exists
8692 set endnetent d_endnent
8693 eval $inlibc
8694
8695 : see if endprotoent exists
8696 set endprotoent d_endpent
8697 eval $inlibc
8698
8699 : see if endpwent exists
8700 set endpwent d_endpwent
8701 eval $inlibc
8702
8703 : see if endservent exists
8704 set endservent d_endsent
8705 eval $inlibc
8706
8707 : Locate the flags for 'open()'
8708 echo " "
8709 $cat >open3.c <<'EOCP'
8710 #include <sys/types.h>
8711 #ifdef I_FCNTL
8712 #include <fcntl.h>
8713 #endif
8714 #ifdef I_SYS_FILE
8715 #include <sys/file.h>
8716 #endif
8717 int main() {
8718         if(O_RDONLY);
8719 #ifdef O_TRUNC
8720         exit(0);
8721 #else
8722         exit(1);
8723 #endif
8724 }
8725 EOCP
8726 : check sys/file.h first to get FREAD on Sun
8727 if $test `./findhdr sys/file.h` && \
8728                 set open3 -DI_SYS_FILE && eval $compile; then
8729         h_sysfile=true;
8730         echo "<sys/file.h> defines the O_* constants..." >&4
8731         if ./open3; then
8732                 echo "and you have the 3 argument form of open()." >&4
8733                 val="$define"
8734         else
8735                 echo "but not the 3 argument form of open().  Oh, well." >&4
8736                 val="$undef"
8737         fi
8738 elif $test `./findhdr fcntl.h` && \
8739                 set open3 -DI_FCNTL && eval $compile; then
8740         h_fcntl=true;
8741         echo "<fcntl.h> defines the O_* constants..." >&4
8742         if ./open3; then
8743                 echo "and you have the 3 argument form of open()." >&4
8744                 val="$define"
8745         else
8746                 echo "but not the 3 argument form of open().  Oh, well." >&4
8747                 val="$undef"
8748         fi
8749 else
8750         val="$undef"
8751         echo "I can't find the O_* constant definitions!  You got problems." >&4
8752 fi
8753 set d_open3
8754 eval $setvar
8755 $rm -f open3*
8756
8757 : see which of string.h or strings.h is needed
8758 echo " "
8759 strings=`./findhdr string.h`
8760 if $test "$strings" && $test -r "$strings"; then
8761         echo "Using <string.h> instead of <strings.h>." >&4
8762         val="$define"
8763 else
8764         val="$undef"
8765         strings=`./findhdr strings.h`
8766         if $test "$strings" && $test -r "$strings"; then
8767                 echo "Using <strings.h> instead of <string.h>." >&4
8768         else
8769                 echo "No string header found -- You'll surely have problems." >&4
8770         fi
8771 fi
8772 set i_string
8773 eval $setvar
8774 case "$i_string" in
8775 "$undef") strings=`./findhdr strings.h`;;
8776 *)        strings=`./findhdr string.h`;;
8777 esac
8778
8779 : check for non-blocking I/O stuff
8780 case "$h_sysfile" in
8781 true) echo "#include <sys/file.h>" > head.c;;
8782 *)
8783         case "$h_fcntl" in
8784         true) echo "#include <fcntl.h>" > head.c;;
8785         *) echo "#include <sys/fcntl.h>" > head.c;;
8786         esac
8787         ;;
8788 esac
8789 echo " "
8790 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8791 case "$o_nonblock" in
8792 '')
8793         $cat head.c > try.c
8794         $cat >>try.c <<'EOCP'
8795 #include <stdio.h>
8796 int main() {
8797 #ifdef O_NONBLOCK
8798         printf("O_NONBLOCK\n");
8799         exit(0);
8800 #endif
8801 #ifdef O_NDELAY
8802         printf("O_NDELAY\n");
8803         exit(0);
8804 #endif
8805 #ifdef FNDELAY
8806         printf("FNDELAY\n");
8807         exit(0);
8808 #endif
8809         exit(0);
8810 }
8811 EOCP
8812         set try
8813         if eval $compile_ok; then
8814                 o_nonblock=`./try`
8815                 case "$o_nonblock" in
8816                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8817                 *) echo "Seems like we can use $o_nonblock.";;
8818                 esac
8819         else
8820                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8821         fi
8822         ;;
8823 *) echo "Using $hint value $o_nonblock.";;
8824 esac
8825 $rm -f try try.* .out core
8826
8827 echo " "
8828 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8829 case "$eagain" in
8830 '')
8831         $cat head.c > try.c
8832         $cat >>try.c <<EOCP
8833 #include <errno.h>
8834 #include <sys/types.h>
8835 #include <signal.h>
8836 #include <stdio.h> 
8837 #define MY_O_NONBLOCK $o_nonblock
8838 #ifndef errno  /* XXX need better Configure test */
8839 extern int errno;
8840 #endif
8841 #$i_unistd I_UNISTD
8842 #ifdef I_UNISTD
8843 #include <unistd.h>
8844 #endif
8845 #$i_string I_STRING
8846 #ifdef I_STRING
8847 #include <string.h>
8848 #else
8849 #include <strings.h>
8850 #endif
8851 $signal_t blech(x) int x; { exit(3); }
8852 EOCP
8853         $cat >> try.c <<'EOCP'
8854 int main()
8855 {
8856         int pd[2];
8857         int pu[2];
8858         char buf[1];
8859         char string[100];
8860
8861         pipe(pd);       /* Down: child -> parent */
8862         pipe(pu);       /* Up: parent -> child */
8863         if (0 != fork()) {
8864                 int ret;
8865                 close(pd[1]);   /* Parent reads from pd[0] */
8866                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8867                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8868                         exit(1);
8869                 signal(SIGALRM, blech);
8870                 alarm(5);
8871                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8872                         exit(2);
8873                 sprintf(string, "%d\n", ret);
8874                 write(2, string, strlen(string));
8875                 alarm(0);
8876 #ifdef EAGAIN
8877                 if (errno == EAGAIN) {
8878                         printf("EAGAIN\n");
8879                         goto ok;
8880                 }
8881 #endif
8882 #ifdef EWOULDBLOCK
8883                 if (errno == EWOULDBLOCK)
8884                         printf("EWOULDBLOCK\n");
8885 #endif
8886         ok:
8887                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8888                 sleep(2);                               /* Give it time to close our pipe */
8889                 alarm(5);
8890                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8891                 alarm(0);
8892                 sprintf(string, "%d\n", ret);
8893                 write(3, string, strlen(string));
8894                 exit(0);
8895         }
8896
8897         close(pd[0]);                   /* We write to pd[1] */
8898         close(pu[1]);                   /* We read from pu[0] */
8899         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8900         close(pd[1]);                   /* Pipe pd is now fully closed! */
8901         exit(0);                                /* Bye bye, thank you for playing! */
8902 }
8903 EOCP
8904         set try
8905         if eval $compile_ok; then
8906                 echo "$startsh" >mtry
8907                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8908                 chmod +x mtry
8909                 ./mtry >/dev/null 2>&1
8910                 case $? in
8911                 0) eagain=`$cat try.out`;;
8912                 1) echo "Could not perform non-blocking setting!";;
8913                 2) echo "I did a successful read() for something that was not there!";;
8914                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8915                 *) echo "Something terribly wrong happened during testing.";;
8916                 esac
8917                 rd_nodata=`$cat try.ret`
8918                 echo "A read() system call with no data present returns $rd_nodata."
8919                 case "$rd_nodata" in
8920                 0|-1) ;;
8921                 *)
8922                         echo "(That's peculiar, fixing that to be -1.)"
8923                         rd_nodata=-1
8924                         ;;
8925                 esac
8926                 case "$eagain" in
8927                 '')
8928                         echo "Forcing errno EAGAIN on read() with no data available."
8929                         eagain=EAGAIN
8930                         ;;
8931                 *)
8932                         echo "Your read() sets errno to $eagain when no data is available."
8933                         ;;
8934                 esac
8935                 status=`$cat try.err`
8936                 case "$status" in
8937                 0) echo "And it correctly returns 0 to signal EOF.";;
8938                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8939                 *) echo "However, your read() returns '$status' on EOF??";;
8940                 esac
8941                 val="$define"
8942                 if test "$status" = "$rd_nodata"; then
8943                         echo "WARNING: you can't distinguish between EOF and no data!"
8944                         val="$undef"
8945                 fi
8946         else
8947                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8948                 eagain=EAGAIN
8949         fi
8950         set d_eofnblk
8951         eval $setvar
8952         ;;
8953 *)
8954         echo "Using $hint value $eagain."
8955         echo "Your read() returns $rd_nodata when no data is present."
8956         case "$d_eofnblk" in
8957         "$define") echo "And you can see EOF because read() returns 0.";;
8958         "$undef") echo "But you can't see EOF status from read() returned value.";;
8959         *)
8960                 echo "(Assuming you can't see EOF status from read anyway.)"
8961                 d_eofnblk=$undef
8962                 ;;
8963         esac
8964         ;;
8965 esac
8966 $rm -f try try.* .out core head.c mtry
8967
8968 : see if fchmod exists
8969 set fchmod d_fchmod
8970 eval $inlibc
8971
8972 : see if fchown exists
8973 set fchown d_fchown
8974 eval $inlibc
8975
8976 : see if this is an fcntl system
8977 set fcntl d_fcntl
8978 eval $inlibc
8979
8980 echo " "
8981 : See if fcntl-based locking works.
8982 $cat >try.c <<'EOCP'
8983 #include <stdlib.h>
8984 #include <unistd.h>
8985 #include <fcntl.h>
8986 int main() {
8987 #if defined(F_SETLK) && defined(F_SETLKW)
8988      struct flock flock;
8989      int retval, fd;
8990      fd = open("try.c", O_RDONLY);
8991      flock.l_type = F_RDLCK;
8992      flock.l_whence = SEEK_SET;
8993      flock.l_start = flock.l_len = 0;
8994      retval = fcntl(fd, F_SETLK, &flock);
8995      close(fd);
8996      (retval < 0 ? exit(2) : exit(0));
8997 #else
8998      exit(2);
8999 #endif
9000 }
9001 EOCP
9002 echo "Checking if fcntl-based file locking works... "
9003 case "$d_fcntl" in
9004 "$define")
9005         set try
9006         if eval $compile_ok; then
9007                 if ./try; then
9008                         echo "Yes, it seems to work."
9009                         val="$define"
9010                 else
9011                         echo "Nope, it didn't work."
9012                         val="$undef"
9013                 fi
9014         else
9015                 echo "I'm unable to compile the test program, so I'll assume not."
9016                 val="$undef"
9017         fi
9018         ;;
9019 *) val="$undef";
9020         echo "Nope, since you don't even have fcntl()."
9021         ;;
9022 esac
9023 set d_fcntl_can_lock
9024 eval $setvar
9025 $rm -f try*
9026
9027
9028 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9029 while $test $# -ge 2; do
9030         case "$1" in
9031         $define) echo "#include <$2>";;
9032         esac ;
9033     shift 2;
9034 done > try.c;
9035 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9036 set try;
9037 if eval $compile; then
9038         val="$define";
9039 else
9040         val="$undef";
9041 fi;
9042 set $varname;
9043 eval $setvar;
9044 $rm -f try.c try.o'
9045
9046 socketlib=''
9047 sockethdr=''
9048 : see whether socket exists
9049 echo " "
9050 $echo $n "Hmm... $c" >&4
9051 if set socket val -f d_socket; eval $csym; $val; then
9052         echo "Looks like you have Berkeley networking support." >&4
9053         d_socket="$define"
9054         if set setsockopt val -f; eval $csym; $val; then
9055                 d_oldsock="$undef"
9056         else
9057                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9058                 d_oldsock="$define"
9059         fi
9060 else
9061         if $contains socklib libc.list >/dev/null 2>&1; then
9062                 echo "Looks like you have Berkeley networking support." >&4
9063                 d_socket="$define"
9064                 : we will have to assume that it supports the 4.2 BSD interface
9065                 d_oldsock="$undef"
9066         else
9067                 echo "You don't have Berkeley networking in libc$_a..." >&4
9068                 if test "X$d_socket" = "X$define"; then
9069                    echo "...but you seem to believe that you have sockets." >&4
9070                 else
9071                         for net in net socket
9072                         do
9073                                 if test -f /usr/lib/lib$net$_a; then
9074                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9075                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9076                                         if $contains socket libc.list >/dev/null 2>&1; then
9077                                                 d_socket="$define"
9078                                                 socketlib="-l$net"
9079                                                 case "$net" in
9080                                                 net)
9081                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9082                                                         sockethdr="-I/usr/netinclude"
9083                                                         ;;
9084                                                 esac
9085                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9086                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9087                                                         d_oldsock="$undef"
9088                                                 else
9089                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9090                                                         d_oldsock="$define"
9091                                                 fi
9092                                                 break
9093                                         fi
9094                                 fi
9095                         done
9096                         if test "X$d_socket" != "X$define"; then
9097                            echo "or anywhere else I see." >&4
9098                            d_socket="$undef"
9099                            d_oldsock="$undef"
9100                         fi
9101                 fi
9102         fi
9103 fi
9104
9105 : see if socketpair exists
9106 set socketpair d_sockpair
9107 eval $inlibc
9108
9109
9110 echo " "
9111 echo "Checking the availability of certain socket constants..." >& 4
9112 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9113         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9114         $cat >try.c <<EOF
9115 #include <sys/types.h>
9116 #include <sys/socket.h>
9117 int main() {
9118     int i = $ENUM;
9119 }
9120 EOF
9121         val="$undef"
9122         set try; if eval $compile; then
9123                 val="$define"
9124         fi
9125         set d_${enum}; eval $setvar
9126         $rm -f try.c try
9127 done
9128
9129 : see if sys/select.h has to be included
9130 set sys/select.h i_sysselct
9131 eval $inhdr
9132
9133 : see if we should include time.h, sys/time.h, or both
9134 echo " "
9135 if test "X$timeincl" = X; then
9136         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9137         $echo $n "I'm now running the test program...$c"
9138         $cat >try.c <<'EOCP'
9139 #include <sys/types.h>
9140 #ifdef I_TIME
9141 #include <time.h>
9142 #endif
9143 #ifdef I_SYSTIME
9144 #ifdef SYSTIMEKERNEL
9145 #define KERNEL
9146 #endif
9147 #include <sys/time.h>
9148 #endif
9149 #ifdef I_SYSSELECT
9150 #include <sys/select.h>
9151 #endif
9152 int main()
9153 {
9154         struct tm foo;
9155 #ifdef S_TIMEVAL
9156         struct timeval bar;
9157 #endif
9158 #ifdef S_TIMEZONE
9159         struct timezone tzp;
9160 #endif
9161         if (foo.tm_sec == foo.tm_sec)
9162                 exit(0);
9163 #ifdef S_TIMEVAL
9164         if (bar.tv_sec == bar.tv_sec)
9165                 exit(0);
9166 #endif
9167         exit(1);
9168 }
9169 EOCP
9170         flags=''
9171         for s_timezone in '-DS_TIMEZONE' ''; do
9172         sysselect=''
9173         for s_timeval in '-DS_TIMEVAL' ''; do
9174         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9175         for i_time in '' '-DI_TIME'; do
9176         for i_systime in '-DI_SYSTIME' ''; do
9177                 case "$flags" in
9178                 '') $echo $n ".$c"
9179                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9180                         if eval $compile; then
9181                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9182                                 shift
9183                                 flags="$*"
9184                                 echo " "
9185                                 $echo $n "Succeeded with $flags$c"
9186                         fi
9187                         ;;
9188                 esac
9189         done
9190         done
9191         done
9192         done
9193         done
9194         timeincl=''
9195         echo " "
9196         case "$flags" in
9197         *SYSTIMEKERNEL*) i_systimek="$define"
9198                 timeincl=`./findhdr sys/time.h`
9199                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9200         *) i_systimek="$undef";;
9201         esac
9202         case "$flags" in
9203         *I_TIME*) i_time="$define"
9204                 timeincl=`./findhdr time.h`" $timeincl"
9205                 echo "We'll include <time.h>." >&4;;
9206         *) i_time="$undef";;
9207         esac
9208         case "$flags" in
9209         *I_SYSTIME*) i_systime="$define"
9210                 timeincl=`./findhdr sys/time.h`" $timeincl"
9211                 echo "We'll include <sys/time.h>." >&4;;
9212         *) i_systime="$undef";;
9213         esac
9214         $rm -f try.c try
9215 fi
9216
9217 : check for fd_set items
9218 $cat <<EOM
9219
9220 Checking to see how well your C compiler handles fd_set and friends ...
9221 EOM
9222 $cat >fd_set.c <<EOCP
9223 #$i_systime I_SYS_TIME
9224 #$i_sysselct I_SYS_SELECT
9225 #$d_socket HAS_SOCKET
9226 #include <sys/types.h>
9227 #ifdef HAS_SOCKET
9228 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9229 #endif
9230 #ifdef I_SYS_TIME
9231 #include <sys/time.h>
9232 #endif
9233 #ifdef I_SYS_SELECT
9234 #include <sys/select.h>
9235 #endif
9236 int main() {
9237         fd_set fds;
9238
9239 #ifdef TRYBITS
9240         if(fds.fds_bits);
9241 #endif
9242
9243 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9244         exit(0);
9245 #else
9246         exit(1);
9247 #endif
9248 }
9249 EOCP
9250 set fd_set -DTRYBITS
9251 if eval $compile; then
9252         d_fds_bits="$define"
9253         d_fd_set="$define"
9254         echo "Well, your system knows about the normal fd_set typedef..." >&4
9255         if ./fd_set; then
9256                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9257                 d_fd_macros="$define"
9258         else
9259                 $cat >&4 <<'EOM'
9260 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9261 EOM
9262                 d_fd_macros="$undef"
9263         fi
9264 else
9265         $cat <<'EOM'
9266 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9267 EOM
9268         set fd_set
9269         if eval $compile; then
9270                 d_fds_bits="$undef"
9271                 d_fd_set="$define"
9272                 echo "Well, your system has some sort of fd_set available..." >&4
9273                 if ./fd_set; then
9274                         echo "and you have the normal fd_set macros." >&4
9275                         d_fd_macros="$define"
9276                 else
9277                         $cat <<'EOM'
9278 but not the normal fd_set macros!  Gross!  More work for me...
9279 EOM
9280                         d_fd_macros="$undef"
9281                 fi
9282         else
9283         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9284                 d_fd_set="$undef"
9285                 d_fds_bits="$undef"
9286                 d_fd_macros="$undef"
9287         fi
9288 fi
9289 $rm -f fd_set*
9290
9291 : see if fgetpos exists
9292 set fgetpos d_fgetpos
9293 eval $inlibc
9294
9295 : see if flock exists
9296 set flock d_flock
9297 eval $inlibc
9298
9299 : see if fork exists
9300 set fork d_fork
9301 eval $inlibc
9302
9303 : see if pathconf exists
9304 set pathconf d_pathconf
9305 eval $inlibc
9306
9307 : see if fpathconf exists
9308 set fpathconf d_fpathconf
9309 eval $inlibc
9310
9311
9312 : check for fpos64_t
9313 echo " "
9314 echo "Checking to see if you have fpos64_t..." >&4
9315 $cat >try.c <<EOCP
9316 #include <stdio.h>
9317 int main() { fpos64_t x = 7; }
9318 EOCP
9319 set try
9320 if eval $compile; then
9321         val="$define"
9322         echo "You have fpos64_t."
9323 else
9324         val="$undef"
9325         echo "You do not have fpos64_t."
9326         case "$fpossize" in
9327         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9328         esac
9329 fi
9330 $rm -f try.* try
9331 set d_fpos64_t
9332 eval $setvar
9333
9334 : see if frexpl exists
9335 set frexpl d_frexpl
9336 eval $inlibc
9337
9338 hasstruct='varname=$1; struct=$2; shift; shift;
9339 while $test $# -ge 2; do
9340         case "$1" in
9341         $define) echo "#include <$2>";;
9342         esac ;
9343     shift 2;
9344 done > try.c;
9345 echo "int main () { struct $struct foo; }" >> try.c;
9346 set try;
9347 if eval $compile; then
9348         val="$define";
9349 else
9350         val="$undef";
9351 fi;
9352 set $varname;
9353 eval $setvar;
9354 $rm -f try.c try.o'
9355
9356 : see if this is a sys/param system
9357 set sys/param.h i_sysparam
9358 eval $inhdr
9359
9360 : see if this is a sys/mount.h system
9361 set sys/mount.h i_sysmount
9362 eval $inhdr
9363
9364 : see if sys/types.h has to be included
9365 set sys/types.h i_systypes
9366 eval $inhdr
9367
9368
9369 echo " "
9370 echo "Checking to see if your system supports struct fs_data..." >&4
9371 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9372 eval $hasstruct
9373 case "$d_fs_data_s" in
9374 "$define")      echo "Yes, it does."   ;;
9375 *)              echo "No, it doesn't." ;;
9376 esac
9377
9378 : see if fseeko exists
9379 set fseeko d_fseeko
9380 eval $inlibc
9381 case "$longsize" in
9382 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9383 esac
9384
9385 : see if fsetpos exists
9386 set fsetpos d_fsetpos
9387 eval $inlibc
9388
9389
9390 : see if fstatfs exists
9391 set fstatfs d_fstatfs
9392 eval $inlibc
9393
9394
9395 : see if statvfs exists
9396 set statvfs d_statvfs
9397 eval $inlibc
9398
9399 : see if fstatvfs exists
9400 set fstatvfs d_fstatvfs
9401 eval $inlibc
9402
9403
9404 : see if fsync exists
9405 set fsync d_fsync
9406 eval $inlibc
9407
9408 : see if ftello exists
9409 set ftello d_ftello
9410 eval $inlibc
9411 case "$longsize" in
9412 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9413 esac
9414
9415 : see if getcwd exists
9416 set getcwd d_getcwd
9417 eval $inlibc
9418
9419 : see if getespwnam exists
9420 set getespwnam d_getespwnam
9421 eval $inlibc
9422
9423
9424 : see if getfsstat exists
9425 set getfsstat d_getfsstat
9426 eval $inlibc
9427
9428 : see if getgrent exists
9429 set getgrent d_getgrent
9430 eval $inlibc
9431
9432 : see if gethostbyaddr exists
9433 set gethostbyaddr d_gethbyaddr
9434 eval $inlibc
9435
9436 : see if gethostbyname exists
9437 set gethostbyname d_gethbyname
9438 eval $inlibc
9439
9440 : see if gethostent exists
9441 set gethostent d_gethent
9442 eval $inlibc
9443
9444 : see how we will look up host name
9445 echo " "
9446 call=''
9447 if set gethostname val -f d_gethname; eval $csym; $val; then
9448         echo 'gethostname() found.' >&4
9449         d_gethname="$define"
9450         call=gethostname
9451 fi
9452 if set uname val -f d_uname; eval $csym; $val; then
9453         if ./xenix; then
9454                 $cat <<'EOM'
9455 uname() was found, but you're running xenix, and older versions of xenix
9456 have a broken uname(). If you don't really know whether your xenix is old
9457 enough to have a broken system call, use the default answer.
9458
9459 EOM
9460                 dflt=y
9461                 case "$d_uname" in
9462                 "$define") dflt=n;;
9463                 esac
9464                 rp='Is your uname() broken?'
9465                 . ./myread
9466                 case "$ans" in
9467                 n*) d_uname="$define"; call=uname;;
9468                 esac
9469         else
9470                 echo 'uname() found.' >&4
9471                 d_uname="$define"
9472                 case "$call" in
9473                 '') call=uname ;;
9474                 esac
9475         fi
9476 fi
9477 case "$d_gethname" in
9478 '') d_gethname="$undef";;
9479 esac
9480 case "$d_uname" in
9481 '') d_uname="$undef";;
9482 esac
9483 case "$d_uname$d_gethname" in
9484 *define*)
9485         dflt=n
9486         cat <<EOM
9487  
9488 Every now and then someone has a $call() that lies about the hostname
9489 but can't be fixed for political or economic reasons.  If you wish, I can
9490 pretend $call() isn't there and maybe compute hostname at run-time
9491 thanks to the '$phostname' command.
9492
9493 EOM
9494         rp="Shall I ignore $call() from now on?"
9495         . ./myread
9496         case "$ans" in
9497         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9498         esac;;
9499 esac
9500 case "$phostname" in
9501 '') aphostname='';;
9502 *) case "$aphostname" in
9503         /*) ;;
9504         *) set X $phostname
9505                 shift
9506                 file=$1
9507                 shift
9508                 file=`./loc $file $file $pth`
9509                 aphostname=`echo $file $*`
9510                 ;;
9511         esac
9512         ;;
9513 esac
9514 case "$d_uname$d_gethname" in
9515 *define*) ;;
9516 *)
9517         case "$phostname" in
9518         '')
9519                 echo "There will be no way for $package to get your hostname." >&4;;
9520         *)
9521         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9522                 ;;
9523         esac;;
9524 esac
9525 case "$d_phostname" in
9526 '') d_phostname="$undef";;
9527 esac
9528
9529 : see if this is a netdb.h system
9530 set netdb.h i_netdb
9531 eval $inhdr
9532
9533 : see if prototypes for various gethostxxx netdb.h functions are available
9534 echo " "
9535 set d_gethostprotos gethostent $i_netdb netdb.h
9536 eval $hasproto
9537
9538 : see if getlogin exists
9539 set getlogin d_getlogin
9540 eval $inlibc
9541
9542 : see if getmnt exists
9543 set getmnt d_getmnt
9544 eval $inlibc
9545
9546 : see if getmntent exists
9547 set getmntent d_getmntent
9548 eval $inlibc
9549
9550 : see if getnetbyaddr exists
9551 set getnetbyaddr d_getnbyaddr
9552 eval $inlibc
9553
9554 : see if getnetbyname exists
9555 set getnetbyname d_getnbyname
9556 eval $inlibc
9557
9558 : see if getnetent exists
9559 set getnetent d_getnent
9560 eval $inlibc
9561
9562 : see if prototypes for various getnetxxx netdb.h functions are available
9563 echo " "
9564 set d_getnetprotos getnetent $i_netdb netdb.h
9565 eval $hasproto
9566
9567 : see if getpagesize exists
9568 set getpagesize d_getpagsz
9569 eval $inlibc
9570
9571
9572 : see if getprotobyname exists
9573 set getprotobyname d_getpbyname
9574 eval $inlibc
9575
9576 : see if getprotobynumber exists
9577 set getprotobynumber d_getpbynumber
9578 eval $inlibc
9579
9580 : see if getprotoent exists
9581 set getprotoent d_getpent
9582 eval $inlibc
9583
9584 : see if getpgid exists
9585 set getpgid d_getpgid
9586 eval $inlibc
9587
9588 : see if getpgrp2 exists
9589 set getpgrp2 d_getpgrp2
9590 eval $inlibc
9591
9592 : see if getppid exists
9593 set getppid d_getppid
9594 eval $inlibc
9595
9596 : see if getpriority exists
9597 set getpriority d_getprior
9598 eval $inlibc
9599
9600 : see if prototypes for various getprotoxxx netdb.h functions are available
9601 echo " "
9602 set d_getprotoprotos getprotoent $i_netdb netdb.h
9603 eval $hasproto
9604
9605 : see if getprpwnam exists
9606 set getprpwnam d_getprpwnam
9607 eval $inlibc
9608
9609 : see if getpwent exists
9610 set getpwent d_getpwent
9611 eval $inlibc
9612
9613
9614 : see if getservbyname exists
9615 set getservbyname d_getsbyname
9616 eval $inlibc
9617
9618 : see if getservbyport exists
9619 set getservbyport d_getsbyport
9620 eval $inlibc
9621
9622 : see if getservent exists
9623 set getservent d_getsent
9624 eval $inlibc
9625
9626 : see if prototypes for various getservxxx netdb.h functions are available
9627 echo " "
9628 set d_getservprotos getservent $i_netdb netdb.h
9629 eval $hasproto
9630
9631 : see if getspnam exists
9632 set getspnam d_getspnam
9633 eval $inlibc
9634
9635 : see if gettimeofday or ftime exists
9636 set gettimeofday d_gettimeod
9637 eval $inlibc
9638 case "$d_gettimeod" in
9639 "$undef")
9640         set ftime d_ftime 
9641         eval $inlibc
9642         ;;
9643 *)
9644         val="$undef"; set d_ftime; eval $setvar
9645         ;;
9646 esac
9647 case "$d_gettimeod$d_ftime" in
9648 "$undef$undef")
9649         echo " "
9650         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9651         ;;
9652 esac
9653
9654 : see if this is an grp system
9655 set grp.h i_grp
9656 eval $inhdr
9657
9658 case "$i_grp" in
9659 $define)
9660         xxx=`./findhdr grp.h`
9661         $cppstdin $cppflags $cppminus < $xxx >$$.h
9662
9663         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9664                 val="$define"
9665         else
9666                 val="$undef"
9667         fi
9668         set d_grpasswd
9669         eval $setvar
9670
9671         $rm -f $$.h
9672         ;;
9673 *)
9674         val="$undef";
9675         set d_grpasswd; eval $setvar
9676         ;;
9677 esac
9678
9679 : see if hasmntopt exists
9680 set hasmntopt d_hasmntopt
9681 eval $inlibc
9682
9683 : see if this is a netinet/in.h or sys/in.h system
9684 set netinet/in.h i_niin sys/in.h i_sysin
9685 eval $inhdr
9686
9687 : see if arpa/inet.h has to be included
9688 set arpa/inet.h i_arpainet
9689 eval $inhdr
9690
9691 : see if htonl --and friends-- exists
9692 val=''
9693 set htonl val
9694 eval $inlibc
9695
9696 : Maybe they are macros.
9697 case "$val" in
9698 $undef)
9699         $cat >htonl.c <<EOM
9700 #include <stdio.h>
9701 #include <sys/types.h>
9702 #$i_niin I_NETINET_IN
9703 #$i_sysin I_SYS_IN
9704 #$i_arpainet I_ARPA_INET
9705 #ifdef I_NETINET_IN
9706 #include <netinet/in.h>
9707 #endif
9708 #ifdef I_SYS_IN
9709 #include <sys/in.h>
9710 #endif
9711 #ifdef I_ARPA_INET
9712 #include <arpa/inet.h>
9713 #endif
9714 #ifdef htonl
9715 printf("Defined as a macro.");
9716 #endif
9717 EOM
9718         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9719         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9720                 val="$define"
9721                 echo "But it seems to be defined as a macro." >&4
9722         fi
9723         $rm -f htonl.?
9724         ;;
9725 esac
9726 set d_htonl
9727 eval $setvar
9728
9729 : see if iconv exists
9730 set iconv d_iconv
9731 eval $inlibc
9732
9733 : index or strchr
9734 echo " "
9735 if set index val -f; eval $csym; $val; then
9736         if set strchr val -f d_strchr; eval $csym; $val; then
9737                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9738                         val="$define"
9739                         vali="$undef"
9740                         echo "strchr() found." >&4
9741                 else
9742                         val="$undef"
9743                         vali="$define"
9744                         echo "index() found." >&4
9745                 fi
9746         else
9747                 val="$undef"
9748                 vali="$define"
9749                 echo "index() found." >&4
9750         fi
9751 else
9752         if set strchr val -f d_strchr; eval $csym; $val; then
9753                 val="$define"
9754                 vali="$undef"
9755                 echo "strchr() found." >&4
9756         else
9757                 echo "No index() or strchr() found!" >&4
9758                 val="$undef"
9759                 vali="$undef"
9760         fi
9761 fi
9762 set d_strchr; eval $setvar
9763 val="$vali"
9764 set d_index; eval $setvar
9765
9766 : check whether inet_aton exists
9767 set inet_aton d_inetaton
9768 eval $inlibc
9769
9770 : see if inttypes.h is available
9771 : we want a real compile instead of Inhdr because some systems
9772 : have an inttypes.h which includes non-existent headers
9773 echo " "
9774 $cat >try.c <<EOCP
9775 #include <inttypes.h>
9776 int main() {
9777         static int32_t foo32 = 0x12345678;
9778 }
9779 EOCP
9780 set try
9781 if eval $compile; then
9782         echo "<inttypes.h> found." >&4
9783         val="$define"
9784 else
9785         echo "<inttypes.h> NOT found." >&4
9786         val="$undef"
9787 fi
9788 $rm -f try.c try
9789 set i_inttypes
9790 eval $setvar
9791
9792 : check for int64_t
9793 echo " "
9794 echo "Checking to see if you have int64_t..." >&4
9795 $cat >try.c <<EOCP
9796 #include <sys/types.h>
9797 #$i_inttypes I_INTTYPES
9798 #ifdef I_INTTYPES
9799 #include <inttypes.h>
9800 #endif
9801 int main() { int64_t x = 7; }
9802 EOCP
9803 set try
9804 if eval $compile; then
9805         val="$define"
9806         echo "You have int64_t."
9807 else
9808         val="$undef"
9809         echo "You do not have int64_t."
9810 fi
9811 $rm -f try try.*
9812 set d_int64_t
9813 eval $setvar
9814
9815 : Look for isascii
9816 echo " "
9817 $cat >isascii.c <<'EOCP'
9818 #include <stdio.h>
9819 #include <ctype.h>
9820 int main() {
9821         int c = 'A';
9822         if (isascii(c))
9823                 exit(0);
9824         else
9825                 exit(1);
9826 }
9827 EOCP
9828 set isascii
9829 if eval $compile; then
9830         echo "isascii() found." >&4
9831         val="$define"
9832 else
9833         echo "isascii() NOT found." >&4
9834         val="$undef"
9835 fi
9836 set d_isascii
9837 eval $setvar
9838 $rm -f isascii*
9839
9840 : see if isnan exists
9841 set isnan d_isnan
9842 eval $inlibc
9843
9844 : see if isnanl exists
9845 set isnanl d_isnanl
9846 eval $inlibc
9847
9848 : see if killpg exists
9849 set killpg d_killpg
9850 eval $inlibc
9851
9852 : see if lchown exists
9853 echo " "
9854 $cat > try.c <<'EOCP'
9855 /* System header to define __stub macros and hopefully few prototypes,
9856     which can conflict with char lchown(); below.  */
9857 #include <assert.h>
9858 /* Override any gcc2 internal prototype to avoid an error.  */
9859 /* We use char because int might match the return type of a gcc2
9860    builtin and then its argument prototype would still apply.  */
9861 char lchown();
9862 int main() {
9863     /*  The GNU C library defines this for functions which it implements
9864         to always fail with ENOSYS.  Some functions are actually named
9865         something starting with __ and the normal name is an alias.  */
9866 #if defined (__stub_lchown) || defined (__stub___lchown)
9867 choke me
9868 #else
9869 lchown();
9870 #endif
9871 ; return 0; }
9872 EOCP
9873 set try
9874 if eval $compile; then
9875     $echo "lchown() found." >&4
9876     val="$define"
9877 else
9878     $echo "lchown() NOT found." >&4
9879     val="$undef"
9880 fi
9881 set d_lchown
9882 eval $setvar
9883
9884 : See if number of significant digits in a double precision number is known
9885 echo " "
9886 $cat >ldbl_dig.c <<EOM
9887 #$i_limits I_LIMITS
9888 #$i_float I_FLOAT
9889 #ifdef I_LIMITS
9890 #include <limits.h>
9891 #endif
9892 #ifdef I_FLOAT
9893 #include <float.h>
9894 #endif
9895 #ifdef LDBL_DIG
9896 printf("Contains LDBL_DIG");
9897 #endif
9898 EOM
9899 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9900 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9901         echo "LDBL_DIG found." >&4
9902         val="$define"
9903 else
9904         echo "LDBL_DIG NOT found." >&4
9905         val="$undef"
9906 fi
9907 $rm -f ldbl_dig.?
9908 set d_ldbl_dig
9909 eval $setvar
9910
9911 : see if link exists
9912 set link d_link
9913 eval $inlibc
9914
9915 : see if localeconv exists
9916 set localeconv d_locconv
9917 eval $inlibc
9918
9919 : see if lockf exists
9920 set lockf d_lockf
9921 eval $inlibc
9922
9923 : check for long long
9924 echo " "
9925 echo "Checking to see if you have long long..." >&4
9926 echo 'int main() { long long x = 7; return 0; }' > try.c
9927 set try
9928 if eval $compile; then
9929         val="$define"
9930         echo "You have long long."
9931 else
9932         val="$undef"
9933         echo "You do not have long long."
9934 fi
9935 $rm try.*
9936 set d_longlong
9937 eval $setvar
9938
9939 : check for length of long long
9940 case "${d_longlong}${longlongsize}" in
9941 $define)
9942         echo " "
9943         echo "Checking to see how big your long longs are..." >&4
9944         $cat >try.c <<'EOCP'
9945 #include <stdio.h>
9946 int main()
9947 {
9948     printf("%d\n", (int)sizeof(long long));
9949     return(0);
9950 }
9951 EOCP
9952         set try
9953         if eval $compile_ok; then
9954                 longlongsize=`./try$exe_ext`
9955                 echo "Your long longs are $longlongsize bytes long."
9956         else
9957                 dflt='8'
9958                 echo " "
9959                 echo "(I can't seem to compile the test program.  Guessing...)"
9960                 rp="What is the size of a long long (in bytes)?"
9961                 . ./myread
9962                 longlongsize="$ans"
9963         fi
9964         if $test "X$longsize" = "X$longlongsize"; then
9965                 echo "(That isn't any different from an ordinary long.)"
9966         fi      
9967         ;;
9968 esac
9969 $rm -f try.* try
9970
9971 : see if prototype for lseek is available
9972 echo " "
9973 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9974 eval $hasproto
9975
9976 : see if lstat exists
9977 set lstat d_lstat
9978 eval $inlibc
9979
9980 : see if madvise exists
9981 set madvise d_madvise
9982 eval $inlibc
9983
9984 : see if mblen exists
9985 set mblen d_mblen
9986 eval $inlibc
9987
9988 : see if mbstowcs exists
9989 set mbstowcs d_mbstowcs
9990 eval $inlibc
9991
9992 : see if mbtowc exists
9993 set mbtowc d_mbtowc
9994 eval $inlibc
9995
9996 : see if memchr exists
9997 set memchr d_memchr
9998 eval $inlibc
9999
10000 : see if memcmp exists
10001 set memcmp d_memcmp
10002 eval $inlibc
10003
10004 : see if memcpy exists
10005 set memcpy d_memcpy
10006 eval $inlibc
10007
10008 : see if memmove exists
10009 set memmove d_memmove
10010 eval $inlibc
10011
10012 : see if memset exists
10013 set memset d_memset
10014 eval $inlibc
10015
10016 : see if mkdir exists
10017 set mkdir d_mkdir
10018 eval $inlibc
10019
10020 : see if mkdtemp exists
10021 set mkdtemp d_mkdtemp
10022 eval $inlibc
10023
10024 : see if mkfifo exists
10025 set mkfifo d_mkfifo
10026 eval $inlibc
10027
10028 : see if mkstemp exists
10029 set mkstemp d_mkstemp
10030 eval $inlibc
10031
10032 : see if mkstemps exists
10033 set mkstemps d_mkstemps
10034 eval $inlibc
10035
10036 : see if mktime exists
10037 set mktime d_mktime
10038 eval $inlibc
10039
10040 : see if this is a sys/mman.h system
10041 set sys/mman.h i_sysmman
10042 eval $inhdr
10043
10044 : see if mmap exists
10045 set mmap d_mmap
10046 eval $inlibc
10047 : see what shmat returns
10048 : default to something harmless
10049 mmaptype='void *'
10050 case "$i_sysmman$d_mmap" in
10051 "$define$define")
10052         $cat >mmap.c <<'END'
10053 #include <sys/mman.h>
10054 void *mmap();
10055 END
10056         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10057                 mmaptype='void *'
10058         else
10059                 mmaptype='caddr_t'
10060         fi
10061         echo "and it returns ($mmaptype)." >&4
10062         ;;
10063 esac
10064
10065
10066
10067 : see if modfl exists
10068 set modfl d_modfl
10069 eval $inlibc
10070
10071 : see if mprotect exists
10072 set mprotect d_mprotect
10073 eval $inlibc
10074
10075 : see if msgctl exists
10076 set msgctl d_msgctl
10077 eval $inlibc
10078
10079 : see if msgget exists
10080 set msgget d_msgget
10081 eval $inlibc
10082
10083 : see if msgsnd exists
10084 set msgsnd d_msgsnd
10085 eval $inlibc
10086
10087 : see if msgrcv exists
10088 set msgrcv d_msgrcv
10089 eval $inlibc
10090
10091 : see how much of the 'msg*(2)' library is present.
10092 h_msg=true
10093 echo " "
10094 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10095 *"$undef"*) h_msg=false;;
10096 esac
10097 case "$osname" in
10098 freebsd)
10099     case "`ipcs 2>&1`" in
10100     "SVID messages"*"not configured"*)
10101         echo "Your $osname does not have the msg*(2) configured." >&4
10102         h_msg=false
10103         val="$undef"
10104         set msgctl d_msgctl
10105         eval $setvar
10106         set msgget d_msgget
10107         eval $setvar
10108         set msgsnd d_msgsnd
10109         eval $setvar
10110         set msgrcv d_msgrcv
10111         eval $setvar
10112         ;;
10113     esac
10114     ;;
10115 esac
10116 : we could also check for sys/ipc.h ...
10117 if $h_msg && $test `./findhdr sys/msg.h`; then
10118         echo "You have the full msg*(2) library." >&4
10119         val="$define"
10120 else
10121         echo "You don't have the full msg*(2) library." >&4
10122         val="$undef"
10123 fi
10124 set d_msg
10125 eval $setvar
10126
10127 : see if msync exists
10128 set msync d_msync
10129 eval $inlibc
10130
10131 : see if munmap exists
10132 set munmap d_munmap
10133 eval $inlibc
10134
10135 : see if nice exists
10136 set nice d_nice
10137 eval $inlibc
10138
10139
10140 echo " "
10141 echo "Checking which 64-bit integer type we could use..." >&4
10142
10143 case "$intsize" in
10144 8) val=int
10145    set quadtype
10146    eval $setvar
10147    val='"unsigned int"'
10148    set uquadtype
10149    eval $setvar
10150    quadkind=1
10151    ;;
10152 *) case "$longsize" in
10153    8) val=long
10154       set quadtype
10155       eval $setvar
10156       val='"unsigned long"'
10157       set uquadtype
10158       eval $setvar
10159       quadkind=2
10160       ;;
10161    *) case "$d_longlong:$longlongsize" in
10162       define:8)
10163         val='"long long"'
10164         set quadtype
10165         eval $setvar
10166         val='"unsigned long long"'
10167         set uquadtype
10168         eval $setvar
10169         quadkind=3
10170         ;;
10171       *) case "$d_int64_t" in
10172          define)
10173            val=int64_t
10174            set quadtype
10175            eval $setvar
10176            val=uint64_t
10177            set uquadtype
10178            eval $setvar
10179            quadkind=4
10180            ;;
10181          esac
10182          ;;
10183       esac
10184       ;;
10185    esac
10186    ;;
10187 esac
10188
10189 case "$quadtype" in
10190 '')     echo "Alas, no 64-bit integer types in sight." >&4
10191         d_quad="$undef"
10192         ;;
10193 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10194             verb="will"
10195         else
10196             verb="could"
10197         fi
10198         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10199         d_quad="$define"
10200         ;;
10201 esac
10202
10203 : check for length of character
10204 echo " "
10205 case "$charsize" in
10206 '')
10207         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10208         $cat >try.c <<'EOCP'
10209 #include <stdio.h>
10210 int main()
10211 {
10212     printf("%d\n", (int)sizeof(char));
10213     exit(0);
10214 }
10215 EOCP
10216         set try
10217         if eval $compile_ok; then
10218                 dflt=`./try`
10219         else
10220                 dflt='1'
10221                 echo "(I can't seem to compile the test program.  Guessing...)"
10222         fi
10223         ;;
10224 *)
10225         dflt="$charsize"
10226         ;;
10227 esac
10228 rp="What is the size of a character (in bytes)?"
10229 . ./myread
10230 charsize="$ans"
10231 $rm -f try.c try
10232
10233 : check for volatile keyword
10234 echo " "
10235 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10236 $cat >try.c <<'EOCP'
10237 int main()
10238 {
10239         typedef struct _goo_struct goo_struct;
10240         goo_struct * volatile goo = ((goo_struct *)0);
10241         struct _goo_struct {
10242                 long long_int;
10243                 int reg_int;
10244                 char char_var;
10245         };
10246         typedef unsigned short foo_t;
10247         char *volatile foo;
10248         volatile int bar;
10249         volatile foo_t blech;
10250         foo = foo;
10251 }
10252 EOCP
10253 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10254         val="$define"
10255         echo "Yup, it does."
10256 else
10257         val="$undef"
10258         echo "Nope, it doesn't."
10259 fi
10260 set d_volatile
10261 eval $setvar
10262 $rm -f try.*
10263
10264
10265 echo " "
10266 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10267
10268 case "$use64bitint:$d_quad:$quadtype" in
10269 define:define:?*)
10270         ivtype="$quadtype"
10271         uvtype="$uquadtype"
10272         ivsize=8
10273         uvsize=8
10274         ;;
10275 *)      ivtype="long"
10276         uvtype="unsigned long"
10277         ivsize=$longsize
10278         uvsize=$longsize
10279         ;;
10280 esac
10281
10282 case "$uselongdouble:$d_longdbl" in
10283 define:define)
10284         nvtype="long double"
10285         nvsize=$longdblsize
10286         ;;
10287 *)      nvtype=double
10288         nvsize=$doublesize
10289         ;;
10290 esac
10291
10292 $echo "(IV will be "$ivtype", $ivsize bytes)"
10293 $echo "(UV will be "$uvtype", $uvsize bytes)"
10294 $echo "(NV will be "$nvtype", $nvsize bytes)"
10295
10296 $cat >try.c <<EOCP
10297 #$i_inttypes I_INTTYPES
10298 #ifdef I_INTTYPES
10299 #include <inttypes.h>
10300 #endif
10301 #include <stdio.h>
10302 int main() {
10303 #ifdef INT8
10304    int8_t i =  INT8_MAX;
10305   uint8_t u = UINT8_MAX;
10306   printf("int8_t\n");
10307 #endif
10308 #ifdef INT16
10309    int16_t i =  INT16_MAX;
10310   uint16_t i = UINT16_MAX;
10311   printf("int16_t\n");
10312 #endif
10313 #ifdef INT32
10314    int32_t i =  INT32_MAX;
10315   uint32_t u = UINT32_MAX;
10316   printf("int32_t\n");
10317 #endif
10318 }
10319 EOCP
10320
10321 case "$i8type" in
10322 '')     case "$charsize" in
10323         1)      i8type=char
10324                 u8type="unsigned char"
10325                 i8size=$charsize
10326                 u8size=$charsize
10327                 ;;
10328         esac
10329         ;;
10330 esac
10331 case "$i8type" in
10332 '')     set try -DINT8
10333         if eval $compile; then
10334                 case "`./try$exe_ext`" in
10335                 int8_t) i8type=int8_t
10336                         u8type=uint8_t
10337                         i8size=1
10338                         u8size=1
10339                         ;;
10340                 esac
10341         fi
10342         ;;
10343 esac
10344 case "$i8type" in
10345 '')     if $test $charsize -ge 1; then
10346                 i8type=char
10347                 u8type="unsigned char"
10348                 i8size=$charsize
10349                 u8size=$charsize
10350         fi
10351         ;;
10352 esac
10353
10354 case "$i16type" in
10355 '')     case "$shortsize" in
10356         2)      i16type=short
10357                 u16type="unsigned short"
10358                 i16size=$shortsize
10359                 u16size=$shortsize
10360                 ;;
10361         esac
10362         ;;
10363 esac
10364 case "$i16type" in
10365 '')     set try -DINT16
10366         if eval $compile; then
10367                 case "`./try$exe_ext`" in
10368                 int16_t)
10369                         i16type=int16_t
10370                         u16type=uint16_t
10371                         i16size=2
10372                         u16size=2
10373                         ;;
10374                 esac
10375         fi
10376         ;;
10377 esac
10378 case "$i16type" in
10379 '')     if $test $shortsize -ge 2; then
10380                 i16type=short
10381                 u16type="unsigned short"
10382                 i16size=$shortsize
10383                 u16size=$shortsize
10384         fi
10385         ;;
10386 esac
10387
10388 case "$i32type" in
10389 '')     case "$longsize" in
10390         4)      i32type=long
10391                 u32type="unsigned long"
10392                 i32size=$longsize
10393                 u32size=$longsize
10394                 ;;
10395         *)      case "$intsize" in
10396                 4)      i32type=int
10397                         u32type="unsigned int"
10398                         i32size=$intsize
10399                         u32size=$intsize
10400                         ;;
10401                 esac
10402                 ;;
10403         esac
10404         ;;
10405 esac
10406 case "$i32type" in
10407 '')     set try -DINT32
10408         if eval $compile; then
10409                 case "`./try$exe_ext`" in
10410                 int32_t)
10411                         i32type=int32_t
10412                         u32type=uint32_t
10413                         i32size=4
10414                         u32size=4
10415                         ;;
10416                 esac
10417         fi
10418         ;;
10419 esac
10420 case "$i32type" in
10421 '')     if $test $intsize -ge 4; then
10422                 i32type=int
10423                 u32type="unsigned int"
10424                 i32size=$intsize
10425                 u32size=$intsize
10426         fi
10427         ;;
10428 esac
10429
10430 case "$i64type" in
10431 '')     case "$d_quad:$quadtype" in
10432         define:?*)
10433                 i64type="$quadtype"
10434                 u64type="$uquadtype"
10435                 i64size=8
10436                 u64size=8
10437                 ;;
10438         esac
10439         ;;
10440 esac
10441
10442 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10443 : volatile so that the compiler has to store it out to memory.
10444 if test X"$d_volatile" = X"$define"; then
10445         volatile=volatile
10446 fi
10447 $cat <<EOP >try.c
10448 #include <stdio.h>
10449 #include <sys/types.h>
10450 #include <signal.h>
10451 #ifdef SIGFPE
10452 $volatile int bletched = 0;
10453 $signal_t blech(s) int s; { bletched = 1; }
10454 #endif
10455 int main() {
10456     $uvtype u = 0;
10457     $nvtype d;
10458     int     n = 8 * $uvsize;
10459     int     i;
10460 #ifdef SIGFPE
10461     signal(SIGFPE, blech);
10462 #endif
10463
10464     for (i = 0; i < n; i++) {
10465       u = u << 1 | ($uvtype)1;
10466       d = ($nvtype)u;
10467       if (($uvtype)d != u)
10468         break;
10469       if (d <= 0)
10470         break;
10471       d = ($nvtype)(u - 1);
10472       if (($uvtype)d != (u - 1))
10473         break;
10474 #ifdef SIGFPE
10475       if (bletched) {
10476         break;
10477 #endif
10478       } 
10479     }
10480     printf("%d\n", ((i == n) ? -n : i));
10481     exit(0);
10482 }
10483 EOP
10484 set try
10485
10486 d_nv_preserves_uv="$undef"
10487 if eval $compile; then
10488         d_nv_preserves_uv_bits="`./try$exe_ext`"
10489 fi
10490 case "$d_nv_preserves_uv_bits" in
10491 \-[1-9]*)       
10492         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10493         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10494         d_nv_preserves_uv="$define"
10495         ;;
10496 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10497         d_nv_preserves_uv="$undef" ;;
10498 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10499         d_nv_preserves_uv_bits="$undef" ;;
10500 esac
10501
10502 $rm -f try.* try
10503
10504
10505 : check for off64_t
10506 echo " "
10507 echo "Checking to see if you have off64_t..." >&4
10508 $cat >try.c <<EOCP
10509 #include <sys/types.h>
10510 #include <unistd.h>
10511 int main() { off64_t x = 7; }
10512 EOCP
10513 set try
10514 if eval $compile; then
10515         val="$define"
10516         echo "You have off64_t."
10517 else
10518         val="$undef"
10519         echo "You do not have off64_t."
10520         case "$lseeksize" in
10521         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10522         esac
10523 fi
10524 $rm -f try.* try
10525 set d_off64_t
10526 eval $setvar
10527
10528 : see if POSIX threads are available
10529 set pthread.h i_pthread
10530 eval $inhdr
10531
10532
10533
10534
10535 : how to create joinable pthreads
10536 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10537         echo " "
10538         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10539         $cat >try.c <<'EOCP'
10540 #include <pthread.h>
10541 int main() {
10542     int detachstate = JOINABLE;
10543 }
10544 EOCP
10545         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10546         if eval $compile; then
10547                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10548                 val="$undef" # Yes, undef.
10549                 set d_old_pthread_create_joinable
10550                 eval $setvar
10551                 val=""
10552                 set old_pthread_create_joinable
10553                 eval $setvar
10554         else
10555                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10556                 if eval $compile; then
10557                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10558                         val="$define"
10559                         set d_old_pthread_create_joinable
10560                         eval $setvar
10561                         val=PTHREAD_CREATE_UNDETACHED
10562                         set old_pthread_create_joinable
10563                         eval $setvar
10564                 else            
10565                         set try -DJOINABLE=__UNDETACHED
10566                         if eval $compile; then
10567                                 echo "You seem to use __UNDETACHED." >&4
10568                                 val="$define"
10569                                 set d_old_pthread_create_joinable
10570                                 eval $setvar
10571                                 val=__UNDETACHED
10572                                 set old_pthread_create_joinable
10573                                 eval $setvar
10574                         else
10575                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10576                                 val="$define"
10577                                 set d_old_pthread_create_joinable
10578                                 eval $setvar
10579                                 val=0
10580                                 set old_pthread_create_joinable
10581                                 eval $setvar
10582                         fi
10583                 fi
10584         fi
10585         $rm -f try try.*
10586 else
10587     d_old_pthread_create_joinable="$undef"
10588     old_pthread_create_joinable=""
10589 fi
10590
10591 : see if pause exists
10592 set pause d_pause
10593 eval $inlibc
10594
10595 : see if pipe exists
10596 set pipe d_pipe
10597 eval $inlibc
10598
10599 : see if poll exists
10600 set poll d_poll
10601 eval $inlibc
10602
10603
10604 : see whether the various POSIXish _yields exist
10605 $cat >try.c <<EOP
10606 #include <pthread.h>
10607 #include <stdio.h>
10608 int main() {
10609 #ifdef SCHED_YIELD
10610         sched_yield();
10611 #else
10612 #ifdef PTHREAD_YIELD
10613         pthread_yield();
10614 #else
10615 #ifdef PTHREAD_YIELD_NULL
10616         pthread_yield(NULL);
10617 #endif
10618 #endif
10619 #endif
10620 }
10621 EOP
10622 : see if sched_yield exists
10623 set try -DSCHED_YIELD
10624 if eval $compile; then
10625     val="$define"
10626     sched_yield='sched_yield()'
10627 else
10628     val="$undef"
10629 fi
10630 case "$usethreads" in
10631 $define)
10632         case "$val" in
10633         $define) echo 'sched_yield() found.' >&4        ;;
10634         *)       echo 'sched_yield() NOT found.' >&4    ;;
10635         esac
10636 esac
10637 set d_sched_yield
10638 eval $setvar
10639
10640 : see if pthread_yield exists
10641 set try -DPTHREAD_YIELD
10642 if eval $compile; then
10643     val="$define"
10644     case "$sched_yield" in
10645     '') sched_yield='pthread_yield()' ;;
10646     esac
10647 else
10648     set try -DPTHREAD_YIELD_NULL
10649     if eval $compile; then
10650         val="$define"
10651         case "$sched_yield" in
10652         '') sched_yield='pthread_yield(NULL)' ;;
10653         esac
10654     else
10655         val="$undef"
10656     fi
10657 fi
10658 case "$usethreads" in
10659 $define)
10660         case "$val" in
10661         $define) echo 'pthread_yield() found.' >&4      ;;
10662         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10663         esac
10664         ;;
10665 esac
10666 set d_pthread_yield
10667 eval $setvar
10668
10669 case "$sched_yield" in
10670 '') sched_yield=undef ;;
10671 esac
10672
10673 $rm -f try try.*
10674
10675 : see if this is a pwd.h system
10676 set pwd.h i_pwd
10677 eval $inhdr
10678
10679 case "$i_pwd" in
10680 $define)
10681         xxx=`./findhdr pwd.h`
10682         $cppstdin $cppflags $cppminus < $xxx >$$.h
10683
10684         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10685                 val="$define"
10686         else
10687                 val="$undef"
10688         fi
10689         set d_pwquota
10690         eval $setvar
10691
10692         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10693                 val="$define"
10694         else
10695                 val="$undef"
10696         fi
10697         set d_pwage
10698         eval $setvar
10699
10700         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10701                 val="$define"
10702         else
10703                 val="$undef"
10704         fi
10705         set d_pwchange
10706         eval $setvar
10707
10708         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10709                 val="$define"
10710         else
10711                 val="$undef"
10712         fi
10713         set d_pwclass
10714         eval $setvar
10715
10716         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10717                 val="$define"
10718         else
10719                 val="$undef"
10720         fi
10721         set d_pwexpire
10722         eval $setvar
10723
10724         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10725                 val="$define"
10726         else
10727                 val="$undef"
10728         fi
10729         set d_pwcomment
10730         eval $setvar
10731
10732         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10733                 val="$define"
10734         else
10735                 val="$undef"
10736         fi
10737         set d_pwgecos
10738         eval $setvar
10739
10740         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10741                 val="$define"
10742         else
10743                 val="$undef"
10744         fi
10745         set d_pwpasswd
10746         eval $setvar
10747
10748         $rm -f $$.h
10749         ;;
10750 *)
10751         val="$undef"; 
10752         set d_pwquota; eval $setvar
10753         set d_pwage; eval $setvar
10754         set d_pwchange; eval $setvar
10755         set d_pwclass; eval $setvar
10756         set d_pwexpire; eval $setvar
10757         set d_pwcomment; eval $setvar
10758         set d_pwgecos; eval $setvar
10759         set d_pwpasswd; eval $setvar
10760         ;;
10761 esac
10762
10763 : see if readdir and friends exist
10764 set readdir d_readdir
10765 eval $inlibc
10766 set seekdir d_seekdir
10767 eval $inlibc
10768 set telldir d_telldir
10769 eval $inlibc
10770 set rewinddir d_rewinddir
10771 eval $inlibc
10772
10773 : see if readlink exists
10774 set readlink d_readlink
10775 eval $inlibc
10776
10777 : see if rename exists
10778 set rename d_rename
10779 eval $inlibc
10780
10781 : see if rmdir exists
10782 set rmdir d_rmdir
10783 eval $inlibc
10784
10785 : see if memory.h is available.
10786 val=''
10787 set memory.h val
10788 eval $inhdr
10789
10790 : See if it conflicts with string.h
10791 case "$val" in
10792 $define)
10793         case "$strings" in
10794         '') ;;
10795         *)
10796                 $cppstdin $cppflags $cppminus < $strings > mem.h
10797                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10798                         echo " "
10799                         echo "We won't be including <memory.h>."
10800                         val="$undef"
10801                 fi
10802                 $rm -f mem.h
10803                 ;;
10804         esac
10805 esac
10806 set i_memory
10807 eval $setvar
10808
10809 : can bcopy handle overlapping blocks?
10810 val="$undef"
10811 case "$d_bcopy" in
10812 "$define")
10813         echo " "
10814         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10815         $cat >try.c <<EOCP
10816 #$i_memory I_MEMORY
10817 #$i_stdlib I_STDLIB
10818 #$i_string I_STRING
10819 #$i_unistd I_UNISTD
10820 EOCP
10821         $cat >>try.c <<'EOCP'
10822 #include <stdio.h>
10823 #ifdef I_MEMORY
10824 #  include <memory.h>
10825 #endif
10826 #ifdef I_STDLIB
10827 #  include <stdlib.h>
10828 #endif
10829 #ifdef I_STRING
10830 #  include <string.h>
10831 #else
10832 #  include <strings.h>
10833 #endif
10834 #ifdef I_UNISTD
10835 #  include <unistd.h>  /* Needed for NetBSD */
10836 #endif
10837 int main()
10838 {
10839 char buf[128], abc[128];
10840 char *b;
10841 int len;
10842 int off;
10843 int align;
10844
10845 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10846
10847 for (align = 7; align >= 0; align--) {
10848         for (len = 36; len; len--) {
10849                 b = buf+align;
10850                 bcopy(abc, b, len);
10851                 for (off = 1; off <= len; off++) {
10852                         bcopy(b, b+off, len);
10853                         bcopy(b+off, b, len);
10854                         if (bcmp(b, abc, len))
10855                                 exit(1);
10856                 }
10857         }
10858 }
10859 exit(0);
10860 }
10861 EOCP
10862         set try
10863         if eval $compile_ok; then
10864                 if ./try 2>/dev/null; then
10865                         echo "Yes, it can."
10866                         val="$define"
10867                 else
10868                         echo "It can't, sorry."
10869                         case "$d_memmove" in
10870                         "$define") echo "But that's Ok since you have memmove()." ;;
10871                         esac
10872                 fi
10873         else
10874                 echo "(I can't compile the test program, so we'll assume not...)"
10875                 case "$d_memmove" in
10876                 "$define") echo "But that's Ok since you have memmove()." ;;
10877                 esac
10878         fi
10879         ;;
10880 esac
10881 $rm -f try.* try core
10882 set d_safebcpy
10883 eval $setvar
10884
10885 : can memcpy handle overlapping blocks?
10886 val="$undef"
10887 case "$d_memcpy" in
10888 "$define")
10889         echo " "
10890         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10891         $cat >try.c <<EOCP
10892 #$i_memory I_MEMORY
10893 #$i_stdlib I_STDLIB
10894 #$i_string I_STRING
10895 #$i_unistd I_UNISTD
10896 EOCP
10897         $cat >>try.c <<'EOCP'
10898 #include <stdio.h>
10899 #ifdef I_MEMORY
10900 #  include <memory.h>
10901 #endif
10902 #ifdef I_STDLIB
10903 #  include <stdlib.h>
10904 #endif
10905 #ifdef I_STRING
10906 #  include <string.h>
10907 #else
10908 #  include <strings.h>
10909 #endif
10910 #ifdef I_UNISTD
10911 #  include <unistd.h>  /* Needed for NetBSD */
10912 #endif
10913 int main()
10914 {
10915 char buf[128], abc[128];
10916 char *b;
10917 int len;
10918 int off;
10919 int align;
10920
10921 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10922    try to store the string in read-only memory. */
10923 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10924
10925 for (align = 7; align >= 0; align--) {
10926         for (len = 36; len; len--) {
10927                 b = buf+align;
10928                 memcpy(b, abc, len);
10929                 for (off = 1; off <= len; off++) {
10930                         memcpy(b+off, b, len);
10931                         memcpy(b, b+off, len);
10932                         if (memcmp(b, abc, len))
10933                                 exit(1);
10934                 }
10935         }
10936 }
10937 exit(0);
10938 }
10939 EOCP
10940         set try
10941         if eval $compile_ok; then
10942                 if ./try 2>/dev/null; then
10943                         echo "Yes, it can."
10944                         val="$define"
10945                 else
10946                         echo "It can't, sorry."
10947                         case "$d_memmove" in
10948                         "$define") echo "But that's Ok since you have memmove()." ;;
10949                         esac
10950                 fi
10951         else
10952                 echo "(I can't compile the test program, so we'll assume not...)"
10953                 case "$d_memmove" in
10954                 "$define") echo "But that's Ok since you have memmove()." ;;
10955                 esac
10956         fi
10957         ;;
10958 esac
10959 $rm -f try.* try core
10960 set d_safemcpy
10961 eval $setvar
10962
10963 : can memcmp be trusted to compare relative magnitude?
10964 val="$undef"
10965 case "$d_memcmp" in
10966 "$define")
10967         echo " "
10968         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10969         $cat >try.c <<EOCP
10970 #$i_memory I_MEMORY
10971 #$i_stdlib I_STDLIB
10972 #$i_string I_STRING
10973 #$i_unistd I_UNISTD
10974 EOCP
10975         $cat >>try.c <<'EOCP'
10976 #include <stdio.h>
10977 #ifdef I_MEMORY
10978 #  include <memory.h>
10979 #endif
10980 #ifdef I_STDLIB
10981 #  include <stdlib.h>
10982 #endif
10983 #ifdef I_STRING
10984 #  include <string.h>
10985 #else
10986 #  include <strings.h>
10987 #endif
10988 #ifdef I_UNISTD
10989 #  include <unistd.h>  /* Needed for NetBSD */
10990 #endif
10991 int main()
10992 {
10993 char a = -1;
10994 char b = 0;
10995 if ((a < b) && memcmp(&a, &b, 1) < 0)
10996         exit(1);
10997 exit(0);
10998 }
10999 EOCP
11000         set try
11001         if eval $compile_ok; then
11002                 if ./try 2>/dev/null; then
11003                         echo "Yes, it can."
11004                         val="$define"
11005                 else
11006                         echo "No, it can't (it uses signed chars)."
11007                 fi
11008         else
11009                 echo "(I can't compile the test program, so we'll assume not...)"
11010         fi
11011         ;;
11012 esac
11013 $rm -f try.* try core
11014 set d_sanemcmp
11015 eval $setvar
11016
11017 : see if prototype for sbrk is available
11018 echo " "
11019 set d_sbrkproto sbrk $i_unistd unistd.h
11020 eval $hasproto
11021
11022 : see if select exists
11023 set select d_select
11024 eval $inlibc
11025
11026 : see if semctl exists
11027 set semctl d_semctl
11028 eval $inlibc
11029
11030 : see if semget exists
11031 set semget d_semget
11032 eval $inlibc
11033
11034 : see if semop exists
11035 set semop d_semop
11036 eval $inlibc
11037
11038 : see how much of the 'sem*(2)' library is present.
11039 h_sem=true
11040 echo " "
11041 case "$d_semctl$d_semget$d_semop" in
11042 *"$undef"*) h_sem=false;;
11043 esac
11044 case "$osname" in
11045 freebsd)
11046     case "`ipcs 2>&1`" in
11047     "SVID messages"*"not configured"*)
11048         echo "Your $osname does not have the sem*(2) configured." >&4
11049         h_sem=false
11050         val="$undef"
11051         set semctl d_semctl
11052         eval $setvar
11053         set semget d_semget
11054         eval $setvar
11055         set semop d_semop
11056         eval $setvar
11057         ;;
11058     esac
11059     ;;
11060 esac
11061 : we could also check for sys/ipc.h ...
11062 if $h_sem && $test `./findhdr sys/sem.h`; then
11063         echo "You have the full sem*(2) library." >&4
11064         val="$define"
11065 else
11066         echo "You don't have the full sem*(2) library." >&4
11067         val="$undef"
11068 fi
11069 set d_sem
11070 eval $setvar
11071
11072 : see whether sys/sem.h defines union semun
11073 echo " "
11074 $cat > try.c <<'END'
11075 #include <sys/types.h>
11076 #include <sys/ipc.h>
11077 #include <sys/sem.h>
11078 int main () { union semun semun; semun.buf = 0; }
11079 END
11080 set try
11081 if eval $compile; then
11082     echo "You have union semun in <sys/sem.h>." >&4
11083     val="$define"
11084 else
11085     echo "You do not have union semun in <sys/sem.h>." >&4
11086     val="$undef"
11087 fi
11088 $rm -f try try.c try.h
11089 set d_union_semun
11090 eval $setvar
11091
11092 : see how to do semctl IPC_STAT
11093 case "$d_sem" in
11094 $define)
11095     : see whether semctl IPC_STAT can use union semun
11096     echo " "
11097     $cat > try.h <<END
11098 #ifndef S_IRUSR
11099 #   ifdef S_IREAD
11100 #       define S_IRUSR S_IREAD
11101 #       define S_IWUSR S_IWRITE
11102 #       define S_IXUSR S_IEXEC
11103 #   else
11104 #       define S_IRUSR 0400
11105 #       define S_IWUSR 0200
11106 #       define S_IXUSR 0100
11107 #   endif
11108 #   define S_IRGRP (S_IRUSR>>3)
11109 #   define S_IWGRP (S_IWUSR>>3)
11110 #   define S_IXGRP (S_IXUSR>>3)
11111 #   define S_IROTH (S_IRUSR>>6)
11112 #   define S_IWOTH (S_IWUSR>>6)
11113 #   define S_IXOTH (S_IXUSR>>6)
11114 #endif
11115 #ifndef S_IRWXU
11116 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11117 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11118 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11119 #endif
11120 END
11121
11122     $cat > try.c <<END
11123 #include <sys/types.h>
11124 #include <sys/ipc.h>
11125 #include <sys/sem.h>
11126 #include <sys/stat.h>
11127 #include <stdio.h>
11128 #include <errno.h>
11129 #include "try.h"
11130 #ifndef errno
11131 extern int errno;
11132 #endif
11133 #$d_union_semun HAS_UNION_SEMUN
11134 int main() {
11135     union semun
11136 #ifndef HAS_UNION_SEMUN
11137     {
11138         int val;
11139         struct semid_ds *buf;
11140         unsigned short *array;
11141     }
11142 #endif
11143     arg;
11144     int sem, st;
11145
11146 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11147     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11148     if (sem > -1) {
11149         struct semid_ds argbuf;
11150         arg.buf = &argbuf;
11151 #       ifdef IPC_STAT
11152         st = semctl(sem, 0, IPC_STAT, arg);
11153         if (st == 0)
11154             printf("semun\n");
11155         else
11156 #       endif /* IPC_STAT */
11157             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11158 #       ifdef IPC_RMID
11159         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11160 #       endif /* IPC_RMID */
11161             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11162     } else
11163 #endif /* IPC_PRIVATE && ... */
11164         printf("semget failed: errno = %d\n", errno);
11165   return 0;
11166 }
11167 END
11168     val="$undef"
11169     set try
11170     if eval $compile; then
11171         xxx=`./try`
11172         case "$xxx" in
11173         semun) val="$define" ;;
11174         esac
11175     fi
11176     $rm -f try try.c
11177     set d_semctl_semun
11178     eval $setvar
11179     case "$d_semctl_semun" in
11180     $define)
11181         echo "You can use union semun for semctl IPC_STAT." >&4
11182         also='also'
11183         ;;
11184     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11185         also=''
11186         ;;
11187     esac
11188
11189     : see whether semctl IPC_STAT can use struct semid_ds pointer
11190     $cat > try.c <<'END'
11191 #include <sys/types.h>
11192 #include <sys/ipc.h>
11193 #include <sys/sem.h>
11194 #include <sys/stat.h>
11195 #include "try.h"
11196 #include <stdio.h>
11197 #include <errno.h>
11198 #ifndef errno
11199 extern int errno;
11200 #endif
11201 int main() {
11202     struct semid_ds arg;
11203     int sem, st;
11204
11205 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11206     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11207     if (sem > -1) {
11208 #       ifdef IPC_STAT
11209         st = semctl(sem, 0, IPC_STAT, &arg);
11210         if (st == 0)
11211             printf("semid_ds\n");
11212         else
11213 #       endif /* IPC_STAT */
11214             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11215 #       ifdef IPC_RMID
11216         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11217 #       endif /* IPC_RMID */
11218             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11219     } else
11220 #endif /* IPC_PRIVATE && ... */
11221         printf("semget failed: errno = %d\n", errno);
11222
11223     return 0;
11224 }
11225 END
11226     val="$undef"
11227     set try
11228     if eval $compile; then
11229         xxx=`./try`
11230         case "$xxx" in
11231         semid_ds) val="$define" ;;
11232         esac
11233     fi
11234     $rm -f try try.c
11235     set d_semctl_semid_ds
11236     eval $setvar
11237     case "$d_semctl_semid_ds" in
11238     $define)
11239         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11240         ;;
11241     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11242         ;;
11243     esac
11244     $rm -f try.h
11245     ;;
11246 *)  val="$undef"
11247
11248     # We do not have the full sem*(2) library, so assume we can not
11249     # use either.
11250
11251     set d_semctl_semun
11252     eval $setvar
11253
11254     set d_semctl_semid_ds
11255     eval $setvar
11256     ;;
11257 esac
11258
11259 : see if setegid exists
11260 set setegid d_setegid
11261 eval $inlibc
11262
11263 : see if seteuid exists
11264 set seteuid d_seteuid
11265 eval $inlibc
11266
11267 : see if setgrent exists
11268 set setgrent d_setgrent
11269 eval $inlibc
11270
11271 : see if sethostent exists
11272 set sethostent d_sethent
11273 eval $inlibc
11274
11275 : see if setlinebuf exists
11276 set setlinebuf d_setlinebuf
11277 eval $inlibc
11278
11279 : see if setlocale exists
11280 set setlocale d_setlocale
11281 eval $inlibc
11282
11283 : see if setnetent exists
11284 set setnetent d_setnent
11285 eval $inlibc
11286
11287 : see if setprotoent exists
11288 set setprotoent d_setpent
11289 eval $inlibc
11290
11291 : see if setpgid exists
11292 set setpgid d_setpgid
11293 eval $inlibc
11294
11295 : see if setpgrp2 exists
11296 set setpgrp2 d_setpgrp2
11297 eval $inlibc
11298
11299 : see if setpriority exists
11300 set setpriority d_setprior
11301 eval $inlibc
11302
11303 : see if setproctitle exists
11304 set setproctitle d_setproctitle
11305 eval $inlibc
11306
11307 : see if setpwent exists
11308 set setpwent d_setpwent
11309 eval $inlibc
11310
11311 : see if setregid exists
11312 set setregid d_setregid
11313 eval $inlibc
11314 set setresgid d_setresgid
11315 eval $inlibc
11316
11317 : see if setreuid exists
11318 set setreuid d_setreuid
11319 eval $inlibc
11320 set setresuid d_setresuid
11321 eval $inlibc
11322
11323 : see if setrgid exists
11324 set setrgid d_setrgid
11325 eval $inlibc
11326
11327 : see if setruid exists
11328 set setruid d_setruid
11329 eval $inlibc
11330
11331 : see if setservent exists
11332 set setservent d_setsent
11333 eval $inlibc
11334
11335 : see if setsid exists
11336 set setsid d_setsid
11337 eval $inlibc
11338
11339 : see if setvbuf exists
11340 set setvbuf d_setvbuf
11341 eval $inlibc
11342
11343 : see if sfio.h is available
11344 set sfio.h i_sfio
11345 eval $inhdr
11346
11347
11348 : see if sfio library is available
11349 case "$i_sfio" in
11350 $define)
11351         val=''
11352         set sfreserve val
11353         eval $inlibc
11354         ;;
11355 *)
11356         val="$undef"
11357         ;;
11358 esac
11359 : Ok, but do we want to use it.
11360 case "$val" in
11361 $define)
11362         case "$usesfio" in
11363         true|$define|[yY]*) dflt='y';;
11364         *) dflt='n';;
11365         esac
11366         echo "$package can use the sfio library, but it is experimental."
11367         case "$useperlio" in
11368         "$undef")
11369             echo "For sfio also the PerlIO abstraction layer is needed."
11370             echo "Earlier you said you wouldn't want that."
11371             ;;
11372         esac
11373         rp="You seem to have sfio available, do you want to try using it?"
11374         . ./myread
11375         case "$ans" in
11376         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11377                 useperlio="$define"
11378                 val="$define"
11379                 ;;
11380         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11381                 val="$undef"
11382                 : Remove sfio from list of libraries to use
11383                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11384                 shift
11385                 libs="$*"
11386                 echo "libs = $libs" >&4
11387                 ;;
11388         esac
11389         ;;
11390 *)      case "$usesfio" in
11391         true|$define|[yY]*)
11392                 echo "Sorry, cannot find sfio on this machine." >&4
11393                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11394                 val="$undef"
11395                 ;;
11396         esac
11397         ;;
11398 esac
11399 set d_sfio
11400 eval $setvar
11401 case "$d_sfio" in
11402 $define) usesfio='true';;
11403 *) usesfio='false';;
11404 esac
11405
11406 : see if shmctl exists
11407 set shmctl d_shmctl
11408 eval $inlibc
11409
11410 : see if shmget exists
11411 set shmget d_shmget
11412 eval $inlibc
11413
11414 : see if shmat exists
11415 set shmat d_shmat
11416 eval $inlibc
11417 : see what shmat returns
11418 case "$d_shmat" in
11419 "$define")
11420         $cat >shmat.c <<'END'
11421 #include <sys/shm.h>
11422 void *shmat();
11423 END
11424         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11425                 shmattype='void *'
11426         else
11427                 shmattype='char *'
11428         fi
11429         echo "and it returns ($shmattype)." >&4
11430         : see if a prototype for shmat is available
11431         xxx=`./findhdr sys/shm.h`
11432         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11433         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11434                 val="$define"
11435         else
11436                 val="$undef"
11437         fi
11438         $rm -f shmat.[co]
11439         ;;
11440 *)
11441         val="$undef"
11442         ;;
11443 esac
11444 set d_shmatprototype
11445 eval $setvar
11446
11447 : see if shmdt exists
11448 set shmdt d_shmdt
11449 eval $inlibc
11450
11451 : see how much of the 'shm*(2)' library is present.
11452 h_shm=true
11453 echo " "
11454 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11455 *"$undef"*) h_shm=false;;
11456 esac
11457 case "$osname" in
11458 freebsd)
11459     case "`ipcs 2>&1`" in
11460     "SVID shared memory"*"not configured"*)
11461         echo "Your $osname does not have the shm*(2) configured." >&4
11462         h_shm=false
11463         val="$undef"
11464         set shmctl d_shmctl
11465         evat $setvar
11466         set shmget d_shmget
11467         evat $setvar
11468         set shmat d_shmat
11469         evat $setvar
11470         set shmdt d_shmdt
11471         evat $setvar
11472         ;;
11473     esac
11474     ;;
11475 esac
11476 : we could also check for sys/ipc.h ...
11477 if $h_shm && $test `./findhdr sys/shm.h`; then
11478         echo "You have the full shm*(2) library." >&4
11479         val="$define"
11480 else
11481         echo "You don't have the full shm*(2) library." >&4
11482         val="$undef"
11483 fi
11484 set d_shm
11485 eval $setvar
11486
11487 echo " "
11488 : see if we have sigaction
11489 if set sigaction val -f d_sigaction; eval $csym; $val; then
11490         echo 'sigaction() found.' >&4
11491         $cat > try.c <<'EOP'
11492 #include <stdio.h>
11493 #include <sys/types.h>
11494 #include <signal.h>
11495 int main()
11496 {
11497     struct sigaction act, oact;
11498     act.sa_flags = 0;
11499     oact.sa_handler = 0;
11500     /* so that act and oact are used */
11501     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11502 }
11503 EOP
11504         set try
11505         if eval $compile_ok; then
11506                 val="$define"
11507         else
11508                 echo "But you don't seem to have a useable struct sigaction." >&4
11509                 val="$undef"
11510         fi
11511 else
11512         echo 'sigaction NOT found.' >&4
11513         val="$undef"
11514 fi
11515 set d_sigaction; eval $setvar
11516 $rm -f try try$_o try.c
11517
11518 : see if sigsetjmp exists
11519 echo " "
11520 case "$d_sigsetjmp" in
11521 '')
11522         $cat >try.c <<'EOP'
11523 #include <setjmp.h>
11524 sigjmp_buf env;
11525 int set = 1;
11526 int main()
11527 {
11528         if (sigsetjmp(env,1))
11529                 exit(set);
11530         set = 0;
11531         siglongjmp(env, 1);
11532         exit(1);
11533 }
11534 EOP
11535         set try
11536         if eval $compile; then
11537                 if ./try >/dev/null 2>&1; then
11538                         echo "POSIX sigsetjmp found." >&4
11539                         val="$define"
11540                 else
11541                         $cat >&4 <<EOM
11542 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11543 I'll ignore them.
11544 EOM
11545                         val="$undef"
11546                 fi
11547         else
11548                 echo "sigsetjmp not found." >&4
11549                 val="$undef"
11550         fi
11551         ;;
11552 *) val="$d_sigsetjmp"
11553         case "$d_sigsetjmp" in
11554         $define) echo "POSIX sigsetjmp found." >&4;;
11555         $undef) echo "sigsetjmp not found." >&4;;
11556         esac
11557         ;;
11558 esac
11559 set d_sigsetjmp
11560 eval $setvar
11561 $rm -f try.c try
11562
11563 : see if socks5_init exists
11564 set socks5_init d_socks5_init
11565 eval $inlibc
11566
11567 : see if sys/stat.h is available
11568 set sys/stat.h i_sysstat
11569 eval $inhdr
11570
11571
11572 : see if stat knows about block sizes
11573 echo " "
11574 echo "Checking to see if your struct stat has st_blocks field..." >&4
11575 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11576 eval $hasfield
11577
11578
11579 : see if this is a sys/vfs.h system
11580 set sys/vfs.h i_sysvfs
11581 eval $inhdr
11582
11583
11584 : see if this is a sys/statfs.h system
11585 set sys/statfs.h i_sysstatfs
11586 eval $inhdr
11587
11588
11589 echo " "
11590 echo "Checking to see if your system supports struct statfs..." >&4
11591 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
11592 eval $hasstruct
11593 case "$d_statfs_s" in
11594 "$define")      echo "Yes, it does."   ;;
11595 *)              echo "No, it doesn't." ;;
11596 esac
11597
11598
11599
11600 : see if struct statfs knows about f_flags
11601 case "$d_statfs_s" in
11602 define) 
11603         echo " "
11604         echo "Checking to see if your struct statfs has f_flags field..." >&4
11605         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
11606         eval $hasfield
11607         ;;
11608 *)      val="$undef"
11609         set d_statfs_f_flags
11610         eval $setvar
11611         ;;
11612 esac
11613 case "$d_statfs_f_flags" in
11614 "$define")      echo "Yes, it does."   ;;
11615 *)              echo "No, it doesn't." ;;
11616 esac
11617
11618 : see if _ptr and _cnt from stdio act std
11619 echo " "
11620
11621 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11622         echo "(Looks like you have stdio.h from BSD.)"
11623         case "$stdio_ptr" in
11624         '') stdio_ptr='((fp)->_p)'
11625                 ptr_lval=$define
11626                 ;;
11627         *)      ptr_lval=$d_stdio_ptr_lval;;
11628         esac
11629         case "$stdio_cnt" in
11630         '') stdio_cnt='((fp)->_r)'
11631                 cnt_lval=$define
11632                 ;;
11633         *)      cnt_lval=$d_stdio_cnt_lval;;
11634         esac
11635         case "$stdio_base" in
11636         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11637         esac
11638         case "$stdio_bufsiz" in
11639         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11640         esac
11641 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11642         echo "(Looks like you have stdio.h from Linux.)"
11643         case "$stdio_ptr" in
11644         '') stdio_ptr='((fp)->_IO_read_ptr)'
11645                 ptr_lval=$define
11646                 ;;
11647         *)      ptr_lval=$d_stdio_ptr_lval;;
11648         esac
11649         case "$stdio_cnt" in
11650         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11651                 cnt_lval=$undef
11652                 ;;
11653         *)      cnt_lval=$d_stdio_cnt_lval;;
11654         esac
11655         case "$stdio_base" in
11656         '') stdio_base='((fp)->_IO_read_base)';;
11657         esac
11658         case "$stdio_bufsiz" in
11659         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11660         esac
11661 else
11662         case "$stdio_ptr" in
11663         '') stdio_ptr='((fp)->_ptr)'
11664                 ptr_lval=$define
11665                 ;;
11666         *)      ptr_lval=$d_stdio_ptr_lval;;
11667         esac
11668         case "$stdio_cnt" in
11669         '') stdio_cnt='((fp)->_cnt)'
11670                 cnt_lval=$define
11671                 ;;
11672         *)      cnt_lval=$d_stdio_cnt_lval;;
11673         esac
11674         case "$stdio_base" in
11675         '') stdio_base='((fp)->_base)';;
11676         esac
11677         case "$stdio_bufsiz" in
11678         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11679         esac
11680 fi
11681
11682 : test whether _ptr and _cnt really work
11683 echo "Checking how std your stdio is..." >&4
11684 $cat >try.c <<EOP
11685 #include <stdio.h>
11686 #define FILE_ptr(fp)    $stdio_ptr
11687 #define FILE_cnt(fp)    $stdio_cnt
11688 int main() {
11689         FILE *fp = fopen("try.c", "r");
11690         char c = getc(fp);
11691         if (
11692                 18 <= FILE_cnt(fp) &&
11693                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11694         )
11695                 exit(0);
11696         exit(1);
11697 }
11698 EOP
11699 val="$undef"
11700 set try
11701 if eval $compile; then
11702         if ./try; then
11703                 echo "Your stdio acts pretty std."
11704                 val="$define"
11705         else
11706                 echo "Your stdio isn't very std."
11707         fi
11708 else
11709         echo "Your stdio doesn't appear very std."
11710 fi
11711 $rm -f try.c try
11712 set d_stdstdio
11713 eval $setvar
11714
11715 : Can _ptr be used as an lvalue?
11716 case "$d_stdstdio$ptr_lval" in
11717 $define$define) val=$define ;;
11718 *) val=$undef ;;
11719 esac
11720 set d_stdio_ptr_lval
11721 eval $setvar
11722
11723 : Can _cnt be used as an lvalue?
11724 case "$d_stdstdio$cnt_lval" in
11725 $define$define) val=$define ;;
11726 *) val=$undef ;;
11727 esac
11728 set d_stdio_cnt_lval
11729 eval $setvar
11730
11731
11732 : test whether setting _ptr sets _cnt as a side effect
11733 d_stdio_ptr_lval_sets_cnt="$undef"
11734 d_stdio_ptr_lval_nochange_cnt="$undef"
11735 case "$d_stdio_ptr_lval$d_stdstdio" in
11736 $define$define)
11737         echo "Checking to see what happens if we set the stdio ptr..." >&4
11738 $cat >try.c <<EOP
11739 #include <stdio.h>
11740 /* Can we scream? */
11741 /* Eat dust sed :-) */
11742 /* In the buffer space, no one can hear you scream. */
11743 #define FILE_ptr(fp)    $stdio_ptr
11744 #define FILE_cnt(fp)    $stdio_cnt
11745 #include <sys/types.h>
11746 int main() {
11747         FILE *fp = fopen("try.c", "r");
11748         int c;
11749         char *ptr;
11750         size_t cnt;
11751         if (!fp) {
11752             puts("Fail even to read");
11753             exit(1);
11754         }
11755         c = getc(fp); /* Read away the first # */
11756         if (c == EOF) {
11757             puts("Fail even to read");
11758             exit(1);
11759         }
11760         if (!(
11761                 18 <= FILE_cnt(fp) &&
11762                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11763         )) {
11764                 puts("Fail even to read");
11765                 exit (1);
11766         }
11767         ptr = (char*) FILE_ptr(fp);
11768         cnt = (size_t)FILE_cnt(fp);
11769
11770         FILE_ptr(fp) += 42;
11771
11772         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11773                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11774                 exit (1);
11775         }
11776         if (FILE_cnt(fp) <= 20) {
11777                 printf ("Fail (<20 chars to test)");
11778                 exit (1);
11779         }
11780         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11781                 puts("Fail compare");
11782                 exit (1);
11783         }
11784         if (cnt == FILE_cnt(fp)) {
11785                 puts("Pass_unchanged");
11786                 exit (0);
11787         }       
11788         if (FILE_cnt(fp) == (cnt - 42)) {
11789                 puts("Pass_changed");
11790                 exit (0);
11791         }
11792         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11793         return 1;
11794
11795 }
11796 EOP
11797         set try
11798         if eval $compile; then
11799                 case `./try$exe_ext` in
11800                 Pass_changed)
11801                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11802                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11803                 Pass_unchanged)
11804                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11805                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11806                 Fail*)
11807                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11808                 *)
11809                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11810         esac
11811         else
11812                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11813         fi
11814         $rm -f try.c try
11815         ;;
11816 esac
11817
11818 : see if _base is also standard
11819 val="$undef"
11820 case "$d_stdstdio" in
11821 $define)
11822         $cat >try.c <<EOP
11823 #include <stdio.h>
11824 #define FILE_base(fp)   $stdio_base
11825 #define FILE_bufsiz(fp) $stdio_bufsiz
11826 int main() {
11827         FILE *fp = fopen("try.c", "r");
11828         char c = getc(fp);
11829         if (
11830                 19 <= FILE_bufsiz(fp) &&
11831                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11832         )
11833                 exit(0);
11834         exit(1);
11835 }
11836 EOP
11837         set try
11838         if eval $compile; then
11839                 if ./try; then
11840                         echo "And its _base field acts std."
11841                         val="$define"
11842                 else
11843                         echo "But its _base field isn't std."
11844                 fi
11845         else
11846                 echo "However, it seems to be lacking the _base field."
11847         fi
11848         $rm -f try.c try
11849         ;;
11850 esac
11851 set d_stdiobase
11852 eval $setvar
11853
11854 $cat >&4 <<EOM
11855 Checking how to access stdio streams by file descriptor number...
11856 EOM
11857 case "$stdio_stream_array" in
11858 '')     $cat >try.c <<EOCP
11859 #include <stdio.h>
11860 int main() {
11861   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11862     printf("yes\n");
11863 }
11864 EOCP
11865         for s in _iob __iob __sF
11866         do
11867                 set try -DSTDIO_STREAM_ARRAY=$s
11868                 if eval $compile; then
11869                         case "`./try$exe_ext`" in
11870                         yes)    stdio_stream_array=$s; break ;;
11871                         esac
11872                 fi
11873         done
11874         $rm -f try.* try$exe_ext
11875 esac
11876 case "$stdio_stream_array" in
11877 '')     $cat >&4 <<EOM
11878 I can't figure out how to access stdio streams by file descriptor number.
11879 EOM
11880         d_stdio_stream_array="$undef"
11881         ;;
11882 *)      $cat >&4 <<EOM
11883 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11884 EOM
11885         d_stdio_stream_array="$define"
11886         ;;
11887 esac
11888
11889 : see if strcoll exists
11890 set strcoll d_strcoll
11891 eval $inlibc
11892
11893 : check for structure copying
11894 echo " "
11895 echo "Checking to see if your C compiler can copy structs..." >&4
11896 $cat >try.c <<'EOCP'
11897 int main()
11898 {
11899         struct blurfl {
11900                 int dyick;
11901         } foo, bar;
11902
11903         foo = bar;
11904 }
11905 EOCP
11906 if $cc -c try.c >/dev/null 2>&1 ; then
11907         val="$define"
11908         echo "Yup, it can."
11909 else
11910         val="$undef"
11911         echo "Nope, it can't."
11912 fi
11913 set d_strctcpy
11914 eval $setvar
11915 $rm -f try.*
11916
11917 : see if strerror and/or sys_errlist[] exist
11918 echo " "
11919 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11920     if set strerror val -f d_strerror; eval $csym; $val; then
11921                 echo 'strerror() found.' >&4
11922                 d_strerror="$define"
11923                 d_strerrm='strerror(e)'
11924                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11925                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11926                         d_syserrlst="$define"
11927                 else
11928                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11929                         d_syserrlst="$undef"
11930                 fi
11931     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11932                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11933                 echo 'strerror() found in string header.' >&4
11934                 d_strerror="$define"
11935                 d_strerrm='strerror(e)'
11936                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11937                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11938                                 d_syserrlst="$define"
11939                 else
11940                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11941                         d_syserrlst="$undef"
11942                 fi
11943     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11944                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11945                 d_strerror="$undef"
11946                 d_syserrlst="$define"
11947                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11948     else
11949                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11950                 d_strerror="$undef"
11951                 d_syserrlst="$undef"
11952                 d_strerrm='"unknown"'
11953     fi
11954 fi
11955
11956 : see if strtod exists
11957 set strtod d_strtod
11958 eval $inlibc
11959
11960 : see if strtol exists
11961 set strtol d_strtol
11962 eval $inlibc
11963
11964 : see if strtold exists
11965 set strtold d_strtold
11966 eval $inlibc
11967
11968 : see if strtoll exists
11969 set strtoll d_strtoll
11970 eval $inlibc
11971
11972 case "$d_longlong-$d_strtoll" in
11973 "$define-$define")
11974         $cat <<EOM
11975 Checking whether your strtoll() works okay...
11976 EOM
11977         $cat >try.c <<'EOCP'
11978 #include <errno.h>
11979 #ifdef __hpux
11980 #define strtoll __strtoll
11981 #endif
11982 #ifdef __EMX__
11983 #define strtoll _strtoll
11984 #endif
11985 #include <stdio.h>
11986 extern long long int strtoll(char *s, char **, int); 
11987 static int bad = 0;
11988 int check(char *s, long long ell, int een) {
11989         long long gll;
11990         errno = 0;
11991         gll = strtoll(s, 0, 10);
11992         if (!((gll == ell) && (errno == een)))
11993                 bad++;
11994 }
11995 int main() {
11996         check(" 1",                                      1LL, 0);
11997         check(" 0",                                      0LL, 0);
11998         check("-1",                                     -1LL, 0);
11999         check("-9223372036854775808", -9223372036854775808LL, 0);
12000         check("-9223372036854775808", -9223372036854775808LL, 0);
12001         check(" 9223372036854775807",  9223372036854775807LL, 0);
12002         check("-9223372036854775808", -9223372036854775808LL, 0);
12003         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12004         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12005         if (!bad)
12006                 printf("ok\n");
12007 }
12008 EOCP
12009         set try
12010         if eval $compile; then
12011                 yyy=`./try`
12012                 case "$yyy" in
12013                 ok) echo "Your strtoll() seems to be working okay." ;;
12014                 *) cat <<EOM >&4
12015 Your strtoll() doesn't seem to be working okay.
12016 EOM
12017                    d_strtoll="$undef"
12018                    ;;
12019                 esac
12020         else
12021                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12022                 d_strtoll="$undef"
12023         fi
12024         ;;
12025 esac
12026
12027 : see if strtoq exists
12028 set strtoq d_strtoq
12029 eval $inlibc
12030
12031 : see if strtoul exists
12032 set strtoul d_strtoul
12033 eval $inlibc
12034
12035 case "$d_strtoul" in
12036 "$define")
12037         $cat <<EOM
12038 Checking whether your strtoul() works okay...
12039 EOM
12040         $cat >try.c <<'EOCP'
12041 #include <errno.h>
12042 #include <stdio.h>
12043 extern unsigned long int strtoul(char *s, char **, int); 
12044 static int bad = 0;
12045 void check(char *s, unsigned long eul, int een) {
12046         unsigned long gul;
12047         errno = 0;
12048         gul = strtoul(s, 0, 10);
12049         if (!((gul == eul) && (errno == een)))
12050                 bad++;
12051 }
12052 int main() {
12053         check(" 1", 1L, 0);
12054         check(" 0", 0L, 0);
12055 EOCP
12056         case "$longsize" in
12057         8)
12058             $cat >>try.c <<'EOCP'
12059         check("18446744073709551615", 18446744073709551615UL, 0);
12060         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12061 #if 0 /* strtoul() for /^-/ strings is undefined. */
12062         check("-1", 18446744073709551615UL, 0);
12063         check("-18446744073709551614", 2, 0);
12064         check("-18446744073709551615", 1, 0);
12065         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12066         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12067 #endif
12068 EOCP
12069                 ;;
12070         4)
12071                     $cat >>try.c <<'EOCP'
12072         check("4294967295", 4294967295UL, 0);
12073         check("4294967296", 4294967295UL, ERANGE);
12074 #if 0 /* strtoul() for /^-/ strings is undefined. */
12075         check("-1", 4294967295UL, 0);
12076         check("-4294967294", 2, 0);
12077         check("-4294967295", 1, 0);
12078         check("-4294967296", 4294967295UL, ERANGE);
12079         check("-4294967297", 4294967295UL, ERANGE);
12080 #endif
12081 EOCP
12082                 ;;
12083         *)
12084 : Should we write these tests to be more portable by sprintf-ing
12085 : ~0 and then manipulating that char string as input for strtol?
12086                 ;;
12087         esac
12088         $cat >>try.c <<'EOCP'
12089         if (!bad)
12090                 printf("ok\n");
12091         return 0;
12092 }
12093 EOCP
12094         set try
12095         if eval $compile; then
12096                 case "`./try`" in
12097                 ok) echo "Your strtoul() seems to be working okay." ;;
12098                 *) cat <<EOM >&4
12099 Your strtoul() doesn't seem to be working okay.
12100 EOM
12101                    d_strtoul="$undef"
12102                    ;;
12103                 esac
12104         fi
12105         ;;
12106 esac
12107
12108 : see if strtoull exists
12109 set strtoull d_strtoull
12110 eval $inlibc
12111
12112 case "$d_longlong-$d_strtoull" in
12113 "$define-$define")
12114         $cat <<EOM
12115 Checking whether your strtoull() works okay...
12116 EOM
12117         $cat >try.c <<'EOCP'
12118 #include <errno.h>
12119 #ifdef __hpux
12120 #define strtoull __strtoull
12121 #endif
12122 #include <stdio.h>
12123 extern unsigned long long int strtoull(char *s, char **, int); 
12124 static int bad = 0;
12125 int check(char *s, long long eull, int een) {
12126         long long gull;
12127         errno = 0;
12128         gull = strtoull(s, 0, 10);
12129         if (!((gull == eull) && (errno == een)))
12130                 bad++;
12131 }
12132 int main() {
12133         check(" 1",                                        1LL, 0);
12134         check(" 0",                                        0LL, 0);
12135         check("18446744073709551615",  18446744073709551615ULL, 0);
12136         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12137 #if 0 /* strtoull() for /^-/ strings is undefined. */
12138         check("-1",                    18446744073709551615ULL, 0);
12139         check("-18446744073709551614",                     2LL, 0);
12140         check("-18446744073709551615",                     1LL, 0);
12141         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12142         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12143 #endif
12144         if (!bad)
12145                 printf("ok\n");
12146 }
12147 EOCP
12148         set try
12149         if eval $compile; then
12150                 case "`./try`" in
12151                 ok) echo "Your strtoull() seems to be working okay." ;;
12152                 *) cat <<EOM >&4
12153 Your strtoull() doesn't seem to be working okay.
12154 EOM
12155                    d_strtoull="$undef"
12156                    ;;
12157                 esac
12158         fi
12159         ;;
12160 esac
12161
12162 : see if strtouq exists
12163 set strtouq d_strtouq
12164 eval $inlibc
12165
12166 case "$d_strtouq" in
12167 "$define")
12168         $cat <<EOM
12169 Checking whether your strtouq() works okay...
12170 EOM
12171         $cat >try.c <<'EOCP'
12172 #include <errno.h>
12173 #include <stdio.h>
12174 extern unsigned long long int strtouq(char *s, char **, int); 
12175 static int bad = 0;
12176 void check(char *s, unsigned long long eull, int een) {
12177         unsigned long long gull;
12178         errno = 0;
12179         gull = strtouq(s, 0, 10);
12180         if (!((gull == eull) && (errno == een)))
12181                 bad++;
12182 }
12183 int main() {
12184         check(" 1",                                        1LL, 0);
12185         check(" 0",                                        0LL, 0);
12186         check("18446744073709551615",  18446744073709551615ULL, 0);
12187         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12188 #if 0 /* strtouq() for /^-/ strings is undefined. */
12189         check("-1",                    18446744073709551615ULL, 0);
12190         check("-18446744073709551614",                     2LL, 0);
12191         check("-18446744073709551615",                     1LL, 0);
12192         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12193         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12194 #endif
12195         if (!bad)
12196                 printf("ok\n");
12197         return 0;
12198 }
12199 EOCP
12200         set try
12201         if eval $compile; then
12202                 case "`./try`" in
12203                 ok) echo "Your strtouq() seems to be working okay." ;;
12204                 *) cat <<EOM >&4
12205 Your strtouq() doesn't seem to be working okay.
12206 EOM
12207                    d_strtouq="$undef"
12208                    ;;
12209                 esac
12210         fi
12211         ;;
12212 esac
12213
12214 : see if strxfrm exists
12215 set strxfrm d_strxfrm
12216 eval $inlibc
12217
12218 : see if symlink exists
12219 set symlink d_symlink
12220 eval $inlibc
12221
12222 : see if syscall exists
12223 set syscall d_syscall
12224 eval $inlibc
12225
12226 : see if sysconf exists
12227 set sysconf d_sysconf
12228 eval $inlibc
12229
12230 : see if system exists
12231 set system d_system
12232 eval $inlibc
12233
12234 : see if tcgetpgrp exists
12235 set tcgetpgrp d_tcgetpgrp
12236 eval $inlibc
12237
12238 : see if tcsetpgrp exists
12239 set tcsetpgrp d_tcsetpgrp
12240 eval $inlibc
12241
12242 : see if prototype for telldir is available
12243 echo " "
12244 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12245 eval $hasproto
12246
12247 : see if this is a sys/times.h system
12248 set sys/times.h i_systimes
12249 eval $inhdr
12250
12251 : see if times exists
12252 echo " "
12253 if set times val -f d_times; eval $csym; $val; then
12254         echo 'times() found.' >&4
12255         d_times="$define"
12256         inc=''
12257         case "$i_systimes" in
12258         "$define") inc='sys/times.h';;
12259         esac
12260         rp="What is the type returned by times() on this system?"
12261         set clock_t clocktype long stdio.h sys/types.h $inc
12262         eval $typedef_ask
12263 else
12264         echo 'times() NOT found, hope that will do.' >&4
12265         d_times="$undef"
12266         clocktype='int'
12267 fi
12268
12269 : see if truncate exists
12270 set truncate d_truncate
12271 eval $inlibc
12272
12273 : see if tzname[] exists
12274 echo " "
12275 if set tzname val -a d_tzname; eval $csym; $val; then
12276         val="$define"
12277         echo 'tzname[] found.' >&4
12278 else
12279         val="$undef"
12280         echo 'tzname[] NOT found.' >&4
12281 fi
12282 set d_tzname
12283 eval $setvar
12284
12285 : see if umask exists
12286 set umask d_umask
12287 eval $inlibc
12288
12289 : see if ustat exists
12290 set ustat d_ustat
12291 eval $inlibc
12292
12293 : backward compatibility for d_hvfork
12294 if test X$d_hvfork != X; then
12295         d_vfork="$d_hvfork"
12296         d_hvfork=''
12297 fi
12298 : see if there is a vfork
12299 val=''
12300 set vfork val
12301 eval $inlibc
12302
12303 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12304 : perl on Solaris 2.x, and probably elsewhere.
12305 case "$val" in
12306 $define)
12307         echo " "
12308         case "$usevfork" in
12309         false) dflt='n';;
12310         *) dflt='y';;
12311         esac
12312         cat <<'EOM'
12313  
12314 Perl can only use a vfork() that doesn't suffer from strict
12315 restrictions on calling functions or modifying global data in
12316 the child.  For example, glibc-2.1 contains such a vfork()
12317 that is unsuitable.  If your system provides a proper fork()
12318 call, chances are that you do NOT want perl to use vfork().
12319
12320 EOM
12321         rp="Do you still want to use vfork()?"
12322         . ./myread
12323         case "$ans" in
12324         y|Y) ;;
12325         *)
12326                 echo "Ok, we won't use vfork()."
12327                 val="$undef"
12328                 ;;
12329         esac
12330         ;;
12331 esac
12332 set d_vfork
12333 eval $setvar
12334 case "$d_vfork" in
12335 $define) usevfork='true';;
12336 *) usevfork='false';;
12337 esac
12338
12339 : see if this is an sysdir system
12340 set sys/dir.h i_sysdir
12341 eval $inhdr
12342
12343 : see if this is an sysndir system
12344 set sys/ndir.h i_sysndir
12345 eval $inhdr
12346
12347 : see if closedir exists
12348 set closedir d_closedir
12349 eval $inlibc
12350
12351 case "$d_closedir" in
12352 "$define")
12353         echo " "
12354         echo "Checking whether closedir() returns a status..." >&4
12355         cat > closedir.c <<EOM
12356 #$i_dirent I_DIRENT             /**/
12357 #$i_sysdir I_SYS_DIR            /**/
12358 #$i_sysndir I_SYS_NDIR          /**/
12359 #$i_systypes I_SYS_TYPES        /**/
12360
12361 #if defined(I_SYS_TYPES)
12362 #include <sys/types.h>
12363 #endif
12364 #if defined(I_DIRENT)
12365 #include <dirent.h>
12366 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12367 #include <sys/dir.h>
12368 #endif
12369 #else
12370 #ifdef I_SYS_NDIR
12371 #include <sys/ndir.h>
12372 #else
12373 #ifdef I_SYS_DIR
12374 #ifdef hp9000s500
12375 #include <ndir.h>       /* may be wrong in the future */
12376 #else
12377 #include <sys/dir.h>
12378 #endif
12379 #endif
12380 #endif
12381 #endif 
12382 int main() { return closedir(opendir(".")); }
12383 EOM
12384         set closedir
12385         if eval $compile_ok; then
12386                 if ./closedir > /dev/null 2>&1 ; then
12387                         echo "Yes, it does."
12388                         val="$undef"
12389                 else
12390                         echo "No, it doesn't."
12391                         val="$define"
12392                 fi
12393         else
12394                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12395                 val="$define"
12396         fi
12397         ;;
12398 *)
12399         val="$undef";
12400         ;;
12401 esac
12402 set d_void_closedir
12403 eval $setvar
12404 $rm -f closedir*
12405 : see if there is a wait4
12406 set wait4 d_wait4
12407 eval $inlibc
12408
12409 : see if waitpid exists
12410 set waitpid d_waitpid
12411 eval $inlibc
12412
12413 : see if wcstombs exists
12414 set wcstombs d_wcstombs
12415 eval $inlibc
12416
12417 : see if wctomb exists
12418 set wctomb d_wctomb
12419 eval $inlibc
12420
12421 : preserve RCS keywords in files with variable substitution, grrr
12422 Date='$Date'
12423 Id='$Id'
12424 Log='$Log'
12425 RCSfile='$RCSfile'
12426 Revision='$Revision'
12427
12428 case "$crosscompile" in
12429 ''|[nN]*) crosscompile="$undef" ;;
12430 esac
12431
12432 case "$osname" in
12433 next|rhapsody|darwin) multiarch="$define" ;;
12434 esac
12435 case "$multiarch" in
12436 ''|[nN]*) multiarch="$undef" ;;
12437 esac
12438
12439 : check for alignment requirements
12440 echo " "
12441 case "$crosscompile$multiarch" in
12442 *$define*)
12443         $cat <<EOM
12444 You seem to be either cross-compiling or doing a multiarchitecture build,
12445 skipping the memory alignment check.
12446
12447 EOM
12448         case "$alignbytes" in
12449         '') alignbytes=8 ;;
12450         esac
12451         ;;
12452 *)
12453         case "$alignbytes" in
12454         '') echo "Checking alignment constraints..." >&4
12455                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12456                         $cat >try.c <<'EOCP'
12457 typedef long double NV;
12458 EOCP
12459                 else
12460                         $cat >try.c <<'EOCP'
12461 typedef double NV;
12462 EOCP
12463                 fi
12464                 $cat >>try.c <<'EOCP'
12465 #include <stdio.h>
12466 struct foobar {
12467         char foo;
12468         NV bar;
12469 } try_algn;
12470 int main()
12471 {
12472     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12473     return(0);
12474 }
12475 EOCP
12476                 set try
12477                 if eval $compile_ok; then
12478                         dflt=`./try`
12479                 else
12480                         dflt='8'
12481                         echo "(I can't seem to compile the test program...)"
12482                 fi
12483                 ;;
12484         *) dflt="$alignbytes"
12485                 ;;
12486         esac
12487         rp="Doubles must be aligned on a how-many-byte boundary?"
12488         . ./myread
12489         alignbytes="$ans"
12490         $rm -f try.c try
12491         ;;
12492 esac
12493
12494
12495 : set the base revision
12496 baserev=5.0
12497
12498 : check for ordering of bytes in a long
12499 echo " "
12500 case "$crosscompile$multiarch" in
12501 *$define*)
12502         $cat <<EOM
12503 You seem to be either cross-compiling or doing a multiarchitecture build,
12504 skipping the byteorder check.
12505
12506 EOM
12507         byteorder='0xffff'
12508         ;;
12509 *)
12510         case "$byteorder" in
12511         '')
12512                 $cat <<'EOM'
12513 In the following, larger digits indicate more significance.  A big-endian
12514 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12515 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12516 machines may have weird orders like 3412.  A Cray will report 87654321,
12517 an Alpha will report 12345678. If the test program works the default is
12518 probably right.
12519 I'm now running the test program...
12520 EOM
12521                 $cat >try.c <<'EOCP'
12522 #include <stdio.h>
12523 int main()
12524 {
12525         int i;
12526         union {
12527                 unsigned long l;
12528                 char c[sizeof(long)];
12529         } u;
12530
12531         if (sizeof(long) > 4)
12532                 u.l = (0x08070605L << 32) | 0x04030201L;
12533         else
12534                 u.l = 0x04030201L;
12535         for (i = 0; i < sizeof(long); i++)
12536                 printf("%c", u.c[i]+'0');
12537         printf("\n");
12538         exit(0);
12539 }
12540 EOCP
12541                 xxx_prompt=y
12542                 set try
12543                 if eval $compile && ./try > /dev/null; then
12544                         dflt=`./try`
12545                         case "$dflt" in
12546                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12547                                 echo "(The test program ran ok.)"
12548                                 echo "byteorder=$dflt"
12549                                 xxx_prompt=n
12550                         ;;
12551                         ????|????????) echo "(The test program ran ok.)" ;;
12552                         *) echo "(The test program didn't run right for some reason.)" ;;
12553                         esac
12554                 else
12555                         dflt='4321'
12556                         cat <<'EOM'
12557 (I can't seem to compile the test program.  Guessing big-endian...)
12558 EOM
12559                 fi
12560                 case "$xxx_prompt" in
12561                 y)
12562                         rp="What is the order of bytes in a long?"
12563                         . ./myread
12564                         byteorder="$ans"
12565                         ;;
12566                 *)      byteorder=$dflt
12567                         ;;
12568                 esac
12569                 ;;
12570         esac
12571         $rm -f try.c try
12572         ;;
12573 esac
12574
12575
12576 : how do we catenate cpp tokens here?
12577 echo " "
12578 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12579 $cat >cpp_stuff.c <<'EOCP'
12580 #define RCAT(a,b)a/**/b
12581 #define ACAT(a,b)a ## b
12582 RCAT(Rei,ser)
12583 ACAT(Cir,cus)
12584 EOCP
12585 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12586 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12587         echo "Oh!  Smells like ANSI's been here." >&4
12588         echo "We can catify or stringify, separately or together!"
12589         cpp_stuff=42
12590 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12591         echo "Ah, yes!  The good old days!" >&4
12592         echo "However, in the good old days we don't know how to stringify and"
12593         echo "catify at the same time."
12594         cpp_stuff=1
12595 else
12596         $cat >&4 <<EOM
12597 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12598 to have to edit the values of CAT[2-5] in config.h...
12599 EOM
12600         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12601 fi
12602 $rm -f cpp_stuff.*
12603
12604 : see if this is a db.h system
12605 set db.h i_db
12606 eval $inhdr
12607
12608 case "$i_db" in
12609 $define)
12610         : Check db version.
12611         echo " "
12612         echo "Checking Berkeley DB version ..." >&4
12613         $cat >try.c <<EOCP
12614 #$d_const HASCONST
12615 #ifndef HASCONST
12616 #define const
12617 #endif
12618 #include <sys/types.h>
12619 #include <stdio.h>
12620 #include <db.h>
12621 int main()
12622 {
12623 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12624     int Major, Minor, Patch ;
12625     unsigned long Version ;
12626     (void)db_version(&Major, &Minor, &Patch) ;
12627     printf("You have Berkeley DB Version 2 or greater\n");
12628
12629     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12630                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12631     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12632                 Major, Minor, Patch) ;
12633
12634     /* check that db.h & libdb are compatible */
12635     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12636         printf("db.h and libdb are incompatible\n") ;
12637         exit(3);        
12638     }
12639
12640     printf("db.h and libdb are compatible\n") ;
12641
12642     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12643                 + DB_VERSION_PATCH ;
12644
12645     /* needs to be >= 2.3.4 */
12646     if (Version < 2003004) {
12647     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12648         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12649         exit(2);        
12650     }
12651
12652     exit(0);
12653 #else
12654 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12655     printf("You have Berkeley DB Version 1\n");
12656     exit(0);    /* DB version < 2: the coast is clear. */
12657 #else
12658     exit(1);    /* <db.h> not Berkeley DB? */
12659 #endif
12660 #endif
12661 }
12662 EOCP
12663         set try
12664         if eval $compile_ok && ./try; then
12665                 echo 'Looks OK.' >&4
12666         else
12667                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12668                 i_db=$undef
12669                 case " $libs " in
12670                 *"-ldb "*)
12671                         : Remove db from list of libraries to use
12672                         echo "Removing unusable -ldb from library list" >&4
12673                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12674                         shift
12675                         libs="$*"
12676                         echo "libs = $libs" >&4
12677                         ;;
12678                 esac
12679         fi
12680         $rm -f try.*
12681         ;;
12682 esac
12683
12684 case "$i_db" in
12685 define)
12686         : Check the return type needed for hash 
12687         echo " "
12688         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12689         $cat >try.c <<EOCP
12690 #$d_const HASCONST
12691 #ifndef HASCONST
12692 #define const
12693 #endif
12694 #include <sys/types.h>
12695 #include <db.h>
12696
12697 #ifndef DB_VERSION_MAJOR
12698 u_int32_t hash_cb (ptr, size)
12699 const void *ptr;
12700 size_t size;
12701 {
12702 }
12703 HASHINFO info;
12704 int main()
12705 {
12706         info.hash = hash_cb;
12707 }
12708 #endif
12709 EOCP
12710         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12711                 if $contains warning try.out >>/dev/null 2>&1 ; then
12712                         db_hashtype='int'
12713                 else
12714                         db_hashtype='u_int32_t'
12715                 fi
12716         else
12717                 : XXX Maybe we should just give up here.
12718                 db_hashtype=u_int32_t
12719                 $cat try.out >&4
12720                 echo "Help:  I can't seem to compile the db test program." >&4
12721                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12722         fi
12723         $rm -f try.*
12724         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12725         ;;
12726 *)      db_hashtype=u_int32_t
12727         ;;
12728 esac
12729 case "$i_db" in
12730 define)
12731         : Check the return type needed for prefix 
12732         echo " "
12733         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12734         cat >try.c <<EOCP
12735 #$d_const HASCONST
12736 #ifndef HASCONST
12737 #define const
12738 #endif
12739 #include <sys/types.h>
12740 #include <db.h>
12741
12742 #ifndef DB_VERSION_MAJOR
12743 size_t prefix_cb (key1, key2)
12744 const DBT *key1;
12745 const DBT *key2;
12746 {
12747 }
12748 BTREEINFO info;
12749 int main()
12750 {
12751         info.prefix = prefix_cb;
12752 }
12753 #endif
12754 EOCP
12755         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12756                 if $contains warning try.out >>/dev/null 2>&1 ; then
12757                         db_prefixtype='int'
12758                 else
12759                         db_prefixtype='size_t'
12760                 fi
12761         else
12762                 db_prefixtype='size_t'
12763                 : XXX Maybe we should just give up here.
12764                 $cat try.out >&4
12765                 echo "Help:  I can't seem to compile the db test program." >&4
12766                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12767         fi
12768         $rm -f try.*
12769         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12770         ;;
12771 *)      db_prefixtype='size_t'
12772         ;;
12773 esac
12774
12775 : check for void type
12776 echo " "
12777 echo "Checking to see how well your C compiler groks the void type..." >&4
12778 case "$voidflags" in
12779 '')
12780         $cat >try.c <<'EOCP'
12781 #if TRY & 1
12782 void sub() {
12783 #else
12784 sub() {
12785 #endif
12786         extern void moo();      /* function returning void */
12787         void (*goo)();          /* ptr to func returning void */
12788 #if TRY & 8
12789         void *hue;              /* generic ptr */
12790 #endif
12791 #if TRY & 2
12792         void (*foo[10])();
12793 #endif
12794
12795 #if TRY & 4
12796         if(goo == moo) {
12797                 exit(0);
12798         }
12799 #endif
12800         exit(0);
12801 }
12802 int main() { sub(); }
12803 EOCP
12804         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12805                 voidflags=$defvoidused
12806         echo "Good.  It appears to support void to the level $package wants.">&4
12807                 if $contains warning .out >/dev/null 2>&1; then
12808                         echo "However, you might get some warnings that look like this:"
12809                         $cat .out
12810                 fi
12811         else
12812 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12813                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12814                         echo "It supports 1..."
12815                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12816                                 echo "It also supports 2..."
12817                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12818                                         voidflags=7
12819                                         echo "And it supports 4 but not 8 definitely."
12820                                 else
12821                                         echo "It doesn't support 4..."
12822                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12823                                                 voidflags=11
12824                                                 echo "But it supports 8."
12825                                         else
12826                                                 voidflags=3
12827                                                 echo "Neither does it support 8."
12828                                         fi
12829                                 fi
12830                         else
12831                                 echo "It does not support 2..."
12832                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12833                                         voidflags=13
12834                                         echo "But it supports 4 and 8."
12835                                 else
12836                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12837                                                 voidflags=5
12838                                                 echo "And it supports 4 but has not heard about 8."
12839                                         else
12840                                                 echo "However it supports 8 but not 4."
12841                                         fi
12842                                 fi
12843                         fi
12844                 else
12845                         echo "There is no support at all for void."
12846                         voidflags=0
12847                 fi
12848         fi
12849 esac
12850 case "$voidflags" in
12851 "$defvoidused") ;;
12852 *)      $cat >&4 <<'EOM'
12853   Support flag bits are:
12854     1: basic void declarations.
12855     2: arrays of pointers to functions returning void.
12856     4: operations between pointers to and addresses of void functions.
12857     8: generic void pointers.
12858 EOM
12859         dflt="$voidflags";
12860         rp="Your void support flags add up to what?"
12861         . ./myread
12862         voidflags="$ans"
12863         ;;
12864 esac
12865 $rm -f try.* .out
12866
12867
12868 : How can we generate normalized random numbers ?
12869 echo " "
12870 echo "Looking for a random number function..." >&4
12871 case "$randfunc" in
12872 '')
12873         if set drand48 val -f; eval $csym; $val; then
12874                 dflt="drand48"
12875                 echo "Good, found drand48()." >&4
12876         elif set random val -f; eval $csym; $val; then
12877                 dflt="random"
12878                 echo "OK, found random()." >&4
12879         else
12880                 dflt="rand"
12881                 echo "Yick, looks like I have to use rand()." >&4
12882         fi
12883         echo " "
12884         ;;
12885 *)
12886         dflt="$randfunc"
12887         ;;
12888 esac
12889 cont=true
12890
12891 case "$ccflags" in
12892 *-Dmy_rand=*|*-Dmy_srand=*)
12893         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12894         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12895         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12896         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12897         ;;
12898 esac
12899
12900 while $test "$cont"; do
12901         rp="Use which function to generate random numbers?"
12902         . ./myread
12903         if $test "$ans" = "$dflt"; then
12904                 : null
12905         else
12906                 randbits=''
12907         fi
12908         randfunc="$ans"
12909         if set $ans val -f; eval $csym; $val; then
12910                 cont=''
12911         else
12912                 dflt=y
12913                 rp="I cannot find function $ans. Use that name anyway?"
12914                 . ./myread
12915                 dflt=rand
12916                 case "$ans" in
12917                         [yY]*) cont='';;
12918                 esac
12919         fi
12920         case "$cont" in
12921         '')
12922                 case "$randfunc" in
12923                 drand48)
12924                         drand01="drand48()"
12925                         seedfunc="srand48"
12926                         randbits=48
12927                         randseedtype=long
12928                         ;;
12929                 rand|random)
12930                         case "$randbits" in
12931                         '')
12932 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12933                                 $cat >try.c <<EOCP
12934 #$i_unistd I_UNISTD
12935 #$i_stdlib I_STDLIB
12936 #include <stdio.h>
12937 #ifdef I_UNISTD
12938 #  include <unistd.h>
12939 #endif
12940 #ifdef I_STDLIB
12941 #  include <stdlib.h>
12942 #endif
12943 int main()
12944 {
12945         register int i;
12946         register unsigned long tmp;
12947         register unsigned long max = 0L;
12948
12949         for (i = 1000; i; i--) {
12950                 tmp = (unsigned long) $randfunc();
12951                 if (tmp > max) max = tmp;
12952         }
12953         for (i = 0; max; i++)
12954                 max /= 2;
12955         printf("%d\n",i);
12956 }
12957 EOCP
12958                                 set try
12959                                 if eval $compile_ok; then
12960                                         dflt=`try`
12961                                 else
12962                                         dflt='?'
12963                                         echo "(I can't seem to compile the test program...)"
12964                                 fi
12965                                 ;;
12966                         *)
12967                                 dflt="$randbits"
12968                                 ;;
12969                         esac
12970                         rp="How many bits does your $randfunc() function produce?"
12971                         . ./myread
12972                         randbits="$ans"
12973                         $rm -f try.c try
12974                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12975                         seedfunc="s$randfunc"
12976                         randseedtype=unsigned
12977                         ;;
12978                 *)
12979                         dflt="31"
12980                         rp="How many bits does your $randfunc() function produce?"
12981                         . ./myread
12982                         randbits="$ans"
12983                         seedfunc="s$randfunc"
12984                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12985                         if set $seedfunc val -f; eval $csym; $val; then
12986                                 echo "(Using $seedfunc() to seed random generator)"
12987                         else
12988                                 echo "(Warning: no $seedfunc() to seed random generator)"
12989                                 seedfunc=rand
12990                         fi
12991                         randseedtype=unsigned
12992                         ;;
12993                 esac
12994                 ;;
12995         esac
12996 done
12997
12998 echo " "
12999 echo "Determining whether or not we are on an EBCDIC system..." >&4
13000 $cat >tebcdic.c <<'EOM'
13001 int main()
13002 {
13003   if ('M'==0xd4) return 0;
13004   return 1;
13005 }
13006 EOM
13007
13008 val=$undef
13009 set tebcdic
13010 if eval $compile_ok; then
13011         if ./tebcdic; then
13012                 echo "You seem to speak EBCDIC." >&4
13013                 val="$define"
13014         else
13015                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13016         fi
13017 else
13018         echo "I'm unable to compile the test program." >&4
13019         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13020 fi
13021 $rm -f tebcdic.c tebcdic
13022 set ebcdic
13023 eval $setvar
13024
13025 echo " "
13026 $cat >&4 <<EOM
13027 Checking how to flush all pending stdio output...
13028 EOM
13029 # I only know how to find the first 32 possibly open files on SunOS.
13030 # See also hints/sunos_4_1.sh and util.c  --AD
13031 case "$osname" in
13032 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13033 esac
13034 $cat >>try.c <<EOCP
13035 #include <stdio.h>
13036 #$i_unistd I_UNISTD
13037 #ifdef I_UNISTD
13038 # include <unistd.h>
13039 #endif
13040 #$d_sysconf HAS_SYSCONF
13041 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13042 #ifdef HAS_STDIO_STREAM_ARRAY
13043 # define STDIO_STREAM_ARRAY $stdio_stream_array
13044 #endif
13045 int main() {
13046   FILE* p = fopen("try.out", "w");
13047 #ifdef TRY_FPUTC
13048   fputc('x', p);
13049 #else
13050 # ifdef TRY_FPRINTF
13051   fprintf(p, "x");
13052 # endif
13053 #endif
13054 #ifdef TRY_FFLUSH_NULL
13055   fflush(NULL);
13056 #endif
13057 #ifdef TRY_FFLUSH_ALL
13058   {
13059     long open_max = -1;
13060 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13061     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13062 # else
13063 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13064     open_max = sysconf(_SC_OPEN_MAX);
13065 #  else
13066 #   ifdef FOPEN_MAX
13067     open_max = FOPEN_MAX;
13068 #   else
13069 #    ifdef OPEN_MAX
13070     open_max = OPEN_MAX;
13071 #    else
13072 #     ifdef _NFILE
13073     open_max = _NFILE;
13074 #     endif
13075 #    endif
13076 #   endif
13077 #  endif
13078 # endif 
13079 # ifdef HAS_STDIO_STREAM_ARRAY
13080     if (open_max > 0) {
13081       long i;
13082       for (i = 0; i < open_max; i++)
13083             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13084                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13085                 STDIO_STREAM_ARRAY[i]._flag)
13086                 fflush(&STDIO_STREAM_ARRAY[i]);
13087     }   
13088   }
13089 # endif
13090 #endif
13091   _exit(42);
13092 }
13093 EOCP
13094 : first we have to find out how _not_ to flush
13095 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13096     output=''
13097     set try -DTRY_FPUTC
13098     if eval $compile; then
13099             $rm -f try.out
13100             ./try$exe_ext 2>/dev/null
13101             if $test ! -s try.out -a "X$?" = X42; then
13102                 output=-DTRY_FPUTC
13103             fi
13104     fi
13105     case "$output" in
13106     '')
13107             set try -DTRY_FPRINTF
13108             $rm -f try.out
13109             if eval $compile; then
13110                     $rm -f try.out
13111                     ./try$exe_ext 2>/dev/null
13112                     if $test ! -s try.out -a "X$?" = X42; then
13113                         output=-DTRY_FPRINTF
13114                     fi
13115             fi
13116         ;;
13117     esac
13118 fi
13119 : check for fflush NULL behaviour
13120 case "$fflushNULL" in
13121 '')     set try -DTRY_FFLUSH_NULL $output
13122         if eval $compile; then
13123                 $rm -f try.out
13124                 ./try$exe_ext 2>/dev/null
13125                 code="$?"
13126                 if $test -s try.out -a "X$code" = X42; then
13127                         fflushNULL="`$cat try.out`"
13128                 else
13129                         if $test "X$code" != X42; then
13130                                 $cat >&4 <<EOM
13131 (If this test failed, don't worry, we'll try another method shortly.)
13132 EOM
13133                         fi
13134                 fi
13135         fi
13136         $rm -f core try.core core.try.*
13137         case "$fflushNULL" in
13138         x)      $cat >&4 <<EOM
13139 Your fflush(NULL) works okay for output streams.
13140 Let's see if it clobbers input pipes...
13141 EOM
13142 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13143 # bug that improperly flushes the input end of pipes.  So we avoid the
13144 # autoflush on fork/system/exec support for now. :-(
13145 $cat >tryp.c <<EOCP
13146 #include <stdio.h>
13147 int
13148 main(int argc, char **argv)
13149 {
13150     char buf[1024];
13151     int i;
13152     char *bp = buf;
13153     while (1) {
13154         while ((i = getc(stdin)) != -1
13155                && (*bp++ = i) != '\n'
13156                && bp < &buf[1024])
13157         /* DO NOTHING */ ;
13158         *bp = '\0';
13159         fprintf(stdout, "%s", buf);
13160         fflush(NULL);
13161         if (i == -1)
13162             return 0;
13163         bp = buf;
13164     }
13165 }
13166 EOCP
13167                 fflushNULL="$define"
13168                 set tryp
13169                 if eval $compile; then
13170                     $rm -f tryp.out
13171                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13172                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13173                        $cat >&4 <<EOM
13174 fflush(NULL) seems to behave okay with input streams.
13175 EOM
13176                         fflushNULL="$define"
13177                     else
13178                         $cat >&4 <<EOM
13179 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13180 EOM
13181                         fflushNULL="$undef"
13182                     fi
13183                 fi
13184                 $rm -f core tryp.c tryp.core core.tryp.*
13185                 ;;
13186         '')     $cat >&4 <<EOM
13187 Your fflush(NULL) isn't working (contrary to ANSI C).
13188 EOM
13189                 fflushNULL="$undef"
13190                 ;;
13191         *)      $cat >&4 <<EOM
13192 Cannot figure out whether your fflush(NULL) works or not.
13193 I'm assuming it doesn't (contrary to ANSI C).
13194 EOM
13195                 fflushNULL="$undef"
13196                 ;;
13197         esac
13198         ;;
13199 $define|true|[yY]*)
13200         fflushNULL="$define"
13201         ;;
13202 *)
13203         fflushNULL="$undef"
13204         ;;
13205 esac
13206 : check explicit looping only if NULL did not work, and if the pipe
13207 : bug does not show up on an explicit flush too
13208 case "$fflushNULL" in
13209 "$undef")
13210         $cat >tryp.c <<EOCP
13211 #include <stdio.h>
13212 int
13213 main(int argc, char **argv)
13214 {
13215     char buf[1024];
13216     int i;
13217     char *bp = buf;
13218     while (1) {
13219         while ((i = getc(stdin)) != -1
13220                && (*bp++ = i) != '\n'
13221                && bp < &buf[1024])
13222         /* DO NOTHING */ ;
13223         *bp = '\0';
13224         fprintf(stdout, "%s", buf);
13225         fflush(stdin);
13226         if (i == -1)
13227             return 0;
13228         bp = buf;
13229     }
13230 }
13231 EOCP
13232         set tryp
13233         if eval $compile; then
13234             $rm -f tryp.out
13235             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13236             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13237                $cat >&4 <<EOM
13238 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13239 EOM
13240                 : now check for fflushall behaviour
13241                 case "$fflushall" in
13242                 '')     set try -DTRY_FFLUSH_ALL $output
13243                         if eval $compile; then
13244                                 $cat >&4 <<EOM
13245 (Now testing the other method--but note that this also may fail.)
13246 EOM
13247                                 $rm -f try.out
13248                                 ./try$exe_ext 2>/dev/null
13249                                 if $test -s try.out -a "X$?" = X42; then
13250                                         fflushall="`$cat try.out`"
13251                                 fi
13252                         fi
13253                         $rm -f core try.core core.try.*
13254                         case "$fflushall" in
13255                         x)      $cat >&4 <<EOM
13256 Whew. Flushing explicitly all the stdio streams works.
13257 EOM
13258                                 fflushall="$define"
13259                                 ;;
13260                         '')     $cat >&4 <<EOM
13261 Sigh. Flushing explicitly all the stdio streams doesn't work.
13262 EOM
13263                                 fflushall="$undef"
13264                                 ;;
13265                         *)      $cat >&4 <<EOM
13266 Cannot figure out whether flushing stdio streams explicitly works or not.
13267 I'm assuming it doesn't.
13268 EOM
13269                                 fflushall="$undef"
13270                                 ;;
13271                         esac
13272                         ;;
13273                 "$define"|true|[yY]*)
13274                         fflushall="$define"
13275                         ;;
13276                 *)
13277                         fflushall="$undef"
13278                         ;;
13279                 esac
13280             else
13281                 $cat >&4 <<EOM
13282 All is futile.  Even fflush(stdin) clobbers input pipes!
13283 EOM
13284                 fflushall="$undef"
13285             fi
13286         else
13287             fflushall="$undef"
13288         fi
13289         $rm -f core tryp.c tryp.core core.tryp.*
13290         ;;
13291 *)      fflushall="$undef"
13292         ;;
13293 esac
13294
13295 case "$fflushNULL$fflushall" in
13296 undefundef)
13297         $cat <<EOM
13298 OK, I give up.  I cannot figure out how to flush pending stdio output.
13299 We won't be flushing handles at all before fork/exec/popen.
13300 EOM
13301         ;;
13302 esac
13303 $rm -f try.* try$exe_ext
13304
13305 : Store the full pathname to the ar program for use in the C program
13306 : Respect a hint or command line value for full_ar.
13307 case "$full_ar" in
13308 '') full_ar=$ar ;;
13309 esac
13310
13311 : Store the full pathname to the sed program for use in the C program
13312 full_sed=$sed
13313
13314 : see what type gids are declared as in the kernel
13315 echo " "
13316 echo "Looking for the type for group ids returned by getgid()."
13317 set gid_t gidtype xxx stdio.h sys/types.h
13318 eval $typedef
13319 case "$gidtype" in
13320 xxx)
13321         xxx=`./findhdr sys/user.h`
13322         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13323         case $1 in
13324         unsigned) dflt="$1 $2" ;;
13325         *) dflt="$1" ;;
13326         esac
13327         ;;
13328 *) dflt="$gidtype";;
13329 esac
13330 case "$gidtype" in
13331 gid_t) echo "gid_t found." ;;
13332 *)      rp="What is the type for group ids returned by getgid()?"
13333         . ./myread
13334         gidtype="$ans"
13335         ;;
13336 esac
13337
13338 echo " "
13339 case "$gidtype" in
13340 *_t) zzz="$gidtype"     ;;
13341 *)   zzz="gid"          ;;
13342 esac
13343 echo "Checking the size of $zzz..." >&4 
13344 cat > try.c <<EOCP
13345 #include <sys/types.h>
13346 #include <stdio.h>
13347 int main() {
13348     printf("%d\n", (int)sizeof($gidtype));
13349     exit(0);
13350 }
13351 EOCP
13352 set try
13353 if eval $compile_ok; then
13354         yyy=`./try`
13355         case "$yyy" in
13356         '')     gidsize=4
13357                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13358                 ;;
13359         *)      gidsize=$yyy
13360                 echo "Your $zzz is $gidsize bytes long."
13361                 ;;
13362         esac
13363 else
13364         gidsize=4
13365         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13366 fi
13367
13368
13369 echo " "
13370 case "$gidtype" in
13371 *_t) zzz="$gidtype"     ;;
13372 *)   zzz="gid"          ;;
13373 esac
13374 echo "Checking the sign of $zzz..." >&4 
13375 cat > try.c <<EOCP
13376 #include <sys/types.h>
13377 #include <stdio.h>
13378 int main() {
13379         $gidtype foo = -1;
13380         if (foo < 0)
13381                 printf("-1\n");
13382         else
13383                 printf("1\n");
13384 }
13385 EOCP
13386 set try
13387 if eval $compile; then
13388         yyy=`./try`
13389         case "$yyy" in
13390         '')     gidsign=1
13391                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13392                 ;;
13393         *)      gidsign=$yyy
13394                 case "$gidsign" in
13395                  1) echo "Your $zzz is unsigned." ;;
13396                 -1) echo "Your $zzz is signed."   ;;
13397                 esac
13398                 ;;
13399         esac
13400 else
13401         gidsign=1
13402         echo "(I can't compile the test program--guessing unsigned.)" >&4
13403 fi
13404
13405
13406 echo " "
13407
13408 if $test X"$quadtype" != X; then
13409
13410 echo "Checking how to print 64-bit integers..." >&4
13411
13412 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13413         $cat >try.c <<'EOCP'
13414 #include <sys/types.h>
13415 #include <stdio.h>
13416 int main() {
13417   int q = 12345678901;
13418   printf("%ld\n", q);
13419 }
13420 EOCP
13421         set try
13422         if eval $compile; then
13423                 yyy=`./try$exe_ext`
13424                 case "$yyy" in
13425                 12345678901)
13426                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13427                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13428                         echo "We will use %d."
13429                         ;;
13430                 esac
13431         fi
13432 fi
13433
13434 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13435         $cat >try.c <<'EOCP'
13436 #include <sys/types.h>
13437 #include <stdio.h>
13438 int main() {
13439   long q = 12345678901;
13440   printf("%ld\n", q);
13441 }
13442 EOCP
13443         set try
13444         if eval $compile; then
13445                 yyy=`./try$exe_ext`
13446                 case "$yyy" in
13447                 12345678901)
13448                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13449                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13450                         echo "We will use %ld."
13451                         ;;
13452                 esac
13453         fi
13454 fi
13455
13456 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13457         $cat >try.c <<'EOCP'
13458 #include <sys/types.h>
13459 #include <inttypes.h>
13460 #include <stdio.h>
13461 int main() {
13462   int64_t q = 12345678901;
13463   printf("%" PRId64 "\n", q);
13464 }
13465 EOCP
13466         set try
13467         if eval $compile; then
13468                 yyy=`./try$exe_ext`
13469                 case "$yyy" in
13470                 12345678901)
13471                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13472                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13473                         echo "We will use the C9X style."
13474                         ;;
13475                 esac
13476         fi
13477 fi
13478
13479 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13480         $cat >try.c <<'EOCP'
13481 #include <sys/types.h>
13482 #include <stdio.h>
13483 int main() {
13484   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13485   printf("%lld\n", q);
13486 }
13487 EOCP
13488         set try
13489         if eval $compile; then
13490                 yyy=`./try$exe_ext`
13491                 case "$yyy" in
13492                 12345678901)
13493                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13494                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13495                         echo "We will use the %lld style."
13496                         ;;
13497                 esac
13498         fi
13499 fi
13500
13501 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13502         $cat >try.c <<EOCP
13503 #include <sys/types.h>
13504 #include <stdio.h>
13505 int main() {
13506   $quadtype q = 12345678901;
13507   printf("%Ld\n", q);
13508 }
13509 EOCP
13510         set try
13511         if eval $compile; then
13512                 yyy=`./try$exe_ext`
13513                 case "$yyy" in
13514                 12345678901)
13515                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13516                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13517                         echo "We will use %Ld."
13518                         ;;
13519                 esac
13520         fi
13521 fi
13522
13523 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13524         $cat >try.c <<EOCP
13525 #include <sys/types.h>
13526 #include <stdio.h>
13527 int main() {
13528   $quadtype q = 12345678901;
13529   printf("%qd\n", q);
13530 }
13531 EOCP
13532         set try
13533         if eval $compile; then
13534                 yyy=`./try$exe_ext`
13535                 case "$yyy" in
13536                 12345678901)
13537                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13538                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13539                         echo "We will use %qd."
13540                         ;;
13541                 esac
13542         fi
13543 fi
13544
13545 if $test X"$sPRId64" = X; then
13546         echo "Cannot figure out how to print 64-bit integers." >&4
13547 fi
13548
13549 $rm -f try try.*
13550
13551 fi
13552
13553 case "$sPRId64" in
13554 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13555         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13556         ;;
13557 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13558         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13559         ;;
13560 esac
13561
13562
13563 echo " "
13564 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13565
13566 if $test X"$ivsize" = X8; then
13567         ivdformat="$sPRId64"
13568         uvuformat="$sPRIu64"
13569         uvoformat="$sPRIo64"
13570         uvxformat="$sPRIx64"
13571         uvXUformat="$sPRIXU64"
13572 else
13573         if $test X"$ivsize" = X"$longsize"; then
13574                 ivdformat='"ld"'
13575                 uvuformat='"lu"'
13576                 uvoformat='"lo"'
13577                 uvxformat='"lx"'
13578                 uvXUformat='"lX"'
13579         else
13580                 if $test X"$ivsize" = X"$intsize"; then
13581                         ivdformat='"d"'
13582                         uvuformat='"u"'
13583                         uvoformat='"o"'
13584                         uvxformat='"x"'
13585                         uvXUformat='"X"'
13586                 else
13587                         : far out
13588                         if $test X"$ivsize" = X"$shortsize"; then
13589                                 ivdformat='"hd"'
13590                                 uvuformat='"hu"'
13591                                 uvoformat='"ho"'
13592                                 uvxformat='"hx"'
13593                                 uvXUformat='"hX"'
13594                         fi
13595                 fi
13596         fi
13597 fi
13598
13599 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13600         nveformat="$sPRIeldbl"
13601         nvfformat="$sPRIfldbl"
13602         nvgformat="$sPRIgldbl"
13603         nvEUformat="$sPRIEUldbl"
13604         nvFUformat="$sPRIFUldbl"
13605         nvGUformat="$sPRIGUldbl"
13606 else
13607         nveformat='"e"'
13608         nvfformat='"f"'
13609         nvgformat='"g"'
13610         nvEUformat='"E"'
13611         nvFUformat='"F"'
13612         nvGUformat='"G"'
13613 fi
13614
13615 case "$ivdformat" in
13616 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13617     exit 1
13618     ;;
13619 esac
13620
13621
13622 echo " "
13623 $echo "Checking the format string to be used for gids..." >&4
13624
13625 case "$gidsign" in
13626 -1)     if $test X"$gidsize" = X"$ivsize"; then
13627                 gidformat="$ivdformat"
13628         else
13629                 if $test X"$gidsize" = X"$longsize"; then
13630                         gidformat='"ld"'
13631                 else
13632                         if $test X"$gidsize" = X"$intsize"; then
13633                                 gidformat='"d"'
13634                         else
13635                                 if $test X"$gidsize" = X"$shortsize"; then
13636                                         gidformat='"hd"'
13637                                 fi
13638                         fi
13639                 fi
13640         fi
13641         ;;
13642 *)      if $test X"$gidsize" = X"$uvsize"; then
13643                 gidformat="$uvuformat"
13644         else
13645                 if $test X"$gidsize" = X"$longsize"; then
13646                         gidformat='"lu"'
13647                 else
13648                         if $test X"$gidsize" = X"$intsize"; then
13649                                 gidformat='"u"'
13650                         else
13651                                 if $test X"$gidsize" = X"$shortsize"; then
13652                                         gidformat='"hu"'
13653                                 fi
13654                         fi
13655                 fi
13656         fi
13657         ;;
13658 esac
13659
13660 : see if getgroups exists
13661 set getgroups d_getgrps
13662 eval $inlibc
13663
13664 : see if setgroups exists
13665 set setgroups d_setgrps
13666 eval $inlibc
13667
13668
13669 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13670 echo " "
13671 case "$d_getgrps$d_setgrps" in
13672 *define*)
13673         case "$groupstype" in
13674         '') dflt="$gidtype" ;;
13675         *)  dflt="$groupstype" ;;
13676         esac
13677         $cat <<EOM
13678 What type of pointer is the second argument to getgroups() and setgroups()?
13679 Usually this is the same as group ids, $gidtype, but not always.
13680
13681 EOM
13682         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13683         . ./myread
13684         groupstype="$ans"
13685         ;;
13686 *)  groupstype="$gidtype";;
13687 esac
13688
13689 echo " "
13690 echo "Checking if your $make program sets \$(MAKE)..." >&4
13691 case "$make_set_make" in
13692 '')
13693         $sed 's/^X //' > testmake.mak << 'EOF'
13694 Xall:
13695 X       @echo 'maketemp="$(MAKE)"'
13696 EOF
13697         case "`$make -f testmake.mak 2>/dev/null`" in
13698         *maketemp=*) make_set_make='#' ;;
13699         *)      make_set_make="MAKE=$make" ;;
13700         esac
13701         $rm -f testmake.mak
13702         ;;
13703 esac
13704 case "$make_set_make" in
13705 '#') echo "Yup, it does.";;
13706 *) echo "Nope, it doesn't.";;
13707 esac
13708
13709 : see what type is used for mode_t
13710 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13711 set mode_t modetype int stdio.h sys/types.h
13712 eval $typedef_ask
13713
13714 : see if stdarg is available
13715 echo " "
13716 if $test `./findhdr stdarg.h`; then
13717         echo "<stdarg.h> found." >&4
13718         valstd="$define"
13719 else
13720         echo "<stdarg.h> NOT found." >&4
13721         valstd="$undef"
13722 fi
13723
13724 : see if varags is available
13725 echo " "
13726 if $test `./findhdr varargs.h`; then
13727         echo "<varargs.h> found." >&4
13728 else
13729         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13730 fi
13731
13732 : set up the varargs testing programs
13733 $cat > varargs.c <<EOP
13734 #ifdef I_STDARG
13735 #include <stdarg.h>
13736 #endif
13737 #ifdef I_VARARGS
13738 #include <varargs.h>
13739 #endif
13740
13741 #ifdef I_STDARG
13742 int f(char *p, ...)
13743 #else
13744 int f(va_alist)
13745 va_dcl
13746 #endif
13747 {
13748         va_list ap;
13749 #ifndef I_STDARG
13750         char *p;
13751 #endif
13752 #ifdef I_STDARG
13753         va_start(ap,p);
13754 #else
13755         va_start(ap);
13756         p = va_arg(ap, char *);
13757 #endif
13758         va_end(ap);
13759 }
13760 EOP
13761 $cat > varargs <<EOP
13762 $startsh
13763 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13764         echo "true"
13765 else
13766         echo "false"
13767 fi
13768 $rm -f varargs$_o
13769 EOP
13770 chmod +x varargs
13771
13772 : now check which varargs header should be included
13773 echo " "
13774 i_varhdr=''
13775 case "$valstd" in
13776 "$define")
13777         if `./varargs I_STDARG`; then
13778                 val='stdarg.h'
13779         elif `./varargs I_VARARGS`; then
13780                 val='varargs.h'
13781         fi
13782         ;;
13783 *)
13784         if `./varargs I_VARARGS`; then
13785                 val='varargs.h'
13786         fi
13787         ;;
13788 esac
13789 case "$val" in
13790 '')
13791 echo "I could not find the definition for va_dcl... You have problems..." >&4
13792         val="$undef"; set i_stdarg; eval $setvar
13793         val="$undef"; set i_varargs; eval $setvar
13794         ;;
13795 *) 
13796         set i_varhdr
13797         eval $setvar
13798         case "$i_varhdr" in
13799         stdarg.h)
13800                 val="$define"; set i_stdarg; eval $setvar
13801                 val="$undef"; set i_varargs; eval $setvar
13802                 ;;
13803         varargs.h)
13804                 val="$undef"; set i_stdarg; eval $setvar
13805                 val="$define"; set i_varargs; eval $setvar
13806                 ;;
13807         esac
13808         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13809 esac
13810 $rm -f varargs*
13811
13812 : see if we need va_copy
13813 echo " "
13814 case "$i_stdarg" in
13815 "$define")
13816         $cat >try.c <<EOCP
13817 #include <stdarg.h>
13818 #include <stdio.h>
13819 #$i_stdlib I_STDLIB
13820 #ifdef I_STDLIB
13821 #include <stdlib.h>
13822 #endif
13823 #include <signal.h>
13824
13825 int
13826 ivfprintf(FILE *f, const char *fmt, va_list *valp)
13827 {
13828   return vfprintf(f, fmt, *valp);
13829 }
13830  
13831 int    
13832 myvfprintf(FILE *f, const  char *fmt, va_list val)
13833 {
13834   return ivfprintf(f, fmt, &val);
13835 }
13836       
13837 int
13838 myprintf(char *fmt, ...) 
13839 {
13840   va_list val;
13841   va_start(val, fmt);
13842   return myvfprintf(stdout, fmt, val); 
13843 }         
13844
13845 int
13846 main(int ac, char **av)
13847 {
13848   signal(SIGSEGV, exit);
13849
13850   myprintf("%s%cs all right, then\n", "that", '\'');                            
13851   exit(0);      
13852 }
13853 EOCP
13854         set try
13855         if eval $compile && ./try 2>&1 >/dev/null; then
13856                 case "`./try`" in
13857                 "that's all right, then")
13858                         okay=yes
13859                         ;;
13860                 esac
13861         fi
13862         case "$okay" in
13863         yes)    echo "It seems that you don't need va_copy()." >&4
13864                 need_va_copy="$undef"
13865                 ;;
13866         *)      echo "It seems that va_copy() or similar will be needed." >&4
13867                 need_va_copy="$define"
13868                 ;;
13869         esac
13870         $rm -f try.* core core.* *.core *.core.*
13871         ;;
13872 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
13873         ;;
13874 esac
13875
13876 : define a fucntion to check prototypes
13877 $cat > protochk <<EOSH
13878 $startsh
13879 cc="$cc"
13880 optimize="$optimize"
13881 ccflags="$ccflags"
13882 prototype="$prototype"
13883 define="$define"
13884 rm=$rm
13885 EOSH
13886
13887 $cat >> protochk <<'EOSH'
13888
13889 $rm -f try.c
13890 foo="$1"
13891 shift
13892 while test $# -ge 2; do
13893         case "$1" in
13894                 $define) echo "#include <$2>" >> try.c ;;
13895                 literal) echo "$2" >> try.c ;;
13896         esac
13897     shift 2
13898 done
13899 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13900 cat >> try.c <<'EOCP'
13901 #ifdef CAN_PROTOTYPE
13902 #define _(args) args
13903 #else
13904 #define _(args) ()
13905 #endif
13906 EOCP
13907 echo "$foo" >> try.c
13908 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13909 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13910 status=$?
13911 $rm -f try.[co]
13912 exit $status
13913 EOSH
13914 chmod +x protochk
13915 $eunicefix protochk
13916
13917 : see what type is used for size_t
13918 rp="What is the type used for the length parameter for string functions?"
13919 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13920 eval $typedef_ask
13921
13922 : check for type of arguments to gethostbyaddr. 
13923 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13924         case "$d_gethbyaddr" in
13925         $define)
13926                 $cat <<EOM
13927
13928 Checking to see what type of arguments are accepted by gethostbyaddr().
13929 EOM
13930                 hdrs="$define sys/types.h
13931                         $d_socket sys/socket.h 
13932                         $i_niin netinet/in.h 
13933                         $i_netdb netdb.h
13934                         $i_unistd unistd.h"
13935                 : The first arg can 'char *' or 'void *'
13936                 : The second arg is some of integral type
13937                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13938                         for yyy in size_t long int; do
13939                                 case "$netdb_host_type" in
13940                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13941                                         if ./protochk "$try" $hdrs; then
13942                                                 echo "Your system accepts $xxx for the first arg."
13943                                                 echo "...and $yyy for the second arg."
13944                                                 netdb_host_type="$xxx"
13945                                                 netdb_hlen_type="$yyy"
13946                                         fi
13947                                         ;;
13948                                 esac
13949                         done
13950                 done
13951                 : In case none of those worked, prompt the user.
13952                 case "$netdb_host_type" in
13953                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13954                         dflt='char *'
13955                         . ./myread
13956                         netdb_host_type=$ans
13957                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13958                         dflt="$sizetype"
13959                         . ./myread
13960                         netdb_hlen_type=$ans
13961                         ;;
13962                 esac
13963                 ;;
13964         *)      : no gethostbyaddr, so pick harmless defaults
13965                 netdb_host_type='char *'
13966                 netdb_hlen_type="$sizetype"
13967                 ;;
13968         esac
13969         # Remove the "const" if needed. -- but then we'll have a 
13970         # prototype clash!
13971         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13972 fi
13973
13974 : check for type of argument to gethostbyname. 
13975 if test "X$netdb_name_type" = X ; then
13976         case "$d_gethbyname" in
13977         $define)
13978                 $cat <<EOM
13979
13980 Checking to see what type of argument is accepted by gethostbyname().
13981 EOM
13982                 hdrs="$define sys/types.h
13983                         $d_socket sys/socket.h 
13984                         $i_niin netinet/in.h 
13985                         $i_netdb netdb.h
13986                         $i_unistd unistd.h"
13987                 for xxx in "const char *" "char *"; do
13988                         case "$netdb_name_type" in
13989                         '')     try="extern struct hostent *gethostbyname($xxx);"
13990                                 if ./protochk "$try" $hdrs; then
13991                                         echo "Your system accepts $xxx."
13992                                         netdb_name_type="$xxx"
13993                                 fi
13994                                 ;;
13995                         esac
13996                 done
13997                 : In case none of those worked, prompt the user.
13998                 case "$netdb_name_type" in
13999                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14000                         dflt='char *'
14001                         . ./myread
14002                         netdb_name_type=$ans
14003                         ;;
14004                 esac
14005                 ;;
14006         *)      : no gethostbyname, so pick harmless default
14007                 netdb_name_type='char *'
14008                 ;;
14009         esac
14010 fi
14011
14012 : check for type of 1st argument to getnetbyaddr. 
14013 if test "X$netdb_net_type" = X ; then
14014         case "$d_getnbyaddr" in
14015         $define)
14016                 $cat <<EOM
14017
14018 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14019 EOM
14020                 hdrs="$define sys/types.h
14021                         $d_socket sys/socket.h 
14022                         $i_niin netinet/in.h 
14023                         $i_netdb netdb.h
14024                         $i_unistd unistd.h"
14025                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14026                         case "$netdb_net_type" in
14027                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14028                                 if ./protochk "$try" $hdrs; then
14029                                         echo "Your system accepts $xxx."
14030                                         netdb_net_type="$xxx"
14031                                 fi
14032                                 ;;
14033                         esac
14034                 done
14035                 : In case none of those worked, prompt the user.
14036                 case "$netdb_net_type" in
14037                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14038                         dflt='long'
14039                         . ./myread
14040                         netdb_net_type=$ans
14041                         ;;
14042                 esac
14043                 ;;
14044         *)      : no getnetbyaddr, so pick harmless default
14045                 netdb_net_type='long'
14046                 ;;
14047         esac
14048 fi
14049 : locate the preferred pager for this system
14050 case "$pager" in
14051 '')
14052         dflt=''
14053         case "$pg" in
14054         /*) dflt=$pg;;
14055         [a-zA-Z]:/*) dflt=$pg;;
14056         esac
14057         case "$more" in
14058         /*) dflt=$more;;
14059         [a-zA-Z]:/*) dflt=$more;;
14060         esac
14061         case "$less" in
14062         /*) dflt=$less;;
14063         [a-zA-Z]:/*) dflt=$less;;
14064         esac
14065         case "$dflt" in
14066         '') dflt=/usr/ucb/more;;
14067         esac
14068         ;;
14069 *) dflt="$pager";;
14070 esac
14071 echo " "
14072 fn=f/
14073 rp='What pager is used on your system?'
14074 . ./getfile
14075 pager="$ans"
14076
14077 : see what type pids are declared as in the kernel
14078 rp="What is the type of process ids on this system?"
14079 set pid_t pidtype int stdio.h sys/types.h
14080 eval $typedef_ask
14081
14082 : Find earliest binary compatible site_perl subdirectory perl can use.
14083 case "$bincompat5005" in
14084 "$define") xs_apiversion='5.005' ;;
14085 *) xs_apiversion=$version ;;   # The current site_perl version.
14086 esac
14087 : Find earliest pure perl site_perl subdirectory perl can use.
14088 : The versioned directories started at 5.005.
14089 pm_apiversion='5.005'
14090
14091 : check for length of pointer
14092 echo " "
14093 case "$ptrsize" in
14094 '')
14095         echo "Checking to see how big your pointers are..." >&4
14096         if test "$voidflags" -gt 7; then
14097                 echo '#define VOID_PTR char *' > try.c
14098         else
14099                 echo '#define VOID_PTR void *' > try.c
14100         fi
14101         $cat >>try.c <<'EOCP'
14102 #include <stdio.h>
14103 int main()
14104 {
14105     printf("%d\n", (int)sizeof(VOID_PTR));
14106     exit(0);
14107 }
14108 EOCP
14109         set try
14110         if eval $compile_ok; then
14111                 ptrsize=`./try`
14112                 echo "Your pointers are $ptrsize bytes long."
14113         else
14114                 dflt='4'
14115                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
14116                 rp="What is the size of a pointer (in bytes)?"
14117                 . ./myread
14118                 ptrsize="$ans"
14119         fi
14120         ;;
14121 esac
14122 $rm -f try.c try
14123
14124 : see if ar generates random libraries by itself
14125 echo " "
14126 echo "Checking how to generate random libraries on your machine..." >&4
14127 echo 'int bar1() { return bar2(); }' > bar1.c
14128 echo 'int bar2() { return 2; }' > bar2.c
14129 $cat > foo.c <<'EOP'
14130 int main() { printf("%d\n", bar1()); exit(0); }
14131 EOP
14132 $cc $ccflags -c bar1.c >/dev/null 2>&1
14133 $cc $ccflags -c bar2.c >/dev/null 2>&1
14134 $cc $ccflags -c foo.c >/dev/null 2>&1
14135 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14136 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14137         ./foobar >/dev/null 2>&1; then
14138         echo "$ar appears to generate random libraries itself."
14139         orderlib=false
14140         ranlib=":"
14141 elif $ar ts bar$_a >/dev/null 2>&1 &&
14142         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14143         ./foobar >/dev/null 2>&1; then
14144                 echo "a table of contents needs to be added with '$ar ts'."
14145                 orderlib=false
14146                 ranlib="$ar ts"
14147 else
14148         case "$ranlib" in
14149         :) ranlib='';;
14150         '')
14151                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14152                 $test -f $ranlib || ranlib=''
14153                 ;;
14154         esac
14155         if $test -n "$ranlib"; then
14156                 echo "your system has '$ranlib'; we'll use that."
14157                 orderlib=false
14158         else
14159                 echo "your system doesn't seem to support random libraries"
14160                 echo "so we'll use lorder and tsort to order the libraries."
14161                 orderlib=true
14162                 ranlib=":"
14163         fi
14164 fi
14165 $rm -f foo* bar* 
14166
14167 : check for type of arguments to select. 
14168 case "$selecttype" in
14169 '') case "$d_select" in
14170         $define)
14171                 echo " "
14172                 $cat <<EOM
14173 Checking to see what type of arguments are accepted by select().
14174 EOM
14175                 hdrs="$define sys/types.h
14176                         $i_systime sys/time.h 
14177                         $i_sysselct sys/select.h
14178                         $d_socket sys/socket.h"
14179                 : The first arg can be int, unsigned, or size_t
14180                 : The last arg may or may not be 'const'
14181                 val=''
14182                 : void pointer has been seen but using that
14183                 : breaks the selectminbits test
14184                 for xxx in 'fd_set *' 'int *'; do
14185                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14186                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14187                                         case "$val" in
14188                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14189                                                 if ./protochk "$try" $hdrs; then
14190                                                         echo "Your system accepts $xxx."
14191                                                         val="$xxx"
14192                                                 fi
14193                                                 ;;
14194                                         esac
14195                                 done
14196                         done
14197                 done
14198                 case "$val" in
14199                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14200                         case "$d_fd_set" in
14201                                 $define) dflt="fd_set *" ;;
14202                                 *)              dflt="int *" ;;
14203                         esac
14204                         . ./myread
14205                         val=$ans
14206                         ;;
14207                 esac
14208                 selecttype="$val"
14209                 ;;
14210         *)      : no select, so pick a harmless default
14211                 selecttype='int *'
14212                 ;;
14213         esac
14214         ;;
14215 esac
14216
14217 : check for the select 'width'
14218 case "$selectminbits" in
14219 '') case "$d_select" in
14220         $define)
14221                 $cat <<EOM
14222
14223 Checking to see on how many bits at a time your select() operates...
14224 EOM
14225                 $cat >try.c <<EOCP
14226 #include <sys/types.h>
14227 #$i_time I_TIME
14228 #$i_systime I_SYS_TIME
14229 #$i_systimek I_SYS_TIME_KERNEL
14230 #ifdef I_TIME
14231 #   include <time.h>
14232 #endif
14233 #ifdef I_SYS_TIME
14234 #   ifdef I_SYS_TIME_KERNEL
14235 #       define KERNEL
14236 #   endif
14237 #   include <sys/time.h>
14238 #   ifdef I_SYS_TIME_KERNEL
14239 #       undef KERNEL
14240 #   endif
14241 #endif
14242 #$i_sysselct I_SYS_SELECT
14243 #ifdef I_SYS_SELECT
14244 #include <sys/select.h>
14245 #endif
14246 #$d_socket HAS_SOCKET
14247 #ifdef HAS_SOCKET
14248 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14249 #endif
14250 #include <stdio.h>
14251 $selecttype b;
14252 #define S sizeof(*(b))
14253 #define MINBITS 64
14254 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14255 #define NBITS  (NBYTES * 8)
14256 int main() {
14257     char s[NBYTES];
14258     struct timeval t;
14259     int i;
14260     FILE* fp;
14261     int fd;
14262
14263     fclose(stdin);
14264     fp = fopen("try.c", "r");
14265     if (fp == 0)
14266       exit(1);
14267     fd = fileno(fp);
14268     if (fd < 0)
14269       exit(2);
14270     b = ($selecttype)s;
14271     for (i = 0; i < NBITS; i++)
14272         FD_SET(i, b);
14273     t.tv_sec  = 0;
14274     t.tv_usec = 0;
14275     select(fd + 1, b, 0, 0, &t);
14276     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14277     printf("%d\n", i + 1);
14278     return 0;
14279 }
14280 EOCP
14281                 set try
14282                 if eval $compile_ok; then
14283                         selectminbits=`./try`
14284                         case "$selectminbits" in
14285                         '')     cat >&4 <<EOM
14286 Cannot figure out on how many bits at a time your select() operates.
14287 I'll play safe and guess it is 32 bits.
14288 EOM
14289                                 selectminbits=32
14290                                 bits="32 bits"
14291                                 ;;
14292                         1)      bits="1 bit" ;;
14293                         *)      bits="$selectminbits bits" ;;
14294                         esac
14295                         echo "Your select() operates on $bits at a time." >&4
14296                 else
14297                         rp='What is the minimum number of bits your select() operates on?'
14298                         case "$byteorder" in
14299                         1234|12345678)  dflt=32 ;;
14300                         *)              dflt=1  ;;
14301                         esac
14302                         . ./myread
14303                         val=$ans
14304                         selectminbits="$val"
14305                 fi
14306                 $rm -f try.* try
14307                 ;;
14308         *)      : no select, so pick a harmless default
14309                 selectminbits='32'
14310                 ;;
14311         esac
14312         ;;
14313 esac
14314
14315 : Trace out the files included by signal.h, then look for SIGxxx names.
14316 : Remove SIGARRAYSIZE used by HPUX.
14317 : Remove SIGSTKSIZE used by Linux.
14318 : Remove SIGSTKSZ used by Posix.
14319 : Remove SIGTYP void lines used by OS2.
14320 : Some cpps, like os390, dont give the file name anywhere
14321 if [ "X$fieldn" = X ]; then
14322         : Just make some guesses.  We check them later.
14323         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14324 else
14325         xxx=`echo '#include <signal.h>' |
14326         $cppstdin $cppminus $cppflags 2>/dev/null |
14327         $grep '^[       ]*#.*include' | 
14328         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14329 fi
14330 : Check this list of files to be sure we have parsed the cpp output ok.
14331 : This will also avoid potentially non-existent files, such 
14332 : as ../foo/bar.h
14333 xxxfiles=''
14334 for xx in $xxx /dev/null ; do
14335         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14336 done
14337 : If we have found no files, at least try signal.h
14338 case "$xxxfiles" in
14339 '')     xxxfiles=`./findhdr signal.h` ;;
14340 esac
14341 xxx=`awk '
14342 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14343         print substr($2, 4, 20)
14344 }
14345 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14346         print substr($3, 4, 20)
14347 }' $xxxfiles`
14348 : Append some common names just in case the awk scan failed.
14349 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14350 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14351 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14352 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14353 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14354
14355 : generate a few handy files for later
14356 $cat > signal.c <<'EOCP'
14357 #include <sys/types.h>
14358 #include <signal.h>
14359 #include <stdio.h>
14360 int main() {
14361
14362 /* Strange style to avoid deeply-nested #if/#else/#endif */
14363 #ifndef NSIG
14364 #  ifdef _NSIG
14365 #    define NSIG (_NSIG)
14366 #  endif
14367 #endif
14368
14369 #ifndef NSIG
14370 #  ifdef SIGMAX
14371 #    define NSIG (SIGMAX+1)
14372 #  endif
14373 #endif
14374
14375 #ifndef NSIG
14376 #  ifdef SIG_MAX
14377 #    define NSIG (SIG_MAX+1)
14378 #  endif
14379 #endif
14380
14381 #ifndef NSIG
14382 #  ifdef MAXSIG
14383 #    define NSIG (MAXSIG+1)
14384 #  endif
14385 #endif
14386
14387 #ifndef NSIG
14388 #  ifdef MAX_SIG
14389 #    define NSIG (MAX_SIG+1)
14390 #  endif
14391 #endif
14392
14393 #ifndef NSIG
14394 #  ifdef SIGARRAYSIZE
14395 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14396 #  endif
14397 #endif
14398
14399 #ifndef NSIG
14400 #  ifdef _sys_nsig
14401 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14402 #  endif
14403 #endif
14404
14405 /* Default to some arbitrary number that's big enough to get most
14406    of the common signals.
14407 */
14408 #ifndef NSIG
14409 #    define NSIG 50
14410 #endif
14411
14412 printf("NSIG %d\n", NSIG);
14413
14414 #ifndef JUST_NSIG
14415
14416 EOCP
14417
14418 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14419 {
14420         printf "#ifdef SIG"; printf $1; printf "\n"
14421         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14422         printf $1; printf ");\n"
14423         printf "#endif\n"
14424 }
14425 END {
14426         printf "#endif /* JUST_NSIG */\n";
14427         printf "exit(0);\n}\n";
14428 }
14429 ' >>signal.c
14430 $cat >signal.awk <<'EOP'
14431 BEGIN { ndups = 0 }
14432 $1 ~ /^NSIG$/ { nsig = $2 }
14433 ($1 !~ /^NSIG$/) && (NF == 2) {
14434     if ($2 > maxsig) { maxsig = $2 }
14435     if (sig_name[$2]) {
14436         dup_name[ndups] = $1
14437         dup_num[ndups] = $2
14438         ndups++ 
14439     }
14440     else {
14441         sig_name[$2] = $1
14442         sig_num[$2] = $2
14443     }
14444 }
14445 END { 
14446     if (nsig == 0) {
14447         nsig = maxsig + 1
14448     }
14449     printf("NSIG %d\n", nsig);
14450     for (n = 1; n < nsig; n++) {
14451         if (sig_name[n]) {
14452             printf("%s %d\n", sig_name[n], sig_num[n])
14453         }
14454         else {
14455             printf("NUM%d %d\n", n, n) 
14456         }
14457     }
14458     for (n = 0; n < ndups; n++) {
14459         printf("%s %d\n", dup_name[n], dup_num[n])
14460     }
14461 }
14462 EOP
14463 $cat >signal_cmd <<EOS
14464 $startsh
14465 if $test -s signal.lst; then
14466     echo "Using your existing signal.lst file"
14467         exit 0
14468 fi
14469 xxx="$xxx"
14470 EOS
14471 $cat >>signal_cmd <<'EOS'
14472
14473 set signal
14474 if eval $compile_ok; then
14475         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14476 else
14477         echo "(I can't seem be able to compile the whole test program)" >&4
14478         echo "(I'll try it in little pieces.)" >&4
14479         set signal -DJUST_NSIG
14480         if eval $compile_ok; then
14481                 ./signal$_exe > signal.nsg
14482                 $cat signal.nsg
14483         else
14484                 echo "I can't seem to figure out how many signals you have." >&4
14485                 echo "Guessing 50." >&4
14486                 echo 'NSIG 50' > signal.nsg
14487         fi
14488         : Now look at all the signal names, one at a time.
14489         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14490                 $cat > signal.c <<EOCP
14491 #include <sys/types.h>
14492 #include <signal.h>
14493 #include <stdio.h>
14494 int main() {
14495 printf("$xx %d\n", SIG${xx});
14496 return 0;
14497 }
14498 EOCP
14499                 set signal
14500                 if eval $compile; then
14501                         echo "SIG${xx} found."
14502                         ./signal$_exe  >> signal.ls1
14503                 else
14504                         echo "SIG${xx} NOT found."
14505                 fi
14506         done
14507         if $test -s signal.ls1; then
14508                 $cat signal.nsg signal.ls1 |
14509                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14510         fi
14511
14512 fi
14513 if $test -s signal.lst; then
14514         :
14515 else
14516         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14517         echo 'kill -l' >signal
14518         set X `csh -f <signal`
14519         $rm -f signal
14520         shift
14521         case $# in
14522         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14523         esac
14524         echo $@ | $tr ' ' $trnl | \
14525             $awk '{ printf "%s %d\n", $1, ++s; }
14526                   END { printf "NSIG %d\n", ++s }' >signal.lst
14527 fi
14528 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14529 EOS
14530 chmod a+x signal_cmd
14531 $eunicefix signal_cmd
14532
14533 : generate list of signal names
14534 echo " "
14535 case "$sig_name_init" in
14536 '') doinit=yes ;;
14537 *)  case "$sig_num_init" in
14538     ''|*,*) doinit=yes ;;
14539     esac ;;
14540 esac
14541 case "$doinit" in
14542 yes)
14543         echo "Generating a list of signal names and numbers..." >&4
14544         . ./signal_cmd
14545         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14546         sig_name=`$awk 'BEGIN { printf "ZERO " }
14547                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14548         sig_num=`$awk  'BEGIN { printf "0 " }
14549                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14550         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14551                              !/^NSIG/   { printf "\"%s\", ", $1 }
14552                              END        { printf "0\n" }' signal.lst`
14553         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14554                              !/^NSIG/   { printf "%d, ", $2}
14555                              END        { printf "0\n"}' signal.lst`
14556         ;;
14557 esac
14558 echo "The following $sig_count signals are available:"
14559 echo " "
14560 echo $sig_name | $awk \
14561 'BEGIN { linelen = 0 }
14562 {
14563         for (i = 1; i <= NF; i++) {
14564                 name = "SIG" $i " "
14565                 linelen = linelen + length(name)
14566                 if (linelen > 70) {
14567                         printf "\n"
14568                         linelen = length(name)
14569                 }
14570                 printf "%s", name
14571         }
14572         printf "\n"
14573 }'
14574 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14575
14576 echo " "
14577 case "$sizetype" in
14578 *_t) zzz="$sizetype"    ;;
14579 *)   zzz="filesize"     ;;
14580 esac
14581 echo "Checking the size of $zzz..." >&4 
14582 cat > try.c <<EOCP
14583 #include <sys/types.h>
14584 #include <stdio.h>
14585 int main() {
14586     printf("%d\n", (int)sizeof($sizetype));
14587     exit(0);
14588 }
14589 EOCP
14590 set try
14591 if eval $compile_ok; then
14592         yyy=`./try`
14593         case "$yyy" in
14594         '')     sizesize=4
14595                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14596                 ;;
14597         *)      sizesize=$yyy
14598                 echo "Your $zzz size is $sizesize bytes."
14599                 ;;
14600         esac
14601 else
14602         sizesize=4
14603         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14604 fi
14605
14606
14607 : check for socklen_t
14608 echo " "
14609 echo "Checking to see if you have socklen_t..." >&4
14610 $cat >try.c <<EOCP
14611 #include <sys/types.h>
14612 #$d_socket HAS_SOCKET
14613 #ifdef HAS_SOCKET
14614 #include <sys/socket.h>
14615 #endif
14616 int main() { socklen_t x = 16; }
14617 EOCP
14618 set try
14619 if eval $compile; then
14620         val="$define"
14621         echo "You have socklen_t."
14622 else
14623         val="$undef"
14624         echo "You do not have socklen_t."
14625         case "$sizetype" in
14626         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14627         esac
14628 fi
14629 $rm -f try try.*
14630 set d_socklen_t
14631 eval $setvar
14632
14633 : see if this is a socks.h system
14634 set socks.h i_socks
14635 eval $inhdr
14636
14637 : check for type of the size argument to socket calls
14638 case "$d_socket" in
14639 "$define")
14640         $cat <<EOM
14641
14642 Checking to see what type is the last argument of accept().
14643 EOM
14644         yyy=''
14645         case "$d_socklen_t" in
14646         "$define") yyy="$yyy socklen_t"
14647         esac
14648         yyy="$yyy $sizetype int long unsigned"
14649         for xxx in $yyy; do
14650                 case "$socksizetype" in
14651                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14652                         case "$usesocks" in
14653                         "$define")
14654                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14655                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14656                                         socksizetype="$xxx"
14657                                 fi
14658                                 ;;
14659                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14660                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14661                                         socksizetype="$xxx"
14662                                 fi
14663                                 ;;
14664                         esac
14665                         ;;
14666                 esac
14667         done
14668 : In case none of those worked, prompt the user.
14669         case "$socksizetype" in
14670         '')     rp='What is the type for socket address structure sizes?'
14671                 dflt='int'
14672                 . ./myread
14673                 socksizetype=$ans
14674                 ;;
14675         esac
14676         ;;
14677 *)      : no sockets, so pick relatively harmless default
14678         socksizetype='int'
14679         ;;
14680 esac
14681
14682 : see what type is used for signed size_t
14683 set ssize_t ssizetype int stdio.h sys/types.h
14684 eval $typedef
14685 dflt="$ssizetype"
14686 $cat > ssize.c <<EOM
14687 #include <stdio.h>
14688 #include <sys/types.h>
14689 #define Size_t $sizetype
14690 #define SSize_t $dflt
14691 int main()
14692 {
14693         if (sizeof(Size_t) == sizeof(SSize_t))
14694                 printf("$dflt\n");
14695         else if (sizeof(Size_t) == sizeof(int))
14696                 printf("int\n");
14697         else 
14698                 printf("long\n");
14699         exit(0);
14700 }
14701 EOM
14702 echo " "
14703 set ssize
14704 if eval $compile_ok && ./ssize > /dev/null; then
14705         ssizetype=`./ssize`
14706         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14707 else
14708         $cat >&4 <<EOM
14709 Help! I can't compile and run the ssize_t test program: please enlighten me!
14710 (This is probably a misconfiguration in your system or libraries, and
14711 you really ought to fix it.  Still, I'll try anyway.)
14712
14713 I need a type that is the same size as $sizetype, but is guaranteed to
14714 be signed.  Common values are ssize_t, int and long.
14715
14716 EOM
14717         rp="What signed type is the same size as $sizetype?"
14718         . ./myread
14719         ssizetype="$ans"
14720 fi
14721 $rm -f ssize ssize.*
14722
14723 : see what type of char stdio uses.
14724 echo " "
14725 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14726 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14727         echo "Your stdio uses unsigned chars." >&4
14728         stdchar="unsigned char"
14729 else
14730         echo "Your stdio uses signed chars." >&4
14731         stdchar="char"
14732 fi
14733 $rm -f stdioh
14734
14735
14736
14737 : see if time exists
14738 echo " "
14739 if test "X$d_time" = X -o X"$timetype" = X; then
14740     if set time val -f d_time; eval $csym; $val; then
14741                 echo 'time() found.' >&4
14742                 val="$define"
14743                 rp="What is the type returned by time() on this system?"
14744                 set time_t timetype long stdio.h sys/types.h
14745                 eval $typedef_ask
14746     else
14747                 echo 'time() not found, hope that will do.' >&4
14748                 val="$undef"
14749                 timetype='int';
14750     fi
14751     set d_time
14752     eval $setvar
14753 fi
14754
14755 : see what type uids are declared as in the kernel
14756 echo " "
14757 echo "Looking for the type for user ids returned by getuid()."
14758 set uid_t uidtype xxx stdio.h sys/types.h
14759 eval $typedef
14760 case "$uidtype" in
14761 xxx)
14762         xxx=`./findhdr sys/user.h`
14763         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14764         case $1 in
14765         unsigned) dflt="$1 $2" ;;
14766         *) dflt="$1" ;;
14767         esac
14768         ;;
14769 *) dflt="$uidtype";;
14770 esac
14771 case "$uidtype" in
14772 uid_t)  echo "uid_t found." ;;
14773 *)      rp="What is the type for user ids returned by getuid()?"
14774         . ./myread
14775         uidtype="$ans"
14776         ;;
14777 esac
14778
14779 echo " "
14780 case "$uidtype" in
14781 *_t) zzz="$uidtype"     ;;
14782 *)   zzz="uid"          ;;
14783 esac
14784 echo "Checking the size of $zzz..." >&4 
14785 cat > try.c <<EOCP
14786 #include <sys/types.h>
14787 #include <stdio.h>
14788 int main() {
14789     printf("%d\n", (int)sizeof($uidtype));
14790     exit(0);
14791 }
14792 EOCP
14793 set try
14794 if eval $compile_ok; then
14795         yyy=`./try`
14796         case "$yyy" in
14797         '')     uidsize=4
14798                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14799                 ;;
14800         *)      uidsize=$yyy
14801                 echo "Your $zzz is $uidsize bytes long."
14802                 ;;
14803         esac
14804 else
14805         uidsize=4
14806         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14807 fi
14808
14809 echo " "
14810 case "$uidtype" in
14811 *_t) zzz="$uidtype"     ;;
14812 *)   zzz="uid"          ;;
14813 esac
14814 echo "Checking the sign of $zzz..." >&4
14815 cat > try.c <<EOCP
14816 #include <sys/types.h>
14817 #include <stdio.h>
14818 int main() {
14819         $uidtype foo = -1;
14820         if (foo < 0)
14821                 printf("-1\n");
14822         else
14823                 printf("1\n");
14824 }
14825 EOCP
14826 set try
14827 if eval $compile; then
14828         yyy=`./try`
14829         case "$yyy" in
14830         '')     uidsign=1
14831                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14832                 ;;
14833         *)      uidsign=$yyy
14834                 case "$uidsign" in
14835                  1) echo "Your $zzz is unsigned." ;;
14836                 -1) echo "Your $zzz is signed."   ;;
14837                 esac
14838                 ;;
14839         esac
14840 else
14841         uidsign=1
14842         echo "(I can't compile the test program--guessing unsigned.)" >&4
14843 fi
14844
14845
14846
14847 echo " "
14848 $echo "Checking the format string to be used for uids..." >&4
14849
14850 case "$uidsign" in
14851 -1)     if $test X"$uidsize" = X"$ivsize"; then
14852                 uidformat="$ivdformat"
14853         else
14854                 if $test X"$uidsize" = X"$longsize"; then
14855                         uidformat='"ld"'
14856                 else
14857                         if $test X"$uidsize" = X"$intsize"; then
14858                                 uidformat='"d"'
14859                         else
14860                                 if $test X"$uidsize" = X"$shortsize"; then
14861                                         uidformat='"hd"'
14862                                 fi
14863                         fi
14864                 fi
14865         fi
14866         ;;
14867 *)      if $test X"$uidsize" = X"$uvsize"; then
14868                 uidformat="$uvuformat"
14869         else
14870                 if $test X"$uidsize" = X"$longsize"; then
14871                         uidformat='"lu"'
14872                 else
14873                         if $test X"$uidsize" = X"$intsize"; then
14874                                 uidformat='"u"'
14875                         else
14876                                 if $test X"$uidsize" = X"$shortsize"; then
14877                                         uidformat='"hu"'
14878                                 fi
14879                         fi
14880                 fi
14881         fi
14882         ;;
14883 esac
14884
14885 : see if dbm.h is available
14886 : see if dbmclose exists
14887 set dbmclose d_dbmclose
14888 eval $inlibc
14889
14890 case "$d_dbmclose" in
14891 $define)
14892         set dbm.h i_dbm
14893         eval $inhdr
14894         case "$i_dbm" in
14895         $define)
14896                 val="$undef"
14897                 set i_rpcsvcdbm
14898                 eval $setvar
14899                 ;;
14900         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14901                 eval $inhdr
14902                 ;;
14903         esac
14904         ;;
14905 *)      echo "We won't be including <dbm.h>"
14906         val="$undef"
14907         set i_dbm
14908         eval $setvar
14909         val="$undef"
14910         set i_rpcsvcdbm
14911         eval $setvar
14912         ;;
14913 esac
14914
14915 : see if this is a sys/file.h system
14916 val=''
14917 set sys/file.h val
14918 eval $inhdr
14919
14920 : do we need to include sys/file.h ?
14921 case "$val" in
14922 "$define")
14923         echo " "
14924         if $h_sysfile; then
14925                 val="$define"
14926                 echo "We'll be including <sys/file.h>." >&4
14927         else
14928                 val="$undef"
14929                 echo "We won't be including <sys/file.h>." >&4
14930         fi
14931         ;;
14932 *)
14933         h_sysfile=false
14934         ;;
14935 esac
14936 set i_sysfile
14937 eval $setvar
14938
14939 : see if fcntl.h is there
14940 val=''
14941 set fcntl.h val
14942 eval $inhdr
14943
14944 : see if we can include fcntl.h
14945 case "$val" in
14946 "$define")
14947         echo " "
14948         if $h_fcntl; then
14949                 val="$define"
14950                 echo "We'll be including <fcntl.h>." >&4
14951         else
14952                 val="$undef"
14953                 if $h_sysfile; then
14954         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14955                 else
14956                         echo "We won't be including <fcntl.h>." >&4
14957                 fi
14958         fi
14959         ;;
14960 *)
14961         h_fcntl=false
14962         val="$undef"
14963         ;;
14964 esac
14965 set i_fcntl
14966 eval $setvar
14967
14968 : see if this is a iconv.h system
14969 set iconv.h i_iconv
14970 eval $inhdr
14971
14972 : see if this is a ieeefp.h system
14973 set ieeefp.h i_ieeefp
14974 eval $inhdr
14975
14976 : see if this is a libutil.h system
14977 set libutil.h i_libutil
14978 eval $inhdr
14979
14980 : see if locale.h is available
14981 set locale.h i_locale
14982 eval $inhdr
14983
14984 : see if mach cthreads are available
14985 if test "X$usethreads" = "X$define"; then
14986         set mach/cthreads.h i_machcthr
14987         eval $inhdr
14988 else
14989         i_machcthr="$undef"
14990 fi
14991
14992
14993
14994 : see if this is a math.h system
14995 set math.h i_math
14996 eval $inhdr
14997
14998 : see if this is a mntent.h system
14999 set mntent.h i_mntent
15000 eval $inhdr
15001
15002 : see if ndbm.h is available
15003 set ndbm.h t_ndbm
15004 eval $inhdr
15005 case "$t_ndbm" in
15006 $define)
15007         : see if dbm_open exists
15008         set dbm_open d_dbm_open
15009         eval $inlibc
15010         case "$d_dbm_open" in
15011         $undef)
15012                 t_ndbm="$undef"
15013                 echo "We won't be including <ndbm.h>"
15014                 ;;
15015         esac
15016         ;;
15017 esac
15018 val="$t_ndbm"
15019 set i_ndbm
15020 eval $setvar
15021
15022 : see if net/errno.h is available
15023 val=''
15024 set net/errno.h val
15025 eval $inhdr
15026
15027 : Unfortunately, it causes problems on some systems.  Arrgh.
15028 case "$val" in
15029 $define)
15030         cat > try.c <<'EOM'
15031 #include <stdio.h>
15032 #include <errno.h>
15033 #include <net/errno.h>
15034 int func()
15035 {
15036         return ENOTSOCK;
15037 }
15038 EOM
15039         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15040                 echo "We'll be including <net/errno.h>." >&4
15041         else
15042                 echo "We won't be including <net/errno.h>." >&4
15043                 val="$undef"
15044         fi
15045         $rm -f try.* try
15046         ;;
15047 esac
15048 set i_neterrno
15049 eval $setvar
15050
15051 : see if netinet/tcp.h is available
15052 set netinet/tcp.h i_netinettcp
15053 eval $inhdr
15054
15055 : see if this is a poll.h system
15056 set poll.h i_poll
15057 eval $inhdr
15058
15059 : see if this is a prot.h system
15060 set prot.h i_prot
15061 eval $inhdr
15062
15063 echo " "
15064 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15065 $cat <<'EOSH' > Cppsym.know
15066 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15067 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15068 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
15069 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
15070 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15071 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15072 bull c cadmus clipper CMU COFF COMPILER_VERSION
15073 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15074 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15075 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15076 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15077 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15078 H3050R H3050RX hbullx20 hcx host_mips
15079 hp200 hp300 hp700 HP700 hp800 hp9000
15080 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15081 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15082 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15083 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15084 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15085 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15086 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15087 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15088 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15089 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15090 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15091 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15092 MATH_HAS_NO_SIDE_EFFECTS
15093 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15094 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15095 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15096 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15097 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15098 NetBSD news1500 news1700 news1800 news1900 news3700
15099 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15100 ns32016 ns32332 ns32k nsc32000
15101 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15102 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15103 pc532 pdp11 PGC PIC plexus PORTAR posix
15104 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15105 POSIX_C_SOURCE POSIX_SOURCE POWER
15106 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15107 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
15108 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15109 sony sony_news sonyrisc sparc sparclite spectrum
15110 stardent stdc STDC_EXT stratos sun sun3 sun386
15111 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15112 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15113 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15114 sysV68 sysV88 Tek4132 Tek4300 titan
15115 tower tower32 tower32_200 tower32_600 tower32_700
15116 tower32_800 tower32_850 tss
15117 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15118 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15119 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15120 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15121 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15122 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15123 z8000
15124 EOSH
15125 # Maybe put other stuff here too.
15126 cat <<EOSH >>Cppsym.know
15127 $osname
15128 EOSH
15129 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15130 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15131 $cat Cppsym.know > Cppsym.c
15132 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15133 $rm -f Cppsym.a Cppsym.b Cppsym.c
15134 cat <<EOSH > Cppsym
15135 $startsh
15136 if $test \$# -gt 0; then
15137     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15138     if $test -s Cppsym.got; then
15139         $rm -f Cppsym.got
15140         exit 0
15141     fi
15142     $rm -f Cppsym.got
15143     exit 1
15144 else
15145     $tr " " "$trnl" | ./Cppsym.try
15146     exit 0
15147 fi
15148 EOSH
15149 chmod +x Cppsym
15150 $eunicefix Cppsym
15151 cat <<EOSH > Cppsym.try
15152 $startsh
15153 cat <<'EOCP' > try.c
15154 #include <stdio.h>
15155 int main() {
15156 EOCP
15157 $awk \\
15158 EOSH
15159 cat <<'EOSH' >> Cppsym.try
15160 'length($1) > 0 {
15161     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
15162     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
15163     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
15164     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
15165 }'       >> try.c
15166 echo '}' >> try.c
15167 EOSH
15168 cat <<EOSH >> Cppsym.try
15169 ccflags="$ccflags"
15170 case "$osname-$gccversion" in
15171 irix-) ccflags="\$ccflags -woff 1178" ;;
15172 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15173 esac
15174 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15175 EOSH
15176 chmod +x Cppsym.try
15177 $eunicefix Cppsym.try
15178 ./Cppsym < Cppsym.know > Cppsym.true
15179 : now check the C compiler for additional symbols
15180 postprocess_cc_v=''
15181 case "$osname" in
15182 aix) postprocess_cc_v="|$tr , ' '" ;;
15183 esac
15184 $cat >ccsym <<EOS
15185 $startsh
15186 $cat >tmp.c <<EOF
15187 extern int foo;
15188 EOF
15189 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15190 do
15191         case "\$i" in
15192         -D*) echo "\$i" | $sed 's/^-D//';;
15193         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15194         esac
15195 done
15196 $rm -f try.c
15197 EOS
15198 postprocess_cc_v=''
15199 chmod +x ccsym
15200 $eunicefix ccsym
15201 ./ccsym > ccsym1.raw
15202 if $test -s ccsym1.raw; then
15203        $sort ccsym1.raw | $uniq >ccsym.raw
15204 else
15205        mv ccsym1.raw ccsym.raw
15206 fi
15207
15208 $awk '/\=/ { print $0; next }
15209         { print $0"=1" }' ccsym.raw >ccsym.list
15210 $awk '/\=/ { print $0; next }
15211         { print $0"=1" }' Cppsym.true >ccsym.true
15212 $comm -13 ccsym.true ccsym.list >ccsym.own
15213 $comm -12 ccsym.true ccsym.list >ccsym.com
15214 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15215 also=''
15216 if $test -z ccsym.raw; then
15217         echo "Your C compiler doesn't seem to define any symbols!" >&4
15218         echo " "
15219         echo "However, your C preprocessor defines the following symbols:"
15220         $cat Cppsym.true
15221         ccsymbols=''
15222         cppsymbols=`$cat Cppsym.true`
15223         cppsymbols=`echo $cppsymbols`
15224         cppccsymbols="$cppsymbols"
15225 else
15226         if $test -s ccsym.com; then
15227                 echo "Your C compiler and pre-processor define these symbols:"
15228                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15229                 also='also '
15230                 symbols='ones'
15231                 cppccsymbols=`$cat ccsym.com`
15232                 cppccsymbols=`echo $cppccsymbols`
15233                 $test "$silent" || sleep 1
15234         fi
15235         if $test -s ccsym.cpp; then
15236                 $test "$also" && echo " "
15237                 echo "Your C pre-processor ${also}defines the following symbols:"
15238                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15239                 also='further '
15240                 cppsymbols=`$cat ccsym.cpp`
15241                 cppsymbols=`echo $cppsymbols`
15242                 $test "$silent" || sleep 1
15243         fi
15244         if $test -s ccsym.own; then
15245                 $test "$also" && echo " "
15246                 echo "Your C compiler ${also}defines the following cpp symbols:"
15247                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15248                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15249                 ccsymbols=`$cat ccsym.own`
15250                 ccsymbols=`echo $ccsymbols`
15251                 $test "$silent" || sleep 1
15252         fi
15253 fi
15254 $rm -f ccsym* Cppsym.*
15255
15256 : see if this is a termio system
15257 val="$undef"
15258 val2="$undef"
15259 val3="$undef"
15260 if $test `./findhdr termios.h`; then
15261         set tcsetattr i_termios
15262         eval $inlibc
15263         val3="$i_termios"
15264 fi
15265 echo " "
15266 case "$val3" in
15267 "$define") echo "You have POSIX termios.h... good!" >&4;;
15268 *) if ./Cppsym pyr; then
15269                 case "`/bin/universe`" in
15270                 ucb) if $test `./findhdr sgtty.h`; then
15271                                 val2="$define"
15272                                 echo "<sgtty.h> found." >&4
15273                         else
15274                                 echo "System is pyramid with BSD universe."
15275                                 echo "<sgtty.h> not found--you could have problems." >&4
15276                         fi;;
15277                 *) if $test `./findhdr termio.h`; then
15278                                 val="$define"
15279                                 echo "<termio.h> found." >&4
15280                         else
15281                                 echo "System is pyramid with USG universe."
15282                                 echo "<termio.h> not found--you could have problems." >&4
15283                         fi;;
15284                 esac
15285         elif ./usg; then
15286                 if $test `./findhdr termio.h`; then
15287                         echo "<termio.h> found." >&4
15288                         val="$define"
15289                 elif $test `./findhdr sgtty.h`; then
15290                         echo "<sgtty.h> found." >&4
15291                         val2="$define"
15292                 else
15293 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15294                 fi
15295         else
15296                 if $test `./findhdr sgtty.h`; then
15297                         echo "<sgtty.h> found." >&4
15298                         val2="$define"
15299                 elif $test `./findhdr termio.h`; then
15300                         echo "<termio.h> found." >&4
15301                         val="$define"
15302                 else
15303 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15304                 fi
15305         fi;;
15306 esac
15307 set i_termio; eval $setvar
15308 val=$val2; set i_sgtty; eval $setvar
15309 val=$val3; set i_termios; eval $setvar
15310
15311 : see if this is a shadow.h system
15312 set shadow.h i_shadow
15313 eval $inhdr
15314
15315 : see if stddef is available
15316 set stddef.h i_stddef
15317 eval $inhdr
15318
15319 : see if this is a sunmath.h system
15320 set sunmath.h i_sunmath
15321 eval $inhdr
15322
15323 : see if sys/access.h is available
15324 set sys/access.h i_sysaccess
15325 eval $inhdr
15326
15327 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15328 set sys/filio.h i_sysfilio
15329 eval $inhdr
15330 echo " "
15331 if $test `./findhdr sys/ioctl.h`; then
15332         val="$define"
15333         echo '<sys/ioctl.h> found.' >&4
15334 else
15335         val="$undef"
15336         if $test $i_sysfilio = "$define"; then
15337             echo '<sys/ioctl.h> NOT found.' >&4
15338         else
15339                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15340                 $test $i_termio = "$define" && xxx="termio.h"
15341                 $test $i_termios = "$define" && xxx="termios.h"
15342 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15343         fi
15344 fi
15345 set i_sysioctl
15346 eval $setvar
15347
15348
15349 : see if this is a syslog.h system
15350 set syslog.h i_syslog
15351 eval $inhdr
15352
15353
15354 : see if this is a sys/mode.h system
15355 set sys/mode.h i_sysmode
15356 eval $inhdr
15357
15358 : see if sys/resource.h has to be included
15359 set sys/resource.h i_sysresrc
15360 eval $inhdr
15361
15362 : see if sys/security.h is available
15363 set sys/security.h i_syssecrt
15364 eval $inhdr
15365
15366 : see if this is a sys/statvfs.h system
15367 set sys/statvfs.h i_sysstatvfs
15368 eval $inhdr
15369
15370 : see if this is a sys/uio.h system
15371 set sys/uio.h i_sysuio
15372 eval $inhdr
15373
15374 : see if this is a sys/un.h system
15375 set sys/un.h i_sysun
15376 eval $inhdr
15377
15378
15379 : see if this is a sys/utsname.h system
15380 set sys/utsname.h i_sysutsname
15381 eval $inhdr
15382
15383 : see if this is a syswait system
15384 set sys/wait.h i_syswait
15385 eval $inhdr
15386
15387 : see if this is a ustat.h system
15388 set ustat.h i_ustat
15389 eval $inhdr
15390
15391 : see if this is an utime system
15392 set utime.h i_utime
15393 eval $inhdr
15394
15395 : see if this is a values.h system
15396 set values.h i_values
15397 eval $inhdr
15398
15399 : see if this is a vfork system
15400 case "$d_vfork" in
15401 "$define")
15402         set vfork.h i_vfork
15403         eval $inhdr
15404         ;;
15405 *)
15406         i_vfork="$undef"
15407         ;;
15408 esac
15409
15410 : see if gdbm.h is available
15411 set gdbm.h t_gdbm
15412 eval $inhdr
15413 case "$t_gdbm" in
15414 $define)
15415         : see if gdbm_open exists
15416         set gdbm_open d_gdbm_open
15417         eval $inlibc
15418         case "$d_gdbm_open" in
15419         $undef)
15420                 t_gdbm="$undef"
15421                 echo "We won't be including <gdbm.h>"
15422                 ;;
15423         esac
15424         ;;
15425 esac
15426 val="$t_gdbm"
15427 set i_gdbm
15428 eval $setvar
15429
15430 echo " "
15431 echo "Looking for extensions..." >&4
15432 : If we are using the old config.sh, known_extensions may contain
15433 : old or inaccurate or duplicate values.
15434 known_extensions=''
15435 nonxs_extensions=''
15436 : We do not use find because it might not be available.
15437 : We do not just use MANIFEST because the user may have dropped
15438 : some additional extensions into the source tree and expect them
15439 : to be built.
15440
15441 : Function to recursively find available extensions, ignoring DynaLoader
15442 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15443 find_extensions='
15444     for xxx in *; do
15445        case "$xxx" in
15446            DynaLoader|dynaload) ;;
15447            *)
15448            if $test -f $xxx/$xxx.xs; then
15449                known_extensions="$known_extensions $1$xxx";
15450            elif $test -f $xxx/Makefile.PL; then
15451                nonxs_extensions="$nonxs_extensions $1$xxx";
15452            else
15453                if $test -d $xxx -a $# -lt 10; then
15454                    set $1$xxx/ $*;
15455                    cd $xxx;
15456                    eval $find_extensions;
15457                    cd ..;
15458                    shift;
15459                fi;
15460            fi
15461            ;;
15462        esac;
15463     done'
15464 tdir=`pwd`
15465 cd $rsrc/ext
15466 set X
15467 shift
15468 eval $find_extensions
15469 set X $nonxs_extensions
15470 shift
15471 nonxs_extensions="$*"
15472 set X $known_extensions
15473 shift
15474 known_extensions="$*"
15475 cd $tdir
15476
15477 : Now see which are supported on this system.
15478 avail_ext=''
15479 for xxx in $known_extensions ; do
15480         case "$xxx" in
15481         DB_File|db_file)
15482                 case "$i_db" in
15483                 $define) avail_ext="$avail_ext $xxx" ;;
15484                 esac
15485                 ;;
15486         GDBM_File|gdbm_fil)
15487                 case "$i_gdbm" in 
15488                 $define) avail_ext="$avail_ext $xxx" ;;
15489                 esac
15490                 ;;
15491         NDBM_File|ndbm_fil)
15492                 case "$i_ndbm" in
15493                 $define)
15494                     case "$osname-$use64bitint" in
15495                     hpux-define)
15496                         case "$libs" in
15497                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15498                         esac
15499                         ;;
15500                     *) avail_ext="$avail_ext $xxx" ;;
15501                     esac
15502                     ;;
15503                 esac
15504                 ;;
15505         ODBM_File|odbm_fil) 
15506                 case "${i_dbm}${i_rpcsvcdbm}" in
15507                 *"${define}"*)
15508                     case "$osname-$use64bitint" in
15509                     hpux-define)
15510                         case "$libs" in
15511                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15512                         esac
15513                         ;;
15514                     *) avail_ext="$avail_ext $xxx" ;;
15515                     esac
15516                     ;;
15517                 esac
15518                 ;;
15519         POSIX|posix)
15520                 case "$useposix" in
15521                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15522                 esac
15523                 ;;
15524         Opcode|opcode)
15525                 case "$useopcode" in
15526                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15527                 esac
15528                 ;;
15529         Socket|socket)
15530                 case "$d_socket" in 
15531                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15532                 esac
15533                 ;;
15534         Sys/Syslog|sys/syslog)
15535                 : XXX syslog requires socket
15536                 case "$d_socket" in 
15537                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15538                 esac
15539                 ;;
15540         Thread|thread)
15541                 case "$usethreads" in 
15542                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15543                 esac
15544                 ;;
15545         IPC/SysV|ipc/sysv)
15546                 : XXX Do we need a useipcsysv variable here
15547                 case "${d_msg}${d_sem}${d_shm}" in 
15548                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15549                 esac
15550                 ;;
15551         *)      avail_ext="$avail_ext $xxx"
15552                 ;;
15553         esac
15554 done
15555
15556 set X $avail_ext
15557 shift
15558 avail_ext="$*"
15559
15560 : Now see which nonxs extensions are supported on this system.
15561 : For now assume all are.
15562 nonxs_ext=''
15563 for xxx in $nonxs_extensions ; do
15564         case "$xxx" in
15565         *)      nonxs_ext="$nonxs_ext $xxx"
15566                 ;;
15567         esac
15568 done
15569
15570 set X $nonxs_ext
15571 shift
15572 nonxs_ext="$*"
15573
15574 case $usedl in
15575 $define)
15576         $cat <<EOM
15577 A number of extensions are supplied with $package.  You may choose to
15578 compile these extensions for dynamic loading (the default), compile
15579 them into the $package executable (static loading), or not include
15580 them at all.  Answer "none" to include no extensions.
15581 Note that DynaLoader is always built and need not be mentioned here.
15582
15583 EOM
15584         case "$dynamic_ext" in
15585         '') dflt="$avail_ext" ;;
15586         *)      dflt="$dynamic_ext"
15587                 # Perhaps we are reusing an old out-of-date config.sh.
15588                 case "$hint" in
15589                 previous)
15590                         if test X"$dynamic_ext" != X"$avail_ext"; then
15591                                 $cat <<EOM
15592 NOTICE:  Your previous config.sh list may be incorrect. 
15593 The extensions now available to you are 
15594         ${avail_ext}
15595 but the default list from your previous config.sh is
15596         ${dynamic_ext} 
15597
15598 EOM
15599                         fi
15600                         ;;
15601                 esac
15602                 ;;
15603         esac
15604         case "$dflt" in
15605         '')     dflt=none;;
15606         esac
15607         rp="What extensions do you wish to load dynamically?"
15608         . ./myread
15609         case "$ans" in
15610         none) dynamic_ext=' ' ;;
15611         *) dynamic_ext="$ans" ;;
15612         esac
15613
15614         case "$static_ext" in
15615         '')
15616                 : Exclude those already listed in dynamic linking
15617                 dflt=''
15618                 for xxx in $avail_ext; do
15619                         case " $dynamic_ext " in
15620                         *" $xxx "*) ;;
15621                         *) dflt="$dflt $xxx" ;;
15622                         esac
15623                 done
15624                 set X $dflt
15625                 shift
15626                 dflt="$*"
15627                 ;;
15628         *)  dflt="$static_ext" 
15629                 ;;
15630         esac
15631
15632         case "$dflt" in
15633         '')     dflt=none;;
15634         esac
15635         rp="What extensions do you wish to load statically?"
15636         . ./myread
15637         case "$ans" in
15638         none) static_ext=' ' ;;
15639         *) static_ext="$ans" ;;
15640         esac
15641         ;;
15642 *)
15643         $cat <<EOM
15644 A number of extensions are supplied with $package.  Answer "none" 
15645 to include no extensions. 
15646 Note that DynaLoader is always built and need not be mentioned here.
15647
15648 EOM
15649         case "$static_ext" in
15650         '') dflt="$avail_ext" ;;
15651         *)      dflt="$static_ext"
15652                 # Perhaps we are reusing an old out-of-date config.sh.
15653                 case "$hint" in
15654                 previous)
15655                         if test X"$static_ext" != X"$avail_ext"; then
15656                                 $cat <<EOM
15657 NOTICE:  Your previous config.sh list may be incorrect. 
15658 The extensions now available to you are 
15659         ${avail_ext}
15660 but the default list from your previous config.sh is
15661         ${static_ext} 
15662
15663 EOM
15664                         fi
15665                         ;;
15666                 esac
15667                 ;;
15668         esac
15669         : Exclude those that are not xs extensions
15670         case "$dflt" in
15671         '')     dflt=none;;
15672         esac
15673         rp="What extensions do you wish to include?"
15674         . ./myread
15675         case "$ans" in
15676         none) static_ext=' ' ;;
15677         *) static_ext="$ans" ;;
15678         esac
15679         ;;
15680 esac
15681
15682 set X $dynamic_ext $static_ext $nonxs_ext
15683 shift
15684 extensions="$*"
15685
15686 : Remove libraries needed only for extensions
15687 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15688 : The exception is SunOS 4.x, which needs them.
15689 case "${osname}X${osvers}" in
15690 sunos*X4*)
15691     perllibs="$libs"
15692     ;;
15693 *) case "$usedl" in
15694     $define|true|[yY]*)
15695             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15696             shift
15697             perllibs="$*"
15698             ;;
15699     *)  perllibs="$libs"
15700             ;;
15701     esac
15702     ;;
15703 esac
15704
15705 : Remove build directory name from cppstdin so it can be used from
15706 : either the present location or the final installed location.
15707 echo " "
15708 : Get out of the UU directory to get correct path name.
15709 cd ..
15710 case "$cppstdin" in
15711 `pwd`/cppstdin)
15712         echo "Stripping down cppstdin path name"
15713         cppstdin=cppstdin
15714         ;;
15715 esac
15716 cd UU
15717
15718 : end of configuration questions
15719 echo " "
15720 echo "End of configuration questions."
15721 echo " "
15722
15723 : back to where it started
15724 if test -d ../UU; then
15725         cd ..
15726 fi
15727
15728 : configuration may be patched via a 'config.over' file
15729 if $test -f config.over; then
15730         echo " "
15731         dflt=y
15732         rp='I see a config.over file.  Do you wish to load it?'
15733         . UU/myread
15734         case "$ans" in
15735         n*) echo "OK, I'll ignore it.";;
15736         *)      . ./config.over
15737                 echo "Configuration override changes have been loaded."
15738                 ;;
15739         esac
15740 fi
15741
15742 : in case they want portability, strip down executable paths
15743 case "$d_portable" in
15744 "$define")
15745         echo " "
15746         echo "Stripping down executable paths..." >&4
15747         for file in $loclist $trylist; do
15748                 eval temp=\$$file
15749                 eval $file=`basename $temp`
15750         done
15751         ;;
15752 esac
15753
15754 : create config.sh file
15755 echo " "
15756 echo "Creating config.sh..." >&4
15757 $spitshell <<EOT >config.sh
15758 $startsh
15759 #
15760 # This file was produced by running the Configure script. It holds all the
15761 # definitions figured out by Configure. Should you modify one of these values,
15762 # do not forget to propagate your changes by running "Configure -der". You may
15763 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15764 #
15765
15766 # Package name      : $package
15767 # Source directory  : $src
15768 # Configuration time: $cf_time
15769 # Configured by     : $cf_by
15770 # Target system     : $myuname
15771
15772 Author='$Author'
15773 Date='$Date'
15774 Header='$Header'
15775 Id='$Id'
15776 Locker='$Locker'
15777 Log='$Log'
15778 Mcc='$Mcc'
15779 RCSfile='$RCSfile'
15780 Revision='$Revision'
15781 Source='$Source'
15782 State='$State'
15783 _a='$_a'
15784 _exe='$_exe'
15785 _o='$_o'
15786 afs='$afs'
15787 alignbytes='$alignbytes'
15788 ansi2knr='$ansi2knr'
15789 aphostname='$aphostname'
15790 api_revision='$api_revision'
15791 api_subversion='$api_subversion'
15792 api_version='$api_version'
15793 api_versionstring='$api_versionstring'
15794 ar='$ar'
15795 archlib='$archlib'
15796 archlibexp='$archlibexp'
15797 archname64='$archname64'
15798 archname='$archname'
15799 archobjs='$archobjs'
15800 awk='$awk'
15801 baserev='$baserev'
15802 bash='$bash'
15803 bin='$bin'
15804 bincompat5005='$bincompat5005'
15805 binexp='$binexp'
15806 bison='$bison'
15807 byacc='$byacc'
15808 byteorder='$byteorder'
15809 c='$c'
15810 castflags='$castflags'
15811 cat='$cat'
15812 cc='$cc'
15813 cccdlflags='$cccdlflags'
15814 ccdlflags='$ccdlflags'
15815 ccflags='$ccflags'
15816 ccflags_uselargefiles='$ccflags_uselargefiles'
15817 ccname='$ccname'
15818 ccsymbols='$ccsymbols'
15819 ccversion='$ccversion'
15820 cf_by='$cf_by'
15821 cf_email='$cf_email'
15822 cf_time='$cf_time'
15823 charsize='$charsize'
15824 chgrp='$chgrp'
15825 chmod='$chmod'
15826 chown='$chown'
15827 clocktype='$clocktype'
15828 comm='$comm'
15829 compress='$compress'
15830 contains='$contains'
15831 cp='$cp'
15832 cpio='$cpio'
15833 cpp='$cpp'
15834 cpp_stuff='$cpp_stuff'
15835 cppccsymbols='$cppccsymbols'
15836 cppflags='$cppflags'
15837 cpplast='$cpplast'
15838 cppminus='$cppminus'
15839 cpprun='$cpprun'
15840 cppstdin='$cppstdin'
15841 cppsymbols='$cppsymbols'
15842 crosscompile='$crosscompile'
15843 cryptlib='$cryptlib'
15844 csh='$csh'
15845 d_Gconvert='$d_Gconvert'
15846 d_PRIEUldbl='$d_PRIEUldbl'
15847 d_PRIFUldbl='$d_PRIFUldbl'
15848 d_PRIGUldbl='$d_PRIGUldbl'
15849 d_PRIXU64='$d_PRIXU64'
15850 d_PRId64='$d_PRId64'
15851 d_PRIeldbl='$d_PRIeldbl'
15852 d_PRIfldbl='$d_PRIfldbl'
15853 d_PRIgldbl='$d_PRIgldbl'
15854 d_PRIi64='$d_PRIi64'
15855 d_PRIo64='$d_PRIo64'
15856 d_PRIu64='$d_PRIu64'
15857 d_PRIx64='$d_PRIx64'
15858 d_SCNfldbl='$d_SCNfldbl'
15859 d__fwalk='$d__fwalk'
15860 d_access='$d_access'
15861 d_accessx='$d_accessx'
15862 d_alarm='$d_alarm'
15863 d_archlib='$d_archlib'
15864 d_atolf='$d_atolf'
15865 d_atoll='$d_atoll'
15866 d_attribut='$d_attribut'
15867 d_bcmp='$d_bcmp'
15868 d_bcopy='$d_bcopy'
15869 d_bincompat5005='$d_bincompat5005'
15870 d_bsd='$d_bsd'
15871 d_bsdgetpgrp='$d_bsdgetpgrp'
15872 d_bsdsetpgrp='$d_bsdsetpgrp'
15873 d_bzero='$d_bzero'
15874 d_casti32='$d_casti32'
15875 d_castneg='$d_castneg'
15876 d_charvspr='$d_charvspr'
15877 d_chown='$d_chown'
15878 d_chroot='$d_chroot'
15879 d_chsize='$d_chsize'
15880 d_closedir='$d_closedir'
15881 d_const='$d_const'
15882 d_crypt='$d_crypt'
15883 d_csh='$d_csh'
15884 d_cuserid='$d_cuserid'
15885 d_dbl_dig='$d_dbl_dig'
15886 d_difftime='$d_difftime'
15887 d_dirnamlen='$d_dirnamlen'
15888 d_dlerror='$d_dlerror'
15889 d_dlopen='$d_dlopen'
15890 d_dlsymun='$d_dlsymun'
15891 d_dosuid='$d_dosuid'
15892 d_drand48proto='$d_drand48proto'
15893 d_dup2='$d_dup2'
15894 d_eaccess='$d_eaccess'
15895 d_endgrent='$d_endgrent'
15896 d_endhent='$d_endhent'
15897 d_endnent='$d_endnent'
15898 d_endpent='$d_endpent'
15899 d_endpwent='$d_endpwent'
15900 d_endsent='$d_endsent'
15901 d_eofnblk='$d_eofnblk'
15902 d_eunice='$d_eunice'
15903 d_fchmod='$d_fchmod'
15904 d_fchown='$d_fchown'
15905 d_fcntl='$d_fcntl'
15906 d_fcntl_can_lock='$d_fcntl_can_lock'
15907 d_fd_macros='$d_fd_macros'
15908 d_fd_set='$d_fd_set'
15909 d_fds_bits='$d_fds_bits'
15910 d_fgetpos='$d_fgetpos'
15911 d_flexfnam='$d_flexfnam'
15912 d_flock='$d_flock'
15913 d_fork='$d_fork'
15914 d_fpathconf='$d_fpathconf'
15915 d_fpos64_t='$d_fpos64_t'
15916 d_frexpl='$d_frexpl'
15917 d_fs_data_s='$d_fs_data_s'
15918 d_fseeko='$d_fseeko'
15919 d_fsetpos='$d_fsetpos'
15920 d_fstatfs='$d_fstatfs'
15921 d_fstatvfs='$d_fstatvfs'
15922 d_fsync='$d_fsync'
15923 d_ftello='$d_ftello'
15924 d_ftime='$d_ftime'
15925 d_getcwd='$d_getcwd'
15926 d_getespwnam='$d_getespwnam'
15927 d_getfsstat='$d_getfsstat'
15928 d_getgrent='$d_getgrent'
15929 d_getgrps='$d_getgrps'
15930 d_gethbyaddr='$d_gethbyaddr'
15931 d_gethbyname='$d_gethbyname'
15932 d_gethent='$d_gethent'
15933 d_gethname='$d_gethname'
15934 d_gethostprotos='$d_gethostprotos'
15935 d_getlogin='$d_getlogin'
15936 d_getmnt='$d_getmnt'
15937 d_getmntent='$d_getmntent'
15938 d_getnbyaddr='$d_getnbyaddr'
15939 d_getnbyname='$d_getnbyname'
15940 d_getnent='$d_getnent'
15941 d_getnetprotos='$d_getnetprotos'
15942 d_getpagsz='$d_getpagsz'
15943 d_getpbyname='$d_getpbyname'
15944 d_getpbynumber='$d_getpbynumber'
15945 d_getpent='$d_getpent'
15946 d_getpgid='$d_getpgid'
15947 d_getpgrp2='$d_getpgrp2'
15948 d_getpgrp='$d_getpgrp'
15949 d_getppid='$d_getppid'
15950 d_getprior='$d_getprior'
15951 d_getprotoprotos='$d_getprotoprotos'
15952 d_getprpwnam='$d_getprpwnam'
15953 d_getpwent='$d_getpwent'
15954 d_getsbyname='$d_getsbyname'
15955 d_getsbyport='$d_getsbyport'
15956 d_getsent='$d_getsent'
15957 d_getservprotos='$d_getservprotos'
15958 d_getspnam='$d_getspnam'
15959 d_gettimeod='$d_gettimeod'
15960 d_gnulibc='$d_gnulibc'
15961 d_grpasswd='$d_grpasswd'
15962 d_hasmntopt='$d_hasmntopt'
15963 d_htonl='$d_htonl'
15964 d_iconv='$d_iconv'
15965 d_index='$d_index'
15966 d_inetaton='$d_inetaton'
15967 d_int64_t='$d_int64_t'
15968 d_isascii='$d_isascii'
15969 d_isnan='$d_isnan'
15970 d_isnanl='$d_isnanl'
15971 d_killpg='$d_killpg'
15972 d_lchown='$d_lchown'
15973 d_ldbl_dig='$d_ldbl_dig'
15974 d_link='$d_link'
15975 d_locconv='$d_locconv'
15976 d_lockf='$d_lockf'
15977 d_longdbl='$d_longdbl'
15978 d_longlong='$d_longlong'
15979 d_lseekproto='$d_lseekproto'
15980 d_lstat='$d_lstat'
15981 d_madvise='$d_madvise'
15982 d_mblen='$d_mblen'
15983 d_mbstowcs='$d_mbstowcs'
15984 d_mbtowc='$d_mbtowc'
15985 d_memchr='$d_memchr'
15986 d_memcmp='$d_memcmp'
15987 d_memcpy='$d_memcpy'
15988 d_memmove='$d_memmove'
15989 d_memset='$d_memset'
15990 d_mkdir='$d_mkdir'
15991 d_mkdtemp='$d_mkdtemp'
15992 d_mkfifo='$d_mkfifo'
15993 d_mkstemp='$d_mkstemp'
15994 d_mkstemps='$d_mkstemps'
15995 d_mktime='$d_mktime'
15996 d_mmap='$d_mmap'
15997 d_modfl='$d_modfl'
15998 d_mprotect='$d_mprotect'
15999 d_msg='$d_msg'
16000 d_msg_ctrunc='$d_msg_ctrunc'
16001 d_msg_dontroute='$d_msg_dontroute'
16002 d_msg_oob='$d_msg_oob'
16003 d_msg_peek='$d_msg_peek'
16004 d_msg_proxy='$d_msg_proxy'
16005 d_msgctl='$d_msgctl'
16006 d_msgget='$d_msgget'
16007 d_msgrcv='$d_msgrcv'
16008 d_msgsnd='$d_msgsnd'
16009 d_msync='$d_msync'
16010 d_munmap='$d_munmap'
16011 d_mymalloc='$d_mymalloc'
16012 d_nice='$d_nice'
16013 d_nv_preserves_uv='$d_nv_preserves_uv'
16014 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16015 d_off64_t='$d_off64_t'
16016 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16017 d_oldpthreads='$d_oldpthreads'
16018 d_oldsock='$d_oldsock'
16019 d_open3='$d_open3'
16020 d_pathconf='$d_pathconf'
16021 d_pause='$d_pause'
16022 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16023 d_phostname='$d_phostname'
16024 d_pipe='$d_pipe'
16025 d_poll='$d_poll'
16026 d_portable='$d_portable'
16027 d_pthread_yield='$d_pthread_yield'
16028 d_pwage='$d_pwage'
16029 d_pwchange='$d_pwchange'
16030 d_pwclass='$d_pwclass'
16031 d_pwcomment='$d_pwcomment'
16032 d_pwexpire='$d_pwexpire'
16033 d_pwgecos='$d_pwgecos'
16034 d_pwpasswd='$d_pwpasswd'
16035 d_pwquota='$d_pwquota'
16036 d_qgcvt='$d_qgcvt'
16037 d_quad='$d_quad'
16038 d_readdir='$d_readdir'
16039 d_readlink='$d_readlink'
16040 d_rename='$d_rename'
16041 d_rewinddir='$d_rewinddir'
16042 d_rmdir='$d_rmdir'
16043 d_safebcpy='$d_safebcpy'
16044 d_safemcpy='$d_safemcpy'
16045 d_sanemcmp='$d_sanemcmp'
16046 d_sbrkproto='$d_sbrkproto'
16047 d_sched_yield='$d_sched_yield'
16048 d_scm_rights='$d_scm_rights'
16049 d_seekdir='$d_seekdir'
16050 d_select='$d_select'
16051 d_sem='$d_sem'
16052 d_semctl='$d_semctl'
16053 d_semctl_semid_ds='$d_semctl_semid_ds'
16054 d_semctl_semun='$d_semctl_semun'
16055 d_semget='$d_semget'
16056 d_semop='$d_semop'
16057 d_setegid='$d_setegid'
16058 d_seteuid='$d_seteuid'
16059 d_setgrent='$d_setgrent'
16060 d_setgrps='$d_setgrps'
16061 d_sethent='$d_sethent'
16062 d_setlinebuf='$d_setlinebuf'
16063 d_setlocale='$d_setlocale'
16064 d_setnent='$d_setnent'
16065 d_setpent='$d_setpent'
16066 d_setpgid='$d_setpgid'
16067 d_setpgrp2='$d_setpgrp2'
16068 d_setpgrp='$d_setpgrp'
16069 d_setprior='$d_setprior'
16070 d_setproctitle='$d_setproctitle'
16071 d_setpwent='$d_setpwent'
16072 d_setregid='$d_setregid'
16073 d_setresgid='$d_setresgid'
16074 d_setresuid='$d_setresuid'
16075 d_setreuid='$d_setreuid'
16076 d_setrgid='$d_setrgid'
16077 d_setruid='$d_setruid'
16078 d_setsent='$d_setsent'
16079 d_setsid='$d_setsid'
16080 d_setvbuf='$d_setvbuf'
16081 d_sfio='$d_sfio'
16082 d_shm='$d_shm'
16083 d_shmat='$d_shmat'
16084 d_shmatprototype='$d_shmatprototype'
16085 d_shmctl='$d_shmctl'
16086 d_shmdt='$d_shmdt'
16087 d_shmget='$d_shmget'
16088 d_sigaction='$d_sigaction'
16089 d_sigsetjmp='$d_sigsetjmp'
16090 d_socket='$d_socket'
16091 d_socklen_t='$d_socklen_t'
16092 d_sockpair='$d_sockpair'
16093 d_socks5_init='$d_socks5_init'
16094 d_sqrtl='$d_sqrtl'
16095 d_statblks='$d_statblks'
16096 d_statfs_f_flags='$d_statfs_f_flags'
16097 d_statfs_s='$d_statfs_s'
16098 d_statvfs='$d_statvfs'
16099 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16100 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16101 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16102 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16103 d_stdio_stream_array='$d_stdio_stream_array'
16104 d_stdiobase='$d_stdiobase'
16105 d_stdstdio='$d_stdstdio'
16106 d_strchr='$d_strchr'
16107 d_strcoll='$d_strcoll'
16108 d_strctcpy='$d_strctcpy'
16109 d_strerrm='$d_strerrm'
16110 d_strerror='$d_strerror'
16111 d_strtod='$d_strtod'
16112 d_strtol='$d_strtol'
16113 d_strtold='$d_strtold'
16114 d_strtoll='$d_strtoll'
16115 d_strtoq='$d_strtoq'
16116 d_strtoul='$d_strtoul'
16117 d_strtoull='$d_strtoull'
16118 d_strtouq='$d_strtouq'
16119 d_strxfrm='$d_strxfrm'
16120 d_suidsafe='$d_suidsafe'
16121 d_symlink='$d_symlink'
16122 d_syscall='$d_syscall'
16123 d_sysconf='$d_sysconf'
16124 d_sysernlst='$d_sysernlst'
16125 d_syserrlst='$d_syserrlst'
16126 d_system='$d_system'
16127 d_tcgetpgrp='$d_tcgetpgrp'
16128 d_tcsetpgrp='$d_tcsetpgrp'
16129 d_telldir='$d_telldir'
16130 d_telldirproto='$d_telldirproto'
16131 d_time='$d_time'
16132 d_times='$d_times'
16133 d_truncate='$d_truncate'
16134 d_tzname='$d_tzname'
16135 d_umask='$d_umask'
16136 d_uname='$d_uname'
16137 d_union_semun='$d_union_semun'
16138 d_ustat='$d_ustat'
16139 d_vendorarch='$d_vendorarch'
16140 d_vendorbin='$d_vendorbin'
16141 d_vendorlib='$d_vendorlib'
16142 d_vfork='$d_vfork'
16143 d_void_closedir='$d_void_closedir'
16144 d_voidsig='$d_voidsig'
16145 d_voidtty='$d_voidtty'
16146 d_volatile='$d_volatile'
16147 d_vprintf='$d_vprintf'
16148 d_wait4='$d_wait4'
16149 d_waitpid='$d_waitpid'
16150 d_wcstombs='$d_wcstombs'
16151 d_wctomb='$d_wctomb'
16152 d_xenix='$d_xenix'
16153 date='$date'
16154 db_hashtype='$db_hashtype'
16155 db_prefixtype='$db_prefixtype'
16156 defvoidused='$defvoidused'
16157 direntrytype='$direntrytype'
16158 dlext='$dlext'
16159 dlsrc='$dlsrc'
16160 doublesize='$doublesize'
16161 drand01='$drand01'
16162 dynamic_ext='$dynamic_ext'
16163 eagain='$eagain'
16164 ebcdic='$ebcdic'
16165 echo='$echo'
16166 egrep='$egrep'
16167 emacs='$emacs'
16168 eunicefix='$eunicefix'
16169 exe_ext='$exe_ext'
16170 expr='$expr'
16171 extensions='$extensions'
16172 fflushNULL='$fflushNULL'
16173 fflushall='$fflushall'
16174 find='$find'
16175 firstmakefile='$firstmakefile'
16176 flex='$flex'
16177 fpossize='$fpossize'
16178 fpostype='$fpostype'
16179 freetype='$freetype'
16180 full_ar='$full_ar'
16181 full_csh='$full_csh'
16182 full_sed='$full_sed'
16183 gccosandvers='$gccosandvers'
16184 gccversion='$gccversion'
16185 gidformat='$gidformat'
16186 gidsign='$gidsign'
16187 gidsize='$gidsize'
16188 gidtype='$gidtype'
16189 glibpth='$glibpth'
16190 grep='$grep'
16191 groupcat='$groupcat'
16192 groupstype='$groupstype'
16193 gzip='$gzip'
16194 h_fcntl='$h_fcntl'
16195 h_sysfile='$h_sysfile'
16196 hint='$hint'
16197 hostcat='$hostcat'
16198 i16size='$i16size'
16199 i16type='$i16type'
16200 i32size='$i32size'
16201 i32type='$i32type'
16202 i64size='$i64size'
16203 i64type='$i64type'
16204 i8size='$i8size'
16205 i8type='$i8type'
16206 i_arpainet='$i_arpainet'
16207 i_bsdioctl='$i_bsdioctl'
16208 i_db='$i_db'
16209 i_dbm='$i_dbm'
16210 i_dirent='$i_dirent'
16211 i_dld='$i_dld'
16212 i_dlfcn='$i_dlfcn'
16213 i_fcntl='$i_fcntl'
16214 i_float='$i_float'
16215 i_gdbm='$i_gdbm'
16216 i_grp='$i_grp'
16217 i_iconv='$i_iconv'
16218 i_ieeefp='$i_ieeefp'
16219 i_inttypes='$i_inttypes'
16220 i_libutil='$i_libutil'
16221 i_limits='$i_limits'
16222 i_locale='$i_locale'
16223 i_machcthr='$i_machcthr'
16224 i_malloc='$i_malloc'
16225 i_math='$i_math'
16226 i_memory='$i_memory'
16227 i_mntent='$i_mntent'
16228 i_ndbm='$i_ndbm'
16229 i_netdb='$i_netdb'
16230 i_neterrno='$i_neterrno'
16231 i_netinettcp='$i_netinettcp'
16232 i_niin='$i_niin'
16233 i_poll='$i_poll'
16234 i_prot='$i_prot'
16235 i_pthread='$i_pthread'
16236 i_pwd='$i_pwd'
16237 i_rpcsvcdbm='$i_rpcsvcdbm'
16238 i_sfio='$i_sfio'
16239 i_sgtty='$i_sgtty'
16240 i_shadow='$i_shadow'
16241 i_socks='$i_socks'
16242 i_stdarg='$i_stdarg'
16243 i_stddef='$i_stddef'
16244 i_stdlib='$i_stdlib'
16245 i_string='$i_string'
16246 i_sunmath='$i_sunmath'
16247 i_sysaccess='$i_sysaccess'
16248 i_sysdir='$i_sysdir'
16249 i_sysfile='$i_sysfile'
16250 i_sysfilio='$i_sysfilio'
16251 i_sysin='$i_sysin'
16252 i_sysioctl='$i_sysioctl'
16253 i_syslog='$i_syslog'
16254 i_sysmman='$i_sysmman'
16255 i_sysmode='$i_sysmode'
16256 i_sysmount='$i_sysmount'
16257 i_sysndir='$i_sysndir'
16258 i_sysparam='$i_sysparam'
16259 i_sysresrc='$i_sysresrc'
16260 i_syssecrt='$i_syssecrt'
16261 i_sysselct='$i_sysselct'
16262 i_syssockio='$i_syssockio'
16263 i_sysstat='$i_sysstat'
16264 i_sysstatfs='$i_sysstatfs'
16265 i_sysstatvfs='$i_sysstatvfs'
16266 i_systime='$i_systime'
16267 i_systimek='$i_systimek'
16268 i_systimes='$i_systimes'
16269 i_systypes='$i_systypes'
16270 i_sysuio='$i_sysuio'
16271 i_sysun='$i_sysun'
16272 i_sysutsname='$i_sysutsname'
16273 i_sysvfs='$i_sysvfs'
16274 i_syswait='$i_syswait'
16275 i_termio='$i_termio'
16276 i_termios='$i_termios'
16277 i_time='$i_time'
16278 i_unistd='$i_unistd'
16279 i_ustat='$i_ustat'
16280 i_utime='$i_utime'
16281 i_values='$i_values'
16282 i_varargs='$i_varargs'
16283 i_varhdr='$i_varhdr'
16284 i_vfork='$i_vfork'
16285 ignore_versioned_solibs='$ignore_versioned_solibs'
16286 inc_version_list='$inc_version_list'
16287 inc_version_list_init='$inc_version_list_init'
16288 incpath='$incpath'
16289 inews='$inews'
16290 installarchlib='$installarchlib'
16291 installbin='$installbin'
16292 installman1dir='$installman1dir'
16293 installman3dir='$installman3dir'
16294 installprefix='$installprefix'
16295 installprefixexp='$installprefixexp'
16296 installprivlib='$installprivlib'
16297 installscript='$installscript'
16298 installsitearch='$installsitearch'
16299 installsitebin='$installsitebin'
16300 installsitelib='$installsitelib'
16301 installstyle='$installstyle'
16302 installusrbinperl='$installusrbinperl'
16303 installvendorarch='$installvendorarch'
16304 installvendorbin='$installvendorbin'
16305 installvendorlib='$installvendorlib'
16306 intsize='$intsize'
16307 issymlink='$issymlink'
16308 ivdformat='$ivdformat'
16309 ivsize='$ivsize'
16310 ivtype='$ivtype'
16311 known_extensions='$known_extensions'
16312 ksh='$ksh'
16313 ld='$ld'
16314 lddlflags='$lddlflags'
16315 ldflags='$ldflags'
16316 ldflags_uselargefiles='$ldflags_uselargefiles'
16317 ldlibpthname='$ldlibpthname'
16318 less='$less'
16319 lib_ext='$lib_ext'
16320 libc='$libc'
16321 libperl='$libperl'
16322 libpth='$libpth'
16323 libs='$libs'
16324 libsdirs='$libsdirs'
16325 libsfiles='$libsfiles'
16326 libsfound='$libsfound'
16327 libspath='$libspath'
16328 libswanted='$libswanted'
16329 libswanted_uselargefiles='$libswanted_uselargefiles'
16330 line='$line'
16331 lint='$lint'
16332 lkflags='$lkflags'
16333 ln='$ln'
16334 lns='$lns'
16335 locincpth='$locincpth'
16336 loclibpth='$loclibpth'
16337 longdblsize='$longdblsize'
16338 longlongsize='$longlongsize'
16339 longsize='$longsize'
16340 lp='$lp'
16341 lpr='$lpr'
16342 ls='$ls'
16343 lseeksize='$lseeksize'
16344 lseektype='$lseektype'
16345 mail='$mail'
16346 mailx='$mailx'
16347 make='$make'
16348 make_set_make='$make_set_make'
16349 mallocobj='$mallocobj'
16350 mallocsrc='$mallocsrc'
16351 malloctype='$malloctype'
16352 man1dir='$man1dir'
16353 man1direxp='$man1direxp'
16354 man1ext='$man1ext'
16355 man3dir='$man3dir'
16356 man3direxp='$man3direxp'
16357 man3ext='$man3ext'
16358 mips_type='$mips_type'
16359 mkdir='$mkdir'
16360 mmaptype='$mmaptype'
16361 modetype='$modetype'
16362 more='$more'
16363 multiarch='$multiarch'
16364 mv='$mv'
16365 myarchname='$myarchname'
16366 mydomain='$mydomain'
16367 myhostname='$myhostname'
16368 myuname='$myuname'
16369 n='$n'
16370 need_va_copy='$need_va_copy'
16371 netdb_hlen_type='$netdb_hlen_type'
16372 netdb_host_type='$netdb_host_type'
16373 netdb_name_type='$netdb_name_type'
16374 netdb_net_type='$netdb_net_type'
16375 nm='$nm'
16376 nm_opt='$nm_opt'
16377 nm_so_opt='$nm_so_opt'
16378 nonxs_ext='$nonxs_ext'
16379 nroff='$nroff'
16380 nvEUformat='$nvEUformat'
16381 nvFUformat='$nvFUformat'
16382 nvGUformat='$nvGUformat'
16383 nveformat='$nveformat'
16384 nvfformat='$nvfformat'
16385 nvgformat='$nvgformat'
16386 nvsize='$nvsize'
16387 nvtype='$nvtype'
16388 o_nonblock='$o_nonblock'
16389 obj_ext='$obj_ext'
16390 old_pthread_create_joinable='$old_pthread_create_joinable'
16391 optimize='$optimize'
16392 orderlib='$orderlib'
16393 osname='$osname'
16394 osvers='$osvers'
16395 otherlibdirs='$otherlibdirs'
16396 package='$package'
16397 pager='$pager'
16398 passcat='$passcat'
16399 patchlevel='$patchlevel'
16400 path_sep='$path_sep'
16401 perl5='$perl5'
16402 perl='$perl'
16403 perladmin='$perladmin'
16404 perllibs='$perllibs'
16405 perlpath='$perlpath'
16406 pg='$pg'
16407 phostname='$phostname'
16408 pidtype='$pidtype'
16409 plibpth='$plibpth'
16410 pm_apiversion='$pm_apiversion'
16411 pmake='$pmake'
16412 pr='$pr'
16413 prefix='$prefix'
16414 prefixexp='$prefixexp'
16415 privlib='$privlib'
16416 privlibexp='$privlibexp'
16417 prototype='$prototype'
16418 ptrsize='$ptrsize'
16419 quadkind='$quadkind'
16420 quadtype='$quadtype'
16421 randbits='$randbits'
16422 randfunc='$randfunc'
16423 randseedtype='$randseedtype'
16424 ranlib='$ranlib'
16425 rd_nodata='$rd_nodata'
16426 revision='$revision'
16427 rm='$rm'
16428 rmail='$rmail'
16429 runnm='$runnm'
16430 sPRIEUldbl='$sPRIEUldbl'
16431 sPRIFUldbl='$sPRIFUldbl'
16432 sPRIGUldbl='$sPRIGUldbl'
16433 sPRIXU64='$sPRIXU64'
16434 sPRId64='$sPRId64'
16435 sPRIeldbl='$sPRIeldbl'
16436 sPRIfldbl='$sPRIfldbl'
16437 sPRIgldbl='$sPRIgldbl'
16438 sPRIi64='$sPRIi64'
16439 sPRIo64='$sPRIo64'
16440 sPRIu64='$sPRIu64'
16441 sPRIx64='$sPRIx64'
16442 sSCNfldbl='$sSCNfldbl'
16443 sched_yield='$sched_yield'
16444 scriptdir='$scriptdir'
16445 scriptdirexp='$scriptdirexp'
16446 sed='$sed'
16447 seedfunc='$seedfunc'
16448 selectminbits='$selectminbits'
16449 selecttype='$selecttype'
16450 sendmail='$sendmail'
16451 sh='$sh'
16452 sh_c='$sh_c'
16453 shar='$shar'
16454 sharpbang='$sharpbang'
16455 shmattype='$shmattype'
16456 shortsize='$shortsize'
16457 shrpenv='$shrpenv'
16458 shsharp='$shsharp'
16459 sig_count='$sig_count'
16460 sig_name='$sig_name'
16461 sig_name_init='$sig_name_init'
16462 sig_num='$sig_num'
16463 sig_num_init='$sig_num_init'
16464 signal_t='$signal_t'
16465 sitearch='$sitearch'
16466 sitearchexp='$sitearchexp'
16467 sitebin='$sitebin'
16468 sitebinexp='$sitebinexp'
16469 sitelib='$sitelib'
16470 sitelib_stem='$sitelib_stem'
16471 sitelibexp='$sitelibexp'
16472 siteprefix='$siteprefix'
16473 siteprefixexp='$siteprefixexp'
16474 sizesize='$sizesize'
16475 sizetype='$sizetype'
16476 sleep='$sleep'
16477 smail='$smail'
16478 so='$so'
16479 sockethdr='$sockethdr'
16480 socketlib='$socketlib'
16481 socksizetype='$socksizetype'
16482 sort='$sort'
16483 spackage='$spackage'
16484 spitshell='$spitshell'
16485 src='$src'
16486 ssizetype='$ssizetype'
16487 startperl='$startperl'
16488 startsh='$startsh'
16489 static_ext='$static_ext'
16490 stdchar='$stdchar'
16491 stdio_base='$stdio_base'
16492 stdio_bufsiz='$stdio_bufsiz'
16493 stdio_cnt='$stdio_cnt'
16494 stdio_filbuf='$stdio_filbuf'
16495 stdio_ptr='$stdio_ptr'
16496 stdio_stream_array='$stdio_stream_array'
16497 strings='$strings'
16498 submit='$submit'
16499 subversion='$subversion'
16500 sysman='$sysman'
16501 tail='$tail'
16502 tar='$tar'
16503 tbl='$tbl'
16504 tee='$tee'
16505 test='$test'
16506 timeincl='$timeincl'
16507 timetype='$timetype'
16508 touch='$touch'
16509 tr='$tr'
16510 trnl='$trnl'
16511 troff='$troff'
16512 u16size='$u16size'
16513 u16type='$u16type'
16514 u32size='$u32size'
16515 u32type='$u32type'
16516 u64size='$u64size'
16517 u64type='$u64type'
16518 u8size='$u8size'
16519 u8type='$u8type'
16520 uidformat='$uidformat'
16521 uidsign='$uidsign'
16522 uidsize='$uidsize'
16523 uidtype='$uidtype'
16524 uname='$uname'
16525 uniq='$uniq'
16526 uquadtype='$uquadtype'
16527 use5005threads='$use5005threads'
16528 use64bitall='$use64bitall'
16529 use64bitint='$use64bitint'
16530 usedl='$usedl'
16531 useithreads='$useithreads'
16532 uselargefiles='$uselargefiles'
16533 uselongdouble='$uselongdouble'
16534 usemorebits='$usemorebits'
16535 usemultiplicity='$usemultiplicity'
16536 usemymalloc='$usemymalloc'
16537 usenm='$usenm'
16538 useopcode='$useopcode'
16539 useperlio='$useperlio'
16540 useposix='$useposix'
16541 usesfio='$usesfio'
16542 useshrplib='$useshrplib'
16543 usesocks='$usesocks'
16544 usethreads='$usethreads'
16545 usevendorprefix='$usevendorprefix'
16546 usevfork='$usevfork'
16547 usrinc='$usrinc'
16548 uuname='$uuname'
16549 uvXUformat='$uvXUformat'
16550 uvoformat='$uvoformat'
16551 uvsize='$uvsize'
16552 uvtype='$uvtype'
16553 uvuformat='$uvuformat'
16554 uvxformat='$uvxformat'
16555 vendorarch='$vendorarch'
16556 vendorarchexp='$vendorarchexp'
16557 vendorbin='$vendorbin'
16558 vendorbinexp='$vendorbinexp'
16559 vendorlib='$vendorlib'
16560 vendorlib_stem='$vendorlib_stem'
16561 vendorlibexp='$vendorlibexp'
16562 vendorprefix='$vendorprefix'
16563 vendorprefixexp='$vendorprefixexp'
16564 version='$version'
16565 versiononly='$versiononly'
16566 vi='$vi'
16567 voidflags='$voidflags'
16568 xlibpth='$xlibpth'
16569 xs_apiversion='$xs_apiversion'
16570 zcat='$zcat'
16571 zip='$zip'
16572 EOT
16573
16574 : Add in command line options if available
16575 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16576
16577 : add special variables
16578 $test -f $src/patchlevel.h && \
16579 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16580 echo "CONFIGDOTSH=true" >>config.sh
16581
16582 : propagate old symbols
16583 if $test -f UU/config.sh; then
16584         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16585         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16586         $sort | $uniq -u >UU/oldsyms
16587         set X `cat UU/oldsyms`
16588         shift
16589         case $# in
16590         0) ;;
16591         *)
16592                 cat <<EOM
16593 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16594 EOM
16595                 echo "# Variables propagated from previous config.sh file." >>config.sh
16596                 for sym in `cat UU/oldsyms`; do
16597                         echo "    Propagating $hint variable "'$'"$sym..."
16598                         eval 'tmp="$'"${sym}"'"'
16599                         echo "$tmp" | \
16600                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16601                 done
16602                 ;;
16603         esac
16604 fi
16605
16606 : Finish up by extracting the .SH files
16607 case "$alldone" in
16608 exit)
16609         $rm -rf UU
16610         echo "Done."
16611         exit 0
16612         ;;
16613 cont)
16614         ;;
16615 '')
16616         dflt=''
16617         nostick=true
16618         $cat <<EOM
16619
16620 If you'd like to make any changes to the config.sh file before I begin
16621 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16622
16623 EOM
16624         rp="Press return or use a shell escape to edit config.sh:"
16625         . UU/myread
16626         nostick=''
16627         case "$ans" in
16628         '') ;;
16629         *) : in case they cannot read
16630                 sh 1>&4 -c "$ans";;
16631         esac
16632         ;;
16633 esac
16634
16635 : if this fails, just run all the .SH files by hand
16636 . ./config.sh
16637
16638 echo " "
16639 exec 1>&4
16640 . ./UU/extract
16641
16642 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16643         dflt=y
16644         case "$silent" in
16645         true) ;;
16646         *)
16647                 $cat <<EOM
16648
16649 Now you need to generate make dependencies by running "$make depend".
16650 You might prefer to run it in background: "$make depend > makedepend.out &"
16651 It can take a while, so you might not want to run it right now.
16652
16653 EOM
16654                 ;;
16655         esac
16656         rp="Run $make depend now?"
16657         . UU/myread
16658         case "$ans" in
16659         y*)
16660                 $make depend && echo "Now you must run '$make'."
16661                 ;;
16662         *)
16663                 echo "You must run '$make depend' then '$make'."
16664                 ;;
16665         esac
16666 elif test -f [Mm]akefile; then
16667         echo " "
16668         echo "Now you must run a $make."
16669 else
16670         echo "Done."
16671 fi
16672
16673 if $test -f Policy.sh; then
16674     $cat <<EOM
16675
16676 If you compile $package on a different machine or from a different object
16677 directory, copy the Policy.sh file from this object directory to the
16678 new one before you run Configure -- this will help you with most of
16679 the policy defaults.
16680
16681 EOM
16682 fi
16683 if $test -f config.msg; then
16684     echo "Hmm.  I also noted the following information while running:"
16685     echo " "
16686     $cat config.msg >&4
16687     $rm -f config.msg
16688 fi
16689 $rm -f kit*isdone ark*isdone
16690 $rm -rf UU
16691
16692 : End of Configure
16693