023df3644c8d92cb37d7055e9bfa514590117e0e
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Fri Jan  5 20:11:52 EET 2001 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 alignbytes=''
277 ansi2knr=''
278 archlib=''
279 archlibexp=''
280 d_archlib=''
281 installarchlib=''
282 archname=''
283 myarchname=''
284 d_atolf=''
285 d_atoll=''
286 baserev=''
287 bin=''
288 binexp=''
289 installbin=''
290 bincompat5005=''
291 d_bincompat5005=''
292 byteorder=''
293 cc=''
294 ccflags=''
295 cppflags=''
296 ldflags=''
297 lkflags=''
298 locincpth=''
299 optimize=''
300 cf_email=''
301 cf_by=''
302 cf_time=''
303 charsize=''
304 contains=''
305 cpp_stuff=''
306 cpplast=''
307 cppminus=''
308 cpprun=''
309 cppstdin=''
310 crosscompile=''
311 d__fwalk=''
312 d_access=''
313 d_accessx=''
314 d_alarm=''
315 d_attribut=''
316 d_bcmp=''
317 d_bcopy=''
318 d_bzero=''
319 d_casti32=''
320 castflags=''
321 d_castneg=''
322 d_chown=''
323 d_chroot=''
324 d_chsize=''
325 d_closedir=''
326 d_void_closedir=''
327 d_const=''
328 cryptlib=''
329 d_crypt=''
330 d_csh=''
331 full_csh=''
332 d_cuserid=''
333 d_dbl_dig=''
334 d_difftime=''
335 d_dlerror=''
336 d_dlopen=''
337 d_dlsymun=''
338 d_dosuid=''
339 d_suidsafe=''
340 d_drand48proto=''
341 d_dup2=''
342 d_eaccess=''
343 d_endgrent=''
344 d_endhent=''
345 d_endnent=''
346 d_endpent=''
347 d_endpwent=''
348 d_endsent=''
349 d_fchmod=''
350 d_fchown=''
351 d_fcntl=''
352 d_fcntl_can_lock=''
353 d_fd_macros=''
354 d_fd_set=''
355 d_fds_bits=''
356 d_fgetpos=''
357 d_flexfnam=''
358 d_flock=''
359 d_fork=''
360 d_fpos64_t=''
361 d_frexpl=''
362 d_fs_data_s=''
363 d_fseeko=''
364 d_fsetpos=''
365 d_fstatfs=''
366 d_fsync=''
367 d_ftello=''
368 d_ftime=''
369 d_gettimeod=''
370 d_Gconvert=''
371 d_getcwd=''
372 d_getespwnam=''
373 d_getfsstat=''
374 d_getgrent=''
375 d_getgrps=''
376 d_gethbyaddr=''
377 d_gethbyname=''
378 d_gethent=''
379 aphostname=''
380 d_gethname=''
381 d_phostname=''
382 d_uname=''
383 d_gethostprotos=''
384 d_getlogin=''
385 d_getmnt=''
386 d_getmntent=''
387 d_getnbyaddr=''
388 d_getnbyname=''
389 d_getnent=''
390 d_getnetprotos=''
391 d_getpagsz=''
392 d_getpent=''
393 d_getpgid=''
394 d_getpgrp2=''
395 d_bsdgetpgrp=''
396 d_getpgrp=''
397 d_getppid=''
398 d_getprior=''
399 d_getpbyname=''
400 d_getpbynumber=''
401 d_getprotoprotos=''
402 d_getprpwnam=''
403 d_getpwent=''
404 d_getsent=''
405 d_getservprotos=''
406 d_getspnam=''
407 d_getsbyname=''
408 d_getsbyport=''
409 d_gnulibc=''
410 d_hasmntopt=''
411 d_htonl=''
412 d_iconv=''
413 d_inetaton=''
414 d_int64_t=''
415 d_isascii=''
416 d_isnan=''
417 d_isnanl=''
418 d_killpg=''
419 d_lchown=''
420 d_ldbl_dig=''
421 d_link=''
422 d_locconv=''
423 d_lockf=''
424 d_longdbl=''
425 longdblsize=''
426 d_longlong=''
427 longlongsize=''
428 d_lseekproto=''
429 d_lstat=''
430 d_madvise=''
431 d_mblen=''
432 d_mbstowcs=''
433 d_mbtowc=''
434 d_memchr=''
435 d_memcmp=''
436 d_memcpy=''
437 d_memmove=''
438 d_memset=''
439 d_mkdir=''
440 d_mkdtemp=''
441 d_mkfifo=''
442 d_mkstemp=''
443 d_mkstemps=''
444 d_mktime=''
445 d_mmap=''
446 mmaptype=''
447 d_modfl=''
448 d_mprotect=''
449 d_msg=''
450 d_msgctl=''
451 d_msgget=''
452 d_msgrcv=''
453 d_msgsnd=''
454 d_msync=''
455 d_munmap=''
456 d_nice=''
457 d_off64_t=''
458 d_open3=''
459 d_fpathconf=''
460 d_pathconf=''
461 d_pause=''
462 d_pipe=''
463 d_poll=''
464 d_portable=''
465 d_old_pthread_create_joinable=''
466 old_pthread_create_joinable=''
467 d_pthread_yield=''
468 d_sched_yield=''
469 sched_yield=''
470 d_qgcvt=''
471 d_readdir=''
472 d_rewinddir=''
473 d_seekdir=''
474 d_telldir=''
475 d_readlink=''
476 d_rename=''
477 d_rmdir=''
478 d_safebcpy=''
479 d_safemcpy=''
480 d_sanemcmp=''
481 d_sbrkproto=''
482 d_select=''
483 d_sem=''
484 d_semctl=''
485 d_semget=''
486 d_semop=''
487 d_setegid=''
488 d_seteuid=''
489 d_setgrent=''
490 d_setgrps=''
491 d_sethent=''
492 d_setlinebuf=''
493 d_setlocale=''
494 d_setnent=''
495 d_setpent=''
496 d_setpgid=''
497 d_setpgrp2=''
498 d_bsdsetpgrp=''
499 d_setpgrp=''
500 d_setprior=''
501 d_setproctitle=''
502 d_setpwent=''
503 d_setregid=''
504 d_setresgid=''
505 d_setresuid=''
506 d_setreuid=''
507 d_setrgid=''
508 d_setruid=''
509 d_setsent=''
510 d_setsid=''
511 d_setvbuf=''
512 d_sfio=''
513 usesfio=''
514 d_shm=''
515 d_shmat=''
516 d_shmatprototype=''
517 shmattype=''
518 d_shmctl=''
519 d_shmdt=''
520 d_shmget=''
521 d_sigaction=''
522 d_sigsetjmp=''
523 d_msg_ctrunc=''
524 d_msg_dontroute=''
525 d_msg_oob=''
526 d_msg_peek=''
527 d_msg_proxy=''
528 d_oldsock=''
529 d_scm_rights=''
530 d_socket=''
531 d_sockpair=''
532 sockethdr=''
533 socketlib=''
534 d_socklen_t=''
535 d_socks5_init=''
536 d_sqrtl=''
537 d_statblks=''
538 d_statfs_f_flags=''
539 d_statfs_s=''
540 d_fstatvfs=''
541 d_statvfs=''
542 d_stdio_cnt_lval=''
543 d_stdio_ptr_lval=''
544 d_stdio_ptr_lval_nochange_cnt=''
545 d_stdio_ptr_lval_sets_cnt=''
546 d_stdiobase=''
547 d_stdstdio=''
548 stdio_base=''
549 stdio_bufsiz=''
550 stdio_cnt=''
551 stdio_filbuf=''
552 stdio_ptr=''
553 d_index=''
554 d_strchr=''
555 d_strcoll=''
556 d_strctcpy=''
557 d_strerrm=''
558 d_strerror=''
559 d_sysernlst=''
560 d_syserrlst=''
561 d_strtod=''
562 d_strtol=''
563 d_strtold=''
564 d_strtoll=''
565 d_strtoq=''
566 d_strtoul=''
567 d_strtoull=''
568 d_strtouq=''
569 d_strxfrm=''
570 d_symlink=''
571 d_syscall=''
572 d_sysconf=''
573 d_system=''
574 d_tcgetpgrp=''
575 d_tcsetpgrp=''
576 d_telldirproto=''
577 d_time=''
578 timetype=''
579 clocktype=''
580 d_times=''
581 d_truncate=''
582 d_tzname=''
583 d_umask=''
584 d_semctl_semid_ds=''
585 d_semctl_semun=''
586 d_union_semun=''
587 d_ustat=''
588 d_vfork=''
589 usevfork=''
590 d_voidsig=''
591 signal_t=''
592 d_volatile=''
593 d_charvspr=''
594 d_vprintf=''
595 d_wait4=''
596 d_waitpid=''
597 d_wcstombs=''
598 d_wctomb=''
599 dlext=''
600 cccdlflags=''
601 ccdlflags=''
602 dlsrc=''
603 ld=''
604 lddlflags=''
605 usedl=''
606 doublesize=''
607 ebcdic=''
608 fflushNULL=''
609 fflushall=''
610 fpossize=''
611 fpostype=''
612 gccosandvers=''
613 gccversion=''
614 gidformat=''
615 gidsign=''
616 gidsize=''
617 gidtype=''
618 groupstype=''
619 h_fcntl=''
620 h_sysfile=''
621 i_arpainet=''
622 db_hashtype=''
623 db_prefixtype=''
624 i_db=''
625 i_dbm=''
626 i_rpcsvcdbm=''
627 d_dirnamlen=''
628 direntrytype=''
629 i_dirent=''
630 i_dld=''
631 i_dlfcn=''
632 i_fcntl=''
633 i_float=''
634 i_gdbm=''
635 d_grpasswd=''
636 i_grp=''
637 i_iconv=''
638 i_ieeefp=''
639 i_inttypes=''
640 i_libutil=''
641 i_limits=''
642 i_locale=''
643 i_machcthr=''
644 i_malloc=''
645 i_math=''
646 i_memory=''
647 i_mntent=''
648 i_ndbm=''
649 i_netdb=''
650 i_neterrno=''
651 i_netinettcp=''
652 i_niin=''
653 i_sysin=''
654 i_poll=''
655 i_prot=''
656 i_pthread=''
657 d_pwage=''
658 d_pwchange=''
659 d_pwclass=''
660 d_pwcomment=''
661 d_pwexpire=''
662 d_pwgecos=''
663 d_pwpasswd=''
664 d_pwquota=''
665 i_pwd=''
666 i_sfio=''
667 i_shadow=''
668 i_socks=''
669 i_stddef=''
670 i_stdlib=''
671 i_string=''
672 strings=''
673 i_sunmath=''
674 i_sysaccess=''
675 i_sysdir=''
676 i_sysfile=''
677 d_voidtty=''
678 i_bsdioctl=''
679 i_sysfilio=''
680 i_sysioctl=''
681 i_syssockio=''
682 i_syslog=''
683 i_sysmman=''
684 i_sysmode=''
685 i_sysmount=''
686 i_sysndir=''
687 i_sysparam=''
688 i_sysresrc=''
689 i_syssecrt=''
690 i_sysselct=''
691 i_sysstat=''
692 i_sysstatfs=''
693 i_sysstatvfs=''
694 i_systimes=''
695 i_systypes=''
696 i_sysuio=''
697 i_sysun=''
698 i_sysutsname=''
699 i_sysvfs=''
700 i_syswait=''
701 i_sgtty=''
702 i_termio=''
703 i_termios=''
704 i_systime=''
705 i_systimek=''
706 i_time=''
707 timeincl=''
708 i_unistd=''
709 i_ustat=''
710 i_utime=''
711 i_values=''
712 i_stdarg=''
713 i_varargs=''
714 i_varhdr=''
715 i_vfork=''
716 inc_version_list=''
717 inc_version_list_init=''
718 installprefix=''
719 installprefixexp=''
720 installstyle=''
721 installusrbinperl=''
722 intsize=''
723 longsize=''
724 shortsize=''
725 issymlink=''
726 libc=''
727 ldlibpthname=''
728 libperl=''
729 shrpenv=''
730 useshrplib=''
731 glibpth=''
732 libpth=''
733 loclibpth=''
734 plibpth=''
735 xlibpth=''
736 ignore_versioned_solibs=''
737 libs=''
738 libsdirs=''
739 libsfiles=''
740 libsfound=''
741 libspath=''
742 lns=''
743 d_PRIEUldbl=''
744 d_PRIFUldbl=''
745 d_PRIGUldbl=''
746 d_PRIeldbl=''
747 d_PRIfldbl=''
748 d_PRIgldbl=''
749 d_SCNfldbl=''
750 sPRIEUldbl=''
751 sPRIFUldbl=''
752 sPRIGUldbl=''
753 sPRIeldbl=''
754 sPRIfldbl=''
755 sPRIgldbl=''
756 sSCNfldbl=''
757 lseeksize=''
758 lseektype=''
759 make_set_make=''
760 d_mymalloc=''
761 freetype=''
762 mallocobj=''
763 mallocsrc=''
764 malloctype=''
765 usemymalloc=''
766 installman1dir=''
767 man1dir=''
768 man1direxp=''
769 man1ext=''
770 installman3dir=''
771 man3dir=''
772 man3direxp=''
773 man3ext=''
774 modetype=''
775 multiarch=''
776 mydomain=''
777 myhostname=''
778 phostname=''
779 c=''
780 n=''
781 d_eofnblk=''
782 eagain=''
783 o_nonblock=''
784 rd_nodata=''
785 need_va_copy=''
786 netdb_hlen_type=''
787 netdb_host_type=''
788 netdb_name_type=''
789 netdb_net_type=''
790 groupcat=''
791 hostcat=''
792 passcat=''
793 orderlib=''
794 ranlib=''
795 d_perl_otherlibdirs=''
796 otherlibdirs=''
797 package=''
798 spackage=''
799 pager=''
800 api_revision=''
801 api_subversion=''
802 api_version=''
803 api_versionstring=''
804 patchlevel=''
805 revision=''
806 subversion=''
807 version=''
808 perl5=''
809 perladmin=''
810 perlpath=''
811 d_nv_preserves_uv=''
812 d_nv_preserves_uv_bits=''
813 i16size=''
814 i16type=''
815 i32size=''
816 i32type=''
817 i64size=''
818 i64type=''
819 i8size=''
820 i8type=''
821 ivsize=''
822 ivtype=''
823 nvsize=''
824 nvtype=''
825 u16size=''
826 u16type=''
827 u32size=''
828 u32type=''
829 u64size=''
830 u64type=''
831 u8size=''
832 u8type=''
833 uvsize=''
834 uvtype=''
835 ivdformat=''
836 nvEUformat=''
837 nvFUformat=''
838 nvGUformat=''
839 nveformat=''
840 nvfformat=''
841 nvgformat=''
842 uvXUformat=''
843 uvoformat=''
844 uvuformat=''
845 uvxformat=''
846 pidtype=''
847 prefix=''
848 prefixexp=''
849 installprivlib=''
850 privlib=''
851 privlibexp=''
852 prototype=''
853 ptrsize=''
854 d_PRIXU64=''
855 d_PRId64=''
856 d_PRIi64=''
857 d_PRIo64=''
858 d_PRIu64=''
859 d_PRIx64=''
860 sPRIXU64=''
861 sPRId64=''
862 sPRIi64=''
863 sPRIo64=''
864 sPRIu64=''
865 sPRIx64=''
866 d_quad=''
867 quadkind=''
868 quadtype=''
869 uquadtype=''
870 drand01=''
871 randbits=''
872 randfunc=''
873 randseedtype=''
874 seedfunc=''
875 installscript=''
876 scriptdir=''
877 scriptdirexp=''
878 selectminbits=''
879 selecttype=''
880 sh=''
881 sig_count=''
882 sig_name=''
883 sig_name_init=''
884 sig_num=''
885 sig_num_init=''
886 installsitearch=''
887 sitearch=''
888 sitearchexp=''
889 installsitebin=''
890 sitebin=''
891 sitebinexp=''
892 installsitelib=''
893 sitelib=''
894 sitelib_stem=''
895 sitelibexp=''
896 siteprefix=''
897 siteprefixexp=''
898 sizesize=''
899 sizetype=''
900 so=''
901 socksizetype=''
902 sharpbang=''
903 shsharp=''
904 spitshell=''
905 src=''
906 ssizetype=''
907 startperl=''
908 startsh=''
909 stdchar=''
910 d_stdio_stream_array=''
911 stdio_stream_array=''
912 sysman=''
913 trnl=''
914 uidformat=''
915 uidsign=''
916 uidsize=''
917 uidtype=''
918 archname64=''
919 use64bitall=''
920 use64bitint=''
921 ccflags_uselargefiles=''
922 ldflags_uselargefiles=''
923 libswanted_uselargefiles=''
924 uselargefiles=''
925 uselongdouble=''
926 usemorebits=''
927 usemultiplicity=''
928 nm_opt=''
929 nm_so_opt=''
930 runnm=''
931 usenm=''
932 useperlio=''
933 usesocks=''
934 d_oldpthreads=''
935 use5005threads=''
936 useithreads=''
937 usethreads=''
938 incpath=''
939 mips_type=''
940 usrinc=''
941 d_vendorarch=''
942 installvendorarch=''
943 vendorarch=''
944 vendorarchexp=''
945 d_vendorbin=''
946 installvendorbin=''
947 vendorbin=''
948 vendorbinexp=''
949 d_vendorlib=''
950 installvendorlib=''
951 vendorlib=''
952 vendorlib_stem=''
953 vendorlibexp=''
954 usevendorprefix=''
955 vendorprefix=''
956 vendorprefixexp=''
957 versiononly=''
958 defvoidused=''
959 voidflags=''
960 pm_apiversion=''
961 xs_apiversion=''
962 CONFIG=''
963
964 define='define'
965 undef='undef'
966 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
967 rmlist=''
968
969 : We must find out about Eunice early
970 eunicefix=':'
971 if test -f /etc/unixtovms; then
972         eunicefix=/etc/unixtovms
973 fi
974 if test -f /etc/unixtovms.exe; then
975         eunicefix=/etc/unixtovms.exe
976 fi
977
978 i_whoami=''
979 ccname=''
980 ccversion=''
981 perllibs=''
982 : set useposix=false in your hint file to disable the POSIX extension.
983 useposix=true
984 : set useopcode=false in your hint file to disable the Opcode extension.
985 useopcode=true
986 : Trailing extension.  Override this in a hint file, if needed.
987 _exe=''
988 : Extra object files, if any, needed on this platform.
989 archobjs=''
990 archname=''
991 : Possible local include directories to search.
992 : Set locincpth to "" in a hint file to defeat local include searches.
993 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
994 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
995 :
996 : no include file wanted by default
997 inclwanted=''
998
999 groupstype=''
1000 : change the next line if compiling for Xenix/286 on Xenix/386
1001 xlibpth='/usr/lib/386 /lib/386'
1002 : Possible local library directories to search.
1003 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1004 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1005
1006 : general looking path for locating libraries
1007 glibpth="/lib /usr/lib $xlibpth"
1008 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1009 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1010 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1011
1012 : Private path used by Configure to find libraries.  Its value
1013 : is prepended to libpth. This variable takes care of special
1014 : machines, like the mips.  Usually, it should be empty.
1015 plibpth=''
1016
1017 : default library list
1018 libswanted=''
1019 : some systems want to use only the non-versioned libso:s
1020 ignore_versioned_solibs=''
1021 archname64=''
1022 ccflags_uselargefiles=''
1023 ldflags_uselargefiles=''
1024 libswanted_uselargefiles=''
1025 : set usemultiplicity on the Configure command line to enable multiplicity.
1026 : set usesocks on the Configure command line to enable socks.
1027 : set usethreads on the Configure command line to enable threads.
1028 : full support for void wanted by default
1029 defvoidused=15
1030
1031 : List of libraries we want.
1032 : If anyone needs -lnet, put it in a hint file.
1033 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1034 libswanted="$libswanted dld ld sun m c cposix posix"
1035 libswanted="$libswanted ndir dir crypt sec"
1036 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1037 : We probably want to search /usr/shlib before most other libraries.
1038 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1039 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1040 glibpth="/usr/shlib $glibpth"
1041 : Do not use vfork unless overridden by a hint file.
1042 usevfork=false
1043
1044 : Find the basic shell for Bourne shell scripts
1045 case "$sh" in
1046 '')
1047         case "$SYSTYPE" in
1048         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1049         *) xxx='/bin/sh';;
1050         esac
1051         if test -f "$xxx"; then
1052                 sh="$xxx"
1053         else
1054                 : Build up a list and do a single loop so we can 'break' out.
1055                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1056                 for xxx in sh bash ksh pdksh ash; do
1057                         for p in $pth; do
1058                                 try="$try ${p}/${xxx}"
1059                         done
1060                 done
1061                 for xxx in $try; do
1062                         if test -f "$xxx"; then
1063                                 sh="$xxx";
1064                                 break
1065                         elif test -f "$xxx.exe"; then
1066                                 sh="$xxx";
1067                                 break
1068                         fi
1069                 done
1070         fi
1071         ;;
1072 esac
1073
1074 case "$sh" in
1075 '')     cat <<EOM >&2
1076 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1077
1078 Usually it's in /bin/sh.  How did you even get this far?
1079 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1080 we'll try to straighten this all out.
1081 EOM
1082         exit 1
1083         ;;
1084 esac
1085
1086 : see if sh knows # comments
1087 if `$sh -c '#' >/dev/null 2>&1`; then
1088         shsharp=true
1089         spitshell=cat
1090         xcat=/bin/cat
1091         test -f $xcat || xcat=/usr/bin/cat
1092         echo "#!$xcat" >try
1093         $eunicefix try
1094         chmod +x try
1095         ./try > today
1096         if test -s today; then
1097                 sharpbang='#!'
1098         else
1099                 echo "#! $xcat" > try
1100                 $eunicefix try
1101                 chmod +x try
1102                 ./try > today
1103                 if test -s today; then
1104                         sharpbang='#! '
1105                 else
1106                         sharpbang=': use '
1107                 fi
1108         fi
1109 else
1110         echo " "
1111         echo "Your $sh doesn't grok # comments--I will strip them later on."
1112         shsharp=false
1113         cd ..
1114         echo "exec grep -v '^[  ]*#'" >spitshell
1115         chmod +x spitshell
1116         $eunicefix spitshell
1117         spitshell=`pwd`/spitshell
1118         cd UU
1119         echo "I presume that if # doesn't work, #! won't work either!"
1120         sharpbang=': use '
1121 fi
1122 rm -f try today
1123
1124 : figure out how to guarantee sh startup
1125 case "$startsh" in
1126 '') startsh=${sharpbang}${sh} ;;
1127 *)
1128 esac
1129 cat >try <<EOSS
1130 $startsh
1131 set abc
1132 test "$?abc" != 1
1133 EOSS
1134
1135 chmod +x try
1136 $eunicefix try
1137 if ./try; then
1138         : echo "Yup, it does."
1139 else
1140         echo "Hmm... '$startsh' does not guarantee sh startup..."
1141         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1142 fi
1143 rm -f try
1144
1145
1146 : Save command line options in file UU/cmdline.opt for later use in
1147 : generating config.sh.
1148 cat > cmdline.opt <<EOSH
1149 # Configure command line arguments.
1150 config_arg0='$0'
1151 config_args='$*'
1152 config_argc=$#
1153 EOSH
1154 argn=1
1155 for arg in "$@"; do
1156         cat >>cmdline.opt <<EOSH
1157 config_arg$argn='$arg'
1158 EOSH
1159         argn=`expr $argn + 1`
1160 done
1161
1162 : produce awk script to parse command line options
1163 cat >options.awk <<'EOF'
1164 BEGIN {
1165         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1166
1167         len = length(optstr);
1168         for (i = 1; i <= len; i++) {
1169                 c = substr(optstr, i, 1);
1170                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1171                 if (a == ":") {
1172                         arg[c] = 1;
1173                         i++;
1174                 }
1175                 opt[c] = 1;
1176         }
1177 }
1178 {
1179         expect = 0;
1180         str = $0;
1181         if (substr(str, 1, 1) != "-") {
1182                 printf("'%s'\n", str);
1183                 next;
1184         }
1185         len = length($0);
1186         for (i = 2; i <= len; i++) {
1187                 c = substr(str, i, 1);
1188                 if (!opt[c]) {
1189                         printf("-%s\n", substr(str, i));
1190                         next;
1191                 }
1192                 printf("-%s\n", c);
1193                 if (arg[c]) {
1194                         if (i < len)
1195                                 printf("'%s'\n", substr(str, i + 1));
1196                         else
1197                                 expect = 1;
1198                         next;
1199                 }
1200         }
1201 }
1202 END {
1203         if (expect)
1204                 print "?";
1205 }
1206 EOF
1207
1208 : process the command line options
1209 set X `for arg in "$@"; do echo "X$arg"; done |
1210         sed -e s/X// | awk -f options.awk`
1211 eval "set $*"
1212 shift
1213 rm -f options.awk
1214
1215 : set up default values
1216 fastread=''
1217 reuseval=false
1218 config_sh=''
1219 alldone=''
1220 error=''
1221 silent=''
1222 extractsh=''
1223 override=''
1224 knowitall=''
1225 rm -f optdef.sh posthint.sh
1226 cat >optdef.sh <<EOS
1227 $startsh
1228 EOS
1229
1230
1231 : option parsing
1232 while test $# -gt 0; do
1233         case "$1" in
1234         -d) shift; fastread=yes;;
1235         -e) shift; alldone=cont;;
1236         -f)
1237                 shift
1238                 cd ..
1239                 if test -r "$1"; then
1240                         config_sh="$1"
1241                 else
1242                         echo "$me: cannot read config file $1." >&2
1243                         error=true
1244                 fi
1245                 cd UU
1246                 shift;;
1247         -h) shift; error=true;;
1248         -r) shift; reuseval=true;;
1249         -s) shift; silent=true; realsilent=true;;
1250         -E) shift; alldone=exit;;
1251         -K) shift; knowitall=true;;
1252         -O) shift; override=true;;
1253         -S) shift; silent=true; extractsh=true;;
1254         -D)
1255                 shift
1256                 case "$1" in
1257                 *=)
1258                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1259                         echo "$me: ignoring -D $1" >&2
1260                         ;;
1261                 *=*) echo "$1" | \
1262                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1263                 *) echo "$1='define'" >> optdef.sh;;
1264                 esac
1265                 shift
1266                 ;;
1267         -U)
1268                 shift
1269                 case "$1" in
1270                 *=) echo "$1" >> optdef.sh;;
1271                 *=*)
1272                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1273                         echo "$me: ignoring -U $1" >&2
1274                         ;;
1275                 *) echo "$1='undef'" >> optdef.sh;;
1276                 esac
1277                 shift
1278                 ;;
1279         -A)
1280             shift
1281             xxx=''
1282             yyy="$1"
1283             zzz=''
1284             uuu=undef
1285             case "$yyy" in
1286             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1287                  case "$zzz" in
1288                  *:*) zzz='' ;;
1289                  *)   xxx=append
1290                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1291                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1292                  esac
1293                  ;;
1294             esac
1295             case "$xxx" in
1296             '')  case "$yyy" in
1297                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1298                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1299                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1300                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1301                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1302                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1303                  esac
1304                  ;;       
1305             esac
1306             case "$xxx" in
1307             append)
1308                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1309             clear)
1310                 echo "$yyy=''"                  >> posthint.sh ;;
1311             define)
1312                 case "$zzz" in
1313                 '') zzz=define ;;
1314                 esac
1315                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1316             eval)
1317                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1318             prepend)
1319                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1320             undef)
1321                 case "$zzz" in
1322                 '') zzz="$uuu" ;;
1323                 esac
1324                 echo "$yyy=$zzz"                >> posthint.sh ;;
1325             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1326             esac
1327             shift
1328             ;;
1329         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1330             exit 0;;
1331         --) break;;
1332         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1333         *) break;;
1334         esac
1335 done
1336
1337 case "$error" in
1338 true)
1339         cat >&2 <<EOM
1340 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1341                  [-U symbol] [-U symbol=] [-A command:symbol...]
1342   -d : use defaults for all answers.
1343   -e : go on without questioning past the production of config.sh.
1344   -f : specify an alternate default configuration file.
1345   -h : print this help message and exit (with an error status).
1346   -r : reuse C symbols value if possible (skips costly nm extraction).
1347   -s : silent mode, only echoes questions and essential information.
1348   -D : define symbol to have some value:
1349          -D symbol         symbol gets the value 'define'
1350          -D symbol=value   symbol gets the value 'value'
1351   -E : stop at the end of questions, after having produced config.sh.
1352   -K : do not use unless you know what you are doing.
1353   -O : let -D and -U override definitions from loaded configuration file.
1354   -S : perform variable substitutions on all .SH files (can mix with -f)
1355   -U : undefine symbol:
1356          -U symbol    symbol gets the value 'undef'
1357          -U symbol=   symbol gets completely empty
1358   -A : manipulate symbol after the platform specific hints have been applied:
1359          -A symbol=value                append " "value to symbol
1360          -A append:symbol=value         append value to symbol
1361          -A define:symbol=value         define symbol to have value
1362          -A clear:symbol                define symbol to be ''
1363          -A define:symbol               define symbol to be 'define'
1364          -A eval:symbol=value           define symbol to be eval of value
1365          -A prepend:symbol=value        prepend value to symbol
1366          -A undef:symbol                define symbol to be 'undef'
1367          -A undef:symbol=               define symbol to be ''
1368   -V : print version number and exit (with a zero status).
1369 EOM
1370         exit 1
1371         ;;
1372 esac
1373
1374 : Sanity checks
1375 case "$fastread$alldone" in
1376 yescont|yesexit) ;;
1377 *)
1378         case "$extractsh" in
1379         true) ;;
1380         *)
1381                 if test ! -t 0; then
1382                         echo "Say 'sh Configure', not 'sh <Configure'"
1383                         exit 1
1384                 fi
1385                 ;;
1386         esac
1387         ;;
1388 esac
1389
1390 exec 4>&1
1391 case "$silent" in
1392 true) exec 1>/dev/null;;
1393 esac
1394
1395 : run the defines and the undefines, if any, but leave the file out there...
1396 touch optdef.sh
1397 . ./optdef.sh
1398 : create the posthint manipulation script and leave the file out there...
1399 touch posthint.sh
1400
1401 : set package name
1402 package=perl5
1403 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1404 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1405 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1406 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1407 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1408 esac
1409
1410 : Some greps do not return status, grrr.
1411 echo "grimblepritz" >grimble
1412 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1413         contains=contains
1414 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1415         contains=grep
1416 else
1417         contains=contains
1418 fi
1419 rm -f grimble
1420 : the following should work in any shell
1421 case "$contains" in
1422 contains*)
1423         echo " "
1424         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1425         cat >contains <<'EOSS'
1426 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1427 EOSS
1428 chmod +x contains
1429 esac
1430
1431 : Find the path to the source tree
1432 case "$src" in
1433 '') case "$0" in
1434     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1435          case "$src" in
1436          /*)    ;;
1437          .)     ;;
1438          *)     src=`cd ../$src && pwd` ;;
1439          esac
1440          ;;
1441     *)   src='.';;
1442     esac;;
1443 esac
1444 case "$src" in
1445 '')     src=/
1446         rsrc=/
1447         ;;
1448 /*) rsrc="$src";;
1449 *) rsrc="../$src";;
1450 esac
1451 if test -f $rsrc/Configure && \
1452         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1453 then
1454    : found it, so we are ok.
1455 else
1456         rsrc=''
1457         for src in . .. ../.. ../../.. ../../../..; do
1458                 if test -f ../$src/Configure && \
1459                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1460                 then
1461                         rsrc=../$src
1462                         break
1463                 fi
1464         done
1465 fi
1466 case "$rsrc" in
1467 '')
1468         cat <<EOM >&4
1469
1470 Sorry, I can't seem to locate the source dir for $package.  Please start
1471 Configure with an explicit path -- i.e. /some/path/Configure.
1472
1473 EOM
1474         exit 1
1475         ;;
1476 ../.)   rsrc='..';;
1477 *)
1478         echo " "
1479         echo "Sources for $package found in \"$src\"." >&4
1480         ;;
1481 esac
1482
1483 : script used to extract .SH files with variable substitutions
1484 cat >extract <<'EOS'
1485 CONFIGDOTSH=true
1486 echo "Doing variable substitutions on .SH files..."
1487 if test -f $src/MANIFEST; then
1488         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1489 else
1490         echo "(Looking for .SH files under the source directory.)"
1491         set x `(cd $src; find . -name "*.SH" -print)`
1492 fi
1493 shift
1494 case $# in
1495 0) set x `(cd $src; echo *.SH)`; shift;;
1496 esac
1497 if test ! -f $src/$1; then
1498         shift
1499 fi
1500 mkdir_p='
1501 name=$1;
1502 create="";
1503 while test $name; do
1504         if test ! -d "$name"; then
1505                 create="$name $create";
1506                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1507                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1508         else
1509                 name="";
1510         fi;
1511 done;
1512 for file in $create; do
1513         mkdir $file;
1514 done
1515 '
1516 for file in $*; do
1517         case "$src" in
1518         ".")
1519                 case "$file" in
1520                 */*)
1521                         dir=`expr X$file : 'X\(.*\)/'`
1522                         file=`expr X$file : 'X.*/\(.*\)'`
1523                         (cd $dir && . ./$file)
1524                         ;;
1525                 *)
1526                         . ./$file
1527                         ;;
1528                 esac
1529                 ;;
1530         *)
1531                 case "$file" in
1532                 */*)
1533                         dir=`expr X$file : 'X\(.*\)/'`
1534                         file=`expr X$file : 'X.*/\(.*\)'`
1535                         (set x $dir; shift; eval $mkdir_p)
1536                         sh <$src/$dir/$file
1537                         ;;
1538                 *)
1539                         sh <$src/$file
1540                         ;;
1541                 esac
1542                 ;;
1543         esac
1544 done
1545 if test -f $src/config_h.SH; then
1546         if test ! -f config.h; then
1547         : oops, they left it out of MANIFEST, probably, so do it anyway.
1548         . $src/config_h.SH
1549         fi
1550 fi
1551 EOS
1552
1553 : extract files and exit if asked to do so
1554 case "$extractsh" in
1555 true)
1556         case "$realsilent" in
1557         true) ;;
1558         *) exec 1>&4;;
1559         esac
1560         case "$config_sh" in
1561         '') config_sh='config.sh';;
1562         esac
1563         echo " "
1564         echo "Fetching answers from $config_sh..."
1565         cd ..
1566         . $config_sh
1567         test "$override" && . ./optdef.sh
1568         echo " "
1569         . UU/extract
1570         rm -rf UU
1571         echo "Done."
1572         exit 0
1573         ;;
1574 esac
1575
1576 : Eunice requires " " instead of "", can you believe it
1577 echo " "
1578 : Here we go...
1579 echo "Beginning of configuration questions for $package."
1580
1581 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1582
1583 : first determine how to suppress newline on echo command
1584 echo " "
1585 echo "Checking echo to see how to suppress newlines..."
1586 (echo "hi there\c" ; echo " ") >.echotmp
1587 if $contains c .echotmp >/dev/null 2>&1 ; then
1588         echo "...using -n."
1589         n='-n'
1590         c=''
1591 else
1592         cat <<'EOM'
1593 ...using \c
1594 EOM
1595         n=''
1596         c='\c'
1597 fi
1598 echo $n "The star should be here-->$c"
1599 echo '*'
1600 rm -f .echotmp
1601
1602 : Now test for existence of everything in MANIFEST
1603 echo " "
1604 if test -f $rsrc/MANIFEST; then
1605         echo "First let's make sure your kit is complete.  Checking..." >&4
1606         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1607         rm -f missing
1608         tmppwd=`pwd`
1609         for filelist in x??; do
1610                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1611         done
1612         if test -s missing; then
1613                 cat missing >&4
1614                 cat >&4 <<'EOM'
1615
1616 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1617
1618 You have the option of continuing the configuration process, despite the
1619 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1620 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1621 and contact the author (perlbug@perl.org).
1622
1623 EOM
1624                 echo $n "Continue? [n] $c" >&4
1625                 read ans
1626                 case "$ans" in
1627                 y*)
1628                         echo "Continuing..." >&4
1629                         rm -f missing
1630                         ;;
1631                 *)
1632                         echo "ABORTING..." >&4
1633                         kill $$
1634                         ;;
1635                 esac
1636         else
1637                 echo "Looks good..."
1638         fi
1639 else
1640         echo "There is no MANIFEST file.  I hope your kit is complete !"
1641 fi
1642 rm -f missing x??
1643
1644 echo " "
1645 : Find the appropriate value for a newline for tr
1646 if test -n "$DJGPP"; then
1647        trnl='\012'
1648 fi
1649 if test X"$trnl" = X; then
1650         case "`echo foo|tr '\n' x 2>/dev/null`" in
1651         foox) trnl='\n' ;;
1652         esac
1653 fi
1654 if test X"$trnl" = X; then
1655         case "`echo foo|tr '\012' x 2>/dev/null`" in
1656         foox) trnl='\012' ;;
1657         esac
1658 fi
1659 if test X"$trnl" = X; then
1660         cat <<EOM >&2
1661
1662 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1663
1664 EOM
1665         exit 1
1666 fi
1667
1668 : compute the number of columns on the terminal for proper question formatting
1669 case "$COLUMNS" in
1670 '') COLUMNS='80';;
1671 esac
1672
1673 : set up the echo used in my read
1674 myecho="case \"\$xxxm\" in
1675 '') echo $n \"\$rp $c\" >&4;;
1676 *) case \"\$rp\" in
1677         '') echo $n \"[\$xxxm] $c\";;
1678         *)
1679                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1680                         echo \"\$rp\" >&4
1681                         echo $n \"[\$xxxm] $c\" >&4
1682                 else
1683                         echo $n \"\$rp [\$xxxm] $c\" >&4
1684                 fi
1685                 ;;
1686         esac;;
1687 esac"
1688
1689 : now set up to do reads with possible shell escape and default assignment
1690 cat <<EOSC >myread
1691 $startsh
1692 xxxm=\$dflt
1693 $myecho
1694 ans='!'
1695 case "\$fastread" in
1696 yes) case "\$dflt" in
1697         '') ;;
1698         *) ans='';
1699                 case "\$silent-\$rp" in
1700                 true-) ;;
1701                 *) echo " " >&4;;
1702                 esac;;
1703         esac;;
1704 *) case "\$silent" in
1705         true) case "\$rp" in
1706                 '') ans='';;
1707                 esac;;
1708         esac;;
1709 esac
1710 while expr "X\$ans" : "X!" >/dev/null; do
1711         read answ
1712         set x \$xxxm
1713         shift
1714         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1715         case  "\$answ" in
1716         "!")
1717                 sh 1>&4
1718                 echo " "
1719                 $myecho
1720                 ;;
1721         !*)
1722                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1723                 shift
1724                 sh 1>&4 -c "\$*"
1725                 echo " "
1726                 $myecho
1727                 ;;
1728         "\$ans")
1729                 case "\$ans" in
1730                 \\&*)
1731                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1732                         shift
1733                         case "\$1" in
1734                         -d)
1735                                 fastread=yes
1736                                 echo "(OK, I'll run with -d after this question.)" >&4
1737                                 ;;
1738                         -*)
1739                                 echo "*** Sorry, \$1 not supported yet." >&4
1740                                 ;;
1741                         esac
1742                         $myecho
1743                         ans=!
1744                         ;;
1745                 esac;;
1746         *)
1747                 case "\$aok" in
1748                 y)
1749                         echo "*** Substitution done -- please confirm."
1750                         xxxm="\$ans"
1751                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1752                         xxxm="\$ans"
1753                         ans=!
1754                         ;;
1755                 *)
1756                         echo "*** Error -- try again."
1757                         ans=!
1758                         ;;
1759                 esac
1760                 $myecho
1761                 ;;
1762         esac
1763         case "\$ans\$xxxm\$nostick" in
1764         '')
1765                 ans=!
1766                 $myecho
1767                 ;;
1768         esac
1769 done
1770 case "\$ans" in
1771 '') ans="\$xxxm";;
1772 esac
1773 EOSC
1774
1775 : create .config dir to save info across Configure sessions
1776 test -d ../.config || mkdir ../.config
1777 cat >../.config/README <<EOF
1778 This directory created by Configure to save information that should
1779 persist across sessions for $package.
1780
1781 You may safely delete it if you wish.
1782 EOF
1783
1784 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1785 case "$usedevel" in
1786 $define|true|[yY]*) ;;
1787 *) case "$xversion" in
1788    *[13579])
1789         cat >&4 <<EOH
1790 *** WHOA THERE!!! ***
1791
1792     This is an UNSTABLE DEVELOPMENT release.
1793     The version of this $package distribution is $xversion, that is, odd,
1794     (as opposed to even) and that signifies a development release.
1795     If you want a maintenance release, you want an even-numbered version.
1796
1797     Do ***NOT*** install this into production use.
1798     Data corruption and crashes are possible.
1799
1800     It is most seriously suggested that you do not continue any further
1801     unless you want to help in developing and debugging Perl.
1802
1803 EOH
1804         rp='Do you really want to continue?'
1805         dflt='n'
1806         . ./myread
1807         case "$ans" in
1808         [yY]) echo >&4 "Okay, continuing." ;;
1809         *) echo >&4 "Okay, bye."
1810            exit 1
1811            ;;
1812         esac
1813         ;;
1814     esac
1815     ;;
1816 esac
1817
1818 : general instructions
1819 needman=true
1820 firsttime=true
1821 user=`(logname) 2>/dev/null`
1822 case "$user" in
1823 '') user=`whoami 2>&1`;;
1824 esac
1825 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1826         firsttime=false
1827         echo " "
1828         rp='Would you like to see the instructions?'
1829         dflt=n
1830         . ./myread
1831         case "$ans" in
1832         [yY]*) ;;
1833         *) needman=false;;
1834         esac
1835 fi
1836 if $needman; then
1837         cat <<EOH
1838
1839 This installation shell script will examine your system and ask you questions
1840 to determine how the perl5 package should be installed. If you get
1841 stuck on a question, you may use a ! shell escape to start a subshell or
1842 execute a command.  Many of the questions will have default answers in square
1843 brackets; typing carriage return will give you the default.
1844
1845 On some of the questions which ask for file or directory names you are allowed
1846 to use the ~name construct to specify the login directory belonging to "name",
1847 even if you don't have a shell which knows about that.  Questions where this is
1848 allowed will be marked "(~name ok)".
1849
1850 EOH
1851         rp=''
1852         dflt='Type carriage return to continue'
1853         . ./myread
1854         cat <<'EOH'
1855
1856 The prompter used in this script allows you to use shell variables and
1857 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1858 in the default answer, as if the default line was a set of arguments given to a
1859 script shell.  This means you may also use $* to repeat the whole default line,
1860 so you do not have to re-type everything to add something to the default.
1861
1862 Everytime there is a substitution, you will have to confirm.  If there is an
1863 error (e.g. an unmatched backtick), the default answer will remain unchanged
1864 and you will be prompted again.
1865
1866 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1867 the questions and use the computed defaults (or the previous answers if there
1868 was already a config.sh file). Type 'Configure -h' for a list of options.
1869 You may also start interactively and then answer '& -d' at any prompt to turn
1870 on the non-interactive behaviour for the remainder of the execution.
1871
1872 EOH
1873         . ./myread
1874         cat <<EOH
1875
1876 Much effort has been expended to ensure that this shell script will run on any
1877 Unix system.  If despite that it blows up on yours, your best bet is to edit
1878 Configure and run it again.  If you can't run Configure for some reason,
1879 you'll have to generate a config.sh file by hand.  Whatever problems you
1880 have, let me (perlbug@perl.org) know how I blew it.
1881
1882 This installation script affects things in two ways:
1883
1884 1) it may do direct variable substitutions on some of the files included
1885    in this kit.
1886 2) it builds a config.h file for inclusion in C programs.  You may edit
1887    any of these files as the need arises after running this script.
1888
1889 If you make a mistake on a question, there is no easy way to back up to it
1890 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1891 files.  Configure will offer to let you do this before it runs the SH files.
1892
1893 EOH
1894         dflt='Type carriage return to continue'
1895         . ./myread
1896         case "$firsttime" in
1897         true) echo $user >>../.config/instruct;;
1898         esac
1899 fi
1900
1901 : find out where common programs are
1902 echo " "
1903 echo "Locating common programs..." >&4
1904 cat <<EOSC >loc
1905 $startsh
1906 case \$# in
1907 0) exit 1;;
1908 esac
1909 thing=\$1
1910 shift
1911 dflt=\$1
1912 shift
1913 for dir in \$*; do
1914         case "\$thing" in
1915         .)
1916         if test -d \$dir/\$thing; then
1917                 echo \$dir
1918                 exit 0
1919         fi
1920         ;;
1921         *)
1922         for thisthing in \$dir/\$thing; do
1923                 : just loop through to pick last item
1924         done
1925         if test -f \$thisthing; then
1926                 echo \$thisthing
1927                 exit 0
1928         elif test -f \$dir/\$thing.exe; then
1929                 if test -n "$DJGPP"; then
1930                         echo \$dir/\$thing.exe
1931                 else
1932                         : on Eunice apparently
1933                         echo \$dir/\$thing
1934                 fi
1935                 exit 0
1936         fi
1937         ;;
1938         esac
1939 done
1940 echo \$dflt
1941 exit 1
1942 EOSC
1943 chmod +x loc
1944 $eunicefix loc
1945 loclist="
1946 awk
1947 cat
1948 comm
1949 cp
1950 echo
1951 expr
1952 grep
1953 ls
1954 make
1955 mkdir
1956 rm
1957 sed
1958 sort
1959 touch
1960 tr
1961 uniq
1962 "
1963 trylist="
1964 Mcc
1965 ar
1966 byacc
1967 cpp
1968 csh
1969 date
1970 egrep
1971 gzip
1972 less
1973 ln
1974 more
1975 nm
1976 nroff
1977 pg
1978 test
1979 uname
1980 zip
1981 "
1982 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1983 pth="$pth /lib /usr/lib"
1984 for file in $loclist; do
1985         eval xxx=\$$file
1986         case "$xxx" in
1987         /*|?:[\\/]*)
1988                 if test -f "$xxx"; then
1989                         : ok
1990                 else
1991                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1992                         xxx=`./loc $file $file $pth`
1993                 fi
1994                 ;;
1995         '') xxx=`./loc $file $file $pth`;;
1996         *) xxx=`./loc $xxx $xxx $pth`;;
1997         esac
1998         eval $file=$xxx
1999         eval _$file=$xxx
2000         case "$xxx" in
2001         /*)
2002                 echo $file is in $xxx.
2003                 ;;
2004         ?:[\\/]*)
2005                 echo $file is in $xxx.
2006                 ;;
2007         *)
2008                 echo "I don't know where '$file' is, and my life depends on it." >&4
2009                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2010                 exit 1
2011                 ;;
2012         esac
2013 done
2014 echo " "
2015 echo "Don't worry if any of the following aren't found..."
2016 say=offhand
2017 for file in $trylist; do
2018         eval xxx=\$$file
2019         case "$xxx" in
2020         /*|?:[\\/]*)
2021                 if test -f "$xxx"; then
2022                         : ok
2023                 else
2024                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2025                         xxx=`./loc $file $file $pth`
2026                 fi
2027                 ;;
2028         '') xxx=`./loc $file $file $pth`;;
2029         *) xxx=`./loc $xxx $xxx $pth`;;
2030         esac
2031         eval $file=$xxx
2032         eval _$file=$xxx
2033         case "$xxx" in
2034         /*)
2035                 echo $file is in $xxx.
2036                 ;;
2037         ?:[\\/]*)
2038                 echo $file is in $xxx.
2039                 ;;
2040         *)
2041                 echo "I don't see $file out there, $say."
2042                 say=either
2043                 ;;
2044         esac
2045 done
2046 case "$egrep" in
2047 egrep)
2048         echo "Substituting grep for egrep."
2049         egrep=$grep
2050         ;;
2051 esac
2052 case "$ln" in
2053 ln)
2054         echo "Substituting cp for ln."
2055         ln=$cp
2056         ;;
2057 esac
2058 case "$test" in
2059 test)
2060         echo "Hopefully test is built into your sh."
2061         ;;
2062 *)
2063         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2064                 echo "Using the test built into your sh."
2065                 echo "Using the test built into your sh."
2066                 test=test
2067                 _test=test
2068         fi
2069         ;;
2070 esac
2071 case "$echo" in
2072 echo)
2073         echo "Hopefully echo is built into your sh."
2074         ;;
2075 '') ;;
2076 *)
2077         echo " "
2078 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2079         $echo $n "hi there$c" >foo1
2080         echo $n "hi there$c" >foo2
2081         if cmp foo1 foo2 >/dev/null 2>&1; then
2082                 echo "They are compatible.  In fact, they may be identical."
2083         else
2084                 case "$n" in
2085                 '-n') n='' c='\c';;
2086                 *) n='-n' c='';;
2087                 esac
2088                 cat <<FOO
2089 They are not compatible!  You are probably running ksh on a non-USG system.
2090 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2091 have echo built in and we may have to run some Bourne shell scripts.  That
2092 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2093
2094 FOO
2095                 $echo $n "The star should be here-->$c"
2096                 $echo "*"
2097         fi
2098         $rm -f foo1 foo2
2099         ;;
2100 esac
2101
2102 cat <<EOS >checkcc
2103 $startsh
2104 EOS
2105 cat <<'EOSC' >>checkcc
2106 case "$cc" in
2107 '') ;;
2108 *)  $rm -f try try.*
2109     $cat >try.c <<EOM
2110 int main(int argc, char *argv[]) {
2111   return 0;
2112 }
2113 EOM
2114     if $cc -o try $ccflags try.c; then
2115        :
2116     else
2117         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2118         despair=yes
2119         trygcc=yes
2120         case "$cc" in
2121         *gcc*) trygcc=no ;;
2122         esac
2123         case "`$cc -v -c try.c 2>&1`" in
2124         *gcc*) trygcc=no ;;
2125         esac
2126         if $test X"$trygcc" = Xyes; then
2127             if gcc -o try -c try.c; then
2128                 echo " "
2129                 echo "You seem to have a working gcc, though." >&4
2130                 rp="Would you like to use it?"
2131                 dflt=y
2132                 if $test -f myread; then
2133                     . ./myread
2134                 else
2135                     if $test -f UU/myread; then
2136                         . ./UU/myread
2137                     else
2138                         echo "Cannot find myread, sorry.  Aborting." >&2
2139                         exit 1
2140                     fi
2141                 fi  
2142                 case "$ans" in
2143                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2144                 esac
2145             fi
2146         fi
2147         if $test X"$despair" = Xyes; then
2148             $cat >&4 <<EOM
2149 You need to find a working C compiler.
2150 Either (purchase and) install the C compiler supplied by your OS vendor,
2151 or for a free C compiler try http://gcc.gnu.org/
2152 I cannot continue any further, aborting.
2153 EOM
2154             exit 1
2155         fi
2156     fi
2157     $rm -f try try.*
2158     ;;
2159 esac
2160 EOSC
2161
2162 : determine whether symbolic links are supported
2163 echo " "
2164 $touch blurfl
2165 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2166         echo "Symbolic links are supported." >&4
2167         lns="$ln -s"
2168 else
2169         echo "Symbolic links are NOT supported." >&4
2170         lns="$ln"
2171 fi
2172 $rm -f blurfl sym
2173
2174 : determine whether symbolic links are supported
2175 echo " "
2176 case "$lns" in
2177 *"ln -s")
2178         echo "Checking how to test for symbolic links..." >&4
2179         $lns blurfl sym
2180         if $test "X$issymlink" = X; then
2181                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2182                 if test $? = 0; then
2183                         issymlink="test -h"
2184                 fi              
2185         fi
2186         if $test "X$issymlink" = X; then
2187                 if  $test -h >/dev/null 2>&1; then
2188                         issymlink="$test -h"
2189                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2190                 fi              
2191         fi
2192         if $test "X$issymlink" = X; then
2193                 if $test -L sym 2>/dev/null; then
2194                         issymlink="$test -L"
2195                 fi
2196         fi
2197         if $test "X$issymlink" != X; then
2198                 echo "You can test for symbolic links with '$issymlink'." >&4
2199         else
2200                 echo "I do not know how you can test for symbolic links." >&4
2201         fi
2202         $rm -f blurfl sym
2203         ;;
2204 *)      echo "No symbolic links, so not testing for their testing..." >&4
2205         ;;
2206 esac
2207 echo " "
2208
2209
2210 case "$mksymlinks" in
2211 $define|true|[yY]*)
2212         case "$src" in
2213         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2214                 exit 1
2215                 ;;
2216         *)      case "$lns:$issymlink" in
2217                 *"ln -s:"*"test -"?)
2218                         echo "Creating the symbolic links..." >&4
2219                         echo "(First creating the subdirectories...)" >&4
2220                         cd ..
2221                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2222                                 read directory
2223                                 test -z "$directory" && break
2224                                 mkdir -p $directory
2225                         done
2226                         # Sanity check 1.
2227                         if test ! -d t/base; then
2228                                 echo "Failed to create the subdirectories.  Aborting." >&4
2229                                 exit 1
2230                         fi
2231                         echo "(Then creating the symlinks...)" >&4
2232                         awk '{print $1}' $src/MANIFEST | while true; do
2233                                 read filename
2234                                 test -z "$filename" && break
2235                                 if test -f $filename; then
2236                                         if $issymlink $filename; then
2237                                                 rm -f $filename
2238                                         fi
2239                                 fi
2240                                 if test -f $filename; then
2241                                         echo "$filename already exists, not symlinking."
2242                                 else
2243                                         ln -s $src/$filename $filename
2244                                 fi
2245                         done
2246                         # Sanity check 2.
2247                         if test ! -f t/base/commonsense.t; then
2248                                 echo "Failed to create the symlinks.  Aborting." >&4
2249                                 exit 1
2250                         fi
2251                         cd UU
2252                         ;;
2253                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2254                         ;;
2255                 esac
2256                 ;;
2257         esac
2258         ;;
2259 esac
2260
2261 : see whether [:lower:] and [:upper:] are supported character classes
2262 echo " "
2263 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2264 ABYZ)
2265         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2266         up='[:upper:]'
2267         low='[:lower:]'
2268         ;;
2269 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2270         # (0xc9 and 0xd1), therefore that is a nice testing point.
2271         if test "X$up" = X -o "X$low" = X; then
2272             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2273             ij) up='[A-Z]'
2274                 low='[a-z]'
2275                 ;;
2276             esac
2277         fi
2278         if test "X$up" = X -o "X$low" = X; then
2279             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2280             ij) up='A-Z'
2281                 low='a-z'
2282                 ;;
2283             esac
2284         fi
2285         if test "X$up" = X -o "X$low" = X; then
2286             case "`echo IJ | od -x 2>/dev/null`" in
2287             *C9D1*|*c9d1*)
2288                 echo "Hey, this might be EBCDIC." >&4
2289                 if test "X$up" = X -o "X$low" = X; then
2290                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2291                     ij) up='[A-IJ-RS-Z]'
2292                         low='[a-ij-rs-z]'
2293                         ;;
2294                     esac
2295                 fi
2296                 if test "X$up" = X -o "X$low" = X; then
2297                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2298                     ij) up='A-IJ-RS-Z'
2299                         low='a-ij-rs-z'
2300                         ;;
2301                     esac
2302                 fi
2303                 ;;
2304             esac
2305         fi
2306 esac
2307 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2308 ij)
2309     echo "Using $up and $low to convert case." >&4
2310     ;;
2311 *)
2312     echo "I don't know how to translate letters from upper to lower case." >&4
2313     echo "Your tr is not acting any way I know of." >&4
2314     exit 1
2315     ;;
2316 esac
2317 : set up the translation script tr, must be called with ./tr of course
2318 cat >tr <<EOSC
2319 $startsh
2320 case "\$1\$2" in
2321 '[A-Z][a-z]') exec $tr '$up' '$low';;
2322 '[a-z][A-Z]') exec $tr '$low' '$up';;
2323 esac
2324 exec $tr "\$@"
2325 EOSC
2326 chmod +x tr
2327 $eunicefix tr
2328
2329 : Try to determine whether config.sh was made on this system
2330 case "$config_sh" in
2331 '')
2332 myuname=`$uname -a 2>/dev/null`
2333 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2334 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2335 # because the A-Z/a-z are not consecutive.
2336 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2337         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2338 newmyuname="$myuname"
2339 dflt=n
2340 case "$knowitall" in
2341 '')
2342         if test -f ../config.sh; then
2343                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2344                         eval "`grep myuname= ../config.sh`"
2345                 fi
2346                 if test "X$myuname" = "X$newmyuname"; then
2347                         dflt=y
2348                 fi
2349         fi
2350         ;;
2351 *) dflt=y;;
2352 esac
2353
2354 : Get old answers from old config file if Configure was run on the
2355 : same system, otherwise use the hints.
2356 hint=default
2357 cd ..
2358 if test -f config.sh; then
2359         echo " "
2360         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2361         . UU/myread
2362         case "$ans" in
2363         n*|N*) echo "OK, I'll ignore it."
2364                 mv config.sh config.sh.old
2365                 myuname="$newmyuname"
2366                 ;;
2367         *)  echo "Fetching default answers from your old config.sh file..." >&4
2368                 tmp_n="$n"
2369                 tmp_c="$c"
2370                 tmp_sh="$sh"
2371                 . ./config.sh
2372                 cp config.sh UU
2373                 n="$tmp_n"
2374                 c="$tmp_c"
2375                 : Older versions did not always set $sh.  Catch re-use of such
2376                 : an old config.sh.
2377                 case "$sh" in
2378                 '') sh="$tmp_sh" ;;
2379                 esac
2380                 hint=previous
2381                 ;;
2382         esac
2383 fi
2384 . ./UU/checkcc
2385 if test ! -f config.sh; then
2386         $cat <<EOM
2387
2388 First time through, eh?  I have some defaults handy for some systems
2389 that need some extra help getting the Configure answers right:
2390
2391 EOM
2392         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2393         dflt=''
2394         : Half the following guesses are probably wrong... If you have better
2395         : tests or hints, please send them to perlbug@perl.org
2396         : The metaconfig authors would also appreciate a copy...
2397         $test -f /irix && osname=irix
2398         $test -f /xenix && osname=sco_xenix
2399         $test -f /dynix && osname=dynix
2400         $test -f /dnix && osname=dnix
2401         $test -f /lynx.os && osname=lynxos
2402         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2403         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2404         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2405         $test -f /bin/mips && /bin/mips && osname=mips
2406         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2407                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2408         $test -d /usr/apollo/bin && osname=apollo
2409         $test -f /etc/saf/_sactab && osname=svr4
2410         $test -d /usr/include/minix && osname=minix
2411         if $test -d /MachTen -o -d /MachTen_Folder; then
2412                 osname=machten
2413                 if $test -x /sbin/version; then
2414                         osvers=`/sbin/version | $awk '{print $2}' |
2415                         $sed -e 's/[A-Za-z]$//'`
2416                 elif $test -x /usr/etc/version; then
2417                         osvers=`/usr/etc/version | $awk '{print $2}' |
2418                         $sed -e 's/[A-Za-z]$//'`
2419                 else
2420                         osvers="$2.$3"
2421                 fi
2422         fi
2423
2424         $test -f /sys/posix.dll &&
2425                 $test -f /usr/bin/what &&
2426                 set X `/usr/bin/what /sys/posix.dll` &&
2427                 $test "$3" = UWIN &&
2428                 osname=uwin &&
2429                 osvers="$5"
2430
2431         if $test -f $uname; then
2432                 set X $myuname
2433                 shift
2434
2435                 case "$5" in
2436                 fps*) osname=fps ;;
2437                 mips*)
2438                         case "$4" in
2439                         umips) osname=umips ;;
2440                         *) osname=mips ;;
2441                         esac;;
2442                 [23]100) osname=mips ;;
2443                 next*) osname=next ;;
2444                 i386*)
2445                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2446                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2447                                 osname='sco'
2448                                 osvers=$tmp
2449                         elif $test -f /etc/kconfig; then
2450                                 osname=isc
2451                                 if test "$lns" = "$ln -s"; then
2452                                         osvers=4
2453                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2454                                         osvers=3
2455                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2456                                         osvers=2
2457                                 fi
2458                         fi
2459                         tmp=''
2460                         ;;
2461                 pc*)
2462                         if test -n "$DJGPP"; then
2463                                 osname=dos
2464                                 osvers=djgpp
2465                         fi
2466                         ;;
2467                 esac
2468
2469                 case "$1" in
2470                 aix) osname=aix
2471                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2472                         case "$tmp" in
2473                         'not found') osvers="$4"."$3" ;;
2474                         '<3240'|'<>3240') osvers=3.2.0 ;;
2475                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2476                         '=3250'|'>3250') osvers=3.2.5 ;;
2477                         *) osvers=$tmp;;
2478                         esac
2479                         ;;
2480                 bsd386) osname=bsd386
2481                         osvers=`$uname -r`
2482                         ;;
2483                 cygwin*) osname=cygwin
2484                         osvers="$3"
2485                         ;;
2486                 *dc.osx) osname=dcosx
2487                         osvers="$3"
2488                         ;;
2489                 dnix) osname=dnix
2490                         osvers="$3"
2491                         ;;
2492                 domainos) osname=apollo
2493                         osvers="$3"
2494                         ;;
2495                 dgux) osname=dgux 
2496                         osvers="$3"
2497                         ;;
2498                 dynixptx*) osname=dynixptx
2499                         osvers=`echo "$4"|sed 's/^v//'`
2500                         ;;
2501                 freebsd) osname=freebsd 
2502                         osvers="$3" ;;
2503                 genix) osname=genix ;;
2504                 hp*) osname=hpux 
2505                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2506                         ;;
2507                 irix*) osname=irix
2508                         case "$3" in
2509                         4*) osvers=4 ;;
2510                         5*) osvers=5 ;;
2511                         *)      osvers="$3" ;;
2512                         esac
2513                         ;;
2514                 linux) osname=linux
2515                         case "$3" in
2516                         *)      osvers="$3" ;;
2517                         esac
2518                         ;;
2519                 MiNT) osname=mint
2520                         ;;
2521                 netbsd*) osname=netbsd
2522                         osvers="$3"
2523                         ;;
2524                 news-os) osvers="$3"
2525                         case "$3" in
2526                         4*) osname=newsos4 ;;
2527                         *) osname=newsos ;;
2528                         esac
2529                         ;;
2530                 next*) osname=next ;;
2531                 nonstop-ux) osname=nonstopux ;;
2532                 POSIX-BC | posix-bc ) osname=posix-bc
2533                         osvers="$3"
2534                         ;;
2535                 powerux | power_ux | powermax_os | powermaxos | \
2536                 powerunix | power_unix) osname=powerux
2537                         osvers="$3"
2538                         ;;
2539                 qnx) osname=qnx
2540                         osvers="$4"
2541                         ;;
2542                 solaris) osname=solaris
2543                         case "$3" in
2544                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2545                         *)      osvers="$3" ;;
2546                         esac
2547                         ;;
2548                 sunos) osname=sunos
2549                         case "$3" in
2550                         5*) osname=solaris
2551                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2552                         *)      osvers="$3" ;;
2553                         esac
2554                         ;;
2555                 titanos) osname=titanos
2556                         case "$3" in
2557                         1*) osvers=1 ;;
2558                         2*) osvers=2 ;;
2559                         3*) osvers=3 ;;
2560                         4*) osvers=4 ;;
2561                         *)      osvers="$3" ;;
2562                         esac
2563                         ;;
2564                 ultrix) osname=ultrix
2565                         osvers="$3"
2566                         ;;
2567                 osf1|mls+)      case "$5" in
2568                                 alpha)
2569                                         osname=dec_osf
2570                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2571                                         case "$osvers" in
2572                                         [1-9].[0-9]*) ;;
2573                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2574                                         esac
2575                                         ;;
2576                         hp*)    osname=hp_osf1  ;;
2577                         mips)   osname=mips_osf1 ;;
2578                         esac
2579                         ;;
2580                 unixware) osname=svr5
2581                         osvers="$4"
2582                         ;;
2583                 uts) osname=uts
2584                         osvers="$3"
2585                         ;;
2586                 $2) case "$osname" in
2587                         *isc*) ;;
2588                         *freebsd*) ;;
2589                         svr*)
2590                                 : svr4.x or possibly later
2591                                 case "svr$3" in 
2592                                 ${osname}*)
2593                                         osname=svr$3
2594                                         osvers=$4
2595                                         ;;
2596                                 esac
2597                                 case "$osname" in
2598                                 svr4.0)
2599                                         : Check for ESIX
2600                                         if test -f /stand/boot ; then
2601                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2602                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2603                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2604                                                         if test -n "$isesix"; then
2605                                                                 osname=esix4
2606                                                         fi
2607                                                 fi
2608                                         fi
2609                                         ;;
2610                                 esac
2611                                 ;;
2612                         *)      if test -f /etc/systemid; then
2613                                         osname=sco
2614                                         set `echo $3 | $sed 's/\./ /g'` $4
2615                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2616                                                 osvers=$1.$2.$3
2617                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2618                                                 osvers=$1.$2
2619                                         elif $test -f $src/hints/sco_$1.sh; then
2620                                                 osvers=$1
2621                                         fi
2622                                 else
2623                                         case "$osname" in
2624                                         '') : Still unknown.  Probably a generic Sys V.
2625                                                 osname="sysv"
2626                                                 osvers="$3"
2627                                                 ;;
2628                                         esac
2629                                 fi
2630                                 ;;
2631                         esac
2632                         ;;
2633                 *)      case "$osname" in
2634                         '') : Still unknown.  Probably a generic BSD.
2635                                 osname="$1"
2636                                 osvers="$3"
2637                                 ;;
2638                         esac
2639                         ;;
2640                 esac
2641         else
2642                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2643                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2644                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2645                                 osname=news_os
2646                         fi
2647                         $rm -f UU/kernel.what
2648                 elif test -d c:/.; then
2649                         set X $myuname
2650                         osname=os2
2651                         osvers="$5"
2652                 fi
2653         fi
2654         
2655         : Now look for a hint file osname_osvers, unless one has been
2656         : specified already.
2657         case "$hintfile" in
2658         ''|' ')
2659                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2660                 : Also try without trailing minor version numbers.
2661                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2662                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2663                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2664                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2665                 case "$file" in
2666                 '') dflt=none ;;
2667                 *)  case "$osvers" in
2668                         '') dflt=$file
2669                                 ;;
2670                         *)  if $test -f $src/hints/$file.sh ; then
2671                                         dflt=$file
2672                                 elif $test -f $src/hints/$xfile.sh ; then
2673                                         dflt=$xfile
2674                                 elif $test -f $src/hints/$xxfile.sh ; then
2675                                         dflt=$xxfile
2676                                 elif $test -f $src/hints/$xxxfile.sh ; then
2677                                         dflt=$xxxfile
2678                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2679                                         dflt=$xxxxfile
2680                                 elif $test -f "$src/hints/${osname}.sh" ; then
2681                                         dflt="${osname}"
2682                                 else
2683                                         dflt=none
2684                                 fi
2685                                 ;;
2686                         esac
2687                         ;;
2688                 esac
2689                 if $test -f Policy.sh ; then
2690                         case "$dflt" in
2691                         *Policy*) ;;
2692                         none) dflt="Policy" ;;
2693                         *) dflt="Policy $dflt" ;;
2694                         esac
2695                 fi
2696                 ;;
2697         *)
2698                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2699                 ;;
2700         esac
2701
2702         if $test -f Policy.sh ; then
2703                 $cat <<EOM
2704
2705 There's also a Policy hint file available, which should make the
2706 site-specific (policy) questions easier to answer.
2707 EOM
2708
2709         fi
2710
2711         $cat <<EOM
2712
2713 You may give one or more space-separated answers, or "none" if appropriate.
2714 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2715 is a good thing.  DO NOT give a wrong version or a wrong OS.
2716
2717 EOM
2718
2719         rp="Which of these apply, if any?"
2720         . UU/myread
2721         tans=$ans
2722         for file in $tans; do
2723                 if $test X$file = XPolicy -a -f Policy.sh; then
2724                         . Policy.sh
2725                         $cat Policy.sh >> UU/config.sh
2726                 elif $test -f $src/hints/$file.sh; then
2727                         . $src/hints/$file.sh
2728                         $cat $src/hints/$file.sh >> UU/config.sh
2729                 elif $test X$tans = X -o X$tans = Xnone ; then
2730                         : nothing
2731                 else
2732                         : Give one chance to correct a possible typo.
2733                         echo "$file.sh does not exist"
2734                         dflt=$file
2735                         rp="hint to use instead?"
2736                         . UU/myread
2737                         for file in $ans; do
2738                                 if $test -f "$src/hints/$file.sh"; then
2739                                         . $src/hints/$file.sh
2740                                         $cat $src/hints/$file.sh >> UU/config.sh
2741                                 elif $test X$ans = X -o X$ans = Xnone ; then
2742                                         : nothing
2743                                 else
2744                                         echo "$file.sh does not exist -- ignored."
2745                                 fi
2746                         done
2747                 fi
2748         done
2749
2750         hint=recommended
2751         : Remember our hint file for later.
2752         if $test -f "$src/hints/$file.sh" ; then
2753                 hintfile="$file"
2754         else
2755                 hintfile=''
2756         fi
2757 fi
2758 cd UU
2759 ;;
2760 *)
2761         echo " "
2762         echo "Fetching default answers from $config_sh..." >&4
2763         tmp_n="$n"
2764         tmp_c="$c"
2765         cd ..
2766         cp $config_sh config.sh 2>/dev/null
2767         chmod +w config.sh
2768         . ./config.sh
2769         cd UU
2770         cp ../config.sh .
2771         n="$tmp_n"
2772         c="$tmp_c"
2773         hint=previous
2774         ;;
2775 esac
2776 test "$override" && . ./optdef.sh
2777
2778 : Restore computed paths
2779 for file in $loclist $trylist; do
2780         eval $file="\$_$file"
2781 done
2782
2783 cat << EOM
2784
2785 Configure uses the operating system name and version to set some defaults.
2786 The default value is probably right if the name rings a bell. Otherwise,
2787 since spelling matters for me, either accept the default or answer "none"
2788 to leave it blank.
2789
2790 EOM
2791 case "$osname" in
2792         ''|' ')
2793                 case "$hintfile" in
2794                 ''|' '|none) dflt=none ;;
2795                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2796                 esac
2797                 ;;
2798         *) dflt="$osname" ;;
2799 esac
2800 rp="Operating system name?"
2801 . ./myread
2802 case "$ans" in
2803 none)  osname='' ;;
2804 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2805 esac
2806 echo " "
2807 case "$osvers" in
2808         ''|' ')
2809                 case "$hintfile" in
2810                 ''|' '|none) dflt=none ;;
2811                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2812                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2813                         case "$dflt" in
2814                         ''|' ') dflt=none ;;
2815                         esac
2816                         ;;
2817                 esac
2818                 ;;
2819         *) dflt="$osvers" ;;
2820 esac
2821 rp="Operating system version?"
2822 . ./myread
2823 case "$ans" in
2824 none)  osvers='' ;;
2825 *) osvers="$ans" ;;
2826 esac
2827
2828
2829 . ./posthint.sh
2830
2831 : who configured the system
2832 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2833 cf_by=`(logname) 2>/dev/null`
2834 case "$cf_by" in
2835 "")
2836         cf_by=`(whoami) 2>/dev/null`
2837         case "$cf_by" in
2838         "") cf_by=unknown ;;
2839         esac ;;
2840 esac
2841
2842 : set up the script used to warn in case of inconsistency
2843 cat <<EOS >whoa
2844 $startsh
2845 EOS
2846 cat <<'EOSC' >>whoa
2847 dflt=y
2848 echo " "
2849 echo "*** WHOA THERE!!! ***" >&4
2850 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2851 rp="    Keep the $hint value?"
2852 . ./myread
2853 case "$ans" in
2854 y) td=$was; tu=$was;;
2855 esac
2856 EOSC
2857
2858 : function used to set $1 to $val
2859 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2860 case "$val$was" in
2861 $define$undef) . ./whoa; eval "$var=\$td";;
2862 $undef$define) . ./whoa; eval "$var=\$tu";;
2863 *) eval "$var=$val";;
2864 esac'
2865
2866 case "$usethreads" in
2867 $define|true|[yY]*)     dflt='y';;
2868 *) dflt='n';;
2869 esac
2870 cat <<EOM
2871
2872 Perl can be built to take advantage of threads on some systems.
2873 To do so, Configure can be run with -Dusethreads.
2874
2875 Note that threading is a highly experimental feature, and
2876 some known race conditions still remain.  If you choose to try
2877 it, be very sure to not actually deploy it for production
2878 purposes.  README.threads has more details, and is required
2879 reading if you enable threads.
2880
2881 If this doesn't make any sense to you, just accept the default '$dflt'.
2882 EOM
2883 rp='Build a threading Perl?'
2884 . ./myread
2885 case "$ans" in
2886 y|Y)    val="$define" ;;
2887 *)      val="$undef" ;;
2888 esac
2889 set usethreads
2890 eval $setvar
2891
2892 case "$usethreads" in
2893 $define)
2894         $cat <<EOM
2895
2896 As of 5.5.640, Perl has two different internal threading implementations,
2897 the 5.005 version (5005threads) and an interpreter-based version
2898 (ithreads) that has one interpreter per thread.  Both are very 
2899 experimental.  This arrangement exists to help developers work out
2900 which one is better.
2901
2902 If you're a casual user, you probably don't want interpreter-threads
2903 at this time.  There doesn't yet exist a way to create threads from
2904 within Perl in this model, i.e., "use Thread;" will NOT work.
2905 EOM
2906         : Default to ithreads unless overridden on command line or with
2907         : old config.sh
2908         dflt='y'
2909         case "$use5005threads" in
2910                 $define|true|[yY]*) dflt='n';;
2911         esac
2912         case "$useithreads" in
2913                 $undef|false|[nN]*) dflt='n';;
2914         esac
2915         rp='Use interpreter-based ithreads?'
2916         . ./myread
2917         case "$ans" in
2918         y|Y)    val="$define" ;;
2919         *)      val="$undef" ;;
2920         esac
2921         set useithreads
2922         eval $setvar
2923         : Now set use5005threads to the opposite value.
2924         case "$useithreads" in
2925         $define) val="$undef" ;;
2926         *) val="$define" ;;
2927         esac
2928         set use5005threads
2929         eval $setvar
2930         ;;
2931 *)
2932         useithreads="$undef"
2933         use5005threads="$undef"
2934         ;;
2935 esac
2936
2937 case "$d_oldpthreads" in
2938 '')     : Configure tests would be welcome here.  For now, assume undef.
2939         val="$undef" ;;
2940 *)      val="$d_oldpthreads" ;;
2941 esac
2942 set d_oldpthreads
2943 eval $setvar
2944
2945
2946 case "$usethreads" in
2947 "$define"|true|[yY]*)
2948 : Look for a hint-file generated 'call-back-unit'.  If the
2949 : user has specified that a threading perl is to be built,
2950 : we may need to set or change some other defaults.
2951         if $test -f usethreads.cbu; then
2952                 echo "Your platform has some specific hints for threaded builds, using them..."
2953                 . ./usethreads.cbu
2954         else
2955                 $cat <<EOM
2956 (Your platform doesn't have any specific hints for threaded builds.
2957  Assuming POSIX threads, then.)
2958 EOM
2959         fi
2960         ;;
2961 esac
2962
2963 cat <<EOM
2964
2965 Perl can be built so that multiple Perl interpreters can coexist
2966 within the same Perl executable.
2967 EOM
2968
2969 case "$useithreads" in
2970 $define)
2971         cat <<EOM
2972 This multiple interpreter support is required for interpreter-based threads.
2973 EOM
2974         val="$define"
2975         ;;
2976 *)      case "$usemultiplicity" in
2977         $define|true|[yY]*)     dflt='y';;
2978         *) dflt='n';;
2979         esac
2980         echo " "
2981         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2982         rp='Build Perl for multiplicity?'
2983         . ./myread
2984         case "$ans" in
2985         y|Y)    val="$define" ;;
2986         *)      val="$undef" ;;
2987         esac
2988         ;;
2989 esac
2990 set usemultiplicity
2991 eval $setvar
2992
2993 : make some quick guesses about what we are up against
2994 echo " "
2995 $echo $n "Hmm...  $c"
2996 echo exit 1 >bsd
2997 echo exit 1 >usg
2998 echo exit 1 >v7
2999 echo exit 1 >osf1
3000 echo exit 1 >eunice
3001 echo exit 1 >xenix
3002 echo exit 1 >venix
3003 echo exit 1 >os2
3004 d_bsd="$undef"
3005 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3006 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3007 then
3008         echo "Looks kind of like an OSF/1 system, but we'll see..."
3009         echo exit 0 >osf1
3010 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3011         xxx=`./loc addbib blurfl $pth`
3012         if $test -f $xxx; then
3013         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3014                 echo exit 0 >bsd
3015                 echo exit 0 >usg
3016         else
3017                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3018                         echo "Looks kind of like an extended USG system, but we'll see..."
3019                 else
3020                         echo "Looks kind of like a USG system, but we'll see..."
3021                 fi
3022                 echo exit 0 >usg
3023         fi
3024 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3025         echo "Looks kind of like a BSD system, but we'll see..."
3026         d_bsd="$define"
3027         echo exit 0 >bsd
3028 else
3029         echo "Looks kind of like a Version 7 system, but we'll see..."
3030         echo exit 0 >v7
3031 fi
3032 case "$eunicefix" in
3033 *unixtovms*)
3034         $cat <<'EOI'
3035 There is, however, a strange, musty smell in the air that reminds me of
3036 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3037 EOI
3038         echo exit 0 >eunice
3039         d_eunice="$define"
3040 : it so happens the Eunice I know will not run shell scripts in Unix format
3041         ;;
3042 *)
3043         echo " "
3044         echo "Congratulations.  You aren't running Eunice."
3045         d_eunice="$undef"
3046         ;;
3047 esac
3048 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3049 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3050 : semicolon as a patch separator
3051 case "$p_" in
3052 :) ;;
3053 *)
3054         $cat <<'EOI'
3055 I have the feeling something is not exactly right, however...don't tell me...
3056 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3057 (Or you may be running DOS with DJGPP.)
3058 EOI
3059         echo exit 0 >os2
3060         ;;
3061 esac
3062 if test -f /xenix; then
3063         echo "Actually, this looks more like a XENIX system..."
3064         echo exit 0 >xenix
3065         d_xenix="$define"
3066 else
3067         echo " "
3068         echo "It's not Xenix..."
3069         d_xenix="$undef"
3070 fi
3071 chmod +x xenix
3072 $eunicefix xenix
3073 if test -f /venix; then
3074         echo "Actually, this looks more like a VENIX system..."
3075         echo exit 0 >venix
3076 else
3077         echo " "
3078         if ./xenix; then
3079                 : null
3080         else
3081                 echo "Nor is it Venix..."
3082         fi
3083 fi
3084 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3085 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3086 $rm -f foo
3087
3088 case "$cc" in
3089 '') dflt=cc;;
3090 *) dflt="$cc";;
3091 esac
3092 rp="Use which C compiler?"
3093 . ./myread
3094 cc="$ans"
3095 : Look for a hint-file generated 'call-back-unit'.  Now that the
3096 : user has specified the compiler, we may need to set or change some
3097 : other defaults.
3098 if $test -f cc.cbu; then
3099     . ./cc.cbu
3100 fi
3101 . ./checkcc
3102
3103 echo " "
3104 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3105 $cat >gccvers.c <<EOM
3106 #include <stdio.h>
3107 int main() {
3108 #ifdef __GNUC__
3109 #ifdef __VERSION__
3110         printf("%s\n", __VERSION__);
3111 #else
3112         printf("%s\n", "1");
3113 #endif
3114 #endif
3115         exit(0);
3116 }
3117 EOM
3118 if $cc -o gccvers $ldflags gccvers.c; then
3119         gccversion=`./gccvers`
3120         case "$gccversion" in
3121         '') echo "You are not using GNU cc." ;;
3122         *)  echo "You are using GNU cc $gccversion."
3123             ccname=gcc  
3124             ;;
3125         esac
3126 else
3127         echo " "
3128         echo "*** WHOA THERE!!! ***" >&4
3129         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3130         case "$knowitall" in
3131         '')
3132         echo "    You'd better start hunting for one and let me know about it." >&4
3133                 exit 1
3134                 ;;
3135         esac
3136 fi
3137 $rm -f gccvers*
3138 case "$gccversion" in
3139 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3140 esac
3141 case "$gccversion" in
3142 '') gccosandvers='' ;;
3143 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3144    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3145    gccshortvers=''
3146    case "$gccosandvers" in
3147    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3148    $osname$osvers) ;; # looking good
3149    $osname*) cat <<EOM >&4
3150
3151 *** WHOA THERE!!! ***
3152
3153     Your gcc has not been compiled for the exact release of
3154     your operating system ($gccosandvers versus $osname$osvers).
3155
3156     In general it is a good idea to keep gcc synchronized with
3157     the operating system because otherwise serious problems
3158     may ensue when trying to compile software, like Perl.
3159
3160     I'm trying to be optimistic here, though, and will continue.
3161     If later during the configuration and build icky compilation
3162     problems appear (headerfile conflicts being the most common
3163     manifestation), I suggest reinstalling the gcc to match
3164     your operating system release.
3165
3166 EOM
3167       ;;
3168    *) gccosandvers='' ;; # failed to parse, better be silent
3169    esac
3170    ;;
3171 esac
3172 case "$ccname" in
3173 '') ccname="$cc" ;;
3174 esac
3175
3176 : see how we invoke the C preprocessor
3177 echo " "
3178 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3179 cat <<'EOT' >testcpp.c
3180 #define ABC abc
3181 #define XYZ xyz
3182 ABC.XYZ
3183 EOT
3184 cd ..
3185 if test ! -f cppstdin; then
3186         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3187                 # AIX cc -E doesn't show the absolute headerfile
3188                 # locations but we'll cheat by using the -M flag.
3189                 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
3190         else
3191                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3192         fi
3193 else
3194         echo "Keeping your $hint cppstdin wrapper."
3195 fi
3196 chmod 755 cppstdin
3197 wrapper=`pwd`/cppstdin
3198 ok='false'
3199 cd UU
3200
3201 if $test "X$cppstdin" != "X" && \
3202         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3203         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3204 then
3205         echo "You used to use $cppstdin $cppminus so we'll use that again."
3206         case "$cpprun" in
3207         '') echo "But let's see if we can live without a wrapper..." ;;
3208         *)
3209                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3210                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3211                 then
3212                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3213                         ok='true'
3214                 else
3215                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3216                 fi
3217                 ;;
3218         esac
3219 else
3220         case "$cppstdin" in
3221         '') ;;
3222         *)
3223                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3224                 ;;
3225         esac
3226 fi
3227
3228 if $ok; then
3229         : nothing
3230 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3231         $cc -E <testcpp.c >testcpp.out 2>&1; \
3232         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3233         echo "Yup, it does."
3234         x_cpp="$cc -E"
3235         x_minus='';
3236 elif echo 'Nope...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"' -P" will work...'; \
3243         $cc -P <testcpp.c >testcpp.out 2>&1; \
3244         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3245         echo "Yipee, that works!"
3246         x_cpp="$cc -P"
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 "At long last!"
3252         x_cpp="$cc -P"
3253         x_minus='-';
3254 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3255         $cpp <testcpp.c >testcpp.out 2>&1; \
3256         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3257         echo "It works!"
3258         x_cpp="$cpp"
3259         x_minus='';
3260 elif echo 'Nixed again...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 "Hooray, it works!  I was beginning to wonder."
3264         x_cpp="$cpp"
3265         x_minus='-';
3266 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3267         $wrapper <testcpp.c >testcpp.out 2>&1; \
3268         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3269         x_cpp="$wrapper"
3270         x_minus=''
3271         echo "Eureka!"
3272 else
3273         dflt=''
3274         rp="No dice.  I can't find a C preprocessor.  Name one:"
3275         . ./myread
3276         x_cpp="$ans"
3277         x_minus=''
3278         $x_cpp <testcpp.c >testcpp.out 2>&1
3279         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3280                 echo "OK, that will do." >&4
3281         else
3282 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3283                 exit 1
3284         fi
3285 fi
3286
3287 case "$ok" in
3288 false)
3289         cppstdin="$x_cpp"
3290         cppminus="$x_minus"
3291         cpprun="$x_cpp"
3292         cpplast="$x_minus"
3293         set X $x_cpp
3294         shift
3295         case "$1" in
3296         "$cpp")
3297                 echo "Perhaps can we force $cc -E using a wrapper..."
3298                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3299                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3300                 then
3301                         echo "Yup, we can."
3302                         cppstdin="$wrapper"
3303                         cppminus='';
3304                 else
3305                         echo "Nope, we'll have to live without it..."
3306                 fi
3307                 ;;
3308         esac
3309         case "$cpprun" in
3310         "$wrapper")
3311                 cpprun=''
3312                 cpplast=''
3313                 ;;
3314         esac
3315         ;;
3316 esac
3317
3318 case "$cppstdin" in
3319 "$wrapper"|'cppstdin') ;;
3320 *) $rm -f $wrapper;;
3321 esac
3322 $rm -f testcpp.c testcpp.out
3323
3324 : decide how portable to be.  Allow command line overrides.
3325 case "$d_portable" in
3326 "$undef") ;;
3327 *)      d_portable="$define" ;;
3328 esac
3329
3330 : set up shell script to do ~ expansion
3331 cat >filexp <<EOSS
3332 $startsh
3333 : expand filename
3334 case "\$1" in
3335  ~/*|~)
3336         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3337         ;;
3338  ~*)
3339         if $test -f /bin/csh; then
3340                 /bin/csh -f -c "glob \$1"
3341                 failed=\$?
3342                 echo ""
3343                 exit \$failed
3344         else
3345                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3346                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3347                 if $test ! -d "\$dir"; then
3348                         me=\`basename \$0\`
3349                         echo "\$me: can't locate home directory for: \$name" >&2
3350                         exit 1
3351                 fi
3352                 case "\$1" in
3353                 */*)
3354                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3355                         ;;
3356                 *)
3357                         echo \$dir
3358                         ;;
3359                 esac
3360         fi
3361         ;;
3362 *)
3363         echo \$1
3364         ;;
3365 esac
3366 EOSS
3367 chmod +x filexp
3368 $eunicefix filexp
3369
3370 : now set up to get a file name
3371 cat <<EOS >getfile
3372 $startsh
3373 EOS
3374 cat <<'EOSC' >>getfile
3375 tilde=''
3376 fullpath=''
3377 already=''
3378 skip=''
3379 none_ok=''
3380 exp_file=''
3381 nopath_ok=''
3382 orig_rp="$rp"
3383 orig_dflt="$dflt"
3384 case "$gfpth" in
3385 '') gfpth='.' ;;
3386 esac
3387
3388 case "$fn" in
3389 *\(*)
3390         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3391         fn=`echo $fn | sed 's/(.*)//'`
3392         ;;
3393 esac
3394
3395 case "$fn" in
3396 *:*)
3397         loc_file=`expr $fn : '.*:\(.*\)'`
3398         fn=`expr $fn : '\(.*\):.*'`
3399         ;;
3400 esac
3401
3402 case "$fn" in
3403 *~*) tilde=true;;
3404 esac
3405 case "$fn" in
3406 */*) fullpath=true;;
3407 esac
3408 case "$fn" in
3409 *+*) skip=true;;
3410 esac
3411 case "$fn" in
3412 *n*) none_ok=true;;
3413 esac
3414 case "$fn" in
3415 *e*) exp_file=true;;
3416 esac
3417 case "$fn" in
3418 *p*) nopath_ok=true;;
3419 esac
3420
3421 case "$fn" in
3422 *f*) type='File';;
3423 *d*) type='Directory';;
3424 *l*) type='Locate';;
3425 esac
3426
3427 what="$type"
3428 case "$what" in
3429 Locate) what='File';;
3430 esac
3431
3432 case "$exp_file" in
3433 '')
3434         case "$d_portable" in
3435         "$define") ;;
3436         *) exp_file=true;;
3437         esac
3438         ;;
3439 esac
3440
3441 cd ..
3442 while test "$type"; do
3443         redo=''
3444         rp="$orig_rp"
3445         dflt="$orig_dflt"
3446         case "$tilde" in
3447         true) rp="$rp (~name ok)";;
3448         esac
3449         . UU/myread
3450         if test -f UU/getfile.ok && \
3451                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3452         then
3453                 value="$ans"
3454                 ansexp="$ans"
3455                 break
3456         fi
3457         case "$ans" in
3458         none)
3459                 value=''
3460                 ansexp=''
3461                 case "$none_ok" in
3462                 true) type='';;
3463                 esac
3464                 ;;
3465         *)
3466                 case "$tilde" in
3467                 '') value="$ans"
3468                         ansexp="$ans";;
3469                 *)
3470                         value=`UU/filexp $ans`
3471                         case $? in
3472                         0)
3473                                 if test "$ans" != "$value"; then
3474                                         echo "(That expands to $value on this system.)"
3475                                 fi
3476                                 ;;
3477                         *) value="$ans";;
3478                         esac
3479                         ansexp="$value"
3480                         case "$exp_file" in
3481                         '') value="$ans";;
3482                         esac
3483                         ;;
3484                 esac
3485                 case "$fullpath" in
3486                 true)
3487                         case "$ansexp" in
3488                         /*) value="$ansexp" ;;
3489                         [a-zA-Z]:/*) value="$ansexp" ;;
3490                         *)
3491                                 redo=true
3492                                 case "$already" in
3493                                 true)
3494                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3495                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3496                                         ;;
3497                                 *)
3498                                 echo "Please give a full path name, starting with slash." >&4
3499                                         case "$tilde" in
3500                                         true)
3501                                 echo "Note that using ~name is ok provided it expands well." >&4
3502                                                 already=true
3503                                                 ;;
3504                                         esac
3505                                 esac
3506                                 ;;
3507                         esac
3508                         ;;
3509                 esac
3510                 case "$redo" in
3511                 '')
3512                         case "$type" in
3513                         File)
3514                                 for fp in $gfpth; do
3515                                         if test "X$fp" = X.; then
3516                                             pf="$ansexp"
3517                                         else    
3518                                             pf="$fp/$ansexp"
3519                                         fi
3520                                         if test -f "$pf"; then
3521                                                 type=''
3522                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3523                                         then
3524                                                 echo "($value is not a plain file, but that's ok.)"
3525                                                 type=''
3526                                         fi
3527                                         if test X"$type" = X; then
3528                                             value="$pf"
3529                                             break
3530                                         fi
3531                                 done
3532                                 ;;
3533                         Directory)
3534                                 for fp in $gfpth; do
3535                                         if test "X$fp" = X.; then
3536                                             dir="$ans"
3537                                             direxp="$ansexp"
3538                                         else    
3539                                             dir="$fp/$ansexp"
3540                                             direxp="$fp/$ansexp"
3541                                         fi
3542                                         if test -d "$direxp"; then
3543                                                 type=''
3544                                                 value="$dir"
3545                                                 break
3546                                         fi
3547                                 done
3548                                 ;;
3549                         Locate)
3550                                 if test -d "$ansexp"; then
3551                                         echo "(Looking for $loc_file in directory $value.)"
3552                                         value="$value/$loc_file"
3553                                         ansexp="$ansexp/$loc_file"
3554                                 fi
3555                                 if test -f "$ansexp"; then
3556                                         type=''
3557                                 fi
3558                                 case "$nopath_ok" in
3559                                 true)   case "$value" in
3560                                         */*) ;;
3561                                         *)      echo "Assuming $value will be in people's path."
3562                                                 type=''
3563                                                 ;;
3564                                         esac
3565                                         ;;
3566                                 esac
3567                                 ;;
3568                         esac
3569
3570                         case "$skip" in
3571                         true) type='';
3572                         esac
3573
3574                         case "$type" in
3575                         '') ;;
3576                         *)
3577                                 if test "$fastread" = yes; then
3578                                         dflt=y
3579                                 else
3580                                         dflt=n
3581                                 fi
3582                                 rp="$what $value doesn't exist.  Use that name anyway?"
3583                                 . UU/myread
3584                                 dflt=''
3585                                 case "$ans" in
3586                                 y*) type='';;
3587                                 *) echo " ";;
3588                                 esac
3589                                 ;;
3590                         esac
3591                         ;;
3592                 esac
3593                 ;;
3594         esac
3595 done
3596 cd UU
3597 ans="$value"
3598 rp="$orig_rp"
3599 dflt="$orig_dflt"
3600 rm -f getfile.ok
3601 test "X$gfpthkeep" != Xy && gfpth=""
3602 EOSC
3603
3604 : What should the include directory be ?
3605 echo " "
3606 $echo $n "Hmm...  $c"
3607 dflt='/usr/include'
3608 incpath=''
3609 mips_type=''
3610 if $test -f /bin/mips && /bin/mips; then
3611         echo "Looks like a MIPS system..."
3612         $cat >usr.c <<'EOCP'
3613 #ifdef SYSTYPE_BSD43
3614 /bsd43
3615 #endif
3616 EOCP
3617         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3618                 dflt='/bsd43/usr/include'
3619                 incpath='/bsd43'
3620                 mips_type='BSD 4.3'
3621         else
3622                 mips_type='System V'
3623         fi
3624         $rm -f usr.c usr.out
3625         echo "and you're compiling with the $mips_type compiler and libraries."
3626         xxx_prompt=y
3627         echo "exit 0" >mips
3628 else
3629         echo "Doesn't look like a MIPS system."
3630         xxx_prompt=n
3631         echo "exit 1" >mips
3632 fi
3633 chmod +x mips
3634 $eunicefix mips
3635 case "$usrinc" in
3636 '') ;;
3637 *) dflt="$usrinc";;
3638 esac
3639 case "$xxx_prompt" in
3640 y)      fn=d/
3641         echo " "
3642         rp='Where are the include files you want to use?'
3643         . ./getfile
3644         usrinc="$ans"
3645         ;;
3646 *)      usrinc="$dflt"
3647         ;;
3648 esac
3649
3650 : Set private lib path
3651 case "$plibpth" in
3652 '') if ./mips; then
3653                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3654         fi;;
3655 esac
3656 case "$libpth" in
3657 ' ') dlist='';;
3658 '') dlist="$loclibpth $plibpth $glibpth";;
3659 *) dlist="$libpth";;
3660 esac
3661
3662 : Now check and see which directories actually exist, avoiding duplicates
3663 libpth=''
3664 for xxx in $dlist
3665 do
3666     if $test -d $xxx; then
3667                 case " $libpth " in
3668                 *" $xxx "*) ;;
3669                 *) libpth="$libpth $xxx";;
3670                 esac
3671     fi
3672 done
3673 $cat <<'EOM'
3674
3675 Some systems have incompatible or broken versions of libraries.  Among
3676 the directories listed in the question below, please remove any you
3677 know not to be holding relevant libraries, and add any that are needed.
3678 Say "none" for none.
3679
3680 EOM
3681 case "$libpth" in
3682 '') dflt='none';;
3683 *)
3684         set X $libpth
3685         shift
3686         dflt=${1+"$@"}
3687         ;;
3688 esac
3689 rp="Directories to use for library searches?"
3690 . ./myread
3691 case "$ans" in
3692 none) libpth=' ';;
3693 *) libpth="$ans";;
3694 esac
3695
3696 : compute shared library extension
3697 case "$so" in
3698 '')
3699         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3700                 dflt='sl'
3701         else
3702                 dflt='so'
3703         fi
3704         ;;
3705 *) dflt="$so";;
3706 esac
3707 $cat <<EOM
3708
3709 On some systems, shared libraries may be available.  Answer 'none' if
3710 you want to suppress searching of shared libraries for the remainder
3711 of this configuration.
3712
3713 EOM
3714 rp='What is the file extension used for shared libraries?'
3715 . ./myread
3716 so="$ans"
3717
3718 : Define several unixisms.
3719 : Hints files or command line option can be used to override them.
3720 : The convoluted testing is in case hints files set either the old
3721 : or the new name.
3722 case "$_exe" in
3723 '')     case "$exe_ext" in
3724     '') ;;
3725         *)      _exe="$exe_ext" ;;
3726         esac
3727         ;;
3728 esac
3729 case "$_a" in
3730 '')     case "$lib_ext" in
3731     '') _a='.a';;
3732         *)      _a="$lib_ext" ;;
3733         esac
3734         ;;
3735 esac
3736 case "$_o" in
3737 '') case "$obj_ext" in
3738         '')     _o='.o';;
3739         *)      _o="$obj_ext";;
3740         esac
3741         ;;
3742 esac
3743 case "$p_" in
3744 '') case "$path_sep" in
3745         '')     p_=':';;
3746         *)      p_="$path_sep";;
3747         esac
3748         ;;
3749 esac
3750 exe_ext=$_exe
3751 lib_ext=$_a
3752 obj_ext=$_o
3753 path_sep=$p_
3754
3755 : Which makefile gets called first.  This is used by make depend.
3756 case "$firstmakefile" in
3757 '') firstmakefile='makefile';;
3758 esac
3759
3760 case "$usesocks" in
3761 $define|true|[yY]*)     dflt='y';;
3762 *) dflt='n';;
3763 esac
3764 cat <<EOM
3765
3766 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3767 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3768 to use the PerlIO abstraction layer, this will be implicitly selected.
3769
3770 If this doesn't make any sense to you, just accept the default '$dflt'.
3771 EOM
3772 rp='Build Perl for SOCKS?'
3773 . ./myread
3774 case "$ans" in
3775 y|Y)    val="$define" ;;     
3776 *)      val="$undef" ;;
3777 esac
3778 set usesocks
3779 eval $setvar
3780
3781 case "$usesocks" in
3782 $define|true|[yY]*) useperlio="$define";;
3783 esac
3784
3785 : Looking for optional libraries
3786 echo " "
3787 echo "Checking for optional libraries..." >&4
3788 case "$libs" in
3789 ' '|'') dflt='';;
3790 *) dflt="$libs";;
3791 esac
3792 case "$libswanted" in
3793 '') libswanted='c_s';;
3794 esac
3795 case "$usesocks" in
3796 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3797 esac
3798 libsfound=''
3799 libsfiles=''
3800 libsdirs=''
3801 libspath=''
3802 for thisdir in $libpth $xlibpth; do
3803   test -d $thisdir && libspath="$libspath $thisdir"
3804 done
3805 for thislib in $libswanted; do
3806         for thisdir in $libspath; do
3807             xxx=''
3808             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3809                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3810                 $test -f "$xxx" && eval $libscheck
3811                 $test -f "$xxx" && libstyle=shared
3812             fi
3813             if test ! -f "$xxx"; then
3814                 xxx=$thisdir/lib$thislib.$so
3815                 $test -f "$xxx" && eval $libscheck
3816                 $test -f "$xxx" && libstyle=shared
3817             fi  
3818             if test ! -f "$xxx"; then
3819                 xxx=$thisdir/lib$thislib$_a
3820                 $test -f "$xxx" && eval $libscheck
3821                 $test -f "$xxx" && libstyle=static
3822             fi
3823             if test ! -f "$xxx"; then
3824                 xxx=$thisdir/$thislib$_a
3825                 $test -f "$xxx" && eval $libscheck
3826                 $test -f "$xxx" && libstyle=static
3827             fi
3828             if test ! -f "$xxx"; then
3829                 xxx=$thisdir/lib${thislib}_s$_a
3830                 $test -f "$xxx" && eval $libscheck
3831                 $test -f "$xxx" && libstyle=static
3832                 $test -f "$xxx" && thislib=${thislib}_s
3833             fi
3834             if test ! -f "$xxx"; then
3835                 xxx=$thisdir/Slib$thislib$_a
3836                 $test -f "$xxx" && eval $libscheck
3837                 $test -f "$xxx" && libstyle=static
3838             fi
3839             if $test -f "$xxx"; then
3840                 case "$libstyle" in
3841                 shared) echo "Found -l$thislib (shared)." ;;
3842                 static) echo "Found -l$thislib." ;;
3843                 *)      echo "Found -l$thislib ($libstyle)." ;;
3844                 esac
3845                 case " $dflt " in
3846                 *"-l$thislib "*);;
3847                 *) dflt="$dflt -l$thislib"
3848                    libsfound="$libsfound $xxx"
3849                    yyy=`basename $xxx`
3850                    libsfiles="$libsfiles $yyy"
3851                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3852                    case " $libsdirs " in
3853                    *" $yyy "*) ;;
3854                    *) libsdirs="$libsdirs $yyy" ;;
3855                    esac
3856                    ;;
3857                 esac
3858                 break
3859             fi  
3860         done
3861         if $test ! -f "$xxx"; then
3862             echo "No -l$thislib."
3863         fi
3864 done
3865 set X $dflt
3866 shift
3867 dflt="$*"
3868 case "$libs" in
3869 '') dflt="$dflt";;
3870 *) dflt="$libs";;
3871 esac
3872 case "$dflt" in
3873 ' '|'') dflt='none';;
3874 esac
3875
3876 $cat <<EOM
3877
3878 In order to compile $package on your machine, a number of libraries
3879 are usually needed.  Include any other special libraries here as well.
3880 Say "none" for none.  The default list is almost always right.
3881 EOM
3882
3883 echo " "
3884 rp="What libraries to use?"
3885 . ./myread
3886 case "$ans" in
3887 none) libs=' ';;
3888 *) libs="$ans";;
3889 esac
3890
3891 : determine optimization, if desired, or use for debug flag also
3892 case "$optimize" in
3893 ' '|$undef) dflt='none';;
3894 '') dflt='-O';;
3895 *) dflt="$optimize";;
3896 esac
3897 $cat <<EOH
3898
3899 By default, $package compiles with the -O flag to use the optimizer.
3900 Alternately, you might want to use the symbolic debugger, which uses
3901 the -g flag (on traditional Unix systems).  Either flag can be
3902 specified here.  To use neither flag, specify the word "none".
3903
3904 EOH
3905 rp="What optimizer/debugger flag should be used?"
3906 . ./myread
3907 optimize="$ans"
3908 case "$optimize" in
3909 'none') optimize=" ";;
3910 esac
3911
3912 dflt=''
3913 : We will not override a previous value, but we might want to
3914 : augment a hint file
3915 case "$hint" in
3916 default|recommended)
3917         case "$gccversion" in
3918         1*) dflt='-fpcc-struct-return' ;;
3919         esac
3920         case "$optimize" in
3921         *-g*) dflt="$dflt -DDEBUGGING";;
3922         esac
3923         case "$gccversion" in
3924         2*) if test -d /etc/conf/kconfig.d &&
3925                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3926                 then
3927                         dflt="$dflt -posix"
3928                 fi
3929                 ;;
3930         esac
3931         case "$gccversion" in
3932         1*) ;;
3933         2.[0-8]*) ;;
3934         ?*)     echo " "
3935                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3936                 echo 'int main(void) { return 0; }' > gcctest.c
3937                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3938                         echo "Yes, it does." 2>&1
3939                         case "$ccflags" in
3940                         *strict-aliasing*) 
3941                                 echo "Leaving current flags $ccflags alone." 2>&1
3942                                 ;;
3943                         *) dflt="$dflt -fno-strict-aliasing" ;;
3944                         esac
3945                 else
3946                         echo "Nope, it doesn't, but that's ok." 2>&1
3947                 fi
3948                 ;;
3949         esac
3950         ;;
3951 esac
3952
3953 case "$mips_type" in
3954 *BSD*|'') inclwanted="$locincpth $usrinc";;
3955 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3956 esac
3957 for thisincl in $inclwanted; do
3958         if $test -d $thisincl; then
3959                 if $test x$thisincl != x$usrinc; then
3960                         case "$dflt" in
3961                         *" -I$thisincl "*);;
3962                         *) dflt="$dflt -I$thisincl ";;
3963                         esac
3964                 fi
3965         fi
3966 done
3967
3968 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3969         xxx=true;
3970 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3971         xxx=true;
3972 else
3973         xxx=false;
3974 fi;
3975 if $xxx; then
3976         case "$dflt" in
3977         *$2*);;
3978         *) dflt="$dflt -D$2";;
3979         esac;
3980 fi'
3981
3982 set signal.h LANGUAGE_C; eval $inctest
3983
3984 case "$usesocks" in
3985 $define)
3986         ccflags="$ccflags -DSOCKS"
3987         ;;
3988 esac
3989
3990 case "$hint" in
3991 default|recommended) dflt="$ccflags $dflt" ;;
3992 *) dflt="$ccflags";;
3993 esac
3994
3995 case "$dflt" in
3996 ''|' ') dflt=none;;
3997 esac
3998
3999 $cat <<EOH
4000
4001 Your C compiler may want other flags.  For this question you should include
4002 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4003 but you should NOT include libraries or ld flags like -lwhatever.  If you
4004 want $package to honor its debug switch, you should include -DDEBUGGING here.
4005 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4006
4007 To use no flags, specify the word "none".
4008
4009 EOH
4010 set X $dflt
4011 shift
4012 dflt=${1+"$@"}
4013 rp="Any additional cc flags?"
4014 . ./myread
4015 case "$ans" in
4016 none) ccflags='';;
4017 *) ccflags="$ans";;
4018 esac
4019
4020 : the following weeds options from ccflags that are of no interest to cpp
4021 cppflags="$ccflags"
4022 case "$gccversion" in
4023 1*) cppflags="$cppflags -D__GNUC__"
4024 esac
4025 case "$mips_type" in
4026 '');;
4027 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4028 esac
4029 case "$cppflags" in
4030 '');;
4031 *)
4032         echo " "
4033         echo "Let me guess what the preprocessor flags are..." >&4
4034         set X $cppflags
4035         shift
4036         cppflags=''
4037         $cat >cpp.c <<'EOM'
4038 #define BLURFL foo
4039
4040 BLURFL xx LFRULB
4041 EOM
4042         previous=''
4043         for flag in $*
4044         do
4045                 case "$flag" in
4046                 -*) ftry="$flag";;
4047                 *) ftry="$previous $flag";;
4048                 esac
4049                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4050                         >cpp1.out 2>/dev/null && \
4051                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4052                         >cpp2.out 2>/dev/null && \
4053                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4054                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4055                 then
4056                         cppflags="$cppflags $ftry"
4057                         previous=''
4058                 else
4059                         previous="$flag"
4060                 fi
4061         done
4062         set X $cppflags
4063         shift
4064         cppflags=${1+"$@"}
4065         case "$cppflags" in
4066         *-*)  echo "They appear to be: $cppflags";;
4067         esac
4068         $rm -f cpp.c cpp?.out
4069         ;;
4070 esac
4071
4072 : flags used in final linking phase
4073 case "$ldflags" in
4074 '') if ./venix; then
4075                 dflt='-i -z'
4076         else
4077                 dflt=''
4078         fi
4079         case "$ccflags" in
4080         *-posix*) dflt="$dflt -posix" ;;
4081         esac
4082         ;;
4083 *) dflt="$ldflags";;
4084 esac
4085
4086 : Try to guess additional flags to pick up local libraries.
4087 for thislibdir in $libpth; do
4088         case " $loclibpth " in
4089         *" $thislibdir "*)
4090                 case "$dflt " in 
4091                 *"-L$thislibdir "*) ;;
4092                 *)  dflt="$dflt -L$thislibdir" ;;
4093                 esac
4094                 ;;
4095         esac
4096 done
4097
4098 case "$dflt" in
4099 '') dflt='none' ;;
4100 esac
4101
4102 $cat <<EOH
4103
4104 Your C linker may need flags.  For this question you should
4105 include -L/whatever and any other flags used by the C linker, but you
4106 should NOT include libraries like -lwhatever.
4107
4108 Make sure you include the appropriate -L/path flags if your C linker
4109 does not normally search all of the directories you specified above,
4110 namely
4111         $libpth
4112 To use no flags, specify the word "none".
4113
4114 EOH
4115
4116 rp="Any additional ld flags (NOT including libraries)?"
4117 . ./myread
4118 case "$ans" in
4119 none) ldflags='';;
4120 *) ldflags="$ans";;
4121 esac
4122 rmlist="$rmlist pdp11"
4123
4124 : coherency check
4125 echo " "
4126 echo "Checking your choice of C compiler and flags for coherency..." >&4
4127 $cat > try.c <<'EOF'
4128 #include <stdio.h>
4129 int main() { printf("Ok\n"); exit(0); }
4130 EOF
4131 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4132 shift
4133 $cat >try.msg <<'EOM'
4134 I've tried to compile and run the following simple program:
4135
4136 EOM
4137 $cat try.c >> try.msg
4138
4139 $cat >> try.msg <<EOM
4140
4141 I used the command:
4142
4143         $*
4144         ./try
4145
4146 and I got the following output:
4147
4148 EOM
4149 dflt=y
4150 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4151         if $sh -c './try' >>try.msg 2>&1; then
4152                 xxx=`./try`
4153                 case "$xxx" in
4154                 "Ok") dflt=n ;;
4155                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4156                         case " $libs " in
4157                         *" -lsfio "*)
4158                                 cat >> try.msg <<'EOQS'
4159 If $libs contains -lsfio, and sfio is mis-configured, then it
4160 sometimes (apparently) runs and exits with a 0 status, but with no
4161 output!  It may have to do with sfio's use of _exit vs. exit.
4162
4163 EOQS
4164                                 rp="You have a big problem.  Shall I abort Configure"
4165                                 dflt=y
4166                                 ;;
4167                         esac
4168                         ;;
4169                 esac
4170         else
4171                 echo "The program compiled OK, but exited with status $?." >>try.msg
4172                 rp="You have a problem.  Shall I abort Configure"
4173                 dflt=y
4174         fi
4175 else
4176         echo "I can't compile the test program." >>try.msg
4177         rp="You have a BIG problem.  Shall I abort Configure"
4178         dflt=y
4179 fi
4180 case "$dflt" in
4181 y)
4182         $cat try.msg >&4
4183         case "$knowitall" in
4184         '')
4185                 echo "(The supplied flags or libraries might be incorrect.)"
4186                 ;;
4187         *) dflt=n;;
4188         esac
4189         echo " "
4190         . ./myread
4191         case "$ans" in
4192         n*|N*) ;;
4193         *)      echo "Ok.  Stopping Configure." >&4
4194                 exit 1
4195                 ;;
4196         esac
4197         ;;
4198 n) echo "OK, that should do.";;
4199 esac
4200 $rm -f try try.* core
4201
4202 : define an is-a-typedef? function
4203 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4204 case "$inclist" in
4205 "") inclist="sys/types.h";;
4206 esac;
4207 eval "varval=\$$var";
4208 case "$varval" in
4209 "")
4210         $rm -f temp.c;
4211         for inc in $inclist; do
4212                 echo "#include <$inc>" >>temp.c;
4213         done;
4214         echo "#ifdef $type" >> temp.c;
4215         echo "printf(\"We have $type\");" >> temp.c;
4216         echo "#endif" >> temp.c;
4217         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4218         if $contains $type temp.E >/dev/null 2>&1; then
4219                 eval "$var=\$type";
4220         else
4221                 eval "$var=\$def";
4222         fi;
4223         $rm -f temp.?;;
4224 *) eval "$var=\$varval";;
4225 esac'
4226
4227 : define an is-a-typedef? function that prompts if the type is not available.
4228 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4229 case "$inclist" in
4230 "") inclist="sys/types.h";;
4231 esac;
4232 eval "varval=\$$var";
4233 case "$varval" in
4234 "")
4235         $rm -f temp.c;
4236         for inc in $inclist; do
4237                 echo "#include <$inc>" >>temp.c;
4238         done;
4239         echo "#ifdef $type" >> temp.c;
4240         echo "printf(\"We have $type\");" >> temp.c;
4241         echo "#endif" >> temp.c;
4242         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4243         echo " " ;
4244         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4245         if $contains $type temp.E >/dev/null 2>&1; then
4246                 echo "$type found." >&4;
4247                 eval "$var=\$type";
4248         else
4249                 echo "$type NOT found." >&4;
4250                 dflt="$def";
4251                 . ./myread ;
4252                 eval "$var=\$ans";
4253         fi;
4254         $rm -f temp.?;;
4255 *) eval "$var=\$varval";;
4256 esac'
4257
4258 : define a shorthand compile call
4259 compile='
4260 mc_file=$1;
4261 shift;
4262 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4263 : define a shorthand compile call for compilations that should be ok.
4264 compile_ok='
4265 mc_file=$1;
4266 shift;
4267 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4268
4269 : check for lengths of integral types
4270 echo " "
4271 case "$intsize" in
4272 '')
4273         echo "Checking to see how big your integers are..." >&4
4274         $cat >intsize.c <<'EOCP'
4275 #include <stdio.h>
4276 int main()
4277 {
4278         printf("intsize=%d;\n", (int)sizeof(int));
4279         printf("longsize=%d;\n", (int)sizeof(long));
4280         printf("shortsize=%d;\n", (int)sizeof(short));
4281         exit(0);
4282 }
4283 EOCP
4284         set intsize
4285         if eval $compile_ok && ./intsize > /dev/null; then
4286                 eval `./intsize`
4287                 echo "Your integers are $intsize bytes long."
4288                 echo "Your long integers are $longsize bytes long."
4289                 echo "Your short integers are $shortsize bytes long."
4290         else
4291                 $cat >&4 <<EOM
4292 !
4293 Help! I can't compile and run the intsize test program: please enlighten me!
4294 (This is probably a misconfiguration in your system or libraries, and
4295 you really ought to fix it.  Still, I'll try anyway.)
4296 !
4297 EOM
4298                 dflt=4
4299                 rp="What is the size of an integer (in bytes)?"
4300                 . ./myread
4301                 intsize="$ans"
4302                 dflt=$intsize
4303                 rp="What is the size of a long integer (in bytes)?"
4304                 . ./myread
4305                 longsize="$ans"
4306                 dflt=2
4307                 rp="What is the size of a short integer (in bytes)?"
4308                 . ./myread
4309                 shortsize="$ans"
4310         fi
4311         ;;
4312 esac
4313 $rm -f intsize intsize.*
4314
4315 : see what type lseek is declared as in the kernel
4316 rp="What is the type used for lseek's offset on this system?"
4317 set off_t lseektype long stdio.h sys/types.h
4318 eval $typedef_ask
4319
4320 echo " "
4321 echo "Checking to see how big your file offsets are..." >&4
4322 $cat >try.c <<EOCP
4323 #include <sys/types.h>
4324 #include <stdio.h>
4325 int main()
4326 {
4327     printf("%d\n", (int)sizeof($lseektype));
4328     return(0); 
4329 }
4330 EOCP
4331 set try
4332 if eval $compile_ok; then
4333         lseeksize=`./try`
4334         echo "Your file offsets are $lseeksize bytes long."
4335 else
4336         dflt=$longsize
4337         echo " "
4338         echo "(I can't seem to compile the test program.  Guessing...)"
4339         rp="What is the size of your file offsets (in bytes)?"
4340         . ./myread
4341         lseeksize="$ans"
4342 fi
4343 $rm -f try.c try
4344
4345 : see what type file positions are declared as in the library
4346 rp="What is the type for file position used by fsetpos()?"
4347 set fpos_t fpostype long stdio.h sys/types.h
4348 eval $typedef_ask
4349
4350 echo " "
4351 case "$fpostype" in
4352 *_t) zzz="$fpostype"    ;;
4353 *)   zzz="fpos_t"       ;;
4354 esac
4355 echo "Checking the size of $zzz..." >&4 
4356 cat > try.c <<EOCP
4357 #include <sys/types.h>
4358 #include <stdio.h>
4359 int main() {
4360     printf("%d\n", (int)sizeof($fpostype));
4361     exit(0);
4362 }
4363 EOCP
4364 set try
4365 if eval $compile_ok; then
4366         yyy=`./try`
4367         case "$yyy" in
4368         '')     fpossize=4
4369                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4370                 ;;
4371         *)      fpossize=$yyy
4372                 echo "Your $zzz is $fpossize bytes long."
4373                 ;;
4374         esac
4375 else
4376         dflt="$longsize"
4377         echo " " >&4
4378         echo "(I can't compile the test program.  Guessing...)" >&4
4379         rp="What is the size of your file positions (in bytes)?"
4380         . ./myread
4381         fpossize="$ans"
4382 fi
4383
4384
4385
4386 # Backward compatibility (uselfs is deprecated).
4387 case "$uselfs" in
4388 "$define"|true|[yY]*)
4389         cat <<EOM >&4
4390
4391 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4392 EOM
4393         uselargefiles="$define"
4394         ;;
4395 esac                          
4396
4397 case "$lseeksize:$fpossize" in
4398 8:8) cat <<EOM
4399
4400 You can have files larger than 2 gigabytes.
4401 EOM
4402    val="$define" ;;
4403 *)    case "$uselargefiles" in
4404    "$undef"|false|[nN]*) dflt='n' ;;
4405    *)   dflt='y' ;;
4406    esac
4407    cat <<EOM
4408
4409 Perl can be built to understand large files (files larger than 2 gigabytes)
4410 on some systems.  To do so, Configure can be run with -Duselargefiles.
4411
4412 If this doesn't make any sense to you, just accept the default '$dflt'.
4413 EOM
4414    rp='Try to understand large files, if available?'
4415    . ./myread
4416    case "$ans" in
4417    y|Y)         val="$define" ;;
4418    *)           val="$undef"  ;;
4419    esac
4420    ;;
4421 esac
4422 set uselargefiles
4423 eval $setvar
4424 case "$uselargefiles" in
4425 "$define")
4426 : Look for a hint-file generated 'call-back-unit'.  If the
4427 : user has specified that a large files perl is to be built,
4428 : we may need to set or change some other defaults.
4429         if $test -f uselargefiles.cbu; then
4430                 echo "Your platform has some specific hints for large file builds, using them..."
4431                 . ./uselargefiles.cbu
4432                 echo " "
4433                 echo "Rechecking to see how big your file offsets are..." >&4
4434                 $cat >try.c <<EOCP
4435 #include <sys/types.h>
4436 #include <stdio.h>
4437 int main()
4438 {
4439     printf("%d\n", (int)sizeof($lseektype));
4440     return(0); 
4441 }
4442 EOCP
4443                 set try
4444                 if eval $compile_ok; then
4445                         lseeksize=`./try`
4446                         $echo "Your file offsets are now $lseeksize bytes long."
4447                 else
4448                         dflt="$lseeksize"
4449                         echo " "
4450                         echo "(I can't seem to compile the test program.  Guessing...)"
4451                         rp="What is the size of your file offsets (in bytes)?"
4452                         . ./myread
4453                         lseeksize="$ans"
4454                 fi
4455                 case "$fpostype" in
4456                 *_t) zzz="$fpostype"    ;;
4457                 *)   zzz="fpos_t"       ;;
4458                 esac
4459                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4460                 $cat > try.c <<EOCP
4461 #include <sys/types.h>
4462 #include <stdio.h>
4463 int main() {
4464     printf("%d\n", (int)sizeof($fpostype));
4465     exit(0);
4466 }
4467 EOCP
4468                 set try
4469                 if eval $compile_ok; then
4470                         yyy=`./try`
4471                         dflt="$lseeksize"
4472                         case "$yyy" in
4473                         '')     echo " "
4474                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4475                                 ;;
4476                         *)      fpossize=$yyy
4477                                 echo " $fpossize bytes." >&4
4478                                 ;;
4479                         esac
4480                 else
4481                         dflt="$fpossize"
4482                         echo " "
4483                         echo "(I can't compile the test program.  Guessing...)" >&4
4484                         rp="What is the size of your file positions (in bytes)?"
4485                         . ./myread
4486                         fpossize="$ans"
4487                 fi
4488                 $rm -f try.c try
4489         fi
4490         ;;
4491 esac
4492
4493
4494 case "$usemorebits" in
4495 "$define"|true|[yY]*)
4496         use64bitint="$define"
4497         uselongdouble="$define"
4498         usemorebits="$define"
4499         ;;
4500 *)      usemorebits="$undef"
4501         ;;
4502 esac
4503
4504
4505 case "$uselonglong" in
4506 "$define"|true|[yY]*)
4507         cat <<EOM >&4
4508
4509 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4510 EOM
4511         use64bitint="$define"
4512         ;;
4513 esac                          
4514 case "$use64bits" in
4515 "$define"|true|[yY]*)
4516         cat <<EOM >&4
4517
4518 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4519 EOM
4520         use64bitint="$define"
4521         ;;
4522 esac                          
4523 case "$use64bitints" in
4524 "$define"|true|[yY]*)
4525         cat <<EOM >&4
4526
4527 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4528 EOM
4529         use64bitint="$define"
4530         ;;
4531 esac                          
4532 case "$use64bitsint" in
4533 "$define"|true|[yY]*)
4534         cat <<EOM >&4
4535
4536 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4537 EOM
4538         use64bitint="$define"
4539         ;;
4540 esac                          
4541 case "$uselonglongs" in
4542 "$define"|true|[yY]*)
4543         cat <<EOM >&4
4544
4545 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4546 EOM
4547         use64bitint="$define"
4548         ;;
4549 esac                          
4550 case "$use64bitsall" in
4551 "$define"|true|[yY]*)
4552         cat <<EOM >&4
4553
4554 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4555 EOM
4556         use64bitall="$define"
4557         ;;
4558 esac                          
4559
4560 case "$ccflags" in
4561 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4562 esac
4563 case "$use64bitall" in
4564 "$define"|true|[yY]*) use64bitint="$define" ;;
4565 esac
4566
4567 case "$longsize" in
4568 8) cat <<EOM
4569
4570 You have natively 64-bit long integers.
4571 EOM
4572    val="$define"
4573    ;;
4574 *) case "$use64bitint" in
4575    "$define"|true|[yY]*) dflt='y';;
4576    *) dflt='n';;
4577    esac
4578    cat <<EOM
4579
4580 Perl can be built to take advantage of 64-bit integer types
4581 on some systems.  To do so, Configure can be run with -Duse64bitint.
4582 Choosing this option will most probably introduce binary incompatibilities.
4583
4584 If this doesn't make any sense to you, just accept the default '$dflt'.
4585 EOM
4586    rp='Try to use 64-bit integers, if available?'
4587    . ./myread
4588    case "$ans" in
4589    [yY]*) val="$define" ;;
4590    *)     val="$undef"  ;;
4591    esac
4592    ;;
4593 esac
4594 set use64bitint
4595 eval $setvar
4596
4597 case "$use64bitall" in
4598 "$define"|true|[yY]*) dflt='y' ;;
4599 *) case "$longsize" in
4600    8) dflt='y' ;;
4601    *) dflt='n' ;;
4602    esac
4603    ;;
4604 esac    
4605 cat <<EOM
4606
4607 You may also choose to try maximal 64-bitness.  It means using as much
4608 64-bitness as possible on the platform.  This in turn means even more
4609 binary incompatibilities.  On the other hand, your platform may not
4610 have any more 64-bitness available than what you already have chosen.
4611
4612 If this doesn't make any sense to you, just accept the default '$dflt'.
4613 EOM
4614 rp='Try to use maximal 64-bit support, if available?'
4615 . ./myread
4616 case "$ans" in
4617 [yY]*) val="$define" ;;
4618 *)     val="$undef"  ;;
4619 esac
4620 set use64bitall
4621 eval $setvar
4622 case "$use64bitall" in
4623 "$define")
4624         case "$use64bitint" in
4625         "$undef")
4626                 cat <<EOM
4627
4628 Since you have chosen a maximally 64-bit build, I'm also turning on
4629 the use of 64-bit integers.
4630 EOM
4631                 use64bitint="$define" ;;
4632         esac
4633         ;;
4634 esac
4635
4636 case "$use64bitint" in
4637 "$define"|true|[yY]*)
4638 : Look for a hint-file generated 'call-back-unit'.  If the
4639 : user has specified that a 64-bit perl is to be built,
4640 : we may need to set or change some other defaults.
4641         if $test -f use64bitint.cbu; then
4642                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4643                 . ./use64bitint.cbu
4644         fi
4645         case "$longsize" in
4646         4) case "$archname64" in
4647            '') archname64=64int ;;
4648            esac
4649            ;;
4650         esac
4651         ;;
4652 esac
4653
4654 case "$use64bitall" in
4655 "$define"|true|[yY]*)
4656 : Look for a hint-file generated 'call-back-unit'.  If the
4657 : user has specified that a maximally 64-bit perl is to be built,
4658 : we may need to set or change some other defaults.
4659         if $test -f use64bitall.cbu; then
4660                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4661                 . ./use64bitall.cbu
4662         fi
4663         case "$longsize" in
4664         4) case "$archname64" in
4665            ''|64int) archname64=64all ;;
4666            esac
4667            ;;
4668         esac
4669         ;;
4670 esac
4671
4672 echo " "
4673 echo "Checking for GNU C Library..." >&4
4674 cat >gnulibc.c <<EOM
4675 #include <stdio.h>
4676 int main()
4677 {
4678 #ifdef __GLIBC__
4679     exit(0);
4680 #else
4681     exit(1);
4682 #endif
4683 }
4684 EOM
4685 set gnulibc
4686 if eval $compile_ok && ./gnulibc; then
4687         val="$define"
4688         echo "You are using the GNU C Library"
4689 else
4690         val="$undef"
4691         echo "You are not using the GNU C Library"
4692 fi
4693 $rm -f gnulibc*
4694 set d_gnulibc
4695 eval $setvar
4696
4697 : see if nm is to be used to determine whether a symbol is defined or not
4698 case "$usenm" in
4699 '')
4700         dflt=''
4701         case "$d_gnulibc" in
4702         "$define")
4703                 echo " "
4704                 echo "nm probably won't work on the GNU C Library." >&4
4705                 dflt=n
4706                 ;;
4707         esac
4708         case "$dflt" in
4709         '') 
4710                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4711                         echo " "
4712                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4713                         echo "'nm' won't be sufficient on this sytem." >&4
4714                         dflt=n
4715                 fi
4716                 ;;
4717         esac
4718         case "$dflt" in
4719         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4720                 if $test $dflt -gt 20; then
4721                         dflt=y
4722                 else
4723                         dflt=n
4724                 fi
4725                 ;;
4726         esac
4727         ;;
4728 *)
4729         case "$usenm" in
4730         true|$define) dflt=y;;
4731         *) dflt=n;;
4732         esac
4733         ;;
4734 esac
4735 $cat <<EOM
4736
4737 I can use $nm to extract the symbols from your C libraries. This
4738 is a time consuming task which may generate huge output on the disk (up
4739 to 3 megabytes) but that should make the symbols extraction faster. The
4740 alternative is to skip the 'nm' extraction part and to compile a small
4741 test program instead to determine whether each symbol is present. If
4742 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4743 this may be the best solution.
4744
4745 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4746
4747 EOM
4748 rp="Shall I use $nm to extract C symbols from the libraries?"
4749 . ./myread
4750 case "$ans" in
4751 [Nn]*) usenm=false;;
4752 *) usenm=true;;
4753 esac
4754
4755 runnm=$usenm
4756 case "$reuseval" in
4757 true) runnm=false;;
4758 esac
4759
4760 : nm options which may be necessary
4761 case "$nm_opt" in
4762 '') if $test -f /mach_boot; then
4763                 nm_opt=''       # Mach
4764         elif $test -d /usr/ccs/lib; then
4765                 nm_opt='-p'     # Solaris (and SunOS?)
4766         elif $test -f /dgux; then
4767                 nm_opt='-p'     # DG-UX
4768         elif $test -f /lib64/rld; then
4769                 nm_opt='-p'     # 64-bit Irix
4770         else
4771                 nm_opt=''
4772         fi;;
4773 esac
4774
4775 : nm options which may be necessary for shared libraries but illegal
4776 : for archive libraries.  Thank you, Linux.
4777 case "$nm_so_opt" in
4778 '')     case "$myuname" in
4779         *linux*)
4780                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4781                         nm_so_opt='--dynamic'
4782                 fi
4783                 ;;
4784         esac
4785         ;;
4786 esac
4787
4788 case "$runnm" in
4789 true)
4790 : get list of predefined functions in a handy place
4791 echo " "
4792 case "$libc" in
4793 '') libc=unknown
4794         case "$libs" in
4795         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4796         esac
4797         ;;
4798 esac
4799 libnames='';
4800 case "$libs" in
4801 '') ;;
4802 *)  for thislib in $libs; do
4803         case "$thislib" in
4804         -lc|-lc_s)
4805                 : Handle C library specially below.
4806                 ;;
4807         -l*)
4808                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4809                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4810                         :
4811                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4812                         :
4813                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4814                         :
4815                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4816                         :
4817                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4818                         :
4819                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4820                         :
4821                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4822                         :
4823                 else
4824                         try=''
4825                 fi
4826                 libnames="$libnames $try"
4827                 ;;
4828         *) libnames="$libnames $thislib" ;;
4829         esac
4830         done
4831         ;;
4832 esac
4833 xxx=normal
4834 case "$libc" in
4835 unknown)
4836         set /lib/libc.$so
4837         for xxx in $libpth; do
4838                 $test -r $1 || set $xxx/libc.$so
4839                 : The messy sed command sorts on library version numbers.
4840                 $test -r $1 || \
4841                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4842                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4843                                 h
4844                                 s/[0-9][0-9]*/0000&/g
4845                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4846                                 G
4847                                 s/\n/ /' | \
4848                          $sort | $sed -e 's/^.* //'`
4849                 eval set \$$#
4850         done
4851         $test -r $1 || set /usr/ccs/lib/libc.$so
4852         $test -r $1 || set /lib/libsys_s$_a
4853         ;;
4854 *)
4855         set blurfl
4856         ;;
4857 esac
4858 if $test -r "$1"; then
4859         echo "Your (shared) C library seems to be in $1."
4860         libc="$1"
4861 elif $test -r /lib/libc && $test -r /lib/clib; then
4862         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4863         xxx=apollo
4864         libc='/lib/clib /lib/libc'
4865         if $test -r /lib/syslib; then
4866                 echo "(Your math library is in /lib/syslib.)"
4867                 libc="$libc /lib/syslib"
4868         fi
4869 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4870         echo "Your C library seems to be in $libc, as you said before."
4871 elif $test -r $incpath/usr/lib/libc$_a; then
4872         libc=$incpath/usr/lib/libc$_a;
4873         echo "Your C library seems to be in $libc.  That's fine."
4874 elif $test -r /lib/libc$_a; then
4875         libc=/lib/libc$_a;
4876         echo "Your C library seems to be in $libc.  You're normal."
4877 else
4878         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4879                 :
4880         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4881                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4882         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4883                 :
4884         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4885                 :
4886         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4887                 :
4888         else
4889                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4890         fi
4891         if $test -r "$tans"; then
4892                 echo "Your C library seems to be in $tans, of all places."
4893                 libc=$tans
4894         else
4895                 libc='blurfl'
4896         fi
4897 fi
4898 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4899         dflt="$libc"
4900         cat <<EOM
4901
4902 If the guess above is wrong (which it might be if you're using a strange
4903 compiler, or your machine supports multiple models), you can override it here.
4904
4905 EOM
4906 else
4907         dflt=''
4908         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4909         cat >&4 <<EOM
4910 I can't seem to find your C library.  I've looked in the following places:
4911
4912 EOM
4913         $sed 's/^/      /' libpath
4914         cat <<EOM
4915
4916 None of these seems to contain your C library. I need to get its name...
4917
4918 EOM
4919 fi
4920 fn=f
4921 rp='Where is your C library?'
4922 . ./getfile
4923 libc="$ans"
4924
4925 echo " "
4926 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4927 set X `cat libnames`
4928 shift
4929 xxx=files
4930 case $# in 1) xxx=file; esac
4931 echo "Extracting names from the following $xxx for later perusal:" >&4
4932 echo " "
4933 $sed 's/^/      /' libnames >&4
4934 echo " "
4935 $echo $n "This may take a while...$c" >&4
4936
4937 for file in $*; do
4938         case $file in
4939         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4940         *) $nm $nm_opt $file 2>/dev/null;;
4941         esac
4942 done >libc.tmp
4943
4944 $echo $n ".$c"
4945 $grep fprintf libc.tmp > libc.ptf
4946 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4947 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4948 xxx='[ADTSIW]'
4949 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4950         eval $xscan;\
4951         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4952                 eval $xrun
4953 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4954         eval $xscan;\
4955         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4956                 eval $xrun
4957 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4958         eval $xscan;\
4959         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4960                 eval $xrun
4961 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4962         eval $xscan;\
4963         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4964                 eval $xrun
4965 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4966         eval $xscan;\
4967         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4968                 eval $xrun
4969 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4970         eval $xscan;\
4971         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4972                 eval $xrun
4973 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4974                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4975         eval $xscan;\
4976         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4977                 eval $xrun
4978 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4979         eval $xscan;\
4980         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4981                 eval $xrun
4982 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4983         eval $xscan;\
4984         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4985                 eval $xrun
4986 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4987         eval $xscan;\
4988         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4989                 eval $xrun
4990 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4991         eval $xscan;\
4992         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4993                 eval $xrun
4994 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4995         eval $xscan;\
4996         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4997                 eval $xrun
4998 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4999         eval $xscan;\
5000         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5001                 eval $xrun
5002 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5003         eval $xscan;\
5004         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5005                 eval $xrun
5006 else
5007         $nm -p $* 2>/dev/null >libc.tmp
5008         $grep fprintf libc.tmp > libc.ptf
5009         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5010                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5011         then
5012                 nm_opt='-p'
5013                 eval $xrun
5014         else
5015                 echo " "
5016                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5017                 com=''
5018                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5019                         for thisname in $libnames $libc; do
5020                                 $ar t $thisname >>libc.tmp
5021                         done
5022                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5023                         echo "Ok." >&4
5024                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5025                         # Repeat libc to extract forwarders to DLL entries too
5026                         for thisname in $libnames $libc; do
5027                                 $ar tv $thisname >>libc.tmp
5028                                 # Revision 50 of EMX has bug in $ar.
5029                                 # it will not extract forwarders to DLL entries
5030                                 # Use emximp which will extract exactly them.
5031                                 emximp -o tmp.imp $thisname \
5032                                     2>/dev/null && \
5033                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5034                                     < tmp.imp >>libc.tmp
5035                                 $rm tmp.imp
5036                         done
5037                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5038                         echo "Ok." >&4
5039                 else
5040                         echo "$ar didn't seem to work right." >&4
5041                         echo "Maybe this is a Cray...trying bld instead..." >&4
5042                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5043                         then
5044                                 for thisname in $libnames; do
5045                                         bld t $libnames | \
5046                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5047                                         $ar t $thisname >>libc.tmp
5048                                 done
5049                                 echo "Ok." >&4
5050                         else
5051                                 echo "That didn't work either.  Giving up." >&4
5052                                 exit 1
5053                         fi
5054                 fi
5055         fi
5056 fi
5057 nm_extract="$com"
5058 if $test -f /lib/syscalls.exp; then
5059         echo " "
5060         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5061         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5062 fi
5063 ;;
5064 esac
5065 $rm -f libnames libpath
5066
5067 : is a C symbol defined?
5068 csym='tlook=$1;
5069 case "$3" in
5070 -v) tf=libc.tmp; tc=""; tdc="";;
5071 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5072 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5073 esac;
5074 tx=yes;
5075 case "$reuseval-$4" in
5076 true-) ;;
5077 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5078 esac;
5079 case "$tx" in
5080 yes)
5081         case "$runnm" in
5082         true)
5083                 if $contains $tlook $tf >/dev/null 2>&1;
5084                 then tval=true;
5085                 else tval=false;
5086                 fi;;
5087         *)
5088                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5089                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5090                 then tval=true;
5091                 else tval=false;
5092                 fi;
5093                 $rm -f t t.c;;
5094         esac;;
5095 *)
5096         case "$tval" in
5097         $define) tval=true;;
5098         *) tval=false;;
5099         esac;;
5100 esac;
5101 eval "$2=$tval"'
5102
5103 : define an is-in-libc? function
5104 inlibc='echo " "; td=$define; tu=$undef;
5105 sym=$1; var=$2; eval "was=\$$2";
5106 tx=yes;
5107 case "$reuseval$was" in
5108 true) ;;
5109 true*) tx=no;;
5110 esac;
5111 case "$tx" in
5112 yes)
5113         set $sym tres -f;
5114         eval $csym;
5115         case "$tres" in
5116         true)
5117                 echo "$sym() found." >&4;
5118                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5119         *)
5120                 echo "$sym() NOT found." >&4;
5121                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5122         esac;;
5123 *)
5124         case "$was" in
5125         $define) echo "$sym() found." >&4;;
5126         *) echo "$sym() NOT found." >&4;;
5127         esac;;
5128 esac'
5129
5130 : see if sqrtl exists
5131 set sqrtl d_sqrtl
5132 eval $inlibc
5133
5134 case "$ccflags" in
5135 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5136 esac
5137
5138 case "$uselongdouble" in
5139 $define|true|[yY]*)     dflt='y';;
5140 *) dflt='n';;
5141 esac
5142 cat <<EOM
5143
5144 Perl can be built to take advantage of long doubles which
5145 (if available) may give more accuracy and range for floating point numbers.
5146
5147 If this doesn't make any sense to you, just accept the default '$dflt'.
5148 EOM
5149 rp='Try to use long doubles if available?'
5150 . ./myread
5151 case "$ans" in
5152 y|Y)    val="$define"   ;;
5153 *)      val="$undef"    ;;
5154 esac
5155 set uselongdouble
5156 eval $setvar
5157
5158 case "$uselongdouble" in
5159 true|[yY]*) uselongdouble="$define" ;;
5160 esac
5161
5162 case "$uselongdouble" in
5163 $define)
5164 : Look for a hint-file generated 'call-back-unit'.  If the
5165 : user has specified that long doubles should be used,
5166 : we may need to set or change some other defaults.
5167         if $test -f uselongdouble.cbu; then
5168                 echo "Your platform has some specific hints for long doubles, using them..."
5169                 . ./uselongdouble.cbu
5170         else
5171                 $cat <<EOM
5172 (Your platform doesn't have any specific hints for long doubles.)
5173 EOM
5174         fi
5175         ;;
5176 esac
5177
5178 case "$uselongdouble:$d_sqrtl" in
5179 $define:$undef)
5180                 $cat <<EOM >&4
5181
5182 *** You requested the use of long doubles but you do not seem to have
5183 *** the mathematic functions for long doubles.  I'm disabling the use
5184 *** of long doubles.
5185
5186 EOM
5187         uselongdouble=$undef
5188         ;;
5189 esac
5190
5191 : check for length of double
5192 echo " "
5193 case "$doublesize" in
5194 '')
5195         echo "Checking to see how big your double precision numbers are..." >&4
5196         $cat >try.c <<'EOCP'
5197 #include <stdio.h>
5198 int main()
5199 {
5200     printf("%d\n", (int)sizeof(double));
5201     exit(0);
5202 }
5203 EOCP
5204         set try
5205         if eval $compile_ok; then
5206                 doublesize=`./try`
5207                 echo "Your double is $doublesize bytes long."
5208         else
5209                 dflt='8'
5210                 echo "(I can't seem to compile the test program.  Guessing...)"
5211                 rp="What is the size of a double precision number (in bytes)?"
5212                 . ./myread
5213                 doublesize="$ans"
5214         fi
5215         ;;
5216 esac
5217 $rm -f try.c try
5218
5219 : check for long doubles
5220 echo " "
5221 echo "Checking to see if you have long double..." >&4
5222 echo 'int main() { long double x = 7.0; }' > try.c
5223 set try
5224 if eval $compile; then
5225         val="$define"
5226         echo "You have long double."
5227 else
5228         val="$undef"
5229         echo "You do not have long double."
5230 fi
5231 $rm try.*
5232 set d_longdbl
5233 eval $setvar
5234
5235 : check for length of long double
5236 case "${d_longdbl}${longdblsize}" in
5237 $define)
5238         echo " "
5239         echo "Checking to see how big your long doubles are..." >&4
5240         $cat >try.c <<'EOCP'
5241 #include <stdio.h>
5242 int main()
5243 {
5244         printf("%d\n", sizeof(long double));
5245 }
5246 EOCP
5247         set try
5248         set try
5249         if eval $compile; then
5250                 longdblsize=`./try$exe_ext`
5251                 echo "Your long doubles are $longdblsize bytes long."
5252         else
5253                 dflt='8'
5254                 echo " "
5255                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5256                 rp="What is the size of a long double (in bytes)?"
5257                 . ./myread
5258                 longdblsize="$ans"
5259         fi
5260         if $test "X$doublesize" = "X$longdblsize"; then
5261                 echo "(That isn't any different from an ordinary double.)"
5262         fi      
5263         ;;
5264 esac
5265 $rm -f try.* try
5266
5267 : determine the architecture name
5268 echo " "
5269 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5270         tarch=`arch`"-$osname"
5271 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5272         if uname -m > tmparch 2>&1 ; then
5273                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5274                         -e 's/$/'"-$osname/" tmparch`
5275         else
5276                 tarch="$osname"
5277         fi
5278         $rm -f tmparch
5279 else
5280         tarch="$osname"
5281 fi
5282 case "$myarchname" in
5283 ''|"$tarch") ;;
5284 *)
5285         echo "(Your architecture name used to be $myarchname.)"
5286         archname=''
5287         ;;
5288 esac
5289 myarchname="$tarch"
5290 case "$archname" in
5291 '') dflt="$tarch";;
5292 *) dflt="$archname";;
5293 esac
5294 rp='What is your architecture name'
5295 . ./myread
5296 archname="$ans"
5297 case "$usethreads" in
5298 $define)
5299         echo "Threads selected." >&4
5300         case "$archname" in
5301         *-thread*) echo "...and architecture name already has -thread." >&4
5302                 ;;
5303         *)      archname="$archname-thread"
5304                 echo "...setting architecture name to $archname." >&4
5305                 ;;
5306         esac
5307         ;;
5308 esac
5309 case "$usemultiplicity" in
5310 $define)
5311         echo "Multiplicity selected." >&4
5312         case "$archname" in
5313         *-multi*) echo "...and architecture name already has -multi." >&4
5314                 ;;
5315         *)      archname="$archname-multi"
5316                 echo "...setting architecture name to $archname." >&4
5317                 ;;
5318         esac
5319         ;;
5320 esac
5321 case "$use64bitint$use64bitall" in
5322 *"$define"*)
5323         case "$archname64" in
5324         '')
5325                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5326                 ;;
5327         *)
5328                 case "$use64bitint" in
5329                 "$define") echo "64 bit integers selected." >&4 ;;
5330                 esac
5331                 case "$use64bitall" in
5332                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5333                 esac
5334                 case "$archname" in
5335                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5336                         ;;
5337                 *)      archname="$archname-$archname64"
5338                         echo "...setting architecture name to $archname." >&4
5339                         ;;
5340                 esac
5341                 ;;
5342         esac
5343 esac
5344 case "$uselongdouble" in
5345 $define)
5346         echo "Long doubles selected." >&4
5347         case "$longdblsize" in
5348         $doublesize)
5349                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5350                 ;;
5351         *)
5352                 case "$archname" in
5353                 *-ld*) echo "...and architecture name already has -ld." >&4
5354                         ;;
5355                 *)      archname="$archname-ld"
5356                         echo "...setting architecture name to $archname." >&4
5357                         ;;
5358                 esac
5359                 ;;
5360         esac
5361         ;;
5362 esac
5363
5364 : determine root of directory hierarchy where package will be installed.
5365 case "$prefix" in
5366 '')
5367         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5368         ;;
5369 *)
5370         dflt="$prefix"
5371         ;;
5372 esac
5373 $cat <<EOM
5374
5375 By default, $package will be installed in $dflt/bin, manual pages
5376 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5377 installation directories. Typically this is something like /usr/local.
5378 If you wish to have binaries under /usr/bin but other parts of the
5379 installation under /usr/local, that's ok: you will be prompted
5380 separately for each of the installation directories, the prefix being
5381 only used to set the defaults.
5382
5383 EOM
5384 fn=d~
5385 rp='Installation prefix to use?'
5386 . ./getfile
5387 oldprefix=''
5388 case "$prefix" in
5389 '') ;;
5390 *)
5391         case "$ans" in
5392         "$prefix") ;;
5393         *) oldprefix="$prefix";;
5394         esac
5395         ;;
5396 esac
5397 prefix="$ans"
5398 prefixexp="$ansexp"
5399
5400 : is AFS running?
5401 echo " "
5402 case "$afs" in
5403 $define|true)   afs=true ;;
5404 $undef|false)   afs=false ;;
5405 *)      if test -d /afs; then
5406                 afs=true
5407         else
5408                 afs=false
5409         fi
5410         ;;
5411 esac
5412 if $afs; then
5413         echo "AFS may be running... I'll be extra cautious then..." >&4
5414 else
5415         echo "AFS does not seem to be running..." >&4
5416 fi
5417
5418 : determine installation prefix for where package is to be installed.
5419 if $afs; then 
5420 $cat <<EOM
5421
5422 Since you are running AFS, I need to distinguish the directory in which
5423 files will reside from the directory in which they are installed (and from
5424 which they are presumably copied to the former directory by occult means).
5425
5426 EOM
5427         case "$installprefix" in
5428         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5429         *) dflt="$installprefix";;
5430         esac
5431 else
5432 $cat <<EOM
5433
5434 In some special cases, particularly when building $package for distribution,
5435 it is convenient to distinguish between the directory in which files should 
5436 be installed from the directory ($prefix) in which they 
5437 will eventually reside.  For most users, these two directories are the same.
5438
5439 EOM
5440         case "$installprefix" in
5441         '') dflt=$prefix ;;
5442         *) dflt=$installprefix;;
5443         esac
5444 fi
5445 fn=d~
5446 rp='What installation prefix should I use for installing files?'
5447 . ./getfile
5448 installprefix="$ans"
5449 installprefixexp="$ansexp"
5450
5451 : set the prefixit variable, to compute a suitable default value
5452 prefixit='case "$3" in
5453 ""|none)
5454         case "$oldprefix" in
5455         "") eval "$1=\"\$$2\"";;
5456         *)
5457                 case "$3" in
5458                 "") eval "$1=";;
5459                 none)
5460                         eval "tp=\"\$$2\"";
5461                         case "$tp" in
5462                         ""|" ") eval "$1=\"\$$2\"";;
5463                         *) eval "$1=";;
5464                         esac;;
5465                 esac;;
5466         esac;;
5467 *)
5468         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5469         case "$tp" in
5470         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5471         /*-$oldprefix/*|\~*-$oldprefix/*)
5472                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5473         *) eval "$1=\"\$$2\"";;
5474         esac;;
5475 esac'
5476
5477
5478 : get the patchlevel
5479 echo " "
5480 echo "Getting the current patchlevel..." >&4
5481 if $test -r $rsrc/patchlevel.h;then
5482         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5483         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5484         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5485         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5486         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5487         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5488 else
5489         revision=0
5490         patchlevel=0
5491         subversion=0
5492         api_revision=0
5493         api_version=0
5494         api_subversion=0
5495 fi
5496 $echo "(You have $package version $patchlevel subversion $subversion.)"
5497 case "$osname" in
5498 dos|vms)
5499         : XXX Should be a Configure test for double-dots in filenames.
5500         version=`echo $revision $patchlevel $subversion | \
5501                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5502         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5503                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5504         ;;
5505 *)
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 esac
5512 : Special case the 5.005_xx maintenance series, which used 5.005
5513 : without any subversion label as a subdirectory in $sitelib
5514 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5515         api_versionstring='5.005'
5516 fi
5517
5518 : determine installation style
5519 : For now, try to deduce it from prefix unless it is already set.
5520 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5521 case "$installstyle" in
5522 '')     case "$prefix" in
5523                 *perl*) dflt='lib';;
5524                 *) dflt='lib/perl5' ;;
5525         esac
5526         ;;
5527 *)      dflt="$installstyle" ;;
5528 esac
5529 : Probably not worth prompting for this since we prompt for all
5530 : the directories individually, and the prompt would be too long and
5531 : confusing anyway.
5532 installstyle=$dflt
5533
5534 : determine where private library files go
5535 : Usual default is /usr/local/lib/perl5/$version.
5536 : Also allow things like /opt/perl/lib/$version, since 
5537 : /opt/perl/lib/perl5... would be redundant.
5538 : The default "style" setting is made in installstyle.U
5539 case "$installstyle" in
5540 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5541 *)       set dflt privlib lib/$version ;;
5542 esac
5543 eval $prefixit
5544 $cat <<EOM
5545
5546 There are some auxiliary files for $package that need to be put into a
5547 private library directory that is accessible by everyone.
5548
5549 EOM
5550 fn=d~+
5551 rp='Pathname where the private library files will reside?'
5552 . ./getfile
5553 privlib="$ans"
5554 privlibexp="$ansexp"
5555 : Change installation prefix, if necessary.
5556 if $test X"$prefix" != X"$installprefix"; then
5557         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5558 else
5559         installprivlib="$privlibexp"
5560 fi
5561
5562 : set the prefixup variable, to restore leading tilda escape
5563 prefixup='case "$prefixexp" in
5564 "$prefix") ;;
5565 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5566 esac'
5567
5568 : determine where public architecture dependent libraries go
5569 set archlib archlib
5570 eval $prefixit
5571 : privlib default is /usr/local/lib/$package/$version
5572 : archlib default is /usr/local/lib/$package/$version/$archname
5573 : privlib may have an optional trailing /share.
5574 tdflt=`echo $privlib | $sed 's,/share$,,'`
5575 tdflt=$tdflt/$archname
5576 case "$archlib" in
5577 '')     dflt=$tdflt
5578         ;;
5579 *)      dflt="$archlib"
5580     ;;
5581 esac
5582 $cat <<EOM
5583
5584 $spackage contains architecture-dependent library files.  If you are
5585 sharing libraries in a heterogeneous environment, you might store
5586 these files in a separate location.  Otherwise, you can just include
5587 them with the rest of the public library files.
5588
5589 EOM
5590 fn=d+~
5591 rp='Where do you want to put the public architecture-dependent libraries?'
5592 . ./getfile
5593 archlib="$ans"
5594 archlibexp="$ansexp"
5595 if $test X"$archlib" = X"$privlib"; then
5596         d_archlib="$undef"
5597 else
5598         d_archlib="$define"
5599 fi
5600 : Change installation prefix, if necessary.
5601 if $test X"$prefix" != X"$installprefix"; then
5602         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5603 else
5604         installarchlib="$archlibexp"
5605 fi
5606
5607
5608 : Binary compatibility with 5.005 is not possible for builds
5609 : with advanced features
5610 case "$usethreads$usemultiplicity" in
5611 *define*)
5612         bincompat5005="$undef"
5613         d_bincompat5005="$undef"
5614         ;;
5615 *)      $cat <<EOM
5616
5617 This version of Perl can be compiled for binary compatibility with 5.005.
5618 If you decide to do so, you will be able to continue using most of the
5619 extensions that were compiled for Perl 5.005.
5620
5621 EOM
5622         case "$bincompat5005$d_bincompat5005" in
5623         *"$undef"*) dflt=n ;;
5624         *) dflt=y ;;
5625         esac
5626         rp='Binary compatibility with Perl 5.005?'
5627         . ./myread
5628         case "$ans" in
5629         y*) val="$define" ;;
5630         *)  val="$undef" ;;
5631         esac
5632         set d_bincompat5005
5633         eval $setvar
5634         case "$d_bincompat5005" in
5635         "$define")
5636                 bincompat5005="$define"
5637                 ;;
5638         *)      bincompat5005="$undef"
5639                 d_bincompat5005="$undef"
5640                 ;;
5641         esac
5642         ;;
5643 esac
5644
5645
5646 : see if setuid scripts can be secure
5647 $cat <<EOM
5648
5649 Some kernels have a bug that prevents setuid #! scripts from being
5650 secure.  Some sites have disabled setuid #! scripts because of this.
5651
5652 First let's decide if your kernel supports secure setuid #! scripts.
5653 (If setuid #! scripts would be secure but have been disabled anyway,
5654 don't say that they are secure if asked.)
5655
5656 EOM
5657
5658 val="$undef"
5659 if $test -d /dev/fd; then
5660         echo "#!$ls" >reflect
5661         chmod +x,u+s reflect
5662         ./reflect >flect 2>&1
5663         if $contains "/dev/fd" flect >/dev/null; then
5664                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5665                 val="$define"
5666         else
5667                 $cat <<EOM
5668 If you are not sure if they are secure, I can check but I'll need a
5669 username and password different from the one you are using right now.
5670 If you don't have such a username or don't want me to test, simply
5671 enter 'none'.
5672
5673 EOM
5674                 rp='Other username to test security of setuid scripts with?'
5675                 dflt='none'
5676                 . ./myread
5677                 case "$ans" in
5678                 n|none)
5679                         case "$d_suidsafe" in
5680                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5681                                 dflt=n;;
5682                         "$undef")
5683                                 echo "Well, the $hint value is *not* secure." >&4
5684                                 dflt=n;;
5685                         *)      echo "Well, the $hint value *is* secure." >&4
5686                                 dflt=y;;
5687                         esac
5688                         ;;
5689                 *)
5690                         $rm -f reflect flect
5691                         echo "#!$ls" >reflect
5692                         chmod +x,u+s reflect
5693                         echo >flect
5694                         chmod a+w flect
5695                         echo '"su" will (probably) prompt you for '"$ans's password."
5696                         su $ans -c './reflect >flect'
5697                         if $contains "/dev/fd" flect >/dev/null; then
5698                                 echo "Okay, it looks like setuid scripts are secure." >&4
5699                                 dflt=y
5700                         else
5701                                 echo "I don't think setuid scripts are secure." >&4
5702                                 dflt=n
5703                         fi
5704                         ;;
5705                 esac
5706                 rp='Does your kernel have *secure* setuid scripts?'
5707                 . ./myread
5708                 case "$ans" in
5709                 [yY]*)  val="$define";;
5710                 *)      val="$undef";;
5711                 esac
5712         fi
5713 else
5714         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5715         echo "(That's for file descriptors, not floppy disks.)"
5716         val="$undef"
5717 fi
5718 set d_suidsafe
5719 eval $setvar
5720
5721 $rm -f reflect flect
5722
5723 : now see if they want to do setuid emulation
5724 echo " "
5725 val="$undef"
5726 case "$d_suidsafe" in
5727 "$define")
5728         val="$undef"
5729         echo "No need to emulate SUID scripts since they are secure here." >& 4
5730         ;;
5731 *)
5732         $cat <<EOM
5733 Some systems have disabled setuid scripts, especially systems where
5734 setuid scripts cannot be secure.  On systems where setuid scripts have
5735 been disabled, the setuid/setgid bits on scripts are currently
5736 useless.  It is possible for $package to detect those bits and emulate
5737 setuid/setgid in a secure fashion.  This emulation will only work if
5738 setuid scripts have been disabled in your kernel.
5739
5740 EOM
5741         case "$d_dosuid" in
5742         "$define") dflt=y ;;
5743         *) dflt=n ;;
5744         esac
5745         rp="Do you want to do setuid/setgid emulation?"
5746         . ./myread
5747         case "$ans" in
5748         [yY]*)  val="$define";;
5749         *)      val="$undef";;
5750         esac
5751         ;;
5752 esac
5753 set d_dosuid
5754 eval $setvar
5755
5756 : determine filename position in cpp output
5757 echo " "
5758 echo "Computing filename position in cpp output for #include directives..." >&4
5759 echo '#include <stdio.h>' > foo.c
5760 $cat >fieldn <<EOF
5761 $startsh
5762 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5763 $grep '^[       ]*#.*stdio\.h' | \
5764 while read cline; do
5765         pos=1
5766         set \$cline
5767         while $test \$# -gt 0; do
5768                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5769                         echo "\$pos"
5770                         exit 0
5771                 fi
5772                 shift
5773                 pos=\`expr \$pos + 1\`
5774         done
5775 done
5776 EOF
5777 chmod +x fieldn
5778 fieldn=`./fieldn`
5779 $rm -f foo.c fieldn
5780 case $fieldn in
5781 '') pos='???';;
5782 1) pos=first;;
5783 2) pos=second;;
5784 3) pos=third;;
5785 *) pos="${fieldn}th";;
5786 esac
5787 echo "Your cpp writes the filename in the $pos field of the line."
5788
5789 : locate header file
5790 $cat >findhdr <<EOF
5791 $startsh
5792 wanted=\$1
5793 name=''
5794 for usrincdir in $usrinc
5795 do
5796         if test -f \$usrincdir/\$wanted; then
5797                 echo "\$usrincdir/\$wanted"
5798                 exit 0
5799         fi
5800 done
5801 awkprg='{ print \$$fieldn }'
5802 echo "#include <\$wanted>" > foo\$\$.c
5803 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5804 $grep "^[       ]*#.*\$wanted" | \
5805 while read cline; do
5806         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5807         case "\$name" in
5808         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5809         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5810         *) exit 2;;
5811         esac;
5812 done;
5813 #
5814 # status = 0: grep returned 0 lines, case statement not executed
5815 # status = 1: headerfile found
5816 # status = 2: while loop executed, no headerfile found
5817 #
5818 status=\$?
5819 $rm -f foo\$\$.c;
5820 if test \$status -eq 1; then
5821         exit 0;
5822 fi
5823 exit 1
5824 EOF
5825 chmod +x findhdr
5826
5827 : define an alternate in-header-list? function
5828 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5829 cont=true; xxf="echo \"<\$1> found.\" >&4";
5830 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5831 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5832 esac;
5833 case $# in 4) instead=instead;; *) instead="at last";; esac;
5834 while $test "$cont"; do
5835         xxx=`./findhdr $1`
5836         var=$2; eval "was=\$$2";
5837         if $test "$xxx" && $test -r "$xxx";
5838         then eval $xxf;
5839         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5840                 cont="";
5841         else eval $xxnf;
5842         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5843         set $yyy; shift; shift; yyy=$@;
5844         case $# in 0) cont="";;
5845         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5846                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5847         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5848                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5849         esac;
5850 done;
5851 while $test "$yyy";
5852 do set $yyy; var=$2; eval "was=\$$2";
5853         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5854         set $yyy; shift; shift; yyy=$@;
5855 done'
5856
5857 : see if this is a malloc.h system
5858 set malloc.h i_malloc
5859 eval $inhdr
5860
5861 : see if stdlib is available
5862 set stdlib.h i_stdlib
5863 eval $inhdr
5864
5865 : determine which malloc to compile in
5866 echo " "
5867 case "$usemymalloc" in
5868 ''|[yY]*|true|$define)  dflt='y' ;;
5869 *)      dflt='n' ;;
5870 esac
5871 rp="Do you wish to attempt to use the malloc that comes with $package?"
5872 . ./myread
5873 usemymalloc="$ans"
5874 case "$ans" in
5875 y*|true)
5876         usemymalloc='y'
5877         mallocsrc='malloc.c'
5878         mallocobj="malloc$_o"
5879         d_mymalloc="$define"
5880         case "$libs" in
5881         *-lmalloc*)
5882                 : Remove malloc from list of libraries to use
5883                 echo "Removing unneeded -lmalloc from library list" >&4
5884                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5885                 shift
5886                 libs="$*"
5887                 echo "libs = $libs" >&4
5888                 ;;
5889         esac
5890         ;;
5891 *)
5892         usemymalloc='n'
5893         mallocsrc=''
5894         mallocobj=''
5895         d_mymalloc="$undef"
5896         ;;
5897 esac
5898
5899 : compute the return types of malloc and free
5900 echo " "
5901 $cat >malloc.c <<END
5902 #$i_malloc I_MALLOC
5903 #$i_stdlib I_STDLIB
5904 #include <stdio.h>
5905 #include <sys/types.h>
5906 #ifdef I_MALLOC
5907 #include <malloc.h>
5908 #endif
5909 #ifdef I_STDLIB
5910 #include <stdlib.h>
5911 #endif
5912 #ifdef TRY_MALLOC
5913 void *malloc();
5914 #endif
5915 #ifdef TRY_FREE
5916 void free();
5917 #endif
5918 END
5919 case "$malloctype" in
5920 '')
5921         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5922                 malloctype='void *'
5923         else
5924                 malloctype='char *'
5925         fi
5926         ;;
5927 esac
5928 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5929
5930 case "$freetype" in
5931 '')
5932         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5933                 freetype='void'
5934         else
5935                 freetype='int'
5936         fi
5937         ;;
5938 esac
5939 echo "Your system uses $freetype free(), it would seem." >&4
5940 $rm -f malloc.[co]
5941 $cat <<EOM
5942
5943 After $package is installed, you may wish to install various
5944 add-on modules and utilities.  Typically, these add-ons will
5945 be installed under $prefix with the rest
5946 of this package.  However, you may wish to install such add-ons
5947 elsewhere under a different prefix.
5948
5949 If you do not wish to put everything under a single prefix, that's
5950 ok.  You will be prompted for the individual locations; this siteprefix
5951 is only used to suggest the defaults.
5952
5953 The default should be fine for most people.
5954
5955 EOM
5956 fn=d~+
5957 rp='Installation prefix to use for add-on modules and utilities?'
5958 : XXX Here might be another good place for an installstyle setting.
5959 case "$siteprefix" in
5960 '') dflt=$prefix ;;
5961 *)  dflt=$siteprefix ;;
5962 esac
5963 . ./getfile
5964 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5965 oldsiteprefix=''
5966 case "$siteprefix" in
5967 '') ;;
5968 *)      case "$ans" in
5969         "$prefix") ;;
5970         *) oldsiteprefix="$prefix";;
5971         esac
5972         ;;
5973 esac
5974 siteprefix="$ans"
5975 siteprefixexp="$ansexp"
5976
5977 : determine where site specific libraries go.
5978 : Usual default is /usr/local/lib/perl5/site_perl/$version
5979 : The default "style" setting is made in installstyle.U
5980 : XXX No longer works with Prefixit stuff.
5981 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5982 case "$sitelib" in
5983 '') case "$installstyle" in
5984         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5985         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5986         esac
5987         ;;
5988 *)      dflt="$sitelib"
5989         ;;
5990 esac
5991 $cat <<EOM
5992
5993 The installation process will create a directory for
5994 site-specific extensions and modules.  Most users find it convenient
5995 to place all site-specific files in this directory rather than in the
5996 main distribution directory.
5997
5998 EOM
5999 fn=d~+
6000 rp='Pathname for the site-specific library files?'
6001 . ./getfile
6002 sitelib="$ans"
6003 sitelibexp="$ansexp"
6004 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6005 : Change installation prefix, if necessary.
6006 if $test X"$prefix" != X"$installprefix"; then
6007         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6008 else
6009         installsitelib="$sitelibexp"
6010 fi
6011
6012 : determine where site specific architecture-dependent libraries go.
6013 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6014 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6015 : sitelib may have an optional trailing /share.
6016 case "$sitearch" in
6017 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6018         dflt="$dflt/$archname"
6019         ;;
6020 *)      dflt="$sitearch"
6021         ;;
6022 esac
6023 set sitearch sitearch none
6024 eval $prefixit
6025 $cat <<EOM
6026
6027 The installation process will also create a directory for
6028 architecture-dependent site-specific extensions and modules.
6029
6030 EOM
6031 fn=d~+
6032 rp='Pathname for the site-specific architecture-dependent library files?'
6033 . ./getfile
6034 sitearch="$ans"
6035 sitearchexp="$ansexp"
6036 : Change installation prefix, if necessary.
6037 if $test X"$prefix" != X"$installprefix"; then
6038         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6039 else
6040         installsitearch="$sitearchexp"
6041 fi
6042
6043 $cat <<EOM
6044
6045 The installation process will also create a directory for
6046 vendor-supplied add-ons.  Vendors who supply perl with their system
6047 may find it convenient to place all vendor-supplied files in this
6048 directory rather than in the main distribution directory.  This will
6049 ease upgrades between binary-compatible maintenance versions of perl.
6050
6051 Of course you may also use these directories in whatever way you see
6052 fit.  For example, you might use them to access modules shared over a
6053 company-wide network.
6054
6055 The default answer should be fine for most people.
6056 This causes further questions about vendor add-ons to be skipped
6057 and no vendor-specific directories will be configured for perl.
6058
6059 EOM
6060 rp='Do you want to configure vendor-specific add-on directories?'
6061 case "$usevendorprefix" in
6062 define|true|[yY]*) dflt=y ;;
6063 *)      : User may have set vendorprefix directly on Configure command line.
6064         case "$vendorprefix" in
6065         ''|' ') dflt=n ;;
6066         *)      dflt=y ;;
6067         esac
6068         ;;
6069 esac
6070 . ./myread
6071 case "$ans" in
6072 [yY]*)  fn=d~+
6073         rp='Installation prefix to use for vendor-supplied add-ons?'
6074         case "$vendorprefix" in
6075         '') dflt='' ;;
6076         *)  dflt=$vendorprefix ;;
6077         esac
6078         . ./getfile
6079         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6080         oldvendorprefix=''
6081         case "$vendorprefix" in
6082         '') ;;
6083         *)      case "$ans" in
6084                 "$prefix") ;;
6085                 *) oldvendorprefix="$prefix";;
6086                 esac
6087                 ;;
6088         esac
6089         usevendorprefix="$define"
6090         vendorprefix="$ans"
6091         vendorprefixexp="$ansexp"
6092         ;;
6093 *)      usevendorprefix="$undef"
6094         vendorprefix=''
6095         vendorprefixexp=''
6096         ;;
6097 esac
6098
6099 case "$vendorprefix" in
6100 '')     d_vendorlib="$undef"
6101         vendorlib=''
6102         vendorlibexp=''
6103         ;;
6104 *)      d_vendorlib="$define"
6105         : determine where vendor-supplied modules go.
6106         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6107         case "$vendorlib" in
6108         '')
6109                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6110                 case "$installstyle" in
6111                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6112                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6113                 esac
6114                 ;;
6115         *)      dflt="$vendorlib"
6116                 ;;
6117         esac
6118         fn=d~+
6119         rp='Pathname for the vendor-supplied library files?'
6120         . ./getfile
6121         vendorlib="$ans"
6122         vendorlibexp="$ansexp"
6123         ;;
6124 esac
6125 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6126 : Change installation prefix, if necessary.
6127 if $test X"$prefix" != X"$installprefix"; then
6128         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6129 else
6130         installvendorlib="$vendorlibexp"
6131 fi
6132
6133 case "$vendorprefix" in
6134 '')     d_vendorarch="$undef"
6135         vendorarch=''
6136         vendorarchexp=''
6137         ;;
6138 *)      d_vendorarch="$define"
6139         : determine where vendor-supplied architecture-dependent libraries go.
6140         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6141         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6142         : vendorlib may have an optional trailing /share.
6143         case "$vendorarch" in
6144         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6145                 dflt="$dflt/$archname"
6146                 ;;
6147         *)      dflt="$vendorarch" ;;
6148         esac
6149         fn=d~+
6150         rp='Pathname for vendor-supplied architecture-dependent files?'
6151         . ./getfile
6152         vendorarch="$ans"
6153         vendorarchexp="$ansexp"
6154         ;;
6155 esac
6156 : Change installation prefix, if necessary.
6157 if $test X"$prefix" != X"$installprefix"; then
6158         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6159 else
6160         installvendorarch="$vendorarchexp"
6161 fi
6162
6163 : Final catch-all directories to search
6164 $cat <<EOM
6165
6166 Lastly, you can have perl look in other directories for extensions and
6167 modules in addition to those already specified.
6168 These directories will be searched after 
6169         $sitearch 
6170         $sitelib 
6171 EOM
6172 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6173 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6174 echo ' '
6175 case "$otherlibdirs" in
6176 ''|' ') dflt='none' ;;
6177 *)      dflt="$otherlibdirs" ;;
6178 esac
6179 $cat <<EOM
6180 Enter a colon-separated set of extra paths to include in perl's @INC
6181 search path, or enter 'none' for no extra paths.
6182
6183 EOM
6184
6185 rp='Colon-separated list of additional directories for perl to search?'
6186 . ./myread
6187 case "$ans" in
6188 ' '|''|none)    otherlibdirs=' ' ;;     
6189 *)      otherlibdirs="$ans" ;;
6190 esac
6191 case "$otherlibdirs" in
6192 ' ') val=$undef ;;
6193 *)      val=$define ;;
6194 esac
6195 set d_perl_otherlibdirs
6196 eval $setvar
6197
6198 : Cruising for prototypes
6199 echo " "
6200 echo "Checking out function prototypes..." >&4
6201 $cat >prototype.c <<'EOCP'
6202 int main(int argc, char *argv[]) {
6203         exit(0);}
6204 EOCP
6205 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6206         echo "Your C compiler appears to support function prototypes."
6207         val="$define"
6208 else
6209         echo "Your C compiler doesn't seem to understand function prototypes."
6210         val="$undef"
6211 fi
6212 set prototype
6213 eval $setvar
6214 $rm -f prototype*
6215
6216 case "$prototype" in
6217 "$define") ;;
6218 *)      ansi2knr='ansi2knr'
6219         echo " "
6220         cat <<EOM >&4
6221
6222 $me:  FATAL ERROR:
6223 This version of $package can only be compiled by a compiler that 
6224 understands function prototypes.  Unfortunately, your C compiler 
6225         $cc $ccflags
6226 doesn't seem to understand them.  Sorry about that.
6227
6228 If GNU cc is available for your system, perhaps you could try that instead.  
6229
6230 Eventually, we hope to support building Perl with pre-ANSI compilers.
6231 If you would like to help in that effort, please contact <perlbug@perl.org>.
6232
6233 Aborting Configure now.
6234 EOM
6235         exit 2
6236         ;;
6237 esac
6238
6239 : determine where public executables go
6240 echo " "
6241 set dflt bin bin
6242 eval $prefixit
6243 fn=d~
6244 rp='Pathname where the public executables will reside?'
6245 . ./getfile
6246 if $test "X$ansexp" != "X$binexp"; then
6247         installbin=''
6248 fi
6249 bin="$ans"
6250 binexp="$ansexp"
6251 : Change installation prefix, if necessary.
6252 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6253 if $test X"$prefix" != X"$installprefix"; then
6254         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6255 else
6256         installbin="$binexp"
6257 fi
6258
6259 : Find perl5.005 or later.
6260 echo "Looking for a previously installed perl5.005 or later... "
6261 case "$perl5" in
6262 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6263                 : Check if this perl is recent and can load a simple module
6264                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6265                         perl5=$tdir/perl
6266                         break;
6267                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6268                         perl5=$tdir/perl
6269                         break;
6270                 fi
6271         done
6272         ;;
6273 *)      perl5="$perl5"
6274         ;;
6275 esac
6276 case "$perl5" in
6277 '')     echo "None found.  That's ok.";;
6278 *)      echo "Using $perl5." ;;
6279 esac
6280
6281 : Determine list of previous versions to include in @INC
6282 $cat > getverlist <<EOPL
6283 #!$perl5 -w
6284 use File::Basename;
6285 \$api_versionstring = "$api_versionstring";
6286 \$version = "$version";
6287 \$stem = "$sitelib_stem";
6288 \$archname = "$archname";
6289 EOPL
6290         $cat >> getverlist <<'EOPL'
6291 # Can't have leading @ because metaconfig interprets it as a command!
6292 ;@inc_version_list=();
6293 # XXX Redo to do opendir/readdir? 
6294 if (-d $stem) {
6295     chdir($stem);
6296     ;@candidates = glob("5.*");
6297 }
6298 else {
6299     ;@candidates = ();
6300 }
6301
6302 # XXX ToDo:  These comparisons must be reworked when two-digit
6303 # subversions come along, so that 5.7.10 compares as greater than
6304 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6305 # widespread that we can use the built-in version vectors rather
6306 # than reinventing them here.  For 5.6.0, however, we must
6307 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6308 foreach $d (@candidates) {
6309     if ($d lt $version) {
6310         if ($d ge $api_versionstring) {
6311             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6312         }
6313         elsif ($d ge "5.005") {
6314             unshift(@inc_version_list, grep { -d } $d);
6315         }
6316     }
6317     else {
6318         # Skip newer version.  I.e. don't look in
6319         # 5.7.0 if we're installing 5.6.1.
6320     }
6321 }
6322
6323 if (@inc_version_list) {
6324     print join(' ', @inc_version_list);
6325 }
6326 else {
6327     # Blank space to preserve value for next Configure run.
6328     print " ";
6329 }
6330 EOPL
6331 chmod +x getverlist
6332 case "$inc_version_list" in
6333 '')     if test -x "$perl5"; then
6334                 dflt=`$perl5 getverlist`
6335         else
6336                 dflt='none'
6337         fi
6338         ;;
6339 $undef) dflt='none' ;;
6340 *)  dflt="$inc_version_list" ;;
6341 esac
6342 case "$dflt" in
6343 ''|' ') dflt=none ;;
6344 esac
6345 case "$dflt" in
6346 5.005) case "$bincompat5005" in
6347        $define|true|[yY]*) ;;
6348        *) dflt=none ;;
6349        esac
6350        ;;
6351 esac
6352 $cat <<'EOM'
6353
6354 In order to ease the process of upgrading, this version of perl 
6355 can be configured to use modules built and installed with earlier 
6356 versions of perl that were installed under $prefix.  Specify here
6357 the list of earlier versions that this version of perl should check.
6358 If Configure detected no earlier versions of perl installed under
6359 $prefix, then the list will be empty.  Answer 'none' to tell perl
6360 to not search earlier versions.
6361
6362 The default should almost always be sensible, so if you're not sure,
6363 just accept the default.
6364 EOM
6365
6366 rp='List of earlier versions to include in @INC?'
6367 . ./myread
6368 case "$ans" in
6369 [Nn]one|''|' ') inc_version_list=' ' ;;
6370 *) inc_version_list="$ans" ;;
6371 esac
6372 case "$inc_version_list" in
6373 ''|' ') 
6374         inc_version_list_init='0';;
6375 *)      inc_version_list_init=`echo $inc_version_list |
6376                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6377         ;;
6378 esac
6379 $rm -f getverlist
6380
6381 : determine whether to install perl also as /usr/bin/perl
6382
6383 echo " "
6384 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6385         $cat <<EOM
6386 Many scripts expect perl to be installed as /usr/bin/perl.
6387 I can install the perl you are about to compile also as /usr/bin/perl
6388 (in addition to $installbin/perl).
6389 EOM
6390         case "$installusrbinperl" in
6391         "$undef"|[nN]*) dflt='n';;
6392         *)              dflt='y';;
6393         esac
6394         rp="Do you want to install perl as /usr/bin/perl?"
6395         . ./myread
6396         case "$ans" in
6397         [yY]*)  val="$define";;
6398         *)      val="$undef" ;;
6399         esac
6400 else
6401         val="$undef"
6402 fi
6403 set installusrbinperl
6404 eval $setvar
6405
6406 : see if dld is available
6407 set dld.h i_dld
6408 eval $inhdr
6409
6410 : see if dlopen exists
6411 xxx_runnm="$runnm"
6412 runnm=false
6413 set dlopen d_dlopen
6414 eval $inlibc
6415 runnm="$xxx_runnm"
6416
6417 : determine which dynamic loading, if any, to compile in
6418 echo " "
6419 dldir="ext/DynaLoader"
6420 case "$usedl" in
6421 $define|y|true)
6422         dflt='y'
6423         usedl="$define"
6424         ;;
6425 $undef|n|false)
6426         dflt='n'
6427         usedl="$undef"
6428         ;;
6429 *) 
6430         dflt='n'
6431         case "$d_dlopen" in
6432             $define) dflt='y' ;;
6433         esac
6434         case "$i_dld" in
6435             $define) dflt='y' ;;
6436         esac
6437         : Does a dl_xxx.xs file exist for this operating system
6438         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6439         ;;
6440 esac
6441 rp="Do you wish to use dynamic loading?"
6442 . ./myread
6443 usedl="$ans"
6444 case "$ans" in
6445 y*) usedl="$define"
6446         case "$dlsrc" in
6447         '')
6448                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6449                         dflt="$dldir/dl_${osname}.xs"
6450                 elif $test "$d_dlopen" = "$define" ; then
6451                         dflt="$dldir/dl_dlopen.xs"
6452                 elif $test "$i_dld" = "$define" ; then
6453                         dflt="$dldir/dl_dld.xs"
6454                 else
6455                         dflt=''
6456                 fi
6457                 ;;
6458         *)      dflt="$dldir/$dlsrc"
6459                 ;;
6460         esac
6461     echo "The following dynamic loading files are available:"
6462         : Can not go over to $dldir because getfile has path hard-coded in.
6463         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6464         rp="Source file to use for dynamic loading"
6465         fn="fne"
6466         gfpth="$src"
6467         . ./getfile
6468         usedl="$define"
6469         : emulate basename
6470         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6471
6472         $cat << EOM
6473
6474 Some systems may require passing special flags to $cc -c to
6475 compile modules that will be used to create a shared library.
6476 To use no flags, say "none".
6477
6478 EOM
6479     case "$cccdlflags" in
6480     '') case "$gccversion" in
6481                 '') case "$osname" in
6482                         hpux)   dflt='+z' ;;
6483                         next)   dflt='none' ;;
6484                         irix*)  dflt='-KPIC' ;;
6485                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6486                         sunos)  dflt='-pic' ;;
6487                         *)      dflt='none' ;;
6488                     esac
6489                         ;;
6490                 *)  case "$osname" in
6491                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6492                         *)      dflt='-fpic' ;;
6493                     esac ;;
6494             esac ;;
6495         ' ') dflt='none' ;;
6496     *)  dflt="$cccdlflags" ;;
6497     esac
6498     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6499     . ./myread
6500     case "$ans" in
6501     none) cccdlflags=' ' ;;
6502     *) cccdlflags="$ans" ;;
6503     esac
6504
6505     cat << EOM
6506
6507 Some systems use ld to create libraries that can be dynamically loaded,
6508 while other systems (such as those using ELF) use $cc.
6509
6510 EOM
6511         case "$ld" in
6512         '')     $cat >try.c <<'EOM'
6513 /* Test for whether ELF binaries are produced */
6514 #include <fcntl.h>
6515 #include <stdlib.h>
6516 int main() {
6517         char b[4];
6518         int i = open("a.out",O_RDONLY);
6519         if(i == -1) 
6520                 exit(1); /* fail */
6521         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6522                 exit(0); /* succeed (yes, it's ELF) */
6523         else
6524                 exit(1); /* fail */
6525 }
6526 EOM
6527                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6528                         cat <<EOM
6529 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6530 EOM
6531                         dflt="$cc"
6532                 else
6533                         echo "I'll use ld to build dynamic libraries."
6534                         dflt='ld'
6535                 fi
6536                 rm -f try.c a.out
6537                 ;;
6538         *)      dflt="$ld"
6539                 ;;
6540         esac
6541
6542     rp="What command should be used to create dynamic libraries?"
6543     . ./myread
6544         ld="$ans"
6545
6546     cat << EOM
6547
6548 Some systems may require passing special flags to $ld to create a
6549 library that can be dynamically loaded.  If your ld flags include
6550 -L/other/path options to locate libraries outside your loader's normal
6551 search path, you may need to specify those -L options here as well.  To
6552 use no flags, say "none".
6553
6554 EOM
6555     case "$lddlflags" in
6556     '') case "$osname" in
6557                         beos) dflt='-nostart' ;;
6558                         hpux) dflt='-b';
6559                               case "$gccversion" in
6560                               '') dflt="$dflt +vnocompatwarnings" ;;
6561                               esac
6562                               ;;        
6563                         linux|irix*)    dflt='-shared' ;;
6564                         next)  dflt='none' ;;
6565                         solaris) dflt='-G' ;;
6566                         sunos) dflt='-assert nodefinitions' ;;
6567                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6568                 *)     dflt='none' ;;
6569                         esac
6570                         ;;
6571     *) dflt="$lddlflags" ;;
6572     esac
6573
6574         : Try to guess additional flags to pick up local libraries.
6575         : Be careful not to append to a plain 'none'
6576         case "$dflt" in
6577         none) dflt='' ;;
6578         esac
6579         for thisflag in $ldflags; do
6580                 case "$thisflag" in
6581                 -L*|-R*)
6582                         case " $dflt " in
6583                         *" $thisflag "*) ;;
6584                         *) dflt="$dflt $thisflag" ;;
6585                         esac
6586                         ;;
6587                 esac
6588         done
6589
6590         case "$dflt" in
6591         ''|' ') dflt='none' ;;
6592         esac
6593
6594     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6595     . ./myread
6596     case "$ans" in
6597     none) lddlflags=' ' ;;
6598     *) lddlflags="$ans" ;;
6599     esac
6600
6601         cat <<EOM
6602
6603 Some systems may require passing special flags to $cc to indicate that
6604 the resulting executable will use dynamic linking.  To use no flags,
6605 say "none".
6606
6607 EOM
6608     case "$ccdlflags" in
6609     '') case "$osname" in
6610                 hpux)   dflt='-Wl,-E' ;;
6611                 linux)  dflt='-rdynamic' ;;
6612                 next)   dflt='none' ;;
6613                 sunos)  dflt='none' ;;
6614                 *)      dflt='none' ;;
6615             esac ;;
6616     ' ')  dflt='none' ;;
6617     *)  dflt="$ccdlflags" ;;
6618     esac
6619     rp="Any special flags to pass to $cc to use dynamic linking?"
6620     . ./myread
6621     case "$ans" in
6622     none) ccdlflags=' ' ;;
6623     *) ccdlflags="$ans" ;;
6624     esac
6625     ;;
6626 *)  usedl="$undef"
6627         ld='ld'
6628     dlsrc='dl_none.xs'
6629     lddlflags=''
6630     ccdlflags=''
6631     ;;
6632 esac
6633
6634 also=''
6635 case "$usedl" in
6636 $undef)
6637         # No dynamic loading being used, so don't bother even to prompt.
6638         useshrplib='false'
6639         ;;
6640 *)      case "$useshrplib" in
6641         '')     case "$osname" in
6642                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6643                         dflt=y
6644                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6645                         ;;
6646                 next*)
6647                         case "$osvers" in
6648                         4*)     dflt=y
6649                                 also='Building a shared libperl is needed for MAB support.'
6650                                 ;;
6651                         *)      dflt=n
6652                                 ;;
6653                         esac
6654                         ;;
6655                 *)      dflt=n
6656                         ;;
6657                 esac
6658                 ;;
6659         $define|true|[Yy]*)
6660                 dflt=y
6661                 ;;
6662         *)      dflt=n
6663                 ;;
6664         esac
6665         $cat << EOM
6666
6667 The perl executable is normally obtained by linking perlmain.c with
6668 libperl${_a}, any static extensions (usually just DynaLoader), and
6669 any other libraries needed on this system (such as -lm, etc.).  Since
6670 your system supports dynamic loading, it is probably possible to build
6671 a shared libperl.$so.  If you will have more than one executable linked
6672 to libperl.$so, this will significantly reduce the size of each
6673 executable, but it may have a noticeable affect on performance.  The
6674 default is probably sensible for your system.
6675 $also
6676
6677 EOM
6678         rp="Build a shared libperl.$so (y/n)"
6679         . ./myread
6680         case "$ans" in
6681         true|$define|[Yy]*)
6682                 useshrplib='true'  ;;
6683         *)      useshrplib='false' ;;
6684         esac
6685         ;;
6686 esac
6687
6688 case "$useshrplib" in
6689 true)
6690         case "$libperl" in
6691         '')
6692                 # Figure out a good name for libperl.so.  Since it gets stored in
6693                 # a version-specific architecture-dependent library, the version
6694                 # number isn't really that important, except for making cc/ld happy.
6695                 #
6696                 # A name such as libperl.so.3.1
6697                 majmin="libperl.$so.$patchlevel.$subversion"
6698                 # A name such as libperl.so.301
6699                 majonly=`echo $patchlevel $subversion |
6700                         $awk '{printf "%d%02d", $1, $2}'`
6701                 majonly=libperl.$so.$majonly
6702                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6703                 # rely on figuring it out from the naming of libc.
6704                 case "${osname}${osvers}" in
6705                 next4*)
6706                         dflt=libperl.5.$so
6707                         # XXX How handle the --version stuff for MAB?
6708                         ;;
6709                 linux*)  # ld won't link with a bare -lperl otherwise.
6710                         dflt=libperl.$so
6711                         ;;
6712                 cygwin*) # include version
6713                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6714                         ;;
6715                 *)      # Try to guess based on whether libc has major.minor.
6716                         case "$libc" in
6717                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6718                         *libc.$so.[0-9]*) dflt=$majonly ;;
6719                         *)      dflt=libperl.$so ;;
6720                         esac
6721                         ;;
6722                 esac
6723                 ;;
6724         *)      dflt=$libperl
6725                 ;;
6726         esac
6727         cat << EOM
6728
6729 I need to select a good name for the shared libperl.  If your system uses
6730 library names with major and minor numbers, then you might want something
6731 like $majmin.  Alternatively, if your system uses a single version
6732 number for shared libraries, then you might want to use $majonly.
6733 Or, your system might be quite happy with a simple libperl.$so.
6734
6735 Since the shared libperl will get installed into a version-specific
6736 architecture-dependent directory, the version number of the shared perl
6737 library probably isn't important, so the default should be o.k.
6738
6739 EOM
6740         rp='What name do you want to give to the shared libperl?'
6741         . ./myread
6742         libperl=$ans
6743         echo "Ok, I'll use $libperl"
6744         ;;
6745 *)
6746         libperl="libperl${_a}"
6747         ;;
6748 esac
6749
6750 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6751 case "$shrpdir" in
6752 '') ;;
6753 *)      $cat >&4 <<EOM
6754 WARNING:  Use of the shrpdir variable for the installation location of
6755 the shared $libperl is not supported.  It was never documented and
6756 will not work in this version.  Let me (perlbug@perl.org)
6757 know of any problems this may cause.
6758
6759 EOM
6760         case "$shrpdir" in
6761         "$archlibexp/CORE")
6762                 $cat >&4 <<EOM
6763 But your current setting of $shrpdir is
6764 the default anyway, so it's harmless.
6765 EOM
6766                 ;;
6767         *)
6768                 $cat >&4 <<EOM
6769 Further, your current attempted setting of $shrpdir
6770 conflicts with the value of $archlibexp/CORE
6771 that installperl will use.
6772 EOM
6773                 ;;
6774         esac
6775         ;;
6776 esac
6777
6778 # How will the perl executable find the installed shared $libperl?
6779 # Add $xxx to ccdlflags.
6780 # If we can't figure out a command-line option, use $shrpenv to
6781 # set env LD_RUN_PATH.  The main perl makefile uses this.
6782 shrpdir=$archlibexp/CORE
6783 xxx=''
6784 tmp_shrpenv=''
6785 if "$useshrplib"; then
6786     case "$osname" in 
6787         aix)
6788                 # We'll set it in Makefile.SH...
6789                 ;;
6790         solaris|netbsd)
6791                 xxx="-R $shrpdir"
6792                 ;;
6793         freebsd)
6794                 xxx="-Wl,-R$shrpdir"
6795                 ;;
6796         linux|irix*|dec_osf)
6797                 xxx="-Wl,-rpath,$shrpdir"
6798                 ;;
6799         next)
6800                 # next doesn't like the default...
6801                 ;;
6802         beos)
6803                 # beos doesn't like the default, either.
6804                 ;;
6805         hpux*)
6806                 # hpux doesn't like the default, either.
6807                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6808                 ;;
6809         *)
6810                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6811                 ;;
6812         esac
6813         case "$xxx" in
6814         '') ;;
6815         *)      
6816                 # Only add $xxx if it isn't already in ccdlflags.
6817                 case " $ccdlflags " in
6818                 *" $xxx "*)     ;;
6819                 *)      ccdlflags="$ccdlflags $xxx"
6820                         cat <<EOM >&4
6821
6822 Adding $xxx to the flags
6823 passed to $ld so that the perl executable will find the 
6824 installed shared $libperl.
6825
6826 EOM
6827                         ;;
6828                 esac
6829                 ;;
6830         esac
6831 fi
6832 # Fix ccdlflags in AIX for building external extensions.
6833 # (For building Perl itself bare -bE:perl.exp is needed,
6834 #  Makefile.SH takes care of this.)
6835 case "$osname" in
6836 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6837 esac
6838 # Respect a hint or command-line value.
6839 case "$shrpenv" in
6840 '') shrpenv="$tmp_shrpenv" ;;
6841 esac
6842 case "$ldlibpthname" in
6843 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6844 none)   ldlibpthname='' ;;
6845 esac
6846
6847 : determine where manual pages are on this system
6848 echo " "
6849 case "$sysman" in
6850 '') 
6851         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6852         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6853         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6854         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6855         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6856         sysman=`./loc . /usr/man/man1 $syspath`
6857         ;;
6858 esac
6859 if $test -d "$sysman"; then
6860         echo "System manual is in $sysman." >&4
6861 else
6862         echo "Could not find manual pages in source form." >&4
6863 fi
6864
6865 : determine where manual pages go
6866 set man1dir man1dir none
6867 eval $prefixit
6868 $cat <<EOM
6869
6870 $spackage has manual pages available in source form.
6871 EOM
6872 case "$nroff" in
6873 nroff)
6874         echo "However, you don't have nroff, so they're probably useless to you."
6875         case "$man1dir" in
6876         '') man1dir="none";;
6877         esac;;
6878 esac
6879 echo "If you don't want the manual sources installed, answer 'none'."
6880 case "$man1dir" in
6881 ' ') dflt=none
6882         ;;
6883 '')
6884         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6885         lookpath="$lookpath $prefixexp/man/p_man/man1"
6886         lookpath="$lookpath $prefixexp/man/u_man/man1"
6887         lookpath="$lookpath $prefixexp/man/man.1"
6888         case "$sysman" in
6889         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6890         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6891         esac
6892         set dflt
6893         eval $prefixup
6894         ;;
6895 *)  dflt="$man1dir"
6896         ;;
6897 esac
6898 echo " "
6899 fn=dn+~
6900 rp="Where do the main $spackage manual pages (source) go?"
6901 . ./getfile
6902 if $test "X$man1direxp" != "X$ansexp"; then
6903         installman1dir=''
6904 fi
6905 man1dir="$ans"
6906 man1direxp="$ansexp"
6907 case "$man1dir" in
6908 '')     man1dir=' '
6909         installman1dir='';;
6910 esac
6911
6912 : Change installation prefix, if necessary.
6913 if $test X"$prefix" != X"$installprefix"; then
6914         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6915 else
6916         installman1dir="$man1direxp"
6917 fi
6918
6919 : What suffix to use on installed man pages
6920
6921 case "$man1dir" in
6922 ' ')
6923         man1ext='0'
6924         ;;
6925 *)
6926         rp="What suffix should be used for the main $spackage man pages?"
6927         case "$man1ext" in
6928         '')     case "$man1dir" in
6929                 *1)  dflt=1 ;;
6930                 *1p) dflt=1p ;;
6931                 *1pm) dflt=1pm ;;
6932                 *l) dflt=l;;
6933                 *n) dflt=n;;
6934                 *o) dflt=o;;
6935                 *p) dflt=p;;
6936                 *C) dflt=C;;
6937                 *L) dflt=L;;
6938                 *L1) dflt=L1;;
6939                 *) dflt=1;;
6940                 esac
6941                 ;;
6942         *)      dflt="$man1ext";;
6943         esac
6944         . ./myread
6945         man1ext="$ans"
6946         ;;
6947 esac
6948
6949 : see if we can have long filenames
6950 echo " "
6951 first=123456789abcdef
6952 $rm -f $first
6953 if (echo hi >$first) 2>/dev/null; then
6954         if $test -f 123456789abcde; then
6955                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6956                 val="$undef"
6957         else
6958                 echo 'You can have filenames longer than 14 characters.'>&4
6959                 val="$define"
6960         fi
6961 else
6962         $cat <<'EOM'
6963 You can't have filenames longer than 14 chars.
6964 You can't even think about them!
6965 EOM
6966         val="$undef"
6967 fi 
6968 set d_flexfnam
6969 eval $setvar
6970 $rm -rf 123456789abcde*
6971
6972 : determine where library module manual pages go
6973 set man3dir man3dir none
6974 eval $prefixit
6975 $cat <<EOM
6976
6977 $spackage has manual pages for many of the library modules.
6978 EOM
6979
6980 case "$nroff" in
6981 nroff)
6982         $cat <<'EOM'
6983 However, you don't have nroff, so they're probably useless to you.
6984 EOM
6985         case "$man3dir" in
6986         '') man3dir="none";;
6987         esac;;
6988 esac
6989
6990 case "$d_flexfnam" in
6991 undef)
6992         $cat <<'EOM'
6993 However, your system can't handle the long file names like File::Basename.3. 
6994 EOM
6995         case "$man3dir" in
6996         '') man3dir="none";;
6997         esac;;
6998 esac
6999
7000 echo "If you don't want the manual sources installed, answer 'none'."
7001 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7002 case "$man3dir" in
7003 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7004         if $test -d "$privlib/man/man3"; then
7005                 cat <<EOM >&4
7006
7007 WARNING:  Previous versions of perl installed man3 pages into
7008 $privlib/man/man3.  This version will suggest a 
7009 new default of $dflt.  
7010 EOM
7011                 tdflt=$dflt
7012                 dflt='n'
7013                 rp='Do you wish to preserve the old behavior?(y/n)'
7014                 . ./myread
7015                 case "$ans" in
7016                 y*) dflt="$privlib/man/man3" ;;
7017                 *)  dflt=$tdflt ;;
7018                 esac
7019     fi
7020         ;;
7021 *)      dflt="$man3dir" ;;
7022 esac
7023 case "$dflt" in
7024 ' ') dflt=none ;;
7025 esac
7026 echo " "
7027 fn=dn+~
7028 rp="Where do the $package library man pages (source) go?"
7029 . ./getfile
7030 man3dir="$ans"
7031 man3direxp="$ansexp"
7032 case "$man3dir" in
7033 '')     man3dir=' '
7034         installman3dir='';;
7035 esac
7036
7037 : Change installation prefix, if necessary.
7038 if $test X"$prefix" != X"$installprefix"; then
7039         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7040 else
7041         installman3dir="$man3direxp"
7042 fi
7043
7044 : What suffix to use on installed man pages
7045 case "$man3dir" in
7046 ' ')
7047         man3ext='0'
7048         ;;
7049 *)
7050         rp="What suffix should be used for the $package library man pages?"
7051         case "$man3ext" in
7052         '')     case "$man3dir" in
7053                 *3)  dflt=3 ;;
7054                 *3p) dflt=3p ;;
7055                 *3pm) dflt=3pm ;;
7056                 *l) dflt=l;;
7057                 *n) dflt=n;;
7058                 *o) dflt=o;;
7059                 *p) dflt=p;;
7060                 *C) dflt=C;;
7061                 *L) dflt=L;;
7062                 *L3) dflt=L3;;
7063                 *) dflt=3;;
7064                 esac
7065                 ;;
7066         *)      dflt="$man3ext";;
7067         esac
7068         . ./myread
7069         man3ext="$ans"
7070         ;;
7071 esac
7072
7073 : see if we have to deal with yellow pages, now NIS.
7074 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7075         if $test -f /usr/etc/nibindd; then
7076                 echo " "
7077                 echo "I'm fairly confident you're on a NeXT."
7078                 echo " "
7079                 rp='Do you get the hosts file via NetInfo?'
7080                 dflt=y
7081                 case "$hostcat" in
7082                 nidump*) ;;
7083                 '') ;;
7084                 *) dflt=n;;
7085                 esac
7086                 . ./myread
7087                 case "$ans" in
7088                 y*) hostcat='nidump hosts .';;
7089                 *)      case "$hostcat" in
7090                         nidump*) hostcat='';;
7091                         esac
7092                         ;;
7093                 esac
7094         fi
7095         case "$hostcat" in
7096         nidump*) ;;
7097         *)
7098                 case "$hostcat" in
7099                 *ypcat*) dflt=y;;
7100                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7101                                 dflt=y
7102                         else
7103                                 dflt=n
7104                         fi;;
7105                 *) dflt=n;;
7106                 esac
7107                 echo " "
7108                 rp='Are you getting the hosts file via yellow pages?'
7109                 . ./myread
7110                 case "$ans" in
7111                 y*) hostcat='ypcat hosts';;
7112                 *) hostcat='cat /etc/hosts';;
7113                 esac
7114                 ;;
7115         esac
7116 fi
7117 case "$hostcat" in
7118 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7119 esac
7120 case "$groupcat" in
7121 '') test -f /etc/group && groupcat='cat /etc/group';;
7122 esac
7123 case "$passcat" in
7124 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7125 esac
7126
7127 : now get the host name
7128 echo " "
7129 echo "Figuring out host name..." >&4
7130 case "$myhostname" in
7131 '') cont=true
7132         echo 'Maybe "hostname" will work...'
7133         if tans=`sh -c hostname 2>&1` ; then
7134                 myhostname=$tans
7135                 phostname=hostname
7136                 cont=''
7137         fi
7138         ;;
7139 *) cont='';;
7140 esac
7141 if $test "$cont"; then
7142         if ./xenix; then
7143                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7144                 if tans=`cat /etc/systemid 2>&1` ; then
7145                         myhostname=$tans
7146                         phostname='cat /etc/systemid'
7147                         echo "Whadyaknow.  Xenix always was a bit strange..."
7148                         cont=''
7149                 fi
7150         elif $test -r /etc/systemid; then
7151                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7152         fi
7153 fi
7154 if $test "$cont"; then
7155         echo 'No, maybe "uuname -l" will work...'
7156         if tans=`sh -c 'uuname -l' 2>&1` ; then
7157                 myhostname=$tans
7158                 phostname='uuname -l'
7159         else
7160                 echo 'Strange.  Maybe "uname -n" will work...'
7161                 if tans=`sh -c 'uname -n' 2>&1` ; then
7162                         myhostname=$tans
7163                         phostname='uname -n'
7164                 else
7165                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7166                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7167                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7168                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7169                         else
7170                                 case "$myhostname" in
7171                                 '') echo "Does this machine have an identity crisis or something?"
7172                                         phostname='';;
7173                                 *)
7174                                         echo "Well, you said $myhostname before..."
7175                                         phostname='echo $myhostname';;
7176                                 esac
7177                         fi
7178                 fi
7179         fi
7180 fi
7181 : you do not want to know about this
7182 set $myhostname
7183 myhostname=$1
7184
7185 : verify guess
7186 if $test "$myhostname" ; then
7187         dflt=y
7188         rp='Your host name appears to be "'$myhostname'".'" Right?"
7189         . ./myread
7190         case "$ans" in
7191         y*) ;;
7192         *) myhostname='';;
7193         esac
7194 fi
7195
7196 : bad guess or no guess
7197 while $test "X$myhostname" = X ; do
7198         dflt=''
7199         rp="Please type the (one word) name of your host:"
7200         . ./myread
7201         myhostname="$ans"
7202 done
7203
7204 : translate upper to lower if necessary
7205 case "$myhostname" in
7206 *[A-Z]*)
7207         echo "(Normalizing case in your host name)"
7208         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7209         ;;
7210 esac
7211
7212 case "$myhostname" in
7213 *.*)
7214         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7215         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7216         echo "(Trimming domain name from host name--host name is now $myhostname)"
7217         ;;
7218 *) case "$mydomain" in
7219         '')
7220                 {
7221                         test "X$hostcat" = "Xypcat hosts" &&
7222                         ypmatch "$myhostname" hosts 2>/dev/null |\
7223                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7224                         $test -s hosts
7225                 } || {
7226                         test "X$hostcat" != "X" &&
7227                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7228                                         /[       ]$myhostname[  . ]/p" > hosts
7229                 }
7230                 tmp_re="[       . ]"
7231                 if $test -f hosts; then
7232                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7233                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7234                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7235                                 hosts | $sort | $uniq | \
7236                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7237                         case `$echo X$dflt` in
7238                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7239                                 dflt=.
7240                                 ;;
7241                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7242                                 ;;
7243                         esac
7244                 else
7245                         echo "(I cannot locate a hosts database anywhere)"
7246                         dflt=.
7247                 fi
7248                 case "$dflt" in
7249                 .)
7250                         tans=`./loc resolv.conf X /etc /usr/etc`
7251                         if $test -f "$tans"; then
7252                                 echo "(Attempting domain name extraction from $tans)"
7253                                 dflt=.`$sed -n -e 's/   / /g' \
7254                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7255                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7256                                 case "$dflt" in
7257                                 .) dflt=.`$sed -n -e 's/        / /g' \
7258                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7259                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7260                                         ;;
7261                                 esac
7262                         fi
7263                         ;;
7264                 esac
7265                 case "$dflt" in
7266                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7267                         dflt=.`sh -c domainname 2>/dev/null`
7268                         case "$dflt" in
7269                         '') dflt='.';;
7270                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7271                         esac
7272                         ;;
7273                 esac
7274                 case "$dflt" in
7275                 .) echo "(Lost all hope -- silly guess then)"
7276                         dflt='.uucp'
7277                         ;;
7278                 esac
7279                 $rm -f hosts
7280                 ;;
7281         *) dflt="$mydomain";;
7282         esac;;
7283 esac
7284 echo " "
7285 rp="What is your domain name?"
7286 . ./myread
7287 tans="$ans"
7288 case "$ans" in
7289 '') ;;
7290 .*) ;;
7291 *) tans=".$tans";;
7292 esac
7293 mydomain="$tans"
7294
7295 : translate upper to lower if necessary
7296 case "$mydomain" in
7297 *[A-Z]*)
7298         echo "(Normalizing case in your domain name)"
7299         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7300         ;;
7301 esac
7302
7303 : a little sanity check here
7304 case "$phostname" in
7305 '') ;;
7306 *)
7307         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7308         $myhostname$mydomain|$myhostname) ;;
7309         *)
7310                 case "$phostname" in
7311                 sed*)
7312                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7313                         ;;
7314                 *)
7315                         echo "(That doesn't agree with your $phostname command, by the way.)"
7316                         ;;
7317                 esac
7318         ;;
7319         esac
7320         ;;
7321 esac
7322
7323 $cat <<EOM
7324
7325 I need to get your e-mail address in Internet format if possible, i.e.
7326 something like user@host.domain. Please answer accurately since I have
7327 no easy means to double check it. The default value provided below
7328 is most probably close to reality but may not be valid from outside
7329 your organization...
7330
7331 EOM
7332 cont=x
7333 while test "$cont"; do
7334         case "$cf_email" in
7335         '') dflt="$cf_by@$myhostname$mydomain";;
7336         *) dflt="$cf_email";;
7337         esac
7338         rp='What is your e-mail address?'
7339         . ./myread
7340         cf_email="$ans"
7341         case "$cf_email" in
7342         *@*.*) cont='' ;;
7343         *)
7344                 rp='Address does not look like an Internet one.  Use it anyway?'
7345                 case "$fastread" in
7346                 yes) dflt=y ;;
7347                 *) dflt=n ;;
7348                 esac
7349                 . ./myread
7350                 case "$ans" in
7351                 y*) cont='' ;;
7352                 *) echo " " ;;
7353                 esac
7354                 ;;
7355         esac
7356 done
7357
7358 $cat <<EOM
7359
7360 If you or somebody else will be maintaining perl at your site, please
7361 fill in the correct e-mail address here so that they may be contacted
7362 if necessary. Currently, the "perlbug" program included with perl
7363 will send mail to this address in addition to perlbug@perl.org. You may
7364 enter "none" for no administrator.
7365
7366 EOM
7367 case "$perladmin" in
7368 '') dflt="$cf_email";;
7369 *) dflt="$perladmin";;
7370 esac
7371 rp='Perl administrator e-mail address'
7372 . ./myread
7373 perladmin="$ans"
7374
7375 : determine whether to only install version-specific parts.
7376 echo " "
7377 $cat <<EOM
7378 Do you want to install only the version-specific parts of the perl
7379 distribution?  Usually you do *not* want to do this.
7380 EOM
7381 case "$versiononly" in
7382 "$define"|[Yy]*|true) dflt='y' ;;
7383 *) dflt='n';
7384 esac
7385 rp="Do you want to install only the version-specific parts of perl?"
7386 . ./myread
7387 case "$ans" in
7388 [yY]*)  val="$define";;
7389 *)      val="$undef" ;;
7390 esac
7391 set versiononly
7392 eval $setvar
7393
7394 : figure out how to guarantee perl startup
7395 case "$startperl" in
7396 '')
7397         case "$sharpbang" in
7398         *!)
7399                 $cat <<EOH
7400
7401 I can use the #! construct to start perl on your system. This will
7402 make startup of perl scripts faster, but may cause problems if you
7403 want to share those scripts and perl is not in a standard place
7404 ($binexp/perl) on all your platforms. The alternative is to force
7405 a shell by starting the script with a single ':' character.
7406
7407 EOH
7408                 case "$versiononly" in
7409                 "$define")      dflt="$binexp/perl$version";;  
7410                 *)              dflt="$binexp/perl";;
7411                 esac
7412                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7413                 . ./myread
7414                 case "$ans" in
7415                 none)   startperl=": # use perl";;
7416                 *)      startperl="#!$ans"
7417                         if $test 30 -lt `echo "$ans" | wc -c`; then
7418                                 $cat >&4 <<EOM
7419
7420 WARNING:  Some systems limit the #! command to 32 characters.
7421 If you experience difficulty running Perl scripts with #!, try
7422 installing Perl in a directory with a shorter pathname.
7423
7424 EOM
7425                         fi ;;
7426                 esac
7427                 ;;
7428         *) startperl=": # use perl"
7429                 ;;
7430         esac
7431         ;;
7432 esac
7433 echo "I'll use $startperl to start perl scripts."
7434
7435 : figure best path for perl in scripts
7436 case "$perlpath" in
7437 '')
7438         perlpath="$binexp/perl"
7439         case "$startperl" in
7440         *!*) ;;
7441         *)
7442                 $cat <<EOH
7443
7444 I will use the "eval 'exec'" idiom to start Perl on your system.
7445 I can use the full path of your Perl binary for this purpose, but
7446 doing so may cause problems if you want to share those scripts and
7447 Perl is not always in a standard place ($binexp/perl).
7448
7449 EOH
7450                 dflt="$binexp/perl"
7451                 rp="What path shall I use in \"eval 'exec'\"?"
7452                 . ./myread
7453                 perlpath="$ans"
7454                 ;;
7455         esac
7456         ;;
7457 esac
7458 case "$startperl" in
7459 *!*)    ;;
7460 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7461 esac
7462
7463 : determine where public executable scripts go
7464 set scriptdir scriptdir
7465 eval $prefixit
7466 case "$scriptdir" in
7467 '')
7468         dflt="$bin"
7469         : guess some guesses
7470         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7471         $test -d /usr/share/bin     && dflt=/usr/share/bin
7472         $test -d /usr/local/script  && dflt=/usr/local/script
7473         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7474         $test -d $prefixexp/script  && dflt=$prefixexp/script
7475         set dflt
7476         eval $prefixup
7477         ;;
7478 *)  dflt="$scriptdir"
7479         ;;
7480 esac
7481 $cat <<EOM
7482  
7483 Some installations have a separate directory just for executable scripts so
7484 that they can mount it across multiple architectures but keep the scripts in
7485 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7486 Or you might just lump your scripts in with all your other executables.
7487  
7488 EOM
7489 fn=d~
7490 rp='Where do you keep publicly executable scripts?'
7491 . ./getfile
7492 if $test "X$ansexp" != "X$scriptdirexp"; then
7493         installscript=''
7494 fi
7495 scriptdir="$ans"
7496 scriptdirexp="$ansexp"
7497 : Change installation prefix, if necessary.
7498 if $test X"$prefix" != X"$installprefix"; then
7499         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7500 else
7501         installscript="$scriptdirexp"
7502 fi
7503
7504 : determine where add-on public executables go
7505 case "$sitebin" in
7506 '')     dflt=$siteprefix/bin ;;
7507 *)      dflt=$sitebin ;;
7508 esac
7509 fn=d~
7510 rp='Pathname where the add-on public executables should be installed?'
7511 . ./getfile
7512 sitebin="$ans"
7513 sitebinexp="$ansexp"
7514 : Change installation prefix, if necessary.
7515 if $test X"$prefix" != X"$installprefix"; then
7516         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7517 else
7518         installsitebin="$sitebinexp"
7519 fi
7520
7521 case "$useperlio" in
7522 $define|true|[yY]*)     dflt='y';;
7523 *) dflt='n';;
7524 esac
7525 cat <<EOM
7526
7527 Previous version of $package used the standard IO mechanisms as
7528 defined in <stdio.h>.  Versions 5.003_02 and later of perl allow
7529 alternate IO mechanisms via the PerlIO abstraction layer, but the
7530 stdio mechanism is still the default.  This abstraction layer can
7531 use AT&T's sfio (if you already have sfio installed) or regular stdio.
7532 Using PerlIO with sfio may cause problems with some extension modules.
7533
7534 If this doesn't make any sense to you, just accept the default '$dflt'.
7535 EOM
7536 rp='Use the experimental PerlIO abstraction layer?'
7537 . ./myread
7538 case "$ans" in
7539 y|Y) 
7540         val="$define"
7541         ;;     
7542 *)      
7543         echo "Ok, doing things the stdio way."
7544         val="$undef"
7545         ;;
7546 esac
7547 set useperlio
7548 eval $setvar 
7549
7550 case "$usesocks" in
7551 $define|true|[yY]*)
7552         case "$useperlio" in
7553         $define|true|[yY]*) ;;
7554         *)      cat >&4 <<EOM
7555
7556 You are using the SOCKS proxy protocol library which means that you
7557 should also use the PerlIO layer.  You may be headed for trouble.
7558
7559 EOM
7560                 ;;
7561         esac
7562         ;;
7563 esac
7564
7565         
7566 case "$vendorprefix" in
7567 '')     d_vendorbin="$undef"
7568         vendorbin=''
7569         vendorbinexp=''
7570         ;;
7571 *)      d_vendorbin="$define"
7572         : determine where vendor-supplied executables go.
7573         case "$vendorbin" in
7574         '') dflt=$vendorprefix/bin ;;
7575         *)      dflt="$vendorbin" ;;
7576         esac
7577         fn=d~+
7578         rp='Pathname for the vendor-supplied executables directory?'
7579         . ./getfile
7580         vendorbin="$ans"
7581         vendorbinexp="$ansexp"
7582         ;;
7583 esac
7584 : Change installation prefix, if necessary.
7585 if $test X"$prefix" != X"$installprefix"; then
7586         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7587 else
7588         installvendorbin="$vendorbinexp"
7589 fi
7590
7591 : see if qgcvt exists
7592 set qgcvt d_qgcvt
7593 eval $inlibc
7594
7595 echo " "
7596
7597 if $test X"$d_longdbl" = X"$define"; then
7598
7599 echo "Checking how to print long doubles..." >&4
7600
7601 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7602         $cat >try.c <<'EOCP'
7603 #include <sys/types.h>
7604 #include <stdio.h>
7605 int main() {
7606   double d = 123.456;
7607   printf("%.3f\n", d);
7608 }
7609 EOCP
7610         set try
7611         if eval $compile; then
7612                 yyy=`./try$exe_ext`
7613                 case "$yyy" in
7614                 123.456)
7615                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7616                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7617                         echo "We will use %f."
7618                         ;;
7619                 esac
7620         fi
7621 fi
7622
7623 if $test X"$sPRIfldbl" = X; then
7624         $cat >try.c <<'EOCP'
7625 #include <sys/types.h>
7626 #include <stdio.h>
7627 int main() {
7628   long double d = 123.456;
7629   printf("%.3llf\n", d);
7630 }
7631 EOCP
7632         set try
7633         if eval $compile; then
7634                 yyy=`./try$exe_ext`
7635                 case "$yyy" in
7636                 123.456)
7637                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7638                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7639                         echo "We will use %llf."
7640                         ;;
7641                 esac
7642         fi
7643 fi
7644
7645 if $test X"$sPRIfldbl" = X; then
7646         $cat >try.c <<'EOCP'
7647 #include <sys/types.h>
7648 #include <stdio.h>
7649 int main() {
7650   long double d = 123.456;
7651   printf("%.3Lf\n", d);
7652 }
7653 EOCP
7654         set try
7655         if eval $compile; then
7656                 yyy=`./try$exe_ext`
7657                 case "$yyy" in
7658                 123.456)
7659                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7660                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7661                         echo "We will use %Lf."
7662                         ;;
7663                 esac
7664         fi
7665 fi
7666
7667 if $test X"$sPRIfldbl" = X; then
7668         $cat >try.c <<'EOCP'
7669 #include <sys/types.h>
7670 #include <stdio.h>
7671 int main() {
7672   long double d = 123.456;
7673   printf("%.3lf\n", d);
7674 }
7675 EOCP
7676         set try
7677         if eval $compile; then
7678                 yyy=`./try$exe_ext`
7679                 case "$yyy" in
7680                 123.456)
7681                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7682                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7683                         echo "We will use %lf."
7684                         ;;
7685                 esac
7686         fi
7687 fi
7688
7689 if $test X"$sPRIfldbl" = X; then
7690         echo "Cannot figure out how to print long doubles." >&4
7691 else
7692         sSCNfldbl=$sPRIfldbl    # expect consistency
7693 fi
7694
7695 $rm -f try try.*
7696
7697 fi # d_longdbl
7698
7699 case "$sPRIfldbl" in
7700 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7701         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7702         d_SCNfldbl="$undef";
7703         ;;
7704 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7705         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7706         d_SCNfldbl="$define";
7707         ;;
7708 esac
7709
7710 : Check how to convert floats to strings.
7711 echo " "
7712 echo "Checking for an efficient way to convert floats to strings."
7713 echo " " > try.c
7714 case "$uselongdouble" in
7715 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7716 esac
7717 case "$d_longdbl" in
7718 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7719 esac
7720 case "$d_PRIgldbl" in
7721 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7722 esac
7723 $cat >>try.c <<EOP
7724 #ifdef TRY_gconvert
7725 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7726 char *myname = "gconvert";
7727 #endif
7728 #ifdef TRY_gcvt
7729 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7730 char *myname = "gcvt";
7731 #endif
7732 #ifdef TRY_qgcvt
7733 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7734 char *myname = "qgcvt";
7735 #define DOUBLETYPE long double
7736 #endif
7737 #ifdef TRY_sprintf
7738 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7739 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7740 #else
7741 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7742 #endif
7743 char *myname = "sprintf";
7744 #endif
7745
7746 #ifndef DOUBLETYPE
7747 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7748 #define DOUBLETYPE long double
7749 #else
7750 #define DOUBLETYPE double
7751 #endif
7752 #endif
7753
7754 #include <stdio.h>
7755
7756 #define I_STDLIB $i_stdlib
7757 #ifdef I_STDLIB
7758 #include <stdlib.h>
7759 #endif
7760
7761 int
7762 checkit(expect, got)
7763 char *expect;
7764 char *got;
7765 {
7766     if (strcmp(expect, got)) {
7767                 printf("%s oddity:  Expected %s, got %s\n",
7768                         myname, expect, got);
7769                 exit(1);
7770         }
7771 }
7772
7773 int main()
7774
7775         char buf[64]; 
7776         buf[63] = '\0';
7777
7778         /* This must be 1st test on (which?) platform */
7779         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7780         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7781         checkit("0.1", buf);
7782
7783         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7784         checkit("1", buf);
7785
7786         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7787         checkit("1.1", buf);
7788
7789         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7790         checkit("1.01", buf);
7791
7792         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7793         checkit("1.001", buf);
7794
7795         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7796         checkit("1.0001", buf);
7797
7798         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7799         checkit("1.00001", buf);
7800
7801         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7802         checkit("1.000001", buf);
7803
7804         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7805         checkit("0", buf);
7806
7807         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7808         checkit("-1", buf);
7809
7810         /* Some Linux gcvt's give 1.e+5 here. */
7811         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7812         checkit("100000", buf);
7813         
7814         /* Some Linux gcvt's give -1.e+5 here. */
7815         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7816         checkit("-100000", buf);
7817
7818         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7819         checkit("123.456", buf);
7820
7821         exit(0);
7822 }
7823 EOP
7824 case "$d_Gconvert" in
7825 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7826 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7827 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7828 *) xxx_list='gconvert gcvt sprintf' ;;
7829 esac
7830
7831 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7832 "$define$define$define")
7833     # for long doubles prefer first qgcvt, then sprintf
7834     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7835     xxx_list="sprintf $xxx_list"
7836     case "$d_qgcvt" in
7837     "$define") xxx_list="qgcvt $xxx_list" ;;
7838     esac
7839     ;;
7840 esac
7841
7842 for xxx_convert in $xxx_list; do
7843         echo "Trying $xxx_convert..."
7844         $rm -f try try$_o
7845         set try -DTRY_$xxx_convert
7846         if eval $compile; then
7847                 echo "$xxx_convert() found." >&4
7848                 if ./try; then
7849                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7850                         break;
7851                 else
7852                         echo "...But $xxx_convert didn't work as I expected."
7853                 fi
7854         else
7855                 echo "$xxx_convert NOT found." >&4
7856         fi
7857 done
7858         
7859 case "$xxx_convert" in
7860 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7861 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7862 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7863 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7864    "$define$define$define")
7865       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7866    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7867    esac
7868    ;;  
7869 esac
7870
7871 : see if _fwalk exists
7872 set fwalk d__fwalk
7873 eval $inlibc
7874
7875 : Initialize h_fcntl
7876 h_fcntl=false
7877
7878 : Initialize h_sysfile
7879 h_sysfile=false
7880
7881 : access call always available on UNIX
7882 set access d_access
7883 eval $inlibc
7884
7885 : locate the flags for 'access()'
7886 case "$d_access" in
7887 "$define")
7888         echo " "
7889         $cat >access.c <<'EOCP'
7890 #include <sys/types.h>
7891 #ifdef I_FCNTL
7892 #include <fcntl.h>
7893 #endif
7894 #ifdef I_SYS_FILE
7895 #include <sys/file.h>
7896 #endif
7897 #ifdef I_UNISTD
7898 #include <unistd.h>
7899 #endif
7900 int main() {
7901         exit(R_OK);
7902 }
7903 EOCP
7904         : check sys/file.h first, no particular reason here
7905         if $test `./findhdr sys/file.h` && \
7906                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7907                 h_sysfile=true;
7908                 echo "<sys/file.h> defines the *_OK access constants." >&4
7909         elif $test `./findhdr fcntl.h` && \
7910                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7911                 h_fcntl=true;
7912                 echo "<fcntl.h> defines the *_OK access constants." >&4
7913         elif $test `./findhdr unistd.h` && \
7914                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7915                 echo "<unistd.h> defines the *_OK access constants." >&4
7916         else
7917                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7918         fi
7919         ;;
7920 esac
7921 $rm -f access*
7922
7923 : see if accessx exists
7924 set accessx d_accessx
7925 eval $inlibc
7926
7927 : see if alarm exists
7928 set alarm d_alarm
7929 eval $inlibc
7930
7931 : see if atolf exists
7932 set atolf d_atolf
7933 eval $inlibc
7934
7935 : see if atoll exists
7936 set atoll d_atoll
7937 eval $inlibc
7938
7939 : Look for GNU-cc style attribute checking
7940 echo " "
7941 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7942 $cat >attrib.c <<'EOCP'
7943 #include <stdio.h>
7944 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7945 EOCP
7946 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7947         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7948                 echo "Your C compiler doesn't fully support __attribute__."
7949                 val="$undef"
7950         else
7951                 echo "Your C compiler supports __attribute__."
7952                 val="$define"
7953         fi
7954 else
7955         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7956         val="$undef"
7957 fi
7958 set d_attribut
7959 eval $setvar
7960 $rm -f attrib*
7961
7962 : see if bcmp exists
7963 set bcmp d_bcmp
7964 eval $inlibc
7965
7966 : see if bcopy exists
7967 set bcopy d_bcopy
7968 eval $inlibc
7969
7970 : see if this is a unistd.h system
7971 set unistd.h i_unistd
7972 eval $inhdr
7973
7974 : see if getpgrp exists
7975 set getpgrp d_getpgrp
7976 eval $inlibc
7977
7978 case "$d_getpgrp" in
7979 "$define")
7980         echo " "
7981         echo "Checking to see which flavor of getpgrp is in use..."
7982         $cat >set.c <<EOP
7983 #$i_unistd I_UNISTD
7984 #include <sys/types.h>
7985 #ifdef I_UNISTD
7986 #  include <unistd.h>
7987 #endif
7988 int main()
7989 {
7990         if (getuid() == 0) {
7991                 printf("(I see you are running Configure as super-user...)\n");
7992                 setuid(1);
7993         }
7994 #ifdef TRY_BSD_PGRP
7995         if (getpgrp(1) == 0)
7996                 exit(0);
7997 #else
7998         if (getpgrp() > 0)
7999                 exit(0);
8000 #endif
8001         exit(1);
8002 }
8003 EOP
8004         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8005                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8006                 val="$define"
8007         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8008                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8009                 val="$undef"
8010         else
8011                 echo "I can't seem to compile and run the test program."
8012                 if ./usg; then
8013                         xxx="a USG one, i.e. you use getpgrp()."
8014                 else
8015                         # SVR4 systems can appear rather BSD-ish.
8016                         case "$i_unistd" in
8017                         $undef)
8018                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8019                                 val="$define"
8020                                 ;;
8021                         $define)
8022                                 xxx="probably a USG one, i.e. you use getpgrp()."
8023                                 val="$undef"
8024                                 ;;
8025                         esac
8026                 fi
8027                 echo "Assuming your getpgrp is $xxx" >&4
8028         fi
8029         ;;
8030 *) val="$undef";;
8031 esac
8032 set d_bsdgetpgrp
8033 eval $setvar
8034 $rm -f set set.c
8035
8036 : see if setpgrp exists
8037 set setpgrp d_setpgrp
8038 eval $inlibc
8039
8040 case "$d_setpgrp" in
8041 "$define")
8042         echo " "
8043         echo "Checking to see which flavor of setpgrp is in use..."
8044         $cat >set.c <<EOP
8045 #$i_unistd I_UNISTD
8046 #include <sys/types.h>
8047 #ifdef I_UNISTD
8048 #  include <unistd.h>
8049 #endif
8050 int main()
8051 {
8052         if (getuid() == 0) {
8053                 printf("(I see you are running Configure as super-user...)\n");
8054                 setuid(1);
8055         }
8056 #ifdef TRY_BSD_PGRP
8057         if (-1 == setpgrp(1, 1))
8058                 exit(0);
8059 #else
8060         if (setpgrp() != -1)
8061                 exit(0);
8062 #endif
8063         exit(1);
8064 }
8065 EOP
8066         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8067                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8068                 val="$define"
8069         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8070                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8071                 val="$undef"
8072         else
8073                 echo "(I can't seem to compile and run the test program.)"
8074                 if ./usg; then
8075                         xxx="a USG one, i.e. you use setpgrp()."
8076                 else
8077                         # SVR4 systems can appear rather BSD-ish.
8078                         case "$i_unistd" in
8079                         $undef)
8080                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8081                                 val="$define"
8082                                 ;;
8083                         $define)
8084                                 xxx="probably a USG one, i.e. you use setpgrp()."
8085                                 val="$undef"
8086                                 ;;
8087                         esac
8088                 fi
8089                 echo "Assuming your setpgrp is $xxx" >&4
8090         fi
8091         ;;
8092 *) val="$undef";;
8093 esac
8094 set d_bsdsetpgrp
8095 eval $setvar
8096 $rm -f set set.c
8097 : see if bzero exists
8098 set bzero d_bzero
8099 eval $inlibc
8100
8101 : see if signal is declared as pointer to function returning int or void
8102 echo " "
8103 xxx=`./findhdr signal.h`
8104 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8105 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8106         echo "You have int (*signal())() instead of void." >&4
8107         val="$undef"
8108 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8109         echo "You have void (*signal())()." >&4
8110         val="$define"
8111 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8112         echo "You have int (*signal())() instead of void." >&4
8113         val="$undef"
8114 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8115         echo "You have void (*signal())()." >&4
8116         val="$define"
8117 else
8118         case "$d_voidsig" in
8119         '')
8120         echo "I can't determine whether signal handler returns void or int..." >&4
8121                 dflt=void
8122                 rp="What type does your signal handler return?"
8123                 . ./myread
8124                 case "$ans" in
8125                 v*) val="$define";;
8126                 *) val="$undef";;
8127                 esac;;
8128         "$define")
8129                 echo "As you already told me, signal handler returns void." >&4
8130                 val="$define"
8131                 ;;
8132         *)      echo "As you already told me, signal handler returns int." >&4
8133                 val="$undef"
8134                 ;;
8135         esac
8136 fi
8137 set d_voidsig
8138 eval $setvar
8139 case "$d_voidsig" in
8140 "$define") signal_t="void";;
8141 *) signal_t="int";;
8142 esac
8143 $rm -f $$.tmp
8144
8145 : check for ability to cast large floats to 32-bit ints.
8146 echo " "
8147 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8148 if $test "$intsize" -ge 4; then
8149         xxx=int
8150 else
8151         xxx=long
8152 fi
8153 $cat >try.c <<EOCP
8154 #include <stdio.h>
8155 #include <sys/types.h>
8156 #include <signal.h>
8157 $signal_t blech(s) int s; { exit(3); }
8158 int main()
8159 {
8160         $xxx i32;
8161         double f, g;
8162         int result = 0;
8163         char str[16];
8164         signal(SIGFPE, blech);
8165
8166         /* Don't let compiler optimize the test away.  Store the number 
8167            in a writable string for gcc to pass to sscanf under HP/UX.
8168         */
8169         sprintf(str, "2147483647");
8170         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8171         g = 10 * f;
8172         i32  = ($xxx) g;
8173
8174         /* x86 processors will probably give 0x8000 0000, which is a
8175        sign change.  We don't want that.  We want to mimic SPARC
8176            behavior here, which is to preserve the sign and give
8177            back 0x7fff ffff.
8178         */
8179         if (i32 != ($xxx) f)
8180                 result |= 1;
8181         exit(result);
8182 }
8183 EOCP
8184 set try
8185 if eval $compile_ok; then
8186         ./try
8187         yyy=$?
8188 else
8189         echo "(I can't seem to compile the test program--assuming it can't)"
8190         yyy=1
8191 fi
8192 case "$yyy" in
8193 0)      val="$define"
8194         echo "Yup, it can."
8195         ;;
8196 *)      val="$undef"
8197         echo "Nope, it can't."
8198         ;;
8199 esac
8200 set d_casti32
8201 eval $setvar
8202 $rm -f try try.*
8203
8204 : check for ability to cast negative floats to unsigned
8205 echo " "
8206 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8207 $cat >try.c <<EOCP
8208 #include <stdio.h>
8209 #include <sys/types.h>
8210 #include <signal.h>
8211 $signal_t blech(s) int s; { exit(7); }
8212 $signal_t blech_in_list(s) int s; { exit(4); }
8213 unsigned long dummy_long(p) unsigned long p; { return p; }
8214 unsigned int dummy_int(p) unsigned int p; { return p; }
8215 unsigned short dummy_short(p) unsigned short p; { return p; }
8216 int main()
8217 {
8218         double f;
8219         unsigned long along;
8220         unsigned int aint;
8221         unsigned short ashort;
8222         int result = 0;
8223         char str[16];
8224         
8225         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8226            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8227            optimized the whole file away
8228         */
8229         /* Store the number in a writable string for gcc to pass to 
8230            sscanf under HP/UX.
8231         */
8232         sprintf(str, "-123");
8233         sscanf(str, "%lf", &f);  /* f = -123.; */
8234
8235         signal(SIGFPE, blech);
8236         along = (unsigned long)f;
8237         aint = (unsigned int)f;
8238         ashort = (unsigned short)f;
8239         if (along != (unsigned long)-123)
8240                 result |= 1;
8241         if (aint != (unsigned int)-123)
8242                 result |= 1;
8243         if (ashort != (unsigned short)-123)
8244                 result |= 1;
8245         sprintf(str, "1073741824.");
8246         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8247         f = f + f;
8248         along = 0;
8249         along = (unsigned long)f;
8250         if (along != 0x80000000)
8251                 result |= 2;
8252         f -= 1.;
8253         along = 0;
8254         along = (unsigned long)f;
8255         if (along != 0x7fffffff)
8256                 result |= 1;
8257         f += 2.;
8258         along = 0;
8259         along = (unsigned long)f;
8260         if (along != 0x80000001)
8261                 result |= 2;
8262         if (result)
8263                 exit(result);
8264         signal(SIGFPE, blech_in_list);
8265         sprintf(str, "123.");
8266         sscanf(str, "%lf", &f);  /* f = 123.; */
8267         along = dummy_long((unsigned long)f);
8268         aint = dummy_int((unsigned int)f);
8269         ashort = dummy_short((unsigned short)f);
8270         if (along != (unsigned long)123)
8271                 result |= 4;
8272         if (aint != (unsigned int)123)
8273                 result |= 4;
8274         if (ashort != (unsigned short)123)
8275                 result |= 4;
8276         exit(result);
8277
8278 }
8279 EOCP
8280 set try
8281 if eval $compile_ok; then
8282         ./try
8283         castflags=$?
8284 else
8285         echo "(I can't seem to compile the test program--assuming it can't)"
8286         castflags=7
8287 fi
8288 case "$castflags" in
8289 0)      val="$define"
8290         echo "Yup, it can."
8291         ;;
8292 *)      val="$undef"
8293         echo "Nope, it can't."
8294         ;;
8295 esac
8296 set d_castneg
8297 eval $setvar
8298 $rm -f try.*
8299
8300 : see if vprintf exists
8301 echo " "
8302 if set vprintf val -f d_vprintf; eval $csym; $val; then
8303         echo 'vprintf() found.' >&4
8304         val="$define"
8305         $cat >vprintf.c <<'EOF'
8306 #include <varargs.h>
8307
8308 int main() { xxx("foo"); }
8309
8310 xxx(va_alist)
8311 va_dcl
8312 {
8313         va_list args;
8314         char buf[10];
8315
8316         va_start(args);
8317         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8318 }
8319 EOF
8320         set vprintf
8321         if eval $compile && ./vprintf; then
8322                 echo "Your vsprintf() returns (int)." >&4
8323                 val2="$undef"
8324         else
8325                 echo "Your vsprintf() returns (char*)." >&4
8326                 val2="$define"
8327         fi
8328 else
8329         echo 'vprintf() NOT found.' >&4
8330                 val="$undef"
8331                 val2="$undef"
8332 fi
8333 set d_vprintf
8334 eval $setvar
8335 val=$val2
8336 set d_charvspr
8337 eval $setvar
8338
8339 : see if chown exists
8340 set chown d_chown
8341 eval $inlibc
8342
8343 : see if chroot exists
8344 set chroot d_chroot
8345 eval $inlibc
8346
8347 : see if chsize exists
8348 set chsize d_chsize
8349 eval $inlibc
8350
8351 : check for const keyword
8352 echo " "
8353 echo 'Checking to see if your C compiler knows about "const"...' >&4
8354 $cat >const.c <<'EOCP'
8355 typedef struct spug { int drokk; } spug;
8356 int main()
8357 {
8358         const char *foo;
8359         const spug y;
8360 }
8361 EOCP
8362 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8363         val="$define"
8364         echo "Yup, it does."
8365 else
8366         val="$undef"
8367         echo "Nope, it doesn't."
8368 fi
8369 set d_const
8370 eval $setvar
8371
8372 : see if crypt exists
8373 echo " "
8374 if set crypt val -f d_crypt; eval $csym; $val; then
8375         echo 'crypt() found.' >&4
8376         val="$define"
8377         cryptlib=''
8378 else
8379         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8380         if $test -z "$cryptlib"; then
8381                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8382         else
8383                 cryptlib=-lcrypt
8384         fi
8385         if $test -z "$cryptlib"; then
8386                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8387         else
8388                 cryptlib=-lcrypt
8389         fi
8390         if $test -z "$cryptlib"; then
8391                 cryptlib=`./loc libcrypt$_a "" $libpth`
8392         else
8393                 cryptlib=-lcrypt
8394         fi
8395         if $test -z "$cryptlib"; then
8396                 echo 'crypt() NOT found.' >&4
8397                 val="$undef"
8398         else
8399                 val="$define"
8400         fi
8401 fi
8402 set d_crypt
8403 eval $setvar
8404
8405 : get csh whereabouts
8406 case "$csh" in
8407 'csh') val="$undef" ;;
8408 *) val="$define" ;;
8409 esac
8410 set d_csh
8411 eval $setvar
8412 : Respect a hint or command line value for full_csh.
8413 case "$full_csh" in
8414 '') full_csh=$csh ;;
8415 esac
8416
8417 : see if cuserid exists
8418 set cuserid d_cuserid
8419 eval $inlibc
8420
8421 : see if this is a limits.h system
8422 set limits.h i_limits
8423 eval $inhdr
8424
8425 : see if this is a float.h system
8426 set float.h i_float
8427 eval $inhdr
8428
8429 : See if number of significant digits in a double precision number is known
8430 echo " "
8431 $cat >dbl_dig.c <<EOM
8432 #$i_limits I_LIMITS
8433 #$i_float I_FLOAT
8434 #ifdef I_LIMITS
8435 #include <limits.h>
8436 #endif
8437 #ifdef I_FLOAT
8438 #include <float.h>
8439 #endif
8440 #ifdef DBL_DIG
8441 printf("Contains DBL_DIG");
8442 #endif
8443 EOM
8444 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8445 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8446         echo "DBL_DIG found." >&4
8447         val="$define"
8448 else
8449         echo "DBL_DIG NOT found." >&4
8450         val="$undef"
8451 fi
8452 $rm -f dbl_dig.?
8453 set d_dbl_dig
8454 eval $setvar
8455
8456 : see if difftime exists
8457 set difftime d_difftime
8458 eval $inlibc
8459
8460 : see if this is a dirent system
8461 echo " "
8462 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8463         val="$define"
8464         echo "<dirent.h> found." >&4
8465 else
8466         val="$undef"
8467         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8468                 echo "<sys/dir.h> found." >&4
8469                 echo " "
8470         else
8471                 xinc=`./findhdr sys/ndir.h`
8472         fi
8473         echo "<dirent.h> NOT found." >&4
8474 fi
8475 set i_dirent
8476 eval $setvar
8477
8478 : Look for type of directory structure.
8479 echo " "
8480 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8481
8482 case "$direntrytype" in
8483 ''|' ')
8484         case "$i_dirent" in
8485         $define) guess1='struct dirent' ;;
8486         *) guess1='struct direct'  ;;
8487         esac
8488         ;;
8489 *)      guess1="$direntrytype"
8490         ;;
8491 esac
8492
8493 case "$guess1" in
8494 'struct dirent') guess2='struct direct' ;;
8495 *) guess2='struct dirent' ;;
8496 esac
8497                 
8498 if $contains "$guess1" try.c >/dev/null 2>&1; then
8499         direntrytype="$guess1"
8500         echo "Your directory entries are $direntrytype." >&4
8501 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8502         direntrytype="$guess2"
8503         echo "Your directory entries seem to be $direntrytype." >&4
8504 else
8505         echo "I don't recognize your system's directory entries." >&4
8506         rp="What type is used for directory entries on this system?"
8507         dflt="$guess1"
8508         . ./myread
8509         direntrytype="$ans"
8510 fi
8511 $rm -f try.c
8512
8513
8514 : see if the directory entry stores field length
8515 echo " "
8516 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8517 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8518         echo "Good, your directory entry keeps length information in d_namlen." >&4
8519         val="$define"
8520 else
8521         echo "Your directory entry does not know about the d_namlen field." >&4
8522         val="$undef"
8523 fi
8524 set d_dirnamlen
8525 eval $setvar
8526 $rm -f try.c
8527
8528 : see if dlerror exists
8529 xxx_runnm="$runnm"
8530 runnm=false
8531 set dlerror d_dlerror
8532 eval $inlibc
8533 runnm="$xxx_runnm"
8534
8535 : see if dlfcn is available
8536 set dlfcn.h i_dlfcn
8537 eval $inhdr
8538
8539 case "$usedl" in
8540 $define|y|true)
8541         $cat << EOM
8542
8543 On a few systems, the dynamically loaded modules that perl generates and uses
8544 will need a different extension than shared libs. The default will probably
8545 be appropriate.
8546
8547 EOM
8548         case "$dlext" in
8549         '')     dflt="$so" ;;
8550         *)      dflt="$dlext" ;;
8551         esac
8552         rp='What is the extension of dynamically loaded modules'
8553         . ./myread
8554         dlext="$ans"
8555         ;;
8556 *)
8557         dlext="none"
8558         ;;
8559 esac
8560
8561 : Check if dlsym need a leading underscore
8562 echo " "
8563 val="$undef"
8564
8565 case "$dlsrc" in
8566 dl_dlopen.xs)
8567         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8568         $cat >dyna.c <<'EOM'
8569 fred () { }
8570 EOM
8571
8572 $cat >fred.c<<EOM
8573
8574 #include <stdio.h>
8575 #$i_dlfcn I_DLFCN
8576 #ifdef I_DLFCN
8577 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8578 #else
8579 #include <sys/types.h>
8580 #include <nlist.h>
8581 #include <link.h>
8582 #endif
8583
8584 extern int fred() ;
8585
8586 int main()
8587 {
8588     void * handle ;
8589     void * symbol ;
8590 #ifndef RTLD_LAZY
8591     int mode = 1 ;
8592 #else
8593     int mode = RTLD_LAZY ;
8594 #endif
8595     handle = dlopen("./dyna.$dlext", mode) ;
8596     if (handle == NULL) {
8597         printf ("1\n") ;
8598         fflush (stdout) ;
8599         exit(0);
8600     }
8601     symbol = dlsym(handle, "fred") ;
8602     if (symbol == NULL) {
8603         /* try putting a leading underscore */
8604         symbol = dlsym(handle, "_fred") ;
8605         if (symbol == NULL) {
8606             printf ("2\n") ;
8607             fflush (stdout) ;
8608             exit(0);
8609         }
8610         printf ("3\n") ;
8611     }
8612     else
8613         printf ("4\n") ;
8614     fflush (stdout) ;
8615     exit(0);
8616 }
8617 EOM
8618         : Call the object file tmp-dyna.o in case dlext=o.
8619         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8620                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8621                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8622                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8623                 xxx=`./fred`
8624                 case $xxx in
8625                 1)      echo "Test program failed using dlopen." >&4
8626                         echo "Perhaps you should not use dynamic loading." >&4;;
8627                 2)      echo "Test program failed using dlsym." >&4
8628                         echo "Perhaps you should not use dynamic loading." >&4;;
8629                 3)      echo "dlsym needs a leading underscore" >&4
8630                         val="$define" ;;
8631                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8632                 esac
8633         else
8634                 echo "I can't compile and run the test program." >&4
8635                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8636         fi
8637         ;;
8638 esac
8639                 
8640 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8641
8642 set d_dlsymun
8643 eval $setvar
8644
8645 hasproto='varname=$1; func=$2; shift; shift;
8646 while $test $# -ge 2; do
8647         case "$1" in
8648         $define) echo "#include <$2>";;
8649         esac ;
8650     shift 2;
8651 done > try.c;
8652 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8653 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8654         echo "$func() prototype found.";
8655         val="$define";
8656 else
8657         echo "$func() prototype NOT found.";
8658         val="$undef";
8659 fi;
8660 set $varname;
8661 eval $setvar;
8662 $rm -f try.c tryout.c'
8663
8664 : see if prototype for drand48 is available
8665 echo " "
8666 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8667 eval $hasproto
8668
8669 : see if dup2 exists
8670 set dup2 d_dup2
8671 eval $inlibc
8672
8673 : see if eaccess exists
8674 set eaccess d_eaccess
8675 eval $inlibc
8676
8677 : see if endgrent exists
8678 set endgrent d_endgrent
8679 eval $inlibc
8680
8681 : see if endhostent exists
8682 set endhostent d_endhent
8683 eval $inlibc
8684
8685 : see if endnetent exists
8686 set endnetent d_endnent
8687 eval $inlibc
8688
8689 : see if endprotoent exists
8690 set endprotoent d_endpent
8691 eval $inlibc
8692
8693 : see if endpwent exists
8694 set endpwent d_endpwent
8695 eval $inlibc
8696
8697 : see if endservent exists
8698 set endservent d_endsent
8699 eval $inlibc
8700
8701 : Locate the flags for 'open()'
8702 echo " "
8703 $cat >open3.c <<'EOCP'
8704 #include <sys/types.h>
8705 #ifdef I_FCNTL
8706 #include <fcntl.h>
8707 #endif
8708 #ifdef I_SYS_FILE
8709 #include <sys/file.h>
8710 #endif
8711 int main() {
8712         if(O_RDONLY);
8713 #ifdef O_TRUNC
8714         exit(0);
8715 #else
8716         exit(1);
8717 #endif
8718 }
8719 EOCP
8720 : check sys/file.h first to get FREAD on Sun
8721 if $test `./findhdr sys/file.h` && \
8722                 set open3 -DI_SYS_FILE && eval $compile; then
8723         h_sysfile=true;
8724         echo "<sys/file.h> defines the O_* constants..." >&4
8725         if ./open3; then
8726                 echo "and you have the 3 argument form of open()." >&4
8727                 val="$define"
8728         else
8729                 echo "but not the 3 argument form of open().  Oh, well." >&4
8730                 val="$undef"
8731         fi
8732 elif $test `./findhdr fcntl.h` && \
8733                 set open3 -DI_FCNTL && eval $compile; then
8734         h_fcntl=true;
8735         echo "<fcntl.h> defines the O_* constants..." >&4
8736         if ./open3; then
8737                 echo "and you have the 3 argument form of open()." >&4
8738                 val="$define"
8739         else
8740                 echo "but not the 3 argument form of open().  Oh, well." >&4
8741                 val="$undef"
8742         fi
8743 else
8744         val="$undef"
8745         echo "I can't find the O_* constant definitions!  You got problems." >&4
8746 fi
8747 set d_open3
8748 eval $setvar
8749 $rm -f open3*
8750
8751 : see which of string.h or strings.h is needed
8752 echo " "
8753 strings=`./findhdr string.h`
8754 if $test "$strings" && $test -r "$strings"; then
8755         echo "Using <string.h> instead of <strings.h>." >&4
8756         val="$define"
8757 else
8758         val="$undef"
8759         strings=`./findhdr strings.h`
8760         if $test "$strings" && $test -r "$strings"; then
8761                 echo "Using <strings.h> instead of <string.h>." >&4
8762         else
8763                 echo "No string header found -- You'll surely have problems." >&4
8764         fi
8765 fi
8766 set i_string
8767 eval $setvar
8768 case "$i_string" in
8769 "$undef") strings=`./findhdr strings.h`;;
8770 *)        strings=`./findhdr string.h`;;
8771 esac
8772
8773 : check for non-blocking I/O stuff
8774 case "$h_sysfile" in
8775 true) echo "#include <sys/file.h>" > head.c;;
8776 *)
8777         case "$h_fcntl" in
8778         true) echo "#include <fcntl.h>" > head.c;;
8779         *) echo "#include <sys/fcntl.h>" > head.c;;
8780         esac
8781         ;;
8782 esac
8783 echo " "
8784 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8785 case "$o_nonblock" in
8786 '')
8787         $cat head.c > try.c
8788         $cat >>try.c <<'EOCP'
8789 #include <stdio.h>
8790 int main() {
8791 #ifdef O_NONBLOCK
8792         printf("O_NONBLOCK\n");
8793         exit(0);
8794 #endif
8795 #ifdef O_NDELAY
8796         printf("O_NDELAY\n");
8797         exit(0);
8798 #endif
8799 #ifdef FNDELAY
8800         printf("FNDELAY\n");
8801         exit(0);
8802 #endif
8803         exit(0);
8804 }
8805 EOCP
8806         set try
8807         if eval $compile_ok; then
8808                 o_nonblock=`./try`
8809                 case "$o_nonblock" in
8810                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8811                 *) echo "Seems like we can use $o_nonblock.";;
8812                 esac
8813         else
8814                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8815         fi
8816         ;;
8817 *) echo "Using $hint value $o_nonblock.";;
8818 esac
8819 $rm -f try try.* .out core
8820
8821 echo " "
8822 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8823 case "$eagain" in
8824 '')
8825         $cat head.c > try.c
8826         $cat >>try.c <<EOCP
8827 #include <errno.h>
8828 #include <sys/types.h>
8829 #include <signal.h>
8830 #include <stdio.h> 
8831 #define MY_O_NONBLOCK $o_nonblock
8832 #ifndef errno  /* XXX need better Configure test */
8833 extern int errno;
8834 #endif
8835 #$i_unistd I_UNISTD
8836 #ifdef I_UNISTD
8837 #include <unistd.h>
8838 #endif
8839 #$i_string I_STRING
8840 #ifdef I_STRING
8841 #include <string.h>
8842 #else
8843 #include <strings.h>
8844 #endif
8845 $signal_t blech(x) int x; { exit(3); }
8846 EOCP
8847         $cat >> try.c <<'EOCP'
8848 int main()
8849 {
8850         int pd[2];
8851         int pu[2];
8852         char buf[1];
8853         char string[100];
8854
8855         pipe(pd);       /* Down: child -> parent */
8856         pipe(pu);       /* Up: parent -> child */
8857         if (0 != fork()) {
8858                 int ret;
8859                 close(pd[1]);   /* Parent reads from pd[0] */
8860                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8861                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8862                         exit(1);
8863                 signal(SIGALRM, blech);
8864                 alarm(5);
8865                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8866                         exit(2);
8867                 sprintf(string, "%d\n", ret);
8868                 write(2, string, strlen(string));
8869                 alarm(0);
8870 #ifdef EAGAIN
8871                 if (errno == EAGAIN) {
8872                         printf("EAGAIN\n");
8873                         goto ok;
8874                 }
8875 #endif
8876 #ifdef EWOULDBLOCK
8877                 if (errno == EWOULDBLOCK)
8878                         printf("EWOULDBLOCK\n");
8879 #endif
8880         ok:
8881                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8882                 sleep(2);                               /* Give it time to close our pipe */
8883                 alarm(5);
8884                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8885                 alarm(0);
8886                 sprintf(string, "%d\n", ret);
8887                 write(3, string, strlen(string));
8888                 exit(0);
8889         }
8890
8891         close(pd[0]);                   /* We write to pd[1] */
8892         close(pu[1]);                   /* We read from pu[0] */
8893         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8894         close(pd[1]);                   /* Pipe pd is now fully closed! */
8895         exit(0);                                /* Bye bye, thank you for playing! */
8896 }
8897 EOCP
8898         set try
8899         if eval $compile_ok; then
8900                 echo "$startsh" >mtry
8901                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8902                 chmod +x mtry
8903                 ./mtry >/dev/null 2>&1
8904                 case $? in
8905                 0) eagain=`$cat try.out`;;
8906                 1) echo "Could not perform non-blocking setting!";;
8907                 2) echo "I did a successful read() for something that was not there!";;
8908                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8909                 *) echo "Something terribly wrong happened during testing.";;
8910                 esac
8911                 rd_nodata=`$cat try.ret`
8912                 echo "A read() system call with no data present returns $rd_nodata."
8913                 case "$rd_nodata" in
8914                 0|-1) ;;
8915                 *)
8916                         echo "(That's peculiar, fixing that to be -1.)"
8917                         rd_nodata=-1
8918                         ;;
8919                 esac
8920                 case "$eagain" in
8921                 '')
8922                         echo "Forcing errno EAGAIN on read() with no data available."
8923                         eagain=EAGAIN
8924                         ;;
8925                 *)
8926                         echo "Your read() sets errno to $eagain when no data is available."
8927                         ;;
8928                 esac
8929                 status=`$cat try.err`
8930                 case "$status" in
8931                 0) echo "And it correctly returns 0 to signal EOF.";;
8932                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8933                 *) echo "However, your read() returns '$status' on EOF??";;
8934                 esac
8935                 val="$define"
8936                 if test "$status" = "$rd_nodata"; then
8937                         echo "WARNING: you can't distinguish between EOF and no data!"
8938                         val="$undef"
8939                 fi
8940         else
8941                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8942                 eagain=EAGAIN
8943         fi
8944         set d_eofnblk
8945         eval $setvar
8946         ;;
8947 *)
8948         echo "Using $hint value $eagain."
8949         echo "Your read() returns $rd_nodata when no data is present."
8950         case "$d_eofnblk" in
8951         "$define") echo "And you can see EOF because read() returns 0.";;
8952         "$undef") echo "But you can't see EOF status from read() returned value.";;
8953         *)
8954                 echo "(Assuming you can't see EOF status from read anyway.)"
8955                 d_eofnblk=$undef
8956                 ;;
8957         esac
8958         ;;
8959 esac
8960 $rm -f try try.* .out core head.c mtry
8961
8962 : see if fchmod exists
8963 set fchmod d_fchmod
8964 eval $inlibc
8965
8966 : see if fchown exists
8967 set fchown d_fchown
8968 eval $inlibc
8969
8970 : see if this is an fcntl system
8971 set fcntl d_fcntl
8972 eval $inlibc
8973
8974 echo " "
8975 : See if fcntl-based locking works.
8976 $cat >try.c <<'EOCP'
8977 #include <stdlib.h>
8978 #include <unistd.h>
8979 #include <fcntl.h>
8980 int main() {
8981 #if defined(F_SETLK) && defined(F_SETLKW)
8982      struct flock flock;
8983      int retval, fd;
8984      fd = open("try.c", O_RDONLY);
8985      flock.l_type = F_RDLCK;
8986      flock.l_whence = SEEK_SET;
8987      flock.l_start = flock.l_len = 0;
8988      retval = fcntl(fd, F_SETLK, &flock);
8989      close(fd);
8990      (retval < 0 ? exit(2) : exit(0));
8991 #else
8992      exit(2);
8993 #endif
8994 }
8995 EOCP
8996 echo "Checking if fcntl-based file locking works... "
8997 case "$d_fcntl" in
8998 "$define")
8999         set try
9000         if eval $compile_ok; then
9001                 if ./try; then
9002                         echo "Yes, it seems to work."
9003                         val="$define"
9004                 else
9005                         echo "Nope, it didn't work."
9006                         val="$undef"
9007                 fi
9008         else
9009                 echo "I'm unable to compile the test program, so I'll assume not."
9010                 val="$undef"
9011         fi
9012         ;;
9013 *) val="$undef";
9014         echo "Nope, since you don't even have fcntl()."
9015         ;;
9016 esac
9017 set d_fcntl_can_lock
9018 eval $setvar
9019 $rm -f try*
9020
9021
9022 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9023 while $test $# -ge 2; do
9024         case "$1" in
9025         $define) echo "#include <$2>";;
9026         esac ;
9027     shift 2;
9028 done > try.c;
9029 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9030 set try;
9031 if eval $compile; then
9032         val="$define";
9033 else
9034         val="$undef";
9035 fi;
9036 set $varname;
9037 eval $setvar;
9038 $rm -f try.c try.o'
9039
9040 socketlib=''
9041 sockethdr=''
9042 : see whether socket exists
9043 echo " "
9044 $echo $n "Hmm... $c" >&4
9045 if set socket val -f d_socket; eval $csym; $val; then
9046         echo "Looks like you have Berkeley networking support." >&4
9047         d_socket="$define"
9048         if set setsockopt val -f; eval $csym; $val; then
9049                 d_oldsock="$undef"
9050         else
9051                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9052                 d_oldsock="$define"
9053         fi
9054 else
9055         if $contains socklib libc.list >/dev/null 2>&1; then
9056                 echo "Looks like you have Berkeley networking support." >&4
9057                 d_socket="$define"
9058                 : we will have to assume that it supports the 4.2 BSD interface
9059                 d_oldsock="$undef"
9060         else
9061                 echo "You don't have Berkeley networking in libc$_a..." >&4
9062                 if test "X$d_socket" = "X$define"; then
9063                    echo "...but you seem to believe that you have sockets." >&4
9064                 else
9065                         for net in net socket
9066                         do
9067                                 if test -f /usr/lib/lib$net$_a; then
9068                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9069                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9070                                         if $contains socket libc.list >/dev/null 2>&1; then
9071                                                 d_socket="$define"
9072                                                 socketlib="-l$net"
9073                                                 case "$net" in
9074                                                 net)
9075                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9076                                                         sockethdr="-I/usr/netinclude"
9077                                                         ;;
9078                                                 esac
9079                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9080                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9081                                                         d_oldsock="$undef"
9082                                                 else
9083                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9084                                                         d_oldsock="$define"
9085                                                 fi
9086                                                 break
9087                                         fi
9088                                 fi
9089                         done
9090                         if test "X$d_socket" != "X$define"; then
9091                            echo "or anywhere else I see." >&4
9092                            d_socket="$undef"
9093                            d_oldsock="$undef"
9094                         fi
9095                 fi
9096         fi
9097 fi
9098
9099 : see if socketpair exists
9100 set socketpair d_sockpair
9101 eval $inlibc
9102
9103
9104 echo " "
9105 echo "Checking the availability of certain socket constants..." >& 4
9106 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9107         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9108         $cat >try.c <<EOF
9109 #include <sys/types.h>
9110 #include <sys/socket.h>
9111 int main() {
9112     int i = $ENUM;
9113 }
9114 EOF
9115         val="$undef"
9116         set try; if eval $compile; then
9117                 val="$define"
9118         fi
9119         set d_${enum}; eval $setvar
9120         $rm -f try.c try
9121 done
9122
9123 : see if sys/select.h has to be included
9124 set sys/select.h i_sysselct
9125 eval $inhdr
9126
9127 : see if we should include time.h, sys/time.h, or both
9128 echo " "
9129 if test "X$timeincl" = X; then
9130         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9131         $echo $n "I'm now running the test program...$c"
9132         $cat >try.c <<'EOCP'
9133 #include <sys/types.h>
9134 #ifdef I_TIME
9135 #include <time.h>
9136 #endif
9137 #ifdef I_SYSTIME
9138 #ifdef SYSTIMEKERNEL
9139 #define KERNEL
9140 #endif
9141 #include <sys/time.h>
9142 #endif
9143 #ifdef I_SYSSELECT
9144 #include <sys/select.h>
9145 #endif
9146 int main()
9147 {
9148         struct tm foo;
9149 #ifdef S_TIMEVAL
9150         struct timeval bar;
9151 #endif
9152 #ifdef S_TIMEZONE
9153         struct timezone tzp;
9154 #endif
9155         if (foo.tm_sec == foo.tm_sec)
9156                 exit(0);
9157 #ifdef S_TIMEVAL
9158         if (bar.tv_sec == bar.tv_sec)
9159                 exit(0);
9160 #endif
9161         exit(1);
9162 }
9163 EOCP
9164         flags=''
9165         for s_timezone in '-DS_TIMEZONE' ''; do
9166         sysselect=''
9167         for s_timeval in '-DS_TIMEVAL' ''; do
9168         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9169         for i_time in '' '-DI_TIME'; do
9170         for i_systime in '-DI_SYSTIME' ''; do
9171                 case "$flags" in
9172                 '') $echo $n ".$c"
9173                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9174                         if eval $compile; then
9175                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9176                                 shift
9177                                 flags="$*"
9178                                 echo " "
9179                                 $echo $n "Succeeded with $flags$c"
9180                         fi
9181                         ;;
9182                 esac
9183         done
9184         done
9185         done
9186         done
9187         done
9188         timeincl=''
9189         echo " "
9190         case "$flags" in
9191         *SYSTIMEKERNEL*) i_systimek="$define"
9192                 timeincl=`./findhdr sys/time.h`
9193                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9194         *) i_systimek="$undef";;
9195         esac
9196         case "$flags" in
9197         *I_TIME*) i_time="$define"
9198                 timeincl=`./findhdr time.h`" $timeincl"
9199                 echo "We'll include <time.h>." >&4;;
9200         *) i_time="$undef";;
9201         esac
9202         case "$flags" in
9203         *I_SYSTIME*) i_systime="$define"
9204                 timeincl=`./findhdr sys/time.h`" $timeincl"
9205                 echo "We'll include <sys/time.h>." >&4;;
9206         *) i_systime="$undef";;
9207         esac
9208         $rm -f try.c try
9209 fi
9210
9211 : check for fd_set items
9212 $cat <<EOM
9213
9214 Checking to see how well your C compiler handles fd_set and friends ...
9215 EOM
9216 $cat >fd_set.c <<EOCP
9217 #$i_systime I_SYS_TIME
9218 #$i_sysselct I_SYS_SELECT
9219 #$d_socket HAS_SOCKET
9220 #include <sys/types.h>
9221 #ifdef HAS_SOCKET
9222 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9223 #endif
9224 #ifdef I_SYS_TIME
9225 #include <sys/time.h>
9226 #endif
9227 #ifdef I_SYS_SELECT
9228 #include <sys/select.h>
9229 #endif
9230 int main() {
9231         fd_set fds;
9232
9233 #ifdef TRYBITS
9234         if(fds.fds_bits);
9235 #endif
9236
9237 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9238         exit(0);
9239 #else
9240         exit(1);
9241 #endif
9242 }
9243 EOCP
9244 set fd_set -DTRYBITS
9245 if eval $compile; then
9246         d_fds_bits="$define"
9247         d_fd_set="$define"
9248         echo "Well, your system knows about the normal fd_set typedef..." >&4
9249         if ./fd_set; then
9250                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9251                 d_fd_macros="$define"
9252         else
9253                 $cat >&4 <<'EOM'
9254 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9255 EOM
9256                 d_fd_macros="$undef"
9257         fi
9258 else
9259         $cat <<'EOM'
9260 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9261 EOM
9262         set fd_set
9263         if eval $compile; then
9264                 d_fds_bits="$undef"
9265                 d_fd_set="$define"
9266                 echo "Well, your system has some sort of fd_set available..." >&4
9267                 if ./fd_set; then
9268                         echo "and you have the normal fd_set macros." >&4
9269                         d_fd_macros="$define"
9270                 else
9271                         $cat <<'EOM'
9272 but not the normal fd_set macros!  Gross!  More work for me...
9273 EOM
9274                         d_fd_macros="$undef"
9275                 fi
9276         else
9277         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9278                 d_fd_set="$undef"
9279                 d_fds_bits="$undef"
9280                 d_fd_macros="$undef"
9281         fi
9282 fi
9283 $rm -f fd_set*
9284
9285 : see if fgetpos exists
9286 set fgetpos d_fgetpos
9287 eval $inlibc
9288
9289 : see if flock exists
9290 set flock d_flock
9291 eval $inlibc
9292
9293 : see if fork exists
9294 set fork d_fork
9295 eval $inlibc
9296
9297 : see if pathconf exists
9298 set pathconf d_pathconf
9299 eval $inlibc
9300
9301 : see if fpathconf exists
9302 set fpathconf d_fpathconf
9303 eval $inlibc
9304
9305
9306 : check for fpos64_t
9307 echo " "
9308 echo "Checking to see if you have fpos64_t..." >&4
9309 $cat >try.c <<EOCP
9310 #include <stdio.h>
9311 int main() { fpos64_t x = 7; }
9312 EOCP
9313 set try
9314 if eval $compile; then
9315         val="$define"
9316         echo "You have fpos64_t."
9317 else
9318         val="$undef"
9319         echo "You do not have fpos64_t."
9320         case "$fpossize" in
9321         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9322         esac
9323 fi
9324 $rm -f try.* try
9325 set d_fpos64_t
9326 eval $setvar
9327
9328 : see if frexpl exists
9329 set frexpl d_frexpl
9330 eval $inlibc
9331
9332 hasstruct='varname=$1; struct=$2; shift; shift;
9333 while $test $# -ge 2; do
9334         case "$1" in
9335         $define) echo "#include <$2>";;
9336         esac ;
9337     shift 2;
9338 done > try.c;
9339 echo "int main () { struct $struct foo; }" >> try.c;
9340 set try;
9341 if eval $compile; then
9342         val="$define";
9343 else
9344         val="$undef";
9345 fi;
9346 set $varname;
9347 eval $setvar;
9348 $rm -f try.c try.o'
9349
9350 : see if this is a sys/param system
9351 set sys/param.h i_sysparam
9352 eval $inhdr
9353
9354 : see if this is a sys/mount.h system
9355 set sys/mount.h i_sysmount
9356 eval $inhdr
9357
9358 : see if sys/types.h has to be included
9359 set sys/types.h i_systypes
9360 eval $inhdr
9361
9362
9363 echo " "
9364 echo "Checking to see if your system supports struct fs_data..." >&4
9365 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9366 eval $hasstruct
9367 case "$d_fs_data_s" in
9368 "$define")      echo "Yes, it does."   ;;
9369 *)              echo "No, it doesn't." ;;
9370 esac
9371
9372 : see if fseeko exists
9373 set fseeko d_fseeko
9374 eval $inlibc
9375 case "$longsize" in
9376 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9377 esac
9378
9379 : see if fsetpos exists
9380 set fsetpos d_fsetpos
9381 eval $inlibc
9382
9383
9384 : see if fstatfs exists
9385 set fstatfs d_fstatfs
9386 eval $inlibc
9387
9388
9389 : see if statvfs exists
9390 set statvfs d_statvfs
9391 eval $inlibc
9392
9393 : see if fstatvfs exists
9394 set fstatvfs d_fstatvfs
9395 eval $inlibc
9396
9397
9398 : see if fsync exists
9399 set fsync d_fsync
9400 eval $inlibc
9401
9402 : see if ftello exists
9403 set ftello d_ftello
9404 eval $inlibc
9405 case "$longsize" in
9406 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9407 esac
9408
9409 : see if getcwd exists
9410 set getcwd d_getcwd
9411 eval $inlibc
9412
9413 : see if getespwnam exists
9414 set getespwnam d_getespwnam
9415 eval $inlibc
9416
9417
9418 : see if getfsstat exists
9419 set getfsstat d_getfsstat
9420 eval $inlibc
9421
9422 : see if getgrent exists
9423 set getgrent d_getgrent
9424 eval $inlibc
9425
9426 : see if gethostbyaddr exists
9427 set gethostbyaddr d_gethbyaddr
9428 eval $inlibc
9429
9430 : see if gethostbyname exists
9431 set gethostbyname d_gethbyname
9432 eval $inlibc
9433
9434 : see if gethostent exists
9435 set gethostent d_gethent
9436 eval $inlibc
9437
9438 : see how we will look up host name
9439 echo " "
9440 call=''
9441 if set gethostname val -f d_gethname; eval $csym; $val; then
9442         echo 'gethostname() found.' >&4
9443         d_gethname="$define"
9444         call=gethostname
9445 fi
9446 if set uname val -f d_uname; eval $csym; $val; then
9447         if ./xenix; then
9448                 $cat <<'EOM'
9449 uname() was found, but you're running xenix, and older versions of xenix
9450 have a broken uname(). If you don't really know whether your xenix is old
9451 enough to have a broken system call, use the default answer.
9452
9453 EOM
9454                 dflt=y
9455                 case "$d_uname" in
9456                 "$define") dflt=n;;
9457                 esac
9458                 rp='Is your uname() broken?'
9459                 . ./myread
9460                 case "$ans" in
9461                 n*) d_uname="$define"; call=uname;;
9462                 esac
9463         else
9464                 echo 'uname() found.' >&4
9465                 d_uname="$define"
9466                 case "$call" in
9467                 '') call=uname ;;
9468                 esac
9469         fi
9470 fi
9471 case "$d_gethname" in
9472 '') d_gethname="$undef";;
9473 esac
9474 case "$d_uname" in
9475 '') d_uname="$undef";;
9476 esac
9477 case "$d_uname$d_gethname" in
9478 *define*)
9479         dflt=n
9480         cat <<EOM
9481  
9482 Every now and then someone has a $call() that lies about the hostname
9483 but can't be fixed for political or economic reasons.  If you wish, I can
9484 pretend $call() isn't there and maybe compute hostname at run-time
9485 thanks to the '$phostname' command.
9486
9487 EOM
9488         rp="Shall I ignore $call() from now on?"
9489         . ./myread
9490         case "$ans" in
9491         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9492         esac;;
9493 esac
9494 case "$phostname" in
9495 '') aphostname='';;
9496 *) case "$aphostname" in
9497         /*) ;;
9498         *) set X $phostname
9499                 shift
9500                 file=$1
9501                 shift
9502                 file=`./loc $file $file $pth`
9503                 aphostname=`echo $file $*`
9504                 ;;
9505         esac
9506         ;;
9507 esac
9508 case "$d_uname$d_gethname" in
9509 *define*) ;;
9510 *)
9511         case "$phostname" in
9512         '')
9513                 echo "There will be no way for $package to get your hostname." >&4;;
9514         *)
9515         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9516                 ;;
9517         esac;;
9518 esac
9519 case "$d_phostname" in
9520 '') d_phostname="$undef";;
9521 esac
9522
9523 : see if this is a netdb.h system
9524 set netdb.h i_netdb
9525 eval $inhdr
9526
9527 : see if prototypes for various gethostxxx netdb.h functions are available
9528 echo " "
9529 set d_gethostprotos gethostent $i_netdb netdb.h
9530 eval $hasproto
9531
9532 : see if getlogin exists
9533 set getlogin d_getlogin
9534 eval $inlibc
9535
9536 : see if getmnt exists
9537 set getmnt d_getmnt
9538 eval $inlibc
9539
9540 : see if getmntent exists
9541 set getmntent d_getmntent
9542 eval $inlibc
9543
9544 : see if getnetbyaddr exists
9545 set getnetbyaddr d_getnbyaddr
9546 eval $inlibc
9547
9548 : see if getnetbyname exists
9549 set getnetbyname d_getnbyname
9550 eval $inlibc
9551
9552 : see if getnetent exists
9553 set getnetent d_getnent
9554 eval $inlibc
9555
9556 : see if prototypes for various getnetxxx netdb.h functions are available
9557 echo " "
9558 set d_getnetprotos getnetent $i_netdb netdb.h
9559 eval $hasproto
9560
9561 : see if getpagesize exists
9562 set getpagesize d_getpagsz
9563 eval $inlibc
9564
9565
9566 : see if getprotobyname exists
9567 set getprotobyname d_getpbyname
9568 eval $inlibc
9569
9570 : see if getprotobynumber exists
9571 set getprotobynumber d_getpbynumber
9572 eval $inlibc
9573
9574 : see if getprotoent exists
9575 set getprotoent d_getpent
9576 eval $inlibc
9577
9578 : see if getpgid exists
9579 set getpgid d_getpgid
9580 eval $inlibc
9581
9582 : see if getpgrp2 exists
9583 set getpgrp2 d_getpgrp2
9584 eval $inlibc
9585
9586 : see if getppid exists
9587 set getppid d_getppid
9588 eval $inlibc
9589
9590 : see if getpriority exists
9591 set getpriority d_getprior
9592 eval $inlibc
9593
9594 : see if prototypes for various getprotoxxx netdb.h functions are available
9595 echo " "
9596 set d_getprotoprotos getprotoent $i_netdb netdb.h
9597 eval $hasproto
9598
9599 : see if getprpwnam exists
9600 set getprpwnam d_getprpwnam
9601 eval $inlibc
9602
9603 : see if getpwent exists
9604 set getpwent d_getpwent
9605 eval $inlibc
9606
9607
9608 : see if getservbyname exists
9609 set getservbyname d_getsbyname
9610 eval $inlibc
9611
9612 : see if getservbyport exists
9613 set getservbyport d_getsbyport
9614 eval $inlibc
9615
9616 : see if getservent exists
9617 set getservent d_getsent
9618 eval $inlibc
9619
9620 : see if prototypes for various getservxxx netdb.h functions are available
9621 echo " "
9622 set d_getservprotos getservent $i_netdb netdb.h
9623 eval $hasproto
9624
9625 : see if getspnam exists
9626 set getspnam d_getspnam
9627 eval $inlibc
9628
9629 : see if gettimeofday or ftime exists
9630 set gettimeofday d_gettimeod
9631 eval $inlibc
9632 case "$d_gettimeod" in
9633 "$undef")
9634         set ftime d_ftime 
9635         eval $inlibc
9636         ;;
9637 *)
9638         val="$undef"; set d_ftime; eval $setvar
9639         ;;
9640 esac
9641 case "$d_gettimeod$d_ftime" in
9642 "$undef$undef")
9643         echo " "
9644         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9645         ;;
9646 esac
9647
9648 : see if this is an grp system
9649 set grp.h i_grp
9650 eval $inhdr
9651
9652 case "$i_grp" in
9653 $define)
9654         xxx=`./findhdr grp.h`
9655         $cppstdin $cppflags $cppminus < $xxx >$$.h
9656
9657         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9658                 val="$define"
9659         else
9660                 val="$undef"
9661         fi
9662         set d_grpasswd
9663         eval $setvar
9664
9665         $rm -f $$.h
9666         ;;
9667 *)
9668         val="$undef";
9669         set d_grpasswd; eval $setvar
9670         ;;
9671 esac
9672
9673 : see if hasmntopt exists
9674 set hasmntopt d_hasmntopt
9675 eval $inlibc
9676
9677 : see if this is a netinet/in.h or sys/in.h system
9678 set netinet/in.h i_niin sys/in.h i_sysin
9679 eval $inhdr
9680
9681 : see if arpa/inet.h has to be included
9682 set arpa/inet.h i_arpainet
9683 eval $inhdr
9684
9685 : see if htonl --and friends-- exists
9686 val=''
9687 set htonl val
9688 eval $inlibc
9689
9690 : Maybe they are macros.
9691 case "$val" in
9692 $undef)
9693         $cat >htonl.c <<EOM
9694 #include <stdio.h>
9695 #include <sys/types.h>
9696 #$i_niin I_NETINET_IN
9697 #$i_sysin I_SYS_IN
9698 #$i_arpainet I_ARPA_INET
9699 #ifdef I_NETINET_IN
9700 #include <netinet/in.h>
9701 #endif
9702 #ifdef I_SYS_IN
9703 #include <sys/in.h>
9704 #endif
9705 #ifdef I_ARPA_INET
9706 #include <arpa/inet.h>
9707 #endif
9708 #ifdef htonl
9709 printf("Defined as a macro.");
9710 #endif
9711 EOM
9712         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9713         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9714                 val="$define"
9715                 echo "But it seems to be defined as a macro." >&4
9716         fi
9717         $rm -f htonl.?
9718         ;;
9719 esac
9720 set d_htonl
9721 eval $setvar
9722
9723 : see if iconv exists
9724 set iconv d_iconv
9725 eval $inlibc
9726
9727 : index or strchr
9728 echo " "
9729 if set index val -f; eval $csym; $val; then
9730         if set strchr val -f d_strchr; eval $csym; $val; then
9731                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9732                         val="$define"
9733                         vali="$undef"
9734                         echo "strchr() found." >&4
9735                 else
9736                         val="$undef"
9737                         vali="$define"
9738                         echo "index() found." >&4
9739                 fi
9740         else
9741                 val="$undef"
9742                 vali="$define"
9743                 echo "index() found." >&4
9744         fi
9745 else
9746         if set strchr val -f d_strchr; eval $csym; $val; then
9747                 val="$define"
9748                 vali="$undef"
9749                 echo "strchr() found." >&4
9750         else
9751                 echo "No index() or strchr() found!" >&4
9752                 val="$undef"
9753                 vali="$undef"
9754         fi
9755 fi
9756 set d_strchr; eval $setvar
9757 val="$vali"
9758 set d_index; eval $setvar
9759
9760 : check whether inet_aton exists
9761 set inet_aton d_inetaton
9762 eval $inlibc
9763
9764 : see if inttypes.h is available
9765 : we want a real compile instead of Inhdr because some systems
9766 : have an inttypes.h which includes non-existent headers
9767 echo " "
9768 $cat >try.c <<EOCP
9769 #include <inttypes.h>
9770 int main() {
9771         static int32_t foo32 = 0x12345678;
9772 }
9773 EOCP
9774 set try
9775 if eval $compile; then
9776         echo "<inttypes.h> found." >&4
9777         val="$define"
9778 else
9779         echo "<inttypes.h> NOT found." >&4
9780         val="$undef"
9781 fi
9782 $rm -f try.c try
9783 set i_inttypes
9784 eval $setvar
9785
9786 : check for int64_t
9787 echo " "
9788 echo "Checking to see if you have int64_t..." >&4
9789 $cat >try.c <<EOCP
9790 #include <sys/types.h>
9791 #$i_inttypes I_INTTYPES
9792 #ifdef I_INTTYPES
9793 #include <inttypes.h>
9794 #endif
9795 int main() { int64_t x = 7; }
9796 EOCP
9797 set try
9798 if eval $compile; then
9799         val="$define"
9800         echo "You have int64_t."
9801 else
9802         val="$undef"
9803         echo "You do not have int64_t."
9804 fi
9805 $rm -f try try.*
9806 set d_int64_t
9807 eval $setvar
9808
9809 : Look for isascii
9810 echo " "
9811 $cat >isascii.c <<'EOCP'
9812 #include <stdio.h>
9813 #include <ctype.h>
9814 int main() {
9815         int c = 'A';
9816         if (isascii(c))
9817                 exit(0);
9818         else
9819                 exit(1);
9820 }
9821 EOCP
9822 set isascii
9823 if eval $compile; then
9824         echo "isascii() found." >&4
9825         val="$define"
9826 else
9827         echo "isascii() NOT found." >&4
9828         val="$undef"
9829 fi
9830 set d_isascii
9831 eval $setvar
9832 $rm -f isascii*
9833
9834 : see if isnan exists
9835 set isnan d_isnan
9836 eval $inlibc
9837
9838 : see if isnanl exists
9839 set isnanl d_isnanl
9840 eval $inlibc
9841
9842 : see if killpg exists
9843 set killpg d_killpg
9844 eval $inlibc
9845
9846 : see if lchown exists
9847 echo " "
9848 $cat > try.c <<'EOCP'
9849 /* System header to define __stub macros and hopefully few prototypes,
9850     which can conflict with char lchown(); below.  */
9851 #include <assert.h>
9852 /* Override any gcc2 internal prototype to avoid an error.  */
9853 /* We use char because int might match the return type of a gcc2
9854    builtin and then its argument prototype would still apply.  */
9855 char lchown();
9856 int main() {
9857     /*  The GNU C library defines this for functions which it implements
9858         to always fail with ENOSYS.  Some functions are actually named
9859         something starting with __ and the normal name is an alias.  */
9860 #if defined (__stub_lchown) || defined (__stub___lchown)
9861 choke me
9862 #else
9863 lchown();
9864 #endif
9865 ; return 0; }
9866 EOCP
9867 set try
9868 if eval $compile; then
9869     $echo "lchown() found." >&4
9870     val="$define"
9871 else
9872     $echo "lchown() NOT found." >&4
9873     val="$undef"
9874 fi
9875 set d_lchown
9876 eval $setvar
9877
9878 : See if number of significant digits in a double precision number is known
9879 echo " "
9880 $cat >ldbl_dig.c <<EOM
9881 #$i_limits I_LIMITS
9882 #$i_float I_FLOAT
9883 #ifdef I_LIMITS
9884 #include <limits.h>
9885 #endif
9886 #ifdef I_FLOAT
9887 #include <float.h>
9888 #endif
9889 #ifdef LDBL_DIG
9890 printf("Contains LDBL_DIG");
9891 #endif
9892 EOM
9893 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9894 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9895         echo "LDBL_DIG found." >&4
9896         val="$define"
9897 else
9898         echo "LDBL_DIG NOT found." >&4
9899         val="$undef"
9900 fi
9901 $rm -f ldbl_dig.?
9902 set d_ldbl_dig
9903 eval $setvar
9904
9905 : see if link exists
9906 set link d_link
9907 eval $inlibc
9908
9909 : see if localeconv exists
9910 set localeconv d_locconv
9911 eval $inlibc
9912
9913 : see if lockf exists
9914 set lockf d_lockf
9915 eval $inlibc
9916
9917 : check for long long
9918 echo " "
9919 echo "Checking to see if you have long long..." >&4
9920 echo 'int main() { long long x = 7; return 0; }' > try.c
9921 set try
9922 if eval $compile; then
9923         val="$define"
9924         echo "You have long long."
9925 else
9926         val="$undef"
9927         echo "You do not have long long."
9928 fi
9929 $rm try.*
9930 set d_longlong
9931 eval $setvar
9932
9933 : check for length of long long
9934 case "${d_longlong}${longlongsize}" in
9935 $define)
9936         echo " "
9937         echo "Checking to see how big your long longs are..." >&4
9938         $cat >try.c <<'EOCP'
9939 #include <stdio.h>
9940 int main()
9941 {
9942     printf("%d\n", (int)sizeof(long long));
9943     return(0);
9944 }
9945 EOCP
9946         set try
9947         if eval $compile_ok; then
9948                 longlongsize=`./try$exe_ext`
9949                 echo "Your long longs are $longlongsize bytes long."
9950         else
9951                 dflt='8'
9952                 echo " "
9953                 echo "(I can't seem to compile the test program.  Guessing...)"
9954                 rp="What is the size of a long long (in bytes)?"
9955                 . ./myread
9956                 longlongsize="$ans"
9957         fi
9958         if $test "X$longsize" = "X$longlongsize"; then
9959                 echo "(That isn't any different from an ordinary long.)"
9960         fi      
9961         ;;
9962 esac
9963 $rm -f try.* try
9964
9965 : see if prototype for lseek is available
9966 echo " "
9967 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9968 eval $hasproto
9969
9970 : see if lstat exists
9971 set lstat d_lstat
9972 eval $inlibc
9973
9974 : see if madvise exists
9975 set madvise d_madvise
9976 eval $inlibc
9977
9978 : see if mblen exists
9979 set mblen d_mblen
9980 eval $inlibc
9981
9982 : see if mbstowcs exists
9983 set mbstowcs d_mbstowcs
9984 eval $inlibc
9985
9986 : see if mbtowc exists
9987 set mbtowc d_mbtowc
9988 eval $inlibc
9989
9990 : see if memchr exists
9991 set memchr d_memchr
9992 eval $inlibc
9993
9994 : see if memcmp exists
9995 set memcmp d_memcmp
9996 eval $inlibc
9997
9998 : see if memcpy exists
9999 set memcpy d_memcpy
10000 eval $inlibc
10001
10002 : see if memmove exists
10003 set memmove d_memmove
10004 eval $inlibc
10005
10006 : see if memset exists
10007 set memset d_memset
10008 eval $inlibc
10009
10010 : see if mkdir exists
10011 set mkdir d_mkdir
10012 eval $inlibc
10013
10014 : see if mkdtemp exists
10015 set mkdtemp d_mkdtemp
10016 eval $inlibc
10017
10018 : see if mkfifo exists
10019 set mkfifo d_mkfifo
10020 eval $inlibc
10021
10022 : see if mkstemp exists
10023 set mkstemp d_mkstemp
10024 eval $inlibc
10025
10026 : see if mkstemps exists
10027 set mkstemps d_mkstemps
10028 eval $inlibc
10029
10030 : see if mktime exists
10031 set mktime d_mktime
10032 eval $inlibc
10033
10034 : see if this is a sys/mman.h system
10035 set sys/mman.h i_sysmman
10036 eval $inhdr
10037
10038 : see if mmap exists
10039 set mmap d_mmap
10040 eval $inlibc
10041 : see what shmat returns
10042 : default to something harmless
10043 mmaptype='void *'
10044 case "$i_sysmman$d_mmap" in
10045 "$define$define")
10046         $cat >mmap.c <<'END'
10047 #include <sys/mman.h>
10048 void *mmap();
10049 END
10050         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10051                 mmaptype='void *'
10052         else
10053                 mmaptype='caddr_t'
10054         fi
10055         echo "and it returns ($mmaptype)." >&4
10056         ;;
10057 esac
10058
10059
10060
10061 : see if modfl exists
10062 set modfl d_modfl
10063 eval $inlibc
10064
10065 : see if mprotect exists
10066 set mprotect d_mprotect
10067 eval $inlibc
10068
10069 : see if msgctl exists
10070 set msgctl d_msgctl
10071 eval $inlibc
10072
10073 : see if msgget exists
10074 set msgget d_msgget
10075 eval $inlibc
10076
10077 : see if msgsnd exists
10078 set msgsnd d_msgsnd
10079 eval $inlibc
10080
10081 : see if msgrcv exists
10082 set msgrcv d_msgrcv
10083 eval $inlibc
10084
10085 : see how much of the 'msg*(2)' library is present.
10086 h_msg=true
10087 echo " "
10088 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10089 *"$undef"*) h_msg=false;;
10090 esac
10091 case "$osname" in
10092 freebsd)
10093     case "`ipcs 2>&1`" in
10094     "SVID messages"*"not configured"*)
10095         echo "Your $osname does not have the msg*(2) configured." >&4
10096         h_msg=false
10097         val="$undef"
10098         set msgctl d_msgctl
10099         eval $setvar
10100         set msgget d_msgget
10101         eval $setvar
10102         set msgsnd d_msgsnd
10103         eval $setvar
10104         set msgrcv d_msgrcv
10105         eval $setvar
10106         ;;
10107     esac
10108     ;;
10109 esac
10110 : we could also check for sys/ipc.h ...
10111 if $h_msg && $test `./findhdr sys/msg.h`; then
10112         echo "You have the full msg*(2) library." >&4
10113         val="$define"
10114 else
10115         echo "You don't have the full msg*(2) library." >&4
10116         val="$undef"
10117 fi
10118 set d_msg
10119 eval $setvar
10120
10121 : see if msync exists
10122 set msync d_msync
10123 eval $inlibc
10124
10125 : see if munmap exists
10126 set munmap d_munmap
10127 eval $inlibc
10128
10129 : see if nice exists
10130 set nice d_nice
10131 eval $inlibc
10132
10133
10134 echo " "
10135 echo "Checking which 64-bit integer type we could use..." >&4
10136
10137 case "$intsize" in
10138 8) val=int
10139    set quadtype
10140    eval $setvar
10141    val='"unsigned int"'
10142    set uquadtype
10143    eval $setvar
10144    quadkind=1
10145    ;;
10146 *) case "$longsize" in
10147    8) val=long
10148       set quadtype
10149       eval $setvar
10150       val='"unsigned long"'
10151       set uquadtype
10152       eval $setvar
10153       quadkind=2
10154       ;;
10155    *) case "$d_longlong:$longlongsize" in
10156       define:8)
10157         val='"long long"'
10158         set quadtype
10159         eval $setvar
10160         val='"unsigned long long"'
10161         set uquadtype
10162         eval $setvar
10163         quadkind=3
10164         ;;
10165       *) case "$d_int64_t" in
10166          define)
10167            val=int64_t
10168            set quadtype
10169            eval $setvar
10170            val=uint64_t
10171            set uquadtype
10172            eval $setvar
10173            quadkind=4
10174            ;;
10175          esac
10176          ;;
10177       esac
10178       ;;
10179    esac
10180    ;;
10181 esac
10182
10183 case "$quadtype" in
10184 '')     echo "Alas, no 64-bit integer types in sight." >&4
10185         d_quad="$undef"
10186         ;;
10187 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10188             verb="will"
10189         else
10190             verb="could"
10191         fi
10192         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10193         d_quad="$define"
10194         ;;
10195 esac
10196
10197 : check for length of character
10198 echo " "
10199 case "$charsize" in
10200 '')
10201         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10202         $cat >try.c <<'EOCP'
10203 #include <stdio.h>
10204 int main()
10205 {
10206     printf("%d\n", (int)sizeof(char));
10207     exit(0);
10208 }
10209 EOCP
10210         set try
10211         if eval $compile_ok; then
10212                 dflt=`./try`
10213         else
10214                 dflt='1'
10215                 echo "(I can't seem to compile the test program.  Guessing...)"
10216         fi
10217         ;;
10218 *)
10219         dflt="$charsize"
10220         ;;
10221 esac
10222 rp="What is the size of a character (in bytes)?"
10223 . ./myread
10224 charsize="$ans"
10225 $rm -f try.c try
10226
10227 : check for volatile keyword
10228 echo " "
10229 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10230 $cat >try.c <<'EOCP'
10231 int main()
10232 {
10233         typedef struct _goo_struct goo_struct;
10234         goo_struct * volatile goo = ((goo_struct *)0);
10235         struct _goo_struct {
10236                 long long_int;
10237                 int reg_int;
10238                 char char_var;
10239         };
10240         typedef unsigned short foo_t;
10241         char *volatile foo;
10242         volatile int bar;
10243         volatile foo_t blech;
10244         foo = foo;
10245 }
10246 EOCP
10247 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10248         val="$define"
10249         echo "Yup, it does."
10250 else
10251         val="$undef"
10252         echo "Nope, it doesn't."
10253 fi
10254 set d_volatile
10255 eval $setvar
10256 $rm -f try.*
10257
10258
10259 echo " "
10260 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10261
10262 case "$use64bitint:$d_quad:$quadtype" in
10263 define:define:?*)
10264         ivtype="$quadtype"
10265         uvtype="$uquadtype"
10266         ivsize=8
10267         uvsize=8
10268         ;;
10269 *)      ivtype="long"
10270         uvtype="unsigned long"
10271         ivsize=$longsize
10272         uvsize=$longsize
10273         ;;
10274 esac
10275
10276 case "$uselongdouble:$d_longdbl" in
10277 define:define)
10278         nvtype="long double"
10279         nvsize=$longdblsize
10280         ;;
10281 *)      nvtype=double
10282         nvsize=$doublesize
10283         ;;
10284 esac
10285
10286 $echo "(IV will be "$ivtype", $ivsize bytes)"
10287 $echo "(UV will be "$uvtype", $uvsize bytes)"
10288 $echo "(NV will be "$nvtype", $nvsize bytes)"
10289
10290 $cat >try.c <<EOCP
10291 #$i_inttypes I_INTTYPES
10292 #ifdef I_INTTYPES
10293 #include <inttypes.h>
10294 #endif
10295 #include <stdio.h>
10296 int main() {
10297 #ifdef INT8
10298    int8_t i =  INT8_MAX;
10299   uint8_t u = UINT8_MAX;
10300   printf("int8_t\n");
10301 #endif
10302 #ifdef INT16
10303    int16_t i =  INT16_MAX;
10304   uint16_t i = UINT16_MAX;
10305   printf("int16_t\n");
10306 #endif
10307 #ifdef INT32
10308    int32_t i =  INT32_MAX;
10309   uint32_t u = UINT32_MAX;
10310   printf("int32_t\n");
10311 #endif
10312 }
10313 EOCP
10314
10315 case "$i8type" in
10316 '')     case "$charsize" in
10317         1)      i8type=char
10318                 u8type="unsigned char"
10319                 i8size=$charsize
10320                 u8size=$charsize
10321                 ;;
10322         esac
10323         ;;
10324 esac
10325 case "$i8type" in
10326 '')     set try -DINT8
10327         if eval $compile; then
10328                 case "`./try$exe_ext`" in
10329                 int8_t) i8type=int8_t
10330                         u8type=uint8_t
10331                         i8size=1
10332                         u8size=1
10333                         ;;
10334                 esac
10335         fi
10336         ;;
10337 esac
10338 case "$i8type" in
10339 '')     if $test $charsize -ge 1; then
10340                 i8type=char
10341                 u8type="unsigned char"
10342                 i8size=$charsize
10343                 u8size=$charsize
10344         fi
10345         ;;
10346 esac
10347
10348 case "$i16type" in
10349 '')     case "$shortsize" in
10350         2)      i16type=short
10351                 u16type="unsigned short"
10352                 i16size=$shortsize
10353                 u16size=$shortsize
10354                 ;;
10355         esac
10356         ;;
10357 esac
10358 case "$i16type" in
10359 '')     set try -DINT16
10360         if eval $compile; then
10361                 case "`./try$exe_ext`" in
10362                 int16_t)
10363                         i16type=int16_t
10364                         u16type=uint16_t
10365                         i16size=2
10366                         u16size=2
10367                         ;;
10368                 esac
10369         fi
10370         ;;
10371 esac
10372 case "$i16type" in
10373 '')     if $test $shortsize -ge 2; then
10374                 i16type=short
10375                 u16type="unsigned short"
10376                 i16size=$shortsize
10377                 u16size=$shortsize
10378         fi
10379         ;;
10380 esac
10381
10382 case "$i32type" in
10383 '')     case "$longsize" in
10384         4)      i32type=long
10385                 u32type="unsigned long"
10386                 i32size=$longsize
10387                 u32size=$longsize
10388                 ;;
10389         *)      case "$intsize" in
10390                 4)      i32type=int
10391                         u32type="unsigned int"
10392                         i32size=$intsize
10393                         u32size=$intsize
10394                         ;;
10395                 esac
10396                 ;;
10397         esac
10398         ;;
10399 esac
10400 case "$i32type" in
10401 '')     set try -DINT32
10402         if eval $compile; then
10403                 case "`./try$exe_ext`" in
10404                 int32_t)
10405                         i32type=int32_t
10406                         u32type=uint32_t
10407                         i32size=4
10408                         u32size=4
10409                         ;;
10410                 esac
10411         fi
10412         ;;
10413 esac
10414 case "$i32type" in
10415 '')     if $test $intsize -ge 4; then
10416                 i32type=int
10417                 u32type="unsigned int"
10418                 i32size=$intsize
10419                 u32size=$intsize
10420         fi
10421         ;;
10422 esac
10423
10424 case "$i64type" in
10425 '')     case "$d_quad:$quadtype" in
10426         define:?*)
10427                 i64type="$quadtype"
10428                 u64type="$uquadtype"
10429                 i64size=8
10430                 u64size=8
10431                 ;;
10432         esac
10433         ;;
10434 esac
10435
10436 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10437 : volatile so that the compiler has to store it out to memory.
10438 if test X"$d_volatile" = X"$define"; then
10439         volatile=volatile
10440 fi
10441 $cat <<EOP >try.c
10442 #include <stdio.h>
10443 #include <sys/types.h>
10444 #include <signal.h>
10445 #ifdef SIGFPE
10446 $volatile int bletched = 0;
10447 $signal_t blech(s) int s; { bletched = 1; }
10448 #endif
10449 int main() {
10450     $uvtype u = 0;
10451     $nvtype d;
10452     int     n = 8 * $uvsize;
10453     int     i;
10454 #ifdef SIGFPE
10455     signal(SIGFPE, blech);
10456 #endif
10457
10458     for (i = 0; i < n; i++) {
10459       u = u << 1 | ($uvtype)1;
10460       d = ($nvtype)u;
10461       if (($uvtype)d != u)
10462         break;
10463       if (d <= 0)
10464         break;
10465       d = ($nvtype)(u - 1);
10466       if (($uvtype)d != (u - 1))
10467         break;
10468 #ifdef SIGFPE
10469       if (bletched) {
10470         break;
10471 #endif
10472       } 
10473     }
10474     printf("%d\n", ((i == n) ? -n : i));
10475     exit(0);
10476 }
10477 EOP
10478 set try
10479
10480 d_nv_preserves_uv="$undef"
10481 if eval $compile; then
10482         d_nv_preserves_uv_bits="`./try$exe_ext`"
10483 fi
10484 case "$d_nv_preserves_uv_bits" in
10485 \-[1-9]*)       
10486         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10487         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10488         d_nv_preserves_uv="$define"
10489         ;;
10490 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10491         d_nv_preserves_uv="$undef" ;;
10492 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10493         d_nv_preserves_uv_bits="$undef" ;;
10494 esac
10495
10496 $rm -f try.* try
10497
10498
10499 : check for off64_t
10500 echo " "
10501 echo "Checking to see if you have off64_t..." >&4
10502 $cat >try.c <<EOCP
10503 #include <sys/types.h>
10504 #include <unistd.h>
10505 int main() { off64_t x = 7; }
10506 EOCP
10507 set try
10508 if eval $compile; then
10509         val="$define"
10510         echo "You have off64_t."
10511 else
10512         val="$undef"
10513         echo "You do not have off64_t."
10514         case "$lseeksize" in
10515         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10516         esac
10517 fi
10518 $rm -f try.* try
10519 set d_off64_t
10520 eval $setvar
10521
10522 : see if POSIX threads are available
10523 set pthread.h i_pthread
10524 eval $inhdr
10525
10526
10527
10528
10529 : how to create joinable pthreads
10530 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10531         echo " "
10532         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10533         $cat >try.c <<'EOCP'
10534 #include <pthread.h>
10535 int main() {
10536     int detachstate = JOINABLE;
10537 }
10538 EOCP
10539         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10540         if eval $compile; then
10541                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10542                 val="$undef" # Yes, undef.
10543                 set d_old_pthread_create_joinable
10544                 eval $setvar
10545                 val=""
10546                 set old_pthread_create_joinable
10547                 eval $setvar
10548         else
10549                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10550                 if eval $compile; then
10551                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10552                         val="$define"
10553                         set d_old_pthread_create_joinable
10554                         eval $setvar
10555                         val=PTHREAD_CREATE_UNDETACHED
10556                         set old_pthread_create_joinable
10557                         eval $setvar
10558                 else            
10559                         set try -DJOINABLE=__UNDETACHED
10560                         if eval $compile; then
10561                                 echo "You seem to use __UNDETACHED." >&4
10562                                 val="$define"
10563                                 set d_old_pthread_create_joinable
10564                                 eval $setvar
10565                                 val=__UNDETACHED
10566                                 set old_pthread_create_joinable
10567                                 eval $setvar
10568                         else
10569                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10570                                 val="$define"
10571                                 set d_old_pthread_create_joinable
10572                                 eval $setvar
10573                                 val=0
10574                                 set old_pthread_create_joinable
10575                                 eval $setvar
10576                         fi
10577                 fi
10578         fi
10579         $rm -f try try.*
10580 else
10581     d_old_pthread_create_joinable="$undef"
10582     old_pthread_create_joinable=""
10583 fi
10584
10585 : see if pause exists
10586 set pause d_pause
10587 eval $inlibc
10588
10589 : see if pipe exists
10590 set pipe d_pipe
10591 eval $inlibc
10592
10593 : see if poll exists
10594 set poll d_poll
10595 eval $inlibc
10596
10597
10598 : see whether the various POSIXish _yields exist
10599 $cat >try.c <<EOP
10600 #include <pthread.h>
10601 #include <stdio.h>
10602 int main() {
10603 #ifdef SCHED_YIELD
10604         sched_yield();
10605 #else
10606 #ifdef PTHREAD_YIELD
10607         pthread_yield();
10608 #else
10609 #ifdef PTHREAD_YIELD_NULL
10610         pthread_yield(NULL);
10611 #endif
10612 #endif
10613 #endif
10614 }
10615 EOP
10616 : see if sched_yield exists
10617 set try -DSCHED_YIELD
10618 if eval $compile; then
10619     val="$define"
10620     sched_yield='sched_yield()'
10621 else
10622     val="$undef"
10623 fi
10624 case "$usethreads" in
10625 $define)
10626         case "$val" in
10627         $define) echo 'sched_yield() found.' >&4        ;;
10628         *)       echo 'sched_yield() NOT found.' >&4    ;;
10629         esac
10630 esac
10631 set d_sched_yield
10632 eval $setvar
10633
10634 : see if pthread_yield exists
10635 set try -DPTHREAD_YIELD
10636 if eval $compile; then
10637     val="$define"
10638     case "$sched_yield" in
10639     '') sched_yield='pthread_yield()' ;;
10640     esac
10641 else
10642     set try -DPTHREAD_YIELD_NULL
10643     if eval $compile; then
10644         val="$define"
10645         case "$sched_yield" in
10646         '') sched_yield='pthread_yield(NULL)' ;;
10647         esac
10648     else
10649         val="$undef"
10650     fi
10651 fi
10652 case "$usethreads" in
10653 $define)
10654         case "$val" in
10655         $define) echo 'pthread_yield() found.' >&4      ;;
10656         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10657         esac
10658         ;;
10659 esac
10660 set d_pthread_yield
10661 eval $setvar
10662
10663 case "$sched_yield" in
10664 '') sched_yield=undef ;;
10665 esac
10666
10667 $rm -f try try.*
10668
10669 : see if this is a pwd.h system
10670 set pwd.h i_pwd
10671 eval $inhdr
10672
10673 case "$i_pwd" in
10674 $define)
10675         xxx=`./findhdr pwd.h`
10676         $cppstdin $cppflags $cppminus < $xxx >$$.h
10677
10678         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10679                 val="$define"
10680         else
10681                 val="$undef"
10682         fi
10683         set d_pwquota
10684         eval $setvar
10685
10686         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10687                 val="$define"
10688         else
10689                 val="$undef"
10690         fi
10691         set d_pwage
10692         eval $setvar
10693
10694         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10695                 val="$define"
10696         else
10697                 val="$undef"
10698         fi
10699         set d_pwchange
10700         eval $setvar
10701
10702         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10703                 val="$define"
10704         else
10705                 val="$undef"
10706         fi
10707         set d_pwclass
10708         eval $setvar
10709
10710         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10711                 val="$define"
10712         else
10713                 val="$undef"
10714         fi
10715         set d_pwexpire
10716         eval $setvar
10717
10718         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10719                 val="$define"
10720         else
10721                 val="$undef"
10722         fi
10723         set d_pwcomment
10724         eval $setvar
10725
10726         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10727                 val="$define"
10728         else
10729                 val="$undef"
10730         fi
10731         set d_pwgecos
10732         eval $setvar
10733
10734         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10735                 val="$define"
10736         else
10737                 val="$undef"
10738         fi
10739         set d_pwpasswd
10740         eval $setvar
10741
10742         $rm -f $$.h
10743         ;;
10744 *)
10745         val="$undef"; 
10746         set d_pwquota; eval $setvar
10747         set d_pwage; eval $setvar
10748         set d_pwchange; eval $setvar
10749         set d_pwclass; eval $setvar
10750         set d_pwexpire; eval $setvar
10751         set d_pwcomment; eval $setvar
10752         set d_pwgecos; eval $setvar
10753         set d_pwpasswd; eval $setvar
10754         ;;
10755 esac
10756
10757 : see if readdir and friends exist
10758 set readdir d_readdir
10759 eval $inlibc
10760 set seekdir d_seekdir
10761 eval $inlibc
10762 set telldir d_telldir
10763 eval $inlibc
10764 set rewinddir d_rewinddir
10765 eval $inlibc
10766
10767 : see if readlink exists
10768 set readlink d_readlink
10769 eval $inlibc
10770
10771 : see if rename exists
10772 set rename d_rename
10773 eval $inlibc
10774
10775 : see if rmdir exists
10776 set rmdir d_rmdir
10777 eval $inlibc
10778
10779 : see if memory.h is available.
10780 val=''
10781 set memory.h val
10782 eval $inhdr
10783
10784 : See if it conflicts with string.h
10785 case "$val" in
10786 $define)
10787         case "$strings" in
10788         '') ;;
10789         *)
10790                 $cppstdin $cppflags $cppminus < $strings > mem.h
10791                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10792                         echo " "
10793                         echo "We won't be including <memory.h>."
10794                         val="$undef"
10795                 fi
10796                 $rm -f mem.h
10797                 ;;
10798         esac
10799 esac
10800 set i_memory
10801 eval $setvar
10802
10803 : can bcopy handle overlapping blocks?
10804 val="$undef"
10805 case "$d_bcopy" in
10806 "$define")
10807         echo " "
10808         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10809         $cat >try.c <<EOCP
10810 #$i_memory I_MEMORY
10811 #$i_stdlib I_STDLIB
10812 #$i_string I_STRING
10813 #$i_unistd I_UNISTD
10814 EOCP
10815         $cat >>try.c <<'EOCP'
10816 #include <stdio.h>
10817 #ifdef I_MEMORY
10818 #  include <memory.h>
10819 #endif
10820 #ifdef I_STDLIB
10821 #  include <stdlib.h>
10822 #endif
10823 #ifdef I_STRING
10824 #  include <string.h>
10825 #else
10826 #  include <strings.h>
10827 #endif
10828 #ifdef I_UNISTD
10829 #  include <unistd.h>  /* Needed for NetBSD */
10830 #endif
10831 int main()
10832 {
10833 char buf[128], abc[128];
10834 char *b;
10835 int len;
10836 int off;
10837 int align;
10838
10839 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10840
10841 for (align = 7; align >= 0; align--) {
10842         for (len = 36; len; len--) {
10843                 b = buf+align;
10844                 bcopy(abc, b, len);
10845                 for (off = 1; off <= len; off++) {
10846                         bcopy(b, b+off, len);
10847                         bcopy(b+off, b, len);
10848                         if (bcmp(b, abc, len))
10849                                 exit(1);
10850                 }
10851         }
10852 }
10853 exit(0);
10854 }
10855 EOCP
10856         set try
10857         if eval $compile_ok; then
10858                 if ./try 2>/dev/null; then
10859                         echo "Yes, it can."
10860                         val="$define"
10861                 else
10862                         echo "It can't, sorry."
10863                         case "$d_memmove" in
10864                         "$define") echo "But that's Ok since you have memmove()." ;;
10865                         esac
10866                 fi
10867         else
10868                 echo "(I can't compile the test program, so we'll assume not...)"
10869                 case "$d_memmove" in
10870                 "$define") echo "But that's Ok since you have memmove()." ;;
10871                 esac
10872         fi
10873         ;;
10874 esac
10875 $rm -f try.* try core
10876 set d_safebcpy
10877 eval $setvar
10878
10879 : can memcpy handle overlapping blocks?
10880 val="$undef"
10881 case "$d_memcpy" in
10882 "$define")
10883         echo " "
10884         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10885         $cat >try.c <<EOCP
10886 #$i_memory I_MEMORY
10887 #$i_stdlib I_STDLIB
10888 #$i_string I_STRING
10889 #$i_unistd I_UNISTD
10890 EOCP
10891         $cat >>try.c <<'EOCP'
10892 #include <stdio.h>
10893 #ifdef I_MEMORY
10894 #  include <memory.h>
10895 #endif
10896 #ifdef I_STDLIB
10897 #  include <stdlib.h>
10898 #endif
10899 #ifdef I_STRING
10900 #  include <string.h>
10901 #else
10902 #  include <strings.h>
10903 #endif
10904 #ifdef I_UNISTD
10905 #  include <unistd.h>  /* Needed for NetBSD */
10906 #endif
10907 int main()
10908 {
10909 char buf[128], abc[128];
10910 char *b;
10911 int len;
10912 int off;
10913 int align;
10914
10915 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10916    try to store the string in read-only memory. */
10917 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10918
10919 for (align = 7; align >= 0; align--) {
10920         for (len = 36; len; len--) {
10921                 b = buf+align;
10922                 memcpy(b, abc, len);
10923                 for (off = 1; off <= len; off++) {
10924                         memcpy(b+off, b, len);
10925                         memcpy(b, b+off, len);
10926                         if (memcmp(b, abc, len))
10927                                 exit(1);
10928                 }
10929         }
10930 }
10931 exit(0);
10932 }
10933 EOCP
10934         set try
10935         if eval $compile_ok; then
10936                 if ./try 2>/dev/null; then
10937                         echo "Yes, it can."
10938                         val="$define"
10939                 else
10940                         echo "It can't, sorry."
10941                         case "$d_memmove" in
10942                         "$define") echo "But that's Ok since you have memmove()." ;;
10943                         esac
10944                 fi
10945         else
10946                 echo "(I can't compile the test program, so we'll assume not...)"
10947                 case "$d_memmove" in
10948                 "$define") echo "But that's Ok since you have memmove()." ;;
10949                 esac
10950         fi
10951         ;;
10952 esac
10953 $rm -f try.* try core
10954 set d_safemcpy
10955 eval $setvar
10956
10957 : can memcmp be trusted to compare relative magnitude?
10958 val="$undef"
10959 case "$d_memcmp" in
10960 "$define")
10961         echo " "
10962         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10963         $cat >try.c <<EOCP
10964 #$i_memory I_MEMORY
10965 #$i_stdlib I_STDLIB
10966 #$i_string I_STRING
10967 #$i_unistd I_UNISTD
10968 EOCP
10969         $cat >>try.c <<'EOCP'
10970 #include <stdio.h>
10971 #ifdef I_MEMORY
10972 #  include <memory.h>
10973 #endif
10974 #ifdef I_STDLIB
10975 #  include <stdlib.h>
10976 #endif
10977 #ifdef I_STRING
10978 #  include <string.h>
10979 #else
10980 #  include <strings.h>
10981 #endif
10982 #ifdef I_UNISTD
10983 #  include <unistd.h>  /* Needed for NetBSD */
10984 #endif
10985 int main()
10986 {
10987 char a = -1;
10988 char b = 0;
10989 if ((a < b) && memcmp(&a, &b, 1) < 0)
10990         exit(1);
10991 exit(0);
10992 }
10993 EOCP
10994         set try
10995         if eval $compile_ok; then
10996                 if ./try 2>/dev/null; then
10997                         echo "Yes, it can."
10998                         val="$define"
10999                 else
11000                         echo "No, it can't (it uses signed chars)."
11001                 fi
11002         else
11003                 echo "(I can't compile the test program, so we'll assume not...)"
11004         fi
11005         ;;
11006 esac
11007 $rm -f try.* try core
11008 set d_sanemcmp
11009 eval $setvar
11010
11011 : see if prototype for sbrk is available
11012 echo " "
11013 set d_sbrkproto sbrk $i_unistd unistd.h
11014 eval $hasproto
11015
11016 : see if select exists
11017 set select d_select
11018 eval $inlibc
11019
11020 : see if semctl exists
11021 set semctl d_semctl
11022 eval $inlibc
11023
11024 : see if semget exists
11025 set semget d_semget
11026 eval $inlibc
11027
11028 : see if semop exists
11029 set semop d_semop
11030 eval $inlibc
11031
11032 : see how much of the 'sem*(2)' library is present.
11033 h_sem=true
11034 echo " "
11035 case "$d_semctl$d_semget$d_semop" in
11036 *"$undef"*) h_sem=false;;
11037 esac
11038 case "$osname" in
11039 freebsd)
11040     case "`ipcs 2>&1`" in
11041     "SVID messages"*"not configured"*)
11042         echo "Your $osname does not have the sem*(2) configured." >&4
11043         h_sem=false
11044         val="$undef"
11045         set semctl d_semctl
11046         eval $setvar
11047         set semget d_semget
11048         eval $setvar
11049         set semop d_semop
11050         eval $setvar
11051         ;;
11052     esac
11053     ;;
11054 esac
11055 : we could also check for sys/ipc.h ...
11056 if $h_sem && $test `./findhdr sys/sem.h`; then
11057         echo "You have the full sem*(2) library." >&4
11058         val="$define"
11059 else
11060         echo "You don't have the full sem*(2) library." >&4
11061         val="$undef"
11062 fi
11063 set d_sem
11064 eval $setvar
11065
11066 : see whether sys/sem.h defines union semun
11067 echo " "
11068 $cat > try.c <<'END'
11069 #include <sys/types.h>
11070 #include <sys/ipc.h>
11071 #include <sys/sem.h>
11072 int main () { union semun semun; semun.buf = 0; }
11073 END
11074 set try
11075 if eval $compile; then
11076     echo "You have union semun in <sys/sem.h>." >&4
11077     val="$define"
11078 else
11079     echo "You do not have union semun in <sys/sem.h>." >&4
11080     val="$undef"
11081 fi
11082 $rm -f try try.c try.h
11083 set d_union_semun
11084 eval $setvar
11085
11086 : see how to do semctl IPC_STAT
11087 case "$d_sem" in
11088 $define)
11089     : see whether semctl IPC_STAT can use union semun
11090     echo " "
11091     $cat > try.h <<END
11092 #ifndef S_IRUSR
11093 #   ifdef S_IREAD
11094 #       define S_IRUSR S_IREAD
11095 #       define S_IWUSR S_IWRITE
11096 #       define S_IXUSR S_IEXEC
11097 #   else
11098 #       define S_IRUSR 0400
11099 #       define S_IWUSR 0200
11100 #       define S_IXUSR 0100
11101 #   endif
11102 #   define S_IRGRP (S_IRUSR>>3)
11103 #   define S_IWGRP (S_IWUSR>>3)
11104 #   define S_IXGRP (S_IXUSR>>3)
11105 #   define S_IROTH (S_IRUSR>>6)
11106 #   define S_IWOTH (S_IWUSR>>6)
11107 #   define S_IXOTH (S_IXUSR>>6)
11108 #endif
11109 #ifndef S_IRWXU
11110 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11111 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11112 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11113 #endif
11114 END
11115
11116     $cat > try.c <<END
11117 #include <sys/types.h>
11118 #include <sys/ipc.h>
11119 #include <sys/sem.h>
11120 #include <sys/stat.h>
11121 #include <stdio.h>
11122 #include <errno.h>
11123 #include "try.h"
11124 #ifndef errno
11125 extern int errno;
11126 #endif
11127 #$d_union_semun HAS_UNION_SEMUN
11128 int main() {
11129     union semun
11130 #ifndef HAS_UNION_SEMUN
11131     {
11132         int val;
11133         struct semid_ds *buf;
11134         unsigned short *array;
11135     }
11136 #endif
11137     arg;
11138     int sem, st;
11139
11140 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11141     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11142     if (sem > -1) {
11143         struct semid_ds argbuf;
11144         arg.buf = &argbuf;
11145 #       ifdef IPC_STAT
11146         st = semctl(sem, 0, IPC_STAT, arg);
11147         if (st == 0)
11148             printf("semun\n");
11149         else
11150 #       endif /* IPC_STAT */
11151             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11152 #       ifdef IPC_RMID
11153         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11154 #       endif /* IPC_RMID */
11155             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11156     } else
11157 #endif /* IPC_PRIVATE && ... */
11158         printf("semget failed: errno = %d\n", errno);
11159   return 0;
11160 }
11161 END
11162     val="$undef"
11163     set try
11164     if eval $compile; then
11165         xxx=`./try`
11166         case "$xxx" in
11167         semun) val="$define" ;;
11168         esac
11169     fi
11170     $rm -f try try.c
11171     set d_semctl_semun
11172     eval $setvar
11173     case "$d_semctl_semun" in
11174     $define)
11175         echo "You can use union semun for semctl IPC_STAT." >&4
11176         also='also'
11177         ;;
11178     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11179         also=''
11180         ;;
11181     esac
11182
11183     : see whether semctl IPC_STAT can use struct semid_ds pointer
11184     $cat > try.c <<'END'
11185 #include <sys/types.h>
11186 #include <sys/ipc.h>
11187 #include <sys/sem.h>
11188 #include <sys/stat.h>
11189 #include "try.h"
11190 #include <stdio.h>
11191 #include <errno.h>
11192 #ifndef errno
11193 extern int errno;
11194 #endif
11195 int main() {
11196     struct semid_ds arg;
11197     int sem, st;
11198
11199 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11200     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11201     if (sem > -1) {
11202 #       ifdef IPC_STAT
11203         st = semctl(sem, 0, IPC_STAT, &arg);
11204         if (st == 0)
11205             printf("semid_ds\n");
11206         else
11207 #       endif /* IPC_STAT */
11208             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11209 #       ifdef IPC_RMID
11210         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11211 #       endif /* IPC_RMID */
11212             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11213     } else
11214 #endif /* IPC_PRIVATE && ... */
11215         printf("semget failed: errno = %d\n", errno);
11216
11217     return 0;
11218 }
11219 END
11220     val="$undef"
11221     set try
11222     if eval $compile; then
11223         xxx=`./try`
11224         case "$xxx" in
11225         semid_ds) val="$define" ;;
11226         esac
11227     fi
11228     $rm -f try try.c
11229     set d_semctl_semid_ds
11230     eval $setvar
11231     case "$d_semctl_semid_ds" in
11232     $define)
11233         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11234         ;;
11235     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11236         ;;
11237     esac
11238     $rm -f try.h
11239     ;;
11240 *)  val="$undef"
11241
11242     # We do not have the full sem*(2) library, so assume we can not
11243     # use either.
11244
11245     set d_semctl_semun
11246     eval $setvar
11247
11248     set d_semctl_semid_ds
11249     eval $setvar
11250     ;;
11251 esac
11252
11253 : see if setegid exists
11254 set setegid d_setegid
11255 eval $inlibc
11256
11257 : see if seteuid exists
11258 set seteuid d_seteuid
11259 eval $inlibc
11260
11261 : see if setgrent exists
11262 set setgrent d_setgrent
11263 eval $inlibc
11264
11265 : see if sethostent exists
11266 set sethostent d_sethent
11267 eval $inlibc
11268
11269 : see if setlinebuf exists
11270 set setlinebuf d_setlinebuf
11271 eval $inlibc
11272
11273 : see if setlocale exists
11274 set setlocale d_setlocale
11275 eval $inlibc
11276
11277 : see if setnetent exists
11278 set setnetent d_setnent
11279 eval $inlibc
11280
11281 : see if setprotoent exists
11282 set setprotoent d_setpent
11283 eval $inlibc
11284
11285 : see if setpgid exists
11286 set setpgid d_setpgid
11287 eval $inlibc
11288
11289 : see if setpgrp2 exists
11290 set setpgrp2 d_setpgrp2
11291 eval $inlibc
11292
11293 : see if setpriority exists
11294 set setpriority d_setprior
11295 eval $inlibc
11296
11297 : see if setproctitle exists
11298 set setproctitle d_setproctitle
11299 eval $inlibc
11300
11301 : see if setpwent exists
11302 set setpwent d_setpwent
11303 eval $inlibc
11304
11305 : see if setregid exists
11306 set setregid d_setregid
11307 eval $inlibc
11308 set setresgid d_setresgid
11309 eval $inlibc
11310
11311 : see if setreuid exists
11312 set setreuid d_setreuid
11313 eval $inlibc
11314 set setresuid d_setresuid
11315 eval $inlibc
11316
11317 : see if setrgid exists
11318 set setrgid d_setrgid
11319 eval $inlibc
11320
11321 : see if setruid exists
11322 set setruid d_setruid
11323 eval $inlibc
11324
11325 : see if setservent exists
11326 set setservent d_setsent
11327 eval $inlibc
11328
11329 : see if setsid exists
11330 set setsid d_setsid
11331 eval $inlibc
11332
11333 : see if setvbuf exists
11334 set setvbuf d_setvbuf
11335 eval $inlibc
11336
11337 : see if sfio.h is available
11338 set sfio.h i_sfio
11339 eval $inhdr
11340
11341
11342 : see if sfio library is available
11343 case "$i_sfio" in
11344 $define)
11345         val=''
11346         set sfreserve val
11347         eval $inlibc
11348         ;;
11349 *)
11350         val="$undef"
11351         ;;
11352 esac
11353 : Ok, but do we want to use it.
11354 case "$val" in
11355 $define)
11356         case "$usesfio" in
11357         true|$define|[yY]*) dflt='y';;
11358         *) dflt='n';;
11359         esac
11360         echo "$package can use the sfio library, but it is experimental."
11361         case "$useperlio" in
11362         "$undef")
11363             echo "For sfio also the PerlIO abstraction layer is needed."
11364             echo "Earlier you said you wouldn't want that."
11365             ;;
11366         esac
11367         rp="You seem to have sfio available, do you want to try using it?"
11368         . ./myread
11369         case "$ans" in
11370         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11371                 useperlio="$define"
11372                 val="$define"
11373                 ;;
11374         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11375                 val="$undef"
11376                 : Remove sfio from list of libraries to use
11377                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11378                 shift
11379                 libs="$*"
11380                 echo "libs = $libs" >&4
11381                 ;;
11382         esac
11383         ;;
11384 *)      case "$usesfio" in
11385         true|$define|[yY]*)
11386                 echo "Sorry, cannot find sfio on this machine." >&4
11387                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11388                 val="$undef"
11389                 ;;
11390         esac
11391         ;;
11392 esac
11393 set d_sfio
11394 eval $setvar
11395 case "$d_sfio" in
11396 $define) usesfio='true';;
11397 *) usesfio='false';;
11398 esac
11399
11400 : see if shmctl exists
11401 set shmctl d_shmctl
11402 eval $inlibc
11403
11404 : see if shmget exists
11405 set shmget d_shmget
11406 eval $inlibc
11407
11408 : see if shmat exists
11409 set shmat d_shmat
11410 eval $inlibc
11411 : see what shmat returns
11412 case "$d_shmat" in
11413 "$define")
11414         $cat >shmat.c <<'END'
11415 #include <sys/shm.h>
11416 void *shmat();
11417 END
11418         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11419                 shmattype='void *'
11420         else
11421                 shmattype='char *'
11422         fi
11423         echo "and it returns ($shmattype)." >&4
11424         : see if a prototype for shmat is available
11425         xxx=`./findhdr sys/shm.h`
11426         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11427         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11428                 val="$define"
11429         else
11430                 val="$undef"
11431         fi
11432         $rm -f shmat.[co]
11433         ;;
11434 *)
11435         val="$undef"
11436         ;;
11437 esac
11438 set d_shmatprototype
11439 eval $setvar
11440
11441 : see if shmdt exists
11442 set shmdt d_shmdt
11443 eval $inlibc
11444
11445 : see how much of the 'shm*(2)' library is present.
11446 h_shm=true
11447 echo " "
11448 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11449 *"$undef"*) h_shm=false;;
11450 esac
11451 case "$osname" in
11452 freebsd)
11453     case "`ipcs 2>&1`" in
11454     "SVID shared memory"*"not configured"*)
11455         echo "Your $osname does not have the shm*(2) configured." >&4
11456         h_shm=false
11457         val="$undef"
11458         set shmctl d_shmctl
11459         evat $setvar
11460         set shmget d_shmget
11461         evat $setvar
11462         set shmat d_shmat
11463         evat $setvar
11464         set shmdt d_shmdt
11465         evat $setvar
11466         ;;
11467     esac
11468     ;;
11469 esac
11470 : we could also check for sys/ipc.h ...
11471 if $h_shm && $test `./findhdr sys/shm.h`; then
11472         echo "You have the full shm*(2) library." >&4
11473         val="$define"
11474 else
11475         echo "You don't have the full shm*(2) library." >&4
11476         val="$undef"
11477 fi
11478 set d_shm
11479 eval $setvar
11480
11481 echo " "
11482 : see if we have sigaction
11483 if set sigaction val -f d_sigaction; eval $csym; $val; then
11484         echo 'sigaction() found.' >&4
11485         $cat > try.c <<'EOP'
11486 #include <stdio.h>
11487 #include <sys/types.h>
11488 #include <signal.h>
11489 int main()
11490 {
11491     struct sigaction act, oact;
11492     act.sa_flags = 0;
11493     oact.sa_handler = 0;
11494     /* so that act and oact are used */
11495     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11496 }
11497 EOP
11498         set try
11499         if eval $compile_ok; then
11500                 val="$define"
11501         else
11502                 echo "But you don't seem to have a useable struct sigaction." >&4
11503                 val="$undef"
11504         fi
11505 else
11506         echo 'sigaction NOT found.' >&4
11507         val="$undef"
11508 fi
11509 set d_sigaction; eval $setvar
11510 $rm -f try try$_o try.c
11511
11512 : see if sigsetjmp exists
11513 echo " "
11514 case "$d_sigsetjmp" in
11515 '')
11516         $cat >try.c <<'EOP'
11517 #include <setjmp.h>
11518 sigjmp_buf env;
11519 int set = 1;
11520 int main()
11521 {
11522         if (sigsetjmp(env,1))
11523                 exit(set);
11524         set = 0;
11525         siglongjmp(env, 1);
11526         exit(1);
11527 }
11528 EOP
11529         set try
11530         if eval $compile; then
11531                 if ./try >/dev/null 2>&1; then
11532                         echo "POSIX sigsetjmp found." >&4
11533                         val="$define"
11534                 else
11535                         $cat >&4 <<EOM
11536 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11537 I'll ignore them.
11538 EOM
11539                         val="$undef"
11540                 fi
11541         else
11542                 echo "sigsetjmp not found." >&4
11543                 val="$undef"
11544         fi
11545         ;;
11546 *) val="$d_sigsetjmp"
11547         case "$d_sigsetjmp" in
11548         $define) echo "POSIX sigsetjmp found." >&4;;
11549         $undef) echo "sigsetjmp not found." >&4;;
11550         esac
11551         ;;
11552 esac
11553 set d_sigsetjmp
11554 eval $setvar
11555 $rm -f try.c try
11556
11557 : see if socks5_init exists
11558 set socks5_init d_socks5_init
11559 eval $inlibc
11560
11561 : see if sys/stat.h is available
11562 set sys/stat.h i_sysstat
11563 eval $inhdr
11564
11565
11566 : see if stat knows about block sizes
11567 echo " "
11568 echo "Checking to see if your struct stat has st_blocks field..." >&4
11569 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11570 eval $hasfield
11571
11572
11573 : see if this is a sys/vfs.h system
11574 set sys/vfs.h i_sysvfs
11575 eval $inhdr
11576
11577
11578 : see if this is a sys/statfs.h system
11579 set sys/statfs.h i_sysstatfs
11580 eval $inhdr
11581
11582
11583 echo " "
11584 echo "Checking to see if your system supports struct statfs..." >&4
11585 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
11586 eval $hasstruct
11587 case "$d_statfs_s" in
11588 "$define")      echo "Yes, it does."   ;;
11589 *)              echo "No, it doesn't." ;;
11590 esac
11591
11592
11593
11594 : see if struct statfs knows about f_flags
11595 case "$d_statfs_s" in
11596 define) 
11597         echo " "
11598         echo "Checking to see if your struct statfs has f_flags field..." >&4
11599         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
11600         eval $hasfield
11601         ;;
11602 *)      val="$undef"
11603         set d_statfs_f_flags
11604         eval $setvar
11605         ;;
11606 esac
11607 case "$d_statfs_f_flags" in
11608 "$define")      echo "Yes, it does."   ;;
11609 *)              echo "No, it doesn't." ;;
11610 esac
11611
11612 : see if _ptr and _cnt from stdio act std
11613 echo " "
11614
11615 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11616         echo "(Looks like you have stdio.h from BSD.)"
11617         case "$stdio_ptr" in
11618         '') stdio_ptr='((fp)->_p)'
11619                 ptr_lval=$define
11620                 ;;
11621         *)      ptr_lval=$d_stdio_ptr_lval;;
11622         esac
11623         case "$stdio_cnt" in
11624         '') stdio_cnt='((fp)->_r)'
11625                 cnt_lval=$define
11626                 ;;
11627         *)      cnt_lval=$d_stdio_cnt_lval;;
11628         esac
11629         case "$stdio_base" in
11630         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11631         esac
11632         case "$stdio_bufsiz" in
11633         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11634         esac
11635 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11636         echo "(Looks like you have stdio.h from Linux.)"
11637         case "$stdio_ptr" in
11638         '') stdio_ptr='((fp)->_IO_read_ptr)'
11639                 ptr_lval=$define
11640                 ;;
11641         *)      ptr_lval=$d_stdio_ptr_lval;;
11642         esac
11643         case "$stdio_cnt" in
11644         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11645                 cnt_lval=$undef
11646                 ;;
11647         *)      cnt_lval=$d_stdio_cnt_lval;;
11648         esac
11649         case "$stdio_base" in
11650         '') stdio_base='((fp)->_IO_read_base)';;
11651         esac
11652         case "$stdio_bufsiz" in
11653         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11654         esac
11655 else
11656         case "$stdio_ptr" in
11657         '') stdio_ptr='((fp)->_ptr)'
11658                 ptr_lval=$define
11659                 ;;
11660         *)      ptr_lval=$d_stdio_ptr_lval;;
11661         esac
11662         case "$stdio_cnt" in
11663         '') stdio_cnt='((fp)->_cnt)'
11664                 cnt_lval=$define
11665                 ;;
11666         *)      cnt_lval=$d_stdio_cnt_lval;;
11667         esac
11668         case "$stdio_base" in
11669         '') stdio_base='((fp)->_base)';;
11670         esac
11671         case "$stdio_bufsiz" in
11672         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11673         esac
11674 fi
11675
11676 : test whether _ptr and _cnt really work
11677 echo "Checking how std your stdio is..." >&4
11678 $cat >try.c <<EOP
11679 #include <stdio.h>
11680 #define FILE_ptr(fp)    $stdio_ptr
11681 #define FILE_cnt(fp)    $stdio_cnt
11682 int main() {
11683         FILE *fp = fopen("try.c", "r");
11684         char c = getc(fp);
11685         if (
11686                 18 <= FILE_cnt(fp) &&
11687                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11688         )
11689                 exit(0);
11690         exit(1);
11691 }
11692 EOP
11693 val="$undef"
11694 set try
11695 if eval $compile; then
11696         if ./try; then
11697                 echo "Your stdio acts pretty std."
11698                 val="$define"
11699         else
11700                 echo "Your stdio isn't very std."
11701         fi
11702 else
11703         echo "Your stdio doesn't appear very std."
11704 fi
11705 $rm -f try.c try
11706 set d_stdstdio
11707 eval $setvar
11708
11709 : Can _ptr be used as an lvalue?
11710 case "$d_stdstdio$ptr_lval" in
11711 $define$define) val=$define ;;
11712 *) val=$undef ;;
11713 esac
11714 set d_stdio_ptr_lval
11715 eval $setvar
11716
11717 : Can _cnt be used as an lvalue?
11718 case "$d_stdstdio$cnt_lval" in
11719 $define$define) val=$define ;;
11720 *) val=$undef ;;
11721 esac
11722 set d_stdio_cnt_lval
11723 eval $setvar
11724
11725
11726 : test whether setting _ptr sets _cnt as a side effect
11727 d_stdio_ptr_lval_sets_cnt="$undef"
11728 d_stdio_ptr_lval_nochange_cnt="$undef"
11729 case "$d_stdio_ptr_lval$d_stdstdio" in
11730 $define$define)
11731         echo "Checking to see what happens if we set the stdio ptr..." >&4
11732 $cat >try.c <<EOP
11733 #include <stdio.h>
11734 /* Can we scream? */
11735 /* Eat dust sed :-) */
11736 /* In the buffer space, no one can hear you scream. */
11737 #define FILE_ptr(fp)    $stdio_ptr
11738 #define FILE_cnt(fp)    $stdio_cnt
11739 #include <sys/types.h>
11740 int main() {
11741         FILE *fp = fopen("try.c", "r");
11742         int c;
11743         char *ptr;
11744         size_t cnt;
11745         if (!fp) {
11746             puts("Fail even to read");
11747             exit(1);
11748         }
11749         c = getc(fp); /* Read away the first # */
11750         if (c == EOF) {
11751             puts("Fail even to read");
11752             exit(1);
11753         }
11754         if (!(
11755                 18 <= FILE_cnt(fp) &&
11756                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11757         )) {
11758                 puts("Fail even to read");
11759                 exit (1);
11760         }
11761         ptr = (char*) FILE_ptr(fp);
11762         cnt = (size_t)FILE_cnt(fp);
11763
11764         FILE_ptr(fp) += 42;
11765
11766         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11767                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11768                 exit (1);
11769         }
11770         if (FILE_cnt(fp) <= 20) {
11771                 printf ("Fail (<20 chars to test)");
11772                 exit (1);
11773         }
11774         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11775                 puts("Fail compare");
11776                 exit (1);
11777         }
11778         if (cnt == FILE_cnt(fp)) {
11779                 puts("Pass_unchanged");
11780                 exit (0);
11781         }       
11782         if (FILE_cnt(fp) == (cnt - 42)) {
11783                 puts("Pass_changed");
11784                 exit (0);
11785         }
11786         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11787         return 1;
11788
11789 }
11790 EOP
11791         set try
11792         if eval $compile; then
11793                 case `./try$exe_ext` in
11794                 Pass_changed)
11795                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11796                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11797                 Pass_unchanged)
11798                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11799                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11800                 Fail*)
11801                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11802                 *)
11803                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11804         esac
11805         else
11806                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11807         fi
11808         $rm -f try.c try
11809         ;;
11810 esac
11811
11812 : see if _base is also standard
11813 val="$undef"
11814 case "$d_stdstdio" in
11815 $define)
11816         $cat >try.c <<EOP
11817 #include <stdio.h>
11818 #define FILE_base(fp)   $stdio_base
11819 #define FILE_bufsiz(fp) $stdio_bufsiz
11820 int main() {
11821         FILE *fp = fopen("try.c", "r");
11822         char c = getc(fp);
11823         if (
11824                 19 <= FILE_bufsiz(fp) &&
11825                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11826         )
11827                 exit(0);
11828         exit(1);
11829 }
11830 EOP
11831         set try
11832         if eval $compile; then
11833                 if ./try; then
11834                         echo "And its _base field acts std."
11835                         val="$define"
11836                 else
11837                         echo "But its _base field isn't std."
11838                 fi
11839         else
11840                 echo "However, it seems to be lacking the _base field."
11841         fi
11842         $rm -f try.c try
11843         ;;
11844 esac
11845 set d_stdiobase
11846 eval $setvar
11847
11848 $cat >&4 <<EOM
11849 Checking how to access stdio streams by file descriptor number...
11850 EOM
11851 case "$stdio_stream_array" in
11852 '')     $cat >try.c <<EOCP
11853 #include <stdio.h>
11854 int main() {
11855   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11856     printf("yes\n");
11857 }
11858 EOCP
11859         for s in _iob __iob __sF
11860         do
11861                 set try -DSTDIO_STREAM_ARRAY=$s
11862                 if eval $compile; then
11863                         case "`./try$exe_ext`" in
11864                         yes)    stdio_stream_array=$s; break ;;
11865                         esac
11866                 fi
11867         done
11868         $rm -f try.* try$exe_ext
11869 esac
11870 case "$stdio_stream_array" in
11871 '')     $cat >&4 <<EOM
11872 I can't figure out how to access stdio streams by file descriptor number.
11873 EOM
11874         d_stdio_stream_array="$undef"
11875         ;;
11876 *)      $cat >&4 <<EOM
11877 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11878 EOM
11879         d_stdio_stream_array="$define"
11880         ;;
11881 esac
11882
11883 : see if strcoll exists
11884 set strcoll d_strcoll
11885 eval $inlibc
11886
11887 : check for structure copying
11888 echo " "
11889 echo "Checking to see if your C compiler can copy structs..." >&4
11890 $cat >try.c <<'EOCP'
11891 int main()
11892 {
11893         struct blurfl {
11894                 int dyick;
11895         } foo, bar;
11896
11897         foo = bar;
11898 }
11899 EOCP
11900 if $cc -c try.c >/dev/null 2>&1 ; then
11901         val="$define"
11902         echo "Yup, it can."
11903 else
11904         val="$undef"
11905         echo "Nope, it can't."
11906 fi
11907 set d_strctcpy
11908 eval $setvar
11909 $rm -f try.*
11910
11911 : see if strerror and/or sys_errlist[] exist
11912 echo " "
11913 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11914     if set strerror val -f d_strerror; eval $csym; $val; then
11915                 echo 'strerror() found.' >&4
11916                 d_strerror="$define"
11917                 d_strerrm='strerror(e)'
11918                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11919                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11920                         d_syserrlst="$define"
11921                 else
11922                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11923                         d_syserrlst="$undef"
11924                 fi
11925     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11926                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11927                 echo 'strerror() found in string header.' >&4
11928                 d_strerror="$define"
11929                 d_strerrm='strerror(e)'
11930                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11931                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11932                                 d_syserrlst="$define"
11933                 else
11934                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11935                         d_syserrlst="$undef"
11936                 fi
11937     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11938                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11939                 d_strerror="$undef"
11940                 d_syserrlst="$define"
11941                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11942     else
11943                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11944                 d_strerror="$undef"
11945                 d_syserrlst="$undef"
11946                 d_strerrm='"unknown"'
11947     fi
11948 fi
11949
11950 : see if strtod exists
11951 set strtod d_strtod
11952 eval $inlibc
11953
11954 : see if strtol exists
11955 set strtol d_strtol
11956 eval $inlibc
11957
11958 : see if strtold exists
11959 set strtold d_strtold
11960 eval $inlibc
11961
11962 : see if strtoll exists
11963 set strtoll d_strtoll
11964 eval $inlibc
11965
11966 case "$d_longlong-$d_strtoll" in
11967 "$define-$define")
11968         $cat <<EOM
11969 Checking whether your strtoll() works okay...
11970 EOM
11971         $cat >try.c <<'EOCP'
11972 #include <errno.h>
11973 #ifdef __hpux
11974 #define strtoll __strtoll
11975 #endif
11976 #ifdef __EMX__
11977 #define strtoll _strtoll
11978 #endif
11979 #include <stdio.h>
11980 extern long long int strtoll(char *s, char **, int); 
11981 static int bad = 0;
11982 int check(char *s, long long ell, int een) {
11983         long long gll;
11984         errno = 0;
11985         gll = strtoll(s, 0, 10);
11986         if (!((gll == ell) && (errno == een)))
11987                 bad++;
11988 }
11989 int main() {
11990         check(" 1",                                      1LL, 0);
11991         check(" 0",                                      0LL, 0);
11992         check("-1",                                     -1LL, 0);
11993         check("-9223372036854775808", -9223372036854775808LL, 0);
11994         check("-9223372036854775808", -9223372036854775808LL, 0);
11995         check(" 9223372036854775807",  9223372036854775807LL, 0);
11996         check("-9223372036854775808", -9223372036854775808LL, 0);
11997         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11998         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11999         if (!bad)
12000                 printf("ok\n");
12001 }
12002 EOCP
12003         set try
12004         if eval $compile; then
12005                 yyy=`./try`
12006                 case "$yyy" in
12007                 ok) echo "Your strtoll() seems to be working okay." ;;
12008                 *) cat <<EOM >&4
12009 Your strtoll() doesn't seem to be working okay.
12010 EOM
12011                    d_strtoll="$undef"
12012                    ;;
12013                 esac
12014         else
12015                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12016                 d_strtoll="$undef"
12017         fi
12018         ;;
12019 esac
12020
12021 : see if strtoq exists
12022 set strtoq d_strtoq
12023 eval $inlibc
12024
12025 : see if strtoul exists
12026 set strtoul d_strtoul
12027 eval $inlibc
12028
12029 case "$d_strtoul" in
12030 "$define")
12031         $cat <<EOM
12032 Checking whether your strtoul() works okay...
12033 EOM
12034         $cat >try.c <<'EOCP'
12035 #include <errno.h>
12036 #include <stdio.h>
12037 extern unsigned long int strtoul(char *s, char **, int); 
12038 static int bad = 0;
12039 void check(char *s, unsigned long eul, int een) {
12040         unsigned long gul;
12041         errno = 0;
12042         gul = strtoul(s, 0, 10);
12043         if (!((gul == eul) && (errno == een)))
12044                 bad++;
12045 }
12046 int main() {
12047         check(" 1", 1L, 0);
12048         check(" 0", 0L, 0);
12049 EOCP
12050         case "$longsize" in
12051         8)
12052             $cat >>try.c <<'EOCP'
12053         check("18446744073709551615", 18446744073709551615UL, 0);
12054         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12055 #if 0 /* strtoul() for /^-/ strings is undefined. */
12056         check("-1", 18446744073709551615UL, 0);
12057         check("-18446744073709551614", 2, 0);
12058         check("-18446744073709551615", 1, 0);
12059         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12060         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12061 #endif
12062 EOCP
12063                 ;;
12064         4)
12065                     $cat >>try.c <<'EOCP'
12066         check("4294967295", 4294967295UL, 0);
12067         check("4294967296", 4294967295UL, ERANGE);
12068 #if 0 /* strtoul() for /^-/ strings is undefined. */
12069         check("-1", 4294967295UL, 0);
12070         check("-4294967294", 2, 0);
12071         check("-4294967295", 1, 0);
12072         check("-4294967296", 4294967295UL, ERANGE);
12073         check("-4294967297", 4294967295UL, ERANGE);
12074 #endif
12075 EOCP
12076                 ;;
12077         *)
12078 : Should we write these tests to be more portable by sprintf-ing
12079 : ~0 and then manipulating that char string as input for strtol?
12080                 ;;
12081         esac
12082         $cat >>try.c <<'EOCP'
12083         if (!bad)
12084                 printf("ok\n");
12085         return 0;
12086 }
12087 EOCP
12088         set try
12089         if eval $compile; then
12090                 case "`./try`" in
12091                 ok) echo "Your strtoul() seems to be working okay." ;;
12092                 *) cat <<EOM >&4
12093 Your strtoul() doesn't seem to be working okay.
12094 EOM
12095                    d_strtoul="$undef"
12096                    ;;
12097                 esac
12098         fi
12099         ;;
12100 esac
12101
12102 : see if strtoull exists
12103 set strtoull d_strtoull
12104 eval $inlibc
12105
12106 case "$d_longlong-$d_strtoull" in
12107 "$define-$define")
12108         $cat <<EOM
12109 Checking whether your strtoull() works okay...
12110 EOM
12111         $cat >try.c <<'EOCP'
12112 #include <errno.h>
12113 #ifdef __hpux
12114 #define strtoull __strtoull
12115 #endif
12116 #include <stdio.h>
12117 extern unsigned long long int strtoull(char *s, char **, int); 
12118 static int bad = 0;
12119 int check(char *s, long long eull, int een) {
12120         long long gull;
12121         errno = 0;
12122         gull = strtoull(s, 0, 10);
12123         if (!((gull == eull) && (errno == een)))
12124                 bad++;
12125 }
12126 int main() {
12127         check(" 1",                                        1LL, 0);
12128         check(" 0",                                        0LL, 0);
12129         check("18446744073709551615",  18446744073709551615ULL, 0);
12130         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12131 #if 0 /* strtoull() for /^-/ strings is undefined. */
12132         check("-1",                    18446744073709551615ULL, 0);
12133         check("-18446744073709551614",                     2LL, 0);
12134         check("-18446744073709551615",                     1LL, 0);
12135         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12136         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12137 #endif
12138         if (!bad)
12139                 printf("ok\n");
12140 }
12141 EOCP
12142         set try
12143         if eval $compile; then
12144                 case "`./try`" in
12145                 ok) echo "Your strtoull() seems to be working okay." ;;
12146                 *) cat <<EOM >&4
12147 Your strtoull() doesn't seem to be working okay.
12148 EOM
12149                    d_strtoull="$undef"
12150                    ;;
12151                 esac
12152         fi
12153         ;;
12154 esac
12155
12156 : see if strtouq exists
12157 set strtouq d_strtouq
12158 eval $inlibc
12159
12160 case "$d_strtouq" in
12161 "$define")
12162         $cat <<EOM
12163 Checking whether your strtouq() works okay...
12164 EOM
12165         $cat >try.c <<'EOCP'
12166 #include <errno.h>
12167 #include <stdio.h>
12168 extern unsigned long long int strtouq(char *s, char **, int); 
12169 static int bad = 0;
12170 void check(char *s, unsigned long long eull, int een) {
12171         unsigned long long gull;
12172         errno = 0;
12173         gull = strtouq(s, 0, 10);
12174         if (!((gull == eull) && (errno == een)))
12175                 bad++;
12176 }
12177 int main() {
12178         check(" 1",                                        1LL, 0);
12179         check(" 0",                                        0LL, 0);
12180         check("18446744073709551615",  18446744073709551615ULL, 0);
12181         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12182 #if 0 /* strtouq() for /^-/ strings is undefined. */
12183         check("-1",                    18446744073709551615ULL, 0);
12184         check("-18446744073709551614",                     2LL, 0);
12185         check("-18446744073709551615",                     1LL, 0);
12186         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12187         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12188 #endif
12189         if (!bad)
12190                 printf("ok\n");
12191         return 0;
12192 }
12193 EOCP
12194         set try
12195         if eval $compile; then
12196                 case "`./try`" in
12197                 ok) echo "Your strtouq() seems to be working okay." ;;
12198                 *) cat <<EOM >&4
12199 Your strtouq() doesn't seem to be working okay.
12200 EOM
12201                    d_strtouq="$undef"
12202                    ;;
12203                 esac
12204         fi
12205         ;;
12206 esac
12207
12208 : see if strxfrm exists
12209 set strxfrm d_strxfrm
12210 eval $inlibc
12211
12212 : see if symlink exists
12213 set symlink d_symlink
12214 eval $inlibc
12215
12216 : see if syscall exists
12217 set syscall d_syscall
12218 eval $inlibc
12219
12220 : see if sysconf exists
12221 set sysconf d_sysconf
12222 eval $inlibc
12223
12224 : see if system exists
12225 set system d_system
12226 eval $inlibc
12227
12228 : see if tcgetpgrp exists
12229 set tcgetpgrp d_tcgetpgrp
12230 eval $inlibc
12231
12232 : see if tcsetpgrp exists
12233 set tcsetpgrp d_tcsetpgrp
12234 eval $inlibc
12235
12236 : see if prototype for telldir is available
12237 echo " "
12238 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12239 eval $hasproto
12240
12241 : see if this is a sys/times.h system
12242 set sys/times.h i_systimes
12243 eval $inhdr
12244
12245 : see if times exists
12246 echo " "
12247 if set times val -f d_times; eval $csym; $val; then
12248         echo 'times() found.' >&4
12249         d_times="$define"
12250         inc=''
12251         case "$i_systimes" in
12252         "$define") inc='sys/times.h';;
12253         esac
12254         rp="What is the type returned by times() on this system?"
12255         set clock_t clocktype long stdio.h sys/types.h $inc
12256         eval $typedef_ask
12257 else
12258         echo 'times() NOT found, hope that will do.' >&4
12259         d_times="$undef"
12260         clocktype='int'
12261 fi
12262
12263 : see if truncate exists
12264 set truncate d_truncate
12265 eval $inlibc
12266
12267 : see if tzname[] exists
12268 echo " "
12269 if set tzname val -a d_tzname; eval $csym; $val; then
12270         val="$define"
12271         echo 'tzname[] found.' >&4
12272 else
12273         val="$undef"
12274         echo 'tzname[] NOT found.' >&4
12275 fi
12276 set d_tzname
12277 eval $setvar
12278
12279 : see if umask exists
12280 set umask d_umask
12281 eval $inlibc
12282
12283 : see if ustat exists
12284 set ustat d_ustat
12285 eval $inlibc
12286
12287 : backward compatibility for d_hvfork
12288 if test X$d_hvfork != X; then
12289         d_vfork="$d_hvfork"
12290         d_hvfork=''
12291 fi
12292 : see if there is a vfork
12293 val=''
12294 set vfork val
12295 eval $inlibc
12296
12297 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12298 : perl on Solaris 2.x, and probably elsewhere.
12299 case "$val" in
12300 $define)
12301         echo " "
12302         case "$usevfork" in
12303         false) dflt='n';;
12304         *) dflt='y';;
12305         esac
12306         cat <<'EOM'
12307  
12308 Perl can only use a vfork() that doesn't suffer from strict
12309 restrictions on calling functions or modifying global data in
12310 the child.  For example, glibc-2.1 contains such a vfork()
12311 that is unsuitable.  If your system provides a proper fork()
12312 call, chances are that you do NOT want perl to use vfork().
12313
12314 EOM
12315         rp="Do you still want to use vfork()?"
12316         . ./myread
12317         case "$ans" in
12318         y|Y) ;;
12319         *)
12320                 echo "Ok, we won't use vfork()."
12321                 val="$undef"
12322                 ;;
12323         esac
12324         ;;
12325 esac
12326 set d_vfork
12327 eval $setvar
12328 case "$d_vfork" in
12329 $define) usevfork='true';;
12330 *) usevfork='false';;
12331 esac
12332
12333 : see if this is an sysdir system
12334 set sys/dir.h i_sysdir
12335 eval $inhdr
12336
12337 : see if this is an sysndir system
12338 set sys/ndir.h i_sysndir
12339 eval $inhdr
12340
12341 : see if closedir exists
12342 set closedir d_closedir
12343 eval $inlibc
12344
12345 case "$d_closedir" in
12346 "$define")
12347         echo " "
12348         echo "Checking whether closedir() returns a status..." >&4
12349         cat > closedir.c <<EOM
12350 #$i_dirent I_DIRENT             /**/
12351 #$i_sysdir I_SYS_DIR            /**/
12352 #$i_sysndir I_SYS_NDIR          /**/
12353 #$i_systypes I_SYS_TYPES        /**/
12354
12355 #if defined(I_SYS_TYPES)
12356 #include <sys/types.h>
12357 #endif
12358 #if defined(I_DIRENT)
12359 #include <dirent.h>
12360 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12361 #include <sys/dir.h>
12362 #endif
12363 #else
12364 #ifdef I_SYS_NDIR
12365 #include <sys/ndir.h>
12366 #else
12367 #ifdef I_SYS_DIR
12368 #ifdef hp9000s500
12369 #include <ndir.h>       /* may be wrong in the future */
12370 #else
12371 #include <sys/dir.h>
12372 #endif
12373 #endif
12374 #endif
12375 #endif 
12376 int main() { return closedir(opendir(".")); }
12377 EOM
12378         set closedir
12379         if eval $compile_ok; then
12380                 if ./closedir > /dev/null 2>&1 ; then
12381                         echo "Yes, it does."
12382                         val="$undef"
12383                 else
12384                         echo "No, it doesn't."
12385                         val="$define"
12386                 fi
12387         else
12388                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12389                 val="$define"
12390         fi
12391         ;;
12392 *)
12393         val="$undef";
12394         ;;
12395 esac
12396 set d_void_closedir
12397 eval $setvar
12398 $rm -f closedir*
12399 : see if there is a wait4
12400 set wait4 d_wait4
12401 eval $inlibc
12402
12403 : see if waitpid exists
12404 set waitpid d_waitpid
12405 eval $inlibc
12406
12407 : see if wcstombs exists
12408 set wcstombs d_wcstombs
12409 eval $inlibc
12410
12411 : see if wctomb exists
12412 set wctomb d_wctomb
12413 eval $inlibc
12414
12415 : preserve RCS keywords in files with variable substitution, grrr
12416 Date='$Date'
12417 Id='$Id'
12418 Log='$Log'
12419 RCSfile='$RCSfile'
12420 Revision='$Revision'
12421
12422 case "$crosscompile" in
12423 ''|[nN]*) crosscompile="$undef" ;;
12424 esac
12425
12426 case "$osname" in
12427 next|rhapsody|darwin) multiarch="$define" ;;
12428 esac
12429 case "$multiarch" in
12430 ''|[nN]*) multiarch="$undef" ;;
12431 esac
12432
12433 : check for alignment requirements
12434 echo " "
12435 case "$crosscompile$multiarch" in
12436 *$define*)
12437         $cat <<EOM
12438 You seem to be either cross-compiling or doing a multiarchitecture build,
12439 skipping the memory alignment check.
12440
12441 EOM
12442         case "$alignbytes" in
12443         '') alignbytes=8 ;;
12444         esac
12445         ;;
12446 *)
12447         case "$alignbytes" in
12448         '') echo "Checking alignment constraints..." >&4
12449                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12450                         $cat >try.c <<'EOCP'
12451 typedef long double NV;
12452 EOCP
12453                 else
12454                         $cat >try.c <<'EOCP'
12455 typedef double NV;
12456 EOCP
12457                 fi
12458                 $cat >>try.c <<'EOCP'
12459 #include <stdio.h>
12460 struct foobar {
12461         char foo;
12462         NV bar;
12463 } try_algn;
12464 int main()
12465 {
12466     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12467     return(0);
12468 }
12469 EOCP
12470                 set try
12471                 if eval $compile_ok; then
12472                         dflt=`./try`
12473                 else
12474                         dflt='8'
12475                         echo "(I can't seem to compile the test program...)"
12476                 fi
12477                 ;;
12478         *) dflt="$alignbytes"
12479                 ;;
12480         esac
12481         rp="Doubles must be aligned on a how-many-byte boundary?"
12482         . ./myread
12483         alignbytes="$ans"
12484         $rm -f try.c try
12485         ;;
12486 esac
12487
12488
12489 : set the base revision
12490 baserev=5.0
12491
12492 : check for ordering of bytes in a long
12493 echo " "
12494 case "$crosscompile$multiarch" in
12495 *$define*)
12496         $cat <<EOM
12497 You seem to be either cross-compiling or doing a multiarchitecture build,
12498 skipping the byteorder check.
12499
12500 EOM
12501         byteorder='0xffff'
12502         ;;
12503 *)
12504         case "$byteorder" in
12505         '')
12506                 $cat <<'EOM'
12507 In the following, larger digits indicate more significance.  A big-endian
12508 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12509 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12510 machines may have weird orders like 3412.  A Cray will report 87654321,
12511 an Alpha will report 12345678. If the test program works the default is
12512 probably right.
12513 I'm now running the test program...
12514 EOM
12515                 $cat >try.c <<'EOCP'
12516 #include <stdio.h>
12517 int main()
12518 {
12519         int i;
12520         union {
12521                 unsigned long l;
12522                 char c[sizeof(long)];
12523         } u;
12524
12525         if (sizeof(long) > 4)
12526                 u.l = (0x08070605L << 32) | 0x04030201L;
12527         else
12528                 u.l = 0x04030201L;
12529         for (i = 0; i < sizeof(long); i++)
12530                 printf("%c", u.c[i]+'0');
12531         printf("\n");
12532         exit(0);
12533 }
12534 EOCP
12535                 xxx_prompt=y
12536                 set try
12537                 if eval $compile && ./try > /dev/null; then
12538                         dflt=`./try`
12539                         case "$dflt" in
12540                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12541                                 echo "(The test program ran ok.)"
12542                                 echo "byteorder=$dflt"
12543                                 xxx_prompt=n
12544                         ;;
12545                         ????|????????) echo "(The test program ran ok.)" ;;
12546                         *) echo "(The test program didn't run right for some reason.)" ;;
12547                         esac
12548                 else
12549                         dflt='4321'
12550                         cat <<'EOM'
12551 (I can't seem to compile the test program.  Guessing big-endian...)
12552 EOM
12553                 fi
12554                 case "$xxx_prompt" in
12555                 y)
12556                         rp="What is the order of bytes in a long?"
12557                         . ./myread
12558                         byteorder="$ans"
12559                         ;;
12560                 *)      byteorder=$dflt
12561                         ;;
12562                 esac
12563                 ;;
12564         esac
12565         $rm -f try.c try
12566         ;;
12567 esac
12568
12569
12570 : how do we catenate cpp tokens here?
12571 echo " "
12572 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12573 $cat >cpp_stuff.c <<'EOCP'
12574 #define RCAT(a,b)a/**/b
12575 #define ACAT(a,b)a ## b
12576 RCAT(Rei,ser)
12577 ACAT(Cir,cus)
12578 EOCP
12579 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12580 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12581         echo "Oh!  Smells like ANSI's been here." >&4
12582         echo "We can catify or stringify, separately or together!"
12583         cpp_stuff=42
12584 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12585         echo "Ah, yes!  The good old days!" >&4
12586         echo "However, in the good old days we don't know how to stringify and"
12587         echo "catify at the same time."
12588         cpp_stuff=1
12589 else
12590         $cat >&4 <<EOM
12591 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12592 to have to edit the values of CAT[2-5] in config.h...
12593 EOM
12594         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12595 fi
12596 $rm -f cpp_stuff.*
12597
12598 : see if this is a db.h system
12599 set db.h i_db
12600 eval $inhdr
12601
12602 case "$i_db" in
12603 $define)
12604         : Check db version.
12605         echo " "
12606         echo "Checking Berkeley DB version ..." >&4
12607         $cat >try.c <<EOCP
12608 #$d_const HASCONST
12609 #ifndef HASCONST
12610 #define const
12611 #endif
12612 #include <sys/types.h>
12613 #include <stdio.h>
12614 #include <db.h>
12615 int main()
12616 {
12617 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12618     int Major, Minor, Patch ;
12619     unsigned long Version ;
12620     (void)db_version(&Major, &Minor, &Patch) ;
12621     printf("You have Berkeley DB Version 2 or greater\n");
12622
12623     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12624                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12625     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12626                 Major, Minor, Patch) ;
12627
12628     /* check that db.h & libdb are compatible */
12629     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12630         printf("db.h and libdb are incompatible\n") ;
12631         exit(3);        
12632     }
12633
12634     printf("db.h and libdb are compatible\n") ;
12635
12636     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12637                 + DB_VERSION_PATCH ;
12638
12639     /* needs to be >= 2.3.4 */
12640     if (Version < 2003004) {
12641     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12642         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12643         exit(2);        
12644     }
12645
12646     exit(0);
12647 #else
12648 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12649     printf("You have Berkeley DB Version 1\n");
12650     exit(0);    /* DB version < 2: the coast is clear. */
12651 #else
12652     exit(1);    /* <db.h> not Berkeley DB? */
12653 #endif
12654 #endif
12655 }
12656 EOCP
12657         set try
12658         if eval $compile_ok && ./try; then
12659                 echo 'Looks OK.' >&4
12660         else
12661                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12662                 i_db=$undef
12663                 case " $libs " in
12664                 *"-ldb "*)
12665                         : Remove db from list of libraries to use
12666                         echo "Removing unusable -ldb from library list" >&4
12667                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12668                         shift
12669                         libs="$*"
12670                         echo "libs = $libs" >&4
12671                         ;;
12672                 esac
12673         fi
12674         $rm -f try.*
12675         ;;
12676 esac
12677
12678 case "$i_db" in
12679 define)
12680         : Check the return type needed for hash 
12681         echo " "
12682         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12683         $cat >try.c <<EOCP
12684 #$d_const HASCONST
12685 #ifndef HASCONST
12686 #define const
12687 #endif
12688 #include <sys/types.h>
12689 #include <db.h>
12690
12691 #ifndef DB_VERSION_MAJOR
12692 u_int32_t hash_cb (ptr, size)
12693 const void *ptr;
12694 size_t size;
12695 {
12696 }
12697 HASHINFO info;
12698 int main()
12699 {
12700         info.hash = hash_cb;
12701 }
12702 #endif
12703 EOCP
12704         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12705                 if $contains warning try.out >>/dev/null 2>&1 ; then
12706                         db_hashtype='int'
12707                 else
12708                         db_hashtype='u_int32_t'
12709                 fi
12710         else
12711                 : XXX Maybe we should just give up here.
12712                 db_hashtype=u_int32_t
12713                 $cat try.out >&4
12714                 echo "Help:  I can't seem to compile the db test program." >&4
12715                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12716         fi
12717         $rm -f try.*
12718         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12719         ;;
12720 *)      db_hashtype=u_int32_t
12721         ;;
12722 esac
12723 case "$i_db" in
12724 define)
12725         : Check the return type needed for prefix 
12726         echo " "
12727         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12728         cat >try.c <<EOCP
12729 #$d_const HASCONST
12730 #ifndef HASCONST
12731 #define const
12732 #endif
12733 #include <sys/types.h>
12734 #include <db.h>
12735
12736 #ifndef DB_VERSION_MAJOR
12737 size_t prefix_cb (key1, key2)
12738 const DBT *key1;
12739 const DBT *key2;
12740 {
12741 }
12742 BTREEINFO info;
12743 int main()
12744 {
12745         info.prefix = prefix_cb;
12746 }
12747 #endif
12748 EOCP
12749         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12750                 if $contains warning try.out >>/dev/null 2>&1 ; then
12751                         db_prefixtype='int'
12752                 else
12753                         db_prefixtype='size_t'
12754                 fi
12755         else
12756                 db_prefixtype='size_t'
12757                 : XXX Maybe we should just give up here.
12758                 $cat try.out >&4
12759                 echo "Help:  I can't seem to compile the db test program." >&4
12760                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12761         fi
12762         $rm -f try.*
12763         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12764         ;;
12765 *)      db_prefixtype='size_t'
12766         ;;
12767 esac
12768
12769 : check for void type
12770 echo " "
12771 echo "Checking to see how well your C compiler groks the void type..." >&4
12772 case "$voidflags" in
12773 '')
12774         $cat >try.c <<'EOCP'
12775 #if TRY & 1
12776 void sub() {
12777 #else
12778 sub() {
12779 #endif
12780         extern void moo();      /* function returning void */
12781         void (*goo)();          /* ptr to func returning void */
12782 #if TRY & 8
12783         void *hue;              /* generic ptr */
12784 #endif
12785 #if TRY & 2
12786         void (*foo[10])();
12787 #endif
12788
12789 #if TRY & 4
12790         if(goo == moo) {
12791                 exit(0);
12792         }
12793 #endif
12794         exit(0);
12795 }
12796 int main() { sub(); }
12797 EOCP
12798         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12799                 voidflags=$defvoidused
12800         echo "Good.  It appears to support void to the level $package wants.">&4
12801                 if $contains warning .out >/dev/null 2>&1; then
12802                         echo "However, you might get some warnings that look like this:"
12803                         $cat .out
12804                 fi
12805         else
12806 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12807                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12808                         echo "It supports 1..."
12809                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12810                                 echo "It also supports 2..."
12811                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12812                                         voidflags=7
12813                                         echo "And it supports 4 but not 8 definitely."
12814                                 else
12815                                         echo "It doesn't support 4..."
12816                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12817                                                 voidflags=11
12818                                                 echo "But it supports 8."
12819                                         else
12820                                                 voidflags=3
12821                                                 echo "Neither does it support 8."
12822                                         fi
12823                                 fi
12824                         else
12825                                 echo "It does not support 2..."
12826                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12827                                         voidflags=13
12828                                         echo "But it supports 4 and 8."
12829                                 else
12830                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12831                                                 voidflags=5
12832                                                 echo "And it supports 4 but has not heard about 8."
12833                                         else
12834                                                 echo "However it supports 8 but not 4."
12835                                         fi
12836                                 fi
12837                         fi
12838                 else
12839                         echo "There is no support at all for void."
12840                         voidflags=0
12841                 fi
12842         fi
12843 esac
12844 case "$voidflags" in
12845 "$defvoidused") ;;
12846 *)      $cat >&4 <<'EOM'
12847   Support flag bits are:
12848     1: basic void declarations.
12849     2: arrays of pointers to functions returning void.
12850     4: operations between pointers to and addresses of void functions.
12851     8: generic void pointers.
12852 EOM
12853         dflt="$voidflags";
12854         rp="Your void support flags add up to what?"
12855         . ./myread
12856         voidflags="$ans"
12857         ;;
12858 esac
12859 $rm -f try.* .out
12860
12861
12862 : How can we generate normalized random numbers ?
12863 echo " "
12864 echo "Looking for a random number function..." >&4
12865 case "$randfunc" in
12866 '')
12867         if set drand48 val -f; eval $csym; $val; then
12868                 dflt="drand48"
12869                 echo "Good, found drand48()." >&4
12870         elif set random val -f; eval $csym; $val; then
12871                 dflt="random"
12872                 echo "OK, found random()." >&4
12873         else
12874                 dflt="rand"
12875                 echo "Yick, looks like I have to use rand()." >&4
12876         fi
12877         echo " "
12878         ;;
12879 *)
12880         dflt="$randfunc"
12881         ;;
12882 esac
12883 cont=true
12884
12885 case "$ccflags" in
12886 *-Dmy_rand=*|*-Dmy_srand=*)
12887         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12888         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12889         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12890         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12891         ;;
12892 esac
12893
12894 while $test "$cont"; do
12895         rp="Use which function to generate random numbers?"
12896         . ./myread
12897         if $test "$ans" = "$dflt"; then
12898                 : null
12899         else
12900                 randbits=''
12901         fi
12902         randfunc="$ans"
12903         if set $ans val -f; eval $csym; $val; then
12904                 cont=''
12905         else
12906                 dflt=y
12907                 rp="I cannot find function $ans. Use that name anyway?"
12908                 . ./myread
12909                 dflt=rand
12910                 case "$ans" in
12911                         [yY]*) cont='';;
12912                 esac
12913         fi
12914         case "$cont" in
12915         '')
12916                 case "$randfunc" in
12917                 drand48)
12918                         drand01="drand48()"
12919                         seedfunc="srand48"
12920                         randbits=48
12921                         randseedtype=long
12922                         ;;
12923                 rand|random)
12924                         case "$randbits" in
12925                         '')
12926 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12927                                 $cat >try.c <<EOCP
12928 #$i_unistd I_UNISTD
12929 #$i_stdlib I_STDLIB
12930 #include <stdio.h>
12931 #ifdef I_UNISTD
12932 #  include <unistd.h>
12933 #endif
12934 #ifdef I_STDLIB
12935 #  include <stdlib.h>
12936 #endif
12937 int main()
12938 {
12939         register int i;
12940         register unsigned long tmp;
12941         register unsigned long max = 0L;
12942
12943         for (i = 1000; i; i--) {
12944                 tmp = (unsigned long) $randfunc();
12945                 if (tmp > max) max = tmp;
12946         }
12947         for (i = 0; max; i++)
12948                 max /= 2;
12949         printf("%d\n",i);
12950 }
12951 EOCP
12952                                 set try
12953                                 if eval $compile_ok; then
12954                                         dflt=`try`
12955                                 else
12956                                         dflt='?'
12957                                         echo "(I can't seem to compile the test program...)"
12958                                 fi
12959                                 ;;
12960                         *)
12961                                 dflt="$randbits"
12962                                 ;;
12963                         esac
12964                         rp="How many bits does your $randfunc() function produce?"
12965                         . ./myread
12966                         randbits="$ans"
12967                         $rm -f try.c try
12968                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12969                         seedfunc="s$randfunc"
12970                         randseedtype=unsigned
12971                         ;;
12972                 *)
12973                         dflt="31"
12974                         rp="How many bits does your $randfunc() function produce?"
12975                         . ./myread
12976                         randbits="$ans"
12977                         seedfunc="s$randfunc"
12978                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12979                         if set $seedfunc val -f; eval $csym; $val; then
12980                                 echo "(Using $seedfunc() to seed random generator)"
12981                         else
12982                                 echo "(Warning: no $seedfunc() to seed random generator)"
12983                                 seedfunc=rand
12984                         fi
12985                         randseedtype=unsigned
12986                         ;;
12987                 esac
12988                 ;;
12989         esac
12990 done
12991
12992 echo " "
12993 echo "Determining whether or not we are on an EBCDIC system..." >&4
12994 $cat >tebcdic.c <<'EOM'
12995 int main()
12996 {
12997   if ('M'==0xd4) return 0;
12998   return 1;
12999 }
13000 EOM
13001
13002 val=$undef
13003 set tebcdic
13004 if eval $compile_ok; then
13005         if ./tebcdic; then
13006                 echo "You seem to speak EBCDIC." >&4
13007                 val="$define"
13008         else
13009                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13010         fi
13011 else
13012         echo "I'm unable to compile the test program." >&4
13013         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13014 fi
13015 $rm -f tebcdic.c tebcdic
13016 set ebcdic
13017 eval $setvar
13018
13019 echo " "
13020 $cat >&4 <<EOM
13021 Checking how to flush all pending stdio output...
13022 EOM
13023 # I only know how to find the first 32 possibly open files on SunOS.
13024 # See also hints/sunos_4_1.sh and util.c  --AD
13025 case "$osname" in
13026 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13027 esac
13028 $cat >>try.c <<EOCP
13029 #include <stdio.h>
13030 #$i_unistd I_UNISTD
13031 #ifdef I_UNISTD
13032 # include <unistd.h>
13033 #endif
13034 #$d_sysconf HAS_SYSCONF
13035 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13036 #ifdef HAS_STDIO_STREAM_ARRAY
13037 # define STDIO_STREAM_ARRAY $stdio_stream_array
13038 #endif
13039 int main() {
13040   FILE* p = fopen("try.out", "w");
13041 #ifdef TRY_FPUTC
13042   fputc('x', p);
13043 #else
13044 # ifdef TRY_FPRINTF
13045   fprintf(p, "x");
13046 # endif
13047 #endif
13048 #ifdef TRY_FFLUSH_NULL
13049   fflush(NULL);
13050 #endif
13051 #ifdef TRY_FFLUSH_ALL
13052   {
13053     long open_max = -1;
13054 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13055     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13056 # else
13057 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13058     open_max = sysconf(_SC_OPEN_MAX);
13059 #  else
13060 #   ifdef FOPEN_MAX
13061     open_max = FOPEN_MAX;
13062 #   else
13063 #    ifdef OPEN_MAX
13064     open_max = OPEN_MAX;
13065 #    else
13066 #     ifdef _NFILE
13067     open_max = _NFILE;
13068 #     endif
13069 #    endif
13070 #   endif
13071 #  endif
13072 # endif 
13073 # ifdef HAS_STDIO_STREAM_ARRAY
13074     if (open_max > 0) {
13075       long i;
13076       for (i = 0; i < open_max; i++)
13077             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13078                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13079                 STDIO_STREAM_ARRAY[i]._flag)
13080                 fflush(&STDIO_STREAM_ARRAY[i]);
13081     }   
13082   }
13083 # endif
13084 #endif
13085   _exit(42);
13086 }
13087 EOCP
13088 : first we have to find out how _not_ to flush
13089 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13090     output=''
13091     set try -DTRY_FPUTC
13092     if eval $compile; then
13093             $rm -f try.out
13094             ./try$exe_ext 2>/dev/null
13095             if $test ! -s try.out -a "X$?" = X42; then
13096                 output=-DTRY_FPUTC
13097             fi
13098     fi
13099     case "$output" in
13100     '')
13101             set try -DTRY_FPRINTF
13102             $rm -f try.out
13103             if eval $compile; then
13104                     $rm -f try.out
13105                     ./try$exe_ext 2>/dev/null
13106                     if $test ! -s try.out -a "X$?" = X42; then
13107                         output=-DTRY_FPRINTF
13108                     fi
13109             fi
13110         ;;
13111     esac
13112 fi
13113 : check for fflush NULL behaviour
13114 case "$fflushNULL" in
13115 '')     set try -DTRY_FFLUSH_NULL $output
13116         if eval $compile; then
13117                 $rm -f try.out
13118                 ./try$exe_ext 2>/dev/null
13119                 code="$?"
13120                 if $test -s try.out -a "X$code" = X42; then
13121                         fflushNULL="`$cat try.out`"
13122                 else
13123                         if $test "X$code" != X42; then
13124                                 $cat >&4 <<EOM
13125 (If this test failed, don't worry, we'll try another method shortly.)
13126 EOM
13127                         fi
13128                 fi
13129         fi
13130         $rm -f core try.core core.try.*
13131         case "$fflushNULL" in
13132         x)      $cat >&4 <<EOM
13133 Your fflush(NULL) works okay for output streams.
13134 Let's see if it clobbers input pipes...
13135 EOM
13136 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13137 # bug that improperly flushes the input end of pipes.  So we avoid the
13138 # autoflush on fork/system/exec support for now. :-(
13139 $cat >tryp.c <<EOCP
13140 #include <stdio.h>
13141 int
13142 main(int argc, char **argv)
13143 {
13144     char buf[1024];
13145     int i;
13146     char *bp = buf;
13147     while (1) {
13148         while ((i = getc(stdin)) != -1
13149                && (*bp++ = i) != '\n'
13150                && bp < &buf[1024])
13151         /* DO NOTHING */ ;
13152         *bp = '\0';
13153         fprintf(stdout, "%s", buf);
13154         fflush(NULL);
13155         if (i == -1)
13156             return 0;
13157         bp = buf;
13158     }
13159 }
13160 EOCP
13161                 fflushNULL="$define"
13162                 set tryp
13163                 if eval $compile; then
13164                     $rm -f tryp.out
13165                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13166                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13167                        $cat >&4 <<EOM
13168 fflush(NULL) seems to behave okay with input streams.
13169 EOM
13170                         fflushNULL="$define"
13171                     else
13172                         $cat >&4 <<EOM
13173 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13174 EOM
13175                         fflushNULL="$undef"
13176                     fi
13177                 fi
13178                 $rm -f core tryp.c tryp.core core.tryp.*
13179                 ;;
13180         '')     $cat >&4 <<EOM
13181 Your fflush(NULL) isn't working (contrary to ANSI C).
13182 EOM
13183                 fflushNULL="$undef"
13184                 ;;
13185         *)      $cat >&4 <<EOM
13186 Cannot figure out whether your fflush(NULL) works or not.
13187 I'm assuming it doesn't (contrary to ANSI C).
13188 EOM
13189                 fflushNULL="$undef"
13190                 ;;
13191         esac
13192         ;;
13193 $define|true|[yY]*)
13194         fflushNULL="$define"
13195         ;;
13196 *)
13197         fflushNULL="$undef"
13198         ;;
13199 esac
13200 : check explicit looping only if NULL did not work, and if the pipe
13201 : bug does not show up on an explicit flush too
13202 case "$fflushNULL" in
13203 "$undef")
13204         $cat >tryp.c <<EOCP
13205 #include <stdio.h>
13206 int
13207 main(int argc, char **argv)
13208 {
13209     char buf[1024];
13210     int i;
13211     char *bp = buf;
13212     while (1) {
13213         while ((i = getc(stdin)) != -1
13214                && (*bp++ = i) != '\n'
13215                && bp < &buf[1024])
13216         /* DO NOTHING */ ;
13217         *bp = '\0';
13218         fprintf(stdout, "%s", buf);
13219         fflush(stdin);
13220         if (i == -1)
13221             return 0;
13222         bp = buf;
13223     }
13224 }
13225 EOCP
13226         set tryp
13227         if eval $compile; then
13228             $rm -f tryp.out
13229             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13230             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13231                $cat >&4 <<EOM
13232 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13233 EOM
13234                 : now check for fflushall behaviour
13235                 case "$fflushall" in
13236                 '')     set try -DTRY_FFLUSH_ALL $output
13237                         if eval $compile; then
13238                                 $cat >&4 <<EOM
13239 (Now testing the other method--but note that this also may fail.)
13240 EOM
13241                                 $rm -f try.out
13242                                 ./try$exe_ext 2>/dev/null
13243                                 if $test -s try.out -a "X$?" = X42; then
13244                                         fflushall="`$cat try.out`"
13245                                 fi
13246                         fi
13247                         $rm -f core try.core core.try.*
13248                         case "$fflushall" in
13249                         x)      $cat >&4 <<EOM
13250 Whew. Flushing explicitly all the stdio streams works.
13251 EOM
13252                                 fflushall="$define"
13253                                 ;;
13254                         '')     $cat >&4 <<EOM
13255 Sigh. Flushing explicitly all the stdio streams doesn't work.
13256 EOM
13257                                 fflushall="$undef"
13258                                 ;;
13259                         *)      $cat >&4 <<EOM
13260 Cannot figure out whether flushing stdio streams explicitly works or not.
13261 I'm assuming it doesn't.
13262 EOM
13263                                 fflushall="$undef"
13264                                 ;;
13265                         esac
13266                         ;;
13267                 "$define"|true|[yY]*)
13268                         fflushall="$define"
13269                         ;;
13270                 *)
13271                         fflushall="$undef"
13272                         ;;
13273                 esac
13274             else
13275                 $cat >&4 <<EOM
13276 All is futile.  Even fflush(stdin) clobbers input pipes!
13277 EOM
13278                 fflushall="$undef"
13279             fi
13280         else
13281             fflushall="$undef"
13282         fi
13283         $rm -f core tryp.c tryp.core core.tryp.*
13284         ;;
13285 *)      fflushall="$undef"
13286         ;;
13287 esac
13288
13289 case "$fflushNULL$fflushall" in
13290 undefundef)
13291         $cat <<EOM
13292 OK, I give up.  I cannot figure out how to flush pending stdio output.
13293 We won't be flushing handles at all before fork/exec/popen.
13294 EOM
13295         ;;
13296 esac
13297 $rm -f try.* try$exe_ext
13298
13299 : Store the full pathname to the ar program for use in the C program
13300 : Respect a hint or command line value for full_ar.
13301 case "$full_ar" in
13302 '') full_ar=$ar ;;
13303 esac
13304
13305 : Store the full pathname to the sed program for use in the C program
13306 full_sed=$sed
13307
13308 : see what type gids are declared as in the kernel
13309 echo " "
13310 echo "Looking for the type for group ids returned by getgid()."
13311 set gid_t gidtype xxx stdio.h sys/types.h
13312 eval $typedef
13313 case "$gidtype" in
13314 xxx)
13315         xxx=`./findhdr sys/user.h`
13316         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13317         case $1 in
13318         unsigned) dflt="$1 $2" ;;
13319         *) dflt="$1" ;;
13320         esac
13321         ;;
13322 *) dflt="$gidtype";;
13323 esac
13324 case "$gidtype" in
13325 gid_t) echo "gid_t found." ;;
13326 *)      rp="What is the type for group ids returned by getgid()?"
13327         . ./myread
13328         gidtype="$ans"
13329         ;;
13330 esac
13331
13332 echo " "
13333 case "$gidtype" in
13334 *_t) zzz="$gidtype"     ;;
13335 *)   zzz="gid"          ;;
13336 esac
13337 echo "Checking the size of $zzz..." >&4 
13338 cat > try.c <<EOCP
13339 #include <sys/types.h>
13340 #include <stdio.h>
13341 int main() {
13342     printf("%d\n", (int)sizeof($gidtype));
13343     exit(0);
13344 }
13345 EOCP
13346 set try
13347 if eval $compile_ok; then
13348         yyy=`./try`
13349         case "$yyy" in
13350         '')     gidsize=4
13351                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13352                 ;;
13353         *)      gidsize=$yyy
13354                 echo "Your $zzz is $gidsize bytes long."
13355                 ;;
13356         esac
13357 else
13358         gidsize=4
13359         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13360 fi
13361
13362
13363 echo " "
13364 case "$gidtype" in
13365 *_t) zzz="$gidtype"     ;;
13366 *)   zzz="gid"          ;;
13367 esac
13368 echo "Checking the sign of $zzz..." >&4 
13369 cat > try.c <<EOCP
13370 #include <sys/types.h>
13371 #include <stdio.h>
13372 int main() {
13373         $gidtype foo = -1;
13374         if (foo < 0)
13375                 printf("-1\n");
13376         else
13377                 printf("1\n");
13378 }
13379 EOCP
13380 set try
13381 if eval $compile; then
13382         yyy=`./try`
13383         case "$yyy" in
13384         '')     gidsign=1
13385                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13386                 ;;
13387         *)      gidsign=$yyy
13388                 case "$gidsign" in
13389                  1) echo "Your $zzz is unsigned." ;;
13390                 -1) echo "Your $zzz is signed."   ;;
13391                 esac
13392                 ;;
13393         esac
13394 else
13395         gidsign=1
13396         echo "(I can't compile the test program--guessing unsigned.)" >&4
13397 fi
13398
13399
13400 echo " "
13401
13402 if $test X"$quadtype" != X; then
13403
13404 echo "Checking how to print 64-bit integers..." >&4
13405
13406 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13407         $cat >try.c <<'EOCP'
13408 #include <sys/types.h>
13409 #include <stdio.h>
13410 int main() {
13411   int q = 12345678901;
13412   printf("%ld\n", q);
13413 }
13414 EOCP
13415         set try
13416         if eval $compile; then
13417                 yyy=`./try$exe_ext`
13418                 case "$yyy" in
13419                 12345678901)
13420                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13421                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13422                         echo "We will use %d."
13423                         ;;
13424                 esac
13425         fi
13426 fi
13427
13428 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13429         $cat >try.c <<'EOCP'
13430 #include <sys/types.h>
13431 #include <stdio.h>
13432 int main() {
13433   long q = 12345678901;
13434   printf("%ld\n", q);
13435 }
13436 EOCP
13437         set try
13438         if eval $compile; then
13439                 yyy=`./try$exe_ext`
13440                 case "$yyy" in
13441                 12345678901)
13442                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13443                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13444                         echo "We will use %ld."
13445                         ;;
13446                 esac
13447         fi
13448 fi
13449
13450 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13451         $cat >try.c <<'EOCP'
13452 #include <sys/types.h>
13453 #include <inttypes.h>
13454 #include <stdio.h>
13455 int main() {
13456   int64_t q = 12345678901;
13457   printf("%" PRId64 "\n", q);
13458 }
13459 EOCP
13460         set try
13461         if eval $compile; then
13462                 yyy=`./try$exe_ext`
13463                 case "$yyy" in
13464                 12345678901)
13465                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13466                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13467                         echo "We will use the C9X style."
13468                         ;;
13469                 esac
13470         fi
13471 fi
13472
13473 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13474         $cat >try.c <<'EOCP'
13475 #include <sys/types.h>
13476 #include <stdio.h>
13477 int main() {
13478   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13479   printf("%lld\n", q);
13480 }
13481 EOCP
13482         set try
13483         if eval $compile; then
13484                 yyy=`./try$exe_ext`
13485                 case "$yyy" in
13486                 12345678901)
13487                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13488                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13489                         echo "We will use the %lld style."
13490                         ;;
13491                 esac
13492         fi
13493 fi
13494
13495 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13496         $cat >try.c <<EOCP
13497 #include <sys/types.h>
13498 #include <stdio.h>
13499 int main() {
13500   $quadtype q = 12345678901;
13501   printf("%Ld\n", q);
13502 }
13503 EOCP
13504         set try
13505         if eval $compile; then
13506                 yyy=`./try$exe_ext`
13507                 case "$yyy" in
13508                 12345678901)
13509                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13510                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13511                         echo "We will use %Ld."
13512                         ;;
13513                 esac
13514         fi
13515 fi
13516
13517 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13518         $cat >try.c <<EOCP
13519 #include <sys/types.h>
13520 #include <stdio.h>
13521 int main() {
13522   $quadtype q = 12345678901;
13523   printf("%qd\n", q);
13524 }
13525 EOCP
13526         set try
13527         if eval $compile; then
13528                 yyy=`./try$exe_ext`
13529                 case "$yyy" in
13530                 12345678901)
13531                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13532                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13533                         echo "We will use %qd."
13534                         ;;
13535                 esac
13536         fi
13537 fi
13538
13539 if $test X"$sPRId64" = X; then
13540         echo "Cannot figure out how to print 64-bit integers." >&4
13541 fi
13542
13543 $rm -f try try.*
13544
13545 fi
13546
13547 case "$sPRId64" in
13548 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13549         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13550         ;;
13551 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13552         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13553         ;;
13554 esac
13555
13556
13557 echo " "
13558 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13559
13560 if $test X"$ivsize" = X8; then
13561         ivdformat="$sPRId64"
13562         uvuformat="$sPRIu64"
13563         uvoformat="$sPRIo64"
13564         uvxformat="$sPRIx64"
13565         uvXUformat="$sPRIXU64"
13566 else
13567         if $test X"$ivsize" = X"$longsize"; then
13568                 ivdformat='"ld"'
13569                 uvuformat='"lu"'
13570                 uvoformat='"lo"'
13571                 uvxformat='"lx"'
13572                 uvXUformat='"lX"'
13573         else
13574                 if $test X"$ivsize" = X"$intsize"; then
13575                         ivdformat='"d"'
13576                         uvuformat='"u"'
13577                         uvoformat='"o"'
13578                         uvxformat='"x"'
13579                         uvXUformat='"X"'
13580                 else
13581                         : far out
13582                         if $test X"$ivsize" = X"$shortsize"; then
13583                                 ivdformat='"hd"'
13584                                 uvuformat='"hu"'
13585                                 uvoformat='"ho"'
13586                                 uvxformat='"hx"'
13587                                 uvXUformat='"hX"'
13588                         fi
13589                 fi
13590         fi
13591 fi
13592
13593 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13594         nveformat="$sPRIeldbl"
13595         nvfformat="$sPRIfldbl"
13596         nvgformat="$sPRIgldbl"
13597         nvEUformat="$sPRIEUldbl"
13598         nvFUformat="$sPRIFUldbl"
13599         nvGUformat="$sPRIGUldbl"
13600 else
13601         nveformat='"e"'
13602         nvfformat='"f"'
13603         nvgformat='"g"'
13604         nvEUformat='"E"'
13605         nvFUformat='"F"'
13606         nvGUformat='"G"'
13607 fi
13608
13609 case "$ivdformat" in
13610 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13611     exit 1
13612     ;;
13613 esac
13614
13615
13616 echo " "
13617 $echo "Checking the format string to be used for gids..." >&4
13618
13619 case "$gidsign" in
13620 -1)     if $test X"$gidsize" = X"$ivsize"; then
13621                 gidformat="$ivdformat"
13622         else
13623                 if $test X"$gidsize" = X"$longsize"; then
13624                         gidformat='"ld"'
13625                 else
13626                         if $test X"$gidsize" = X"$intsize"; then
13627                                 gidformat='"d"'
13628                         else
13629                                 if $test X"$gidsize" = X"$shortsize"; then
13630                                         gidformat='"hd"'
13631                                 fi
13632                         fi
13633                 fi
13634         fi
13635         ;;
13636 *)      if $test X"$gidsize" = X"$uvsize"; then
13637                 gidformat="$uvuformat"
13638         else
13639                 if $test X"$gidsize" = X"$longsize"; then
13640                         gidformat='"lu"'
13641                 else
13642                         if $test X"$gidsize" = X"$intsize"; then
13643                                 gidformat='"u"'
13644                         else
13645                                 if $test X"$gidsize" = X"$shortsize"; then
13646                                         gidformat='"hu"'
13647                                 fi
13648                         fi
13649                 fi
13650         fi
13651         ;;
13652 esac
13653
13654 : see if getgroups exists
13655 set getgroups d_getgrps
13656 eval $inlibc
13657
13658 : see if setgroups exists
13659 set setgroups d_setgrps
13660 eval $inlibc
13661
13662
13663 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13664 echo " "
13665 case "$d_getgrps$d_setgrps" in
13666 *define*)
13667         case "$groupstype" in
13668         '') dflt="$gidtype" ;;
13669         *)  dflt="$groupstype" ;;
13670         esac
13671         $cat <<EOM
13672 What type of pointer is the second argument to getgroups() and setgroups()?
13673 Usually this is the same as group ids, $gidtype, but not always.
13674
13675 EOM
13676         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13677         . ./myread
13678         groupstype="$ans"
13679         ;;
13680 *)  groupstype="$gidtype";;
13681 esac
13682
13683 echo " "
13684 echo "Checking if your $make program sets \$(MAKE)..." >&4
13685 case "$make_set_make" in
13686 '')
13687         $sed 's/^X //' > testmake.mak << 'EOF'
13688 Xall:
13689 X       @echo 'maketemp="$(MAKE)"'
13690 EOF
13691         case "`$make -f testmake.mak 2>/dev/null`" in
13692         *maketemp=*) make_set_make='#' ;;
13693         *)      make_set_make="MAKE=$make" ;;
13694         esac
13695         $rm -f testmake.mak
13696         ;;
13697 esac
13698 case "$make_set_make" in
13699 '#') echo "Yup, it does.";;
13700 *) echo "Nope, it doesn't.";;
13701 esac
13702
13703 : see what type is used for mode_t
13704 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13705 set mode_t modetype int stdio.h sys/types.h
13706 eval $typedef_ask
13707
13708 : see if stdarg is available
13709 echo " "
13710 if $test `./findhdr stdarg.h`; then
13711         echo "<stdarg.h> found." >&4
13712         valstd="$define"
13713 else
13714         echo "<stdarg.h> NOT found." >&4
13715         valstd="$undef"
13716 fi
13717
13718 : see if varags is available
13719 echo " "
13720 if $test `./findhdr varargs.h`; then
13721         echo "<varargs.h> found." >&4
13722 else
13723         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13724 fi
13725
13726 : set up the varargs testing programs
13727 $cat > varargs.c <<EOP
13728 #ifdef I_STDARG
13729 #include <stdarg.h>
13730 #endif
13731 #ifdef I_VARARGS
13732 #include <varargs.h>
13733 #endif
13734
13735 #ifdef I_STDARG
13736 int f(char *p, ...)
13737 #else
13738 int f(va_alist)
13739 va_dcl
13740 #endif
13741 {
13742         va_list ap;
13743 #ifndef I_STDARG
13744         char *p;
13745 #endif
13746 #ifdef I_STDARG
13747         va_start(ap,p);
13748 #else
13749         va_start(ap);
13750         p = va_arg(ap, char *);
13751 #endif
13752         va_end(ap);
13753 }
13754 EOP
13755 $cat > varargs <<EOP
13756 $startsh
13757 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13758         echo "true"
13759 else
13760         echo "false"
13761 fi
13762 $rm -f varargs$_o
13763 EOP
13764 chmod +x varargs
13765
13766 : now check which varargs header should be included
13767 echo " "
13768 i_varhdr=''
13769 case "$valstd" in
13770 "$define")
13771         if `./varargs I_STDARG`; then
13772                 val='stdarg.h'
13773         elif `./varargs I_VARARGS`; then
13774                 val='varargs.h'
13775         fi
13776         ;;
13777 *)
13778         if `./varargs I_VARARGS`; then
13779                 val='varargs.h'
13780         fi
13781         ;;
13782 esac
13783 case "$val" in
13784 '')
13785 echo "I could not find the definition for va_dcl... You have problems..." >&4
13786         val="$undef"; set i_stdarg; eval $setvar
13787         val="$undef"; set i_varargs; eval $setvar
13788         ;;
13789 *) 
13790         set i_varhdr
13791         eval $setvar
13792         case "$i_varhdr" in
13793         stdarg.h)
13794                 val="$define"; set i_stdarg; eval $setvar
13795                 val="$undef"; set i_varargs; eval $setvar
13796                 ;;
13797         varargs.h)
13798                 val="$undef"; set i_stdarg; eval $setvar
13799                 val="$define"; set i_varargs; eval $setvar
13800                 ;;
13801         esac
13802         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13803 esac
13804 $rm -f varargs*
13805
13806 : see if we need va_copy
13807 echo " "
13808 case "$i_stdarg" in
13809 "$define")
13810         $cat >try.c <<EOCP
13811 #include <stdarg.h>
13812 #include <stdio.h>
13813 #$i_stdlib I_STDLIB
13814 #ifdef I_STDLIB
13815 #include <stdlib.h>
13816 #endif
13817 #include <signal.h>
13818
13819 int
13820 ivfprintf(FILE *f, const char *fmt, va_list *valp)
13821 {
13822   return vfprintf(f, fmt, *valp);
13823 }
13824  
13825 int    
13826 myvfprintf(FILE *f, const  char *fmt, va_list val)
13827 {
13828   return ivfprintf(f, fmt, &val);
13829 }
13830       
13831 int
13832 myprintf(char *fmt, ...) 
13833 {
13834   va_list val;
13835   va_start(val, fmt);
13836   return myvfprintf(stdout, fmt, val); 
13837 }         
13838
13839 int
13840 main(int ac, char **av)
13841 {
13842   signal(SIGSEGV, exit);
13843
13844   myprintf("%s%cs all right, then\n", "that", '\'');                            
13845   exit(0);      
13846 }
13847 EOCP
13848         set try
13849         if eval $compile && ./try 2>&1 >/dev/null; then
13850                 case "`./try`" in
13851                 "that's all right, then")
13852                         okay=yes
13853                         ;;
13854                 esac
13855         fi
13856         case "$okay" in
13857         yes)    echo "It seems that you don't need va_copy()." >&4
13858                 need_va_copy="$undef"
13859                 ;;
13860         *)      echo "It seems that va_copy() or similar will be needed." >&4
13861                 need_va_copy="$define"
13862                 ;;
13863         esac
13864         $rm -f try.* core core.* *.core *.core.*
13865         ;;
13866 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
13867         ;;
13868 esac
13869
13870 : define a fucntion to check prototypes
13871 $cat > protochk <<EOSH
13872 $startsh
13873 cc="$cc"
13874 optimize="$optimize"
13875 ccflags="$ccflags"
13876 prototype="$prototype"
13877 define="$define"
13878 rm=$rm
13879 EOSH
13880
13881 $cat >> protochk <<'EOSH'
13882
13883 $rm -f try.c
13884 foo="$1"
13885 shift
13886 while test $# -ge 2; do
13887         case "$1" in
13888                 $define) echo "#include <$2>" >> try.c ;;
13889                 literal) echo "$2" >> try.c ;;
13890         esac
13891     shift 2
13892 done
13893 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13894 cat >> try.c <<'EOCP'
13895 #ifdef CAN_PROTOTYPE
13896 #define _(args) args
13897 #else
13898 #define _(args) ()
13899 #endif
13900 EOCP
13901 echo "$foo" >> try.c
13902 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13903 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13904 status=$?
13905 $rm -f try.[co]
13906 exit $status
13907 EOSH
13908 chmod +x protochk
13909 $eunicefix protochk
13910
13911 : see what type is used for size_t
13912 rp="What is the type used for the length parameter for string functions?"
13913 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13914 eval $typedef_ask
13915
13916 : check for type of arguments to gethostbyaddr. 
13917 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13918         case "$d_gethbyaddr" in
13919         $define)
13920                 $cat <<EOM
13921
13922 Checking to see what type of arguments are accepted by gethostbyaddr().
13923 EOM
13924                 hdrs="$define sys/types.h
13925                         $d_socket sys/socket.h 
13926                         $i_niin netinet/in.h 
13927                         $i_netdb netdb.h
13928                         $i_unistd unistd.h"
13929                 : The first arg can 'char *' or 'void *'
13930                 : The second arg is some of integral type
13931                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13932                         for yyy in size_t long int; do
13933                                 case "$netdb_host_type" in
13934                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13935                                         if ./protochk "$try" $hdrs; then
13936                                                 echo "Your system accepts $xxx for the first arg."
13937                                                 echo "...and $yyy for the second arg."
13938                                                 netdb_host_type="$xxx"
13939                                                 netdb_hlen_type="$yyy"
13940                                         fi
13941                                         ;;
13942                                 esac
13943                         done
13944                 done
13945                 : In case none of those worked, prompt the user.
13946                 case "$netdb_host_type" in
13947                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13948                         dflt='char *'
13949                         . ./myread
13950                         netdb_host_type=$ans
13951                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13952                         dflt="$sizetype"
13953                         . ./myread
13954                         netdb_hlen_type=$ans
13955                         ;;
13956                 esac
13957                 ;;
13958         *)      : no gethostbyaddr, so pick harmless defaults
13959                 netdb_host_type='char *'
13960                 netdb_hlen_type="$sizetype"
13961                 ;;
13962         esac
13963         # Remove the "const" if needed. -- but then we'll have a 
13964         # prototype clash!
13965         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13966 fi
13967
13968 : check for type of argument to gethostbyname. 
13969 if test "X$netdb_name_type" = X ; then
13970         case "$d_gethbyname" in
13971         $define)
13972                 $cat <<EOM
13973
13974 Checking to see what type of argument is accepted by gethostbyname().
13975 EOM
13976                 hdrs="$define sys/types.h
13977                         $d_socket sys/socket.h 
13978                         $i_niin netinet/in.h 
13979                         $i_netdb netdb.h
13980                         $i_unistd unistd.h"
13981                 for xxx in "const char *" "char *"; do
13982                         case "$netdb_name_type" in
13983                         '')     try="extern struct hostent *gethostbyname($xxx);"
13984                                 if ./protochk "$try" $hdrs; then
13985                                         echo "Your system accepts $xxx."
13986                                         netdb_name_type="$xxx"
13987                                 fi
13988                                 ;;
13989                         esac
13990                 done
13991                 : In case none of those worked, prompt the user.
13992                 case "$netdb_name_type" in
13993                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13994                         dflt='char *'
13995                         . ./myread
13996                         netdb_name_type=$ans
13997                         ;;
13998                 esac
13999                 ;;
14000         *)      : no gethostbyname, so pick harmless default
14001                 netdb_name_type='char *'
14002                 ;;
14003         esac
14004 fi
14005
14006 : check for type of 1st argument to getnetbyaddr. 
14007 if test "X$netdb_net_type" = X ; then
14008         case "$d_getnbyaddr" in
14009         $define)
14010                 $cat <<EOM
14011
14012 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14013 EOM
14014                 hdrs="$define sys/types.h
14015                         $d_socket sys/socket.h 
14016                         $i_niin netinet/in.h 
14017                         $i_netdb netdb.h
14018                         $i_unistd unistd.h"
14019                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14020                         case "$netdb_net_type" in
14021                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14022                                 if ./protochk "$try" $hdrs; then
14023                                         echo "Your system accepts $xxx."
14024                                         netdb_net_type="$xxx"
14025                                 fi
14026                                 ;;
14027                         esac
14028                 done
14029                 : In case none of those worked, prompt the user.
14030                 case "$netdb_net_type" in
14031                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14032                         dflt='long'
14033                         . ./myread
14034                         netdb_net_type=$ans
14035                         ;;
14036                 esac
14037                 ;;
14038         *)      : no getnetbyaddr, so pick harmless default
14039                 netdb_net_type='long'
14040                 ;;
14041         esac
14042 fi
14043 : locate the preferred pager for this system
14044 case "$pager" in
14045 '')
14046         dflt=''
14047         case "$pg" in
14048         /*) dflt=$pg;;
14049         [a-zA-Z]:/*) dflt=$pg;;
14050         esac
14051         case "$more" in
14052         /*) dflt=$more;;
14053         [a-zA-Z]:/*) dflt=$more;;
14054         esac
14055         case "$less" in
14056         /*) dflt=$less;;
14057         [a-zA-Z]:/*) dflt=$less;;
14058         esac
14059         case "$dflt" in
14060         '') dflt=/usr/ucb/more;;
14061         esac
14062         ;;
14063 *) dflt="$pager";;
14064 esac
14065 echo " "
14066 fn=f/
14067 rp='What pager is used on your system?'
14068 . ./getfile
14069 pager="$ans"
14070
14071 : see what type pids are declared as in the kernel
14072 rp="What is the type of process ids on this system?"
14073 set pid_t pidtype int stdio.h sys/types.h
14074 eval $typedef_ask
14075
14076 : Find earliest binary compatible site_perl subdirectory perl can use.
14077 case "$bincompat5005" in
14078 "$define") xs_apiversion='5.005' ;;
14079 *) xs_apiversion=$version ;;   # The current site_perl version.
14080 esac
14081 : Find earliest pure perl site_perl subdirectory perl can use.
14082 : The versioned directories started at 5.005.
14083 pm_apiversion='5.005'
14084
14085 : check for length of pointer
14086 echo " "
14087 case "$ptrsize" in
14088 '')
14089         echo "Checking to see how big your pointers are..." >&4
14090         if test "$voidflags" -gt 7; then
14091                 echo '#define VOID_PTR char *' > try.c
14092         else
14093                 echo '#define VOID_PTR void *' > try.c
14094         fi
14095         $cat >>try.c <<'EOCP'
14096 #include <stdio.h>
14097 int main()
14098 {
14099     printf("%d\n", (int)sizeof(VOID_PTR));
14100     exit(0);
14101 }
14102 EOCP
14103         set try
14104         if eval $compile_ok; then
14105                 ptrsize=`./try`
14106                 echo "Your pointers are $ptrsize bytes long."
14107         else
14108                 dflt='4'
14109                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
14110                 rp="What is the size of a pointer (in bytes)?"
14111                 . ./myread
14112                 ptrsize="$ans"
14113         fi
14114         ;;
14115 esac
14116 $rm -f try.c try
14117
14118 : see if ar generates random libraries by itself
14119 echo " "
14120 echo "Checking how to generate random libraries on your machine..." >&4
14121 echo 'int bar1() { return bar2(); }' > bar1.c
14122 echo 'int bar2() { return 2; }' > bar2.c
14123 $cat > foo.c <<'EOP'
14124 int main() { printf("%d\n", bar1()); exit(0); }
14125 EOP
14126 $cc $ccflags -c bar1.c >/dev/null 2>&1
14127 $cc $ccflags -c bar2.c >/dev/null 2>&1
14128 $cc $ccflags -c foo.c >/dev/null 2>&1
14129 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14130 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14131         ./foobar >/dev/null 2>&1; then
14132         echo "$ar appears to generate random libraries itself."
14133         orderlib=false
14134         ranlib=":"
14135 elif $ar ts bar$_a >/dev/null 2>&1 &&
14136         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14137         ./foobar >/dev/null 2>&1; then
14138                 echo "a table of contents needs to be added with '$ar ts'."
14139                 orderlib=false
14140                 ranlib="$ar ts"
14141 else
14142         case "$ranlib" in
14143         :) ranlib='';;
14144         '')
14145                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14146                 $test -f $ranlib || ranlib=''
14147                 ;;
14148         esac
14149         if $test -n "$ranlib"; then
14150                 echo "your system has '$ranlib'; we'll use that."
14151                 orderlib=false
14152         else
14153                 echo "your system doesn't seem to support random libraries"
14154                 echo "so we'll use lorder and tsort to order the libraries."
14155                 orderlib=true
14156                 ranlib=":"
14157         fi
14158 fi
14159 $rm -f foo* bar* 
14160
14161 : check for type of arguments to select. 
14162 case "$selecttype" in
14163 '') case "$d_select" in
14164         $define)
14165                 echo " "
14166                 $cat <<EOM
14167 Checking to see what type of arguments are accepted by select().
14168 EOM
14169                 hdrs="$define sys/types.h
14170                         $i_systime sys/time.h 
14171                         $i_sysselct sys/select.h
14172                         $d_socket sys/socket.h"
14173                 : The first arg can be int, unsigned, or size_t
14174                 : The last arg may or may not be 'const'
14175                 val=''
14176                 : void pointer has been seen but using that
14177                 : breaks the selectminbits test
14178                 for xxx in 'fd_set *' 'int *'; do
14179                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14180                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14181                                         case "$val" in
14182                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14183                                                 if ./protochk "$try" $hdrs; then
14184                                                         echo "Your system accepts $xxx."
14185                                                         val="$xxx"
14186                                                 fi
14187                                                 ;;
14188                                         esac
14189                                 done
14190                         done
14191                 done
14192                 case "$val" in
14193                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14194                         case "$d_fd_set" in
14195                                 $define) dflt="fd_set *" ;;
14196                                 *)              dflt="int *" ;;
14197                         esac
14198                         . ./myread
14199                         val=$ans
14200                         ;;
14201                 esac
14202                 selecttype="$val"
14203                 ;;
14204         *)      : no select, so pick a harmless default
14205                 selecttype='int *'
14206                 ;;
14207         esac
14208         ;;
14209 esac
14210
14211 : check for the select 'width'
14212 case "$selectminbits" in
14213 '') case "$d_select" in
14214         $define)
14215                 $cat <<EOM
14216
14217 Checking to see on how many bits at a time your select() operates...
14218 EOM
14219                 $cat >try.c <<EOCP
14220 #include <sys/types.h>
14221 #$i_time I_TIME
14222 #$i_systime I_SYS_TIME
14223 #$i_systimek I_SYS_TIME_KERNEL
14224 #ifdef I_TIME
14225 #   include <time.h>
14226 #endif
14227 #ifdef I_SYS_TIME
14228 #   ifdef I_SYS_TIME_KERNEL
14229 #       define KERNEL
14230 #   endif
14231 #   include <sys/time.h>
14232 #   ifdef I_SYS_TIME_KERNEL
14233 #       undef KERNEL
14234 #   endif
14235 #endif
14236 #$i_sysselct I_SYS_SELECT
14237 #ifdef I_SYS_SELECT
14238 #include <sys/select.h>
14239 #endif
14240 #$d_socket HAS_SOCKET
14241 #ifdef HAS_SOCKET
14242 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14243 #endif
14244 #include <stdio.h>
14245 $selecttype b;
14246 #define S sizeof(*(b))
14247 #define MINBITS 64
14248 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14249 #define NBITS  (NBYTES * 8)
14250 int main() {
14251     char s[NBYTES];
14252     struct timeval t;
14253     int i;
14254     FILE* fp;
14255     int fd;
14256
14257     fclose(stdin);
14258     fp = fopen("try.c", "r");
14259     if (fp == 0)
14260       exit(1);
14261     fd = fileno(fp);
14262     if (fd < 0)
14263       exit(2);
14264     b = ($selecttype)s;
14265     for (i = 0; i < NBITS; i++)
14266         FD_SET(i, b);
14267     t.tv_sec  = 0;
14268     t.tv_usec = 0;
14269     select(fd + 1, b, 0, 0, &t);
14270     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14271     printf("%d\n", i + 1);
14272     return 0;
14273 }
14274 EOCP
14275                 set try
14276                 if eval $compile_ok; then
14277                         selectminbits=`./try`
14278                         case "$selectminbits" in
14279                         '')     cat >&4 <<EOM
14280 Cannot figure out on how many bits at a time your select() operates.
14281 I'll play safe and guess it is 32 bits.
14282 EOM
14283                                 selectminbits=32
14284                                 bits="32 bits"
14285                                 ;;
14286                         1)      bits="1 bit" ;;
14287                         *)      bits="$selectminbits bits" ;;
14288                         esac
14289                         echo "Your select() operates on $bits at a time." >&4
14290                 else
14291                         rp='What is the minimum number of bits your select() operates on?'
14292                         case "$byteorder" in
14293                         1234|12345678)  dflt=32 ;;
14294                         *)              dflt=1  ;;
14295                         esac
14296                         . ./myread
14297                         val=$ans
14298                         selectminbits="$val"
14299                 fi
14300                 $rm -f try.* try
14301                 ;;
14302         *)      : no select, so pick a harmless default
14303                 selectminbits='32'
14304                 ;;
14305         esac
14306         ;;
14307 esac
14308
14309 : Trace out the files included by signal.h, then look for SIGxxx names.
14310 : Remove SIGARRAYSIZE used by HPUX.
14311 : Remove SIGSTKSIZE used by Linux.
14312 : Remove SIGSTKSZ used by Posix.
14313 : Remove SIGTYP void lines used by OS2.
14314 : Some cpps, like os390, dont give the file name anywhere
14315 if [ "X$fieldn" = X ]; then
14316         : Just make some guesses.  We check them later.
14317         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14318 else
14319         xxx=`echo '#include <signal.h>' |
14320         $cppstdin $cppminus $cppflags 2>/dev/null |
14321         $grep '^[       ]*#.*include' | 
14322         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14323 fi
14324 : Check this list of files to be sure we have parsed the cpp output ok.
14325 : This will also avoid potentially non-existent files, such 
14326 : as ../foo/bar.h
14327 xxxfiles=''
14328 for xx in $xxx /dev/null ; do
14329         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14330 done
14331 : If we have found no files, at least try signal.h
14332 case "$xxxfiles" in
14333 '')     xxxfiles=`./findhdr signal.h` ;;
14334 esac
14335 xxx=`awk '
14336 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14337         print substr($2, 4, 20)
14338 }
14339 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14340         print substr($3, 4, 20)
14341 }' $xxxfiles`
14342 : Append some common names just in case the awk scan failed.
14343 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14344 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14345 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14346 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14347 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14348
14349 : generate a few handy files for later
14350 $cat > signal.c <<'EOCP'
14351 #include <sys/types.h>
14352 #include <signal.h>
14353 #include <stdio.h>
14354 int main() {
14355
14356 /* Strange style to avoid deeply-nested #if/#else/#endif */
14357 #ifndef NSIG
14358 #  ifdef _NSIG
14359 #    define NSIG (_NSIG)
14360 #  endif
14361 #endif
14362
14363 #ifndef NSIG
14364 #  ifdef SIGMAX
14365 #    define NSIG (SIGMAX+1)
14366 #  endif
14367 #endif
14368
14369 #ifndef NSIG
14370 #  ifdef SIG_MAX
14371 #    define NSIG (SIG_MAX+1)
14372 #  endif
14373 #endif
14374
14375 #ifndef NSIG
14376 #  ifdef MAXSIG
14377 #    define NSIG (MAXSIG+1)
14378 #  endif
14379 #endif
14380
14381 #ifndef NSIG
14382 #  ifdef MAX_SIG
14383 #    define NSIG (MAX_SIG+1)
14384 #  endif
14385 #endif
14386
14387 #ifndef NSIG
14388 #  ifdef SIGARRAYSIZE
14389 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14390 #  endif
14391 #endif
14392
14393 #ifndef NSIG
14394 #  ifdef _sys_nsig
14395 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14396 #  endif
14397 #endif
14398
14399 /* Default to some arbitrary number that's big enough to get most
14400    of the common signals.
14401 */
14402 #ifndef NSIG
14403 #    define NSIG 50
14404 #endif
14405
14406 printf("NSIG %d\n", NSIG);
14407
14408 #ifndef JUST_NSIG
14409
14410 EOCP
14411
14412 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14413 {
14414         printf "#ifdef SIG"; printf $1; printf "\n"
14415         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14416         printf $1; printf ");\n"
14417         printf "#endif\n"
14418 }
14419 END {
14420         printf "#endif /* JUST_NSIG */\n";
14421         printf "exit(0);\n}\n";
14422 }
14423 ' >>signal.c
14424 $cat >signal.awk <<'EOP'
14425 BEGIN { ndups = 0 }
14426 $1 ~ /^NSIG$/ { nsig = $2 }
14427 ($1 !~ /^NSIG$/) && (NF == 2) {
14428     if ($2 > maxsig) { maxsig = $2 }
14429     if (sig_name[$2]) {
14430         dup_name[ndups] = $1
14431         dup_num[ndups] = $2
14432         ndups++ 
14433     }
14434     else {
14435         sig_name[$2] = $1
14436         sig_num[$2] = $2
14437     }
14438 }
14439 END { 
14440     if (nsig == 0) {
14441         nsig = maxsig + 1
14442     }
14443     printf("NSIG %d\n", nsig);
14444     for (n = 1; n < nsig; n++) {
14445         if (sig_name[n]) {
14446             printf("%s %d\n", sig_name[n], sig_num[n])
14447         }
14448         else {
14449             printf("NUM%d %d\n", n, n) 
14450         }
14451     }
14452     for (n = 0; n < ndups; n++) {
14453         printf("%s %d\n", dup_name[n], dup_num[n])
14454     }
14455 }
14456 EOP
14457 $cat >signal_cmd <<EOS
14458 $startsh
14459 if $test -s signal.lst; then
14460     echo "Using your existing signal.lst file"
14461         exit 0
14462 fi
14463 xxx="$xxx"
14464 EOS
14465 $cat >>signal_cmd <<'EOS'
14466
14467 set signal
14468 if eval $compile_ok; then
14469         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14470 else
14471         echo "(I can't seem be able to compile the whole test program)" >&4
14472         echo "(I'll try it in little pieces.)" >&4
14473         set signal -DJUST_NSIG
14474         if eval $compile_ok; then
14475                 ./signal$_exe > signal.nsg
14476                 $cat signal.nsg
14477         else
14478                 echo "I can't seem to figure out how many signals you have." >&4
14479                 echo "Guessing 50." >&4
14480                 echo 'NSIG 50' > signal.nsg
14481         fi
14482         : Now look at all the signal names, one at a time.
14483         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14484                 $cat > signal.c <<EOCP
14485 #include <sys/types.h>
14486 #include <signal.h>
14487 #include <stdio.h>
14488 int main() {
14489 printf("$xx %d\n", SIG${xx});
14490 return 0;
14491 }
14492 EOCP
14493                 set signal
14494                 if eval $compile; then
14495                         echo "SIG${xx} found."
14496                         ./signal$_exe  >> signal.ls1
14497                 else
14498                         echo "SIG${xx} NOT found."
14499                 fi
14500         done
14501         if $test -s signal.ls1; then
14502                 $cat signal.nsg signal.ls1 |
14503                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14504         fi
14505
14506 fi
14507 if $test -s signal.lst; then
14508         :
14509 else
14510         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14511         echo 'kill -l' >signal
14512         set X `csh -f <signal`
14513         $rm -f signal
14514         shift
14515         case $# in
14516         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14517         esac
14518         echo $@ | $tr ' ' $trnl | \
14519             $awk '{ printf "%s %d\n", $1, ++s; }
14520                   END { printf "NSIG %d\n", ++s }' >signal.lst
14521 fi
14522 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14523 EOS
14524 chmod a+x signal_cmd
14525 $eunicefix signal_cmd
14526
14527 : generate list of signal names
14528 echo " "
14529 case "$sig_name_init" in
14530 '') doinit=yes ;;
14531 *)  case "$sig_num_init" in
14532     ''|*,*) doinit=yes ;;
14533     esac ;;
14534 esac
14535 case "$doinit" in
14536 yes)
14537         echo "Generating a list of signal names and numbers..." >&4
14538         . ./signal_cmd
14539         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14540         sig_name=`$awk 'BEGIN { printf "ZERO " }
14541                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14542         sig_num=`$awk  'BEGIN { printf "0 " }
14543                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14544         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14545                              !/^NSIG/   { printf "\"%s\", ", $1 }
14546                              END        { printf "0\n" }' signal.lst`
14547         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14548                              !/^NSIG/   { printf "%d, ", $2}
14549                              END        { printf "0\n"}' signal.lst`
14550         ;;
14551 esac
14552 echo "The following $sig_count signals are available:"
14553 echo " "
14554 echo $sig_name | $awk \
14555 'BEGIN { linelen = 0 }
14556 {
14557         for (i = 1; i <= NF; i++) {
14558                 name = "SIG" $i " "
14559                 linelen = linelen + length(name)
14560                 if (linelen > 70) {
14561                         printf "\n"
14562                         linelen = length(name)
14563                 }
14564                 printf "%s", name
14565         }
14566         printf "\n"
14567 }'
14568 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14569
14570 echo " "
14571 case "$sizetype" in
14572 *_t) zzz="$sizetype"    ;;
14573 *)   zzz="filesize"     ;;
14574 esac
14575 echo "Checking the size of $zzz..." >&4 
14576 cat > try.c <<EOCP
14577 #include <sys/types.h>
14578 #include <stdio.h>
14579 int main() {
14580     printf("%d\n", (int)sizeof($sizetype));
14581     exit(0);
14582 }
14583 EOCP
14584 set try
14585 if eval $compile_ok; then
14586         yyy=`./try`
14587         case "$yyy" in
14588         '')     sizesize=4
14589                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14590                 ;;
14591         *)      sizesize=$yyy
14592                 echo "Your $zzz size is $sizesize bytes."
14593                 ;;
14594         esac
14595 else
14596         sizesize=4
14597         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14598 fi
14599
14600
14601 : check for socklen_t
14602 echo " "
14603 echo "Checking to see if you have socklen_t..." >&4
14604 $cat >try.c <<EOCP
14605 #include <sys/types.h>
14606 #$d_socket HAS_SOCKET
14607 #ifdef HAS_SOCKET
14608 #include <sys/socket.h>
14609 #endif
14610 int main() { socklen_t x = 16; }
14611 EOCP
14612 set try
14613 if eval $compile; then
14614         val="$define"
14615         echo "You have socklen_t."
14616 else
14617         val="$undef"
14618         echo "You do not have socklen_t."
14619         case "$sizetype" in
14620         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14621         esac
14622 fi
14623 $rm -f try try.*
14624 set d_socklen_t
14625 eval $setvar
14626
14627 : see if this is a socks.h system
14628 set socks.h i_socks
14629 eval $inhdr
14630
14631 : check for type of the size argument to socket calls
14632 case "$d_socket" in
14633 "$define")
14634         $cat <<EOM
14635
14636 Checking to see what type is the last argument of accept().
14637 EOM
14638         yyy=''
14639         case "$d_socklen_t" in
14640         "$define") yyy="$yyy socklen_t"
14641         esac
14642         yyy="$yyy $sizetype int long unsigned"
14643         for xxx in $yyy; do
14644                 case "$socksizetype" in
14645                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14646                         case "$usesocks" in
14647                         "$define")
14648                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14649                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14650                                         socksizetype="$xxx"
14651                                 fi
14652                                 ;;
14653                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14654                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14655                                         socksizetype="$xxx"
14656                                 fi
14657                                 ;;
14658                         esac
14659                         ;;
14660                 esac
14661         done
14662 : In case none of those worked, prompt the user.
14663         case "$socksizetype" in
14664         '')     rp='What is the type for socket address structure sizes?'
14665                 dflt='int'
14666                 . ./myread
14667                 socksizetype=$ans
14668                 ;;
14669         esac
14670         ;;
14671 *)      : no sockets, so pick relatively harmless default
14672         socksizetype='int'
14673         ;;
14674 esac
14675
14676 : see what type is used for signed size_t
14677 set ssize_t ssizetype int stdio.h sys/types.h
14678 eval $typedef
14679 dflt="$ssizetype"
14680 $cat > ssize.c <<EOM
14681 #include <stdio.h>
14682 #include <sys/types.h>
14683 #define Size_t $sizetype
14684 #define SSize_t $dflt
14685 int main()
14686 {
14687         if (sizeof(Size_t) == sizeof(SSize_t))
14688                 printf("$dflt\n");
14689         else if (sizeof(Size_t) == sizeof(int))
14690                 printf("int\n");
14691         else 
14692                 printf("long\n");
14693         exit(0);
14694 }
14695 EOM
14696 echo " "
14697 set ssize
14698 if eval $compile_ok && ./ssize > /dev/null; then
14699         ssizetype=`./ssize`
14700         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14701 else
14702         $cat >&4 <<EOM
14703 Help! I can't compile and run the ssize_t test program: please enlighten me!
14704 (This is probably a misconfiguration in your system or libraries, and
14705 you really ought to fix it.  Still, I'll try anyway.)
14706
14707 I need a type that is the same size as $sizetype, but is guaranteed to
14708 be signed.  Common values are ssize_t, int and long.
14709
14710 EOM
14711         rp="What signed type is the same size as $sizetype?"
14712         . ./myread
14713         ssizetype="$ans"
14714 fi
14715 $rm -f ssize ssize.*
14716
14717 : see what type of char stdio uses.
14718 echo " "
14719 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14720 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14721         echo "Your stdio uses unsigned chars." >&4
14722         stdchar="unsigned char"
14723 else
14724         echo "Your stdio uses signed chars." >&4
14725         stdchar="char"
14726 fi
14727 $rm -f stdioh
14728
14729
14730
14731 : see if time exists
14732 echo " "
14733 if test "X$d_time" = X -o X"$timetype" = X; then
14734     if set time val -f d_time; eval $csym; $val; then
14735                 echo 'time() found.' >&4
14736                 val="$define"
14737                 rp="What is the type returned by time() on this system?"
14738                 set time_t timetype long stdio.h sys/types.h
14739                 eval $typedef_ask
14740     else
14741                 echo 'time() not found, hope that will do.' >&4
14742                 val="$undef"
14743                 timetype='int';
14744     fi
14745     set d_time
14746     eval $setvar
14747 fi
14748
14749 : see what type uids are declared as in the kernel
14750 echo " "
14751 echo "Looking for the type for user ids returned by getuid()."
14752 set uid_t uidtype xxx stdio.h sys/types.h
14753 eval $typedef
14754 case "$uidtype" in
14755 xxx)
14756         xxx=`./findhdr sys/user.h`
14757         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14758         case $1 in
14759         unsigned) dflt="$1 $2" ;;
14760         *) dflt="$1" ;;
14761         esac
14762         ;;
14763 *) dflt="$uidtype";;
14764 esac
14765 case "$uidtype" in
14766 uid_t)  echo "uid_t found." ;;
14767 *)      rp="What is the type for user ids returned by getuid()?"
14768         . ./myread
14769         uidtype="$ans"
14770         ;;
14771 esac
14772
14773 echo " "
14774 case "$uidtype" in
14775 *_t) zzz="$uidtype"     ;;
14776 *)   zzz="uid"          ;;
14777 esac
14778 echo "Checking the size of $zzz..." >&4 
14779 cat > try.c <<EOCP
14780 #include <sys/types.h>
14781 #include <stdio.h>
14782 int main() {
14783     printf("%d\n", (int)sizeof($uidtype));
14784     exit(0);
14785 }
14786 EOCP
14787 set try
14788 if eval $compile_ok; then
14789         yyy=`./try`
14790         case "$yyy" in
14791         '')     uidsize=4
14792                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14793                 ;;
14794         *)      uidsize=$yyy
14795                 echo "Your $zzz is $uidsize bytes long."
14796                 ;;
14797         esac
14798 else
14799         uidsize=4
14800         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14801 fi
14802
14803 echo " "
14804 case "$uidtype" in
14805 *_t) zzz="$uidtype"     ;;
14806 *)   zzz="uid"          ;;
14807 esac
14808 echo "Checking the sign of $zzz..." >&4
14809 cat > try.c <<EOCP
14810 #include <sys/types.h>
14811 #include <stdio.h>
14812 int main() {
14813         $uidtype foo = -1;
14814         if (foo < 0)
14815                 printf("-1\n");
14816         else
14817                 printf("1\n");
14818 }
14819 EOCP
14820 set try
14821 if eval $compile; then
14822         yyy=`./try`
14823         case "$yyy" in
14824         '')     uidsign=1
14825                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14826                 ;;
14827         *)      uidsign=$yyy
14828                 case "$uidsign" in
14829                  1) echo "Your $zzz is unsigned." ;;
14830                 -1) echo "Your $zzz is signed."   ;;
14831                 esac
14832                 ;;
14833         esac
14834 else
14835         uidsign=1
14836         echo "(I can't compile the test program--guessing unsigned.)" >&4
14837 fi
14838
14839
14840
14841 echo " "
14842 $echo "Checking the format string to be used for uids..." >&4
14843
14844 case "$uidsign" in
14845 -1)     if $test X"$uidsize" = X"$ivsize"; then
14846                 uidformat="$ivdformat"
14847         else
14848                 if $test X"$uidsize" = X"$longsize"; then
14849                         uidformat='"ld"'
14850                 else
14851                         if $test X"$uidsize" = X"$intsize"; then
14852                                 uidformat='"d"'
14853                         else
14854                                 if $test X"$uidsize" = X"$shortsize"; then
14855                                         uidformat='"hd"'
14856                                 fi
14857                         fi
14858                 fi
14859         fi
14860         ;;
14861 *)      if $test X"$uidsize" = X"$uvsize"; then
14862                 uidformat="$uvuformat"
14863         else
14864                 if $test X"$uidsize" = X"$longsize"; then
14865                         uidformat='"lu"'
14866                 else
14867                         if $test X"$uidsize" = X"$intsize"; then
14868                                 uidformat='"u"'
14869                         else
14870                                 if $test X"$uidsize" = X"$shortsize"; then
14871                                         uidformat='"hu"'
14872                                 fi
14873                         fi
14874                 fi
14875         fi
14876         ;;
14877 esac
14878
14879 : see if dbm.h is available
14880 : see if dbmclose exists
14881 set dbmclose d_dbmclose
14882 eval $inlibc
14883
14884 case "$d_dbmclose" in
14885 $define)
14886         set dbm.h i_dbm
14887         eval $inhdr
14888         case "$i_dbm" in
14889         $define)
14890                 val="$undef"
14891                 set i_rpcsvcdbm
14892                 eval $setvar
14893                 ;;
14894         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14895                 eval $inhdr
14896                 ;;
14897         esac
14898         ;;
14899 *)      echo "We won't be including <dbm.h>"
14900         val="$undef"
14901         set i_dbm
14902         eval $setvar
14903         val="$undef"
14904         set i_rpcsvcdbm
14905         eval $setvar
14906         ;;
14907 esac
14908
14909 : see if this is a sys/file.h system
14910 val=''
14911 set sys/file.h val
14912 eval $inhdr
14913
14914 : do we need to include sys/file.h ?
14915 case "$val" in
14916 "$define")
14917         echo " "
14918         if $h_sysfile; then
14919                 val="$define"
14920                 echo "We'll be including <sys/file.h>." >&4
14921         else
14922                 val="$undef"
14923                 echo "We won't be including <sys/file.h>." >&4
14924         fi
14925         ;;
14926 *)
14927         h_sysfile=false
14928         ;;
14929 esac
14930 set i_sysfile
14931 eval $setvar
14932
14933 : see if fcntl.h is there
14934 val=''
14935 set fcntl.h val
14936 eval $inhdr
14937
14938 : see if we can include fcntl.h
14939 case "$val" in
14940 "$define")
14941         echo " "
14942         if $h_fcntl; then
14943                 val="$define"
14944                 echo "We'll be including <fcntl.h>." >&4
14945         else
14946                 val="$undef"
14947                 if $h_sysfile; then
14948         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14949                 else
14950                         echo "We won't be including <fcntl.h>." >&4
14951                 fi
14952         fi
14953         ;;
14954 *)
14955         h_fcntl=false
14956         val="$undef"
14957         ;;
14958 esac
14959 set i_fcntl
14960 eval $setvar
14961
14962 : see if this is a iconv.h system
14963 set iconv.h i_iconv
14964 eval $inhdr
14965
14966 : see if this is a ieeefp.h system
14967 set ieeefp.h i_ieeefp
14968 eval $inhdr
14969
14970 : see if this is a libutil.h system
14971 set libutil.h i_libutil
14972 eval $inhdr
14973
14974 : see if locale.h is available
14975 set locale.h i_locale
14976 eval $inhdr
14977
14978 : see if mach cthreads are available
14979 if test "X$usethreads" = "X$define"; then
14980         set mach/cthreads.h i_machcthr
14981         eval $inhdr
14982 else
14983         i_machcthr="$undef"
14984 fi
14985
14986
14987
14988 : see if this is a math.h system
14989 set math.h i_math
14990 eval $inhdr
14991
14992 : see if this is a mntent.h system
14993 set mntent.h i_mntent
14994 eval $inhdr
14995
14996 : see if ndbm.h is available
14997 set ndbm.h t_ndbm
14998 eval $inhdr
14999 case "$t_ndbm" in
15000 $define)
15001         : see if dbm_open exists
15002         set dbm_open d_dbm_open
15003         eval $inlibc
15004         case "$d_dbm_open" in
15005         $undef)
15006                 t_ndbm="$undef"
15007                 echo "We won't be including <ndbm.h>"
15008                 ;;
15009         esac
15010         ;;
15011 esac
15012 val="$t_ndbm"
15013 set i_ndbm
15014 eval $setvar
15015
15016 : see if net/errno.h is available
15017 val=''
15018 set net/errno.h val
15019 eval $inhdr
15020
15021 : Unfortunately, it causes problems on some systems.  Arrgh.
15022 case "$val" in
15023 $define)
15024         cat > try.c <<'EOM'
15025 #include <stdio.h>
15026 #include <errno.h>
15027 #include <net/errno.h>
15028 int func()
15029 {
15030         return ENOTSOCK;
15031 }
15032 EOM
15033         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15034                 echo "We'll be including <net/errno.h>." >&4
15035         else
15036                 echo "We won't be including <net/errno.h>." >&4
15037                 val="$undef"
15038         fi
15039         $rm -f try.* try
15040         ;;
15041 esac
15042 set i_neterrno
15043 eval $setvar
15044
15045 : see if netinet/tcp.h is available
15046 set netinet/tcp.h i_netinettcp
15047 eval $inhdr
15048
15049 : see if this is a poll.h system
15050 set poll.h i_poll
15051 eval $inhdr
15052
15053 : see if this is a prot.h system
15054 set prot.h i_prot
15055 eval $inhdr
15056
15057 echo " "
15058 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15059 $cat <<'EOSH' > Cppsym.know
15060 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15061 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15062 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
15063 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
15064 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15065 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15066 bull c cadmus clipper CMU COFF COMPILER_VERSION
15067 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15068 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15069 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15070 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15071 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15072 H3050R H3050RX hbullx20 hcx host_mips
15073 hp200 hp300 hp700 HP700 hp800 hp9000
15074 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15075 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15076 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15077 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15078 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15079 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15080 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15081 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15082 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15083 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15084 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15085 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15086 MATH_HAS_NO_SIDE_EFFECTS
15087 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15088 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15089 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15090 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15091 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15092 NetBSD news1500 news1700 news1800 news1900 news3700
15093 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15094 ns32016 ns32332 ns32k nsc32000
15095 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15096 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15097 pc532 pdp11 PGC PIC plexus PORTAR posix
15098 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15099 POSIX_C_SOURCE POSIX_SOURCE POWER
15100 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15101 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
15102 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15103 sony sony_news sonyrisc sparc sparclite spectrum
15104 stardent stdc STDC_EXT stratos sun sun3 sun386
15105 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15106 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15107 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15108 sysV68 sysV88 Tek4132 Tek4300 titan
15109 tower tower32 tower32_200 tower32_600 tower32_700
15110 tower32_800 tower32_850 tss
15111 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15112 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15113 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15114 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15115 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15116 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15117 z8000
15118 EOSH
15119 # Maybe put other stuff here too.
15120 cat <<EOSH >>Cppsym.know
15121 $osname
15122 EOSH
15123 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15124 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15125 $cat Cppsym.know > Cppsym.c
15126 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15127 $rm -f Cppsym.a Cppsym.b Cppsym.c
15128 cat <<EOSH > Cppsym
15129 $startsh
15130 if $test \$# -gt 0; then
15131     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15132     if $test -s Cppsym.got; then
15133         $rm -f Cppsym.got
15134         exit 0
15135     fi
15136     $rm -f Cppsym.got
15137     exit 1
15138 else
15139     $tr " " "$trnl" | ./Cppsym.try
15140     exit 0
15141 fi
15142 EOSH
15143 chmod +x Cppsym
15144 $eunicefix Cppsym
15145 cat <<EOSH > Cppsym.try
15146 $startsh
15147 cat <<'EOCP' > try.c
15148 #include <stdio.h>
15149 int main() {
15150 EOCP
15151 $awk \\
15152 EOSH
15153 cat <<'EOSH' >> Cppsym.try
15154 'length($1) > 0 {
15155     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15156     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15157     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15158     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
15159 }'       >> try.c
15160 echo '}' >> try.c
15161 EOSH
15162 cat <<EOSH >> Cppsym.try
15163 ccflags="$ccflags"
15164 case "$osname-$gccversion" in
15165 irix-) ccflags="\$ccflags -woff 1178" ;;
15166 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15167 esac
15168 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15169 EOSH
15170 chmod +x Cppsym.try
15171 $eunicefix Cppsym.try
15172 ./Cppsym < Cppsym.know > Cppsym.true
15173 : now check the C compiler for additional symbols
15174 postprocess_cc_v=''
15175 case "$osname" in
15176 aix) postprocess_cc_v="|$tr , ' '" ;;
15177 esac
15178 $cat >ccsym <<EOS
15179 $startsh
15180 $cat >tmp.c <<EOF
15181 extern int foo;
15182 EOF
15183 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15184 do
15185         case "\$i" in
15186         -D*) echo "\$i" | $sed 's/^-D//';;
15187         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15188         esac
15189 done
15190 $rm -f try.c
15191 EOS
15192 postprocess_cc_v=''
15193 chmod +x ccsym
15194 $eunicefix ccsym
15195 ./ccsym > ccsym1.raw
15196 if $test -s ccsym1.raw; then
15197        $sort ccsym1.raw | $uniq >ccsym.raw
15198 else
15199        mv ccsym1.raw ccsym.raw
15200 fi
15201
15202 $awk '/\=/ { print $0; next }
15203         { print $0"=1" }' ccsym.raw >ccsym.list
15204 $awk '/\=/ { print $0; next }
15205         { print $0"=1" }' Cppsym.true >ccsym.true
15206 $comm -13 ccsym.true ccsym.list >ccsym.own
15207 $comm -12 ccsym.true ccsym.list >ccsym.com
15208 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15209 also=''
15210 if $test -z ccsym.raw; then
15211         echo "Your C compiler doesn't seem to define any symbols!" >&4
15212         echo " "
15213         echo "However, your C preprocessor defines the following symbols:"
15214         $cat Cppsym.true
15215         ccsymbols=''
15216         cppsymbols=`$cat Cppsym.true`
15217         cppsymbols=`echo $cppsymbols`
15218         cppccsymbols="$cppsymbols"
15219 else
15220         if $test -s ccsym.com; then
15221                 echo "Your C compiler and pre-processor define these symbols:"
15222                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15223                 also='also '
15224                 symbols='ones'
15225                 cppccsymbols=`$cat ccsym.com`
15226                 cppccsymbols=`echo $cppccsymbols`
15227                 $test "$silent" || sleep 1
15228         fi
15229         if $test -s ccsym.cpp; then
15230                 $test "$also" && echo " "
15231                 echo "Your C pre-processor ${also}defines the following symbols:"
15232                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15233                 also='further '
15234                 cppsymbols=`$cat ccsym.cpp`
15235                 cppsymbols=`echo $cppsymbols`
15236                 $test "$silent" || sleep 1
15237         fi
15238         if $test -s ccsym.own; then
15239                 $test "$also" && echo " "
15240                 echo "Your C compiler ${also}defines the following cpp symbols:"
15241                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15242                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15243                 ccsymbols=`$cat ccsym.own`
15244                 ccsymbols=`echo $ccsymbols`
15245                 $test "$silent" || sleep 1
15246         fi
15247 fi
15248 $rm -f ccsym* Cppsym.*
15249
15250 : see if this is a termio system
15251 val="$undef"
15252 val2="$undef"
15253 val3="$undef"
15254 if $test `./findhdr termios.h`; then
15255         set tcsetattr i_termios
15256         eval $inlibc
15257         val3="$i_termios"
15258 fi
15259 echo " "
15260 case "$val3" in
15261 "$define") echo "You have POSIX termios.h... good!" >&4;;
15262 *) if ./Cppsym pyr; then
15263                 case "`/bin/universe`" in
15264                 ucb) if $test `./findhdr sgtty.h`; then
15265                                 val2="$define"
15266                                 echo "<sgtty.h> found." >&4
15267                         else
15268                                 echo "System is pyramid with BSD universe."
15269                                 echo "<sgtty.h> not found--you could have problems." >&4
15270                         fi;;
15271                 *) if $test `./findhdr termio.h`; then
15272                                 val="$define"
15273                                 echo "<termio.h> found." >&4
15274                         else
15275                                 echo "System is pyramid with USG universe."
15276                                 echo "<termio.h> not found--you could have problems." >&4
15277                         fi;;
15278                 esac
15279         elif ./usg; then
15280                 if $test `./findhdr termio.h`; then
15281                         echo "<termio.h> found." >&4
15282                         val="$define"
15283                 elif $test `./findhdr sgtty.h`; then
15284                         echo "<sgtty.h> found." >&4
15285                         val2="$define"
15286                 else
15287 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15288                 fi
15289         else
15290                 if $test `./findhdr sgtty.h`; then
15291                         echo "<sgtty.h> found." >&4
15292                         val2="$define"
15293                 elif $test `./findhdr termio.h`; then
15294                         echo "<termio.h> found." >&4
15295                         val="$define"
15296                 else
15297 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15298                 fi
15299         fi;;
15300 esac
15301 set i_termio; eval $setvar
15302 val=$val2; set i_sgtty; eval $setvar
15303 val=$val3; set i_termios; eval $setvar
15304
15305 : see if this is a shadow.h system
15306 set shadow.h i_shadow
15307 eval $inhdr
15308
15309 : see if stddef is available
15310 set stddef.h i_stddef
15311 eval $inhdr
15312
15313 : see if this is a sunmath.h system
15314 set sunmath.h i_sunmath
15315 eval $inhdr
15316
15317 : see if sys/access.h is available
15318 set sys/access.h i_sysaccess
15319 eval $inhdr
15320
15321 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15322 set sys/filio.h i_sysfilio
15323 eval $inhdr
15324 echo " "
15325 if $test `./findhdr sys/ioctl.h`; then
15326         val="$define"
15327         echo '<sys/ioctl.h> found.' >&4
15328 else
15329         val="$undef"
15330         if $test $i_sysfilio = "$define"; then
15331             echo '<sys/ioctl.h> NOT found.' >&4
15332         else
15333                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15334                 $test $i_termio = "$define" && xxx="termio.h"
15335                 $test $i_termios = "$define" && xxx="termios.h"
15336 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15337         fi
15338 fi
15339 set i_sysioctl
15340 eval $setvar
15341
15342
15343 : see if this is a syslog.h system
15344 set syslog.h i_syslog
15345 eval $inhdr
15346
15347
15348 : see if this is a sys/mode.h system
15349 set sys/mode.h i_sysmode
15350 eval $inhdr
15351
15352 : see if sys/resource.h has to be included
15353 set sys/resource.h i_sysresrc
15354 eval $inhdr
15355
15356 : see if sys/security.h is available
15357 set sys/security.h i_syssecrt
15358 eval $inhdr
15359
15360 : see if this is a sys/statvfs.h system
15361 set sys/statvfs.h i_sysstatvfs
15362 eval $inhdr
15363
15364 : see if this is a sys/uio.h system
15365 set sys/uio.h i_sysuio
15366 eval $inhdr
15367
15368 : see if this is a sys/un.h system
15369 set sys/un.h i_sysun
15370 eval $inhdr
15371
15372
15373 : see if this is a sys/utsname.h system
15374 set sys/utsname.h i_sysutsname
15375 eval $inhdr
15376
15377 : see if this is a syswait system
15378 set sys/wait.h i_syswait
15379 eval $inhdr
15380
15381 : see if this is a ustat.h system
15382 set ustat.h i_ustat
15383 eval $inhdr
15384
15385 : see if this is an utime system
15386 set utime.h i_utime
15387 eval $inhdr
15388
15389 : see if this is a values.h system
15390 set values.h i_values
15391 eval $inhdr
15392
15393 : see if this is a vfork system
15394 case "$d_vfork" in
15395 "$define")
15396         set vfork.h i_vfork
15397         eval $inhdr
15398         ;;
15399 *)
15400         i_vfork="$undef"
15401         ;;
15402 esac
15403
15404 : see if gdbm.h is available
15405 set gdbm.h t_gdbm
15406 eval $inhdr
15407 case "$t_gdbm" in
15408 $define)
15409         : see if gdbm_open exists
15410         set gdbm_open d_gdbm_open
15411         eval $inlibc
15412         case "$d_gdbm_open" in
15413         $undef)
15414                 t_gdbm="$undef"
15415                 echo "We won't be including <gdbm.h>"
15416                 ;;
15417         esac
15418         ;;
15419 esac
15420 val="$t_gdbm"
15421 set i_gdbm
15422 eval $setvar
15423
15424 echo " "
15425 echo "Looking for extensions..." >&4
15426 : If we are using the old config.sh, known_extensions may contain
15427 : old or inaccurate or duplicate values.
15428 known_extensions=''
15429 nonxs_extensions=''
15430 : We do not use find because it might not be available.
15431 : We do not just use MANIFEST because the user may have dropped
15432 : some additional extensions into the source tree and expect them
15433 : to be built.
15434
15435 : Function to recursively find available extensions, ignoring DynaLoader
15436 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15437 find_extensions='
15438     for xxx in *; do
15439        case "$xxx" in
15440            DynaLoader|dynaload) ;;
15441            *)
15442            if $test -f $xxx/$xxx.xs; then
15443                known_extensions="$known_extensions $1$xxx";
15444            elif $test -f $xxx/Makefile.PL; then
15445                nonxs_extensions="$nonxs_extensions $1$xxx";
15446            else
15447                if $test -d $xxx -a $# -lt 10; then
15448                    set $1$xxx/ $*;
15449                    cd $xxx;
15450                    eval $find_extensions;
15451                    cd ..;
15452                    shift;
15453                fi;
15454            fi
15455            ;;
15456        esac;
15457     done'
15458 tdir=`pwd`
15459 cd $rsrc/ext
15460 set X
15461 shift
15462 eval $find_extensions
15463 set X $nonxs_extensions
15464 shift
15465 nonxs_extensions="$*"
15466 set X $known_extensions
15467 shift
15468 known_extensions="$*"
15469 cd $tdir
15470
15471 : Now see which are supported on this system.
15472 avail_ext=''
15473 for xxx in $known_extensions ; do
15474         case "$xxx" in
15475         DB_File|db_file)
15476                 case "$i_db" in
15477                 $define) avail_ext="$avail_ext $xxx" ;;
15478                 esac
15479                 ;;
15480         GDBM_File|gdbm_fil)
15481                 case "$i_gdbm" in 
15482                 $define) avail_ext="$avail_ext $xxx" ;;
15483                 esac
15484                 ;;
15485         NDBM_File|ndbm_fil)
15486                 case "$i_ndbm" in
15487                 $define)
15488                     case "$osname-$use64bitint" in
15489                     hpux-define)
15490                         case "$libs" in
15491                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15492                         esac
15493                         ;;
15494                     *) avail_ext="$avail_ext $xxx" ;;
15495                     esac
15496                     ;;
15497                 esac
15498                 ;;
15499         ODBM_File|odbm_fil) 
15500                 case "${i_dbm}${i_rpcsvcdbm}" in
15501                 *"${define}"*)
15502                     case "$osname-$use64bitint" in
15503                     hpux-define)
15504                         case "$libs" in
15505                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15506                         esac
15507                         ;;
15508                     *) avail_ext="$avail_ext $xxx" ;;
15509                     esac
15510                     ;;
15511                 esac
15512                 ;;
15513         POSIX|posix)
15514                 case "$useposix" in
15515                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15516                 esac
15517                 ;;
15518         Opcode|opcode)
15519                 case "$useopcode" in
15520                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15521                 esac
15522                 ;;
15523         Socket|socket)
15524                 case "$d_socket" in 
15525                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15526                 esac
15527                 ;;
15528         Sys/Syslog|sys/syslog)
15529                 : XXX syslog requires socket
15530                 case "$d_socket" in 
15531                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15532                 esac
15533                 ;;
15534         Thread|thread)
15535                 case "$usethreads" in 
15536                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15537                 esac
15538                 ;;
15539         IPC/SysV|ipc/sysv)
15540                 : XXX Do we need a useipcsysv variable here
15541                 case "${d_msg}${d_sem}${d_shm}" in 
15542                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15543                 esac
15544                 ;;
15545         *)      avail_ext="$avail_ext $xxx"
15546                 ;;
15547         esac
15548 done
15549
15550 set X $avail_ext
15551 shift
15552 avail_ext="$*"
15553
15554 : Now see which nonxs extensions are supported on this system.
15555 : For now assume all are.
15556 nonxs_ext=''
15557 for xxx in $nonxs_extensions ; do
15558         case "$xxx" in
15559         *)      nonxs_ext="$nonxs_ext $xxx"
15560                 ;;
15561         esac
15562 done
15563
15564 set X $nonxs_ext
15565 shift
15566 nonxs_ext="$*"
15567
15568 case $usedl in
15569 $define)
15570         $cat <<EOM
15571 A number of extensions are supplied with $package.  You may choose to
15572 compile these extensions for dynamic loading (the default), compile
15573 them into the $package executable (static loading), or not include
15574 them at all.  Answer "none" to include no extensions.
15575 Note that DynaLoader is always built and need not be mentioned here.
15576
15577 EOM
15578         case "$dynamic_ext" in
15579         '') dflt="$avail_ext" ;;
15580         *)      dflt="$dynamic_ext"
15581                 # Perhaps we are reusing an old out-of-date config.sh.
15582                 case "$hint" in
15583                 previous)
15584                         if test X"$dynamic_ext" != X"$avail_ext"; then
15585                                 $cat <<EOM
15586 NOTICE:  Your previous config.sh list may be incorrect. 
15587 The extensions now available to you are 
15588         ${avail_ext}
15589 but the default list from your previous config.sh is
15590         ${dynamic_ext} 
15591
15592 EOM
15593                         fi
15594                         ;;
15595                 esac
15596                 ;;
15597         esac
15598         case "$dflt" in
15599         '')     dflt=none;;
15600         esac
15601         rp="What extensions do you wish to load dynamically?"
15602         . ./myread
15603         case "$ans" in
15604         none) dynamic_ext=' ' ;;
15605         *) dynamic_ext="$ans" ;;
15606         esac
15607
15608         case "$static_ext" in
15609         '')
15610                 : Exclude those already listed in dynamic linking
15611                 dflt=''
15612                 for xxx in $avail_ext; do
15613                         case " $dynamic_ext " in
15614                         *" $xxx "*) ;;
15615                         *) dflt="$dflt $xxx" ;;
15616                         esac
15617                 done
15618                 set X $dflt
15619                 shift
15620                 dflt="$*"
15621                 ;;
15622         *)  dflt="$static_ext" 
15623                 ;;
15624         esac
15625
15626         case "$dflt" in
15627         '')     dflt=none;;
15628         esac
15629         rp="What extensions do you wish to load statically?"
15630         . ./myread
15631         case "$ans" in
15632         none) static_ext=' ' ;;
15633         *) static_ext="$ans" ;;
15634         esac
15635         ;;
15636 *)
15637         $cat <<EOM
15638 A number of extensions are supplied with $package.  Answer "none" 
15639 to include no extensions. 
15640 Note that DynaLoader is always built and need not be mentioned here.
15641
15642 EOM
15643         case "$static_ext" in
15644         '') dflt="$avail_ext" ;;
15645         *)      dflt="$static_ext"
15646                 # Perhaps we are reusing an old out-of-date config.sh.
15647                 case "$hint" in
15648                 previous)
15649                         if test X"$static_ext" != X"$avail_ext"; then
15650                                 $cat <<EOM
15651 NOTICE:  Your previous config.sh list may be incorrect. 
15652 The extensions now available to you are 
15653         ${avail_ext}
15654 but the default list from your previous config.sh is
15655         ${static_ext} 
15656
15657 EOM
15658                         fi
15659                         ;;
15660                 esac
15661                 ;;
15662         esac
15663         : Exclude those that are not xs extensions
15664         case "$dflt" in
15665         '')     dflt=none;;
15666         esac
15667         rp="What extensions do you wish to include?"
15668         . ./myread
15669         case "$ans" in
15670         none) static_ext=' ' ;;
15671         *) static_ext="$ans" ;;
15672         esac
15673         ;;
15674 esac
15675
15676 set X $dynamic_ext $static_ext $nonxs_ext
15677 shift
15678 extensions="$*"
15679
15680 : Remove libraries needed only for extensions
15681 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15682 : The exception is SunOS 4.x, which needs them.
15683 case "${osname}X${osvers}" in
15684 sunos*X4*)
15685     perllibs="$libs"
15686     ;;
15687 *) case "$usedl" in
15688     $define|true|[yY]*)
15689             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15690             shift
15691             perllibs="$*"
15692             ;;
15693     *)  perllibs="$libs"
15694             ;;
15695     esac
15696     ;;
15697 esac
15698
15699 : Remove build directory name from cppstdin so it can be used from
15700 : either the present location or the final installed location.
15701 echo " "
15702 : Get out of the UU directory to get correct path name.
15703 cd ..
15704 case "$cppstdin" in
15705 `pwd`/cppstdin)
15706         echo "Stripping down cppstdin path name"
15707         cppstdin=cppstdin
15708         ;;
15709 esac
15710 cd UU
15711
15712 : end of configuration questions
15713 echo " "
15714 echo "End of configuration questions."
15715 echo " "
15716
15717 : back to where it started
15718 if test -d ../UU; then
15719         cd ..
15720 fi
15721
15722 : configuration may be patched via a 'config.over' file
15723 if $test -f config.over; then
15724         echo " "
15725         dflt=y
15726         rp='I see a config.over file.  Do you wish to load it?'
15727         . UU/myread
15728         case "$ans" in
15729         n*) echo "OK, I'll ignore it.";;
15730         *)      . ./config.over
15731                 echo "Configuration override changes have been loaded."
15732                 ;;
15733         esac
15734 fi
15735
15736 : in case they want portability, strip down executable paths
15737 case "$d_portable" in
15738 "$define")
15739         echo " "
15740         echo "Stripping down executable paths..." >&4
15741         for file in $loclist $trylist; do
15742                 eval temp=\$$file
15743                 eval $file=`basename $temp`
15744         done
15745         ;;
15746 esac
15747
15748 : create config.sh file
15749 echo " "
15750 echo "Creating config.sh..." >&4
15751 $spitshell <<EOT >config.sh
15752 $startsh
15753 #
15754 # This file was produced by running the Configure script. It holds all the
15755 # definitions figured out by Configure. Should you modify one of these values,
15756 # do not forget to propagate your changes by running "Configure -der". You may
15757 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15758 #
15759
15760 # Package name      : $package
15761 # Source directory  : $src
15762 # Configuration time: $cf_time
15763 # Configured by     : $cf_by
15764 # Target system     : $myuname
15765
15766 Author='$Author'
15767 Date='$Date'
15768 Header='$Header'
15769 Id='$Id'
15770 Locker='$Locker'
15771 Log='$Log'
15772 Mcc='$Mcc'
15773 RCSfile='$RCSfile'
15774 Revision='$Revision'
15775 Source='$Source'
15776 State='$State'
15777 _a='$_a'
15778 _exe='$_exe'
15779 _o='$_o'
15780 afs='$afs'
15781 alignbytes='$alignbytes'
15782 ansi2knr='$ansi2knr'
15783 aphostname='$aphostname'
15784 api_revision='$api_revision'
15785 api_subversion='$api_subversion'
15786 api_version='$api_version'
15787 api_versionstring='$api_versionstring'
15788 ar='$ar'
15789 archlib='$archlib'
15790 archlibexp='$archlibexp'
15791 archname64='$archname64'
15792 archname='$archname'
15793 archobjs='$archobjs'
15794 awk='$awk'
15795 baserev='$baserev'
15796 bash='$bash'
15797 bin='$bin'
15798 bincompat5005='$bincompat5005'
15799 binexp='$binexp'
15800 bison='$bison'
15801 byacc='$byacc'
15802 byteorder='$byteorder'
15803 c='$c'
15804 castflags='$castflags'
15805 cat='$cat'
15806 cc='$cc'
15807 cccdlflags='$cccdlflags'
15808 ccdlflags='$ccdlflags'
15809 ccflags='$ccflags'
15810 ccflags_uselargefiles='$ccflags_uselargefiles'
15811 ccname='$ccname'
15812 ccsymbols='$ccsymbols'
15813 ccversion='$ccversion'
15814 cf_by='$cf_by'
15815 cf_email='$cf_email'
15816 cf_time='$cf_time'
15817 charsize='$charsize'
15818 chgrp='$chgrp'
15819 chmod='$chmod'
15820 chown='$chown'
15821 clocktype='$clocktype'
15822 comm='$comm'
15823 compress='$compress'
15824 contains='$contains'
15825 cp='$cp'
15826 cpio='$cpio'
15827 cpp='$cpp'
15828 cpp_stuff='$cpp_stuff'
15829 cppccsymbols='$cppccsymbols'
15830 cppflags='$cppflags'
15831 cpplast='$cpplast'
15832 cppminus='$cppminus'
15833 cpprun='$cpprun'
15834 cppstdin='$cppstdin'
15835 cppsymbols='$cppsymbols'
15836 crosscompile='$crosscompile'
15837 cryptlib='$cryptlib'
15838 csh='$csh'
15839 d_Gconvert='$d_Gconvert'
15840 d_PRIEUldbl='$d_PRIEUldbl'
15841 d_PRIFUldbl='$d_PRIFUldbl'
15842 d_PRIGUldbl='$d_PRIGUldbl'
15843 d_PRIXU64='$d_PRIXU64'
15844 d_PRId64='$d_PRId64'
15845 d_PRIeldbl='$d_PRIeldbl'
15846 d_PRIfldbl='$d_PRIfldbl'
15847 d_PRIgldbl='$d_PRIgldbl'
15848 d_PRIi64='$d_PRIi64'
15849 d_PRIo64='$d_PRIo64'
15850 d_PRIu64='$d_PRIu64'
15851 d_PRIx64='$d_PRIx64'
15852 d_SCNfldbl='$d_SCNfldbl'
15853 d__fwalk='$d__fwalk'
15854 d_access='$d_access'
15855 d_accessx='$d_accessx'
15856 d_alarm='$d_alarm'
15857 d_archlib='$d_archlib'
15858 d_atolf='$d_atolf'
15859 d_atoll='$d_atoll'
15860 d_attribut='$d_attribut'
15861 d_bcmp='$d_bcmp'
15862 d_bcopy='$d_bcopy'
15863 d_bincompat5005='$d_bincompat5005'
15864 d_bsd='$d_bsd'
15865 d_bsdgetpgrp='$d_bsdgetpgrp'
15866 d_bsdsetpgrp='$d_bsdsetpgrp'
15867 d_bzero='$d_bzero'
15868 d_casti32='$d_casti32'
15869 d_castneg='$d_castneg'
15870 d_charvspr='$d_charvspr'
15871 d_chown='$d_chown'
15872 d_chroot='$d_chroot'
15873 d_chsize='$d_chsize'
15874 d_closedir='$d_closedir'
15875 d_const='$d_const'
15876 d_crypt='$d_crypt'
15877 d_csh='$d_csh'
15878 d_cuserid='$d_cuserid'
15879 d_dbl_dig='$d_dbl_dig'
15880 d_difftime='$d_difftime'
15881 d_dirnamlen='$d_dirnamlen'
15882 d_dlerror='$d_dlerror'
15883 d_dlopen='$d_dlopen'
15884 d_dlsymun='$d_dlsymun'
15885 d_dosuid='$d_dosuid'
15886 d_drand48proto='$d_drand48proto'
15887 d_dup2='$d_dup2'
15888 d_eaccess='$d_eaccess'
15889 d_endgrent='$d_endgrent'
15890 d_endhent='$d_endhent'
15891 d_endnent='$d_endnent'
15892 d_endpent='$d_endpent'
15893 d_endpwent='$d_endpwent'
15894 d_endsent='$d_endsent'
15895 d_eofnblk='$d_eofnblk'
15896 d_eunice='$d_eunice'
15897 d_fchmod='$d_fchmod'
15898 d_fchown='$d_fchown'
15899 d_fcntl='$d_fcntl'
15900 d_fcntl_can_lock='$d_fcntl_can_lock'
15901 d_fd_macros='$d_fd_macros'
15902 d_fd_set='$d_fd_set'
15903 d_fds_bits='$d_fds_bits'
15904 d_fgetpos='$d_fgetpos'
15905 d_flexfnam='$d_flexfnam'
15906 d_flock='$d_flock'
15907 d_fork='$d_fork'
15908 d_fpathconf='$d_fpathconf'
15909 d_fpos64_t='$d_fpos64_t'
15910 d_frexpl='$d_frexpl'
15911 d_fs_data_s='$d_fs_data_s'
15912 d_fseeko='$d_fseeko'
15913 d_fsetpos='$d_fsetpos'
15914 d_fstatfs='$d_fstatfs'
15915 d_fstatvfs='$d_fstatvfs'
15916 d_fsync='$d_fsync'
15917 d_ftello='$d_ftello'
15918 d_ftime='$d_ftime'
15919 d_getcwd='$d_getcwd'
15920 d_getespwnam='$d_getespwnam'
15921 d_getfsstat='$d_getfsstat'
15922 d_getgrent='$d_getgrent'
15923 d_getgrps='$d_getgrps'
15924 d_gethbyaddr='$d_gethbyaddr'
15925 d_gethbyname='$d_gethbyname'
15926 d_gethent='$d_gethent'
15927 d_gethname='$d_gethname'
15928 d_gethostprotos='$d_gethostprotos'
15929 d_getlogin='$d_getlogin'
15930 d_getmnt='$d_getmnt'
15931 d_getmntent='$d_getmntent'
15932 d_getnbyaddr='$d_getnbyaddr'
15933 d_getnbyname='$d_getnbyname'
15934 d_getnent='$d_getnent'
15935 d_getnetprotos='$d_getnetprotos'
15936 d_getpagsz='$d_getpagsz'
15937 d_getpbyname='$d_getpbyname'
15938 d_getpbynumber='$d_getpbynumber'
15939 d_getpent='$d_getpent'
15940 d_getpgid='$d_getpgid'
15941 d_getpgrp2='$d_getpgrp2'
15942 d_getpgrp='$d_getpgrp'
15943 d_getppid='$d_getppid'
15944 d_getprior='$d_getprior'
15945 d_getprotoprotos='$d_getprotoprotos'
15946 d_getprpwnam='$d_getprpwnam'
15947 d_getpwent='$d_getpwent'
15948 d_getsbyname='$d_getsbyname'
15949 d_getsbyport='$d_getsbyport'
15950 d_getsent='$d_getsent'
15951 d_getservprotos='$d_getservprotos'
15952 d_getspnam='$d_getspnam'
15953 d_gettimeod='$d_gettimeod'
15954 d_gnulibc='$d_gnulibc'
15955 d_grpasswd='$d_grpasswd'
15956 d_hasmntopt='$d_hasmntopt'
15957 d_htonl='$d_htonl'
15958 d_iconv='$d_iconv'
15959 d_index='$d_index'
15960 d_inetaton='$d_inetaton'
15961 d_int64_t='$d_int64_t'
15962 d_isascii='$d_isascii'
15963 d_isnan='$d_isnan'
15964 d_isnanl='$d_isnanl'
15965 d_killpg='$d_killpg'
15966 d_lchown='$d_lchown'
15967 d_ldbl_dig='$d_ldbl_dig'
15968 d_link='$d_link'
15969 d_locconv='$d_locconv'
15970 d_lockf='$d_lockf'
15971 d_longdbl='$d_longdbl'
15972 d_longlong='$d_longlong'
15973 d_lseekproto='$d_lseekproto'
15974 d_lstat='$d_lstat'
15975 d_madvise='$d_madvise'
15976 d_mblen='$d_mblen'
15977 d_mbstowcs='$d_mbstowcs'
15978 d_mbtowc='$d_mbtowc'
15979 d_memchr='$d_memchr'
15980 d_memcmp='$d_memcmp'
15981 d_memcpy='$d_memcpy'
15982 d_memmove='$d_memmove'
15983 d_memset='$d_memset'
15984 d_mkdir='$d_mkdir'
15985 d_mkdtemp='$d_mkdtemp'
15986 d_mkfifo='$d_mkfifo'
15987 d_mkstemp='$d_mkstemp'
15988 d_mkstemps='$d_mkstemps'
15989 d_mktime='$d_mktime'
15990 d_mmap='$d_mmap'
15991 d_modfl='$d_modfl'
15992 d_mprotect='$d_mprotect'
15993 d_msg='$d_msg'
15994 d_msg_ctrunc='$d_msg_ctrunc'
15995 d_msg_dontroute='$d_msg_dontroute'
15996 d_msg_oob='$d_msg_oob'
15997 d_msg_peek='$d_msg_peek'
15998 d_msg_proxy='$d_msg_proxy'
15999 d_msgctl='$d_msgctl'
16000 d_msgget='$d_msgget'
16001 d_msgrcv='$d_msgrcv'
16002 d_msgsnd='$d_msgsnd'
16003 d_msync='$d_msync'
16004 d_munmap='$d_munmap'
16005 d_mymalloc='$d_mymalloc'
16006 d_nice='$d_nice'
16007 d_nv_preserves_uv='$d_nv_preserves_uv'
16008 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16009 d_off64_t='$d_off64_t'
16010 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16011 d_oldpthreads='$d_oldpthreads'
16012 d_oldsock='$d_oldsock'
16013 d_open3='$d_open3'
16014 d_pathconf='$d_pathconf'
16015 d_pause='$d_pause'
16016 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16017 d_phostname='$d_phostname'
16018 d_pipe='$d_pipe'
16019 d_poll='$d_poll'
16020 d_portable='$d_portable'
16021 d_pthread_yield='$d_pthread_yield'
16022 d_pwage='$d_pwage'
16023 d_pwchange='$d_pwchange'
16024 d_pwclass='$d_pwclass'
16025 d_pwcomment='$d_pwcomment'
16026 d_pwexpire='$d_pwexpire'
16027 d_pwgecos='$d_pwgecos'
16028 d_pwpasswd='$d_pwpasswd'
16029 d_pwquota='$d_pwquota'
16030 d_qgcvt='$d_qgcvt'
16031 d_quad='$d_quad'
16032 d_readdir='$d_readdir'
16033 d_readlink='$d_readlink'
16034 d_rename='$d_rename'
16035 d_rewinddir='$d_rewinddir'
16036 d_rmdir='$d_rmdir'
16037 d_safebcpy='$d_safebcpy'
16038 d_safemcpy='$d_safemcpy'
16039 d_sanemcmp='$d_sanemcmp'
16040 d_sbrkproto='$d_sbrkproto'
16041 d_sched_yield='$d_sched_yield'
16042 d_scm_rights='$d_scm_rights'
16043 d_seekdir='$d_seekdir'
16044 d_select='$d_select'
16045 d_sem='$d_sem'
16046 d_semctl='$d_semctl'
16047 d_semctl_semid_ds='$d_semctl_semid_ds'
16048 d_semctl_semun='$d_semctl_semun'
16049 d_semget='$d_semget'
16050 d_semop='$d_semop'
16051 d_setegid='$d_setegid'
16052 d_seteuid='$d_seteuid'
16053 d_setgrent='$d_setgrent'
16054 d_setgrps='$d_setgrps'
16055 d_sethent='$d_sethent'
16056 d_setlinebuf='$d_setlinebuf'
16057 d_setlocale='$d_setlocale'
16058 d_setnent='$d_setnent'
16059 d_setpent='$d_setpent'
16060 d_setpgid='$d_setpgid'
16061 d_setpgrp2='$d_setpgrp2'
16062 d_setpgrp='$d_setpgrp'
16063 d_setprior='$d_setprior'
16064 d_setproctitle='$d_setproctitle'
16065 d_setpwent='$d_setpwent'
16066 d_setregid='$d_setregid'
16067 d_setresgid='$d_setresgid'
16068 d_setresuid='$d_setresuid'
16069 d_setreuid='$d_setreuid'
16070 d_setrgid='$d_setrgid'
16071 d_setruid='$d_setruid'
16072 d_setsent='$d_setsent'
16073 d_setsid='$d_setsid'
16074 d_setvbuf='$d_setvbuf'
16075 d_sfio='$d_sfio'
16076 d_shm='$d_shm'
16077 d_shmat='$d_shmat'
16078 d_shmatprototype='$d_shmatprototype'
16079 d_shmctl='$d_shmctl'
16080 d_shmdt='$d_shmdt'
16081 d_shmget='$d_shmget'
16082 d_sigaction='$d_sigaction'
16083 d_sigsetjmp='$d_sigsetjmp'
16084 d_socket='$d_socket'
16085 d_socklen_t='$d_socklen_t'
16086 d_sockpair='$d_sockpair'
16087 d_socks5_init='$d_socks5_init'
16088 d_sqrtl='$d_sqrtl'
16089 d_statblks='$d_statblks'
16090 d_statfs_f_flags='$d_statfs_f_flags'
16091 d_statfs_s='$d_statfs_s'
16092 d_statvfs='$d_statvfs'
16093 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16094 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16095 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16096 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16097 d_stdio_stream_array='$d_stdio_stream_array'
16098 d_stdiobase='$d_stdiobase'
16099 d_stdstdio='$d_stdstdio'
16100 d_strchr='$d_strchr'
16101 d_strcoll='$d_strcoll'
16102 d_strctcpy='$d_strctcpy'
16103 d_strerrm='$d_strerrm'
16104 d_strerror='$d_strerror'
16105 d_strtod='$d_strtod'
16106 d_strtol='$d_strtol'
16107 d_strtold='$d_strtold'
16108 d_strtoll='$d_strtoll'
16109 d_strtoq='$d_strtoq'
16110 d_strtoul='$d_strtoul'
16111 d_strtoull='$d_strtoull'
16112 d_strtouq='$d_strtouq'
16113 d_strxfrm='$d_strxfrm'
16114 d_suidsafe='$d_suidsafe'
16115 d_symlink='$d_symlink'
16116 d_syscall='$d_syscall'
16117 d_sysconf='$d_sysconf'
16118 d_sysernlst='$d_sysernlst'
16119 d_syserrlst='$d_syserrlst'
16120 d_system='$d_system'
16121 d_tcgetpgrp='$d_tcgetpgrp'
16122 d_tcsetpgrp='$d_tcsetpgrp'
16123 d_telldir='$d_telldir'
16124 d_telldirproto='$d_telldirproto'
16125 d_time='$d_time'
16126 d_times='$d_times'
16127 d_truncate='$d_truncate'
16128 d_tzname='$d_tzname'
16129 d_umask='$d_umask'
16130 d_uname='$d_uname'
16131 d_union_semun='$d_union_semun'
16132 d_ustat='$d_ustat'
16133 d_vendorarch='$d_vendorarch'
16134 d_vendorbin='$d_vendorbin'
16135 d_vendorlib='$d_vendorlib'
16136 d_vfork='$d_vfork'
16137 d_void_closedir='$d_void_closedir'
16138 d_voidsig='$d_voidsig'
16139 d_voidtty='$d_voidtty'
16140 d_volatile='$d_volatile'
16141 d_vprintf='$d_vprintf'
16142 d_wait4='$d_wait4'
16143 d_waitpid='$d_waitpid'
16144 d_wcstombs='$d_wcstombs'
16145 d_wctomb='$d_wctomb'
16146 d_xenix='$d_xenix'
16147 date='$date'
16148 db_hashtype='$db_hashtype'
16149 db_prefixtype='$db_prefixtype'
16150 defvoidused='$defvoidused'
16151 direntrytype='$direntrytype'
16152 dlext='$dlext'
16153 dlsrc='$dlsrc'
16154 doublesize='$doublesize'
16155 drand01='$drand01'
16156 dynamic_ext='$dynamic_ext'
16157 eagain='$eagain'
16158 ebcdic='$ebcdic'
16159 echo='$echo'
16160 egrep='$egrep'
16161 emacs='$emacs'
16162 eunicefix='$eunicefix'
16163 exe_ext='$exe_ext'
16164 expr='$expr'
16165 extensions='$extensions'
16166 fflushNULL='$fflushNULL'
16167 fflushall='$fflushall'
16168 find='$find'
16169 firstmakefile='$firstmakefile'
16170 flex='$flex'
16171 fpossize='$fpossize'
16172 fpostype='$fpostype'
16173 freetype='$freetype'
16174 full_ar='$full_ar'
16175 full_csh='$full_csh'
16176 full_sed='$full_sed'
16177 gccosandvers='$gccosandvers'
16178 gccversion='$gccversion'
16179 gidformat='$gidformat'
16180 gidsign='$gidsign'
16181 gidsize='$gidsize'
16182 gidtype='$gidtype'
16183 glibpth='$glibpth'
16184 grep='$grep'
16185 groupcat='$groupcat'
16186 groupstype='$groupstype'
16187 gzip='$gzip'
16188 h_fcntl='$h_fcntl'
16189 h_sysfile='$h_sysfile'
16190 hint='$hint'
16191 hostcat='$hostcat'
16192 i16size='$i16size'
16193 i16type='$i16type'
16194 i32size='$i32size'
16195 i32type='$i32type'
16196 i64size='$i64size'
16197 i64type='$i64type'
16198 i8size='$i8size'
16199 i8type='$i8type'
16200 i_arpainet='$i_arpainet'
16201 i_bsdioctl='$i_bsdioctl'
16202 i_db='$i_db'
16203 i_dbm='$i_dbm'
16204 i_dirent='$i_dirent'
16205 i_dld='$i_dld'
16206 i_dlfcn='$i_dlfcn'
16207 i_fcntl='$i_fcntl'
16208 i_float='$i_float'
16209 i_gdbm='$i_gdbm'
16210 i_grp='$i_grp'
16211 i_iconv='$i_iconv'
16212 i_ieeefp='$i_ieeefp'
16213 i_inttypes='$i_inttypes'
16214 i_libutil='$i_libutil'
16215 i_limits='$i_limits'
16216 i_locale='$i_locale'
16217 i_machcthr='$i_machcthr'
16218 i_malloc='$i_malloc'
16219 i_math='$i_math'
16220 i_memory='$i_memory'
16221 i_mntent='$i_mntent'
16222 i_ndbm='$i_ndbm'
16223 i_netdb='$i_netdb'
16224 i_neterrno='$i_neterrno'
16225 i_netinettcp='$i_netinettcp'
16226 i_niin='$i_niin'
16227 i_poll='$i_poll'
16228 i_prot='$i_prot'
16229 i_pthread='$i_pthread'
16230 i_pwd='$i_pwd'
16231 i_rpcsvcdbm='$i_rpcsvcdbm'
16232 i_sfio='$i_sfio'
16233 i_sgtty='$i_sgtty'
16234 i_shadow='$i_shadow'
16235 i_socks='$i_socks'
16236 i_stdarg='$i_stdarg'
16237 i_stddef='$i_stddef'
16238 i_stdlib='$i_stdlib'
16239 i_string='$i_string'
16240 i_sunmath='$i_sunmath'
16241 i_sysaccess='$i_sysaccess'
16242 i_sysdir='$i_sysdir'
16243 i_sysfile='$i_sysfile'
16244 i_sysfilio='$i_sysfilio'
16245 i_sysin='$i_sysin'
16246 i_sysioctl='$i_sysioctl'
16247 i_syslog='$i_syslog'
16248 i_sysmman='$i_sysmman'
16249 i_sysmode='$i_sysmode'
16250 i_sysmount='$i_sysmount'
16251 i_sysndir='$i_sysndir'
16252 i_sysparam='$i_sysparam'
16253 i_sysresrc='$i_sysresrc'
16254 i_syssecrt='$i_syssecrt'
16255 i_sysselct='$i_sysselct'
16256 i_syssockio='$i_syssockio'
16257 i_sysstat='$i_sysstat'
16258 i_sysstatfs='$i_sysstatfs'
16259 i_sysstatvfs='$i_sysstatvfs'
16260 i_systime='$i_systime'
16261 i_systimek='$i_systimek'
16262 i_systimes='$i_systimes'
16263 i_systypes='$i_systypes'
16264 i_sysuio='$i_sysuio'
16265 i_sysun='$i_sysun'
16266 i_sysutsname='$i_sysutsname'
16267 i_sysvfs='$i_sysvfs'
16268 i_syswait='$i_syswait'
16269 i_termio='$i_termio'
16270 i_termios='$i_termios'
16271 i_time='$i_time'
16272 i_unistd='$i_unistd'
16273 i_ustat='$i_ustat'
16274 i_utime='$i_utime'
16275 i_values='$i_values'
16276 i_varargs='$i_varargs'
16277 i_varhdr='$i_varhdr'
16278 i_vfork='$i_vfork'
16279 ignore_versioned_solibs='$ignore_versioned_solibs'
16280 inc_version_list='$inc_version_list'
16281 inc_version_list_init='$inc_version_list_init'
16282 incpath='$incpath'
16283 inews='$inews'
16284 installarchlib='$installarchlib'
16285 installbin='$installbin'
16286 installman1dir='$installman1dir'
16287 installman3dir='$installman3dir'
16288 installprefix='$installprefix'
16289 installprefixexp='$installprefixexp'
16290 installprivlib='$installprivlib'
16291 installscript='$installscript'
16292 installsitearch='$installsitearch'
16293 installsitebin='$installsitebin'
16294 installsitelib='$installsitelib'
16295 installstyle='$installstyle'
16296 installusrbinperl='$installusrbinperl'
16297 installvendorarch='$installvendorarch'
16298 installvendorbin='$installvendorbin'
16299 installvendorlib='$installvendorlib'
16300 intsize='$intsize'
16301 issymlink='$issymlink'
16302 ivdformat='$ivdformat'
16303 ivsize='$ivsize'
16304 ivtype='$ivtype'
16305 known_extensions='$known_extensions'
16306 ksh='$ksh'
16307 ld='$ld'
16308 lddlflags='$lddlflags'
16309 ldflags='$ldflags'
16310 ldflags_uselargefiles='$ldflags_uselargefiles'
16311 ldlibpthname='$ldlibpthname'
16312 less='$less'
16313 lib_ext='$lib_ext'
16314 libc='$libc'
16315 libperl='$libperl'
16316 libpth='$libpth'
16317 libs='$libs'
16318 libsdirs='$libsdirs'
16319 libsfiles='$libsfiles'
16320 libsfound='$libsfound'
16321 libspath='$libspath'
16322 libswanted='$libswanted'
16323 libswanted_uselargefiles='$libswanted_uselargefiles'
16324 line='$line'
16325 lint='$lint'
16326 lkflags='$lkflags'
16327 ln='$ln'
16328 lns='$lns'
16329 locincpth='$locincpth'
16330 loclibpth='$loclibpth'
16331 longdblsize='$longdblsize'
16332 longlongsize='$longlongsize'
16333 longsize='$longsize'
16334 lp='$lp'
16335 lpr='$lpr'
16336 ls='$ls'
16337 lseeksize='$lseeksize'
16338 lseektype='$lseektype'
16339 mail='$mail'
16340 mailx='$mailx'
16341 make='$make'
16342 make_set_make='$make_set_make'
16343 mallocobj='$mallocobj'
16344 mallocsrc='$mallocsrc'
16345 malloctype='$malloctype'
16346 man1dir='$man1dir'
16347 man1direxp='$man1direxp'
16348 man1ext='$man1ext'
16349 man3dir='$man3dir'
16350 man3direxp='$man3direxp'
16351 man3ext='$man3ext'
16352 mips_type='$mips_type'
16353 mkdir='$mkdir'
16354 mmaptype='$mmaptype'
16355 modetype='$modetype'
16356 more='$more'
16357 multiarch='$multiarch'
16358 mv='$mv'
16359 myarchname='$myarchname'
16360 mydomain='$mydomain'
16361 myhostname='$myhostname'
16362 myuname='$myuname'
16363 n='$n'
16364 need_va_copy='$need_va_copy'
16365 netdb_hlen_type='$netdb_hlen_type'
16366 netdb_host_type='$netdb_host_type'
16367 netdb_name_type='$netdb_name_type'
16368 netdb_net_type='$netdb_net_type'
16369 nm='$nm'
16370 nm_opt='$nm_opt'
16371 nm_so_opt='$nm_so_opt'
16372 nonxs_ext='$nonxs_ext'
16373 nroff='$nroff'
16374 nvEUformat='$nvEUformat'
16375 nvFUformat='$nvFUformat'
16376 nvGUformat='$nvGUformat'
16377 nveformat='$nveformat'
16378 nvfformat='$nvfformat'
16379 nvgformat='$nvgformat'
16380 nvsize='$nvsize'
16381 nvtype='$nvtype'
16382 o_nonblock='$o_nonblock'
16383 obj_ext='$obj_ext'
16384 old_pthread_create_joinable='$old_pthread_create_joinable'
16385 optimize='$optimize'
16386 orderlib='$orderlib'
16387 osname='$osname'
16388 osvers='$osvers'
16389 otherlibdirs='$otherlibdirs'
16390 package='$package'
16391 pager='$pager'
16392 passcat='$passcat'
16393 patchlevel='$patchlevel'
16394 path_sep='$path_sep'
16395 perl5='$perl5'
16396 perl='$perl'
16397 perladmin='$perladmin'
16398 perllibs='$perllibs'
16399 perlpath='$perlpath'
16400 pg='$pg'
16401 phostname='$phostname'
16402 pidtype='$pidtype'
16403 plibpth='$plibpth'
16404 pm_apiversion='$pm_apiversion'
16405 pmake='$pmake'
16406 pr='$pr'
16407 prefix='$prefix'
16408 prefixexp='$prefixexp'
16409 privlib='$privlib'
16410 privlibexp='$privlibexp'
16411 prototype='$prototype'
16412 ptrsize='$ptrsize'
16413 quadkind='$quadkind'
16414 quadtype='$quadtype'
16415 randbits='$randbits'
16416 randfunc='$randfunc'
16417 randseedtype='$randseedtype'
16418 ranlib='$ranlib'
16419 rd_nodata='$rd_nodata'
16420 revision='$revision'
16421 rm='$rm'
16422 rmail='$rmail'
16423 runnm='$runnm'
16424 sPRIEUldbl='$sPRIEUldbl'
16425 sPRIFUldbl='$sPRIFUldbl'
16426 sPRIGUldbl='$sPRIGUldbl'
16427 sPRIXU64='$sPRIXU64'
16428 sPRId64='$sPRId64'
16429 sPRIeldbl='$sPRIeldbl'
16430 sPRIfldbl='$sPRIfldbl'
16431 sPRIgldbl='$sPRIgldbl'
16432 sPRIi64='$sPRIi64'
16433 sPRIo64='$sPRIo64'
16434 sPRIu64='$sPRIu64'
16435 sPRIx64='$sPRIx64'
16436 sSCNfldbl='$sSCNfldbl'
16437 sched_yield='$sched_yield'
16438 scriptdir='$scriptdir'
16439 scriptdirexp='$scriptdirexp'
16440 sed='$sed'
16441 seedfunc='$seedfunc'
16442 selectminbits='$selectminbits'
16443 selecttype='$selecttype'
16444 sendmail='$sendmail'
16445 sh='$sh'
16446 shar='$shar'
16447 sharpbang='$sharpbang'
16448 shmattype='$shmattype'
16449 shortsize='$shortsize'
16450 shrpenv='$shrpenv'
16451 shsharp='$shsharp'
16452 sig_count='$sig_count'
16453 sig_name='$sig_name'
16454 sig_name_init='$sig_name_init'
16455 sig_num='$sig_num'
16456 sig_num_init='$sig_num_init'
16457 signal_t='$signal_t'
16458 sitearch='$sitearch'
16459 sitearchexp='$sitearchexp'
16460 sitebin='$sitebin'
16461 sitebinexp='$sitebinexp'
16462 sitelib='$sitelib'
16463 sitelib_stem='$sitelib_stem'
16464 sitelibexp='$sitelibexp'
16465 siteprefix='$siteprefix'
16466 siteprefixexp='$siteprefixexp'
16467 sizesize='$sizesize'
16468 sizetype='$sizetype'
16469 sleep='$sleep'
16470 smail='$smail'
16471 so='$so'
16472 sockethdr='$sockethdr'
16473 socketlib='$socketlib'
16474 socksizetype='$socksizetype'
16475 sort='$sort'
16476 spackage='$spackage'
16477 spitshell='$spitshell'
16478 src='$src'
16479 ssizetype='$ssizetype'
16480 startperl='$startperl'
16481 startsh='$startsh'
16482 static_ext='$static_ext'
16483 stdchar='$stdchar'
16484 stdio_base='$stdio_base'
16485 stdio_bufsiz='$stdio_bufsiz'
16486 stdio_cnt='$stdio_cnt'
16487 stdio_filbuf='$stdio_filbuf'
16488 stdio_ptr='$stdio_ptr'
16489 stdio_stream_array='$stdio_stream_array'
16490 strings='$strings'
16491 submit='$submit'
16492 subversion='$subversion'
16493 sysman='$sysman'
16494 tail='$tail'
16495 tar='$tar'
16496 tbl='$tbl'
16497 tee='$tee'
16498 test='$test'
16499 timeincl='$timeincl'
16500 timetype='$timetype'
16501 touch='$touch'
16502 tr='$tr'
16503 trnl='$trnl'
16504 troff='$troff'
16505 u16size='$u16size'
16506 u16type='$u16type'
16507 u32size='$u32size'
16508 u32type='$u32type'
16509 u64size='$u64size'
16510 u64type='$u64type'
16511 u8size='$u8size'
16512 u8type='$u8type'
16513 uidformat='$uidformat'
16514 uidsign='$uidsign'
16515 uidsize='$uidsize'
16516 uidtype='$uidtype'
16517 uname='$uname'
16518 uniq='$uniq'
16519 uquadtype='$uquadtype'
16520 use5005threads='$use5005threads'
16521 use64bitall='$use64bitall'
16522 use64bitint='$use64bitint'
16523 usedl='$usedl'
16524 useithreads='$useithreads'
16525 uselargefiles='$uselargefiles'
16526 uselongdouble='$uselongdouble'
16527 usemorebits='$usemorebits'
16528 usemultiplicity='$usemultiplicity'
16529 usemymalloc='$usemymalloc'
16530 usenm='$usenm'
16531 useopcode='$useopcode'
16532 useperlio='$useperlio'
16533 useposix='$useposix'
16534 usesfio='$usesfio'
16535 useshrplib='$useshrplib'
16536 usesocks='$usesocks'
16537 usethreads='$usethreads'
16538 usevendorprefix='$usevendorprefix'
16539 usevfork='$usevfork'
16540 usrinc='$usrinc'
16541 uuname='$uuname'
16542 uvXUformat='$uvXUformat'
16543 uvoformat='$uvoformat'
16544 uvsize='$uvsize'
16545 uvtype='$uvtype'
16546 uvuformat='$uvuformat'
16547 uvxformat='$uvxformat'
16548 vendorarch='$vendorarch'
16549 vendorarchexp='$vendorarchexp'
16550 vendorbin='$vendorbin'
16551 vendorbinexp='$vendorbinexp'
16552 vendorlib='$vendorlib'
16553 vendorlib_stem='$vendorlib_stem'
16554 vendorlibexp='$vendorlibexp'
16555 vendorprefix='$vendorprefix'
16556 vendorprefixexp='$vendorprefixexp'
16557 version='$version'
16558 versiononly='$versiononly'
16559 vi='$vi'
16560 voidflags='$voidflags'
16561 xlibpth='$xlibpth'
16562 xs_apiversion='$xs_apiversion'
16563 zcat='$zcat'
16564 zip='$zip'
16565 EOT
16566
16567 : Add in command line options if available
16568 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16569
16570 : add special variables
16571 $test -f $src/patchlevel.h && \
16572 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16573 echo "CONFIGDOTSH=true" >>config.sh
16574
16575 : propagate old symbols
16576 if $test -f UU/config.sh; then
16577         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16578         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16579         $sort | $uniq -u >UU/oldsyms
16580         set X `cat UU/oldsyms`
16581         shift
16582         case $# in
16583         0) ;;
16584         *)
16585                 cat <<EOM
16586 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16587 EOM
16588                 echo "# Variables propagated from previous config.sh file." >>config.sh
16589                 for sym in `cat UU/oldsyms`; do
16590                         echo "    Propagating $hint variable "'$'"$sym..."
16591                         eval 'tmp="$'"${sym}"'"'
16592                         echo "$tmp" | \
16593                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16594                 done
16595                 ;;
16596         esac
16597 fi
16598
16599 : Finish up by extracting the .SH files
16600 case "$alldone" in
16601 exit)
16602         $rm -rf UU
16603         echo "Done."
16604         exit 0
16605         ;;
16606 cont)
16607         ;;
16608 '')
16609         dflt=''
16610         nostick=true
16611         $cat <<EOM
16612
16613 If you'd like to make any changes to the config.sh file before I begin
16614 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16615
16616 EOM
16617         rp="Press return or use a shell escape to edit config.sh:"
16618         . UU/myread
16619         nostick=''
16620         case "$ans" in
16621         '') ;;
16622         *) : in case they cannot read
16623                 sh 1>&4 -c "$ans";;
16624         esac
16625         ;;
16626 esac
16627
16628 : if this fails, just run all the .SH files by hand
16629 . ./config.sh
16630
16631 echo " "
16632 exec 1>&4
16633 . ./UU/extract
16634
16635 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16636         dflt=y
16637         case "$silent" in
16638         true) ;;
16639         *)
16640                 $cat <<EOM
16641
16642 Now you need to generate make dependencies by running "$make depend".
16643 You might prefer to run it in background: "$make depend > makedepend.out &"
16644 It can take a while, so you might not want to run it right now.
16645
16646 EOM
16647                 ;;
16648         esac
16649         rp="Run $make depend now?"
16650         . UU/myread
16651         case "$ans" in
16652         y*)
16653                 $make depend && echo "Now you must run '$make'."
16654                 ;;
16655         *)
16656                 echo "You must run '$make depend' then '$make'."
16657                 ;;
16658         esac
16659 elif test -f [Mm]akefile; then
16660         echo " "
16661         echo "Now you must run a $make."
16662 else
16663         echo "Done."
16664 fi
16665
16666 if $test -f Policy.sh; then
16667     $cat <<EOM
16668
16669 If you compile $package on a different machine or from a different object
16670 directory, copy the Policy.sh file from this object directory to the
16671 new one before you run Configure -- this will help you with most of
16672 the policy defaults.
16673
16674 EOM
16675 fi
16676 if $test -f config.msg; then
16677     echo "Hmm.  I also noted the following information while running:"
16678     echo " "
16679     $cat config.msg >&4
16680     $rm -f config.msg
16681 fi
16682 $rm -f kit*isdone ark*isdone
16683 $rm -rf UU
16684
16685 : End of Configure
16686