Re: [ID 20020213.015] Pod::Html XHTML update for 5.7.2
[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 Feb 15 01:22:14 EET 2002 [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                 case "X${MACHTYPE:-nonesuchmach}" in
69                 *cygwin) ;;
70                 *) p_=\; ;;
71                 esac
72         fi
73 fi
74
75 : Proper PATH setting
76 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83 paths="$paths /sbin /usr/sbin /usr/libexec"
84 paths="$paths /system/gnu_library/bin"
85
86 for p in $paths
87 do
88         case "$p_$PATH$p_" in
89         *$p_$p$p_*) ;;
90         *) test -d $p && PATH=$PATH$p_$p ;;
91         esac
92 done
93
94 PATH=.$p_$PATH
95 export PATH
96
97 : shall we be using ksh?
98 inksh=''
99 needksh=''
100 avoidksh=''
101 newsh=/bin/ksh
102 changesh=''
103 if (PATH=.; alias -x) >/dev/null 2>&1; then
104                 inksh=true
105 fi
106 if test -f /hp-ux -a -f /bin/ksh; then
107         needksh='to avoid sh bug in "here document" expansion'
108 fi
109 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110         if test X`/usr/bin/uname -v` = X4; then
111                 avoidksh="to avoid AIX 4's /bin/sh"
112                 newsh=/usr/bin/bsh
113         fi
114 fi
115 if test -f /osf_boot -a -f /usr/sbin/setld; then
116         if test X`/usr/bin/uname -s` = XOSF1; then
117                 avoidksh="to avoid Digital UNIX' ksh"
118                 newsh=/bin/sh
119                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
120         fi
121 fi
122 case "$inksh/$needksh" in
123 /[a-z]*)
124                 ENV=''
125                 changesh=true
126                 reason="$needksh"
127         ;;
128 esac
129 case "$inksh/$avoidksh" in
130 true/[a-z]*)
131         changesh=true
132         reason="$avoidksh"
133         ;;
134 esac
135 case "$inksh/$needksh-$avoidksh-" in
136 true/--)
137                 cat <<EOM
138 (I see you are using the Korn shell.  Some ksh's blow up on $me,
139 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
140 EOM
141         ;;
142 esac
143 case "$changesh" in
144 true)
145         export newsh
146         echo "(Feeding myself to $newsh $reason.)"
147         case "$0" in
148         Configure|*/Configure) exec $newsh $0 "$@";;
149         *) exec $newsh Configure "$@";;
150         esac
151         ;;
152 esac
153
154 : if needed set CDPATH to a harmless value that is not chatty
155 : avoid bash 2.02 problems with empty CDPATH.
156 case "$CDPATH" in
157 '')     ;;
158 *)      case "$SHELL" in
159         *bash*) CDPATH='.' ;;
160         *)              CDPATH='' ;;
161         esac
162         ;;
163 esac
164 : Configure runs within the UU subdirectory
165 test -d UU || mkdir UU
166 cd UU && rm -f ./*
167
168
169 ccname=''
170 ccversion=''
171 ccsymbols=''
172 cppccsymbols=''
173 cppsymbols=''
174 from=''
175 run=''
176 targetarch=''
177 to=''
178 usecrosscompile=''
179 perllibs=''
180 dynamic_ext=''
181 extensions=''
182 known_extensions=''
183 nonxs_ext=''
184 static_ext=''
185 useopcode=''
186 useposix=''
187 extras=''
188 d_bsd=''
189 d_eunice=''
190 d_xenix=''
191 eunicefix=''
192 Mcc=''
193 ar=''
194 awk=''
195 bash=''
196 bison=''
197 byacc=''
198 cat=''
199 chgrp=''
200 chmod=''
201 chown=''
202 comm=''
203 compress=''
204 cp=''
205 cpio=''
206 cpp=''
207 csh=''
208 date=''
209 echo=''
210 egrep=''
211 emacs=''
212 expr=''
213 find=''
214 flex=''
215 gmake=''
216 grep=''
217 gzip=''
218 inews=''
219 ksh=''
220 less=''
221 line=''
222 lint=''
223 ln=''
224 lp=''
225 lpr=''
226 ls=''
227 mail=''
228 mailx=''
229 make=''
230 mkdir=''
231 more=''
232 mv=''
233 nm=''
234 nroff=''
235 perl=''
236 pg=''
237 pmake=''
238 pr=''
239 rm=''
240 rmail=''
241 sed=''
242 sendmail=''
243 shar=''
244 sleep=''
245 smail=''
246 sort=''
247 submit=''
248 tail=''
249 tar=''
250 tbl=''
251 tee=''
252 test=''
253 touch=''
254 tr=''
255 troff=''
256 uname=''
257 uniq=''
258 uuname=''
259 vi=''
260 zcat=''
261 zip=''
262 full_ar=''
263 full_sed=''
264 libswanted=''
265 hint=''
266 myuname=''
267 osname=''
268 osvers=''
269 Author=''
270 Date=''
271 Header=''
272 Id=''
273 Locker=''
274 Log=''
275 RCSfile=''
276 Revision=''
277 Source=''
278 State=''
279 _a=''
280 _exe=''
281 _o=''
282 archobjs=''
283 exe_ext=''
284 firstmakefile=''
285 lib_ext=''
286 obj_ext=''
287 path_sep=''
288 afs=''
289 afsroot=''
290 alignbytes=''
291 ansi2knr=''
292 archlib=''
293 archlibexp=''
294 d_archlib=''
295 installarchlib=''
296 archname=''
297 myarchname=''
298 d_atolf=''
299 d_atoll=''
300 baserev=''
301 bin=''
302 binexp=''
303 installbin=''
304 bincompat5005=''
305 d_bincompat5005=''
306 byteorder=''
307 cc=''
308 ccflags=''
309 cppflags=''
310 ldflags=''
311 lkflags=''
312 locincpth=''
313 optimize=''
314 cf_email=''
315 cf_by=''
316 cf_time=''
317 charsize=''
318 contains=''
319 cpp_stuff=''
320 cpplast=''
321 cppminus=''
322 cpprun=''
323 cppstdin=''
324 d__fwalk=''
325 d_access=''
326 d_accessx=''
327 d_alarm=''
328 d_attribut=''
329 d_bcmp=''
330 d_bcopy=''
331 d_bzero=''
332 d_casti32=''
333 castflags=''
334 d_castneg=''
335 d_chown=''
336 d_chroot=''
337 d_chsize=''
338 d_class=''
339 d_closedir=''
340 d_void_closedir=''
341 d_cmsghdr_s=''
342 d_const=''
343 cryptlib=''
344 d_crypt=''
345 d_csh=''
346 full_csh=''
347 d_cuserid=''
348 d_dbl_dig=''
349 d_dbminitproto=''
350 d_difftime=''
351 d_dirfd=''
352 d_dlerror=''
353 d_dlopen=''
354 d_dlsymun=''
355 d_dosuid=''
356 d_suidsafe=''
357 d_drand48proto=''
358 d_dup2=''
359 d_eaccess=''
360 d_endgrent=''
361 d_endhent=''
362 d_endnent=''
363 d_endpent=''
364 d_endpwent=''
365 d_endsent=''
366 d_fchdir=''
367 d_fchmod=''
368 d_fchown=''
369 d_fcntl=''
370 d_fcntl_can_lock=''
371 d_fd_macros=''
372 d_fd_set=''
373 d_fds_bits=''
374 d_fgetpos=''
375 d_finite=''
376 d_finitel=''
377 d_flexfnam=''
378 d_flock=''
379 d_flockproto=''
380 d_fork=''
381 d_fp_class=''
382 d_fpclass=''
383 d_fpclassify=''
384 d_fpclassl=''
385 d_fpos64_t=''
386 d_frexpl=''
387 d_fs_data_s=''
388 d_fseeko=''
389 d_fsetpos=''
390 d_fstatfs=''
391 d_fsync=''
392 d_ftello=''
393 d_ftime=''
394 d_gettimeod=''
395 d_Gconvert=''
396 d_getcwd=''
397 d_getespwnam=''
398 d_getfsstat=''
399 d_getgrent=''
400 d_getgrps=''
401 d_gethbyaddr=''
402 d_gethbyname=''
403 d_gethent=''
404 aphostname=''
405 d_gethname=''
406 d_phostname=''
407 d_uname=''
408 d_gethostprotos=''
409 d_getitimer=''
410 d_getlogin=''
411 d_getmnt=''
412 d_getmntent=''
413 d_getnbyaddr=''
414 d_getnbyname=''
415 d_getnent=''
416 d_getnetprotos=''
417 d_getpagsz=''
418 d_getpent=''
419 d_getpgid=''
420 d_getpgrp2=''
421 d_bsdgetpgrp=''
422 d_getpgrp=''
423 d_getppid=''
424 d_getprior=''
425 d_getpbyname=''
426 d_getpbynumber=''
427 d_getprotoprotos=''
428 d_getprpwnam=''
429 d_getpwent=''
430 d_getsent=''
431 d_getservprotos=''
432 d_getspnam=''
433 d_getsbyname=''
434 d_getsbyport=''
435 d_gnulibc=''
436 d_hasmntopt=''
437 d_htonl=''
438 d_inetaton=''
439 d_int64_t=''
440 d_isascii=''
441 d_isfinite=''
442 d_isinf=''
443 d_isnan=''
444 d_isnanl=''
445 d_killpg=''
446 d_lchown=''
447 d_ldbl_dig=''
448 d_link=''
449 d_locconv=''
450 d_lockf=''
451 d_longdbl=''
452 longdblsize=''
453 d_longlong=''
454 longlongsize=''
455 d_lseekproto=''
456 d_lstat=''
457 d_madvise=''
458 d_mblen=''
459 d_mbstowcs=''
460 d_mbtowc=''
461 d_memchr=''
462 d_memcmp=''
463 d_memcpy=''
464 d_memmove=''
465 d_memset=''
466 d_mkdir=''
467 d_mkdtemp=''
468 d_mkfifo=''
469 d_mkstemp=''
470 d_mkstemps=''
471 d_mktime=''
472 d_mmap=''
473 mmaptype=''
474 d_modfl=''
475 d_modfl_pow32_bug=''
476 d_mprotect=''
477 d_msg=''
478 d_msgctl=''
479 d_msgget=''
480 d_msghdr_s=''
481 d_msgrcv=''
482 d_msgsnd=''
483 d_msync=''
484 d_munmap=''
485 d_nice=''
486 d_nl_langinfo=''
487 d_off64_t=''
488 d_open3=''
489 d_fpathconf=''
490 d_pathconf=''
491 d_pause=''
492 d_pipe=''
493 d_poll=''
494 d_portable=''
495 d_procselfexe=''
496 procselfexe=''
497 d_old_pthread_create_joinable=''
498 old_pthread_create_joinable=''
499 d_pthread_atfork=''
500 d_pthread_yield=''
501 d_sched_yield=''
502 sched_yield=''
503 d_qgcvt=''
504 d_readdir=''
505 d_rewinddir=''
506 d_seekdir=''
507 d_telldir=''
508 d_readlink=''
509 d_readv=''
510 d_recvmsg=''
511 d_rename=''
512 d_rmdir=''
513 d_safebcpy=''
514 d_safemcpy=''
515 d_sanemcmp=''
516 d_sbrkproto=''
517 d_select=''
518 d_sem=''
519 d_semctl=''
520 d_semget=''
521 d_semop=''
522 d_sendmsg=''
523 d_setegid=''
524 d_seteuid=''
525 d_setgrent=''
526 d_setgrps=''
527 d_sethent=''
528 d_setitimer=''
529 d_setlinebuf=''
530 d_setlocale=''
531 d_setnent=''
532 d_setpent=''
533 d_setpgid=''
534 d_setpgrp2=''
535 d_bsdsetpgrp=''
536 d_setpgrp=''
537 d_setprior=''
538 d_setproctitle=''
539 d_setpwent=''
540 d_setregid=''
541 d_setresgid=''
542 d_setresuid=''
543 d_setreuid=''
544 d_setrgid=''
545 d_setruid=''
546 d_setsent=''
547 d_setsid=''
548 d_setvbuf=''
549 d_sfio=''
550 usesfio=''
551 d_shm=''
552 d_shmat=''
553 d_shmatprototype=''
554 shmattype=''
555 d_shmctl=''
556 d_shmdt=''
557 d_shmget=''
558 d_sigaction=''
559 d_sigprocmask=''
560 d_sigsetjmp=''
561 d_sockatmark=''
562 d_sockatmarkproto=''
563 d_msg_ctrunc=''
564 d_msg_dontroute=''
565 d_msg_oob=''
566 d_msg_peek=''
567 d_msg_proxy=''
568 d_oldsock=''
569 d_scm_rights=''
570 d_socket=''
571 d_sockpair=''
572 sockethdr=''
573 socketlib=''
574 d_socklen_t=''
575 d_socks5_init=''
576 d_sqrtl=''
577 d_sresgproto=''
578 d_sresuproto=''
579 d_statblks=''
580 d_statfs_f_flags=''
581 d_statfs_s=''
582 d_fstatvfs=''
583 d_statvfs=''
584 d_stdio_cnt_lval=''
585 d_stdio_ptr_lval=''
586 d_stdio_ptr_lval_nochange_cnt=''
587 d_stdio_ptr_lval_sets_cnt=''
588 d_stdiobase=''
589 d_stdstdio=''
590 stdio_base=''
591 stdio_bufsiz=''
592 stdio_cnt=''
593 stdio_filbuf=''
594 stdio_ptr=''
595 d_index=''
596 d_strchr=''
597 d_strcoll=''
598 d_strctcpy=''
599 d_strerrm=''
600 d_strerror=''
601 d_sysernlst=''
602 d_syserrlst=''
603 d_strftime=''
604 d_strtod=''
605 d_strtol=''
606 d_strtold=''
607 d_strtoll=''
608 d_strtoq=''
609 d_strtoul=''
610 d_strtoull=''
611 d_strtouq=''
612 d_strxfrm=''
613 d_symlink=''
614 d_syscall=''
615 d_syscallproto=''
616 d_sysconf=''
617 d_system=''
618 d_tcgetpgrp=''
619 d_tcsetpgrp=''
620 d_telldirproto=''
621 d_time=''
622 timetype=''
623 clocktype=''
624 d_times=''
625 d_truncate=''
626 d_tzname=''
627 d_u32align=''
628 d_ualarm=''
629 d_umask=''
630 d_semctl_semid_ds=''
631 d_semctl_semun=''
632 d_union_semun=''
633 d_unordered=''
634 d_usleep=''
635 d_usleepproto=''
636 d_ustat=''
637 d_vfork=''
638 usevfork=''
639 d_voidsig=''
640 signal_t=''
641 d_volatile=''
642 d_charvspr=''
643 d_vprintf=''
644 d_wait4=''
645 d_waitpid=''
646 d_wcstombs=''
647 d_wctomb=''
648 d_writev=''
649 dlext=''
650 cccdlflags=''
651 ccdlflags=''
652 dlsrc=''
653 ld=''
654 lddlflags=''
655 usedl=''
656 doublesize=''
657 ebcdic=''
658 fflushNULL=''
659 fflushall=''
660 fpossize=''
661 fpostype=''
662 gccosandvers=''
663 gccversion=''
664 gidformat=''
665 gidsign=''
666 gidsize=''
667 gidtype=''
668 groupstype=''
669 h_fcntl=''
670 h_sysfile=''
671 i_arpainet=''
672 db_hashtype=''
673 db_prefixtype=''
674 db_version_major=''
675 db_version_minor=''
676 db_version_patch=''
677 i_db=''
678 i_dbm=''
679 i_rpcsvcdbm=''
680 d_dirnamlen=''
681 direntrytype=''
682 i_dirent=''
683 i_dld=''
684 i_dlfcn=''
685 i_fcntl=''
686 i_float=''
687 i_fp=''
688 i_fp_class=''
689 i_gdbm=''
690 d_grpasswd=''
691 i_grp=''
692 i_ieeefp=''
693 i_inttypes=''
694 i_langinfo=''
695 i_libutil=''
696 i_limits=''
697 i_locale=''
698 i_machcthr=''
699 i_malloc=''
700 i_math=''
701 i_memory=''
702 i_mntent=''
703 i_ndbm=''
704 i_netdb=''
705 i_neterrno=''
706 i_netinettcp=''
707 i_niin=''
708 i_sysin=''
709 i_poll=''
710 i_prot=''
711 i_pthread=''
712 d_pwage=''
713 d_pwchange=''
714 d_pwclass=''
715 d_pwcomment=''
716 d_pwexpire=''
717 d_pwgecos=''
718 d_pwpasswd=''
719 d_pwquota=''
720 i_pwd=''
721 i_sfio=''
722 i_shadow=''
723 i_socks=''
724 i_stddef=''
725 i_stdlib=''
726 i_string=''
727 strings=''
728 i_sunmath=''
729 i_sysaccess=''
730 i_sysdir=''
731 i_sysfile=''
732 d_voidtty=''
733 i_bsdioctl=''
734 i_sysfilio=''
735 i_sysioctl=''
736 i_syssockio=''
737 i_syslog=''
738 i_sysmman=''
739 i_sysmode=''
740 i_sysmount=''
741 i_sysndir=''
742 i_sysparam=''
743 i_sysresrc=''
744 i_syssecrt=''
745 i_sysselct=''
746 i_sysstat=''
747 i_sysstatfs=''
748 i_sysstatvfs=''
749 i_systimes=''
750 i_systypes=''
751 i_sysuio=''
752 i_sysun=''
753 i_sysutsname=''
754 i_sysvfs=''
755 i_syswait=''
756 i_sgtty=''
757 i_termio=''
758 i_termios=''
759 i_systime=''
760 i_systimek=''
761 i_time=''
762 timeincl=''
763 i_unistd=''
764 i_ustat=''
765 i_utime=''
766 i_values=''
767 i_stdarg=''
768 i_varargs=''
769 i_varhdr=''
770 i_vfork=''
771 inc_version_list=''
772 inc_version_list_init=''
773 installprefix=''
774 installprefixexp=''
775 installstyle=''
776 installusrbinperl=''
777 intsize=''
778 longsize=''
779 shortsize=''
780 issymlink=''
781 libc=''
782 ldlibpthname=''
783 libperl=''
784 shrpenv=''
785 useshrplib=''
786 glibpth=''
787 libpth=''
788 loclibpth=''
789 plibpth=''
790 xlibpth=''
791 ignore_versioned_solibs=''
792 libs=''
793 libsdirs=''
794 libsfiles=''
795 libsfound=''
796 libspath=''
797 lns=''
798 d_PRIEUldbl=''
799 d_PRIFUldbl=''
800 d_PRIGUldbl=''
801 d_PRIeldbl=''
802 d_PRIfldbl=''
803 d_PRIgldbl=''
804 d_SCNfldbl=''
805 sPRIEUldbl=''
806 sPRIFUldbl=''
807 sPRIGUldbl=''
808 sPRIeldbl=''
809 sPRIfldbl=''
810 sPRIgldbl=''
811 sSCNfldbl=''
812 lseeksize=''
813 lseektype=''
814 make_set_make=''
815 d_mymalloc=''
816 freetype=''
817 mallocobj=''
818 mallocsrc=''
819 malloctype=''
820 usemymalloc=''
821 installman1dir=''
822 man1dir=''
823 man1direxp=''
824 man1ext=''
825 installman3dir=''
826 man3dir=''
827 man3direxp=''
828 man3ext=''
829 modetype=''
830 multiarch=''
831 mydomain=''
832 myhostname=''
833 phostname=''
834 c=''
835 n=''
836 d_eofnblk=''
837 eagain=''
838 o_nonblock=''
839 rd_nodata=''
840 need_va_copy=''
841 netdb_hlen_type=''
842 netdb_host_type=''
843 netdb_name_type=''
844 netdb_net_type=''
845 groupcat=''
846 hostcat=''
847 passcat=''
848 orderlib=''
849 ranlib=''
850 d_perl_otherlibdirs=''
851 otherlibdirs=''
852 package=''
853 spackage=''
854 pager=''
855 api_revision=''
856 api_subversion=''
857 api_version=''
858 api_versionstring=''
859 patchlevel=''
860 perl_patchlevel=''
861 revision=''
862 subversion=''
863 version=''
864 version_patchlevel_string=''
865 perl5=''
866 perladmin=''
867 perlpath=''
868 d_nv_preserves_uv=''
869 d_nv_preserves_uv_bits=''
870 i16size=''
871 i16type=''
872 i32size=''
873 i32type=''
874 i64size=''
875 i64type=''
876 i8size=''
877 i8type=''
878 ivsize=''
879 ivtype=''
880 nvsize=''
881 nvtype=''
882 u16size=''
883 u16type=''
884 u32size=''
885 u32type=''
886 u64size=''
887 u64type=''
888 u8size=''
889 u8type=''
890 uvsize=''
891 uvtype=''
892 ivdformat=''
893 nvEUformat=''
894 nvFUformat=''
895 nvGUformat=''
896 nveformat=''
897 nvfformat=''
898 nvgformat=''
899 uvXUformat=''
900 uvoformat=''
901 uvuformat=''
902 uvxformat=''
903 pidtype=''
904 prefix=''
905 prefixexp=''
906 installprivlib=''
907 privlib=''
908 privlibexp=''
909 prototype=''
910 ptrsize=''
911 d_PRIXU64=''
912 d_PRId64=''
913 d_PRIi64=''
914 d_PRIo64=''
915 d_PRIu64=''
916 d_PRIx64=''
917 sPRIXU64=''
918 sPRId64=''
919 sPRIi64=''
920 sPRIo64=''
921 sPRIu64=''
922 sPRIx64=''
923 d_quad=''
924 quadkind=''
925 quadtype=''
926 uquadtype=''
927 drand01=''
928 randbits=''
929 randfunc=''
930 randseedtype=''
931 seedfunc=''
932 installscript=''
933 scriptdir=''
934 scriptdirexp=''
935 selectminbits=''
936 selecttype=''
937 sh=''
938 sig_count=''
939 sig_name=''
940 sig_name_init=''
941 sig_num=''
942 sig_num_init=''
943 sig_size=''
944 installsitearch=''
945 sitearch=''
946 sitearchexp=''
947 installsitebin=''
948 sitebin=''
949 sitebinexp=''
950 installsitelib=''
951 sitelib=''
952 sitelib_stem=''
953 sitelibexp=''
954 siteprefix=''
955 siteprefixexp=''
956 sizesize=''
957 sizetype=''
958 so=''
959 socksizetype=''
960 sharpbang=''
961 shsharp=''
962 spitshell=''
963 src=''
964 ssizetype=''
965 startperl=''
966 startsh=''
967 stdchar=''
968 d_stdio_stream_array=''
969 stdio_stream_array=''
970 sysman=''
971 trnl=''
972 uidformat=''
973 uidsign=''
974 uidsize=''
975 uidtype=''
976 archname64=''
977 use64bitall=''
978 use64bitint=''
979 ccflags_uselargefiles=''
980 ldflags_uselargefiles=''
981 libswanted_uselargefiles=''
982 uselargefiles=''
983 uselongdouble=''
984 usemorebits=''
985 usemultiplicity=''
986 nm_opt=''
987 nm_so_opt=''
988 runnm=''
989 usenm=''
990 useperlio=''
991 usesocks=''
992 d_oldpthreads=''
993 use5005threads=''
994 useithreads=''
995 usereentrant=''
996 usethreads=''
997 incpath=''
998 mips_type=''
999 usrinc=''
1000 d_vendorarch=''
1001 installvendorarch=''
1002 vendorarch=''
1003 vendorarchexp=''
1004 d_vendorbin=''
1005 installvendorbin=''
1006 vendorbin=''
1007 vendorbinexp=''
1008 d_vendorlib=''
1009 installvendorlib=''
1010 vendorlib=''
1011 vendorlib_stem=''
1012 vendorlibexp=''
1013 usevendorprefix=''
1014 vendorprefix=''
1015 vendorprefixexp=''
1016 versiononly=''
1017 defvoidused=''
1018 voidflags=''
1019 pm_apiversion=''
1020 xs_apiversion=''
1021 yacc=''
1022 yaccflags=''
1023 CONFIG=''
1024
1025 define='define'
1026 undef='undef'
1027 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1028 rmlist=''
1029
1030 : We must find out about Eunice early
1031 eunicefix=':'
1032 if test -f /etc/unixtovms; then
1033         eunicefix=/etc/unixtovms
1034 fi
1035 if test -f /etc/unixtovms.exe; then
1036         eunicefix=/etc/unixtovms.exe
1037 fi
1038
1039 : Set executable suffix now -- needed before hints available
1040 : maybe Stratus VOS
1041 if test -f "/system/gnu_library/bin/ar.pm"; then
1042     _exe=".pm"
1043 fi
1044 : maybe dos djgpp
1045 if test -n "$DJGPP"; then
1046     _exe=".exe"
1047 fi
1048 : maybe os/2
1049 if test -d c:/. ; then
1050     _exe=".exe"
1051 fi
1052
1053 i_whoami=''
1054 ccname=''
1055 ccversion=''
1056 perllibs=''
1057 : set useposix=false in your hint file to disable the POSIX extension.
1058 useposix=true
1059 : set useopcode=false in your hint file to disable the Opcode extension.
1060 useopcode=true
1061 : Trailing extension.  Override this in a hint file, if needed.
1062 : Extra object files, if any, needed on this platform.
1063 archobjs=''
1064 archname=''
1065 : Possible local include directories to search.
1066 : Set locincpth to "" in a hint file to defeat local include searches.
1067 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1068 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1069 :
1070 : no include file wanted by default
1071 inclwanted=''
1072
1073 groupstype=''
1074 libnames=''
1075 : change the next line if compiling for Xenix/286 on Xenix/386
1076 xlibpth='/usr/lib/386 /lib/386'
1077 : Possible local library directories to search.
1078 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1079 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1080
1081 : general looking path for locating libraries
1082 glibpth="/lib /usr/lib $xlibpth"
1083 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1084 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1085 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1086
1087 : Private path used by Configure to find libraries.  Its value
1088 : is prepended to libpth. This variable takes care of special
1089 : machines, like the mips.  Usually, it should be empty.
1090 plibpth=''
1091
1092 : default library list
1093 libswanted=''
1094 : some systems want to use only the non-versioned libso:s
1095 ignore_versioned_solibs=''
1096 archname64=''
1097 ccflags_uselargefiles=''
1098 ldflags_uselargefiles=''
1099 libswanted_uselargefiles=''
1100 : set usemultiplicity on the Configure command line to enable multiplicity.
1101 : set usesocks on the Configure command line to enable socks.
1102 : set usethreads on the Configure command line to enable threads.
1103 usereentrant='undef'
1104 : full support for void wanted by default
1105 defvoidused=15
1106
1107 : List of libraries we want.
1108 : If anyone needs -lnet, put it in a hint file.
1109 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1110 libswanted="$libswanted dld ld sun m c cposix posix"
1111 libswanted="$libswanted ndir dir crypt sec"
1112 libswanted="$libswanted ucb bsd BSD PW x util"
1113 : We probably want to search /usr/shlib before most other libraries.
1114 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1115 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1116 glibpth="/usr/shlib $glibpth"
1117 : Do not use vfork unless overridden by a hint file.
1118 usevfork=false
1119
1120 : Find the basic shell for Bourne shell scripts
1121 case "$sh" in
1122 '')
1123         case "$SYSTYPE" in
1124         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1125         *) xxx='/bin/sh';;
1126         esac
1127         if test -f "$xxx"; then
1128                 sh="$xxx"
1129         else
1130                 : Build up a list and do a single loop so we can 'break' out.
1131                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1132                 for xxx in sh bash ksh pdksh ash; do
1133                         for p in $pth; do
1134                                 try="$try ${p}/${xxx}"
1135                         done
1136                 done
1137                 for xxx in $try; do
1138                         if test -f "$xxx"; then
1139                                 sh="$xxx";
1140                                 break
1141                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1142                                 sh="$xxx";
1143                                 break
1144                         elif test -f "$xxx.exe"; then
1145                                 sh="$xxx";
1146                                 break
1147                         fi
1148                 done
1149         fi
1150         ;;
1151 esac
1152
1153 case "$sh" in
1154 '')     cat >&2 <<EOM
1155 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1156
1157 Usually it's in /bin/sh.  How did you even get this far?
1158 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1159 we'll try to straighten this all out.
1160 EOM
1161         exit 1
1162         ;;
1163 esac
1164
1165 : see if sh knows # comments
1166 if `$sh -c '#' >/dev/null 2>&1`; then
1167         shsharp=true
1168         spitshell=cat
1169         xcat=/bin/cat
1170         test -f $xcat$_exe || xcat=/usr/bin/cat
1171         if test ! -f $xcat$_exe; then
1172                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1173                         if test -f $p/cat$_exe; then
1174                                 xcat=$p/cat
1175                                 break
1176                         fi
1177                 done
1178                 if test ! -f $xcat$_exe; then
1179                         echo "Can't find cat anywhere!"
1180                         exit 1
1181                 fi
1182         fi
1183         echo "#!$xcat" >sharp
1184         $eunicefix sharp
1185         chmod +x sharp
1186         ./sharp > today
1187         if test -s today; then
1188                 sharpbang='#!'
1189         else
1190                 echo "#! $xcat" > sharp
1191                 $eunicefix sharp
1192                 chmod +x sharp
1193                 ./sharp > today
1194                 if test -s today; then
1195                         sharpbang='#! '
1196                 else
1197                         sharpbang=': use '
1198                 fi
1199         fi
1200 else
1201         echo " "
1202         echo "Your $sh doesn't grok # comments--I will strip them later on."
1203         shsharp=false
1204         cd ..
1205         echo "exec grep -v '^[  ]*#'" >spitshell
1206         chmod +x spitshell
1207         $eunicefix spitshell
1208         spitshell=`pwd`/spitshell
1209         cd UU
1210         echo "I presume that if # doesn't work, #! won't work either!"
1211         sharpbang=': use '
1212 fi
1213 rm -f sharp today
1214
1215 : figure out how to guarantee sh startup
1216 case "$startsh" in
1217 '') startsh=${sharpbang}${sh} ;;
1218 *)
1219 esac
1220 cat >sharp <<EOSS
1221 $startsh
1222 set abc
1223 test "$?abc" != 1
1224 EOSS
1225
1226 chmod +x sharp
1227 $eunicefix sharp
1228 if ./sharp; then
1229         : echo "Yup, it does."
1230 else
1231         echo "Hmm... '$startsh' does not guarantee sh startup..."
1232         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1233 fi
1234 rm -f sharp
1235
1236
1237 : Save command line options in file UU/cmdline.opt for later use in
1238 : generating config.sh.
1239 cat > cmdline.opt <<EOSH
1240 # Configure command line arguments.
1241 config_arg0='$0'
1242 config_args='$*'
1243 config_argc=$#
1244 EOSH
1245 argn=1
1246 args_exp=''
1247 args_sep=''
1248 for arg in "$@"; do
1249         cat >>cmdline.opt <<EOSH
1250 config_arg$argn='$arg'
1251 EOSH
1252         # Extreme backslashitis: replace each ' by '"'"'
1253         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1254 $arg
1255 EOC
1256         arg_exp=`cat cmdl.opt`
1257         args_exp="$args_exp$args_sep'$arg_exp'"
1258         argn=`expr $argn + 1`
1259         args_sep=' '
1260 done
1261 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1262 # used by ./hints/os2.sh
1263 rm -f cmdl.opt
1264
1265 : produce awk script to parse command line options
1266 cat >options.awk <<'EOF'
1267 BEGIN {
1268         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1269
1270         len = length(optstr);
1271         for (i = 1; i <= len; i++) {
1272                 c = substr(optstr, i, 1);
1273                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1274                 if (a == ":") {
1275                         arg[c] = 1;
1276                         i++;
1277                 }
1278                 opt[c] = 1;
1279         }
1280 }
1281 {
1282         expect = 0;
1283         str = $0;
1284         if (substr(str, 1, 1) != "-") {
1285                 printf("'%s'\n", str);
1286                 next;
1287         }
1288         len = length($0);
1289         for (i = 2; i <= len; i++) {
1290                 c = substr(str, i, 1);
1291                 if (!opt[c]) {
1292                         printf("-%s\n", substr(str, i));
1293                         next;
1294                 }
1295                 printf("-%s\n", c);
1296                 if (arg[c]) {
1297                         if (i < len)
1298                                 printf("'%s'\n", substr(str, i + 1));
1299                         else
1300                                 expect = 1;
1301                         next;
1302                 }
1303         }
1304 }
1305 END {
1306         if (expect)
1307                 print "?";
1308 }
1309 EOF
1310
1311 : process the command line options
1312 set X `for arg in "$@"; do echo "X$arg"; done |
1313         sed -e s/X// | awk -f options.awk`
1314 eval "set $*"
1315 shift
1316 rm -f options.awk
1317
1318 : set up default values
1319 fastread=''
1320 reuseval=false
1321 config_sh=''
1322 alldone=''
1323 error=''
1324 silent=''
1325 extractsh=''
1326 override=''
1327 knowitall=''
1328 rm -f optdef.sh posthint.sh
1329 cat >optdef.sh <<EOS
1330 $startsh
1331 EOS
1332
1333
1334 : option parsing
1335 while test $# -gt 0; do
1336         case "$1" in
1337         -d) shift; fastread=yes;;
1338         -e) shift; alldone=cont;;
1339         -f)
1340                 shift
1341                 cd ..
1342                 if test -r "$1"; then
1343                         config_sh="$1"
1344                 else
1345                         echo "$me: cannot read config file $1." >&2
1346                         error=true
1347                 fi
1348                 cd UU
1349                 shift;;
1350         -h) shift; error=true;;
1351         -r) shift; reuseval=true;;
1352         -s) shift; silent=true; realsilent=true;;
1353         -E) shift; alldone=exit;;
1354         -K) shift; knowitall=true;;
1355         -O) shift; override=true;;
1356         -S) shift; silent=true; extractsh=true;;
1357         -D)
1358                 shift
1359                 case "$1" in
1360                 *=)
1361                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1362                         echo "$me: ignoring -D $1" >&2
1363                         ;;
1364                 *=*) echo "$1" | \
1365                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1366                 *) echo "$1='define'" >> optdef.sh;;
1367                 esac
1368                 shift
1369                 ;;
1370         -U)
1371                 shift
1372                 case "$1" in
1373                 *=) echo "$1" >> optdef.sh;;
1374                 *=*)
1375                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1376                         echo "$me: ignoring -U $1" >&2
1377                         ;;
1378                 *) echo "$1='undef'" >> optdef.sh;;
1379                 esac
1380                 shift
1381                 ;;
1382         -A)
1383             shift
1384             xxx=''
1385             yyy="$1"
1386             zzz=''
1387             uuu=undef
1388             case "$yyy" in
1389             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1390                  case "$zzz" in
1391                  *:*) zzz='' ;;
1392                  *)   xxx=append
1393                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1394                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1395                  esac
1396                  ;;
1397             esac
1398             case "$xxx" in
1399             '')  case "$yyy" in
1400                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1401                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1402                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1403                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1404                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1405                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1406                  esac
1407                  ;;       
1408             esac
1409             case "$xxx" in
1410             append)
1411                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1412             clear)
1413                 echo "$yyy=''"                  >> posthint.sh ;;
1414             define)
1415                 case "$zzz" in
1416                 '') zzz=define ;;
1417                 esac
1418                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1419             eval)
1420                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1421             prepend)
1422                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1423             undef)
1424                 case "$zzz" in
1425                 '') zzz="$uuu" ;;
1426                 esac
1427                 echo "$yyy=$zzz"                >> posthint.sh ;;
1428             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1429             esac
1430             shift
1431             ;;
1432         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1433             exit 0;;
1434         --) break;;
1435         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1436         *) break;;
1437         esac
1438 done
1439
1440 case "$error" in
1441 true)
1442         cat >&2 <<EOM
1443 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1444                  [-U symbol] [-U symbol=] [-A command:symbol...]
1445   -d : use defaults for all answers.
1446   -e : go on without questioning past the production of config.sh.
1447   -f : specify an alternate default configuration file.
1448   -h : print this help message and exit (with an error status).
1449   -r : reuse C symbols value if possible (skips costly nm extraction).
1450   -s : silent mode, only echoes questions and essential information.
1451   -D : define symbol to have some value:
1452          -D symbol         symbol gets the value 'define'
1453          -D symbol=value   symbol gets the value 'value'
1454   -E : stop at the end of questions, after having produced config.sh.
1455   -K : do not use unless you know what you are doing.
1456   -O : let -D and -U override definitions from loaded configuration file.
1457   -S : perform variable substitutions on all .SH files (can mix with -f)
1458   -U : undefine symbol:
1459          -U symbol    symbol gets the value 'undef'
1460          -U symbol=   symbol gets completely empty
1461   -A : manipulate symbol after the platform specific hints have been applied:
1462          -A symbol=value                append " "value to symbol
1463          -A append:symbol=value         append value to symbol
1464          -A define:symbol=value         define symbol to have value
1465          -A clear:symbol                define symbol to be ''
1466          -A define:symbol               define symbol to be 'define'
1467          -A eval:symbol=value           define symbol to be eval of value
1468          -A prepend:symbol=value        prepend value to symbol
1469          -A undef:symbol                define symbol to be 'undef'
1470          -A undef:symbol=               define symbol to be ''
1471   -V : print version number and exit (with a zero status).
1472 EOM
1473         exit 1
1474         ;;
1475 esac
1476
1477 : Sanity checks
1478 case "$fastread$alldone" in
1479 yescont|yesexit) ;;
1480 *)
1481         case "$extractsh" in
1482         true) ;;
1483         *)
1484                 if test ! -t 0; then
1485                         echo "Say 'sh Configure', not 'sh <Configure'"
1486                         exit 1
1487                 fi
1488                 ;;
1489         esac
1490         ;;
1491 esac
1492
1493 exec 4>&1
1494 case "$silent" in
1495 true) exec 1>/dev/null;;
1496 esac
1497
1498 : run the defines and the undefines, if any, but leave the file out there...
1499 touch optdef.sh
1500 . ./optdef.sh
1501 : create the posthint manipulation script and leave the file out there...
1502 touch posthint.sh
1503
1504 : set package name
1505 package=perl5
1506 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1507 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1508 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1509 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1510 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1511 esac
1512
1513 : Some greps do not return status, grrr.
1514 echo "grimblepritz" >grimble
1515 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1516         contains=contains
1517 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1518         contains=grep
1519 else
1520         contains=contains
1521 fi
1522 rm -f grimble
1523 : the following should work in any shell
1524 case "$contains" in
1525 contains*)
1526         echo " "
1527         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1528         cat >contains <<'EOSS'
1529 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1530 EOSS
1531 chmod +x contains
1532 esac
1533
1534 : Find the path to the source tree
1535 case "$src" in
1536 '') case "$0" in
1537     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1538          case "$src" in
1539          /*)    ;;
1540          .)     ;;
1541          *)     src=`cd ../$src && pwd` ;;
1542          esac
1543          ;;
1544     *)   src='.';;
1545     esac;;
1546 esac
1547 case "$src" in
1548 '')     src=/
1549         rsrc=/
1550         ;;
1551 /*) rsrc="$src";;
1552 *) rsrc="../$src";;
1553 esac
1554 if test -f $rsrc/Configure && \
1555         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1556 then
1557    : found it, so we are ok.
1558 else
1559         rsrc=''
1560         for src in . .. ../.. ../../.. ../../../..; do
1561                 if test -f ../$src/Configure && \
1562                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1563                 then
1564                         rsrc=../$src
1565                         break
1566                 fi
1567         done
1568 fi
1569 case "$rsrc" in
1570 '')
1571         cat <<EOM >&4
1572
1573 Sorry, I can't seem to locate the source dir for $package.  Please start
1574 Configure with an explicit path -- i.e. /some/path/Configure.
1575
1576 EOM
1577         exit 1
1578         ;;
1579 ../.)   rsrc='..';;
1580 *)
1581         echo " "
1582         echo "Sources for $package found in \"$src\"." >&4
1583         ;;
1584 esac
1585
1586 : script used to extract .SH files with variable substitutions
1587 cat >extract <<'EOS'
1588 PERL_CONFIG_SH=true
1589 echo "Doing variable substitutions on .SH files..."
1590 if test -f MANIFEST; then
1591         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1592 else
1593         echo "(Looking for .SH files under the source directory.)"
1594         set x `(cd "$src"; find . -name "*.SH" -print)`
1595 fi
1596 shift
1597 case $# in
1598 0) set x `(cd "$src"; echo *.SH)`; shift;;
1599 esac
1600 if test ! -f "$src/$1"; then
1601         shift
1602 fi
1603 mkdir_p='
1604 name=$1;
1605 create="";
1606 while test $name; do
1607         if test ! -d "$name"; then
1608                 create="$name $create";
1609                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1610                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1611         else
1612                 name="";
1613         fi;
1614 done;
1615 for file in $create; do
1616         mkdir $file;
1617 done
1618 '
1619 for file in $*; do
1620         case "$src" in
1621         ".")
1622                 case "$file" in
1623                 */*)
1624                         dir=`expr X$file : 'X\(.*\)/'`
1625                         file=`expr X$file : 'X.*/\(.*\)'`
1626                         (cd "$dir" && . ./$file)
1627                         ;;
1628                 *)
1629                         . ./$file
1630                         ;;
1631                 esac
1632                 ;;
1633         *)
1634                 case "$file" in
1635                 */*)
1636                         dir=`expr X$file : 'X\(.*\)/'`
1637                         file=`expr X$file : 'X.*/\(.*\)'`
1638                         (set x $dir; shift; eval $mkdir_p)
1639                         sh <"$src/$dir/$file"
1640                         ;;
1641                 *)
1642                         sh <"$src/$file"
1643                         ;;
1644                 esac
1645                 ;;
1646         esac
1647 done
1648 if test -f "$src/config_h.SH"; then
1649         if test ! -f config.h; then
1650         : oops, they left it out of MANIFEST, probably, so do it anyway.
1651         . "$src/config_h.SH"
1652         fi
1653 fi
1654 EOS
1655
1656 : extract files and exit if asked to do so
1657 case "$extractsh" in
1658 true)
1659         case "$realsilent" in
1660         true) ;;
1661         *) exec 1>&4;;
1662         esac
1663         case "$config_sh" in
1664         '') config_sh='config.sh';;
1665         esac
1666         echo " "
1667         echo "Fetching answers from $config_sh..."
1668         cd ..
1669         . $config_sh
1670         test "$override" && . ./optdef.sh
1671         echo " "
1672         . UU/extract
1673         rm -rf UU
1674         echo "Extraction done."
1675         exit 0
1676         ;;
1677 esac
1678
1679 : Eunice requires " " instead of "", can you believe it
1680 echo " "
1681 : Here we go...
1682 echo "Beginning of configuration questions for $package."
1683
1684 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1685
1686 : first determine how to suppress newline on echo command
1687 echo " "
1688 echo "Checking echo to see how to suppress newlines..."
1689 (echo "hi there\c" ; echo " ") >.echotmp
1690 if $contains c .echotmp >/dev/null 2>&1 ; then
1691         echo "...using -n."
1692         n='-n'
1693         c=''
1694 else
1695         cat <<'EOM'
1696 ...using \c
1697 EOM
1698         n=''
1699         c='\c'
1700 fi
1701 echo $n "The star should be here-->$c"
1702 echo '*'
1703 rm -f .echotmp
1704
1705 : Now test for existence of everything in MANIFEST
1706 echo " "
1707 if test -f "$rsrc/MANIFEST"; then
1708         echo "First let's make sure your kit is complete.  Checking..." >&4
1709         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | split -50
1710         rm -f missing
1711         tmppwd=`pwd`
1712         for filelist in x??; do
1713                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1714         done
1715         if test -s missing; then
1716                 cat missing >&4
1717                 cat >&4 <<'EOM'
1718
1719 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1720
1721 You have the option of continuing the configuration process, despite the
1722 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1723 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1724 and contact the author (perlbug@perl.org).
1725
1726 EOM
1727                 echo $n "Continue? [n] $c" >&4
1728                 read ans
1729                 case "$ans" in
1730                 y*)
1731                         echo "Continuing..." >&4
1732                         rm -f missing
1733                         ;;
1734                 *)
1735                         echo "ABORTING..." >&4
1736                         kill $$
1737                         ;;
1738                 esac
1739         else
1740                 echo "Looks good..."
1741         fi
1742 else
1743         echo "There is no MANIFEST file.  I hope your kit is complete !"
1744 fi
1745 rm -f missing x??
1746
1747 echo " "
1748 : Find the appropriate value for a newline for tr
1749 if test -n "$DJGPP"; then
1750        trnl='\012'
1751 fi
1752 if test X"$trnl" = X; then
1753         case "`echo foo|tr '\n' x 2>/dev/null`" in
1754         foox) trnl='\n' ;;
1755         esac
1756 fi
1757 if test X"$trnl" = X; then
1758         case "`echo foo|tr '\012' x 2>/dev/null`" in
1759         foox) trnl='\012' ;;
1760         esac
1761 fi
1762 if test X"$trnl" = X; then
1763         cat <<EOM >&2
1764
1765 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1766
1767 EOM
1768         exit 1
1769 fi
1770
1771 : compute the number of columns on the terminal for proper question formatting
1772 case "$COLUMNS" in
1773 '') COLUMNS='80';;
1774 esac
1775
1776 : set up the echo used in my read
1777 myecho="case \"\$xxxm\" in
1778 '') echo $n \"\$rp $c\" >&4;;
1779 *) case \"\$rp\" in
1780         '') echo $n \"[\$xxxm] $c\";;
1781         *)
1782                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1783                         echo \"\$rp\" >&4
1784                         echo $n \"[\$xxxm] $c\" >&4
1785                 else
1786                         echo $n \"\$rp [\$xxxm] $c\" >&4
1787                 fi
1788                 ;;
1789         esac;;
1790 esac"
1791
1792 : now set up to do reads with possible shell escape and default assignment
1793 cat <<EOSC >myread
1794 $startsh
1795 xxxm=\$dflt
1796 $myecho
1797 ans='!'
1798 case "\$fastread" in
1799 yes) case "\$dflt" in
1800         '') ;;
1801         *) ans='';
1802                 case "\$silent-\$rp" in
1803                 true-) ;;
1804                 *) echo " " >&4;;
1805                 esac;;
1806         esac;;
1807 *) case "\$silent" in
1808         true) case "\$rp" in
1809                 '') ans='';;
1810                 esac;;
1811         esac;;
1812 esac
1813 while expr "X\$ans" : "X!" >/dev/null; do
1814         read answ
1815         set x \$xxxm
1816         shift
1817         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1818         case  "\$answ" in
1819         "!")
1820                 sh 1>&4
1821                 echo " "
1822                 $myecho
1823                 ;;
1824         !*)
1825                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1826                 shift
1827                 sh 1>&4 -c "\$*"
1828                 echo " "
1829                 $myecho
1830                 ;;
1831         "\$ans")
1832                 case "\$ans" in
1833                 \\&*)
1834                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1835                         shift
1836                         case "\$1" in
1837                         -d)
1838                                 fastread=yes
1839                                 echo "(OK, I'll run with -d after this question.)" >&4
1840                                 ;;
1841                         -*)
1842                                 echo "*** Sorry, \$1 not supported yet." >&4
1843                                 ;;
1844                         esac
1845                         $myecho
1846                         ans=!
1847                         ;;
1848                 esac;;
1849         *)
1850                 case "\$aok" in
1851                 y)
1852                         echo "*** Substitution done -- please confirm."
1853                         xxxm="\$ans"
1854                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1855                         xxxm="\$ans"
1856                         ans=!
1857                         ;;
1858                 *)
1859                         echo "*** Error -- try again."
1860                         ans=!
1861                         ;;
1862                 esac
1863                 $myecho
1864                 ;;
1865         esac
1866         case "\$ans\$xxxm\$nostick" in
1867         '')
1868                 ans=!
1869                 $myecho
1870                 ;;
1871         esac
1872 done
1873 case "\$ans" in
1874 '') ans="\$xxxm";;
1875 esac
1876 EOSC
1877
1878 : create .config dir to save info across Configure sessions
1879 test -d ../.config || mkdir ../.config
1880 cat >../.config/README <<EOF
1881 This directory created by Configure to save information that should
1882 persist across sessions for $package.
1883
1884 You may safely delete it if you wish.
1885 EOF
1886
1887 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1888 case "$usedevel" in
1889 $define|true|[yY]*) ;;
1890 *) case "$xversion" in
1891    *[13579])
1892         cat >&4 <<EOH
1893 *** WHOA THERE!!! ***
1894
1895     This is an UNSTABLE DEVELOPMENT release.
1896     The version of this $package distribution is $xversion, that is, odd,
1897     (as opposed to even) and that signifies a development release.
1898     If you want a maintenance release, you want an even-numbered version.
1899
1900     Do ***NOT*** install this into production use.
1901     Data corruption and crashes are possible.
1902
1903     It is most seriously suggested that you do not continue any further
1904     unless you want to help in developing and debugging Perl.
1905
1906     If you *still* want to build perl, you can answer 'y' now,
1907     or pass -Dusedevel to Configure.
1908
1909 EOH
1910         rp='Do you really want to continue?'
1911         dflt='n'
1912         . ./myread
1913         case "$ans" in
1914         [yY]) echo >&4 "Okay, continuing."
1915               usedevel="$define" ;;
1916         *) echo >&4 "Okay, bye."
1917            exit 1
1918            ;;
1919         esac
1920         ;;
1921     esac
1922     ;;
1923 esac
1924 case "$usedevel" in
1925 $define|true|[yY]*)
1926         case "$versiononly" in
1927         '') versiononly="$define" ;;
1928         esac
1929         case "$installusrbinperl" in
1930         '') installusrbinperl="$undef" ;;
1931         esac
1932         ;;
1933 esac
1934
1935 : general instructions
1936 needman=true
1937 firsttime=true
1938 user=`(logname) 2>/dev/null`
1939 case "$user" in
1940 '') user=`whoami 2>&1`;;
1941 esac
1942 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1943         firsttime=false
1944         echo " "
1945         rp='Would you like to see the instructions?'
1946         dflt=n
1947         . ./myread
1948         case "$ans" in
1949         [yY]*) ;;
1950         *) needman=false;;
1951         esac
1952 fi
1953 if $needman; then
1954         cat <<EOH
1955
1956 This installation shell script will examine your system and ask you questions
1957 to determine how the perl5 package should be installed. If you get
1958 stuck on a question, you may use a ! shell escape to start a subshell or
1959 execute a command.  Many of the questions will have default answers in square
1960 brackets; typing carriage return will give you the default.
1961
1962 On some of the questions which ask for file or directory names you are allowed
1963 to use the ~name construct to specify the login directory belonging to "name",
1964 even if you don't have a shell which knows about that.  Questions where this is
1965 allowed will be marked "(~name ok)".
1966
1967 EOH
1968         rp=''
1969         dflt='Type carriage return to continue'
1970         . ./myread
1971         cat <<'EOH'
1972
1973 The prompter used in this script allows you to use shell variables and
1974 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1975 in the default answer, as if the default line was a set of arguments given to a
1976 script shell.  This means you may also use $* to repeat the whole default line,
1977 so you do not have to re-type everything to add something to the default.
1978
1979 Everytime there is a substitution, you will have to confirm.  If there is an
1980 error (e.g. an unmatched backtick), the default answer will remain unchanged
1981 and you will be prompted again.
1982
1983 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1984 the questions and use the computed defaults (or the previous answers if there
1985 was already a config.sh file). Type 'Configure -h' for a list of options.
1986 You may also start interactively and then answer '& -d' at any prompt to turn
1987 on the non-interactive behaviour for the remainder of the execution.
1988
1989 EOH
1990         . ./myread
1991         cat <<EOH
1992
1993 Much effort has been expended to ensure that this shell script will run on any
1994 Unix system.  If despite that it blows up on yours, your best bet is to edit
1995 Configure and run it again.  If you can't run Configure for some reason,
1996 you'll have to generate a config.sh file by hand.  Whatever problems you
1997 have, let me (perlbug@perl.org) know how I blew it.
1998
1999 This installation script affects things in two ways:
2000
2001 1) it may do direct variable substitutions on some of the files included
2002    in this kit.
2003 2) it builds a config.h file for inclusion in C programs.  You may edit
2004    any of these files as the need arises after running this script.
2005
2006 If you make a mistake on a question, there is no easy way to back up to it
2007 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2008 files.  Configure will offer to let you do this before it runs the SH files.
2009
2010 EOH
2011         dflt='Type carriage return to continue'
2012         . ./myread
2013         case "$firsttime" in
2014         true) echo $user >>../.config/instruct;;
2015         esac
2016 fi
2017
2018 : find out where common programs are
2019 echo " "
2020 echo "Locating common programs..." >&4
2021 cat <<EOSC >loc
2022 $startsh
2023 case \$# in
2024 0) exit 1;;
2025 esac
2026 thing=\$1
2027 shift
2028 dflt=\$1
2029 shift
2030 for dir in \$*; do
2031         case "\$thing" in
2032         .)
2033         if test -d \$dir/\$thing; then
2034                 echo \$dir
2035                 exit 0
2036         fi
2037         ;;
2038         *)
2039         for thisthing in \$dir/\$thing; do
2040                 : just loop through to pick last item
2041         done
2042         if test -f \$thisthing; then
2043                 echo \$thisthing
2044                 exit 0
2045         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2046                 echo \$thisthing
2047                 exit 0
2048         elif test -f \$dir/\$thing.exe; then
2049                 if test -n "$DJGPP"; then
2050                         echo \$dir/\$thing.exe
2051                 else
2052                         : on Eunice apparently
2053                         echo \$dir/\$thing
2054                 fi
2055                 exit 0
2056         fi
2057         ;;
2058         esac
2059 done
2060 echo \$dflt
2061 exit 1
2062 EOSC
2063 chmod +x loc
2064 $eunicefix loc
2065 loclist="
2066 awk
2067 cat
2068 chmod
2069 comm
2070 cp
2071 echo
2072 expr
2073 grep
2074 ls
2075 mkdir
2076 rm
2077 sed
2078 sort
2079 touch
2080 tr
2081 uniq
2082 "
2083 trylist="
2084 Mcc
2085 ar
2086 bison
2087 byacc
2088 cpp
2089 csh
2090 date
2091 egrep
2092 gmake
2093 gzip
2094 less
2095 ln
2096 make
2097 more
2098 nm
2099 nroff
2100 pg
2101 test
2102 uname
2103 zip
2104 "
2105 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2106 pth="$pth /lib /usr/lib"
2107 for file in $loclist; do
2108         eval xxx=\$$file
2109         case "$xxx" in
2110         /*|?:[\\/]*)
2111                 if test -f "$xxx"; then
2112                         : ok
2113                 else
2114                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2115                         xxx=`./loc $file $file $pth`
2116                 fi
2117                 ;;
2118         '') xxx=`./loc $file $file $pth`;;
2119         *) xxx=`./loc $xxx $xxx $pth`;;
2120         esac
2121         eval $file=$xxx$_exe
2122         eval _$file=$xxx
2123         case "$xxx" in
2124         /*)
2125                 echo $file is in $xxx.
2126                 ;;
2127         ?:[\\/]*)
2128                 echo $file is in $xxx.
2129                 ;;
2130         *)
2131                 echo "I don't know where '$file' is, and my life depends on it." >&4
2132                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2133                 exit 1
2134                 ;;
2135         esac
2136 done
2137 echo " "
2138 echo "Don't worry if any of the following aren't found..."
2139 say=offhand
2140 for file in $trylist; do
2141         eval xxx=\$$file
2142         case "$xxx" in
2143         /*|?:[\\/]*)
2144                 if test -f "$xxx"; then
2145                         : ok
2146                 else
2147                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2148                         xxx=`./loc $file $file $pth`
2149                 fi
2150                 ;;
2151         '') xxx=`./loc $file $file $pth`;;
2152         *) xxx=`./loc $xxx $xxx $pth`;;
2153         esac
2154         eval $file=$xxx$_exe
2155         eval _$file=$xxx
2156         case "$xxx" in
2157         /*)
2158                 echo $file is in $xxx.
2159                 ;;
2160         ?:[\\/]*)
2161                 echo $file is in $xxx.
2162                 ;;
2163         *)
2164                 echo "I don't see $file out there, $say."
2165                 say=either
2166                 ;;
2167         esac
2168 done
2169 case "$egrep" in
2170 egrep)
2171         echo "Substituting grep for egrep."
2172         egrep=$grep
2173         _egrep=$grep
2174         ;;
2175 esac
2176 case "$ln" in
2177 ln)
2178         echo "Substituting cp for ln."
2179         ln=$cp
2180         _ln=$cp
2181         ;;
2182 esac
2183 case "$make" in
2184 make)   
2185         case "$gmake" in
2186         gmake)
2187         echo "I can't find make or gmake, and my life depends on it." >&4
2188         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2189         exit 1
2190         ;;
2191         esac
2192         ;;
2193 esac    
2194 case "$gmake" in
2195 gmake)  ;;
2196 *)      # We can't have osname yet.
2197         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2198                 # Assume that gmake, if found, is definitely GNU make
2199                 # and prefer it over the system make.
2200                 echo "Substituting gmake for make."
2201                 make=$gmake
2202                 _make=$gmake
2203         fi
2204         ;;
2205 esac
2206 case "$test" in
2207 test)
2208         echo "Hopefully test is built into your sh."
2209         ;;
2210 *)
2211         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2212                 echo "Using the test built into your sh."
2213                 test=test
2214                 _test=test
2215         fi
2216         ;;
2217 esac
2218 case "$echo" in
2219 echo)
2220         echo "Hopefully echo is built into your sh."
2221         ;;
2222 '') ;;
2223 *)
2224         echo " "
2225 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2226         $echo $n "hi there$c" >foo1
2227         echo $n "hi there$c" >foo2
2228         if cmp foo1 foo2 >/dev/null 2>&1; then
2229                 echo "They are compatible.  In fact, they may be identical."
2230         else
2231                 case "$n" in
2232                 '-n') n='' c='\c';;
2233                 *) n='-n' c='';;
2234                 esac
2235                 cat <<FOO
2236 They are not compatible!  You are probably running ksh on a non-USG system.
2237 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2238 have echo built in and we may have to run some Bourne shell scripts.  That
2239 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2240
2241 FOO
2242                 $echo $n "The star should be here-->$c"
2243                 $echo "*"
2244         fi
2245         $rm -f foo1 foo2
2246         ;;
2247 esac
2248
2249 cat <<EOS >checkcc
2250 $startsh
2251 EOS
2252 cat <<'EOSC' >>checkcc
2253 case "$cc" in
2254 '') ;;
2255 *)  $rm -f try try.*
2256     $cat >try.c <<EOM
2257 int main(int argc, char *argv[]) {
2258   return 0;
2259 }
2260 EOM
2261     if $cc -o try $ccflags $ldflags try.c; then
2262        :
2263     else
2264         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2265         despair=yes
2266         trygcc=yes
2267         case "$cc" in
2268         *gcc*) trygcc=no ;;
2269         esac
2270         case "`$cc -v -c try.c 2>&1`" in
2271         *gcc*) trygcc=no ;;
2272         esac
2273         if $test X"$trygcc" = Xyes; then
2274             if gcc -o try -c try.c; then
2275                 echo " "
2276                 echo "You seem to have a working gcc, though." >&4
2277                 rp="Would you like to use it?"
2278                 dflt=y
2279                 if $test -f myread; then
2280                     . ./myread
2281                 else
2282                     if $test -f UU/myread; then
2283                         . ./UU/myread
2284                     else
2285                         echo "Cannot find myread, sorry.  Aborting." >&2
2286                         exit 1
2287                     fi
2288                 fi  
2289                 case "$ans" in
2290                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2291                 esac
2292             fi
2293         fi
2294         if $test X"$despair" = Xyes; then
2295             $cat >&4 <<EOM
2296 You need to find a working C compiler.
2297 Either (purchase and) install the C compiler supplied by your OS vendor,
2298 or for a free C compiler try http://gcc.gnu.org/
2299 I cannot continue any further, aborting.
2300 EOM
2301             exit 1
2302         fi
2303     fi
2304     $rm -f try try.*
2305     ;;
2306 esac
2307 EOSC
2308
2309 : determine whether symbolic links are supported
2310 echo " "
2311 $touch blurfl
2312 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2313         echo "Symbolic links are supported." >&4
2314         lns="$ln -s"
2315 else
2316         echo "Symbolic links are NOT supported." >&4
2317         lns="$ln"
2318 fi
2319 $rm -f blurfl sym
2320
2321 : determine whether symbolic links are supported
2322 echo " "
2323 case "$lns" in
2324 *"ln"*" -s")
2325         echo "Checking how to test for symbolic links..." >&4
2326         $lns blurfl sym
2327         if $test "X$issymlink" = X; then
2328                 case "$newsh" in
2329                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2330                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2331                 esac
2332                 if test $? = 0; then
2333                         issymlink="test -h"
2334                 else
2335                         echo "Your builtin 'test -h' may be broken." >&4
2336                         case "$test" in
2337                         /*)     ;;
2338                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2339                                 for p in $pth
2340                                 do
2341                                         if test -f "$p/$test"; then
2342                                                 test="$p/$test"
2343                                                 break
2344                                         fi
2345                                 done
2346                                 ;;
2347                         esac
2348                         case "$test" in
2349                         /*)
2350                                 echo "Trying external '$test -h'." >&4
2351                                 issymlink="$test -h"
2352                                 if $test ! -h sym >/dev/null 2>&1; then
2353                                         echo "External '$test -h' is broken, too." >&4
2354                                         issymlink=''
2355                                 fi
2356                                 ;;
2357                         *)      issymlink='' ;;
2358                         esac
2359                 fi              
2360         fi
2361         if $test "X$issymlink" = X; then
2362                 if $test -L sym 2>/dev/null; then
2363                         issymlink="$test -L"
2364                         echo "The builtin '$test -L' worked." >&4
2365                 fi
2366         fi
2367         if $test "X$issymlink" != X; then
2368                 echo "You can test for symbolic links with '$issymlink'." >&4
2369         else
2370                 echo "I do not know how you can test for symbolic links." >&4
2371         fi
2372         $rm -f blurfl sym
2373         ;;
2374 *)      echo "No symbolic links, so not testing for their testing..." >&4
2375         ;;
2376 esac
2377 echo " "
2378
2379
2380 case "$mksymlinks" in
2381 $define|true|[yY]*)
2382         case "$src" in
2383         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2384                 exit 1
2385                 ;;
2386         *)      case "$lns:$issymlink" in
2387                 *"ln -s:"*"test -"?)
2388                         echo "Creating the symbolic links..." >&4
2389                         echo "(First creating the subdirectories...)" >&4
2390                         cd ..
2391                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2392                                 read directory
2393                                 test -z "$directory" && break
2394                                 mkdir -p $directory
2395                         done
2396                         # Sanity check 1.
2397                         if test ! -d t/base; then
2398                                 echo "Failed to create the subdirectories.  Aborting." >&4
2399                                 exit 1
2400                         fi
2401                         echo "(Then creating the symlinks...)" >&4
2402                         awk '{print $1}' $src/MANIFEST | while true; do
2403                                 read filename
2404                                 test -z "$filename" && break
2405                                 if test -f $filename; then
2406                                         if $issymlink $filename; then
2407                                                 rm -f $filename
2408                                         fi
2409                                 fi
2410                                 if test -f $filename; then
2411                                         echo "$filename already exists, not symlinking."
2412                                 else
2413                                         ln -s $src/$filename $filename
2414                                 fi
2415                         done
2416                         # Sanity check 2.
2417                         if test ! -f t/base/lex.t; then
2418                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2419                                 exit 1
2420                         fi
2421                         cd UU
2422                         ;;
2423                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2424                         ;;
2425                 esac
2426                 ;;
2427         esac
2428         ;;
2429 esac
2430
2431
2432 case "$usecrosscompile" in
2433 $define|true|[yY]*)
2434         $echo "Cross-compiling..."
2435         croak=''
2436         case "$cc" in
2437         *-*-gcc) # A cross-compiling gcc, probably.
2438             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2439             ar=$targetarch-ar
2440             # leave out ld, choosing it is more complex
2441             nm=$targetarch-nm
2442             ranlib=$targetarch-ranlib
2443             $echo 'extern int foo;' > try.c
2444             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2445             shift
2446             if $test $# -gt 0; then
2447                 incpth="$incpth $*"
2448                 incpth="`$echo $incpth|$sed 's/^ //'`"
2449                 echo "Guessing incpth '$incpth'." >&4
2450                 for i in $*; do
2451                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2452                     if $test -d $j; then
2453                         libpth="$libpth $j"
2454                     fi
2455                 done   
2456                 libpth="`$echo $libpth|$sed 's/^ //'`"
2457                 echo "Guessing libpth '$libpth'." >&4
2458             fi
2459             $rm -f try.c
2460             ;;
2461         esac
2462         case "$targetarch" in
2463         '') echo "Targetarch not defined." >&4; croak=y ;;
2464         *)  echo "Using targetarch $targetarch." >&4 ;;
2465         esac
2466         case "$incpth" in
2467         '') echo "Incpth not defined." >&4; croak=y ;;
2468         *)  echo "Using incpth '$incpth'." >&4 ;;
2469         esac
2470         case "$libpth" in
2471         '') echo "Libpth not defined." >&4; croak=y ;;
2472         *)  echo "Using libpth '$libpth'." >&4 ;;
2473         esac
2474         case "$usrinc" in
2475         '') for i in $incpth; do
2476                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2477                     usrinc=$i
2478                     echo "Guessing usrinc $usrinc." >&4
2479                     break
2480                 fi
2481             done
2482             case "$usrinc" in
2483             '') echo "Usrinc not defined." >&4; croak=y ;;
2484             esac
2485             ;;
2486         *)  echo "Using usrinc $usrinc." >&4 ;;
2487         esac
2488         case "$targethost" in
2489         '') echo "Targethost not defined." >&4; croak=y ;;
2490         *)  echo "Using targethost $targethost." >&4
2491         esac
2492         locincpth=' '
2493         loclibpth=' '
2494         case "$croak" in
2495         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2496         esac
2497         case "$src" in
2498         /*) run=$src/Cross/run
2499             targetmkdir=$src/Cross/mkdir
2500             to=$src/Cross/to
2501             from=$src/Cross/from
2502             ;;
2503         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2504             run=$pwd/Cross/run
2505             targetmkdir=$pwd/Cross/mkdir
2506             to=$pwd/Cross/to
2507             from=$pwd/Cross/from
2508             ;;
2509         esac
2510         case "$targetrun" in
2511         '') targetrun=ssh ;;
2512         esac
2513         case "$targetto" in
2514         '') targetto=scp ;;
2515         esac
2516         case "$targetfrom" in
2517         '') targetfrom=scp ;;
2518         esac
2519         run=$run-$targetrun
2520         to=$to-$targetto
2521         from=$from-$targetfrom
2522         case "$targetdir" in
2523         '')  targetdir=/tmp
2524              echo "Guessing targetdir $targetdir." >&4
2525              ;;
2526         esac
2527         case "$targetuser" in
2528         '')  targetuser=root
2529              echo "Guessing targetuser $targetuser." >&4
2530              ;;
2531         esac
2532         case "$targetfrom" in
2533         scp)    q=-q ;;
2534         *)      q='' ;;
2535         esac
2536         case "$targetrun" in
2537         ssh|rsh)
2538             cat >$run <<EOF
2539 #!/bin/sh
2540 case "\$1" in
2541 -cwd)
2542   shift
2543   cwd=\$1
2544   shift
2545   ;;
2546 esac
2547 case "\$cwd" in
2548 '') cwd=$targetdir ;;
2549 esac
2550 exe=\$1
2551 shift
2552 if $test ! -f \$exe.xok; then
2553   $to \$exe
2554   $touch \$exe.xok
2555 fi
2556 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2557 EOF
2558             ;;
2559         *)  echo "Unknown targetrun '$targetrun'" >&4
2560             exit 1
2561             ;;
2562         esac
2563         case "$targetmkdir" in
2564         */Cross/mkdir)
2565             cat >$targetmkdir <<EOF
2566 #!/bin/sh
2567 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2568 EOF
2569             $chmod a+rx $targetmkdir
2570             ;;
2571         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2572             exit 1
2573             ;;
2574         esac
2575         case "$targetto" in
2576         scp|rcp)
2577             cat >$to <<EOF
2578 #!/bin/sh
2579 for f in \$@
2580 do
2581   case "\$f" in
2582   /*)
2583     $targetmkdir \`dirname \$f\`
2584     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2585     ;;
2586   *)
2587     $targetmkdir $targetdir/\`dirname \$f\`
2588     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2589     ;;
2590   esac
2591 done
2592 exit 0
2593 EOF
2594             ;;
2595         cp) cat >$to <<EOF
2596 #!/bin/sh
2597 for f in \$@
2598 do
2599   case "\$f" in
2600   /*)
2601     $mkdir -p $targetdir/\`dirname \$f\`
2602     $cp \$f $targetdir/\$f || exit 1
2603     ;;
2604   *)
2605     $targetmkdir $targetdir/\`dirname \$f\`
2606     $cp \$f $targetdir/\$f || exit 1
2607     ;;
2608   esac
2609 done
2610 exit 0
2611 EOF
2612             ;;
2613         *)  echo "Unknown targetto '$targetto'" >&4
2614             exit 1
2615             ;;
2616         esac
2617         case "$targetfrom" in
2618         scp|rcp)
2619           cat >$from <<EOF
2620 #!/bin/sh
2621 for f in \$@
2622 do
2623   $rm -f \$f
2624   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2625 done
2626 exit 0
2627 EOF
2628             ;;
2629         cp) cat >$from <<EOF
2630 #!/bin/sh
2631 for f in \$@
2632 do
2633   $rm -f \$f
2634   cp $targetdir/\$f . || exit 1
2635 done
2636 exit 0
2637 EOF
2638             ;;
2639         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2640             exit 1
2641             ;;
2642         esac
2643         if $test ! -f $run; then
2644             echo "Target 'run' script '$run' not found." >&4
2645         else
2646             $chmod a+rx $run
2647         fi
2648         if $test ! -f $to; then
2649             echo "Target 'to' script '$to' not found." >&4
2650         else
2651             $chmod a+rx $to
2652         fi
2653         if $test ! -f $from; then
2654             echo "Target 'from' script '$from' not found." >&4
2655         else
2656             $chmod a+rx $from
2657         fi
2658         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2659             exit 1
2660         fi
2661         cat >&4 <<EOF
2662 Using '$run' for remote execution,
2663 and '$from' and '$to'
2664 for remote file transfer.
2665 EOF
2666         ;;
2667 *)      run=''
2668         to=:
2669         from=:
2670         usecrosscompile='undef'
2671         targetarch=''
2672         ;;
2673 esac
2674
2675 : see whether [:lower:] and [:upper:] are supported character classes
2676 echo " "
2677 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2678 ABYZ)
2679         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2680         up='[:upper:]'
2681         low='[:lower:]'
2682         ;;
2683 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2684         # (0xc9 and 0xd1), therefore that is a nice testing point.
2685         if test "X$up" = X -o "X$low" = X; then
2686             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2687             ij) up='[A-Z]'
2688                 low='[a-z]'
2689                 ;;
2690             esac
2691         fi
2692         if test "X$up" = X -o "X$low" = X; then
2693             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2694             ij) up='A-Z'
2695                 low='a-z'
2696                 ;;
2697             esac
2698         fi
2699         if test "X$up" = X -o "X$low" = X; then
2700             case "`echo IJ | od -x 2>/dev/null`" in
2701             *C9D1*|*c9d1*)
2702                 echo "Hey, this might be EBCDIC." >&4
2703                 if test "X$up" = X -o "X$low" = X; then
2704                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2705                     ij) up='[A-IJ-RS-Z]'
2706                         low='[a-ij-rs-z]'
2707                         ;;
2708                     esac
2709                 fi
2710                 if test "X$up" = X -o "X$low" = X; then
2711                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2712                     ij) up='A-IJ-RS-Z'
2713                         low='a-ij-rs-z'
2714                         ;;
2715                     esac
2716                 fi
2717                 ;;
2718             esac
2719         fi
2720 esac
2721 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2722 ij)
2723     echo "Using $up and $low to convert case." >&4
2724     ;;
2725 *)
2726     echo "I don't know how to translate letters from upper to lower case." >&4
2727     echo "Your tr is not acting any way I know of." >&4
2728     exit 1
2729     ;;
2730 esac
2731 : set up the translation script tr, must be called with ./tr of course
2732 cat >tr <<EOSC
2733 $startsh
2734 case "\$1\$2" in
2735 '[A-Z][a-z]') exec $tr '$up' '$low';;
2736 '[a-z][A-Z]') exec $tr '$low' '$up';;
2737 esac
2738 exec $tr "\$@"
2739 EOSC
2740 chmod +x tr
2741 $eunicefix tr
2742
2743 : Try to determine whether config.sh was made on this system
2744 case "$config_sh" in
2745 '')
2746 myuname=`$uname -a 2>/dev/null`
2747 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2748 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2749 # because the A-Z/a-z are not consecutive.
2750 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2751         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2752 newmyuname="$myuname"
2753 dflt=n
2754 case "$knowitall" in
2755 '')
2756         if test -f ../config.sh; then
2757                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2758                         eval "`grep myuname= ../config.sh`"
2759                 fi
2760                 if test "X$myuname" = "X$newmyuname"; then
2761                         dflt=y
2762                 fi
2763         fi
2764         ;;
2765 *) dflt=y;;
2766 esac
2767
2768 : Get old answers from old config file if Configure was run on the
2769 : same system, otherwise use the hints.
2770 hint=default
2771 cd ..
2772 if test -f config.sh; then
2773         echo " "
2774         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2775         . UU/myread
2776         case "$ans" in
2777         n*|N*) echo "OK, I'll ignore it."
2778                 mv config.sh config.sh.old
2779                 myuname="$newmyuname"
2780                 ;;
2781         *)  echo "Fetching default answers from your old config.sh file..." >&4
2782                 tmp_n="$n"
2783                 tmp_c="$c"
2784                 tmp_sh="$sh"
2785                 . ./config.sh
2786                 cp config.sh UU
2787                 n="$tmp_n"
2788                 c="$tmp_c"
2789                 : Older versions did not always set $sh.  Catch re-use of such
2790                 : an old config.sh.
2791                 case "$sh" in
2792                 '') sh="$tmp_sh" ;;
2793                 esac
2794                 hint=previous
2795                 ;;
2796         esac
2797 fi
2798 . ./UU/checkcc
2799 if test ! -f config.sh; then
2800         $cat <<EOM
2801
2802 First time through, eh?  I have some defaults handy for some systems
2803 that need some extra help getting the Configure answers right:
2804
2805 EOM
2806         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2807         dflt=''
2808         : Half the following guesses are probably wrong... If you have better
2809         : tests or hints, please send them to perlbug@perl.org
2810         : The metaconfig authors would also appreciate a copy...
2811         $test -f /irix && osname=irix
2812         $test -f /xenix && osname=sco_xenix
2813         $test -f /dynix && osname=dynix
2814         $test -f /dnix && osname=dnix
2815         $test -f /lynx.os && osname=lynxos
2816         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2817         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2818         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2819         $test -f /bin/mips && /bin/mips && osname=mips
2820         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2821                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2822         $test -d /usr/apollo/bin && osname=apollo
2823         $test -f /etc/saf/_sactab && osname=svr4
2824         $test -d /usr/include/minix && osname=minix
2825         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2826         if $test -d /MachTen -o -d /MachTen_Folder; then
2827                 osname=machten
2828                 if $test -x /sbin/version; then
2829                         osvers=`/sbin/version | $awk '{print $2}' |
2830                         $sed -e 's/[A-Za-z]$//'`
2831                 elif $test -x /usr/etc/version; then
2832                         osvers=`/usr/etc/version | $awk '{print $2}' |
2833                         $sed -e 's/[A-Za-z]$//'`
2834                 else
2835                         osvers="$2.$3"
2836                 fi
2837         fi
2838
2839         $test -f /sys/posix.dll &&
2840                 $test -f /usr/bin/what &&
2841                 set X `/usr/bin/what /sys/posix.dll` &&
2842                 $test "$3" = UWIN &&
2843                 osname=uwin &&
2844                 osvers="$5"
2845
2846         if $test -f $uname; then
2847                 set X $myuname
2848                 shift
2849
2850                 case "$5" in
2851                 fps*) osname=fps ;;
2852                 mips*)
2853                         case "$4" in
2854                         umips) osname=umips ;;
2855                         *) osname=mips ;;
2856                         esac;;
2857                 [23]100) osname=mips ;;
2858                 next*) osname=next ;;
2859                 i386*)
2860                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2861                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2862                                 osname='sco'
2863                                 osvers=$tmp
2864                         elif $test -f /etc/kconfig; then
2865                                 osname=isc
2866                                 if test "$lns" = "$ln -s"; then
2867                                         osvers=4
2868                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2869                                         osvers=3
2870                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2871                                         osvers=2
2872                                 fi
2873                         fi
2874                         tmp=''
2875                         ;;
2876                 pc*)
2877                         if test -n "$DJGPP"; then
2878                                 osname=dos
2879                                 osvers=djgpp
2880                         fi
2881                         ;;
2882                 esac
2883
2884                 case "$1" in
2885                 aix) osname=aix
2886                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2887                         case "$tmp" in
2888                         'not found') osvers="$4"."$3" ;;
2889                         '<3240'|'<>3240') osvers=3.2.0 ;;
2890                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2891                         '=3250'|'>3250') osvers=3.2.5 ;;
2892                         *) osvers=$tmp;;
2893                         esac
2894                         ;;
2895                 bsd386) osname=bsd386
2896                         osvers=`$uname -r`
2897                         ;;
2898                 cygwin*) osname=cygwin
2899                         osvers="$3"
2900                         ;;
2901                 *dc.osx) osname=dcosx
2902                         osvers="$3"
2903                         ;;
2904                 dnix) osname=dnix
2905                         osvers="$3"
2906                         ;;
2907                 domainos) osname=apollo
2908                         osvers="$3"
2909                         ;;
2910                 dgux) osname=dgux 
2911                         osvers="$3"
2912                         ;;
2913                 dynixptx*) osname=dynixptx
2914                         osvers=`echo "$4"|sed 's/^v//'`
2915                         ;;
2916                 freebsd) osname=freebsd 
2917                         osvers="$3" ;;
2918                 genix) osname=genix ;;
2919                 hp*) osname=hpux 
2920                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2921                         ;;
2922                 irix*) osname=irix
2923                         case "$3" in
2924                         4*) osvers=4 ;;
2925                         5*) osvers=5 ;;
2926                         *)      osvers="$3" ;;
2927                         esac
2928                         ;;
2929                 linux) osname=linux
2930                         case "$3" in
2931                         *)      osvers="$3" ;;
2932                         esac
2933                         ;;
2934                 MiNT) osname=mint
2935                         ;;
2936                 netbsd*) osname=netbsd
2937                         osvers="$3"
2938                         ;;
2939                 news-os) osvers="$3"
2940                         case "$3" in
2941                         4*) osname=newsos4 ;;
2942                         *) osname=newsos ;;
2943                         esac
2944                         ;;
2945                 next*) osname=next ;;
2946                 nonstop-ux) osname=nonstopux ;;
2947                 POSIX-BC | posix-bc ) osname=posix-bc
2948                         osvers="$3"
2949                         ;;
2950                 powerux | power_ux | powermax_os | powermaxos | \
2951                 powerunix | power_unix) osname=powerux
2952                         osvers="$3"
2953                         ;;
2954                 qnx) osname=qnx
2955                         osvers="$4"
2956                         ;;
2957                 solaris) osname=solaris
2958                         case "$3" in
2959                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2960                         *)      osvers="$3" ;;
2961                         esac
2962                         ;;
2963                 sunos) osname=sunos
2964                         case "$3" in
2965                         5*) osname=solaris
2966                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2967                         *)      osvers="$3" ;;
2968                         esac
2969                         ;;
2970                 titanos) osname=titanos
2971                         case "$3" in
2972                         1*) osvers=1 ;;
2973                         2*) osvers=2 ;;
2974                         3*) osvers=3 ;;
2975                         4*) osvers=4 ;;
2976                         *)      osvers="$3" ;;
2977                         esac
2978                         ;;
2979                 ultrix) osname=ultrix
2980                         osvers="$3"
2981                         ;;
2982                 osf1|mls+)      case "$5" in
2983                                 alpha)
2984                                         osname=dec_osf
2985                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2986                                         case "$osvers" in
2987                                         [1-9].[0-9]*) ;;
2988                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2989                                         esac
2990                                         ;;
2991                         hp*)    osname=hp_osf1  ;;
2992                         mips)   osname=mips_osf1 ;;
2993                         esac
2994                         ;;
2995                 unixware) osname=svr5
2996                         osvers="$4"
2997                         ;;
2998                 uts)    osname=uts
2999                         osvers="$3"
3000                         ;;
3001                 vos) osvers="$3"
3002                         ;;
3003                 $2) case "$osname" in
3004                         *isc*) ;;
3005                         *freebsd*) ;;
3006                         svr*)
3007                                 : svr4.x or possibly later
3008                                 case "svr$3" in 
3009                                 ${osname}*)
3010                                         osname=svr$3
3011                                         osvers=$4
3012                                         ;;
3013                                 esac
3014                                 case "$osname" in
3015                                 svr4.0)
3016                                         : Check for ESIX
3017                                         if test -f /stand/boot ; then
3018                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3019                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3020                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3021                                                         if test -n "$isesix"; then
3022                                                                 osname=esix4
3023                                                         fi
3024                                                 fi
3025                                         fi
3026                                         ;;
3027                                 esac
3028                                 ;;
3029                         *)      if test -f /etc/systemid; then
3030                                         osname=sco
3031                                         set `echo $3 | $sed 's/\./ /g'` $4
3032                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3033                                                 osvers=$1.$2.$3
3034                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3035                                                 osvers=$1.$2
3036                                         elif $test -f $src/hints/sco_$1.sh; then
3037                                                 osvers=$1
3038                                         fi
3039                                 else
3040                                         case "$osname" in
3041                                         '') : Still unknown.  Probably a generic Sys V.
3042                                                 osname="sysv"
3043                                                 osvers="$3"
3044                                                 ;;
3045                                         esac
3046                                 fi
3047                                 ;;
3048                         esac
3049                         ;;
3050                 *)      case "$osname" in
3051                         '') : Still unknown.  Probably a generic BSD.
3052                                 osname="$1"
3053                                 osvers="$3"
3054                                 ;;
3055                         esac
3056                         ;;
3057                 esac
3058         else
3059                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3060                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3061                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3062                                 osname=news_os
3063                         fi
3064                         $rm -f UU/kernel.what
3065                 elif test -d c:/.; then
3066                         set X $myuname
3067                         osname=os2
3068                         osvers="$5"
3069                 fi
3070         fi
3071         
3072         case "$targetarch" in
3073         '') ;;
3074         *)  hostarch=$osname
3075             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3076             osvers=''
3077             ;;
3078         esac
3079
3080         : Now look for a hint file osname_osvers, unless one has been
3081         : specified already.
3082         case "$hintfile" in
3083         ''|' ')
3084                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3085                 : Also try without trailing minor version numbers.
3086                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3087                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3088                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3089                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3090                 case "$file" in
3091                 '') dflt=none ;;
3092                 *)  case "$osvers" in
3093                         '') dflt=$file
3094                                 ;;
3095                         *)  if $test -f $src/hints/$file.sh ; then
3096                                         dflt=$file
3097                                 elif $test -f $src/hints/$xfile.sh ; then
3098                                         dflt=$xfile
3099                                 elif $test -f $src/hints/$xxfile.sh ; then
3100                                         dflt=$xxfile
3101                                 elif $test -f $src/hints/$xxxfile.sh ; then
3102                                         dflt=$xxxfile
3103                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3104                                         dflt=$xxxxfile
3105                                 elif $test -f "$src/hints/${osname}.sh" ; then
3106                                         dflt="${osname}"
3107                                 else
3108                                         dflt=none
3109                                 fi
3110                                 ;;
3111                         esac
3112                         ;;
3113                 esac
3114                 if $test -f Policy.sh ; then
3115                         case "$dflt" in
3116                         *Policy*) ;;
3117                         none) dflt="Policy" ;;
3118                         *) dflt="Policy $dflt" ;;
3119                         esac
3120                 fi
3121                 ;;
3122         *)
3123                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3124                 ;;
3125         esac
3126
3127         if $test -f Policy.sh ; then
3128                 $cat <<EOM
3129
3130 There's also a Policy hint file available, which should make the
3131 site-specific (policy) questions easier to answer.
3132 EOM
3133
3134         fi
3135
3136         $cat <<EOM
3137
3138 You may give one or more space-separated answers, or "none" if appropriate.
3139 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3140 is a good thing.  DO NOT give a wrong version or a wrong OS.
3141
3142 EOM
3143
3144         rp="Which of these apply, if any?"
3145         . UU/myread
3146         tans=$ans
3147         for file in $tans; do
3148                 if $test X$file = XPolicy -a -f Policy.sh; then
3149                         . Policy.sh
3150                         $cat Policy.sh >> UU/config.sh
3151                 elif $test -f $src/hints/$file.sh; then
3152                         . $src/hints/$file.sh
3153                         $cat $src/hints/$file.sh >> UU/config.sh
3154                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3155                         : nothing
3156                 else
3157                         : Give one chance to correct a possible typo.
3158                         echo "$file.sh does not exist"
3159                         dflt=$file
3160                         rp="hint to use instead?"
3161                         . UU/myread
3162                         for file in $ans; do
3163                                 if $test -f "$src/hints/$file.sh"; then
3164                                         . $src/hints/$file.sh
3165                                         $cat $src/hints/$file.sh >> UU/config.sh
3166                                 elif $test X$ans = X -o X$ans = Xnone ; then
3167                                         : nothing
3168                                 else
3169                                         echo "$file.sh does not exist -- ignored."
3170                                 fi
3171                         done
3172                 fi
3173         done
3174
3175         hint=recommended
3176         : Remember our hint file for later.
3177         if $test -f "$src/hints/$file.sh" ; then
3178                 hintfile="$file"
3179         else
3180                 hintfile=''
3181         fi
3182 fi
3183 cd UU
3184 ;;
3185 *)
3186         echo " "
3187         echo "Fetching default answers from $config_sh..." >&4
3188         tmp_n="$n"
3189         tmp_c="$c"
3190         cd ..
3191         cp $config_sh config.sh 2>/dev/null
3192         chmod +w config.sh
3193         . ./config.sh
3194         cd UU
3195         cp ../config.sh .
3196         n="$tmp_n"
3197         c="$tmp_c"
3198         hint=previous
3199         ;;
3200 esac
3201 test "$override" && . ./optdef.sh
3202
3203 : Restore computed paths
3204 for file in $loclist $trylist; do
3205         eval $file="\$_$file"
3206 done
3207
3208 cat << EOM
3209
3210 Configure uses the operating system name and version to set some defaults.
3211 The default value is probably right if the name rings a bell. Otherwise,
3212 since spelling matters for me, either accept the default or answer "none"
3213 to leave it blank.
3214
3215 EOM
3216 case "$osname" in
3217         ''|' ')
3218                 case "$hintfile" in
3219                 ''|' '|none) dflt=none ;;
3220                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3221                 esac
3222                 ;;
3223         *) dflt="$osname" ;;
3224 esac
3225 rp="Operating system name?"
3226 . ./myread
3227 case "$ans" in
3228 none)  osname='' ;;
3229 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3230 esac
3231 echo " "
3232 case "$osvers" in
3233         ''|' ')
3234                 case "$hintfile" in
3235                 ''|' '|none) dflt=none ;;
3236                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3237                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3238                         case "$dflt" in
3239                         ''|' ') dflt=none ;;
3240                         esac
3241                         ;;
3242                 esac
3243                 ;;
3244         *) dflt="$osvers" ;;
3245 esac
3246 rp="Operating system version?"
3247 . ./myread
3248 case "$ans" in
3249 none)  osvers='' ;;
3250 *) osvers="$ans" ;;
3251 esac
3252
3253
3254 . ./posthint.sh
3255
3256 : who configured the system
3257 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3258 cf_by=`(logname) 2>/dev/null`
3259 case "$cf_by" in
3260 "")
3261         cf_by=`(whoami) 2>/dev/null`
3262         case "$cf_by" in
3263         "") cf_by=unknown ;;
3264         esac ;;
3265 esac
3266
3267 : set up the script used to warn in case of inconsistency
3268 cat <<EOS >whoa
3269 $startsh
3270 EOS
3271 cat <<'EOSC' >>whoa
3272 dflt=y
3273 echo " "
3274 echo "*** WHOA THERE!!! ***" >&4
3275 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3276 rp="    Keep the $hint value?"
3277 . ./myread
3278 case "$ans" in
3279 y) td=$was; tu=$was;;
3280 esac
3281 EOSC
3282
3283 : function used to set $1 to $val
3284 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3285 case "$val$was" in
3286 $define$undef) . ./whoa; eval "$var=\$td";;
3287 $undef$define) . ./whoa; eval "$var=\$tu";;
3288 *) eval "$var=$val";;
3289 esac'
3290
3291 case "$usethreads" in
3292 $define|true|[yY]*)     dflt='y';;
3293 *) dflt='n';;
3294 esac
3295 cat <<EOM
3296
3297 Perl can be built to take advantage of threads on some systems.
3298 To do so, Configure can be run with -Dusethreads.
3299
3300 Note that threading is a highly experimental feature, and
3301 some known race conditions still remain.  If you choose to try
3302 it, be very sure to not actually deploy it for production
3303 purposes.  README.threads has more details, and is required
3304 reading if you enable threads.
3305
3306 If this doesn't make any sense to you, just accept the default '$dflt'.
3307 EOM
3308 rp='Build a threading Perl?'
3309 . ./myread
3310 case "$ans" in
3311 y|Y)    val="$define" ;;
3312 *)      val="$undef" ;;
3313 esac
3314 set usethreads
3315 eval $setvar
3316
3317 case "$usethreads" in
3318 $define)
3319         $cat <<EOM
3320
3321 As of 5.5.640, Perl has two different internal threading implementations,
3322 the 5.005 version (5005threads) and an interpreter-based version
3323 (ithreads) that has one interpreter per thread.  Both are very 
3324 experimental.  This arrangement exists to help developers work out
3325 which one is better.
3326
3327 If you're a casual user, you probably don't want interpreter-threads
3328 at this time.  But if you do, the 'threads' module allows their use,
3329 and the 'Thread' module offers an interface to both 5005threads and
3330 ithreads (whichever has been configured).
3331 EOM
3332         : Default to ithreads unless overridden on command line or with
3333         : old config.sh
3334         dflt='y'
3335         case "$use5005threads" in
3336                 $define|true|[yY]*) dflt='n';;
3337         esac
3338         case "$useithreads" in
3339                 $undef|false|[nN]*) dflt='n';;
3340         esac
3341         rp='Use interpreter-based ithreads?'
3342         . ./myread
3343         case "$ans" in
3344         y|Y)    val="$define" ;;
3345         *)      val="$undef" ;;
3346         esac
3347         set useithreads
3348         eval $setvar
3349         : Now set use5005threads to the opposite value.
3350         case "$useithreads" in
3351         $define) val="$undef" ;;
3352         *) val="$define" ;;
3353         esac
3354         set use5005threads
3355         eval $setvar
3356         ;;
3357 *)
3358         useithreads="$undef"
3359         use5005threads="$undef"
3360         ;;
3361 esac
3362
3363 case "$useithreads$use5005threads" in
3364 "$define$define")
3365         $cat >&4 <<EOM
3366
3367 You cannot have both the ithreads and the 5.005 threads enabled
3368 at the same time.  Disabling the 5.005 threads since they are
3369 much less stable than the ithreads.
3370
3371 EOM
3372         use5005threads="$undef"
3373         ;;
3374 esac
3375
3376 case "$d_oldpthreads" in
3377 '')     : Configure tests would be welcome here.  For now, assume undef.
3378         val="$undef" ;;
3379 *)      val="$d_oldpthreads" ;;
3380 esac
3381 set d_oldpthreads
3382 eval $setvar
3383
3384
3385 case "$usethreads" in
3386 "$define"|true|[yY]*)
3387 : Look for a hint-file generated 'call-back-unit'.  If the
3388 : user has specified that a threading perl is to be built,
3389 : we may need to set or change some other defaults.
3390         if $test -f usethreads.cbu; then
3391                 echo "Your platform has some specific hints for threaded builds, using them..."
3392                 . ./usethreads.cbu
3393         else
3394                 $cat <<EOM
3395 (Your platform doesn't have any specific hints for threaded builds.
3396  Assuming POSIX threads, then.)
3397 EOM
3398         fi
3399         ;;
3400 esac
3401
3402 cat <<EOM
3403
3404 Perl can be built so that multiple Perl interpreters can coexist
3405 within the same Perl executable.
3406 EOM
3407
3408 case "$useithreads" in
3409 $define)
3410         cat <<EOM
3411 This multiple interpreter support is required for interpreter-based threads.
3412 EOM
3413         val="$define"
3414         ;;
3415 *)      case "$usemultiplicity" in
3416         $define|true|[yY]*)     dflt='y';;
3417         *) dflt='n';;
3418         esac
3419         echo " "
3420         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3421         rp='Build Perl for multiplicity?'
3422         . ./myread
3423         case "$ans" in
3424         y|Y)    val="$define" ;;
3425         *)      val="$undef" ;;
3426         esac
3427         ;;
3428 esac
3429 set usemultiplicity
3430 eval $setvar
3431
3432
3433 case "$usemorebits" in
3434 "$define"|true|[yY]*)
3435         use64bitint="$define"
3436         uselongdouble="$define"
3437         usemorebits="$define"
3438         ;;
3439 *)      usemorebits="$undef"
3440         ;;
3441 esac
3442
3443 : make some quick guesses about what we are up against
3444 echo " "
3445 $echo $n "Hmm...  $c"
3446 echo exit 1 >bsd
3447 echo exit 1 >usg
3448 echo exit 1 >v7
3449 echo exit 1 >osf1
3450 echo exit 1 >eunice
3451 echo exit 1 >xenix
3452 echo exit 1 >venix
3453 echo exit 1 >os2
3454 d_bsd="$undef"
3455 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3456 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3457 then
3458         echo "Looks kind of like an OSF/1 system, but we'll see..."
3459         echo exit 0 >osf1
3460 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3461         xxx=`./loc addbib blurfl $pth`
3462         if $test -f $xxx; then
3463         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3464                 echo exit 0 >bsd
3465                 echo exit 0 >usg
3466         else
3467                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3468                         echo "Looks kind of like an extended USG system, but we'll see..."
3469                 else
3470                         echo "Looks kind of like a USG system, but we'll see..."
3471                 fi
3472                 echo exit 0 >usg
3473         fi
3474 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3475         echo "Looks kind of like a BSD system, but we'll see..."
3476         d_bsd="$define"
3477         echo exit 0 >bsd
3478 else
3479         echo "Looks kind of like a Version 7 system, but we'll see..."
3480         echo exit 0 >v7
3481 fi
3482 case "$eunicefix" in
3483 *unixtovms*)
3484         $cat <<'EOI'
3485 There is, however, a strange, musty smell in the air that reminds me of
3486 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3487 EOI
3488         echo exit 0 >eunice
3489         d_eunice="$define"
3490 : it so happens the Eunice I know will not run shell scripts in Unix format
3491         ;;
3492 *)
3493         echo " "
3494         echo "Congratulations.  You aren't running Eunice."
3495         d_eunice="$undef"
3496         ;;
3497 esac
3498 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3499 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3500 : semicolon as a patch separator
3501 case "$p_" in
3502 :) ;;
3503 *)
3504         $cat <<'EOI'
3505 I have the feeling something is not exactly right, however...don't tell me...
3506 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3507 (Or you may be running DOS with DJGPP.)
3508 EOI
3509         echo exit 0 >os2
3510         ;;
3511 esac
3512 if test -f /xenix; then
3513         echo "Actually, this looks more like a XENIX system..."
3514         echo exit 0 >xenix
3515         d_xenix="$define"
3516 else
3517         echo " "
3518         echo "It's not Xenix..."
3519         d_xenix="$undef"
3520 fi
3521 chmod +x xenix
3522 $eunicefix xenix
3523 if test -f /venix; then
3524         echo "Actually, this looks more like a VENIX system..."
3525         echo exit 0 >venix
3526 else
3527         echo " "
3528         if ./xenix; then
3529                 : null
3530         else
3531                 echo "Nor is it Venix..."
3532         fi
3533 fi
3534 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3535 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3536 $rm -f foo
3537
3538 case "$cc" in
3539 '') dflt=cc;;
3540 *) dflt="$cc";;
3541 esac
3542 rp="Use which C compiler?"
3543 . ./myread
3544 cc="$ans"
3545 : Look for a hint-file generated 'call-back-unit'.  Now that the
3546 : user has specified the compiler, we may need to set or change some
3547 : other defaults.
3548 if $test -f cc.cbu; then
3549     . ./cc.cbu
3550 fi
3551 . ./checkcc
3552
3553 echo " "
3554 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3555 $cat >try.c <<EOM
3556 #include <stdio.h>
3557 int main() {
3558 #ifdef __GNUC__
3559 #ifdef __VERSION__
3560         printf("%s\n", __VERSION__);
3561 #else
3562         printf("%s\n", "1");
3563 #endif
3564 #endif
3565         exit(0);
3566 }
3567 EOM
3568 if $cc -o try $ccflags $ldflags try.c; then
3569         gccversion=`$run ./try`
3570         case "$gccversion" in
3571         '') echo "You are not using GNU cc." ;;
3572         *)  echo "You are using GNU cc $gccversion."
3573             ccname=gcc  
3574             ;;
3575         esac
3576 else
3577         echo " "
3578         echo "*** WHOA THERE!!! ***" >&4
3579         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3580         case "$knowitall" in
3581         '')
3582         echo "    You'd better start hunting for one and let me know about it." >&4
3583                 exit 1
3584                 ;;
3585         esac
3586 fi
3587 $rm -f try try.*
3588 case "$gccversion" in
3589 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3590 esac
3591 case "$gccversion" in
3592 '') gccosandvers='' ;;
3593 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3594    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3595    gccshortvers=''
3596    case "$gccosandvers" in
3597    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3598    $osname$osvers) ;; # looking good
3599    $osname*) cat <<EOM >&4
3600
3601 *** WHOA THERE!!! ***
3602
3603     Your gcc has not been compiled for the exact release of
3604     your operating system ($gccosandvers versus $osname$osvers).
3605
3606     In general it is a good idea to keep gcc synchronized with
3607     the operating system because otherwise serious problems
3608     may ensue when trying to compile software, like Perl.
3609
3610     I'm trying to be optimistic here, though, and will continue.
3611     If later during the configuration and build icky compilation
3612     problems appear (headerfile conflicts being the most common
3613     manifestation), I suggest reinstalling the gcc to match
3614     your operating system release.
3615
3616 EOM
3617       ;;
3618    *) gccosandvers='' ;; # failed to parse, better be silent
3619    esac
3620    ;;
3621 esac
3622 case "$ccname" in
3623 '') ccname="$cc" ;;
3624 esac
3625
3626
3627 : decide how portable to be.  Allow command line overrides.
3628 case "$d_portable" in
3629 "$undef") ;;
3630 *)      d_portable="$define" ;;
3631 esac
3632
3633 : set up shell script to do ~ expansion
3634 cat >filexp <<EOSS
3635 $startsh
3636 : expand filename
3637 case "\$1" in
3638  ~/*|~)
3639         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3640         ;;
3641  ~*)
3642         if $test -f /bin/csh; then
3643                 /bin/csh -f -c "glob \$1"
3644                 failed=\$?
3645                 echo ""
3646                 exit \$failed
3647         else
3648                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3649                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3650                 if $test ! -d "\$dir"; then
3651                         me=\`basename \$0\`
3652                         echo "\$me: can't locate home directory for: \$name" >&2
3653                         exit 1
3654                 fi
3655                 case "\$1" in
3656                 */*)
3657                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3658                         ;;
3659                 *)
3660                         echo \$dir
3661                         ;;
3662                 esac
3663         fi
3664         ;;
3665 *)
3666         echo \$1
3667         ;;
3668 esac
3669 EOSS
3670 chmod +x filexp
3671 $eunicefix filexp
3672
3673 : now set up to get a file name
3674 cat <<EOS >getfile
3675 $startsh
3676 EOS
3677 cat <<'EOSC' >>getfile
3678 tilde=''
3679 fullpath=''
3680 already=''
3681 skip=''
3682 none_ok=''
3683 exp_file=''
3684 nopath_ok=''
3685 orig_rp="$rp"
3686 orig_dflt="$dflt"
3687 case "$gfpth" in
3688 '') gfpth='.' ;;
3689 esac
3690
3691 case "$fn" in
3692 *\(*)
3693         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3694         fn=`echo $fn | sed 's/(.*)//'`
3695         ;;
3696 esac
3697
3698 case "$fn" in
3699 *:*)
3700         loc_file=`expr $fn : '.*:\(.*\)'`
3701         fn=`expr $fn : '\(.*\):.*'`
3702         ;;
3703 esac
3704
3705 case "$fn" in
3706 *~*) tilde=true;;
3707 esac
3708 case "$fn" in
3709 */*) fullpath=true;;
3710 esac
3711 case "$fn" in
3712 *+*) skip=true;;
3713 esac
3714 case "$fn" in
3715 *n*) none_ok=true;;
3716 esac
3717 case "$fn" in
3718 *e*) exp_file=true;;
3719 esac
3720 case "$fn" in
3721 *p*) nopath_ok=true;;
3722 esac
3723
3724 case "$fn" in
3725 *f*) type='File';;
3726 *d*) type='Directory';;
3727 *l*) type='Locate';;
3728 esac
3729
3730 what="$type"
3731 case "$what" in
3732 Locate) what='File';;
3733 esac
3734
3735 case "$exp_file" in
3736 '')
3737         case "$d_portable" in
3738         "$define") ;;
3739         *) exp_file=true;;
3740         esac
3741         ;;
3742 esac
3743
3744 cd ..
3745 while test "$type"; do
3746         redo=''
3747         rp="$orig_rp"
3748         dflt="$orig_dflt"
3749         case "$tilde" in
3750         true) rp="$rp (~name ok)";;
3751         esac
3752         . UU/myread
3753         if test -f UU/getfile.ok && \
3754                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3755         then
3756                 value="$ans"
3757                 ansexp="$ans"
3758                 break
3759         fi
3760         case "$ans" in
3761         none)
3762                 value=''
3763                 ansexp=''
3764                 case "$none_ok" in
3765                 true) type='';;
3766                 esac
3767                 ;;
3768         *)
3769                 case "$tilde" in
3770                 '') value="$ans"
3771                         ansexp="$ans";;
3772                 *)
3773                         value=`UU/filexp $ans`
3774                         case $? in
3775                         0)
3776                                 if test "$ans" != "$value"; then
3777                                         echo "(That expands to $value on this system.)"
3778                                 fi
3779                                 ;;
3780                         *) value="$ans";;
3781                         esac
3782                         ansexp="$value"
3783                         case "$exp_file" in
3784                         '') value="$ans";;
3785                         esac
3786                         ;;
3787                 esac
3788                 case "$fullpath" in
3789                 true)
3790                         case "$ansexp" in
3791                         /*) value="$ansexp" ;;
3792                         [a-zA-Z]:/*) value="$ansexp" ;;
3793                         *)
3794                                 redo=true
3795                                 case "$already" in
3796                                 true)
3797                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3798                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3799                                         ;;
3800                                 *)
3801                                 echo "Please give a full path name, starting with slash." >&4
3802                                         case "$tilde" in
3803                                         true)
3804                                 echo "Note that using ~name is ok provided it expands well." >&4
3805                                                 already=true
3806                                                 ;;
3807                                         esac
3808                                 esac
3809                                 ;;
3810                         esac
3811                         ;;
3812                 esac
3813                 case "$redo" in
3814                 '')
3815                         case "$type" in
3816                         File)
3817                                 for fp in $gfpth; do
3818                                         if test "X$fp" = X.; then
3819                                             pf="$ansexp"
3820                                         else    
3821                                             pf="$fp/$ansexp"
3822                                         fi
3823                                         if test -f "$pf"; then
3824                                                 type=''
3825                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3826                                         then
3827                                                 echo "($value is not a plain file, but that's ok.)"
3828                                                 type=''
3829                                         fi
3830                                         if test X"$type" = X; then
3831                                             value="$pf"
3832                                             break
3833                                         fi
3834                                 done
3835                                 ;;
3836                         Directory)
3837                                 for fp in $gfpth; do
3838                                         if test "X$fp" = X.; then
3839                                             dir="$ans"
3840                                             direxp="$ansexp"
3841                                         else    
3842                                             dir="$fp/$ansexp"
3843                                             direxp="$fp/$ansexp"
3844                                         fi
3845                                         if test -d "$direxp"; then
3846                                                 type=''
3847                                                 value="$dir"
3848                                                 break
3849                                         fi
3850                                 done
3851                                 ;;
3852                         Locate)
3853                                 if test -d "$ansexp"; then
3854                                         echo "(Looking for $loc_file in directory $value.)"
3855                                         value="$value/$loc_file"
3856                                         ansexp="$ansexp/$loc_file"
3857                                 fi
3858                                 if test -f "$ansexp"; then
3859                                         type=''
3860                                 fi
3861                                 case "$nopath_ok" in
3862                                 true)   case "$value" in
3863                                         */*) ;;
3864                                         *)      echo "Assuming $value will be in people's path."
3865                                                 type=''
3866                                                 ;;
3867                                         esac
3868                                         ;;
3869                                 esac
3870                                 ;;
3871                         esac
3872
3873                         case "$skip" in
3874                         true) type='';
3875                         esac
3876
3877                         case "$type" in
3878                         '') ;;
3879                         *)
3880                                 if test "$fastread" = yes; then
3881                                         dflt=y
3882                                 else
3883                                         dflt=n
3884                                 fi
3885                                 rp="$what $value doesn't exist.  Use that name anyway?"
3886                                 . UU/myread
3887                                 dflt=''
3888                                 case "$ans" in
3889                                 y*) type='';;
3890                                 *) echo " ";;
3891                                 esac
3892                                 ;;
3893                         esac
3894                         ;;
3895                 esac
3896                 ;;
3897         esac
3898 done
3899 cd UU
3900 ans="$value"
3901 rp="$orig_rp"
3902 dflt="$orig_dflt"
3903 rm -f getfile.ok
3904 test "X$gfpthkeep" != Xy && gfpth=""
3905 EOSC
3906
3907 : What should the include directory be ?
3908 echo " "
3909 $echo $n "Hmm...  $c"
3910 dflt='/usr/include'
3911 incpath=''
3912 mips_type=''
3913 if $test -f /bin/mips && /bin/mips; then
3914         echo "Looks like a MIPS system..."
3915         $cat >usr.c <<'EOCP'
3916 #ifdef SYSTYPE_BSD43
3917 /bsd43
3918 #endif
3919 EOCP
3920         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3921                 dflt='/bsd43/usr/include'
3922                 incpath='/bsd43'
3923                 mips_type='BSD 4.3'
3924         else
3925                 mips_type='System V'
3926         fi
3927         $rm -f usr.c usr.out
3928         echo "and you're compiling with the $mips_type compiler and libraries."
3929         xxx_prompt=y
3930         echo "exit 0" >mips
3931 else
3932         echo "Doesn't look like a MIPS system."
3933         xxx_prompt=n
3934         echo "exit 1" >mips
3935 fi
3936 chmod +x mips
3937 $eunicefix mips
3938 case "$usrinc" in
3939 '') ;;
3940 *) dflt="$usrinc";;
3941 esac
3942 case "$xxx_prompt" in
3943 y)      fn=d/
3944         echo " "
3945         rp='Where are the include files you want to use?'
3946         . ./getfile
3947         usrinc="$ans"
3948         ;;
3949 *)      usrinc="$dflt"
3950         ;;
3951 esac
3952
3953 : see how we invoke the C preprocessor
3954 echo " "
3955 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3956 cat <<'EOT' >testcpp.c
3957 #define ABC abc
3958 #define XYZ xyz
3959 ABC.XYZ
3960 EOT
3961 cd ..
3962 if test ! -f cppstdin; then
3963         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3964                 # AIX cc -E doesn't show the absolute headerfile
3965                 # locations but we'll cheat by using the -M flag.
3966                 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
3967         else
3968                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3969         fi
3970 else
3971         echo "Keeping your $hint cppstdin wrapper."
3972 fi
3973 chmod 755 cppstdin
3974 wrapper=`pwd`/cppstdin
3975 ok='false'
3976 cd UU
3977
3978 if $test "X$cppstdin" != "X" && \
3979         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3980         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3981 then
3982         echo "You used to use $cppstdin $cppminus so we'll use that again."
3983         case "$cpprun" in
3984         '') echo "But let's see if we can live without a wrapper..." ;;
3985         *)
3986                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3987                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3988                 then
3989                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3990                         ok='true'
3991                 else
3992                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3993                 fi
3994                 ;;
3995         esac
3996 else
3997         case "$cppstdin" in
3998         '') ;;
3999         *)
4000                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4001                 ;;
4002         esac
4003 fi
4004
4005 if $ok; then
4006         : nothing
4007 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4008         $cc -E <testcpp.c >testcpp.out 2>&1; \
4009         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4010         echo "Yup, it does."
4011         x_cpp="$cc -E"
4012         x_minus='';
4013 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4014         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4015         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4016         echo "Yup, it does."
4017         x_cpp="$cc -E"
4018         x_minus='-';
4019 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4020         $cc -P <testcpp.c >testcpp.out 2>&1; \
4021         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4022         echo "Yipee, that works!"
4023         x_cpp="$cc -P"
4024         x_minus='';
4025 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4026         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4027         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4028         echo "At long last!"
4029         x_cpp="$cc -P"
4030         x_minus='-';
4031 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4032         $cpp <testcpp.c >testcpp.out 2>&1; \
4033         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4034         echo "It works!"
4035         x_cpp="$cpp"
4036         x_minus='';
4037 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4038         $cpp - <testcpp.c >testcpp.out 2>&1; \
4039         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4040         echo "Hooray, it works!  I was beginning to wonder."
4041         x_cpp="$cpp"
4042         x_minus='-';
4043 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4044         $wrapper <testcpp.c >testcpp.out 2>&1; \
4045         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4046         x_cpp="$wrapper"
4047         x_minus=''
4048         echo "Eureka!"
4049 else
4050         dflt=''
4051         rp="No dice.  I can't find a C preprocessor.  Name one:"
4052         . ./myread
4053         x_cpp="$ans"
4054         x_minus=''
4055         $x_cpp <testcpp.c >testcpp.out 2>&1
4056         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4057                 echo "OK, that will do." >&4
4058         else
4059 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4060                 exit 1
4061         fi
4062 fi
4063
4064 case "$ok" in
4065 false)
4066         cppstdin="$x_cpp"
4067         cppminus="$x_minus"
4068         cpprun="$x_cpp"
4069         cpplast="$x_minus"
4070         set X $x_cpp
4071         shift
4072         case "$1" in
4073         "$cpp")
4074                 echo "Perhaps can we force $cc -E using a wrapper..."
4075                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4076                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4077                 then
4078                         echo "Yup, we can."
4079                         cppstdin="$wrapper"
4080                         cppminus='';
4081                 else
4082                         echo "Nope, we'll have to live without it..."
4083                 fi
4084                 ;;
4085         esac
4086         case "$cpprun" in
4087         "$wrapper")
4088                 cpprun=''
4089                 cpplast=''
4090                 ;;
4091         esac
4092         ;;
4093 esac
4094
4095 case "$cppstdin" in
4096 "$wrapper"|'cppstdin') ;;
4097 *) $rm -f $wrapper;;
4098 esac
4099 $rm -f testcpp.c testcpp.out
4100
4101 : Set private lib path
4102 case "$plibpth" in
4103 '') if ./mips; then
4104                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4105         fi;;
4106 esac
4107 case "$libpth" in
4108 ' ') dlist='';;
4109 '') dlist="$loclibpth $plibpth $glibpth";;
4110 *) dlist="$libpth";;
4111 esac
4112
4113 : Now check and see which directories actually exist, avoiding duplicates
4114 libpth=''
4115 for xxx in $dlist
4116 do
4117     if $test -d $xxx; then
4118                 case " $libpth " in
4119                 *" $xxx "*) ;;
4120                 *) libpth="$libpth $xxx";;
4121                 esac
4122     fi
4123 done
4124 $cat <<'EOM'
4125
4126 Some systems have incompatible or broken versions of libraries.  Among
4127 the directories listed in the question below, please remove any you
4128 know not to be holding relevant libraries, and add any that are needed.
4129 Say "none" for none.
4130
4131 EOM
4132 case "$libpth" in
4133 '') dflt='none';;
4134 *)
4135         set X $libpth
4136         shift
4137         dflt=${1+"$@"}
4138         ;;
4139 esac
4140 rp="Directories to use for library searches?"
4141 . ./myread
4142 case "$ans" in
4143 none) libpth=' ';;
4144 *) libpth="$ans";;
4145 esac
4146
4147 : compute shared library extension
4148 case "$so" in
4149 '')
4150         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4151                 dflt='sl'
4152         else
4153                 dflt='so'
4154         fi
4155         ;;
4156 *) dflt="$so";;
4157 esac
4158 $cat <<EOM
4159
4160 On some systems, shared libraries may be available.  Answer 'none' if
4161 you want to suppress searching of shared libraries for the remainder
4162 of this configuration.
4163
4164 EOM
4165 rp='What is the file extension used for shared libraries?'
4166 . ./myread
4167 so="$ans"
4168
4169 : Define several unixisms.
4170 : Hints files or command line option can be used to override them.
4171 : The convoluted testing is in case hints files set either the old
4172 : or the new name.
4173 case "$_exe" in
4174 '')     case "$exe_ext" in
4175         '')     ;;
4176         *)      _exe="$exe_ext" ;;
4177         esac
4178         ;;
4179 esac
4180 case "$_a" in
4181 '')     case "$lib_ext" in
4182     '') _a='.a';;
4183         *)      _a="$lib_ext" ;;
4184         esac
4185         ;;
4186 esac
4187 case "$_o" in
4188 '') case "$obj_ext" in
4189         '')     _o='.o';;
4190         *)      _o="$obj_ext";;
4191         esac
4192         ;;
4193 esac
4194 case "$p_" in
4195 '') case "$path_sep" in
4196         '')     p_=':';;
4197         *)      p_="$path_sep";;
4198         esac
4199         ;;
4200 esac
4201 exe_ext=$_exe
4202 lib_ext=$_a
4203 obj_ext=$_o
4204 path_sep=$p_
4205
4206 : Which makefile gets called first.  This is used by make depend.
4207 case "$firstmakefile" in
4208 '') firstmakefile='makefile';;
4209 esac
4210
4211 case "$usesocks" in
4212 $define|true|[yY]*)     dflt='y';;
4213 *) dflt='n';;
4214 esac
4215 cat <<EOM
4216
4217 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4218 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4219 to use the PerlIO abstraction layer, this will be implicitly selected.
4220
4221 If this doesn't make any sense to you, just accept the default '$dflt'.
4222 EOM
4223 rp='Build Perl for SOCKS?'
4224 . ./myread
4225 case "$ans" in
4226 y|Y)    val="$define" ;;     
4227 *)      val="$undef" ;;
4228 esac
4229 set usesocks
4230 eval $setvar
4231
4232 case "$usesocks" in
4233 $define|true|[yY]*) useperlio="$define";;
4234 esac
4235
4236 : Looking for optional libraries
4237 echo " "
4238 echo "Checking for optional libraries..." >&4
4239 case "$libs" in
4240 ' '|'') dflt='';;
4241 *) dflt="$libs";;
4242 esac
4243 case "$libswanted" in
4244 '') libswanted='c_s';;
4245 esac
4246 case "$usesocks" in
4247 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4248 esac
4249 libsfound=''
4250 libsfiles=''
4251 libsdirs=''
4252 libspath=''
4253 for thisdir in $libpth $xlibpth; do
4254   test -d $thisdir && libspath="$libspath $thisdir"
4255 done
4256 for thislib in $libswanted; do
4257         for thisdir in $libspath; do
4258             xxx=''
4259             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4260                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
4261                 $test -f "$xxx" && eval $libscheck
4262                 $test -f "$xxx" && libstyle=shared
4263             fi
4264             if test ! -f "$xxx"; then
4265                 xxx=$thisdir/lib$thislib.$so
4266                 $test -f "$xxx" && eval $libscheck
4267                 $test -f "$xxx" && libstyle=shared
4268             fi  
4269             if test ! -f "$xxx"; then
4270                 xxx=$thisdir/lib$thislib$_a
4271                 $test -f "$xxx" && eval $libscheck
4272                 $test -f "$xxx" && libstyle=static
4273             fi
4274             if test ! -f "$xxx"; then
4275                 xxx=$thisdir/$thislib$_a
4276                 $test -f "$xxx" && eval $libscheck
4277                 $test -f "$xxx" && libstyle=static
4278             fi
4279             if test ! -f "$xxx"; then
4280                 xxx=$thisdir/lib${thislib}_s$_a
4281                 $test -f "$xxx" && eval $libscheck
4282                 $test -f "$xxx" && libstyle=static
4283                 $test -f "$xxx" && thislib=${thislib}_s
4284             fi
4285             if test ! -f "$xxx"; then
4286                 xxx=$thisdir/Slib$thislib$_a
4287                 $test -f "$xxx" && eval $libscheck
4288                 $test -f "$xxx" && libstyle=static
4289             fi
4290             if $test -f "$xxx"; then
4291                 case "$libstyle" in
4292                 shared) echo "Found -l$thislib (shared)." ;;
4293                 static) echo "Found -l$thislib." ;;
4294                 *)      echo "Found -l$thislib ($libstyle)." ;;
4295                 esac
4296                 case " $dflt " in
4297                 *"-l$thislib "*);;
4298                 *) dflt="$dflt -l$thislib"
4299                    libsfound="$libsfound $xxx"
4300                    yyy=`basename $xxx`
4301                    libsfiles="$libsfiles $yyy"
4302                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4303                    case " $libsdirs " in
4304                    *" $yyy "*) ;;
4305                    *) libsdirs="$libsdirs $yyy" ;;
4306                    esac
4307                    ;;
4308                 esac
4309                 break
4310             fi  
4311         done
4312         if $test ! -f "$xxx"; then
4313             echo "No -l$thislib."
4314         fi
4315 done
4316 set X $dflt
4317 shift
4318 dflt="$*"
4319 case "$libs" in
4320 '') dflt="$dflt";;
4321 *) dflt="$libs";;
4322 esac
4323 case "$dflt" in
4324 ' '|'') dflt='none';;
4325 esac
4326
4327 $cat <<EOM
4328
4329 In order to compile $package on your machine, a number of libraries
4330 are usually needed.  Include any other special libraries here as well.
4331 Say "none" for none.  The default list is almost always right.
4332 EOM
4333
4334 echo " "
4335 rp="What libraries to use?"
4336 . ./myread
4337 case "$ans" in
4338 none) libs=' ';;
4339 *) libs="$ans";;
4340 esac
4341
4342 : determine optimization, if desired, or use for debug flag also
4343 case "$optimize" in
4344 ' '|$undef) dflt='none';;
4345 '') dflt='-O';;
4346 *) dflt="$optimize";;
4347 esac
4348 $cat <<EOH
4349
4350 By default, $package compiles with the -O flag to use the optimizer.
4351 Alternately, you might want to use the symbolic debugger, which uses
4352 the -g flag (on traditional Unix systems).  Either flag can be
4353 specified here.  To use neither flag, specify the word "none".
4354
4355 EOH
4356 rp="What optimizer/debugger flag should be used?"
4357 . ./myread
4358 optimize="$ans"
4359 case "$optimize" in
4360 'none') optimize=" ";;
4361 esac
4362
4363 dflt=''
4364 : We will not override a previous value, but we might want to
4365 : augment a hint file
4366 case "$hint" in
4367 default|recommended)
4368         case "$gccversion" in
4369         1*) dflt='-fpcc-struct-return' ;;
4370         esac
4371         case "$optimize" in
4372         *-g*) dflt="$dflt -DDEBUGGING";;
4373         esac
4374         case "$gccversion" in
4375         2*) if test -d /etc/conf/kconfig.d &&
4376                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4377                 then
4378                         dflt="$dflt -posix"
4379                 fi
4380                 ;;
4381         esac
4382         case "$gccversion" in
4383         1*) ;;
4384         2.[0-8]*) ;;
4385         ?*)     echo " "
4386                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4387                 echo 'int main(void) { return 0; }' > gcctest.c
4388                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4389                         echo "Yes, it does." 2>&1
4390                         case "$ccflags" in
4391                         *strict-aliasing*) 
4392                                 echo "Leaving current flags $ccflags alone." 2>&1
4393                                 ;;
4394                         *) dflt="$dflt -fno-strict-aliasing" ;;
4395                         esac
4396                 else
4397                         echo "Nope, it doesn't, but that's ok." 2>&1
4398                 fi
4399                 ;;
4400         esac
4401         ;;
4402 esac
4403
4404 case "$mips_type" in
4405 *BSD*|'') inclwanted="$locincpth $usrinc";;
4406 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4407 esac
4408 for thisincl in $inclwanted; do
4409         if $test -d $thisincl; then
4410                 if $test x$thisincl != x$usrinc; then
4411                         case "$dflt" in
4412                         *" -I$thisincl "*);;
4413                         *) dflt="$dflt -I$thisincl ";;
4414                         esac
4415                 fi
4416         fi
4417 done
4418
4419 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4420         xxx=true;
4421 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4422         xxx=true;
4423 else
4424         xxx=false;
4425 fi;
4426 if $xxx; then
4427         case "$dflt" in
4428         *$2*);;
4429         *) dflt="$dflt -D$2";;
4430         esac;
4431 fi'
4432
4433 set signal.h LANGUAGE_C; eval $inctest
4434
4435 case "$usesocks" in
4436 $define)
4437         ccflags="$ccflags -DSOCKS"
4438         ;;
4439 esac
4440
4441 case "$hint" in
4442 default|recommended) dflt="$ccflags $dflt" ;;
4443 *) dflt="$ccflags";;
4444 esac
4445
4446 case "$dflt" in
4447 ''|' ') dflt=none;;
4448 esac
4449
4450 $cat <<EOH
4451
4452 Your C compiler may want other flags.  For this question you should include
4453 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4454 but you should NOT include libraries or ld flags like -lwhatever.  If you
4455 want $package to honor its debug switch, you should include -DDEBUGGING here.
4456 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4457
4458 To use no flags, specify the word "none".
4459
4460 EOH
4461 set X $dflt
4462 shift
4463 dflt=${1+"$@"}
4464 rp="Any additional cc flags?"
4465 . ./myread
4466 case "$ans" in
4467 none) ccflags='';;
4468 *) ccflags="$ans";;
4469 esac
4470
4471 : the following weeds options from ccflags that are of no interest to cpp
4472 case "$cppflags" in
4473 '') cppflags="$ccflags" ;;
4474 *)  cppflags="$cppflags $ccflags" ;;
4475 esac
4476 case "$gccversion" in
4477 1*) cppflags="$cppflags -D__GNUC__"
4478 esac
4479 case "$mips_type" in
4480 '');;
4481 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4482 esac
4483 case "$cppflags" in
4484 '');;
4485 *)
4486         echo " "
4487         echo "Let me guess what the preprocessor flags are..." >&4
4488         set X $cppflags
4489         shift
4490         cppflags=''
4491         $cat >cpp.c <<'EOM'
4492 #define BLURFL foo
4493
4494 BLURFL xx LFRULB
4495 EOM
4496         previous=''
4497         for flag in $*
4498         do
4499                 case "$flag" in
4500                 -*) ftry="$flag";;
4501                 *) ftry="$previous $flag";;
4502                 esac
4503                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4504                         >cpp1.out 2>/dev/null && \
4505                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4506                         >cpp2.out 2>/dev/null && \
4507                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4508                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4509                 then
4510                         cppflags="$cppflags $ftry"
4511                         previous=''
4512                 else
4513                         previous="$flag"
4514                 fi
4515         done
4516         set X $cppflags
4517         shift
4518         cppflags=${1+"$@"}
4519         case "$cppflags" in
4520         *-*)  echo "They appear to be: $cppflags";;
4521         esac
4522         $rm -f cpp.c cpp?.out
4523         ;;
4524 esac
4525
4526 : flags used in final linking phase
4527 case "$ldflags" in
4528 '') if ./venix; then
4529                 dflt='-i -z'
4530         else
4531                 dflt=''
4532         fi
4533         case "$ccflags" in
4534         *-posix*) dflt="$dflt -posix" ;;
4535         esac
4536         ;;
4537 *) dflt="$ldflags";;
4538 esac
4539
4540 : Try to guess additional flags to pick up local libraries.
4541 for thislibdir in $libpth; do
4542         case " $loclibpth " in
4543         *" $thislibdir "*)
4544                 case "$dflt " in 
4545                 *"-L$thislibdir "*) ;;
4546                 *)  dflt="$dflt -L$thislibdir" ;;
4547                 esac
4548                 ;;
4549         esac
4550 done
4551
4552 case "$dflt" in
4553 '') dflt='none' ;;
4554 esac
4555
4556 $cat <<EOH
4557
4558 Your C linker may need flags.  For this question you should
4559 include -L/whatever and any other flags used by the C linker, but you
4560 should NOT include libraries like -lwhatever.
4561
4562 Make sure you include the appropriate -L/path flags if your C linker
4563 does not normally search all of the directories you specified above,
4564 namely
4565         $libpth
4566 To use no flags, specify the word "none".
4567
4568 EOH
4569
4570 rp="Any additional ld flags (NOT including libraries)?"
4571 . ./myread
4572 case "$ans" in
4573 none) ldflags='';;
4574 *) ldflags="$ans";;
4575 esac
4576 rmlist="$rmlist pdp11"
4577
4578 : coherency check
4579 echo " "
4580 echo "Checking your choice of C compiler and flags for coherency..." >&4
4581 $cat > try.c <<'EOF'
4582 #include <stdio.h>
4583 int main() { printf("Ok\n"); exit(0); }
4584 EOF
4585 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4586 shift
4587 $cat >try.msg <<'EOM'
4588 I've tried to compile and run the following simple program:
4589
4590 EOM
4591 $cat try.c >> try.msg
4592
4593 $cat >> try.msg <<EOM
4594
4595 I used the command:
4596
4597         $*
4598         $run ./try
4599
4600 and I got the following output:
4601
4602 EOM
4603 dflt=y
4604 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4605         if $sh -c "$run ./try" >>try.msg 2>&1; then
4606                 xxx=`$run ./try`
4607                 case "$xxx" in
4608                 "Ok") dflt=n ;;
4609                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4610                         case " $libs " in
4611                         *" -lsfio "*)
4612                                 cat >> try.msg <<'EOQS'
4613 If $libs contains -lsfio, and sfio is mis-configured, then it
4614 sometimes (apparently) runs and exits with a 0 status, but with no
4615 output!  It may have to do with sfio's use of _exit vs. exit.
4616
4617 EOQS
4618                                 rp="You have a big problem.  Shall I abort Configure"
4619                                 dflt=y
4620                                 ;;
4621                         esac
4622                         ;;
4623                 esac
4624         else
4625                 echo "The program compiled OK, but exited with status $?." >>try.msg
4626                 rp="You have a problem.  Shall I abort Configure"
4627                 dflt=y
4628         fi
4629 else
4630         echo "I can't compile the test program." >>try.msg
4631         rp="You have a BIG problem.  Shall I abort Configure"
4632         dflt=y
4633 fi
4634 case "$dflt" in
4635 y)
4636         $cat try.msg >&4
4637         case "$knowitall" in
4638         '')
4639                 echo "(The supplied flags or libraries might be incorrect.)"
4640                 ;;
4641         *) dflt=n;;
4642         esac
4643         echo " "
4644         . ./myread
4645         case "$ans" in
4646         n*|N*) ;;
4647         *)      echo "Ok.  Stopping Configure." >&4
4648                 exit 1
4649                 ;;
4650         esac
4651         ;;
4652 n) echo "OK, that should do.";;
4653 esac
4654 $rm -f try try.* core
4655
4656 : define a shorthand compile call
4657 compile='
4658 mc_file=$1;
4659 shift;
4660 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4661 : define a shorthand compile call for compilations that should be ok.
4662 compile_ok='
4663 mc_file=$1;
4664 shift;
4665 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4666
4667 : check for lengths of integral types
4668 echo " "
4669 case "$intsize" in
4670 '')
4671         echo "Checking to see how big your integers are..." >&4
4672         $cat >try.c <<'EOCP'
4673 #include <stdio.h>
4674 int main()
4675 {
4676         printf("intsize=%d;\n", (int)sizeof(int));
4677         printf("longsize=%d;\n", (int)sizeof(long));
4678         printf("shortsize=%d;\n", (int)sizeof(short));
4679         exit(0);
4680 }
4681 EOCP
4682         set try
4683         if eval $compile_ok && $run ./try > /dev/null; then
4684                 eval `$run ./try`
4685                 echo "Your integers are $intsize bytes long."
4686                 echo "Your long integers are $longsize bytes long."
4687                 echo "Your short integers are $shortsize bytes long."
4688         else
4689                 $cat >&4 <<EOM
4690 !
4691 Help! I can't compile and run the intsize test program: please enlighten me!
4692 (This is probably a misconfiguration in your system or libraries, and
4693 you really ought to fix it.  Still, I'll try anyway.)
4694 !
4695 EOM
4696                 dflt=4
4697                 rp="What is the size of an integer (in bytes)?"
4698                 . ./myread
4699                 intsize="$ans"
4700                 dflt=$intsize
4701                 rp="What is the size of a long integer (in bytes)?"
4702                 . ./myread
4703                 longsize="$ans"
4704                 dflt=2
4705                 rp="What is the size of a short integer (in bytes)?"
4706                 . ./myread
4707                 shortsize="$ans"
4708         fi
4709         ;;
4710 esac
4711 $rm -f try try.*
4712
4713 : check for void type
4714 echo " "
4715 echo "Checking to see how well your C compiler groks the void type..." >&4
4716 case "$voidflags" in
4717 '')
4718         $cat >try.c <<'EOCP'
4719 #if TRY & 1
4720 void sub() {
4721 #else
4722 sub() {
4723 #endif
4724         extern void moo();      /* function returning void */
4725         void (*goo)();          /* ptr to func returning void */
4726 #if TRY & 8
4727         void *hue;              /* generic ptr */
4728 #endif
4729 #if TRY & 2
4730         void (*foo[10])();
4731 #endif
4732
4733 #if TRY & 4
4734         if(goo == moo) {
4735                 exit(0);
4736         }
4737 #endif
4738         exit(0);
4739 }
4740 int main() { sub(); }
4741 EOCP
4742         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4743                 voidflags=$defvoidused
4744         echo "Good.  It appears to support void to the level $package wants.">&4
4745                 if $contains warning .out >/dev/null 2>&1; then
4746                         echo "However, you might get some warnings that look like this:"
4747                         $cat .out
4748                 fi
4749         else
4750 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4751                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4752                         echo "It supports 1..."
4753                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4754                                 echo "It also supports 2..."
4755                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4756                                         voidflags=7
4757                                         echo "And it supports 4 but not 8 definitely."
4758                                 else
4759                                         echo "It doesn't support 4..."
4760                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4761                                                 voidflags=11
4762                                                 echo "But it supports 8."
4763                                         else
4764                                                 voidflags=3
4765                                                 echo "Neither does it support 8."
4766                                         fi
4767                                 fi
4768                         else
4769                                 echo "It does not support 2..."
4770                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4771                                         voidflags=13
4772                                         echo "But it supports 4 and 8."
4773                                 else
4774                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4775                                                 voidflags=5
4776                                                 echo "And it supports 4 but has not heard about 8."
4777                                         else
4778                                                 echo "However it supports 8 but not 4."
4779                                         fi
4780                                 fi
4781                         fi
4782                 else
4783                         echo "There is no support at all for void."
4784                         voidflags=0
4785                 fi
4786         fi
4787 esac
4788 case "$voidflags" in
4789 "$defvoidused") ;;
4790 *)      $cat >&4 <<'EOM'
4791   Support flag bits are:
4792     1: basic void declarations.
4793     2: arrays of pointers to functions returning void.
4794     4: operations between pointers to and addresses of void functions.
4795     8: generic void pointers.
4796 EOM
4797         dflt="$voidflags";
4798         rp="Your void support flags add up to what?"
4799         . ./myread
4800         voidflags="$ans"
4801         ;;
4802 esac
4803 $rm -f try.* .out
4804
4805 : check for length of pointer
4806 echo " "
4807 case "$ptrsize" in
4808 '')
4809         echo "Checking to see how big your pointers are..." >&4
4810         if test "$voidflags" -gt 7; then
4811                 echo '#define VOID_PTR char *' > try.c
4812         else
4813                 echo '#define VOID_PTR void *' > try.c
4814         fi
4815         $cat >>try.c <<'EOCP'
4816 #include <stdio.h>
4817 int main()
4818 {
4819     printf("%d\n", (int)sizeof(VOID_PTR));
4820     exit(0);
4821 }
4822 EOCP
4823         set try
4824         if eval $compile_ok; then
4825                 ptrsize=`$run ./try`
4826                 echo "Your pointers are $ptrsize bytes long."
4827         else
4828                 dflt='4'
4829                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4830                 rp="What is the size of a pointer (in bytes)?"
4831                 . ./myread
4832                 ptrsize="$ans"
4833         fi
4834         ;;
4835 esac
4836 $rm -f try.c try
4837
4838 : check for long long
4839 echo " "
4840 echo "Checking to see if you have long long..." >&4
4841 echo 'int main() { long long x = 7; return 0; }' > try.c
4842 set try
4843 if eval $compile; then
4844         val="$define"
4845         echo "You have long long."
4846 else
4847         val="$undef"
4848         echo "You do not have long long."
4849 fi
4850 $rm try.*
4851 set d_longlong
4852 eval $setvar
4853
4854 : check for length of long long
4855 case "${d_longlong}${longlongsize}" in
4856 $define)
4857         echo " "
4858         echo "Checking to see how big your long longs are..." >&4
4859         $cat >try.c <<'EOCP'
4860 #include <stdio.h>
4861 int main()
4862 {
4863     printf("%d\n", (int)sizeof(long long));
4864     return(0);
4865 }
4866 EOCP
4867         set try
4868         if eval $compile_ok; then
4869                 longlongsize=`$run ./try`
4870                 echo "Your long longs are $longlongsize bytes long."
4871         else
4872                 dflt='8'
4873                 echo " "
4874                 echo "(I can't seem to compile the test program.  Guessing...)"
4875                 rp="What is the size of a long long (in bytes)?"
4876                 . ./myread
4877                 longlongsize="$ans"
4878         fi
4879         if $test "X$longsize" = "X$longlongsize"; then
4880                 echo "(That isn't any different from an ordinary long.)"
4881         fi      
4882         ;;
4883 esac
4884 $rm -f try.* try
4885
4886 : determine filename position in cpp output
4887 echo " "
4888 echo "Computing filename position in cpp output for #include directives..." >&4
4889 case "$osname" in
4890 vos) testaccess=-e ;;
4891 *)   testaccess=-r ;;
4892 esac
4893 echo '#include <stdio.h>' > foo.c
4894 $cat >fieldn <<EOF
4895 $startsh
4896 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4897 $grep '^[       ]*#.*stdio\.h' | \
4898 while read cline; do
4899         pos=1
4900         set \$cline
4901         while $test \$# -gt 0; do
4902                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4903                         echo "\$pos"
4904                         exit 0
4905                 fi
4906                 shift
4907                 pos=\`expr \$pos + 1\`
4908         done
4909 done
4910 EOF
4911 chmod +x fieldn
4912 fieldn=`./fieldn`
4913 $rm -f foo.c fieldn
4914 case $fieldn in
4915 '') pos='???';;
4916 1) pos=first;;
4917 2) pos=second;;
4918 3) pos=third;;
4919 *) pos="${fieldn}th";;
4920 esac
4921 echo "Your cpp writes the filename in the $pos field of the line."
4922
4923 case "$osname" in
4924 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4925 *)   cppfilter='' ;;
4926 esac
4927 : locate header file
4928 $cat >findhdr <<EOF
4929 $startsh
4930 wanted=\$1
4931 name=''
4932 for usrincdir in $usrinc
4933 do
4934         if test -f \$usrincdir/\$wanted; then
4935                 echo "\$usrincdir/\$wanted"
4936                 exit 0
4937         fi
4938 done
4939 awkprg='{ print \$$fieldn }'
4940 echo "#include <\$wanted>" > foo\$\$.c
4941 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4942 $cppfilter $grep "^[    ]*#.*\$wanted" | \
4943 while read cline; do
4944         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4945         case "\$name" in
4946         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4947         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4948         *) exit 2;;
4949         esac;
4950 done;
4951 #
4952 # status = 0: grep returned 0 lines, case statement not executed
4953 # status = 1: headerfile found
4954 # status = 2: while loop executed, no headerfile found
4955 #
4956 status=\$?
4957 $rm -f foo\$\$.c;
4958 if test \$status -eq 1; then
4959         exit 0;
4960 fi
4961 exit 1
4962 EOF
4963 chmod +x findhdr
4964
4965 : define an alternate in-header-list? function
4966 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4967 cont=true; xxf="echo \"<\$1> found.\" >&4";
4968 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4969 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4970 esac;
4971 case $# in 4) instead=instead;; *) instead="at last";; esac;
4972 while $test "$cont"; do
4973         xxx=`./findhdr $1`
4974         var=$2; eval "was=\$$2";
4975         if $test "$xxx" && $test -r "$xxx";
4976         then eval $xxf;
4977         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4978                 cont="";
4979         else eval $xxnf;
4980         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4981         set $yyy; shift; shift; yyy=$@;
4982         case $# in 0) cont="";;
4983         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4984                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4985         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4986                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4987         esac;
4988 done;
4989 while $test "$yyy";
4990 do set $yyy; var=$2; eval "was=\$$2";
4991         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4992         set $yyy; shift; shift; yyy=$@;
4993 done'
4994
4995 : see if inttypes.h is available
4996 : we want a real compile instead of Inhdr because some systems
4997 : have an inttypes.h which includes non-existent headers
4998 echo " "
4999 $cat >try.c <<EOCP
5000 #include <inttypes.h>
5001 int main() {
5002         static int32_t foo32 = 0x12345678;
5003 }
5004 EOCP
5005 set try
5006 if eval $compile; then
5007         echo "<inttypes.h> found." >&4
5008         val="$define"
5009 else
5010         echo "<inttypes.h> NOT found." >&4
5011         val="$undef"
5012 fi
5013 $rm -f try.c try
5014 set i_inttypes
5015 eval $setvar
5016
5017 : check for int64_t
5018 echo " "
5019 echo "Checking to see if you have int64_t..." >&4
5020 $cat >try.c <<EOCP
5021 #include <sys/types.h>
5022 #$i_inttypes I_INTTYPES
5023 #ifdef I_INTTYPES
5024 #include <inttypes.h>
5025 #endif
5026 int main() { int64_t x = 7; }
5027 EOCP
5028 set try
5029 if eval $compile; then
5030         val="$define"
5031         echo "You have int64_t."
5032 else
5033         val="$undef"
5034         echo "You do not have int64_t."
5035 fi
5036 $rm -f try try.*
5037 set d_int64_t
5038 eval $setvar
5039
5040
5041 echo " "
5042 echo "Checking which 64-bit integer type we could use..." >&4
5043
5044 case "$intsize" in
5045 8) val=int
5046    set quadtype
5047    eval $setvar
5048    val='"unsigned int"'
5049    set uquadtype
5050    eval $setvar
5051    quadkind=1
5052    ;;
5053 *) case "$longsize" in
5054    8) val=long
5055       set quadtype
5056       eval $setvar
5057       val='"unsigned long"'
5058       set uquadtype
5059       eval $setvar
5060       quadkind=2
5061       ;;
5062    *) case "$d_longlong:$longlongsize" in
5063       define:8)
5064         val='"long long"'
5065         set quadtype
5066         eval $setvar
5067         val='"unsigned long long"'
5068         set uquadtype
5069         eval $setvar
5070         quadkind=3
5071         ;;
5072       *) case "$d_int64_t" in
5073          define)
5074            val=int64_t
5075            set quadtype
5076            eval $setvar
5077            val=uint64_t
5078            set uquadtype
5079            eval $setvar
5080            quadkind=4
5081            ;;
5082          esac
5083          ;;
5084       esac
5085       ;;
5086    esac
5087    ;;
5088 esac
5089
5090 case "$quadtype" in
5091 '')     echo "Alas, no 64-bit integer types in sight." >&4
5092         d_quad="$undef"
5093         ;;
5094 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5095         d_quad="$define"
5096         ;;
5097 esac
5098
5099
5100 case "$uselonglong" in
5101 "$define"|true|[yY]*)
5102         cat <<EOM >&4
5103
5104 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5105 EOM
5106         use64bitint="$define"
5107         ;;
5108 esac                          
5109 case "$use64bits" in
5110 "$define"|true|[yY]*)
5111         cat <<EOM >&4
5112
5113 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5114 EOM
5115         use64bitint="$define"
5116         ;;
5117 esac                          
5118 case "$use64bitints" in
5119 "$define"|true|[yY]*)
5120         cat <<EOM >&4
5121
5122 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5123 EOM
5124         use64bitint="$define"
5125         ;;
5126 esac                          
5127 case "$use64bitsint" in
5128 "$define"|true|[yY]*)
5129         cat <<EOM >&4
5130
5131 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5132 EOM
5133         use64bitint="$define"
5134         ;;
5135 esac                          
5136 case "$uselonglongs" in
5137 "$define"|true|[yY]*)
5138         cat <<EOM >&4
5139
5140 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5141 EOM
5142         use64bitint="$define"
5143         ;;
5144 esac                          
5145 case "$use64bitsall" in
5146 "$define"|true|[yY]*)
5147         cat <<EOM >&4
5148
5149 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5150 EOM
5151         use64bitall="$define"
5152         ;;
5153 esac                          
5154
5155 case "$ccflags" in
5156 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5157 esac
5158 case "$use64bitall" in
5159 "$define"|true|[yY]*) use64bitint="$define" ;;
5160 esac
5161
5162 case "$longsize" in
5163 8) cat <<EOM
5164
5165 You have natively 64-bit long integers.
5166 EOM
5167    val="$define"
5168    ;;
5169 *) case "$use64bitint" in
5170    "$define"|true|[yY]*) dflt='y';;
5171    *) dflt='n';;
5172    esac
5173    case "$d_quad" in
5174    "$define") ;;
5175    *) dflt='n' ;;
5176    esac
5177    cat <<EOM
5178
5179 Perl can be built to take advantage of 64-bit integer types
5180 on some systems.  To do so, Configure can be run with -Duse64bitint.
5181 Choosing this option will most probably introduce binary incompatibilities.
5182
5183 If this doesn't make any sense to you, just accept the default '$dflt'.
5184 (The default has been chosen based on your configuration.)
5185 EOM
5186    rp='Try to use 64-bit integers, if available?'
5187    . ./myread
5188    case "$ans" in
5189    [yY]*) val="$define" ;;
5190    *)     val="$undef"  ;;
5191    esac
5192    ;;
5193 esac
5194 set use64bitint
5195 eval $setvar
5196
5197 case "$use64bitall" in
5198 "$define"|true|[yY]*) dflt='y' ;;
5199 *) case "$longsize" in
5200    8) dflt='y' ;;
5201    *) dflt='n' ;;
5202    esac
5203    ;;
5204 esac    
5205 cat <<EOM
5206
5207 You may also choose to try maximal 64-bitness.  It means using as much
5208 64-bitness as possible on the platform.  This in turn means even more
5209 binary incompatibilities.  On the other hand, your platform may not
5210 have any more 64-bitness available than what you already have chosen.
5211
5212 If this doesn't make any sense to you, just accept the default '$dflt'.
5213 (The default has been chosen based on your configuration.)
5214 EOM
5215 rp='Try to use maximal 64-bit support, if available?'
5216 . ./myread
5217 case "$ans" in
5218 [yY]*) val="$define" ;;
5219 *)     val="$undef"  ;;
5220 esac
5221 set use64bitall
5222 eval $setvar
5223 case "$use64bitall" in
5224 "$define")
5225         case "$use64bitint" in
5226         "$undef")
5227                 cat <<EOM
5228
5229 Since you have chosen a maximally 64-bit build, I'm also turning on
5230 the use of 64-bit integers.
5231 EOM
5232                 use64bitint="$define" ;;
5233         esac
5234         ;;
5235 esac
5236
5237 case "$use64bitall" in
5238 "$define"|true|[yY]*)
5239         case "$ptrsize" in
5240         4)      cat <<EOM >&4
5241
5242 *** You have chosen a maximally 64-bit build, but your pointers
5243 *** are only 4 bytes wide, disabling maximal 64-bitness.
5244
5245 EOM
5246                 use64bitall="$undef"
5247                 case "$use64bitint" in
5248                 "$define"|true|[yY]*) ;;
5249                 *)      cat <<EOM >&4
5250
5251 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5252
5253 EOM
5254                         use64bitint="$define"
5255                         ;;
5256                 esac
5257                 ;;
5258         esac
5259         ;;
5260 esac
5261
5262 case "$use64bitint" in
5263 "$define"|true|[yY]*)
5264 : Look for a hint-file generated 'call-back-unit'.  If the
5265 : user has specified that a 64-bit perl is to be built,
5266 : we may need to set or change some other defaults.
5267         if $test -f use64bitint.cbu; then
5268                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5269                 . ./use64bitint.cbu
5270         fi
5271         case "$longsize" in
5272         4) case "$archname64" in
5273            '') archname64=64int ;;
5274            esac
5275            ;;
5276         esac
5277         ;;
5278 esac
5279
5280 case "$use64bitall" in
5281 "$define"|true|[yY]*)
5282 : Look for a hint-file generated 'call-back-unit'.  If the
5283 : user has specified that a maximally 64-bit perl is to be built,
5284 : we may need to set or change some other defaults.
5285         if $test -f use64bitall.cbu; then
5286                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5287                 . ./use64bitall.cbu
5288         fi
5289         case "$longsize" in
5290         4) case "$archname64" in
5291            ''|64int) archname64=64all ;;
5292            esac
5293            ;;
5294         esac
5295         ;;
5296 esac
5297
5298 echo " "
5299 echo "Checking for GNU C Library..." >&4
5300 cat >try.c <<EOM
5301 #include <stdio.h>
5302 int main()
5303 {
5304 #ifdef __GLIBC__
5305     exit(0);
5306 #else
5307     exit(1);
5308 #endif
5309 }
5310 EOM
5311 set try
5312 if eval $compile_ok && $run ./try; then
5313         val="$define"
5314         echo "You are using the GNU C Library"
5315 else
5316         val="$undef"
5317         echo "You are not using the GNU C Library"
5318 fi
5319 $rm -f try try.*
5320 set d_gnulibc
5321 eval $setvar
5322
5323 : see if nm is to be used to determine whether a symbol is defined or not
5324 case "$usenm" in
5325 '')
5326         dflt=''
5327         case "$d_gnulibc" in
5328         "$define")
5329                 echo " "
5330                 echo "nm probably won't work on the GNU C Library." >&4
5331                 dflt=n
5332                 ;;
5333         esac
5334         case "$dflt" in
5335         '') 
5336                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5337                         echo " "
5338                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5339                         echo "'nm' won't be sufficient on this sytem." >&4
5340                         dflt=n
5341                 fi
5342                 ;;
5343         esac
5344         case "$dflt" in
5345         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5346                 if $test $dflt -gt 20; then
5347                         dflt=y
5348                 else
5349                         dflt=n
5350                 fi
5351                 ;;
5352         esac
5353         ;;
5354 *)
5355         case "$usenm" in
5356         true|$define) dflt=y;;
5357         *) dflt=n;;
5358         esac
5359         ;;
5360 esac
5361 $cat <<EOM
5362
5363 I can use $nm to extract the symbols from your C libraries. This
5364 is a time consuming task which may generate huge output on the disk (up
5365 to 3 megabytes) but that should make the symbols extraction faster. The
5366 alternative is to skip the 'nm' extraction part and to compile a small
5367 test program instead to determine whether each symbol is present. If
5368 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5369 this may be the best solution.
5370
5371 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5372
5373 EOM
5374 rp="Shall I use $nm to extract C symbols from the libraries?"
5375 . ./myread
5376 case "$ans" in
5377 [Nn]*) usenm=false;;
5378 *) usenm=true;;
5379 esac
5380
5381 runnm=$usenm
5382 case "$reuseval" in
5383 true) runnm=false;;
5384 esac
5385
5386 : nm options which may be necessary
5387 case "$nm_opt" in
5388 '') if $test -f /mach_boot; then
5389                 nm_opt=''       # Mach
5390         elif $test -d /usr/ccs/lib; then
5391                 nm_opt='-p'     # Solaris (and SunOS?)
5392         elif $test -f /dgux; then
5393                 nm_opt='-p'     # DG-UX
5394         elif $test -f /lib64/rld; then
5395                 nm_opt='-p'     # 64-bit Irix
5396         else
5397                 nm_opt=''
5398         fi;;
5399 esac
5400
5401 : nm options which may be necessary for shared libraries but illegal
5402 : for archive libraries.  Thank you, Linux.
5403 case "$nm_so_opt" in
5404 '')     case "$myuname" in
5405         *linux*)
5406                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5407                         nm_so_opt='--dynamic'
5408                 fi
5409                 ;;
5410         esac
5411         ;;
5412 esac
5413
5414 case "$runnm" in
5415 true)
5416 : get list of predefined functions in a handy place
5417 echo " "
5418 case "$libc" in
5419 '') libc=unknown
5420         case "$libs" in
5421         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5422         esac
5423         ;;
5424 esac
5425 case "$libs" in
5426 '') ;;
5427 *)  for thislib in $libs; do
5428         case "$thislib" in
5429         -lc|-lc_s)
5430                 : Handle C library specially below.
5431                 ;;
5432         -l*)
5433                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5434                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5435                         :
5436                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5437                         :
5438                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5439                         :
5440                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5441                         :
5442                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5443                         :
5444                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5445                         :
5446                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5447                         :
5448                 else
5449                         try=''
5450                 fi
5451                 libnames="$libnames $try"
5452                 ;;
5453         *) libnames="$libnames $thislib" ;;
5454         esac
5455         done
5456         ;;
5457 esac
5458 xxx=normal
5459 case "$libc" in
5460 unknown)
5461         set /lib/libc.$so
5462         for xxx in $libpth; do
5463                 $test -r $1 || set $xxx/libc.$so
5464                 : The messy sed command sorts on library version numbers.
5465                 $test -r $1 || \
5466                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5467                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5468                                 h
5469                                 s/[0-9][0-9]*/0000&/g
5470                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5471                                 G
5472                                 s/\n/ /' | \
5473                          $sort | $sed -e 's/^.* //'`
5474                 eval set \$$#
5475         done
5476         $test -r $1 || set /usr/ccs/lib/libc.$so
5477         $test -r $1 || set /lib/libsys_s$_a
5478         ;;
5479 *)
5480         set blurfl
5481         ;;
5482 esac
5483 if $test -r "$1"; then
5484         echo "Your (shared) C library seems to be in $1."
5485         libc="$1"
5486 elif $test -r /lib/libc && $test -r /lib/clib; then
5487         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5488         xxx=apollo
5489         libc='/lib/clib /lib/libc'
5490         if $test -r /lib/syslib; then
5491                 echo "(Your math library is in /lib/syslib.)"
5492                 libc="$libc /lib/syslib"
5493         fi
5494 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5495         echo "Your C library seems to be in $libc, as you said before."
5496 elif $test -r $incpath/usr/lib/libc$_a; then
5497         libc=$incpath/usr/lib/libc$_a;
5498         echo "Your C library seems to be in $libc.  That's fine."
5499 elif $test -r /lib/libc$_a; then
5500         libc=/lib/libc$_a;
5501         echo "Your C library seems to be in $libc.  You're normal."
5502 else
5503         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5504                 :
5505         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5506                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5507         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5508                 :
5509         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5510                 :
5511         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5512                 :
5513         else
5514                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5515         fi
5516         if $test -r "$tans"; then
5517                 echo "Your C library seems to be in $tans, of all places."
5518                 libc=$tans
5519         else
5520                 libc='blurfl'
5521         fi
5522 fi
5523 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5524         dflt="$libc"
5525         cat <<EOM
5526
5527 If the guess above is wrong (which it might be if you're using a strange
5528 compiler, or your machine supports multiple models), you can override it here.
5529
5530 EOM
5531 else
5532         dflt=''
5533         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5534         cat >&4 <<EOM
5535 I can't seem to find your C library.  I've looked in the following places:
5536
5537 EOM
5538         $sed 's/^/      /' libpath
5539         cat <<EOM
5540
5541 None of these seems to contain your C library. I need to get its name...
5542
5543 EOM
5544 fi
5545 fn=f
5546 rp='Where is your C library?'
5547 . ./getfile
5548 libc="$ans"
5549
5550 echo " "
5551 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5552 set X `cat libnames`
5553 shift
5554 xxx=files
5555 case $# in 1) xxx=file; esac
5556 echo "Extracting names from the following $xxx for later perusal:" >&4
5557 echo " "
5558 $sed 's/^/      /' libnames >&4
5559 echo " "
5560 $echo $n "This may take a while...$c" >&4
5561
5562 for file in $*; do
5563         case $file in
5564         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5565         *) $nm $nm_opt $file 2>/dev/null;;
5566         esac
5567 done >libc.tmp
5568
5569 $echo $n ".$c"
5570 $grep fprintf libc.tmp > libc.ptf
5571 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5572 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5573 xxx='[ADTSIW]'
5574 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5575         eval $xscan;\
5576         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5577                 eval $xrun
5578 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5579         eval $xscan;\
5580         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5581                 eval $xrun
5582 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5583         eval $xscan;\
5584         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5585                 eval $xrun
5586 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5587         eval $xscan;\
5588         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5589                 eval $xrun
5590 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5591         eval $xscan;\
5592         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5593                 eval $xrun
5594 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5595         eval $xscan;\
5596         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5597                 eval $xrun
5598 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5599                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5600         eval $xscan;\
5601         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5602                 eval $xrun
5603 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5604         eval $xscan;\
5605         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5606                 eval $xrun
5607 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5608         eval $xscan;\
5609         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5610                 eval $xrun
5611 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5612         eval $xscan;\
5613         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5614                 eval $xrun
5615 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5616         eval $xscan;\
5617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5618                 eval $xrun
5619 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5620         eval $xscan;\
5621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5622                 eval $xrun
5623 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5624         eval $xscan;\
5625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5626                 eval $xrun
5627 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5628         eval $xscan;\
5629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5630                 eval $xrun
5631 else
5632         $nm -p $* 2>/dev/null >libc.tmp
5633         $grep fprintf libc.tmp > libc.ptf
5634         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5635                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5636         then
5637                 nm_opt='-p'
5638                 eval $xrun
5639         else
5640                 echo " "
5641                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5642                 com=''
5643                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5644                         for thisname in $libnames $libc; do
5645                                 $ar t $thisname >>libc.tmp
5646                         done
5647                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5648                         echo "Ok." >&4
5649                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5650                         # Repeat libc to extract forwarders to DLL entries too
5651                         for thisname in $libnames $libc; do
5652                                 $ar tv $thisname >>libc.tmp
5653                                 # Revision 50 of EMX has bug in $ar.
5654                                 # it will not extract forwarders to DLL entries
5655                                 # Use emximp which will extract exactly them.
5656                                 emximp -o tmp.imp $thisname \
5657                                     2>/dev/null && \
5658                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5659                                     < tmp.imp >>libc.tmp
5660                                 $rm tmp.imp
5661                         done
5662                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5663                         echo "Ok." >&4
5664                 else
5665                         echo "$ar didn't seem to work right." >&4
5666                         echo "Maybe this is a Cray...trying bld instead..." >&4
5667                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5668                         then
5669                                 for thisname in $libnames; do
5670                                         bld t $libnames | \
5671                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5672                                         $ar t $thisname >>libc.tmp
5673                                 done
5674                                 echo "Ok." >&4
5675                         else
5676                                 echo "That didn't work either.  Giving up." >&4
5677                                 exit 1
5678                         fi
5679                 fi
5680         fi
5681 fi
5682 nm_extract="$com"
5683 if $test -f /lib/syscalls.exp; then
5684         echo " "
5685         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5686         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5687 fi
5688 ;;
5689 esac
5690 $rm -f libnames libpath
5691
5692 : is a C symbol defined?
5693 csym='tlook=$1;
5694 case "$3" in
5695 -v) tf=libc.tmp; tc=""; tdc="";;
5696 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5697 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5698 esac;
5699 tx=yes;
5700 case "$reuseval-$4" in
5701 true-) ;;
5702 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5703 esac;
5704 case "$tx" in
5705 yes)
5706         case "$runnm" in
5707         true)
5708                 if $contains $tlook $tf >/dev/null 2>&1;
5709                 then tval=true;
5710                 else tval=false;
5711                 fi;;
5712         *)
5713                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5714                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5715                 then tval=true;
5716                 else tval=false;
5717                 fi;
5718                 $rm -f t t.c;;
5719         esac;;
5720 *)
5721         case "$tval" in
5722         $define) tval=true;;
5723         *) tval=false;;
5724         esac;;
5725 esac;
5726 eval "$2=$tval"'
5727
5728 : define an is-in-libc? function
5729 inlibc='echo " "; td=$define; tu=$undef;
5730 sym=$1; var=$2; eval "was=\$$2";
5731 tx=yes;
5732 case "$reuseval$was" in
5733 true) ;;
5734 true*) tx=no;;
5735 esac;
5736 case "$tx" in
5737 yes)
5738         set $sym tres -f;
5739         eval $csym;
5740         case "$tres" in
5741         true)
5742                 echo "$sym() found." >&4;
5743                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5744         *)
5745                 echo "$sym() NOT found." >&4;
5746                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5747         esac;;
5748 *)
5749         case "$was" in
5750         $define) echo "$sym() found." >&4;;
5751         *) echo "$sym() NOT found." >&4;;
5752         esac;;
5753 esac'
5754
5755 : see if sqrtl exists
5756 set sqrtl d_sqrtl
5757 eval $inlibc
5758
5759 : check for length of double
5760 echo " "
5761 case "$doublesize" in
5762 '')
5763         echo "Checking to see how big your double precision numbers are..." >&4
5764         $cat >try.c <<'EOCP'
5765 #include <stdio.h>
5766 int main()
5767 {
5768     printf("%d\n", (int)sizeof(double));
5769     exit(0);
5770 }
5771 EOCP
5772         set try
5773         if eval $compile_ok; then
5774                 doublesize=`$run ./try`
5775                 echo "Your double is $doublesize bytes long."
5776         else
5777                 dflt='8'
5778                 echo "(I can't seem to compile the test program.  Guessing...)"
5779                 rp="What is the size of a double precision number (in bytes)?"
5780                 . ./myread
5781                 doublesize="$ans"
5782         fi
5783         ;;
5784 esac
5785 $rm -f try.c try
5786
5787 : check for long doubles
5788 echo " "
5789 echo "Checking to see if you have long double..." >&4
5790 echo 'int main() { long double x = 7.0; }' > try.c
5791 set try
5792 if eval $compile; then
5793         val="$define"
5794         echo "You have long double."
5795 else
5796         val="$undef"
5797         echo "You do not have long double."
5798 fi
5799 $rm try.*
5800 set d_longdbl
5801 eval $setvar
5802
5803 : check for length of long double
5804 case "${d_longdbl}${longdblsize}" in
5805 $define)
5806         echo " "
5807         echo "Checking to see how big your long doubles are..." >&4
5808         $cat >try.c <<'EOCP'
5809 #include <stdio.h>
5810 int main()
5811 {
5812         printf("%d\n", sizeof(long double));
5813 }
5814 EOCP
5815         set try
5816         set try
5817         if eval $compile; then
5818                 longdblsize=`$run ./try`
5819                 echo "Your long doubles are $longdblsize bytes long."
5820         else
5821                 dflt='8'
5822                 echo " "
5823                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5824                 rp="What is the size of a long double (in bytes)?"
5825                 . ./myread
5826                 longdblsize="$ans"
5827         fi
5828         if $test "X$doublesize" = "X$longdblsize"; then
5829                 echo "(That isn't any different from an ordinary double.)"
5830         fi      
5831         ;;
5832 esac
5833 $rm -f try.* try
5834
5835 echo " "
5836
5837 if $test X"$d_longdbl" = X"$define"; then
5838
5839 echo "Checking how to print long doubles..." >&4
5840
5841 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5842         $cat >try.c <<'EOCP'
5843 #include <sys/types.h>
5844 #include <stdio.h>
5845 int main() {
5846   double d = 123.456;
5847   printf("%.3f\n", d);
5848 }
5849 EOCP
5850         set try
5851         if eval $compile; then
5852                 yyy=`$run ./try`
5853                 case "$yyy" in
5854                 123.456)
5855                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5856                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5857                         echo "We will use %f."
5858                         ;;
5859                 esac
5860         fi
5861 fi
5862
5863 if $test X"$sPRIfldbl" = X; then
5864         $cat >try.c <<'EOCP'
5865 #include <sys/types.h>
5866 #include <stdio.h>
5867 int main() {
5868   long double d = 123.456;
5869   printf("%.3Lf\n", d);
5870 }
5871 EOCP
5872         set try
5873         if eval $compile; then
5874                 yyy=`$run ./try`
5875                 case "$yyy" in
5876                 123.456)
5877                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5878                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5879                         echo "We will use %Lf."
5880                         ;;
5881                 esac
5882         fi
5883 fi
5884
5885 if $test X"$sPRIfldbl" = X; then
5886         $cat >try.c <<'EOCP'
5887 #include <sys/types.h>
5888 #include <stdio.h>
5889 int main() {
5890   long double d = 123.456;
5891   printf("%.3llf\n", d);
5892 }
5893 EOCP
5894         set try
5895         if eval $compile; then
5896                 yyy=`$run ./try`
5897                 case "$yyy" in
5898                 123.456)
5899                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
5900                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
5901                         echo "We will use %llf."
5902                         ;;
5903                 esac
5904         fi
5905 fi
5906
5907 if $test X"$sPRIfldbl" = X; then
5908         $cat >try.c <<'EOCP'
5909 #include <sys/types.h>
5910 #include <stdio.h>
5911 int main() {
5912   long double d = 123.456;
5913   printf("%.3lf\n", d);
5914 }
5915 EOCP
5916         set try
5917         if eval $compile; then
5918                 yyy=`$run ./try`
5919                 case "$yyy" in
5920                 123.456)
5921                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
5922                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
5923                         echo "We will use %lf."
5924                         ;;
5925                 esac
5926         fi
5927 fi
5928
5929 if $test X"$sPRIfldbl" = X; then
5930         echo "Cannot figure out how to print long doubles." >&4
5931 else
5932         sSCNfldbl=$sPRIfldbl    # expect consistency
5933 fi
5934
5935 $rm -f try try.*
5936
5937 fi # d_longdbl
5938
5939 case "$sPRIfldbl" in
5940 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
5941         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
5942         d_SCNfldbl="$undef";
5943         ;;
5944 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
5945         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
5946         d_SCNfldbl="$define";
5947         ;;
5948 esac
5949
5950 : see if modfl exists
5951 set modfl d_modfl
5952 eval $inlibc
5953
5954 d_modfl_pow32_bug="$undef"
5955
5956 case "$d_longdbl$d_modfl" in
5957 $define$define)
5958         $cat <<EOM
5959 Checking to see whether your modfl() is okay for large values...
5960 EOM
5961 $cat >try.c <<EOCP
5962 #include <math.h> 
5963 #include <stdio.h>
5964 int main() {
5965     long double nv = 4294967303.15;
5966     long double v, w;
5967     v = modfl(nv, &w);         
5968 #ifdef __GLIBC__
5969     printf("glibc");
5970 #endif
5971     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
5972     return 0;
5973 }
5974 EOCP
5975         case "$osname:$gccversion" in
5976         aix:)   saveccflags="$ccflags"
5977                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
5978         esac
5979         set try
5980         if eval $compile; then
5981                 foo=`$run ./try`
5982                 case "$foo" in
5983                 *" 4294967303.150000 1.150000 4294967302.000000")
5984                         echo >&4 "Your modfl() is broken for large values."
5985                         d_modfl_pow32_bug="$define"
5986                         case "$foo" in
5987                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
5988                         ;;
5989                         esac
5990                         ;;
5991                 *" 4294967303.150000 0.150000 4294967303.000000")
5992                         echo >&4 "Your modfl() seems okay for large values."
5993                         ;;
5994                 *)      echo >&4 "I don't understand your modfl() at all."
5995                         d_modfl="$undef"
5996                         ;;
5997                 esac
5998                 $rm -f try.* try core core.try.*
5999         else
6000                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6001                 d_modfl="$undef"
6002         fi
6003         case "$osname:$gccversion" in
6004         aix:)   ccflags="$saveccflags" ;; # restore
6005         esac
6006         ;;
6007 esac
6008
6009 case "$ccflags" in
6010 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6011 esac
6012
6013 case "$uselongdouble" in
6014 $define|true|[yY]*)     dflt='y';;
6015 *) dflt='n';;
6016 esac
6017 cat <<EOM
6018
6019 Perl can be built to take advantage of long doubles which
6020 (if available) may give more accuracy and range for floating point numbers.
6021
6022 If this doesn't make any sense to you, just accept the default '$dflt'.
6023 EOM
6024 rp='Try to use long doubles if available?'
6025 . ./myread
6026 case "$ans" in
6027 y|Y)    val="$define"   ;;
6028 *)      val="$undef"    ;;
6029 esac
6030 set uselongdouble
6031 eval $setvar
6032
6033 case "$uselongdouble" in
6034 true|[yY]*) uselongdouble="$define" ;;
6035 esac
6036
6037 case "$uselongdouble" in
6038 $define)
6039 : Look for a hint-file generated 'call-back-unit'.  If the
6040 : user has specified that long doubles should be used,
6041 : we may need to set or change some other defaults.
6042         if $test -f uselongdouble.cbu; then
6043                 echo "Your platform has some specific hints for long doubles, using them..."
6044                 . ./uselongdouble.cbu
6045         else
6046                 $cat <<EOM
6047 (Your platform doesn't have any specific hints for long doubles.)
6048 EOM
6049         fi
6050         ;;
6051 esac
6052
6053 message=X
6054 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6055 $define:$define:$define)
6056         : You have both
6057         ;;
6058 $define:$define:$undef)
6059         message="I could not find modfl"
6060         ;;
6061 $define:$undef:$define)
6062         message="I could not find sqrtl"
6063         ;;
6064 $define:$undef:$undef)
6065         message="I found neither sqrtl nor modfl"
6066         ;;
6067 esac
6068
6069 if $test "$message" != X; then
6070         $cat <<EOM >&4
6071
6072 *** You requested the use of long doubles but you do not seem to have
6073 *** the mathematic functions for long doubles.
6074 *** ($message)
6075 *** I'm disabling the use of long doubles.
6076
6077 EOM
6078
6079         uselongdouble=$undef
6080 fi
6081
6082 case "$useperlio" in
6083 $define|true|[yY]*|'')  dflt='y';;
6084 *) dflt='n';;
6085 esac
6086 cat <<EOM
6087
6088 Previous version of $package used the standard IO mechanisms as
6089 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6090 alternate IO mechanisms via the PerlIO abstraction layer, but the
6091 stdio mechanism is still available if needed.  The abstraction layer
6092 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6093 Using PerlIO with sfio may cause problems with some extension modules.
6094
6095 If this doesn't make any sense to you, just accept the default '$dflt'.
6096 EOM
6097 rp='Use the PerlIO abstraction layer?'
6098 . ./myread
6099 case "$ans" in
6100 y|Y) 
6101         val="$define"
6102         ;;
6103 *)      
6104         echo "Ok, doing things the stdio way."
6105         val="$undef"
6106         ;;
6107 esac
6108 set useperlio
6109 eval $setvar 
6110
6111 case "$usesocks" in
6112 $define|true|[yY]*)
6113         case "$useperlio" in
6114         $define|true|[yY]*) ;;
6115         *)      cat >&4 <<EOM
6116
6117 You are using the SOCKS proxy protocol library which means that you
6118 should also use the PerlIO layer.  You may be headed for trouble.
6119
6120 EOM
6121                 ;;
6122         esac
6123         ;;
6124 esac
6125
6126         
6127 : determine the architecture name
6128 echo " "
6129 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6130         tarch=`arch`"-$osname"
6131 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6132         if uname -m > tmparch 2>&1 ; then
6133                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6134                         -e 's/$/'"-$osname/" tmparch`
6135         else
6136                 tarch="$osname"
6137         fi
6138         $rm -f tmparch
6139 else
6140         tarch="$osname"
6141 fi
6142 case "$myarchname" in
6143 ''|"$tarch") ;;
6144 *)
6145         echo "(Your architecture name used to be $myarchname.)"
6146         archname=''
6147         ;;
6148 esac
6149 case "$targetarch" in
6150 '') ;;
6151 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6152 esac
6153 myarchname="$tarch"
6154 case "$archname" in
6155 '') dflt="$tarch";;
6156 *) dflt="$archname";;
6157 esac
6158 rp='What is your architecture name'
6159 . ./myread
6160 archname="$ans"
6161 case "$usethreads" in
6162 $define)
6163         echo "Threads selected." >&4
6164         case "$archname" in
6165         *-thread*) echo "...and architecture name already has -thread." >&4
6166                 ;;
6167         *)      archname="$archname-thread"
6168                 echo "...setting architecture name to $archname." >&4
6169                 ;;
6170         esac
6171         ;;
6172 esac
6173 case "$usemultiplicity" in
6174 $define)
6175         echo "Multiplicity selected." >&4
6176         case "$archname" in
6177         *-multi*) echo "...and architecture name already has -multi." >&4
6178                 ;;
6179         *)      archname="$archname-multi"
6180                 echo "...setting architecture name to $archname." >&4
6181                 ;;
6182         esac
6183         ;;
6184 esac
6185 case "$use64bitint$use64bitall" in
6186 *"$define"*)
6187         case "$archname64" in
6188         '')
6189                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6190                 ;;
6191         *)
6192                 case "$use64bitint" in
6193                 "$define") echo "64 bit integers selected." >&4 ;;
6194                 esac
6195                 case "$use64bitall" in
6196                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6197                 esac
6198                 case "$archname" in
6199                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6200                         ;;
6201                 *)      archname="$archname-$archname64"
6202                         echo "...setting architecture name to $archname." >&4
6203                         ;;
6204                 esac
6205                 ;;
6206         esac
6207 esac
6208 case "$uselongdouble" in
6209 $define)
6210         echo "Long doubles selected." >&4
6211         case "$longdblsize" in
6212         $doublesize)
6213                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6214                 ;;
6215         *)
6216                 case "$archname" in
6217                 *-ld*) echo "...and architecture name already has -ld." >&4
6218                         ;;
6219                 *)      archname="$archname-ld"
6220                         echo "...setting architecture name to $archname." >&4
6221                         ;;
6222                 esac
6223                 ;;
6224         esac
6225         ;;
6226 esac
6227 case "$useperlio" in
6228 $define)
6229         echo "Perlio selected." >&4
6230         ;;
6231 *)
6232         echo "Perlio not selected, using stdio." >&4
6233         case "$archname" in
6234         *-stdio*) echo "...and architecture name already has -stdio." >&4
6235                 ;;
6236         *)      archname="$archname-stdio"
6237                 echo "...setting architecture name to $archname." >&4
6238                 ;;
6239         esac
6240         ;;
6241 esac
6242
6243 : determine root of directory hierarchy where package will be installed.
6244 case "$prefix" in
6245 '')
6246         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6247         ;;
6248 *)
6249         dflt="$prefix"
6250         ;;
6251 esac
6252 $cat <<EOM
6253
6254 By default, $package will be installed in $dflt/bin, manual pages
6255 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6256 installation directories. Typically this is something like /usr/local.
6257 If you wish to have binaries under /usr/bin but other parts of the
6258 installation under /usr/local, that's ok: you will be prompted
6259 separately for each of the installation directories, the prefix being
6260 only used to set the defaults.
6261
6262 EOM
6263 fn=d~
6264 rp='Installation prefix to use?'
6265 . ./getfile
6266 oldprefix=''
6267 case "$prefix" in
6268 '') ;;
6269 *)
6270         case "$ans" in
6271         "$prefix") ;;
6272         *) oldprefix="$prefix";;
6273         esac
6274         ;;
6275 esac
6276 prefix="$ans"
6277 prefixexp="$ansexp"
6278
6279 case "$afsroot" in
6280 '')     afsroot=/afs ;;
6281 *)      afsroot=$afsroot ;;
6282 esac
6283
6284 : is AFS running?
6285 echo " "
6286 case "$afs" in
6287 $define|true)   afs=true ;;
6288 $undef|false)   afs=false ;;
6289 *)      if test -d $afsroot; then
6290                 afs=true
6291         else
6292                 afs=false
6293         fi
6294         ;;
6295 esac
6296 if $afs; then
6297         echo "AFS may be running... I'll be extra cautious then..." >&4
6298 else
6299         echo "AFS does not seem to be running..." >&4
6300 fi
6301
6302 : determine installation prefix for where package is to be installed.
6303 if $afs; then 
6304 $cat <<EOM
6305
6306 Since you are running AFS, I need to distinguish the directory in which
6307 files will reside from the directory in which they are installed (and from
6308 which they are presumably copied to the former directory by occult means).
6309
6310 EOM
6311         case "$installprefix" in
6312         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6313         *) dflt="$installprefix";;
6314         esac
6315 else
6316 $cat <<EOM
6317
6318 In some special cases, particularly when building $package for distribution,
6319 it is convenient to distinguish between the directory in which files should 
6320 be installed from the directory ($prefix) in which they 
6321 will eventually reside.  For most users, these two directories are the same.
6322
6323 EOM
6324         case "$installprefix" in
6325         '') dflt=$prefix ;;
6326         *) dflt=$installprefix;;
6327         esac
6328 fi
6329 fn=d~
6330 rp='What installation prefix should I use for installing files?'
6331 . ./getfile
6332 installprefix="$ans"
6333 installprefixexp="$ansexp"
6334
6335 : set the prefixit variable, to compute a suitable default value
6336 prefixit='case "$3" in
6337 ""|none)
6338         case "$oldprefix" in
6339         "") eval "$1=\"\$$2\"";;
6340         *)
6341                 case "$3" in
6342                 "") eval "$1=";;
6343                 none)
6344                         eval "tp=\"\$$2\"";
6345                         case "$tp" in
6346                         ""|" ") eval "$1=\"\$$2\"";;
6347                         *) eval "$1=";;
6348                         esac;;
6349                 esac;;
6350         esac;;
6351 *)
6352         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6353         case "$tp" in
6354         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6355         /*-$oldprefix/*|\~*-$oldprefix/*)
6356                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6357         *) eval "$1=\"\$$2\"";;
6358         esac;;
6359 esac'
6360
6361 : get the patchlevel
6362 echo " "
6363 echo "Getting the current patchlevel..." >&4
6364 if $test -r $rsrc/patchlevel.h;then
6365         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6366         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6367         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6368         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6369         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6370         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6371        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6372 else
6373         revision=0
6374         patchlevel=0
6375         subversion=0
6376         api_revision=0
6377         api_version=0
6378         api_subversion=0
6379         perl_patchlevel=0
6380         $echo "(You do not have patchlevel.h.  Eek.)"
6381 fi
6382 if $test -r $rsrc/.patch ; then  
6383         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6384                 perl_patchlevel=`cat $rsrc/.patch`
6385         fi
6386 fi
6387 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6388 version_patchlevel_string="version $patchlevel subversion $subversion"
6389 case "$perl_patchlevel" in
6390 0|'') ;;
6391 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6392 esac
6393
6394 $echo "(You have $package $version_patchlevel_string.)"
6395
6396 case "$osname" in
6397 dos|vms)
6398         : XXX Should be a Configure test for double-dots in filenames.
6399         version=`echo $revision $patchlevel $subversion | \
6400                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6401         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6402                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6403         ;;
6404 *)
6405         version=`echo $revision $patchlevel $subversion | \
6406                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6407         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6408                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6409         ;;
6410 esac
6411 : Special case the 5.005_xx maintenance series, which used 5.005
6412 : without any subversion label as a subdirectory in $sitelib
6413 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6414         api_versionstring='5.005'
6415 fi
6416
6417 : determine installation style
6418 : For now, try to deduce it from prefix unless it is already set.
6419 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6420 case "$installstyle" in
6421 '')     case "$prefix" in
6422                 *perl*) dflt='lib';;
6423                 *) dflt='lib/perl5' ;;
6424         esac
6425         ;;
6426 *)      dflt="$installstyle" ;;
6427 esac
6428 : Probably not worth prompting for this since we prompt for all
6429 : the directories individually, and the prompt would be too long and
6430 : confusing anyway.
6431 installstyle=$dflt
6432
6433 : determine where private library files go
6434 : Usual default is /usr/local/lib/perl5/$version.
6435 : Also allow things like /opt/perl/lib/$version, since 
6436 : /opt/perl/lib/perl5... would be redundant.
6437 : The default "style" setting is made in installstyle.U
6438 case "$installstyle" in
6439 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6440 *)       set dflt privlib lib/$version ;;
6441 esac
6442 eval $prefixit
6443 $cat <<EOM
6444
6445 There are some auxiliary files for $package that need to be put into a
6446 private library directory that is accessible by everyone.
6447
6448 EOM
6449 fn=d~+
6450 rp='Pathname where the private library files will reside?'
6451 . ./getfile
6452 privlib="$ans"
6453 privlibexp="$ansexp"
6454 : Change installation prefix, if necessary.
6455 if $test X"$prefix" != X"$installprefix"; then
6456         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6457 else
6458         installprivlib="$privlibexp"
6459 fi
6460
6461 : set the prefixup variable, to restore leading tilda escape
6462 prefixup='case "$prefixexp" in
6463 "$prefix") ;;
6464 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6465 esac'
6466
6467 : determine where public architecture dependent libraries go
6468 set archlib archlib
6469 eval $prefixit
6470 : privlib default is /usr/local/lib/$package/$version
6471 : archlib default is /usr/local/lib/$package/$version/$archname
6472 : privlib may have an optional trailing /share.
6473 tdflt=`echo $privlib | $sed 's,/share$,,'`
6474 tdflt=$tdflt/$archname
6475 case "$archlib" in
6476 '')     dflt=$tdflt
6477         ;;
6478 *)      dflt="$archlib"
6479     ;;
6480 esac
6481 $cat <<EOM
6482
6483 $spackage contains architecture-dependent library files.  If you are
6484 sharing libraries in a heterogeneous environment, you might store
6485 these files in a separate location.  Otherwise, you can just include
6486 them with the rest of the public library files.
6487
6488 EOM
6489 fn=d+~
6490 rp='Where do you want to put the public architecture-dependent libraries?'
6491 . ./getfile
6492 archlib="$ans"
6493 archlibexp="$ansexp"
6494 if $test X"$archlib" = X"$privlib"; then
6495         d_archlib="$undef"
6496 else
6497         d_archlib="$define"
6498 fi
6499 : Change installation prefix, if necessary.
6500 if $test X"$prefix" != X"$installprefix"; then
6501         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6502 else
6503         installarchlib="$archlibexp"
6504 fi
6505
6506
6507 : Binary compatibility with 5.005 is not possible for builds
6508 : with advanced features
6509 case "$usethreads$usemultiplicity" in
6510 *define*)
6511         bincompat5005="$undef"
6512         d_bincompat5005="$undef"
6513         ;;
6514 *)      $cat <<EOM
6515
6516 This version of Perl can be compiled for binary compatibility with 5.005.
6517 If you decide to do so, you will be able to continue using most of the
6518 extensions that were compiled for Perl 5.005.
6519
6520 EOM
6521         case "$bincompat5005$d_bincompat5005" in
6522         *"$undef"*) dflt=n ;;
6523         *) dflt=y ;;
6524         esac
6525         rp='Binary compatibility with Perl 5.005?'
6526         . ./myread
6527         case "$ans" in
6528         y*) val="$define" ;;
6529         *)  val="$undef" ;;
6530         esac
6531         set d_bincompat5005
6532         eval $setvar
6533         case "$d_bincompat5005" in
6534         "$define")
6535                 bincompat5005="$define"
6536                 ;;
6537         *)      bincompat5005="$undef"
6538                 d_bincompat5005="$undef"
6539                 ;;
6540         esac
6541         ;;
6542 esac
6543
6544
6545 : see if setuid scripts can be secure
6546 $cat <<EOM
6547
6548 Some kernels have a bug that prevents setuid #! scripts from being
6549 secure.  Some sites have disabled setuid #! scripts because of this.
6550
6551 First let's decide if your kernel supports secure setuid #! scripts.
6552 (If setuid #! scripts would be secure but have been disabled anyway,
6553 don't say that they are secure if asked.)
6554
6555 EOM
6556
6557 val="$undef"
6558 if $test -d /dev/fd; then
6559         echo "#!$ls" >reflect
6560         chmod +x,u+s reflect
6561         ./reflect >flect 2>&1
6562         if $contains "/dev/fd" flect >/dev/null; then
6563                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6564                 val="$define"
6565         else
6566                 $cat <<EOM
6567 If you are not sure if they are secure, I can check but I'll need a
6568 username and password different from the one you are using right now.
6569 If you don't have such a username or don't want me to test, simply
6570 enter 'none'.
6571
6572 EOM
6573                 rp='Other username to test security of setuid scripts with?'
6574                 dflt='none'
6575                 . ./myread
6576                 case "$ans" in
6577                 n|none)
6578                         case "$d_suidsafe" in
6579                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6580                                 dflt=n;;
6581                         "$undef")
6582                                 echo "Well, the $hint value is *not* secure." >&4
6583                                 dflt=n;;
6584                         *)      echo "Well, the $hint value *is* secure." >&4
6585                                 dflt=y;;
6586                         esac
6587                         ;;
6588                 *)
6589                         $rm -f reflect flect
6590                         echo "#!$ls" >reflect
6591                         chmod +x,u+s reflect
6592                         echo >flect
6593                         chmod a+w flect
6594                         echo '"su" will (probably) prompt you for '"$ans's password."
6595                         su $ans -c './reflect >flect'
6596                         if $contains "/dev/fd" flect >/dev/null; then
6597                                 echo "Okay, it looks like setuid scripts are secure." >&4
6598                                 dflt=y
6599                         else
6600                                 echo "I don't think setuid scripts are secure." >&4
6601                                 dflt=n
6602                         fi
6603                         ;;
6604                 esac
6605                 rp='Does your kernel have *secure* setuid scripts?'
6606                 . ./myread
6607                 case "$ans" in
6608                 [yY]*)  val="$define";;
6609                 *)      val="$undef";;
6610                 esac
6611         fi
6612 else
6613         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6614         echo "(That's for file descriptors, not floppy disks.)"
6615         val="$undef"
6616 fi
6617 set d_suidsafe
6618 eval $setvar
6619
6620 $rm -f reflect flect
6621
6622 : now see if they want to do setuid emulation
6623 echo " "
6624 val="$undef"
6625 case "$d_suidsafe" in
6626 "$define")
6627         val="$undef"
6628         echo "No need to emulate SUID scripts since they are secure here." >&4
6629         ;;
6630 *)
6631         $cat <<EOM
6632 Some systems have disabled setuid scripts, especially systems where
6633 setuid scripts cannot be secure.  On systems where setuid scripts have
6634 been disabled, the setuid/setgid bits on scripts are currently
6635 useless.  It is possible for $package to detect those bits and emulate
6636 setuid/setgid in a secure fashion.  This emulation will only work if
6637 setuid scripts have been disabled in your kernel.
6638
6639 EOM
6640         case "$d_dosuid" in
6641         "$define") dflt=y ;;
6642         *) dflt=n ;;
6643         esac
6644         rp="Do you want to do setuid/setgid emulation?"
6645         . ./myread
6646         case "$ans" in
6647         [yY]*)  val="$define";;
6648         *)      val="$undef";;
6649         esac
6650         ;;
6651 esac
6652 set d_dosuid
6653 eval $setvar
6654
6655 : see if this is a malloc.h system
6656 set malloc.h i_malloc
6657 eval $inhdr
6658
6659 : see if stdlib is available
6660 set stdlib.h i_stdlib
6661 eval $inhdr
6662
6663 : determine which malloc to compile in
6664 echo " "
6665 case "$usemymalloc" in
6666 [yY]*|true|$define)     dflt='y' ;;
6667 [nN]*|false|$undef)     dflt='n' ;;
6668 *)      case "$ptrsize" in
6669         4) dflt='y' ;;
6670         *) dflt='n' ;;
6671         esac
6672         ;;
6673 esac
6674 rp="Do you wish to attempt to use the malloc that comes with $package?"
6675 . ./myread
6676 usemymalloc="$ans"
6677 case "$ans" in
6678 y*|true)
6679         usemymalloc='y'
6680         mallocsrc='malloc.c'
6681         mallocobj="malloc$_o"
6682         d_mymalloc="$define"
6683         case "$libs" in
6684         *-lmalloc*)
6685                 : Remove malloc from list of libraries to use
6686                 echo "Removing unneeded -lmalloc from library list" >&4
6687                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6688                 shift
6689                 libs="$*"
6690                 echo "libs = $libs" >&4
6691                 ;;
6692         esac
6693         ;;
6694 *)
6695         usemymalloc='n'
6696         mallocsrc=''
6697         mallocobj=''
6698         d_mymalloc="$undef"
6699         ;;
6700 esac
6701
6702 : compute the return types of malloc and free
6703 echo " "
6704 $cat >malloc.c <<END
6705 #$i_malloc I_MALLOC
6706 #$i_stdlib I_STDLIB
6707 #include <stdio.h>
6708 #include <sys/types.h>
6709 #ifdef I_MALLOC
6710 #include <malloc.h>
6711 #endif
6712 #ifdef I_STDLIB
6713 #include <stdlib.h>
6714 #endif
6715 #ifdef TRY_MALLOC
6716 void *malloc();
6717 #endif
6718 #ifdef TRY_FREE
6719 void free();
6720 #endif
6721 END
6722 case "$malloctype" in
6723 '')
6724         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6725                 malloctype='void *'
6726         else
6727                 malloctype='char *'
6728         fi
6729         ;;
6730 esac
6731 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6732
6733 case "$freetype" in
6734 '')
6735         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6736                 freetype='void'
6737         else
6738                 freetype='int'
6739         fi
6740         ;;
6741 esac
6742 echo "Your system uses $freetype free(), it would seem." >&4
6743 $rm -f malloc.[co]
6744 $cat <<EOM
6745
6746 After $package is installed, you may wish to install various
6747 add-on modules and utilities.  Typically, these add-ons will
6748 be installed under $prefix with the rest
6749 of this package.  However, you may wish to install such add-ons
6750 elsewhere under a different prefix.
6751
6752 If you do not wish to put everything under a single prefix, that's
6753 ok.  You will be prompted for the individual locations; this siteprefix
6754 is only used to suggest the defaults.
6755
6756 The default should be fine for most people.
6757
6758 EOM
6759 fn=d~+
6760 rp='Installation prefix to use for add-on modules and utilities?'
6761 : XXX Here might be another good place for an installstyle setting.
6762 case "$siteprefix" in
6763 '') dflt=$prefix ;;
6764 *)  dflt=$siteprefix ;;
6765 esac
6766 . ./getfile
6767 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6768 oldsiteprefix=''
6769 case "$siteprefix" in
6770 '') ;;
6771 *)      case "$ans" in
6772         "$prefix") ;;
6773         *) oldsiteprefix="$prefix";;
6774         esac
6775         ;;
6776 esac
6777 siteprefix="$ans"
6778 siteprefixexp="$ansexp"
6779
6780 : determine where site specific libraries go.
6781 : Usual default is /usr/local/lib/perl5/site_perl/$version
6782 : The default "style" setting is made in installstyle.U
6783 : XXX No longer works with Prefixit stuff.
6784 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6785 case "$sitelib" in
6786 '') case "$installstyle" in
6787         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6788         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6789         esac
6790         ;;
6791 *)      dflt="$sitelib"
6792         ;;
6793 esac
6794 $cat <<EOM
6795
6796 The installation process will create a directory for
6797 site-specific extensions and modules.  Most users find it convenient
6798 to place all site-specific files in this directory rather than in the
6799 main distribution directory.
6800
6801 EOM
6802 fn=d~+
6803 rp='Pathname for the site-specific library files?'
6804 . ./getfile
6805 sitelib="$ans"
6806 sitelibexp="$ansexp"
6807 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6808 : Change installation prefix, if necessary.
6809 if $test X"$prefix" != X"$installprefix"; then
6810         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6811 else
6812         installsitelib="$sitelibexp"
6813 fi
6814
6815 : determine where site specific architecture-dependent libraries go.
6816 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6817 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6818 : sitelib may have an optional trailing /share.
6819 case "$sitearch" in
6820 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6821         dflt="$dflt/$archname"
6822         ;;
6823 *)      dflt="$sitearch"
6824         ;;
6825 esac
6826 set sitearch sitearch none
6827 eval $prefixit
6828 $cat <<EOM
6829
6830 The installation process will also create a directory for
6831 architecture-dependent site-specific extensions and modules.
6832
6833 EOM
6834 fn=d~+
6835 rp='Pathname for the site-specific architecture-dependent library files?'
6836 . ./getfile
6837 sitearch="$ans"
6838 sitearchexp="$ansexp"
6839 : Change installation prefix, if necessary.
6840 if $test X"$prefix" != X"$installprefix"; then
6841         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6842 else
6843         installsitearch="$sitearchexp"
6844 fi
6845
6846 $cat <<EOM
6847
6848 The installation process will also create a directory for
6849 vendor-supplied add-ons.  Vendors who supply perl with their system
6850 may find it convenient to place all vendor-supplied files in this
6851 directory rather than in the main distribution directory.  This will
6852 ease upgrades between binary-compatible maintenance versions of perl.
6853
6854 Of course you may also use these directories in whatever way you see
6855 fit.  For example, you might use them to access modules shared over a
6856 company-wide network.
6857
6858 The default answer should be fine for most people.
6859 This causes further questions about vendor add-ons to be skipped
6860 and no vendor-specific directories will be configured for perl.
6861
6862 EOM
6863 rp='Do you want to configure vendor-specific add-on directories?'
6864 case "$usevendorprefix" in
6865 define|true|[yY]*) dflt=y ;;
6866 *)      : User may have set vendorprefix directly on Configure command line.
6867         case "$vendorprefix" in
6868         ''|' ') dflt=n ;;
6869         *)      dflt=y ;;
6870         esac
6871         ;;
6872 esac
6873 . ./myread
6874 case "$ans" in
6875 [yY]*)  fn=d~+
6876         rp='Installation prefix to use for vendor-supplied add-ons?'
6877         case "$vendorprefix" in
6878         '') dflt='' ;;
6879         *)  dflt=$vendorprefix ;;
6880         esac
6881         . ./getfile
6882         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6883         oldvendorprefix=''
6884         case "$vendorprefix" in
6885         '') ;;
6886         *)      case "$ans" in
6887                 "$prefix") ;;
6888                 *) oldvendorprefix="$prefix";;
6889                 esac
6890                 ;;
6891         esac
6892         usevendorprefix="$define"
6893         vendorprefix="$ans"
6894         vendorprefixexp="$ansexp"
6895         ;;
6896 *)      usevendorprefix="$undef"
6897         vendorprefix=''
6898         vendorprefixexp=''
6899         ;;
6900 esac
6901
6902 case "$vendorprefix" in
6903 '')     d_vendorlib="$undef"
6904         vendorlib=''
6905         vendorlibexp=''
6906         ;;
6907 *)      d_vendorlib="$define"
6908         : determine where vendor-supplied modules go.
6909         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6910         case "$vendorlib" in
6911         '')
6912                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6913                 case "$installstyle" in
6914                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6915                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6916                 esac
6917                 ;;
6918         *)      dflt="$vendorlib"
6919                 ;;
6920         esac
6921         fn=d~+
6922         rp='Pathname for the vendor-supplied library files?'
6923         . ./getfile
6924         vendorlib="$ans"
6925         vendorlibexp="$ansexp"
6926         ;;
6927 esac
6928 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6929 : Change installation prefix, if necessary.
6930 if $test X"$prefix" != X"$installprefix"; then
6931         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6932 else
6933         installvendorlib="$vendorlibexp"
6934 fi
6935
6936 case "$vendorprefix" in
6937 '')     d_vendorarch="$undef"
6938         vendorarch=''
6939         vendorarchexp=''
6940         ;;
6941 *)      d_vendorarch="$define"
6942         : determine where vendor-supplied architecture-dependent libraries go.
6943         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6944         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6945         : vendorlib may have an optional trailing /share.
6946         case "$vendorarch" in
6947         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6948                 dflt="$dflt/$archname"
6949                 ;;
6950         *)      dflt="$vendorarch" ;;
6951         esac
6952         fn=d~+
6953         rp='Pathname for vendor-supplied architecture-dependent files?'
6954         . ./getfile
6955         vendorarch="$ans"
6956         vendorarchexp="$ansexp"
6957         ;;
6958 esac
6959 : Change installation prefix, if necessary.
6960 if $test X"$prefix" != X"$installprefix"; then
6961         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6962 else
6963         installvendorarch="$vendorarchexp"
6964 fi
6965
6966 : Final catch-all directories to search
6967 $cat <<EOM
6968
6969 Lastly, you can have perl look in other directories for extensions and
6970 modules in addition to those already specified.
6971 These directories will be searched after 
6972         $sitearch 
6973         $sitelib 
6974 EOM
6975 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6976 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6977 echo ' '
6978 case "$otherlibdirs" in
6979 ''|' ') dflt='none' ;;
6980 *)      dflt="$otherlibdirs" ;;
6981 esac
6982 $cat <<EOM
6983 Enter a colon-separated set of extra paths to include in perl's @INC
6984 search path, or enter 'none' for no extra paths.
6985
6986 EOM
6987
6988 rp='Colon-separated list of additional directories for perl to search?'
6989 . ./myread
6990 case "$ans" in
6991 ' '|''|none)    otherlibdirs=' ' ;;     
6992 *)      otherlibdirs="$ans" ;;
6993 esac
6994 case "$otherlibdirs" in
6995 ' ') val=$undef ;;
6996 *)      val=$define ;;
6997 esac
6998 set d_perl_otherlibdirs
6999 eval $setvar
7000
7001 : Cruising for prototypes
7002 echo " "
7003 echo "Checking out function prototypes..." >&4
7004 $cat >prototype.c <<'EOCP'
7005 int main(int argc, char *argv[]) {
7006         exit(0);}
7007 EOCP
7008 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7009         echo "Your C compiler appears to support function prototypes."
7010         val="$define"
7011 else
7012         echo "Your C compiler doesn't seem to understand function prototypes."
7013         val="$undef"
7014 fi
7015 set prototype
7016 eval $setvar
7017 $rm -f prototype*
7018
7019 case "$prototype" in
7020 "$define") ;;
7021 *)      ansi2knr='ansi2knr'
7022         echo " "
7023         cat <<EOM >&4
7024
7025 $me:  FATAL ERROR:
7026 This version of $package can only be compiled by a compiler that 
7027 understands function prototypes.  Unfortunately, your C compiler 
7028         $cc $ccflags
7029 doesn't seem to understand them.  Sorry about that.
7030
7031 If GNU cc is available for your system, perhaps you could try that instead.  
7032
7033 Eventually, we hope to support building Perl with pre-ANSI compilers.
7034 If you would like to help in that effort, please contact <perlbug@perl.org>.
7035
7036 Aborting Configure now.
7037 EOM
7038         exit 2
7039         ;;
7040 esac
7041
7042 : determine where public executables go
7043 echo " "
7044 set dflt bin bin
7045 eval $prefixit
7046 fn=d~
7047 rp='Pathname where the public executables will reside?'
7048 . ./getfile
7049 if $test "X$ansexp" != "X$binexp"; then
7050         installbin=''
7051 fi
7052 bin="$ans"
7053 binexp="$ansexp"
7054 : Change installation prefix, if necessary.
7055 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7056 if $test X"$prefix" != X"$installprefix"; then
7057         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7058 else
7059         installbin="$binexp"
7060 fi
7061
7062 echo " "
7063 case "$extras" in
7064 '') dflt='n';;
7065 *) dflt='y';;
7066 esac
7067 cat <<EOM
7068 Perl can be built with extra modules or bundles of modules which
7069 will be fetched from the CPAN and installed alongside Perl.
7070
7071 Notice that you will need access to the CPAN; either via the Internet,
7072 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7073 be asked later to configure the CPAN.pm module which will in turn do
7074 the installation of the rest of the extra modules or bundles.)
7075
7076 Notice also that if the modules require any external software such as
7077 libraries and headers (the libz library and the zlib.h header for the
7078 Compress::Zlib module, for example) you MUST have any such software
7079 already installed, this configuration process will NOT install such
7080 things for you.
7081
7082 If this doesn't make any sense to you, just accept the default '$dflt'.
7083 EOM
7084 rp='Install any extra modules (y or n)?'
7085 . ./myread
7086 case "$ans" in
7087 y|Y)
7088         cat <<EOM
7089
7090 Please list any extra modules or bundles to be installed from CPAN,
7091 with spaces between the names.  The names can be in any format the
7092 'install' command of CPAN.pm will understand.  (Answer 'none',
7093 without the quotes, to install no extra modules or bundles.)
7094 EOM
7095         rp='Extras?'
7096         dflt="$extras"
7097         . ./myread
7098         extras="$ans"
7099 esac
7100 case "$extras" in
7101 ''|'none')
7102         val=''
7103         $rm -f ../extras.lst
7104         ;;
7105 *)      echo "(Saving the list of extras for later...)"
7106         echo "$extras" > ../extras.lst
7107         val="'$extras'"
7108         ;;
7109 esac
7110 set extras
7111 eval $setvar
7112 echo " "
7113
7114 : Find perl5.005 or later.
7115 echo "Looking for a previously installed perl5.005 or later... "
7116 case "$perl5" in
7117 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7118                 : Check if this perl is recent and can load a simple module
7119                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7120                         perl5=$tdir/perl
7121                         break;
7122                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7123                         perl5=$tdir/perl5
7124                         break;
7125                 fi
7126         done
7127         ;;
7128 *)      perl5="$perl5"
7129         ;;
7130 esac
7131 case "$perl5" in
7132 '')     echo "None found.  That's ok.";;
7133 *)      echo "Using $perl5." ;;
7134 esac
7135
7136 : Determine list of previous versions to include in @INC
7137 $cat > getverlist <<EOPL
7138 #!$perl5 -w
7139 use File::Basename;
7140 \$api_versionstring = "$api_versionstring";
7141 \$version = "$version";
7142 \$stem = "$sitelib_stem";
7143 \$archname = "$archname";
7144 EOPL
7145         $cat >> getverlist <<'EOPL'
7146 # Can't have leading @ because metaconfig interprets it as a command!
7147 ;@inc_version_list=();
7148 # XXX Redo to do opendir/readdir? 
7149 if (-d $stem) {
7150     chdir($stem);
7151     ;@candidates = glob("5.*");
7152 }
7153 else {
7154     ;@candidates = ();
7155 }
7156
7157 # XXX ToDo:  These comparisons must be reworked when two-digit
7158 # subversions come along, so that 5.7.10 compares as greater than
7159 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7160 # widespread that we can use the built-in version vectors rather
7161 # than reinventing them here.  For 5.6.0, however, we must
7162 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7163 foreach $d (@candidates) {
7164     if ($d lt $version) {
7165         if ($d ge $api_versionstring) {
7166             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7167         }
7168         elsif ($d ge "5.005") {
7169             unshift(@inc_version_list, grep { -d } $d);
7170         }
7171     }
7172     else {
7173         # Skip newer version.  I.e. don't look in
7174         # 5.7.0 if we're installing 5.6.1.
7175     }
7176 }
7177
7178 if (@inc_version_list) {
7179     print join(' ', @inc_version_list);
7180 }
7181 else {
7182     # Blank space to preserve value for next Configure run.
7183     print " ";
7184 }
7185 EOPL
7186 chmod +x getverlist
7187 case "$inc_version_list" in
7188 '')     if test -x "$perl5$exe_ext"; then
7189                 dflt=`$perl5 getverlist`
7190         else
7191                 dflt='none'
7192         fi
7193         ;;
7194 $undef) dflt='none' ;;
7195 *)  eval dflt=\"$inc_version_list\" ;;
7196 esac
7197 case "$dflt" in
7198 ''|' ') dflt=none ;;
7199 esac
7200 case "$dflt" in
7201 5.005) case "$bincompat5005" in
7202        $define|true|[yY]*) ;;
7203        *) dflt=none ;;
7204        esac
7205        ;;
7206 esac
7207 $cat <<'EOM'
7208
7209 In order to ease the process of upgrading, this version of perl 
7210 can be configured to use modules built and installed with earlier 
7211 versions of perl that were installed under $prefix.  Specify here
7212 the list of earlier versions that this version of perl should check.
7213 If Configure detected no earlier versions of perl installed under
7214 $prefix, then the list will be empty.  Answer 'none' to tell perl
7215 to not search earlier versions.
7216
7217 The default should almost always be sensible, so if you're not sure,
7218 just accept the default.
7219 EOM
7220
7221 rp='List of earlier versions to include in @INC?'
7222 . ./myread
7223 case "$ans" in
7224 [Nn]one|''|' ') inc_version_list=' ' ;;
7225 *) inc_version_list="$ans" ;;
7226 esac
7227 case "$inc_version_list" in
7228 ''|' ') 
7229         inc_version_list_init='0';;
7230 *)      inc_version_list_init=`echo $inc_version_list |
7231                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7232         ;;
7233 esac
7234 $rm -f getverlist
7235
7236 : determine whether to install perl also as /usr/bin/perl
7237
7238 echo " "
7239 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7240         $cat <<EOM
7241 Many scripts expect perl to be installed as /usr/bin/perl.
7242 I can install the perl you are about to compile also as /usr/bin/perl
7243 (in addition to $installbin/perl).
7244 EOM
7245         case "$installusrbinperl" in
7246         "$undef"|[nN]*) dflt='n';;
7247         *)              dflt='y';;
7248         esac
7249         rp="Do you want to install perl as /usr/bin/perl?"
7250         . ./myread
7251         case "$ans" in
7252         [yY]*)  val="$define";;
7253         *)      val="$undef" ;;
7254         esac
7255 else
7256         val="$undef"
7257 fi
7258 set installusrbinperl
7259 eval $setvar
7260
7261 : see if dld is available
7262 set dld.h i_dld
7263 eval $inhdr
7264
7265 : see if dlopen exists
7266 xxx_runnm="$runnm"
7267 runnm=false
7268 set dlopen d_dlopen
7269 eval $inlibc
7270 runnm="$xxx_runnm"
7271
7272 : determine which dynamic loading, if any, to compile in
7273 echo " "
7274 dldir="ext/DynaLoader"
7275 case "$usedl" in
7276 $define|y|true)
7277         dflt='y'
7278         usedl="$define"
7279         ;;
7280 $undef|n|false)
7281         dflt='n'
7282         usedl="$undef"
7283         ;;
7284 *) 
7285         dflt='n'
7286         case "$d_dlopen" in
7287             $define) dflt='y' ;;
7288         esac
7289         case "$i_dld" in
7290             $define) dflt='y' ;;
7291         esac
7292         : Does a dl_xxx.xs file exist for this operating system
7293         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7294         ;;
7295 esac
7296 rp="Do you wish to use dynamic loading?"
7297 . ./myread
7298 usedl="$ans"
7299 case "$ans" in
7300 y*) usedl="$define"
7301         case "$dlsrc" in
7302         '')
7303                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7304                         dflt="$dldir/dl_${osname}.xs"
7305                 elif $test "$d_dlopen" = "$define" ; then
7306                         dflt="$dldir/dl_dlopen.xs"
7307                 elif $test "$i_dld" = "$define" ; then
7308                         dflt="$dldir/dl_dld.xs"
7309                 else
7310                         dflt=''
7311                 fi
7312                 ;;
7313         *)      dflt="$dldir/$dlsrc"
7314                 ;;
7315         esac
7316     echo "The following dynamic loading files are available:"
7317         : Can not go over to $dldir because getfile has path hard-coded in.
7318         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7319         rp="Source file to use for dynamic loading"
7320         fn="fne"
7321         gfpth="$src"
7322         . ./getfile
7323         usedl="$define"
7324         : emulate basename
7325         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7326
7327         $cat << EOM
7328
7329 Some systems may require passing special flags to $cc -c to
7330 compile modules that will be used to create a shared library.
7331 To use no flags, say "none".
7332
7333 EOM
7334     case "$cccdlflags" in
7335     '') case "$gccversion" in
7336                 '') case "$osname" in
7337                         hpux)   dflt='+z' ;;
7338                         next)   dflt='none' ;;
7339                         irix*)  dflt='-KPIC' ;;
7340                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7341                         sunos)  dflt='-pic' ;;
7342                         *)      dflt='none' ;;
7343                     esac
7344                         ;;
7345                 *)  case "$osname" in
7346                         darwin) dflt='none' ;;
7347                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7348                         *)      dflt='-fpic' ;;
7349                     esac ;;
7350             esac ;;
7351         ' ') dflt='none' ;;
7352     *)  dflt="$cccdlflags" ;;
7353     esac
7354     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7355     . ./myread
7356     case "$ans" in
7357     none) cccdlflags=' ' ;;
7358     *) cccdlflags="$ans" ;;
7359     esac
7360
7361     cat << EOM
7362
7363 Some systems use ld to create libraries that can be dynamically loaded,
7364 while other systems (such as those using ELF) use $cc.
7365
7366 EOM
7367         case "$ld" in
7368         '')     $cat >try.c <<'EOM'
7369 /* Test for whether ELF binaries are produced */
7370 #include <fcntl.h>
7371 #include <stdlib.h>
7372 int main() {
7373         char b[4];
7374         int i = open("a.out",O_RDONLY);
7375         if(i == -1) 
7376                 exit(1); /* fail */
7377         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7378                 exit(0); /* succeed (yes, it's ELF) */
7379         else
7380                 exit(1); /* fail */
7381 }
7382 EOM
7383                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7384                         cat <<EOM
7385 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7386 EOM
7387                         dflt="$cc"
7388                 else
7389                         echo "I'll use ld to build dynamic libraries."
7390                         dflt='ld'
7391                 fi
7392                 rm -f try.c a.out
7393                 ;;
7394         *)      dflt="$ld"
7395                 ;;
7396         esac
7397
7398     rp="What command should be used to create dynamic libraries?"
7399     . ./myread
7400         ld="$ans"
7401
7402     cat << EOM
7403
7404 Some systems may require passing special flags to $ld to create a
7405 library that can be dynamically loaded.  If your ld flags include
7406 -L/other/path options to locate libraries outside your loader's normal
7407 search path, you may need to specify those -L options here as well.  To
7408 use no flags, say "none".
7409
7410 EOM
7411     case "$lddlflags" in
7412     '') case "$osname" in
7413                         beos) dflt='-nostart' ;;
7414                         hpux) dflt='-b';
7415                               case "$gccversion" in
7416                               '') dflt="$dflt +vnocompatwarnings" ;;
7417                               esac
7418                               ;;        
7419                         linux|irix*)    dflt='-shared' ;;
7420                         next)  dflt='none' ;;
7421                         solaris) dflt='-G' ;;
7422                         sunos) dflt='-assert nodefinitions' ;;
7423                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7424                 *)     dflt='none' ;;
7425                         esac
7426                         ;;
7427     *) dflt="$lddlflags" ;;
7428     esac
7429
7430         : Try to guess additional flags to pick up local libraries.
7431         : Be careful not to append to a plain 'none'
7432         case "$dflt" in
7433         none) dflt='' ;;
7434         esac
7435         for thisflag in $ldflags; do
7436                 case "$thisflag" in
7437                 -L*|-R*|-Wl,-R*)
7438                         case " $dflt " in
7439                         *" $thisflag "*) ;;
7440                         *) dflt="$dflt $thisflag" ;;
7441                         esac
7442                         ;;
7443                 esac
7444         done
7445
7446         case "$dflt" in
7447         ''|' ') dflt='none' ;;
7448         esac
7449
7450     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7451     . ./myread
7452     case "$ans" in
7453     none) lddlflags=' ' ;;
7454     *) lddlflags="$ans" ;;
7455     esac
7456
7457         cat <<EOM
7458
7459 Some systems may require passing special flags to $cc to indicate that
7460 the resulting executable will use dynamic linking.  To use no flags,
7461 say "none".
7462
7463 EOM
7464     case "$ccdlflags" in
7465     '') case "$osname" in
7466                 hpux)   dflt='-Wl,-E' ;;
7467                 linux)  dflt='-rdynamic' ;;
7468                 next)   dflt='none' ;;
7469                 sunos)  dflt='none' ;;
7470                 *)      dflt='none' ;;
7471             esac ;;
7472     ' ')  dflt='none' ;;
7473     *)  dflt="$ccdlflags" ;;
7474     esac
7475     rp="Any special flags to pass to $cc to use dynamic linking?"
7476     . ./myread
7477     case "$ans" in
7478     none) ccdlflags=' ' ;;
7479     *) ccdlflags="$ans" ;;
7480     esac
7481     ;;
7482 *)  usedl="$undef"
7483         ld='ld'
7484     dlsrc='dl_none.xs'
7485     lddlflags=''
7486     ccdlflags=''
7487     ;;
7488 esac
7489
7490 also=''
7491 case "$usedl" in
7492 $undef)
7493         # No dynamic loading being used, so don't bother even to prompt.
7494         useshrplib='false'
7495         ;;
7496 *)      case "$useshrplib" in
7497         '')     case "$osname" in
7498                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7499                         dflt=y
7500                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7501                         ;;
7502                 next*)
7503                         case "$osvers" in
7504                         4*)     dflt=y
7505                                 also='Building a shared libperl is needed for MAB support.'
7506                                 ;;
7507                         *)      dflt=n
7508                                 ;;
7509                         esac
7510                         ;;
7511                 *)      dflt=n
7512                         ;;
7513                 esac
7514                 ;;
7515         $define|true|[Yy]*)
7516                 dflt=y
7517                 ;;
7518         *)      dflt=n
7519                 ;;
7520         esac
7521         $cat << EOM
7522
7523 The perl executable is normally obtained by linking perlmain.c with
7524 libperl${_a}, any static extensions (usually just DynaLoader), and
7525 any other libraries needed on this system (such as -lm, etc.).  Since
7526 your system supports dynamic loading, it is probably possible to build
7527 a shared libperl.$so.  If you will have more than one executable linked
7528 to libperl.$so, this will significantly reduce the size of each
7529 executable, but it may have a noticeable affect on performance.  The
7530 default is probably sensible for your system.
7531 $also
7532
7533 EOM
7534         rp="Build a shared libperl.$so (y/n)"
7535         . ./myread
7536         case "$ans" in
7537         true|$define|[Yy]*)
7538                 useshrplib='true'  ;;
7539         *)      useshrplib='false' ;;
7540         esac
7541         ;;
7542 esac
7543
7544 case "$useshrplib" in
7545 true)
7546         case "$libperl" in
7547         '')
7548                 # Figure out a good name for libperl.so.  Since it gets stored in
7549                 # a version-specific architecture-dependent library, the version
7550                 # number isn't really that important, except for making cc/ld happy.
7551                 #
7552                 # A name such as libperl.so.3.1
7553                 majmin="libperl.$so.$patchlevel.$subversion"
7554                 # A name such as libperl.so.301
7555                 majonly=`echo $patchlevel $subversion |
7556                         $awk '{printf "%d%02d", $1, $2}'`
7557                 majonly=libperl.$so.$majonly
7558                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7559                 # rely on figuring it out from the naming of libc.
7560                 case "${osname}${osvers}" in
7561                 next4*)
7562                         dflt=libperl.5.$so
7563                         # XXX How handle the --version stuff for MAB?
7564                         ;;
7565                 linux*)  # ld won't link with a bare -lperl otherwise.
7566                         dflt=libperl.$so
7567                         ;;
7568                 cygwin*) # ld links against an importlib
7569                         dflt=libperl$lib_ext
7570                         ;;
7571                 *)      # Try to guess based on whether libc has major.minor.
7572                         case "$libc" in
7573                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7574                         *libc.$so.[0-9]*) dflt=$majonly ;;
7575                         *)      dflt=libperl.$so ;;
7576                         esac
7577                         ;;
7578                 esac
7579                 ;;
7580         *)      dflt=$libperl
7581                 ;;
7582         esac
7583         cat << EOM
7584
7585 I need to select a good name for the shared libperl.  If your system uses
7586 library names with major and minor numbers, then you might want something
7587 like $majmin.  Alternatively, if your system uses a single version
7588 number for shared libraries, then you might want to use $majonly.
7589 Or, your system might be quite happy with a simple libperl.$so.
7590
7591 Since the shared libperl will get installed into a version-specific
7592 architecture-dependent directory, the version number of the shared perl
7593 library probably isn't important, so the default should be o.k.
7594
7595 EOM
7596         rp='What name do you want to give to the shared libperl?'
7597         . ./myread
7598         libperl=$ans
7599         echo "Ok, I'll use $libperl"
7600         ;;
7601 *)
7602         libperl="libperl${_a}"
7603         ;;
7604 esac
7605
7606 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7607 case "$shrpdir" in
7608 '') ;;
7609 *)      $cat >&4 <<EOM
7610 WARNING:  Use of the shrpdir variable for the installation location of
7611 the shared $libperl is not supported.  It was never documented and
7612 will not work in this version.  Let me (perlbug@perl.org)
7613 know of any problems this may cause.
7614
7615 EOM
7616         case "$shrpdir" in
7617         "$archlibexp/CORE")
7618                 $cat >&4 <<EOM
7619 But your current setting of $shrpdir is
7620 the default anyway, so it's harmless.
7621 EOM
7622                 ;;
7623         *)
7624                 $cat >&4 <<EOM
7625 Further, your current attempted setting of $shrpdir
7626 conflicts with the value of $archlibexp/CORE
7627 that installperl will use.
7628 EOM
7629                 ;;
7630         esac
7631         ;;
7632 esac
7633
7634 # How will the perl executable find the installed shared $libperl?
7635 # Add $xxx to ccdlflags.
7636 # If we can't figure out a command-line option, use $shrpenv to
7637 # set env LD_RUN_PATH.  The main perl makefile uses this.
7638 shrpdir=$archlibexp/CORE
7639 xxx=''
7640 tmp_shrpenv=''
7641 if "$useshrplib"; then
7642     case "$osname" in 
7643         aix)
7644                 # We'll set it in Makefile.SH...
7645                 ;;
7646         solaris)
7647                 xxx="-R $shrpdir"
7648                 ;;
7649         freebsd|netbsd)
7650                 xxx="-Wl,-R$shrpdir"
7651                 ;;
7652         bsdos|linux|irix*|dec_osf)
7653                 xxx="-Wl,-rpath,$shrpdir"
7654                 ;;
7655         next)
7656                 # next doesn't like the default...
7657                 ;;
7658         beos)
7659                 # beos doesn't like the default, either.
7660                 ;;
7661         hpux*)
7662                 # hpux doesn't like the default, either.
7663                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7664                 ;;
7665         *)
7666                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7667                 ;;
7668         esac
7669         case "$xxx" in
7670         '') ;;
7671         *)      
7672                 # Only add $xxx if it isn't already in ccdlflags.
7673                 case " $ccdlflags " in
7674                 *" $xxx "*)     ;;
7675                 *)      ccdlflags="$ccdlflags $xxx"
7676                         cat <<EOM >&4
7677
7678 Adding $xxx to the flags
7679 passed to $ld so that the perl executable will find the 
7680 installed shared $libperl.
7681
7682 EOM
7683                         ;;
7684                 esac
7685                 ;;
7686         esac
7687 fi
7688 # Fix ccdlflags in AIX for building external extensions.
7689 # (For building Perl itself bare -bE:perl.exp is needed,
7690 #  Makefile.SH takes care of this.)
7691 case "$osname" in
7692 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7693 esac
7694 # Respect a hint or command-line value.
7695 case "$shrpenv" in
7696 '') shrpenv="$tmp_shrpenv" ;;
7697 esac
7698 case "$ldlibpthname" in
7699 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7700 none)   ldlibpthname='' ;;
7701 esac
7702
7703 : determine where manual pages are on this system
7704 echo " "
7705 case "$sysman" in
7706 '') 
7707         syspath='/usr/share/man/man1 /usr/man/man1'
7708         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7709         syspath="$syspath /usr/man/u_man/man1"
7710         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7711         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7712         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7713         sysman=`./loc . /usr/man/man1 $syspath`
7714         ;;
7715 esac
7716 if $test -d "$sysman"; then
7717         echo "System manual is in $sysman." >&4
7718 else
7719         echo "Could not find manual pages in source form." >&4
7720 fi
7721
7722 : determine where manual pages go
7723 set man1dir man1dir none
7724 eval $prefixit
7725 $cat <<EOM
7726
7727 $spackage has manual pages available in source form.
7728 EOM
7729 case "$nroff" in
7730 nroff)
7731         echo "However, you don't have nroff, so they're probably useless to you."
7732         case "$man1dir" in
7733         '') man1dir="none";;
7734         esac;;
7735 esac
7736 echo "If you don't want the manual sources installed, answer 'none'."
7737 case "$man1dir" in
7738 ' ') dflt=none
7739         ;;
7740 '')
7741         lookpath="$prefixexp/share/man/man1"
7742         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7743         lookpath="$lookpath $prefixexp/man/p_man/man1"
7744         lookpath="$lookpath $prefixexp/man/u_man/man1"
7745         lookpath="$lookpath $prefixexp/man/man.1"
7746         case "$sysman" in
7747         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7748         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7749         esac
7750         set dflt
7751         eval $prefixup
7752         ;;
7753 *)  dflt="$man1dir"
7754         ;;
7755 esac
7756 echo " "
7757 fn=dn+~
7758 rp="Where do the main $spackage manual pages (source) go?"
7759 . ./getfile
7760 if $test "X$man1direxp" != "X$ansexp"; then
7761         installman1dir=''
7762 fi
7763 man1dir="$ans"
7764 man1direxp="$ansexp"
7765 case "$man1dir" in
7766 '')     man1dir=' '
7767         installman1dir='';;
7768 esac
7769
7770 : Change installation prefix, if necessary.
7771 if $test X"$prefix" != X"$installprefix"; then
7772         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7773 else
7774         installman1dir="$man1direxp"
7775 fi
7776
7777 : What suffix to use on installed man pages
7778
7779 case "$man1dir" in
7780 ' ')
7781         man1ext='0'
7782         ;;
7783 *)
7784         rp="What suffix should be used for the main $spackage man pages?"
7785         case "$man1ext" in
7786         '')     case "$man1dir" in
7787                 *1)  dflt=1 ;;
7788                 *1p) dflt=1p ;;
7789                 *1pm) dflt=1pm ;;
7790                 *l) dflt=l;;
7791                 *n) dflt=n;;
7792                 *o) dflt=o;;
7793                 *p) dflt=p;;
7794                 *C) dflt=C;;
7795                 *L) dflt=L;;
7796                 *L1) dflt=L1;;
7797                 *) dflt=1;;
7798                 esac
7799                 ;;
7800         *)      dflt="$man1ext";;
7801         esac
7802         . ./myread
7803         man1ext="$ans"
7804         ;;
7805 esac
7806
7807 : see if we can have long filenames
7808 echo " "
7809 first=123456789abcdef
7810 $rm -f $first
7811 if (echo hi >$first) 2>/dev/null; then
7812         if $test -f 123456789abcde; then
7813                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7814                 val="$undef"
7815         else
7816                 echo 'You can have filenames longer than 14 characters.'>&4
7817                 val="$define"
7818         fi
7819 else
7820         $cat <<'EOM'
7821 You can't have filenames longer than 14 chars.
7822 You can't even think about them!
7823 EOM
7824         val="$undef"
7825 fi 
7826 set d_flexfnam
7827 eval $setvar
7828 $rm -rf 123456789abcde*
7829
7830 : determine where library module manual pages go
7831 set man3dir man3dir none
7832 eval $prefixit
7833 $cat <<EOM
7834
7835 $spackage has manual pages for many of the library modules.
7836 EOM
7837
7838 case "$nroff" in
7839 nroff)
7840         $cat <<'EOM'
7841 However, you don't have nroff, so they're probably useless to you.
7842 EOM
7843         case "$man3dir" in
7844         '') man3dir="none";;
7845         esac;;
7846 esac
7847
7848 case "$d_flexfnam" in
7849 undef)
7850         $cat <<'EOM'
7851 However, your system can't handle the long file names like File::Basename.3. 
7852 EOM
7853         case "$man3dir" in
7854         '') man3dir="none";;
7855         esac;;
7856 esac
7857
7858 echo "If you don't want the manual sources installed, answer 'none'."
7859 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7860 case "$man3dir" in
7861 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7862         if $test -d "$privlib/man/man3"; then
7863                 cat <<EOM >&4
7864
7865 WARNING:  Previous versions of perl installed man3 pages into
7866 $privlib/man/man3.  This version will suggest a 
7867 new default of $dflt.  
7868 EOM
7869                 tdflt=$dflt
7870                 dflt='n'
7871                 rp='Do you wish to preserve the old behavior?(y/n)'
7872                 . ./myread
7873                 case "$ans" in
7874                 y*) dflt="$privlib/man/man3" ;;
7875                 *)  dflt=$tdflt ;;
7876                 esac
7877     fi
7878         ;;
7879 *)      dflt="$man3dir" ;;
7880 esac
7881 case "$dflt" in
7882 ' ') dflt=none ;;
7883 esac
7884 echo " "
7885 fn=dn+~
7886 rp="Where do the $package library man pages (source) go?"
7887 . ./getfile
7888 man3dir="$ans"
7889 man3direxp="$ansexp"
7890 case "$man3dir" in
7891 '')     man3dir=' '
7892         installman3dir='';;
7893 esac
7894
7895 : Change installation prefix, if necessary.
7896 if $test X"$prefix" != X"$installprefix"; then
7897         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7898 else
7899         installman3dir="$man3direxp"
7900 fi
7901
7902 : What suffix to use on installed man pages
7903 case "$man3dir" in
7904 ' ')
7905         man3ext='0'
7906         ;;
7907 *)
7908         rp="What suffix should be used for the $package library man pages?"
7909         case "$man3ext" in
7910         '')     case "$man3dir" in
7911                 *3)  dflt=3 ;;
7912                 *3p) dflt=3p ;;
7913                 *3pm) dflt=3pm ;;
7914                 *l) dflt=l;;
7915                 *n) dflt=n;;
7916                 *o) dflt=o;;
7917                 *p) dflt=p;;
7918                 *C) dflt=C;;
7919                 *L) dflt=L;;
7920                 *L3) dflt=L3;;
7921                 *) dflt=3;;
7922                 esac
7923                 ;;
7924         *)      dflt="$man3ext";;
7925         esac
7926         . ./myread
7927         man3ext="$ans"
7928         ;;
7929 esac
7930
7931 : see if we have to deal with yellow pages, now NIS.
7932 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
7933         if $test -f /usr/etc/nibindd; then
7934                 echo " "
7935                 echo "I'm fairly confident you're on a NeXT."
7936                 echo " "
7937                 rp='Do you get the hosts file via NetInfo?'
7938                 dflt=y
7939                 case "$hostcat" in
7940                 nidump*) ;;
7941                 '') ;;
7942                 *) dflt=n;;
7943                 esac
7944                 . ./myread
7945                 case "$ans" in
7946                 y*) hostcat='nidump hosts .';;
7947                 *)      case "$hostcat" in
7948                         nidump*) hostcat='';;
7949                         esac
7950                         ;;
7951                 esac
7952         fi
7953         case "$hostcat" in
7954         nidump*) ;;
7955         *)
7956                 case "$hostcat" in
7957                 *ypcat*) dflt=y;;
7958                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7959                                 dflt=y
7960                         else
7961                                 dflt=n
7962                         fi;;
7963                 *) dflt=n;;
7964                 esac
7965                 echo " "
7966                 rp='Are you getting the hosts file via yellow pages?'
7967                 . ./myread
7968                 case "$ans" in
7969                 y*) hostcat='ypcat hosts';;
7970                 *) hostcat='cat /etc/hosts';;
7971                 esac
7972                 ;;
7973         esac
7974 fi
7975 case "$hostcat" in
7976 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7977 esac
7978 case "$groupcat" in
7979 '') test -f /etc/group && groupcat='cat /etc/group';;
7980 esac
7981 case "$passcat" in
7982 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7983 esac
7984
7985 : now get the host name
7986 echo " "
7987 echo "Figuring out host name..." >&4
7988 case "$myhostname" in
7989 '') cont=true
7990         echo 'Maybe "hostname" will work...'
7991         if tans=`sh -c hostname 2>&1` ; then
7992                 myhostname=$tans
7993                 phostname=hostname
7994                 cont=''
7995         fi
7996         ;;
7997 *) cont='';;
7998 esac
7999 if $test "$cont"; then
8000         if ./xenix; then
8001                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8002                 if tans=`cat /etc/systemid 2>&1` ; then
8003                         myhostname=$tans
8004                         phostname='cat /etc/systemid'
8005                         echo "Whadyaknow.  Xenix always was a bit strange..."
8006                         cont=''
8007                 fi
8008         elif $test -r /etc/systemid; then
8009                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8010         fi
8011 fi
8012 if $test "$cont"; then
8013         echo 'No, maybe "uuname -l" will work...'
8014         if tans=`sh -c 'uuname -l' 2>&1` ; then
8015                 myhostname=$tans
8016                 phostname='uuname -l'
8017         else
8018                 echo 'Strange.  Maybe "uname -n" will work...'
8019                 if tans=`sh -c 'uname -n' 2>&1` ; then
8020                         myhostname=$tans
8021                         phostname='uname -n'
8022                 else
8023                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8024                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8025                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8026                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8027                         else
8028                                 case "$myhostname" in
8029                                 '') echo "Does this machine have an identity crisis or something?"
8030                                         phostname='';;
8031                                 *)
8032                                         echo "Well, you said $myhostname before..."
8033                                         phostname='echo $myhostname';;
8034                                 esac
8035                         fi
8036                 fi
8037         fi
8038 fi
8039 case "$myhostname" in
8040 '') myhostname=noname ;;
8041 esac
8042 : you do not want to know about this
8043 set $myhostname
8044 myhostname=$1
8045
8046 : verify guess
8047 if $test "$myhostname" ; then
8048         dflt=y
8049         rp='Your host name appears to be "'$myhostname'".'" Right?"
8050         . ./myread
8051         case "$ans" in
8052         y*) ;;
8053         *) myhostname='';;
8054         esac
8055 fi
8056
8057 : bad guess or no guess
8058 while $test "X$myhostname" = X ; do
8059         dflt=''
8060         rp="Please type the (one word) name of your host:"
8061         . ./myread
8062         myhostname="$ans"
8063 done
8064
8065 : translate upper to lower if necessary
8066 case "$myhostname" in
8067 *[A-Z]*)
8068         echo "(Normalizing case in your host name)"
8069         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8070         ;;
8071 esac
8072
8073 case "$myhostname" in
8074 *.*)
8075         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8076         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8077         echo "(Trimming domain name from host name--host name is now $myhostname)"
8078         ;;
8079 *) case "$mydomain" in
8080         '')
8081                 {
8082                         test "X$hostcat" = "Xypcat hosts" &&
8083                         ypmatch "$myhostname" hosts 2>/dev/null |\
8084                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8085                         $test -s hosts
8086                 } || {
8087                         test "X$hostcat" != "X" &&
8088                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8089                                         /[       ]$myhostname[  . ]/p" > hosts
8090                 }
8091                 tmp_re="[       . ]"
8092                 if $test -f hosts; then
8093                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8094                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8095                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8096                                 hosts | $sort | $uniq | \
8097                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8098                         case `$echo X$dflt` in
8099                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8100                                 dflt=.
8101                                 ;;
8102                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8103                                 ;;
8104                         esac
8105                 else
8106                         echo "(I cannot locate a hosts database anywhere)"
8107                         dflt=.
8108                 fi
8109                 case "$dflt" in
8110                 .)
8111                         tans=`./loc resolv.conf X /etc /usr/etc`
8112                         if $test -f "$tans"; then
8113                                 echo "(Attempting domain name extraction from $tans)"
8114                                 dflt=.`$sed -n -e 's/   / /g' \
8115                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8116                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8117                                 case "$dflt" in
8118                                 .) dflt=.`$sed -n -e 's/        / /g' \
8119                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8120                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8121                                         ;;
8122                                 esac
8123                         fi
8124                         ;;
8125                 esac
8126                 case "$dflt" in
8127                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8128                         dflt=.`sh -c domainname 2>/dev/null`
8129                         case "$dflt" in
8130                         '') dflt='.';;
8131                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8132                         esac
8133                         ;;
8134                 esac
8135                 case "$dflt$osname" in
8136                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8137                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8138                         ;;
8139                 esac
8140                 case "$dflt" in
8141                 .) echo "(Lost all hope -- silly guess then)"
8142                         dflt='.nonet'
8143                         ;;
8144                 esac
8145                 $rm -f hosts
8146                 ;;
8147         *) dflt="$mydomain";;
8148         esac;;
8149 esac
8150 echo " "
8151 rp="What is your domain name?"
8152 . ./myread
8153 tans="$ans"
8154 case "$ans" in
8155 '') ;;
8156 .*) ;;
8157 *) tans=".$tans";;
8158 esac
8159 mydomain="$tans"
8160
8161 : translate upper to lower if necessary
8162 case "$mydomain" in
8163 *[A-Z]*)
8164         echo "(Normalizing case in your domain name)"
8165         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8166         ;;
8167 esac
8168
8169 : a little sanity check here
8170 case "$phostname" in
8171 '') ;;
8172 *)
8173         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8174         $myhostname$mydomain|$myhostname) ;;
8175         *)
8176                 case "$phostname" in
8177                 sed*)
8178                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8179                         ;;
8180                 *)
8181                         echo "(That doesn't agree with your $phostname command, by the way.)"
8182                         ;;
8183                 esac
8184         ;;
8185         esac
8186         ;;
8187 esac
8188
8189 $cat <<EOM
8190
8191 I need to get your e-mail address in Internet format if possible, i.e.
8192 something like user@host.domain. Please answer accurately since I have
8193 no easy means to double check it. The default value provided below
8194 is most probably close to reality but may not be valid from outside
8195 your organization...
8196
8197 EOM
8198 cont=x
8199 while test "$cont"; do
8200         case "$cf_email" in
8201         '') dflt="$cf_by@$myhostname$mydomain";;
8202         *) dflt="$cf_email";;
8203         esac
8204         rp='What is your e-mail address?'
8205         . ./myread
8206         cf_email="$ans"
8207         case "$cf_email" in
8208         *@*.*) cont='' ;;
8209         *)
8210                 rp='Address does not look like an Internet one.  Use it anyway?'
8211                 case "$fastread" in
8212                 yes) dflt=y ;;
8213                 *) dflt=n ;;
8214                 esac
8215                 . ./myread
8216                 case "$ans" in
8217                 y*) cont='' ;;
8218                 *) echo " " ;;
8219                 esac
8220                 ;;
8221         esac
8222 done
8223
8224 $cat <<EOM
8225
8226 If you or somebody else will be maintaining perl at your site, please
8227 fill in the correct e-mail address here so that they may be contacted
8228 if necessary. Currently, the "perlbug" program included with perl
8229 will send mail to this address in addition to perlbug@perl.org. You may
8230 enter "none" for no administrator.
8231
8232 EOM
8233 case "$perladmin" in
8234 '') dflt="$cf_email";;
8235 *) dflt="$perladmin";;
8236 esac
8237 rp='Perl administrator e-mail address'
8238 . ./myread
8239 perladmin="$ans"
8240
8241 : determine whether to only install version-specific parts.
8242 echo " "
8243 $cat <<EOM
8244 Do you want to install only the version-specific parts of the perl
8245 distribution?  Usually you do *not* want to do this.
8246 EOM
8247 case "$versiononly" in
8248 "$define"|[Yy]*|true) dflt='y' ;;
8249 *) dflt='n';
8250 esac
8251 rp="Do you want to install only the version-specific parts of perl?"
8252 . ./myread
8253 case "$ans" in
8254 [yY]*)  val="$define";;
8255 *)      val="$undef" ;;
8256 esac
8257 set versiononly
8258 eval $setvar
8259
8260 : figure out how to guarantee perl startup
8261 case "$startperl" in
8262 '')
8263         case "$sharpbang" in
8264         *!)
8265                 $cat <<EOH
8266
8267 I can use the #! construct to start perl on your system. This will
8268 make startup of perl scripts faster, but may cause problems if you
8269 want to share those scripts and perl is not in a standard place
8270 ($binexp/perl) on all your platforms. The alternative is to force
8271 a shell by starting the script with a single ':' character.
8272
8273 EOH
8274                 case "$versiononly" in
8275                 "$define")      dflt="$binexp/perl$version";;  
8276                 *)              dflt="$binexp/perl";;
8277                 esac
8278                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8279                 . ./myread
8280                 case "$ans" in
8281                 none)   startperl=": # use perl";;
8282                 *)      startperl="#!$ans"
8283                         if $test 30 -lt `echo "$ans" | wc -c`; then
8284                                 $cat >&4 <<EOM
8285
8286 WARNING:  Some systems limit the #! command to 32 characters.
8287 If you experience difficulty running Perl scripts with #!, try
8288 installing Perl in a directory with a shorter pathname.
8289
8290 EOM
8291                         fi ;;
8292                 esac
8293                 ;;
8294         *) startperl=": # use perl"
8295                 ;;
8296         esac
8297         ;;
8298 esac
8299 echo "I'll use $startperl to start perl scripts."
8300
8301 : figure best path for perl in scripts
8302 case "$perlpath" in
8303 '')
8304         case "$versiononly" in
8305         "$define")      perlpath="$binexp/perl$version";;
8306         *)              perlpath="$binexp/perl";;
8307         esac
8308         case "$startperl" in
8309         *!*) ;;
8310         *)
8311                 $cat <<EOH
8312
8313 I will use the "eval 'exec'" idiom to start Perl on your system.
8314 I can use the full path of your Perl binary for this purpose, but
8315 doing so may cause problems if you want to share those scripts and
8316 Perl is not always in a standard place ($binexp/perl).
8317
8318 EOH
8319                 dflt="$binexp/perl"
8320                 rp="What path shall I use in \"eval 'exec'\"?"
8321                 . ./myread
8322                 perlpath="$ans"
8323                 ;;
8324         esac
8325         ;;
8326 esac
8327 case "$startperl" in
8328 *!*)    ;;
8329 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8330 esac
8331
8332 : determine where public executable scripts go
8333 set scriptdir scriptdir
8334 eval $prefixit
8335 case "$scriptdir" in
8336 '')
8337         dflt="$bin"
8338         : guess some guesses
8339         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8340         $test -d /usr/share/bin     && dflt=/usr/share/bin
8341         $test -d /usr/local/script  && dflt=/usr/local/script
8342         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8343         $test -d $prefixexp/script  && dflt=$prefixexp/script
8344         set dflt
8345         eval $prefixup
8346         ;;
8347 *)  dflt="$scriptdir"
8348         ;;
8349 esac
8350 $cat <<EOM
8351  
8352 Some installations have a separate directory just for executable scripts so
8353 that they can mount it across multiple architectures but keep the scripts in
8354 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8355 Or you might just lump your scripts in with all your other executables.
8356  
8357 EOM
8358 fn=d~
8359 rp='Where do you keep publicly executable scripts?'
8360 . ./getfile
8361 if $test "X$ansexp" != "X$scriptdirexp"; then
8362         installscript=''
8363 fi
8364 scriptdir="$ans"
8365 scriptdirexp="$ansexp"
8366 : Change installation prefix, if necessary.
8367 if $test X"$prefix" != X"$installprefix"; then
8368         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8369 else
8370         installscript="$scriptdirexp"
8371 fi
8372
8373 : determine where add-on public executables go
8374 case "$sitebin" in
8375 '')     dflt=$siteprefix/bin ;;
8376 *)      dflt=$sitebin ;;
8377 esac
8378 fn=d~
8379 rp='Pathname where the add-on public executables should be installed?'
8380 . ./getfile
8381 sitebin="$ans"
8382 sitebinexp="$ansexp"
8383 : Change installation prefix, if necessary.
8384 if $test X"$prefix" != X"$installprefix"; then
8385         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8386 else
8387         installsitebin="$sitebinexp"
8388 fi
8389
8390 : define an is-a-typedef? function
8391 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8392 case "$inclist" in
8393 "") inclist="sys/types.h";;
8394 esac;
8395 eval "varval=\$$var";
8396 case "$varval" in
8397 "")
8398         $rm -f temp.c;
8399         for inc in $inclist; do
8400                 echo "#include <$inc>" >>temp.c;
8401         done;
8402         echo "#ifdef $type" >> temp.c;
8403         echo "printf(\"We have $type\");" >> temp.c;
8404         echo "#endif" >> temp.c;
8405         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8406         if $contains $type temp.E >/dev/null 2>&1; then
8407                 eval "$var=\$type";
8408         else
8409                 eval "$var=\$def";
8410         fi;
8411         $rm -f temp.?;;
8412 *) eval "$var=\$varval";;
8413 esac'
8414
8415 : define an is-a-typedef? function that prompts if the type is not available.
8416 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8417 case "$inclist" in
8418 "") inclist="sys/types.h";;
8419 esac;
8420 eval "varval=\$$var";
8421 case "$varval" in
8422 "")
8423         $rm -f temp.c;
8424         for inc in $inclist; do
8425                 echo "#include <$inc>" >>temp.c;
8426         done;
8427         echo "#ifdef $type" >> temp.c;
8428         echo "printf(\"We have $type\");" >> temp.c;
8429         echo "#endif" >> temp.c;
8430         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8431         echo " " ;
8432         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8433         if $contains $type temp.E >/dev/null 2>&1; then
8434                 echo "$type found." >&4;
8435                 eval "$var=\$type";
8436         else
8437                 echo "$type NOT found." >&4;
8438                 dflt="$def";
8439                 . ./myread ;
8440                 eval "$var=\$ans";
8441         fi;
8442         $rm -f temp.?;;
8443 *) eval "$var=\$varval";;
8444 esac'
8445
8446 : see what type lseek is declared as in the kernel
8447 rp="What is the type used for lseek's offset on this system?"
8448 set off_t lseektype long stdio.h sys/types.h
8449 eval $typedef_ask
8450
8451 echo " "
8452 echo "Checking to see how big your file offsets are..." >&4
8453 $cat >try.c <<EOCP
8454 #include <sys/types.h>
8455 #include <stdio.h>
8456 int main()
8457 {
8458     printf("%d\n", (int)sizeof($lseektype));
8459     return(0); 
8460 }
8461 EOCP
8462 set try
8463 if eval $compile_ok; then
8464         lseeksize=`$run ./try`
8465         echo "Your file offsets are $lseeksize bytes long."
8466 else
8467         dflt=$longsize
8468         echo " "
8469         echo "(I can't seem to compile the test program.  Guessing...)"
8470         rp="What is the size of your file offsets (in bytes)?"
8471         . ./myread
8472         lseeksize="$ans"
8473 fi
8474 $rm -f try.c try
8475
8476 : see what type file positions are declared as in the library
8477 rp="What is the type for file position used by fsetpos()?"
8478 set fpos_t fpostype long stdio.h sys/types.h
8479 eval $typedef_ask
8480
8481 echo " "
8482 case "$fpostype" in
8483 *_t) zzz="$fpostype"    ;;
8484 *)   zzz="fpos_t"       ;;
8485 esac
8486 echo "Checking the size of $zzz..." >&4 
8487 cat > try.c <<EOCP
8488 #include <sys/types.h>
8489 #include <stdio.h>
8490 int main() {
8491     printf("%d\n", (int)sizeof($fpostype));
8492     exit(0);
8493 }
8494 EOCP
8495 set try
8496 if eval $compile_ok; then
8497         yyy=`$run ./try`
8498         case "$yyy" in
8499         '')     fpossize=4
8500                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8501                 ;;
8502         *)      fpossize=$yyy
8503                 echo "Your $zzz is $fpossize bytes long."
8504                 ;;
8505         esac
8506 else
8507         dflt="$longsize"
8508         echo " " >&4
8509         echo "(I can't compile the test program.  Guessing...)" >&4
8510         rp="What is the size of your file positions (in bytes)?"
8511         . ./myread
8512         fpossize="$ans"
8513 fi
8514
8515
8516
8517 # Backward compatibility (uselfs is deprecated).
8518 case "$uselfs" in
8519 "$define"|true|[yY]*)
8520         cat <<EOM >&4
8521
8522 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8523 EOM
8524         uselargefiles="$define"
8525         ;;
8526 esac                          
8527
8528 case "$lseeksize:$fpossize" in
8529 8:8) cat <<EOM
8530
8531 You can have files larger than 2 gigabytes.
8532 EOM
8533    val="$define" ;;
8534 *)    case "$uselargefiles" in
8535    "$undef"|false|[nN]*) dflt='n' ;;
8536    *)   dflt='y' ;;
8537    esac
8538    cat <<EOM
8539
8540 Perl can be built to understand large files (files larger than 2 gigabytes)
8541 on some systems.  To do so, Configure can be run with -Duselargefiles.
8542
8543 If this doesn't make any sense to you, just accept the default '$dflt'.
8544 EOM
8545    rp='Try to understand large files, if available?'
8546    . ./myread
8547    case "$ans" in
8548    y|Y)         val="$define" ;;
8549    *)           val="$undef"  ;;
8550    esac
8551    ;;
8552 esac
8553 set uselargefiles
8554 eval $setvar
8555 case "$uselargefiles" in
8556 "$define")
8557 : Look for a hint-file generated 'call-back-unit'.  If the
8558 : user has specified that a large files perl is to be built,
8559 : we may need to set or change some other defaults.
8560         if $test -f uselargefiles.cbu; then
8561                 echo "Your platform has some specific hints for large file builds, using them..."
8562                 . ./uselargefiles.cbu
8563                 echo " "
8564                 echo "Rechecking to see how big your file offsets are..." >&4
8565                 $cat >try.c <<EOCP
8566 #include <sys/types.h>
8567 #include <stdio.h>
8568 int main()
8569 {
8570     printf("%d\n", (int)sizeof($lseektype));
8571     return(0); 
8572 }
8573 EOCP
8574                 set try
8575                 if eval $compile_ok; then
8576                         lseeksize=`$run ./try`
8577                         $echo "Your file offsets are now $lseeksize bytes long."
8578                 else
8579                         dflt="$lseeksize"
8580                         echo " "
8581                         echo "(I can't seem to compile the test program.  Guessing...)"
8582                         rp="What is the size of your file offsets (in bytes)?"
8583                         . ./myread
8584                         lseeksize="$ans"
8585                 fi
8586                 case "$fpostype" in
8587                 *_t) zzz="$fpostype"    ;;
8588                 *)   zzz="fpos_t"       ;;
8589                 esac
8590                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8591                 $cat > try.c <<EOCP
8592 #include <sys/types.h>
8593 #include <stdio.h>
8594 int main() {
8595     printf("%d\n", (int)sizeof($fpostype));
8596     exit(0);
8597 }
8598 EOCP
8599                 set try
8600                 if eval $compile_ok; then
8601                         yyy=`$run ./try`
8602                         dflt="$lseeksize"
8603                         case "$yyy" in
8604                         '')     echo " "
8605                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8606                                 ;;
8607                         *)      fpossize=$yyy
8608                                 echo " $fpossize bytes." >&4
8609                                 ;;
8610                         esac
8611                 else
8612                         dflt="$fpossize"
8613                         echo " "
8614                         echo "(I can't compile the test program.  Guessing...)" >&4
8615                         rp="What is the size of your file positions (in bytes)?"
8616                         . ./myread
8617                         fpossize="$ans"
8618                 fi
8619                 $rm -f try.c try
8620         fi
8621         ;;
8622 esac
8623
8624 case "$vendorprefix" in
8625 '')     d_vendorbin="$undef"
8626         vendorbin=''
8627         vendorbinexp=''
8628         ;;
8629 *)      d_vendorbin="$define"
8630         : determine where vendor-supplied executables go.
8631         case "$vendorbin" in
8632         '') dflt=$vendorprefix/bin ;;
8633         *)      dflt="$vendorbin" ;;
8634         esac
8635         fn=d~+
8636         rp='Pathname for the vendor-supplied executables directory?'
8637         . ./getfile
8638         vendorbin="$ans"
8639         vendorbinexp="$ansexp"
8640         ;;
8641 esac
8642 : Change installation prefix, if necessary.
8643 if $test X"$prefix" != X"$installprefix"; then
8644         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8645 else
8646         installvendorbin="$vendorbinexp"
8647 fi
8648
8649 : see if qgcvt exists
8650 set qgcvt d_qgcvt
8651 eval $inlibc
8652
8653 : Check how to convert floats to strings.
8654 echo " "
8655 echo "Checking for an efficient way to convert floats to strings."
8656 echo " " > try.c
8657 case "$uselongdouble" in
8658 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8659 esac
8660 case "$d_longdbl" in
8661 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8662 esac
8663 case "$d_PRIgldbl" in
8664 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8665 esac
8666 $cat >>try.c <<EOP
8667 #ifdef TRY_gconvert
8668 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8669 char *myname = "gconvert";
8670 #endif
8671 #ifdef TRY_gcvt
8672 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8673 char *myname = "gcvt";
8674 #endif
8675 #ifdef TRY_qgcvt
8676 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8677 char *myname = "qgcvt";
8678 #define DOUBLETYPE long double
8679 #endif
8680 #ifdef TRY_sprintf
8681 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8682 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8683 #else
8684 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8685 #endif
8686 char *myname = "sprintf";
8687 #endif
8688
8689 #ifndef DOUBLETYPE
8690 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8691 #define DOUBLETYPE long double
8692 #else
8693 #define DOUBLETYPE double
8694 #endif
8695 #endif
8696
8697 #include <stdio.h>
8698
8699 #define I_STDLIB $i_stdlib
8700 #ifdef I_STDLIB
8701 #include <stdlib.h>
8702 #endif
8703
8704 int
8705 checkit(expect, got)
8706 char *expect;
8707 char *got;
8708 {
8709     if (strcmp(expect, got)) {
8710                 printf("%s oddity:  Expected %s, got %s\n",
8711                         myname, expect, got);
8712                 exit(1);
8713         }
8714 }
8715
8716 int main()
8717
8718         char buf[64]; 
8719         buf[63] = '\0';
8720
8721         /* This must be 1st test on (which?) platform */
8722         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8723         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8724         checkit("0.1", buf);
8725
8726         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8727         checkit("1", buf);
8728
8729         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8730         checkit("1.1", buf);
8731
8732         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8733         checkit("1.01", buf);
8734
8735         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8736         checkit("1.001", buf);
8737
8738         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8739         checkit("1.0001", buf);
8740
8741         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8742         checkit("1.00001", buf);
8743
8744         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8745         checkit("1.000001", buf);
8746
8747         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8748         checkit("0", buf);
8749
8750         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8751         checkit("-1", buf);
8752
8753         /* Some Linux gcvt's give 1.e+5 here. */
8754         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8755         checkit("100000", buf);
8756         
8757         /* Some Linux gcvt's give -1.e+5 here. */
8758         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8759         checkit("-100000", buf);
8760
8761         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8762         checkit("123.456", buf);
8763
8764         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8765         Gconvert((DOUBLETYPE)1e30, 8, 0, buf);
8766         if (strlen(buf) > 5)
8767             checkit("1e+030", buf); /* for Microsoft */
8768         else
8769             checkit("1e+30", buf);
8770
8771         exit(0);
8772 }
8773 EOP
8774 case "$d_Gconvert" in
8775 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8776 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8777 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8778 *) xxx_list='gconvert gcvt sprintf' ;;
8779 esac
8780
8781 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8782 "$define$define$define")
8783     # for long doubles prefer first qgcvt, then sprintf
8784     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8785     xxx_list="sprintf $xxx_list"
8786     case "$d_qgcvt" in
8787     "$define") xxx_list="qgcvt $xxx_list" ;;
8788     esac
8789     ;;
8790 esac
8791
8792 for xxx_convert in $xxx_list; do
8793         echo "Trying $xxx_convert..."
8794         $rm -f try try$_o
8795         set try -DTRY_$xxx_convert
8796         if eval $compile; then
8797                 echo "$xxx_convert() found." >&4
8798                 if $run ./try; then
8799                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8800                         break;
8801                 else
8802                         echo "...But $xxx_convert didn't work as I expected."
8803                 fi
8804         else
8805                 echo "$xxx_convert NOT found." >&4
8806         fi
8807 done
8808         
8809 case "$xxx_convert" in
8810 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8811 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8812 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8813 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8814    "$define$define$define")
8815       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8816    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8817    esac
8818    ;;  
8819 esac
8820
8821 : see if _fwalk exists
8822 set fwalk d__fwalk
8823 eval $inlibc
8824
8825 : Initialize h_fcntl
8826 h_fcntl=false
8827
8828 : Initialize h_sysfile
8829 h_sysfile=false
8830
8831 : access call always available on UNIX
8832 set access d_access
8833 eval $inlibc
8834
8835 : locate the flags for 'access()'
8836 case "$d_access" in
8837 "$define")
8838         echo " "
8839         $cat >access.c <<'EOCP'
8840 #include <sys/types.h>
8841 #ifdef I_FCNTL
8842 #include <fcntl.h>
8843 #endif
8844 #ifdef I_SYS_FILE
8845 #include <sys/file.h>
8846 #endif
8847 #ifdef I_UNISTD
8848 #include <unistd.h>
8849 #endif
8850 int main() {
8851         exit(R_OK);
8852 }
8853 EOCP
8854         : check sys/file.h first, no particular reason here
8855         if $test `./findhdr sys/file.h` && \
8856                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8857                 h_sysfile=true;
8858                 echo "<sys/file.h> defines the *_OK access constants." >&4
8859         elif $test `./findhdr fcntl.h` && \
8860                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8861                 h_fcntl=true;
8862                 echo "<fcntl.h> defines the *_OK access constants." >&4
8863         elif $test `./findhdr unistd.h` && \
8864                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8865                 echo "<unistd.h> defines the *_OK access constants." >&4
8866         else
8867                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8868         fi
8869         ;;
8870 esac
8871 $rm -f access*
8872
8873 : see if accessx exists
8874 set accessx d_accessx
8875 eval $inlibc
8876
8877 : see if alarm exists
8878 set alarm d_alarm
8879 eval $inlibc
8880
8881 : see if atolf exists
8882 set atolf d_atolf
8883 eval $inlibc
8884
8885 : see if atoll exists
8886 set atoll d_atoll
8887 eval $inlibc
8888
8889 : Look for GNU-cc style attribute checking
8890 echo " "
8891 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8892 $cat >attrib.c <<'EOCP'
8893 #include <stdio.h>
8894 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8895 EOCP
8896 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8897         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8898                 echo "Your C compiler doesn't fully support __attribute__."
8899                 val="$undef"
8900         else
8901                 echo "Your C compiler supports __attribute__."
8902                 val="$define"
8903         fi
8904 else
8905         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8906         val="$undef"
8907 fi
8908 set d_attribut
8909 eval $setvar
8910 $rm -f attrib*
8911
8912 : see if bcmp exists
8913 set bcmp d_bcmp
8914 eval $inlibc
8915
8916 : see if bcopy exists
8917 set bcopy d_bcopy
8918 eval $inlibc
8919
8920 : see if this is a unistd.h system
8921 set unistd.h i_unistd
8922 eval $inhdr
8923
8924 : see if getpgrp exists
8925 set getpgrp d_getpgrp
8926 eval $inlibc
8927
8928 case "$d_getpgrp" in
8929 "$define")
8930         echo " "
8931         echo "Checking to see which flavor of getpgrp is in use..."
8932         $cat >try.c <<EOP
8933 #$i_unistd I_UNISTD
8934 #include <sys/types.h>
8935 #ifdef I_UNISTD
8936 #  include <unistd.h>
8937 #endif
8938 int main()
8939 {
8940         if (getuid() == 0) {
8941                 printf("(I see you are running Configure as super-user...)\n");
8942                 setuid(1);
8943         }
8944 #ifdef TRY_BSD_PGRP
8945         if (getpgrp(1) == 0)
8946                 exit(0);
8947 #else
8948         if (getpgrp() > 0)
8949                 exit(0);
8950 #endif
8951         exit(1);
8952 }
8953 EOP
8954         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8955                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8956                 val="$define"
8957         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8958                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8959                 val="$undef"
8960         else
8961                 echo "I can't seem to compile and run the test program."
8962                 if ./usg; then
8963                         xxx="a USG one, i.e. you use getpgrp()."
8964                 else
8965                         # SVR4 systems can appear rather BSD-ish.
8966                         case "$i_unistd" in
8967                         $undef)
8968                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8969                                 val="$define"
8970                                 ;;
8971                         $define)
8972                                 xxx="probably a USG one, i.e. you use getpgrp()."
8973                                 val="$undef"
8974                                 ;;
8975                         esac
8976                 fi
8977                 echo "Assuming your getpgrp is $xxx" >&4
8978         fi
8979         ;;
8980 *) val="$undef";;
8981 esac
8982 set d_bsdgetpgrp
8983 eval $setvar
8984 $rm -f try try.*
8985
8986 : see if setpgrp exists
8987 set setpgrp d_setpgrp
8988 eval $inlibc
8989
8990 case "$d_setpgrp" in
8991 "$define")
8992         echo " "
8993         echo "Checking to see which flavor of setpgrp is in use..."
8994         $cat >try.c <<EOP
8995 #$i_unistd I_UNISTD
8996 #include <sys/types.h>
8997 #ifdef I_UNISTD
8998 #  include <unistd.h>
8999 #endif
9000 int main()
9001 {
9002         if (getuid() == 0) {
9003                 printf("(I see you are running Configure as super-user...)\n");
9004                 setuid(1);
9005         }
9006 #ifdef TRY_BSD_PGRP
9007         if (-1 == setpgrp(1, 1))
9008                 exit(0);
9009 #else
9010         if (setpgrp() != -1)
9011                 exit(0);
9012 #endif
9013         exit(1);
9014 }
9015 EOP
9016         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9017                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9018                 val="$define"
9019         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9020                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9021                 val="$undef"
9022         else
9023                 echo "(I can't seem to compile and run the test program.)"
9024                 if ./usg; then
9025                         xxx="a USG one, i.e. you use setpgrp()."
9026                 else
9027                         # SVR4 systems can appear rather BSD-ish.
9028                         case "$i_unistd" in
9029                         $undef)
9030                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9031                                 val="$define"
9032                                 ;;
9033                         $define)
9034                                 xxx="probably a USG one, i.e. you use setpgrp()."
9035                                 val="$undef"
9036                                 ;;
9037                         esac
9038                 fi
9039                 echo "Assuming your setpgrp is $xxx" >&4
9040         fi
9041         ;;
9042 *) val="$undef";;
9043 esac
9044 set d_bsdsetpgrp
9045 eval $setvar
9046 $rm -f try try.*
9047 : see if bzero exists
9048 set bzero d_bzero
9049 eval $inlibc
9050
9051 : see if signal is declared as pointer to function returning int or void
9052 echo " "
9053 xxx=`./findhdr signal.h`
9054 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9055 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9056         echo "You have int (*signal())() instead of void." >&4
9057         val="$undef"
9058 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9059         echo "You have void (*signal())()." >&4
9060         val="$define"
9061 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9062         echo "You have int (*signal())() instead of void." >&4
9063         val="$undef"
9064 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9065         echo "You have void (*signal())()." >&4
9066         val="$define"
9067 else
9068         case "$d_voidsig" in
9069         '')
9070         echo "I can't determine whether signal handler returns void or int..." >&4
9071                 dflt=void
9072                 rp="What type does your signal handler return?"
9073                 . ./myread
9074                 case "$ans" in
9075                 v*) val="$define";;
9076                 *) val="$undef";;
9077                 esac;;
9078         "$define")
9079                 echo "As you already told me, signal handler returns void." >&4
9080                 val="$define"
9081                 ;;
9082         *)      echo "As you already told me, signal handler returns int." >&4
9083                 val="$undef"
9084                 ;;
9085         esac
9086 fi
9087 set d_voidsig
9088 eval $setvar
9089 case "$d_voidsig" in
9090 "$define") signal_t="void";;
9091 *) signal_t="int";;
9092 esac
9093 $rm -f $$.tmp
9094
9095 : check for ability to cast large floats to 32-bit ints.
9096 echo " "
9097 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9098 if $test "$intsize" -ge 4; then
9099         xxx=int
9100 else
9101         xxx=long
9102 fi
9103 $cat >try.c <<EOCP
9104 #include <stdio.h>
9105 #include <sys/types.h>
9106 #include <signal.h>
9107 $signal_t blech(s) int s; { exit(3); }
9108 int main()
9109 {
9110         $xxx i32;
9111         double f, g;
9112         int result = 0;
9113         char str[16];
9114         signal(SIGFPE, blech);
9115
9116         /* Don't let compiler optimize the test away.  Store the number 
9117            in a writable string for gcc to pass to sscanf under HP/UX.
9118         */
9119         sprintf(str, "2147483647");
9120         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9121         g = 10 * f;
9122         i32  = ($xxx) g;
9123
9124         /* x86 processors will probably give 0x8000 0000, which is a
9125        sign change.  We don't want that.  We want to mimic SPARC
9126            behavior here, which is to preserve the sign and give
9127            back 0x7fff ffff.
9128         */
9129         if (i32 != ($xxx) f)
9130                 result |= 1;
9131         exit(result);
9132 }
9133 EOCP
9134 set try
9135 if eval $compile_ok; then
9136         $run ./try
9137         yyy=$?
9138 else
9139         echo "(I can't seem to compile the test program--assuming it can't)"
9140         yyy=1
9141 fi
9142 case "$yyy" in
9143 0)      val="$define"
9144         echo "Yup, it can."
9145         ;;
9146 *)      val="$undef"
9147         echo "Nope, it can't."
9148         ;;
9149 esac
9150 set d_casti32
9151 eval $setvar
9152 $rm -f try try.*
9153
9154 : check for ability to cast negative floats to unsigned
9155 echo " "
9156 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9157 $cat >try.c <<EOCP
9158 #include <stdio.h>
9159 #include <sys/types.h>
9160 #include <signal.h>
9161 $signal_t blech(s) int s; { exit(7); }
9162 $signal_t blech_in_list(s) int s; { exit(4); }
9163 unsigned long dummy_long(p) unsigned long p; { return p; }
9164 unsigned int dummy_int(p) unsigned int p; { return p; }
9165 unsigned short dummy_short(p) unsigned short p; { return p; }
9166 int main()
9167 {
9168         double f;
9169         unsigned long along;
9170         unsigned int aint;
9171         unsigned short ashort;
9172         int result = 0;
9173         char str[16];
9174         
9175         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9176            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9177            optimized the whole file away
9178         */
9179         /* Store the number in a writable string for gcc to pass to 
9180            sscanf under HP/UX.
9181         */
9182         sprintf(str, "-123");
9183         sscanf(str, "%lf", &f);  /* f = -123.; */
9184
9185         signal(SIGFPE, blech);
9186         along = (unsigned long)f;
9187         aint = (unsigned int)f;
9188         ashort = (unsigned short)f;
9189         if (along != (unsigned long)-123)
9190                 result |= 1;
9191         if (aint != (unsigned int)-123)
9192                 result |= 1;
9193         if (ashort != (unsigned short)-123)
9194                 result |= 1;
9195         sprintf(str, "1073741824.");
9196         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9197         f = f + f;
9198         along = 0;
9199         along = (unsigned long)f;
9200         if (along != 0x80000000)
9201                 result |= 2;
9202         f -= 1.;
9203         along = 0;
9204         along = (unsigned long)f;
9205         if (along != 0x7fffffff)
9206                 result |= 1;
9207         f += 2.;
9208         along = 0;
9209         along = (unsigned long)f;
9210         if (along != 0x80000001)
9211                 result |= 2;
9212         if (result)
9213                 exit(result);
9214         signal(SIGFPE, blech_in_list);
9215         sprintf(str, "123.");
9216         sscanf(str, "%lf", &f);  /* f = 123.; */
9217         along = dummy_long((unsigned long)f);
9218         aint = dummy_int((unsigned int)f);
9219         ashort = dummy_short((unsigned short)f);
9220         if (along != (unsigned long)123)
9221                 result |= 4;
9222         if (aint != (unsigned int)123)
9223                 result |= 4;
9224         if (ashort != (unsigned short)123)
9225                 result |= 4;
9226         exit(result);
9227
9228 }
9229 EOCP
9230 set try
9231 if eval $compile_ok; then
9232         $run ./try
9233         castflags=$?
9234 else
9235         echo "(I can't seem to compile the test program--assuming it can't)"
9236         castflags=7
9237 fi
9238 case "$castflags" in
9239 0)      val="$define"
9240         echo "Yup, it can."
9241         ;;
9242 *)      val="$undef"
9243         echo "Nope, it can't."
9244         ;;
9245 esac
9246 set d_castneg
9247 eval $setvar
9248 $rm -f try.*
9249
9250 : see if vprintf exists
9251 echo " "
9252 if set vprintf val -f d_vprintf; eval $csym; $val; then
9253         echo 'vprintf() found.' >&4
9254         val="$define"
9255         $cat >try.c <<'EOF'
9256 #include <varargs.h>
9257
9258 int main() { xxx("foo"); }
9259
9260 xxx(va_alist)
9261 va_dcl
9262 {
9263         va_list args;
9264         char buf[10];
9265
9266         va_start(args);
9267         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9268 }
9269 EOF
9270         set try
9271         if eval $compile && $run ./try; then
9272                 echo "Your vsprintf() returns (int)." >&4
9273                 val2="$undef"
9274         else
9275                 echo "Your vsprintf() returns (char*)." >&4
9276                 val2="$define"
9277         fi
9278 else
9279         echo 'vprintf() NOT found.' >&4
9280                 val="$undef"
9281                 val2="$undef"
9282 fi
9283 $rm -f try try.*
9284 set d_vprintf
9285 eval $setvar
9286 val=$val2
9287 set d_charvspr
9288 eval $setvar
9289
9290 : see if chown exists
9291 set chown d_chown
9292 eval $inlibc
9293
9294 : see if chroot exists
9295 set chroot d_chroot
9296 eval $inlibc
9297
9298 : see if chsize exists
9299 set chsize d_chsize
9300 eval $inlibc
9301
9302 : see if class exists
9303 set class d_class
9304 eval $inlibc
9305
9306 hasstruct='varname=$1; struct=$2; shift; shift;
9307 while $test $# -ge 2; do
9308         case "$1" in
9309         $define) echo "#include <$2>";;
9310         esac ;
9311     shift 2;
9312 done > try.c;
9313 echo "int main () { struct $struct foo; }" >> try.c;
9314 set try;
9315 if eval $compile; then
9316         val="$define";
9317 else
9318         val="$undef";
9319 fi;
9320 set $varname;
9321 eval $setvar;
9322 $rm -f try.c try.o'
9323
9324 : see if sys/types.h has to be included
9325 set sys/types.h i_systypes
9326 eval $inhdr
9327
9328 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9329 while $test $# -ge 2; do
9330         case "$1" in
9331         $define) echo "#include <$2>";;
9332         esac ;
9333     shift 2;
9334 done > try.c;
9335 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9336 set try;
9337 if eval $compile; then
9338         val="$define";
9339 else
9340         val="$undef";
9341 fi;
9342 set $varname;
9343 eval $setvar;
9344 $rm -f try.c try.o'
9345
9346 socketlib=''
9347 sockethdr=''
9348 : see whether socket exists
9349 echo " "
9350 $echo $n "Hmm... $c" >&4
9351 if set socket val -f d_socket; eval $csym; $val; then
9352         echo "Looks like you have Berkeley networking support." >&4
9353         d_socket="$define"
9354         if set setsockopt val -f; eval $csym; $val; then
9355                 d_oldsock="$undef"
9356         else
9357                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9358                 d_oldsock="$define"
9359         fi
9360 else
9361         if $contains socklib libc.list >/dev/null 2>&1; then
9362                 echo "Looks like you have Berkeley networking support." >&4
9363                 d_socket="$define"
9364                 : we will have to assume that it supports the 4.2 BSD interface
9365                 d_oldsock="$undef"
9366         else
9367                 echo "You don't have Berkeley networking in libc$_a..." >&4
9368                 if test "X$d_socket" = "X$define"; then
9369                    echo "...but you seem to believe that you have sockets." >&4
9370                 else
9371                         for net in net socket
9372                         do
9373                                 if test -f /usr/lib/lib$net$_a; then
9374                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9375                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9376                                         if $contains socket libc.list >/dev/null 2>&1; then
9377                                                 d_socket="$define"
9378                                                 socketlib="-l$net"
9379                                                 case "$net" in
9380                                                 net)
9381                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9382                                                         sockethdr="-I/usr/netinclude"
9383                                                         ;;
9384                                                 esac
9385                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9386                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9387                                                         d_oldsock="$undef"
9388                                                 else
9389                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9390                                                         d_oldsock="$define"
9391                                                 fi
9392                                                 break
9393                                         fi
9394                                 fi
9395                         done
9396                         if test "X$d_socket" != "X$define"; then
9397                            echo "or anywhere else I see." >&4
9398                            d_socket="$undef"
9399                            d_oldsock="$undef"
9400                         fi
9401                 fi
9402         fi
9403 fi
9404
9405 : see if socketpair exists
9406 set socketpair d_sockpair
9407 eval $inlibc
9408
9409
9410 echo " "
9411 echo "Checking the availability of certain socket constants..." >&4
9412 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9413         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9414         $cat >try.c <<EOF
9415 #include <sys/types.h>
9416 #include <sys/socket.h>
9417 int main() {
9418     int i = $ENUM;
9419 }
9420 EOF
9421         val="$undef"
9422         set try; if eval $compile; then
9423                 val="$define"
9424         fi
9425         set d_${enum}; eval $setvar
9426         $rm -f try.c try
9427 done
9428
9429 : see if this is a sys/uio.h system
9430 set sys/uio.h i_sysuio
9431 eval $inhdr
9432
9433
9434 echo " "
9435 echo "Checking to see if your system supports struct cmsghdr..." >&4
9436 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9437 eval $hasstruct
9438 case "$d_cmsghdr_s" in
9439 "$define")      echo "Yes, it does."   ;;
9440 *)              echo "No, it doesn't." ;;
9441 esac
9442
9443
9444 : check for const keyword
9445 echo " "
9446 echo 'Checking to see if your C compiler knows about "const"...' >&4
9447 $cat >const.c <<'EOCP'
9448 typedef struct spug { int drokk; } spug;
9449 int main()
9450 {
9451         const char *foo;
9452         const spug y;
9453 }
9454 EOCP
9455 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9456         val="$define"
9457         echo "Yup, it does."
9458 else
9459         val="$undef"
9460         echo "Nope, it doesn't."
9461 fi
9462 set d_const
9463 eval $setvar
9464
9465 : see if crypt exists
9466 echo " "
9467 set crypt d_crypt
9468 eval $inlibc
9469 case "$d_crypt" in
9470 $define) cryptlib='' ;;
9471 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9472                 echo 'crypt() found.' >&4
9473                 val="$define"
9474                 cryptlib=''
9475         else
9476                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9477                 if $test -z "$cryptlib"; then
9478                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9479                 else
9480                         cryptlib=-lcrypt
9481                 fi
9482                 if $test -z "$cryptlib"; then
9483                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9484                 else
9485                         cryptlib=-lcrypt
9486                 fi
9487                 if $test -z "$cryptlib"; then
9488                         cryptlib=`./loc libcrypt$_a "" $libpth`
9489                 else
9490                         cryptlib=-lcrypt
9491                 fi
9492                 if $test -z "$cryptlib"; then
9493                         echo 'crypt() NOT found.' >&4
9494                         val="$undef"
9495                 else
9496                         val="$define"
9497                 fi
9498         fi
9499         set d_crypt
9500         eval $setvar
9501         ;;
9502 esac
9503
9504 : get csh whereabouts
9505 case "$csh" in
9506 'csh') val="$undef" ;;
9507 *) val="$define" ;;
9508 esac
9509 set d_csh
9510 eval $setvar
9511 : Respect a hint or command line value for full_csh.
9512 case "$full_csh" in
9513 '') full_csh=$csh ;;
9514 esac
9515
9516 : see if cuserid exists
9517 set cuserid d_cuserid
9518 eval $inlibc
9519
9520 : see if this is a limits.h system
9521 set limits.h i_limits
9522 eval $inhdr
9523
9524 : see if this is a float.h system
9525 set float.h i_float
9526 eval $inhdr
9527
9528 : See if number of significant digits in a double precision number is known
9529 echo " "
9530 $cat >dbl_dig.c <<EOM
9531 #$i_limits I_LIMITS
9532 #$i_float I_FLOAT
9533 #ifdef I_LIMITS
9534 #include <limits.h>
9535 #endif
9536 #ifdef I_FLOAT
9537 #include <float.h>
9538 #endif
9539 #ifdef DBL_DIG
9540 printf("Contains DBL_DIG");
9541 #endif
9542 EOM
9543 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9544 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9545         echo "DBL_DIG found." >&4
9546         val="$define"
9547 else
9548         echo "DBL_DIG NOT found." >&4
9549         val="$undef"
9550 fi
9551 $rm -f dbl_dig.?
9552 set d_dbl_dig
9553 eval $setvar
9554
9555 hasproto='varname=$1; func=$2; shift; shift;
9556 while $test $# -ge 2; do
9557         case "$1" in
9558         $define) echo "#include <$2>";;
9559         esac ;
9560     shift 2;
9561 done > try.c;
9562 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9563 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9564         echo "$func() prototype found.";
9565         val="$define";
9566 else
9567         echo "$func() prototype NOT found.";
9568         val="$undef";
9569 fi;
9570 set $varname;
9571 eval $setvar;
9572 $rm -f try.c tryout.c'
9573
9574 : see if dbm.h is available
9575 : see if dbmclose exists
9576 set dbmclose d_dbmclose
9577 eval $inlibc
9578
9579 case "$d_dbmclose" in
9580 $define)
9581         set dbm.h i_dbm
9582         eval $inhdr
9583         case "$i_dbm" in
9584         $define)
9585                 val="$undef"
9586                 set i_rpcsvcdbm
9587                 eval $setvar
9588                 ;;
9589         *)      set rpcsvc/dbm.h i_rpcsvcdbm
9590                 eval $inhdr
9591                 ;;
9592         esac
9593         ;;
9594 *)      echo "We won't be including <dbm.h>"
9595         val="$undef"
9596         set i_dbm
9597         eval $setvar
9598         val="$undef"
9599         set i_rpcsvcdbm
9600         eval $setvar
9601         ;;
9602 esac
9603
9604 : see if prototype for dbminit is available
9605 echo " "
9606 set d_dbminitproto dbminit $i_dbm dbm.h
9607 eval $hasproto
9608
9609 : see if difftime exists
9610 set difftime d_difftime
9611 eval $inlibc
9612
9613 : see if this is a dirent system
9614 echo " "
9615 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9616         val="$define"
9617         echo "<dirent.h> found." >&4
9618 else
9619         val="$undef"
9620         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9621                 echo "<sys/dir.h> found." >&4
9622                 echo " "
9623         else
9624                 xinc=`./findhdr sys/ndir.h`
9625         fi
9626         echo "<dirent.h> NOT found." >&4
9627 fi
9628 set i_dirent
9629 eval $setvar
9630
9631 : Look for type of directory structure.
9632 echo " "
9633 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9634
9635 case "$direntrytype" in
9636 ''|' ')
9637         case "$i_dirent" in
9638         $define) guess1='struct dirent' ;;
9639         *) guess1='struct direct'  ;;
9640         esac
9641         ;;
9642 *)      guess1="$direntrytype"
9643         ;;
9644 esac
9645
9646 case "$guess1" in
9647 'struct dirent') guess2='struct direct' ;;
9648 *) guess2='struct dirent' ;;
9649 esac
9650                 
9651 if $contains "$guess1" try.c >/dev/null 2>&1; then
9652         direntrytype="$guess1"
9653         echo "Your directory entries are $direntrytype." >&4
9654 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9655         direntrytype="$guess2"
9656         echo "Your directory entries seem to be $direntrytype." >&4
9657 else
9658         echo "I don't recognize your system's directory entries." >&4
9659         rp="What type is used for directory entries on this system?"
9660         dflt="$guess1"
9661         . ./myread
9662         direntrytype="$ans"
9663 fi
9664 $rm -f try.c
9665
9666
9667 : see if the directory entry stores field length
9668 echo " "
9669 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9670 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9671         echo "Good, your directory entry keeps length information in d_namlen." >&4
9672         val="$define"
9673 else
9674         echo "Your directory entry does not know about the d_namlen field." >&4
9675         val="$undef"
9676 fi
9677 set d_dirnamlen
9678 eval $setvar
9679 $rm -f try.c
9680
9681 : see if this is an sysdir system
9682 set sys/dir.h i_sysdir
9683 eval $inhdr
9684
9685 : see if this is an sysndir system
9686 set sys/ndir.h i_sysndir
9687 eval $inhdr
9688
9689 : Look for dirfd
9690 echo " "
9691 $cat >dirfd.c <<EOM
9692 #include <stdio.h>
9693 #$i_dirent I_DIRENT             /**/
9694 #$i_sysdir I_SYS_DIR            /**/
9695 #$i_sysndir I_SYS_NDIR          /**/
9696 #$i_systypes I_SYS_TYPES        /**/
9697 #if defined(I_SYS_TYPES)
9698 #include <sys/types.h>
9699 #endif
9700 #if defined(I_DIRENT)
9701 #include <dirent.h>
9702 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
9703 #include <sys/dir.h>
9704 #endif
9705 #else
9706 #ifdef I_SYS_NDIR
9707 #include <sys/ndir.h>
9708 #else
9709 #ifdef I_SYS_DIR
9710 #ifdef hp9000s500
9711 #include <ndir.h>       /* may be wrong in the future */
9712 #else
9713 #include <sys/dir.h>
9714 #endif
9715 #endif
9716 #endif
9717 #endif 
9718 int main() {
9719         DIR *dirp = opendir(".");
9720         if (dirfd(dirp) >= 0)
9721                 exit(0);
9722         else
9723                 exit(1);
9724 }
9725 EOM
9726 set dirfd
9727 if eval $compile; then
9728         val="$define"
9729 fi
9730 case "$val" in
9731 $define)        echo "dirfd() found." >&4       ;;
9732 *)              echo "dirfd() NOT found." >&4   ;;
9733 esac
9734 set d_dirfd
9735 eval $setvar
9736 $rm -f dirfd*
9737
9738 : see if dlerror exists
9739 xxx_runnm="$runnm"
9740 runnm=false
9741 set dlerror d_dlerror
9742 eval $inlibc
9743 runnm="$xxx_runnm"
9744
9745 : see if dlfcn is available
9746 set dlfcn.h i_dlfcn
9747 eval $inhdr
9748
9749 case "$usedl" in
9750 $define|y|true)
9751         $cat << EOM
9752
9753 On a few systems, the dynamically loaded modules that perl generates and uses
9754 will need a different extension than shared libs. The default will probably
9755 be appropriate.
9756
9757 EOM
9758         case "$dlext" in
9759         '')     dflt="$so" ;;
9760         *)      dflt="$dlext" ;;
9761         esac
9762         rp='What is the extension of dynamically loaded modules'
9763         . ./myread
9764         dlext="$ans"
9765         ;;
9766 *)
9767         dlext="none"
9768         ;;
9769 esac
9770
9771 : Check if dlsym need a leading underscore
9772 echo " "
9773 val="$undef"
9774
9775 case "$dlsrc" in
9776 dl_dlopen.xs)
9777         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9778         $cat >dyna.c <<'EOM'
9779 fred () { }
9780 EOM
9781
9782 $cat >fred.c<<EOM
9783
9784 #include <stdio.h>
9785 #$i_dlfcn I_DLFCN
9786 #ifdef I_DLFCN
9787 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
9788 #else
9789 #include <sys/types.h>
9790 #include <nlist.h>
9791 #include <link.h>
9792 #endif
9793
9794 extern int fred() ;
9795
9796 int main()
9797 {
9798     void * handle ;
9799     void * symbol ;
9800 #ifndef RTLD_LAZY
9801     int mode = 1 ;
9802 #else
9803     int mode = RTLD_LAZY ;
9804 #endif
9805     handle = dlopen("./dyna.$dlext", mode) ;
9806     if (handle == NULL) {
9807         printf ("1\n") ;
9808         fflush (stdout) ;
9809         exit(0);
9810     }
9811     symbol = dlsym(handle, "fred") ;
9812     if (symbol == NULL) {
9813         /* try putting a leading underscore */
9814         symbol = dlsym(handle, "_fred") ;
9815         if (symbol == NULL) {
9816             printf ("2\n") ;
9817             fflush (stdout) ;
9818             exit(0);
9819         }
9820         printf ("3\n") ;
9821     }
9822     else
9823         printf ("4\n") ;
9824     fflush (stdout) ;
9825     exit(0);
9826 }
9827 EOM
9828         : Call the object file tmp-dyna.o in case dlext=o.
9829         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9830                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9831                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9832                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
9833                 xxx=`$run ./fred`
9834                 case $xxx in
9835                 1)      echo "Test program failed using dlopen." >&4
9836                         echo "Perhaps you should not use dynamic loading." >&4;;
9837                 2)      echo "Test program failed using dlsym." >&4
9838                         echo "Perhaps you should not use dynamic loading." >&4;;
9839                 3)      echo "dlsym needs a leading underscore" >&4
9840                         val="$define" ;;
9841                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9842                 esac
9843         else
9844                 echo "I can't compile and run the test program." >&4
9845                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9846         fi
9847         ;;
9848 esac
9849                 
9850 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
9851
9852 set d_dlsymun
9853 eval $setvar
9854
9855 : see if prototype for drand48 is available
9856 echo " "
9857 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9858 eval $hasproto
9859
9860 : see if dup2 exists
9861 set dup2 d_dup2
9862 eval $inlibc
9863
9864 : see if eaccess exists
9865 set eaccess d_eaccess
9866 eval $inlibc
9867
9868 : see if endgrent exists
9869 set endgrent d_endgrent
9870 eval $inlibc
9871
9872 : see if endhostent exists
9873 set endhostent d_endhent
9874 eval $inlibc
9875
9876 : see if endnetent exists
9877 set endnetent d_endnent
9878 eval $inlibc
9879
9880 : see if endprotoent exists
9881 set endprotoent d_endpent
9882 eval $inlibc
9883
9884 : see if endpwent exists
9885 set endpwent d_endpwent
9886 eval $inlibc
9887
9888 : see if endservent exists
9889 set endservent d_endsent
9890 eval $inlibc
9891
9892 : Locate the flags for 'open()'
9893 echo " "
9894 $cat >try.c <<'EOCP'
9895 #include <sys/types.h>
9896 #ifdef I_FCNTL
9897 #include <fcntl.h>
9898 #endif
9899 #ifdef I_SYS_FILE
9900 #include <sys/file.h>
9901 #endif
9902 int main() {
9903         if(O_RDONLY);
9904 #ifdef O_TRUNC
9905         exit(0);
9906 #else
9907         exit(1);
9908 #endif
9909 }
9910 EOCP
9911 : check sys/file.h first to get FREAD on Sun
9912 if $test `./findhdr sys/file.h` && \
9913                 set try -DI_SYS_FILE && eval $compile; then
9914         h_sysfile=true;
9915         echo "<sys/file.h> defines the O_* constants..." >&4
9916         if $run ./try; then
9917                 echo "and you have the 3 argument form of open()." >&4
9918                 val="$define"
9919         else
9920                 echo "but not the 3 argument form of open().  Oh, well." >&4
9921                 val="$undef"
9922         fi
9923 elif $test `./findhdr fcntl.h` && \
9924                 set try -DI_FCNTL && eval $compile; then
9925         h_fcntl=true;
9926         echo "<fcntl.h> defines the O_* constants..." >&4
9927         if $run ./try; then
9928                 echo "and you have the 3 argument form of open()." >&4
9929                 val="$define"
9930         else
9931                 echo "but not the 3 argument form of open().  Oh, well." >&4
9932                 val="$undef"
9933         fi
9934 else
9935         val="$undef"
9936         echo "I can't find the O_* constant definitions!  You got problems." >&4
9937 fi
9938 set d_open3
9939 eval $setvar
9940 $rm -f try try.*
9941
9942 : see which of string.h or strings.h is needed
9943 echo " "
9944 strings=`./findhdr string.h`
9945 if $test "$strings" && $test -r "$strings"; then
9946         echo "Using <string.h> instead of <strings.h>." >&4
9947         val="$define"
9948 else
9949         val="$undef"
9950         strings=`./findhdr strings.h`
9951         if $test "$strings" && $test -r "$strings"; then
9952                 echo "Using <strings.h> instead of <string.h>." >&4
9953         else
9954                 echo "No string header found -- You'll surely have problems." >&4
9955         fi
9956 fi
9957 set i_string
9958 eval $setvar
9959 case "$i_string" in
9960 "$undef") strings=`./findhdr strings.h`;;
9961 *)        strings=`./findhdr string.h`;;
9962 esac
9963
9964 : see if this is a sys/file.h system
9965 val=''
9966 set sys/file.h val
9967 eval $inhdr
9968
9969 : do we need to include sys/file.h ?
9970 case "$val" in
9971 "$define")
9972         echo " "
9973         if $h_sysfile; then
9974                 val="$define"
9975                 echo "We'll be including <sys/file.h>." >&4
9976         else
9977                 val="$undef"
9978                 echo "We won't be including <sys/file.h>." >&4
9979         fi
9980         ;;
9981 *)
9982         h_sysfile=false
9983         ;;
9984 esac
9985 set i_sysfile
9986 eval $setvar
9987
9988 : see if fcntl.h is there
9989 val=''
9990 set fcntl.h val
9991 eval $inhdr
9992
9993 : see if we can include fcntl.h
9994 case "$val" in
9995 "$define")
9996         echo " "
9997         if $h_fcntl; then
9998                 val="$define"
9999                 echo "We'll be including <fcntl.h>." >&4
10000         else
10001                 val="$undef"
10002                 if $h_sysfile; then
10003         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
10004                 else
10005                         echo "We won't be including <fcntl.h>." >&4
10006                 fi
10007         fi
10008         ;;
10009 *)
10010         h_fcntl=false
10011         val="$undef"
10012         ;;
10013 esac
10014 set i_fcntl
10015 eval $setvar
10016
10017 : check for non-blocking I/O stuff
10018 case "$h_sysfile" in
10019 true) echo "#include <sys/file.h>" > head.c;;
10020 *)
10021        case "$h_fcntl" in
10022        true) echo "#include <fcntl.h>" > head.c;;
10023        *) echo "#include <sys/fcntl.h>" > head.c;;
10024        esac
10025        ;;
10026 esac
10027 echo " "
10028 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
10029 case "$o_nonblock" in
10030 '')
10031         $cat head.c > try.c
10032         $cat >>try.c <<EOCP
10033 #include <stdio.h>
10034 #include <stdlib.h>
10035 #$i_fcntl I_FCNTL
10036 #ifdef I_FCNTL
10037 #include <fcntl.h>
10038 #endif
10039 int main() {
10040 #ifdef O_NONBLOCK
10041         printf("O_NONBLOCK\n");
10042         exit(0);
10043 #endif
10044 #ifdef O_NDELAY
10045         printf("O_NDELAY\n");
10046         exit(0);
10047 #endif
10048 #ifdef FNDELAY
10049         printf("FNDELAY\n");
10050         exit(0);
10051 #endif
10052         exit(0);
10053 }
10054 EOCP
10055         set try
10056         if eval $compile_ok; then
10057                 o_nonblock=`$run ./try`
10058                 case "$o_nonblock" in
10059                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
10060                 *) echo "Seems like we can use $o_nonblock.";;
10061                 esac
10062         else
10063                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
10064         fi
10065         ;;
10066 *) echo "Using $hint value $o_nonblock.";;
10067 esac
10068 $rm -f try try.* .out core
10069
10070 echo " "
10071 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
10072 case "$eagain" in
10073 '')
10074         $cat head.c > try.c
10075         $cat >>try.c <<EOCP
10076 #include <errno.h>
10077 #include <sys/types.h>
10078 #include <signal.h>
10079 #include <stdio.h> 
10080 #include <stdlib.h> 
10081 #$i_fcntl I_FCNTL
10082 #ifdef I_FCNTL
10083 #include <fcntl.h>
10084 #endif
10085 #define MY_O_NONBLOCK $o_nonblock
10086 #ifndef errno  /* XXX need better Configure test */
10087 extern int errno;
10088 #endif
10089 #$i_unistd I_UNISTD
10090 #ifdef I_UNISTD
10091 #include <unistd.h>
10092 #endif
10093 #$i_string I_STRING
10094 #ifdef I_STRING
10095 #include <string.h>
10096 #else
10097 #include <strings.h>
10098 #endif
10099 $signal_t blech(x) int x; { exit(3); }
10100 EOCP
10101         $cat >> try.c <<'EOCP'
10102 int main()
10103 {
10104         int pd[2];
10105         int pu[2];
10106         char buf[1];
10107         char string[100];
10108
10109         pipe(pd);       /* Down: child -> parent */
10110         pipe(pu);       /* Up: parent -> child */
10111         if (0 != fork()) {
10112                 int ret;
10113                 close(pd[1]);   /* Parent reads from pd[0] */
10114                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
10115 #ifdef F_SETFL
10116                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
10117                         exit(1);
10118 #else
10119                 exit(4);
10120 #endif
10121                 signal(SIGALRM, blech);
10122                 alarm(5);
10123                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
10124                         exit(2);
10125                 sprintf(string, "%d\n", ret);
10126                 write(2, string, strlen(string));
10127                 alarm(0);
10128 #ifdef EAGAIN
10129                 if (errno == EAGAIN) {
10130                         printf("EAGAIN\n");
10131                         goto ok;
10132                 }
10133 #endif
10134 #ifdef EWOULDBLOCK
10135                 if (errno == EWOULDBLOCK)
10136                         printf("EWOULDBLOCK\n");
10137 #endif
10138         ok:
10139                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
10140                 sleep(2);                               /* Give it time to close our pipe */
10141                 alarm(5);
10142                 ret = read(pd[0], buf, 1);      /* Should read EOF */
10143                 alarm(0);
10144                 sprintf(string, "%d\n", ret);
10145                 write(4, string, strlen(string));
10146                 exit(0);
10147         }
10148
10149         close(pd[0]);                   /* We write to pd[1] */
10150         close(pu[1]);                   /* We read from pu[0] */
10151         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
10152         close(pd[1]);                   /* Pipe pd is now fully closed! */
10153         exit(0);                                /* Bye bye, thank you for playing! */
10154 }
10155 EOCP
10156         set try
10157         if eval $compile_ok; then
10158                 echo "$startsh" >mtry
10159                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
10160                 chmod +x mtry
10161                 ./mtry >/dev/null 2>&1
10162                 case $? in
10163                 0) eagain=`$cat try.out`;;
10164                 1) echo "Could not perform non-blocking setting!";;
10165                 2) echo "I did a successful read() for something that was not there!";;
10166                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
10167                 4) echo "Could not find F_SETFL!";;
10168                 *) echo "Something terribly wrong happened during testing.";;
10169                 esac
10170                 rd_nodata=`$cat try.ret`
10171                 echo "A read() system call with no data present returns $rd_nodata."
10172                 case "$rd_nodata" in
10173                 0|-1) ;;
10174                 *)
10175                         echo "(That's peculiar, fixing that to be -1.)"
10176                         rd_nodata=-1
10177                         ;;
10178                 esac
10179                 case "$eagain" in
10180                 '')
10181                         echo "Forcing errno EAGAIN on read() with no data available."
10182                         eagain=EAGAIN
10183                         ;;
10184                 *)
10185                         echo "Your read() sets errno to $eagain when no data is available."
10186                         ;;
10187                 esac
10188                 status=`$cat try.err`
10189                 case "$status" in
10190                 0) echo "And it correctly returns 0 to signal EOF.";;
10191                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
10192                 *) echo "However, your read() returns '$status' on EOF??";;
10193                 esac
10194                 val="$define"
10195                 if test "$status" = "$rd_nodata"; then
10196                         echo "WARNING: you can't distinguish between EOF and no data!"
10197                         val="$undef"
10198                 fi
10199         else
10200                 echo "I can't compile the test program--assuming errno EAGAIN will do."
10201                 eagain=EAGAIN
10202         fi
10203         set d_eofnblk
10204         eval $setvar
10205         ;;
10206 *)
10207         echo "Using $hint value $eagain."
10208         echo "Your read() returns $rd_nodata when no data is present."
10209         case "$d_eofnblk" in
10210         "$define") echo "And you can see EOF because read() returns 0.";;
10211         "$undef") echo "But you can't see EOF status from read() returned value.";;
10212         *)
10213                 echo "(Assuming you can't see EOF status from read anyway.)"
10214                 d_eofnblk=$undef
10215                 ;;
10216         esac
10217         ;;
10218 esac
10219 $rm -f try try.* .out core head.c mtry
10220
10221 : see if fchdir exists
10222 set fchdir d_fchdir
10223 eval $inlibc
10224
10225 : see if fchmod exists
10226 set fchmod d_fchmod
10227 eval $inlibc
10228
10229 : see if fchown exists
10230 set fchown d_fchown
10231 eval $inlibc
10232
10233 : see if this is an fcntl system
10234 set fcntl d_fcntl
10235 eval $inlibc
10236
10237 echo " "
10238 : See if fcntl-based locking works.
10239 $cat >try.c <<EOCP
10240 #include <stdlib.h>
10241 #include <unistd.h>
10242 #include <fcntl.h>
10243 #include <signal.h>
10244 $signal_t blech(x) int x; { exit(3); }
10245 int main() {
10246 #if defined(F_SETLK) && defined(F_SETLKW)
10247      struct flock flock;
10248      int retval, fd;
10249      fd = open("try.c", O_RDONLY);
10250      flock.l_type = F_RDLCK;
10251      flock.l_whence = SEEK_SET;
10252      flock.l_start = flock.l_len = 0;
10253      signal(SIGALRM, blech);
10254      alarm(10);
10255      retval = fcntl(fd, F_SETLK, &flock);
10256      close(fd);
10257      (retval < 0 ? exit(2) : exit(0));
10258 #else
10259      exit(2);
10260 #endif
10261 }
10262 EOCP
10263 echo "Checking if fcntl-based file locking works... "
10264 case "$d_fcntl" in
10265 "$define")
10266         set try
10267         if eval $compile_ok; then
10268                 if $run ./try; then
10269                         echo "Yes, it seems to work."
10270                         val="$define"
10271                 else
10272                         echo "Nope, it didn't work."
10273                         val="$undef"
10274                         case "$?" in
10275                         3) $cat >&4 <<EOM
10276 ***
10277 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
10278 *** This is (almost) impossible.
10279 *** If your NFS lock daemons are not feeling well, something like
10280 *** this may happen, please investigate.  Cannot continue, aborting.
10281 ***
10282 EOM
10283                                 exit 1
10284                                 ;;
10285                         esac
10286                 fi
10287         else
10288                 echo "I'm unable to compile the test program, so I'll assume not."
10289                 val="$undef"
10290         fi
10291         ;;
10292 *) val="$undef";
10293         echo "Nope, since you don't even have fcntl()."
10294         ;;
10295 esac
10296 set d_fcntl_can_lock
10297 eval $setvar
10298 $rm -f try*
10299
10300
10301 : see if sys/select.h has to be included
10302 set sys/select.h i_sysselct
10303 eval $inhdr
10304
10305 : see if we should include time.h, sys/time.h, or both
10306 echo " "
10307 if test "X$timeincl" = X; then
10308         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10309         $echo $n "I'm now running the test program...$c"
10310         $cat >try.c <<'EOCP'
10311 #include <sys/types.h>
10312 #ifdef I_TIME
10313 #include <time.h>
10314 #endif
10315 #ifdef I_SYSTIME
10316 #ifdef SYSTIMEKERNEL
10317 #define KERNEL
10318 #endif
10319 #include <sys/time.h>
10320 #endif
10321 #ifdef I_SYSSELECT
10322 #include <sys/select.h>
10323 #endif
10324 int main()
10325 {
10326         struct tm foo;
10327 #ifdef S_TIMEVAL
10328         struct timeval bar;
10329 #endif
10330 #ifdef S_TIMEZONE
10331         struct timezone tzp;
10332 #endif
10333         if (foo.tm_sec == foo.tm_sec)
10334                 exit(0);
10335 #ifdef S_TIMEVAL
10336         if (bar.tv_sec == bar.tv_sec)
10337                 exit(0);
10338 #endif
10339         exit(1);
10340 }
10341 EOCP
10342         flags=''
10343         for s_timezone in '-DS_TIMEZONE' ''; do
10344         sysselect=''
10345         for s_timeval in '-DS_TIMEVAL' ''; do
10346         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10347         for i_time in '' '-DI_TIME'; do
10348         for i_systime in '-DI_SYSTIME' ''; do
10349                 case "$flags" in
10350                 '') $echo $n ".$c"
10351                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10352                         if eval $compile; then
10353                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10354                                 shift
10355                                 flags="$*"
10356                                 echo " "
10357                                 $echo $n "Succeeded with $flags$c"
10358                         fi
10359                         ;;
10360                 esac
10361         done
10362         done
10363         done
10364         done
10365         done
10366         timeincl=''
10367         echo " "
10368         case "$flags" in
10369         *SYSTIMEKERNEL*) i_systimek="$define"
10370                 timeincl=`./findhdr sys/time.h`
10371                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10372         *) i_systimek="$undef";;
10373         esac
10374         case "$flags" in
10375         *I_TIME*) i_time="$define"
10376                 timeincl=`./findhdr time.h`" $timeincl"
10377                 echo "We'll include <time.h>." >&4;;
10378         *) i_time="$undef";;
10379         esac
10380         case "$flags" in
10381         *I_SYSTIME*) i_systime="$define"
10382                 timeincl=`./findhdr sys/time.h`" $timeincl"
10383                 echo "We'll include <sys/time.h>." >&4;;
10384         *) i_systime="$undef";;
10385         esac
10386         $rm -f try.c try
10387 fi
10388
10389 : check for fd_set items
10390 $cat <<EOM
10391
10392 Checking to see how well your C compiler handles fd_set and friends ...
10393 EOM
10394 $cat >try.c <<EOCP
10395 #$i_systime I_SYS_TIME
10396 #$i_sysselct I_SYS_SELECT
10397 #$d_socket HAS_SOCKET
10398 #include <sys/types.h>
10399 #ifdef HAS_SOCKET
10400 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
10401 #endif
10402 #ifdef I_SYS_TIME
10403 #include <sys/time.h>
10404 #endif
10405 #ifdef I_SYS_SELECT
10406 #include <sys/select.h>
10407 #endif
10408 int main() {
10409         fd_set fds;
10410
10411 #ifdef TRYBITS
10412         if(fds.fds_bits);
10413 #endif
10414
10415 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
10416         exit(0);
10417 #else
10418         exit(1);
10419 #endif
10420 }
10421 EOCP
10422 set try -DTRYBITS
10423 if eval $compile; then
10424         d_fds_bits="$define"
10425         d_fd_set="$define"
10426         echo "Well, your system knows about the normal fd_set typedef..." >&4
10427         if $run ./try; then
10428                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
10429                 d_fd_macros="$define"
10430         else
10431                 $cat >&4 <<'EOM'
10432 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
10433 EOM
10434                 d_fd_macros="$undef"
10435         fi
10436 else
10437         $cat <<'EOM'
10438 Hmm, your compiler has some difficulty with fd_set.  Checking further...
10439 EOM
10440         set try
10441         if eval $compile; then
10442                 d_fds_bits="$undef"
10443                 d_fd_set="$define"
10444                 echo "Well, your system has some sort of fd_set available..." >&4
10445                 if $run ./try; then
10446                         echo "and you have the normal fd_set macros." >&4
10447                         d_fd_macros="$define"
10448                 else
10449                         $cat <<'EOM'
10450 but not the normal fd_set macros!  Gross!  More work for me...
10451 EOM
10452                         d_fd_macros="$undef"
10453                 fi
10454         else
10455         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
10456                 d_fd_set="$undef"
10457                 d_fds_bits="$undef"
10458                 d_fd_macros="$undef"
10459         fi
10460 fi
10461 $rm -f try try.*
10462
10463 : see if fgetpos exists
10464 set fgetpos d_fgetpos
10465 eval $inlibc
10466
10467 : see if finite exists
10468 set finite d_finite
10469 eval $inlibc
10470
10471 : see if finitel exists
10472 set finitel d_finitel
10473 eval $inlibc
10474
10475 : see if flock exists
10476 set flock d_flock
10477 eval $inlibc
10478
10479 : see if prototype for flock is available
10480 echo " "
10481 set d_flockproto flock $i_sysfile sys/file.h
10482 eval $hasproto
10483
10484 : see if fork exists
10485 set fork d_fork
10486 eval $inlibc
10487
10488 : see if fp_class exists
10489 set fp_class d_fp_class
10490 eval $inlibc
10491
10492 : see if pathconf exists
10493 set pathconf d_pathconf
10494 eval $inlibc
10495
10496 : see if fpathconf exists
10497 set fpathconf d_fpathconf
10498 eval $inlibc
10499
10500 : see if fpclass exists
10501 set fpclass d_fpclass
10502 eval $inlibc
10503
10504 : see if fpclassify exists
10505 set fpclassify d_fpclassify
10506 eval $inlibc
10507
10508 : see if fpclassl exists
10509 set fpclassl d_fpclassl
10510 eval $inlibc
10511
10512
10513 : check for fpos64_t
10514 echo " "
10515 echo "Checking to see if you have fpos64_t..." >&4
10516 $cat >try.c <<EOCP
10517 #include <stdio.h>
10518 int main() { fpos64_t x = 7; }
10519 EOCP
10520 set try
10521 if eval $compile; then
10522         val="$define"
10523         echo "You have fpos64_t."
10524 else
10525         val="$undef"
10526         echo "You do not have fpos64_t."
10527         case "$fpossize" in
10528         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
10529         esac
10530 fi
10531 $rm -f try.* try
10532 set d_fpos64_t
10533 eval $setvar
10534
10535 : see if frexpl exists
10536 set frexpl d_frexpl
10537 eval $inlibc
10538
10539 : see if this is a sys/param system
10540 set sys/param.h i_sysparam
10541 eval $inhdr
10542
10543 : see if this is a sys/mount.h system
10544 set sys/mount.h i_sysmount
10545 eval $inhdr
10546
10547
10548 echo " "
10549 echo "Checking to see if your system supports struct fs_data..." >&4
10550 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
10551 eval $hasstruct
10552 case "$d_fs_data_s" in
10553 "$define")      echo "Yes, it does."   ;;
10554 *)              echo "No, it doesn't." ;;
10555 esac
10556
10557 : see if fseeko exists
10558 set fseeko d_fseeko
10559 eval $inlibc
10560 case "$longsize" in
10561 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
10562 esac
10563
10564 : see if fsetpos exists
10565 set fsetpos d_fsetpos
10566 eval $inlibc
10567
10568
10569 : see if fstatfs exists
10570 set fstatfs d_fstatfs
10571 eval $inlibc
10572
10573
10574 : see if statvfs exists
10575 set statvfs d_statvfs
10576 eval $inlibc
10577
10578 : see if fstatvfs exists
10579 set fstatvfs d_fstatvfs
10580 eval $inlibc
10581
10582
10583 : see if fsync exists
10584 set fsync d_fsync
10585 eval $inlibc
10586
10587 : see if ftello exists
10588 set ftello d_ftello
10589 eval $inlibc
10590 case "$longsize" in
10591 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
10592 esac
10593
10594 : see if getcwd exists
10595 set getcwd d_getcwd
10596 eval $inlibc
10597
10598 : see if getespwnam exists
10599 set getespwnam d_getespwnam
10600 eval $inlibc
10601
10602
10603 : see if getfsstat exists
10604 set getfsstat d_getfsstat
10605 eval $inlibc
10606
10607 : see if getgrent exists
10608 set getgrent d_getgrent
10609 eval $inlibc
10610
10611 : see if gethostbyaddr exists
10612 set gethostbyaddr d_gethbyaddr
10613 eval $inlibc
10614
10615 : see if gethostbyname exists
10616 set gethostbyname d_gethbyname
10617 eval $inlibc
10618
10619 : see if gethostent exists
10620 set gethostent d_gethent
10621 eval $inlibc
10622
10623 : see how we will look up host name
10624 echo " "
10625 call=''
10626 if set gethostname val -f d_gethname; eval $csym; $val; then
10627         echo 'gethostname() found.' >&4
10628         d_gethname="$define"
10629         call=gethostname
10630 fi
10631 if set uname val -f d_uname; eval $csym; $val; then
10632         if ./xenix; then
10633                 $cat <<'EOM'
10634 uname() was found, but you're running xenix, and older versions of xenix
10635 have a broken uname(). If you don't really know whether your xenix is old
10636 enough to have a broken system call, use the default answer.
10637
10638 EOM
10639                 dflt=y
10640                 case "$d_uname" in
10641                 "$define") dflt=n;;
10642                 esac
10643                 rp='Is your uname() broken?'
10644                 . ./myread
10645                 case "$ans" in
10646                 n*) d_uname="$define"; call=uname;;
10647                 esac
10648         else
10649                 echo 'uname() found.' >&4
10650                 d_uname="$define"
10651                 case "$call" in
10652                 '') call=uname ;;
10653                 esac
10654         fi
10655 fi
10656 case "$d_gethname" in
10657 '') d_gethname="$undef";;
10658 esac
10659 case "$d_uname" in
10660 '') d_uname="$undef";;
10661 esac
10662 case "$d_uname$d_gethname" in
10663 *define*)
10664         dflt=n
10665         cat <<EOM
10666  
10667 Every now and then someone has a $call() that lies about the hostname
10668 but can't be fixed for political or economic reasons.  If you wish, I can
10669 pretend $call() isn't there and maybe compute hostname at run-time
10670 thanks to the '$phostname' command.
10671
10672 EOM
10673         rp="Shall I ignore $call() from now on?"
10674         . ./myread
10675         case "$ans" in
10676         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
10677         esac;;
10678 esac
10679 case "$phostname" in
10680 '') aphostname='';;
10681 *) case "$aphostname" in
10682         /*) ;;
10683         *) set X $phostname
10684                 shift
10685                 file=$1
10686                 shift
10687                 file=`./loc $file $file $pth`
10688                 aphostname=`echo $file $*`
10689                 ;;
10690         esac
10691         ;;
10692 esac
10693 case "$d_uname$d_gethname" in
10694 *define*) ;;
10695 *)
10696         case "$phostname" in
10697         '')
10698                 echo "There will be no way for $package to get your hostname." >&4;;
10699         *)
10700         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10701                 ;;
10702         esac;;
10703 esac
10704 case "$d_phostname" in
10705 '') d_phostname="$undef";;
10706 esac
10707
10708 : see if this is a netdb.h system
10709 set netdb.h i_netdb
10710 eval $inhdr
10711
10712 : see if prototypes for various gethostxxx netdb.h functions are available
10713 echo " "
10714 set d_gethostprotos gethostent $i_netdb netdb.h
10715 eval $hasproto
10716
10717 : see if getitimer exists
10718 set getitimer d_getitimer
10719 eval $inlibc
10720
10721 : see if getlogin exists
10722 set getlogin d_getlogin
10723 eval $inlibc
10724
10725 : see if getmnt exists
10726 set getmnt d_getmnt
10727 eval $inlibc
10728
10729 : see if getmntent exists
10730 set getmntent d_getmntent
10731 eval $inlibc
10732
10733 : see if getnetbyaddr exists
10734 set getnetbyaddr d_getnbyaddr
10735 eval $inlibc
10736
10737 : see if getnetbyname exists
10738 set getnetbyname d_getnbyname
10739 eval $inlibc
10740
10741 : see if getnetent exists
10742 set getnetent d_getnent
10743 eval $inlibc
10744
10745 : see if prototypes for various getnetxxx netdb.h functions are available
10746 echo " "
10747 set d_getnetprotos getnetent $i_netdb netdb.h
10748 eval $hasproto
10749
10750 : see if getpagesize exists
10751 set getpagesize d_getpagsz
10752 eval $inlibc
10753
10754
10755 : see if getprotobyname exists
10756 set getprotobyname d_getpbyname
10757 eval $inlibc
10758
10759 : see if getprotobynumber exists
10760 set getprotobynumber d_getpbynumber
10761 eval $inlibc
10762
10763 : see if getprotoent exists
10764 set getprotoent d_getpent
10765 eval $inlibc
10766
10767 : see if getpgid exists
10768 set getpgid d_getpgid
10769 eval $inlibc
10770
10771 : see if getpgrp2 exists
10772 set getpgrp2 d_getpgrp2
10773 eval $inlibc
10774
10775 : see if getppid exists
10776 set getppid d_getppid
10777 eval $inlibc
10778
10779 : see if getpriority exists
10780 set getpriority d_getprior
10781 eval $inlibc
10782
10783 : see if prototypes for various getprotoxxx netdb.h functions are available
10784 echo " "
10785 set d_getprotoprotos getprotoent $i_netdb netdb.h
10786 eval $hasproto
10787
10788 : see if getprpwnam exists
10789 set getprpwnam d_getprpwnam
10790 eval $inlibc
10791
10792 : see if getpwent exists
10793 set getpwent d_getpwent
10794 eval $inlibc
10795
10796
10797 : see if getservbyname exists
10798 set getservbyname d_getsbyname
10799 eval $inlibc
10800
10801 : see if getservbyport exists
10802 set getservbyport d_getsbyport
10803 eval $inlibc
10804
10805 : see if getservent exists
10806 set getservent d_getsent
10807 eval $inlibc
10808
10809 : see if prototypes for various getservxxx netdb.h functions are available
10810 echo " "
10811 set d_getservprotos getservent $i_netdb netdb.h
10812 eval $hasproto
10813
10814 : see if getspnam exists
10815 set getspnam d_getspnam
10816 eval $inlibc
10817
10818 : see if gettimeofday or ftime exists
10819 set gettimeofday d_gettimeod
10820 eval $inlibc
10821 case "$d_gettimeod" in
10822 "$undef")
10823         set ftime d_ftime 
10824         eval $inlibc
10825         ;;
10826 *)
10827         val="$undef"; set d_ftime; eval $setvar
10828         ;;
10829 esac
10830 case "$d_gettimeod$d_ftime" in
10831 "$undef$undef")
10832         echo " "
10833         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10834         ;;
10835 esac
10836
10837 : see if this is an grp system
10838 set grp.h i_grp
10839 eval $inhdr
10840
10841 case "$i_grp" in
10842 $define)
10843         xxx=`./findhdr grp.h`
10844         $cppstdin $cppflags $cppminus < $xxx >$$.h
10845
10846         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10847                 val="$define"
10848         else
10849                 val="$undef"
10850         fi
10851         set d_grpasswd
10852         eval $setvar
10853
10854         $rm -f $$.h
10855         ;;
10856 *)
10857         val="$undef";
10858         set d_grpasswd; eval $setvar
10859         ;;
10860 esac
10861
10862 : see if hasmntopt exists
10863 set hasmntopt d_hasmntopt
10864 eval $inlibc
10865
10866 : see if this is a netinet/in.h or sys/in.h system
10867 set netinet/in.h i_niin sys/in.h i_sysin
10868 eval $inhdr
10869
10870 : see if arpa/inet.h has to be included
10871 set arpa/inet.h i_arpainet
10872 eval $inhdr
10873
10874 : see if htonl --and friends-- exists
10875 val=''
10876 set htonl val
10877 eval $inlibc
10878
10879 : Maybe they are macros.
10880 case "$val" in
10881 $undef)
10882         $cat >htonl.c <<EOM
10883 #include <stdio.h>
10884 #include <sys/types.h>
10885 #$i_niin I_NETINET_IN
10886 #$i_sysin I_SYS_IN
10887 #$i_arpainet I_ARPA_INET
10888 #ifdef I_NETINET_IN
10889 #include <netinet/in.h>
10890 #endif
10891 #ifdef I_SYS_IN
10892 #include <sys/in.h>
10893 #endif
10894 #ifdef I_ARPA_INET
10895 #include <arpa/inet.h>
10896 #endif
10897 #ifdef htonl
10898 printf("Defined as a macro.");
10899 #endif
10900 EOM
10901         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10902         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10903                 val="$define"
10904                 echo "But it seems to be defined as a macro." >&4
10905         fi
10906         $rm -f htonl.?
10907         ;;
10908 esac
10909 set d_htonl
10910 eval $setvar
10911
10912 : index or strchr
10913 echo " "
10914 if set index val -f; eval $csym; $val; then
10915         if set strchr val -f d_strchr; eval $csym; $val; then
10916                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10917                         val="$define"
10918                         vali="$undef"
10919                         echo "strchr() found." >&4
10920                 else
10921                         val="$undef"
10922                         vali="$define"
10923                         echo "index() found." >&4
10924                 fi
10925         else
10926                 val="$undef"
10927                 vali="$define"
10928                 echo "index() found." >&4
10929         fi
10930 else
10931         if set strchr val -f d_strchr; eval $csym; $val; then
10932                 val="$define"
10933                 vali="$undef"
10934                 echo "strchr() found." >&4
10935         else
10936                 echo "No index() or strchr() found!" >&4
10937                 val="$undef"
10938                 vali="$undef"
10939         fi
10940 fi
10941 set d_strchr; eval $setvar
10942 val="$vali"
10943 set d_index; eval $setvar
10944
10945 : check whether inet_aton exists
10946 set inet_aton d_inetaton
10947 eval $inlibc
10948
10949 : Look for isascii
10950 echo " "
10951 $cat >isascii.c <<'EOCP'
10952 #include <stdio.h>
10953 #include <ctype.h>
10954 int main() {
10955         int c = 'A';
10956         if (isascii(c))
10957                 exit(0);
10958         else
10959                 exit(1);
10960 }
10961 EOCP
10962 set isascii
10963 if eval $compile; then
10964         echo "isascii() found." >&4
10965         val="$define"
10966 else
10967         echo "isascii() NOT found." >&4
10968         val="$undef"
10969 fi
10970 set d_isascii
10971 eval $setvar
10972 $rm -f isascii*
10973
10974 : see if isfinite exists
10975 set isfinite d_isfinite
10976 eval $inlibc
10977
10978 : see if isinf exists
10979 set isinf d_isinf
10980 eval $inlibc
10981
10982 : see if isnan exists
10983 set isnan d_isnan
10984 eval $inlibc
10985
10986 : see if isnanl exists
10987 set isnanl d_isnanl
10988 eval $inlibc
10989
10990 : see if killpg exists
10991 set killpg d_killpg
10992 eval $inlibc
10993
10994 : see if lchown exists
10995 echo " "
10996 $cat > try.c <<'EOCP'
10997 /* System header to define __stub macros and hopefully few prototypes,
10998     which can conflict with char lchown(); below.  */
10999 #include <assert.h>
11000 /* Override any gcc2 internal prototype to avoid an error.  */
11001 /* We use char because int might match the return type of a gcc2
11002    builtin and then its argument prototype would still apply.  */
11003 char lchown();
11004 int main() {
11005     /*  The GNU C library defines this for functions which it implements
11006         to always fail with ENOSYS.  Some functions are actually named
11007         something starting with __ and the normal name is an alias.  */
11008 #if defined (__stub_lchown) || defined (__stub___lchown)
11009 choke me
11010 #else
11011 lchown();
11012 #endif
11013 ; return 0; }
11014 EOCP
11015 set try
11016 if eval $compile; then
11017     $echo "lchown() found." >&4
11018     val="$define"
11019 else
11020     $echo "lchown() NOT found." >&4
11021     val="$undef"
11022 fi
11023 set d_lchown
11024 eval $setvar
11025
11026 : See if number of significant digits in a double precision number is known
11027 echo " "
11028 $cat >ldbl_dig.c <<EOM
11029 #$i_limits I_LIMITS
11030 #$i_float I_FLOAT
11031 #ifdef I_LIMITS
11032 #include <limits.h>
11033 #endif
11034 #ifdef I_FLOAT
11035 #include <float.h>
11036 #endif
11037 #ifdef LDBL_DIG
11038 printf("Contains LDBL_DIG");
11039 #endif
11040 EOM
11041 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
11042 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
11043         echo "LDBL_DIG found." >&4
11044         val="$define"
11045 else
11046         echo "LDBL_DIG NOT found." >&4
11047         val="$undef"
11048 fi
11049 $rm -f ldbl_dig.?
11050 set d_ldbl_dig
11051 eval $setvar
11052
11053 : see if link exists
11054 set link d_link
11055 eval $inlibc
11056
11057 : see if localeconv exists
11058 set localeconv d_locconv
11059 eval $inlibc
11060
11061 : see if lockf exists
11062 set lockf d_lockf
11063 eval $inlibc
11064
11065 : see if prototype for lseek is available
11066 echo " "
11067 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
11068 eval $hasproto
11069
11070 : see if lstat exists
11071 set lstat d_lstat
11072 eval $inlibc
11073
11074 : see if madvise exists
11075 set madvise d_madvise
11076 eval $inlibc
11077
11078 : see if mblen exists
11079 set mblen d_mblen
11080 eval $inlibc
11081
11082 : see if mbstowcs exists
11083 set mbstowcs d_mbstowcs
11084 eval $inlibc
11085
11086 : see if mbtowc exists
11087 set mbtowc d_mbtowc
11088 eval $inlibc
11089
11090 : see if memchr exists
11091 set memchr d_memchr
11092 eval $inlibc
11093
11094 : see if memcmp exists
11095 set memcmp d_memcmp
11096 eval $inlibc
11097
11098 : see if memcpy exists
11099 set memcpy d_memcpy
11100 eval $inlibc
11101
11102 : see if memmove exists
11103 set memmove d_memmove
11104 eval $inlibc
11105
11106 : see if memset exists
11107 set memset d_memset
11108 eval $inlibc
11109
11110 : see if mkdir exists
11111 set mkdir d_mkdir
11112 eval $inlibc
11113
11114 : see if mkdtemp exists
11115 set mkdtemp d_mkdtemp
11116 eval $inlibc
11117
11118 : see if mkfifo exists
11119 set mkfifo d_mkfifo
11120 eval $inlibc
11121
11122 : see if mkstemp exists
11123 set mkstemp d_mkstemp
11124 eval $inlibc
11125
11126 : see if mkstemps exists
11127 set mkstemps d_mkstemps
11128 eval $inlibc
11129
11130 : see if mktime exists
11131 set mktime d_mktime
11132 eval $inlibc
11133
11134 : see if this is a sys/mman.h system
11135 set sys/mman.h i_sysmman
11136 eval $inhdr
11137
11138 : see if mmap exists
11139 set mmap d_mmap
11140 eval $inlibc
11141 : see what shmat returns
11142 : default to something harmless
11143 mmaptype='void *'
11144 case "$i_sysmman$d_mmap" in
11145 "$define$define")
11146         $cat >mmap.c <<'END'
11147 #include <sys/mman.h>
11148 void *mmap();
11149 END
11150         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
11151                 mmaptype='void *'
11152         else
11153                 mmaptype='caddr_t'
11154         fi
11155         echo "and it returns ($mmaptype)." >&4
11156         ;;
11157 esac
11158
11159
11160
11161 : see if mprotect exists
11162 set mprotect d_mprotect
11163 eval $inlibc
11164
11165 : see if msgctl exists
11166 set msgctl d_msgctl
11167 eval $inlibc
11168
11169 : see if msgget exists
11170 set msgget d_msgget
11171 eval $inlibc
11172
11173 : see if msgsnd exists
11174 set msgsnd d_msgsnd
11175 eval $inlibc
11176
11177 : see if msgrcv exists
11178 set msgrcv d_msgrcv
11179 eval $inlibc
11180
11181 : see how much of the 'msg*(2)' library is present.
11182 h_msg=true
11183 echo " "
11184 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
11185 *"$undef"*) h_msg=false;;
11186 esac
11187 case "$osname" in
11188 freebsd)
11189     case "`ipcs 2>&1`" in
11190     "SVID messages"*"not configured"*)
11191         echo "Your $osname does not have the msg*(2) configured." >&4
11192         h_msg=false
11193         val="$undef"
11194         set msgctl d_msgctl
11195         eval $setvar
11196         set msgget d_msgget
11197         eval $setvar
11198         set msgsnd d_msgsnd
11199         eval $setvar
11200         set msgrcv d_msgrcv
11201         eval $setvar
11202         ;;
11203     esac
11204     ;;
11205 esac
11206 : we could also check for sys/ipc.h ...
11207 if $h_msg && $test `./findhdr sys/msg.h`; then
11208         echo "You have the full msg*(2) library." >&4
11209         val="$define"
11210 else
11211         echo "You don't have the full msg*(2) library." >&4
11212         val="$undef"
11213 fi
11214 set d_msg
11215 eval $setvar
11216
11217
11218 echo " "
11219 echo "Checking to see if your system supports struct msghdr..." >&4
11220 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11221 eval $hasstruct
11222 case "$d_msghdr_s" in
11223 "$define")      echo "Yes, it does."   ;;
11224 *)              echo "No, it doesn't." ;;
11225 esac
11226
11227
11228 : see if msync exists
11229 set msync d_msync
11230 eval $inlibc
11231
11232 : see if munmap exists
11233 set munmap d_munmap
11234 eval $inlibc
11235
11236 : see if nice exists
11237 set nice d_nice
11238 eval $inlibc
11239
11240 : see if this is a langinfo.h system
11241 set langinfo.h i_langinfo
11242 eval $inhdr
11243
11244 : see if nl_langinfo exists
11245 set nl_langinfo d_nl_langinfo
11246 eval $inlibc
11247
11248 : check for length of character
11249 echo " "
11250 case "$charsize" in
11251 '')
11252         echo "Checking to see how big your characters are (hey, you never know)..." >&4
11253         $cat >try.c <<'EOCP'
11254 #include <stdio.h>
11255 int main()
11256 {
11257     printf("%d\n", (int)sizeof(char));
11258     exit(0);
11259 }
11260 EOCP
11261         set try
11262         if eval $compile_ok; then
11263                 dflt=`$run ./try`
11264         else
11265                 dflt='1'
11266                 echo "(I can't seem to compile the test program.  Guessing...)"
11267         fi
11268         ;;
11269 *)
11270         dflt="$charsize"
11271         ;;
11272 esac
11273 rp="What is the size of a character (in bytes)?"
11274 . ./myread
11275 charsize="$ans"
11276 $rm -f try.c try
11277
11278 : check for volatile keyword
11279 echo " "
11280 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11281 $cat >try.c <<'EOCP'
11282 int main()
11283 {
11284         typedef struct _goo_struct goo_struct;
11285         goo_struct * volatile goo = ((goo_struct *)0);
11286         struct _goo_struct {
11287                 long long_int;
11288                 int reg_int;
11289                 char char_var;
11290         };
11291         typedef unsigned short foo_t;
11292         char *volatile foo;
11293         volatile int bar;
11294         volatile foo_t blech;
11295         foo = foo;
11296 }
11297 EOCP
11298 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11299         val="$define"
11300         echo "Yup, it does."
11301 else
11302         val="$undef"
11303         echo "Nope, it doesn't."
11304 fi
11305 set d_volatile
11306 eval $setvar
11307 $rm -f try.*
11308
11309
11310 echo " "
11311 $echo "Choosing the C types to be used for Perl's internal types..." >&4
11312
11313 case "$use64bitint:$d_quad:$quadtype" in
11314 define:define:?*)
11315         ivtype="$quadtype"
11316         uvtype="$uquadtype"
11317         ivsize=8
11318         uvsize=8
11319         ;;
11320 *)      ivtype="long"
11321         uvtype="unsigned long"
11322         ivsize=$longsize
11323         uvsize=$longsize
11324         ;;
11325 esac
11326
11327 case "$uselongdouble:$d_longdbl" in
11328 define:define)
11329         nvtype="long double"
11330         nvsize=$longdblsize
11331         ;;
11332 *)      nvtype=double
11333         nvsize=$doublesize
11334         ;;
11335 esac
11336
11337 $echo "(IV will be "$ivtype", $ivsize bytes)"
11338 $echo "(UV will be "$uvtype", $uvsize bytes)"
11339 $echo "(NV will be "$nvtype", $nvsize bytes)"
11340
11341 $cat >try.c <<EOCP
11342 #$i_inttypes I_INTTYPES
11343 #ifdef I_INTTYPES
11344 #include <inttypes.h>
11345 #endif
11346 #include <stdio.h>
11347 int main() {
11348 #ifdef INT8
11349    int8_t i =  INT8_MAX;
11350   uint8_t u = UINT8_MAX;
11351   printf("int8_t\n");
11352 #endif
11353 #ifdef INT16
11354    int16_t i =  INT16_MAX;
11355   uint16_t i = UINT16_MAX;
11356   printf("int16_t\n");
11357 #endif
11358 #ifdef INT32
11359    int32_t i =  INT32_MAX;
11360   uint32_t u = UINT32_MAX;
11361   printf("int32_t\n");
11362 #endif
11363 }
11364 EOCP
11365
11366 case "$i8type" in
11367 '')     case "$charsize" in
11368         1)      i8type=char
11369                 u8type="unsigned char"
11370                 i8size=$charsize
11371                 u8size=$charsize
11372                 ;;
11373         esac
11374         ;;
11375 esac
11376 case "$i8type" in
11377 '')     set try -DINT8
11378         if eval $compile; then
11379                 case "`$run ./try`" in
11380                 int8_t) i8type=int8_t
11381                         u8type=uint8_t
11382                         i8size=1
11383                         u8size=1
11384                         ;;
11385                 esac
11386         fi
11387         ;;
11388 esac
11389 case "$i8type" in
11390 '')     if $test $charsize -ge 1; then
11391                 i8type=char
11392                 u8type="unsigned char"
11393                 i8size=$charsize
11394                 u8size=$charsize
11395         fi
11396         ;;
11397 esac
11398
11399 case "$i16type" in
11400 '')     case "$shortsize" in
11401         2)      i16type=short
11402                 u16type="unsigned short"
11403                 i16size=$shortsize
11404                 u16size=$shortsize
11405                 ;;
11406         esac
11407         ;;
11408 esac
11409 case "$i16type" in
11410 '')     set try -DINT16
11411         if eval $compile; then
11412                 case "`$run ./try`" in
11413                 int16_t)
11414                         i16type=int16_t
11415                         u16type=uint16_t
11416                         i16size=2
11417                         u16size=2
11418                         ;;
11419                 esac
11420         fi
11421         ;;
11422 esac
11423 case "$i16type" in
11424 '')     if $test $shortsize -ge 2; then
11425                 i16type=short
11426                 u16type="unsigned short"
11427                 i16size=$shortsize
11428                 u16size=$shortsize
11429         fi
11430         ;;
11431 esac
11432
11433 case "$i32type" in
11434 '')     case "$longsize" in
11435         4)      i32type=long
11436                 u32type="unsigned long"
11437                 i32size=$longsize
11438                 u32size=$longsize
11439                 ;;
11440         *)      case "$intsize" in
11441                 4)      i32type=int
11442                         u32type="unsigned int"
11443                         i32size=$intsize
11444                         u32size=$intsize
11445                         ;;
11446                 esac
11447                 ;;
11448         esac
11449         ;;
11450 esac
11451 case "$i32type" in
11452 '')     set try -DINT32
11453         if eval $compile; then
11454                 case "`$run ./try`" in
11455                 int32_t)
11456                         i32type=int32_t
11457                         u32type=uint32_t
11458                         i32size=4
11459                         u32size=4
11460                         ;;
11461                 esac
11462         fi
11463         ;;
11464 esac
11465 case "$i32type" in
11466 '')     if $test $intsize -ge 4; then
11467                 i32type=int
11468                 u32type="unsigned int"
11469                 i32size=$intsize
11470                 u32size=$intsize
11471         fi
11472         ;;
11473 esac
11474
11475 case "$i64type" in
11476 '')     case "$d_quad:$quadtype" in
11477         define:?*)
11478                 i64type="$quadtype"
11479                 u64type="$uquadtype"
11480                 i64size=8
11481                 u64size=8
11482                 ;;
11483         esac
11484         ;;
11485 esac
11486
11487 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
11488 : volatile so that the compiler has to store it out to memory.
11489 if test X"$d_volatile" = X"$define"; then
11490         volatile=volatile
11491 fi
11492 $cat <<EOP >try.c
11493 #include <stdio.h>
11494 #include <sys/types.h>
11495 #include <signal.h>
11496 #ifdef SIGFPE
11497 $volatile int bletched = 0;
11498 $signal_t blech(s) int s; { bletched = 1; }
11499 #endif
11500 int main() {
11501     $uvtype u = 0;
11502     $nvtype d;
11503     int     n = 8 * $uvsize;
11504     int     i;
11505 #ifdef SIGFPE
11506     signal(SIGFPE, blech);
11507 #endif
11508
11509     for (i = 0; i < n; i++) {
11510       u = u << 1 | ($uvtype)1;
11511       d = ($nvtype)u;
11512       if (($uvtype)d != u)
11513         break;
11514       if (d <= 0)
11515         break;
11516       d = ($nvtype)(u - 1);
11517       if (($uvtype)d != (u - 1))
11518         break;
11519 #ifdef SIGFPE
11520       if (bletched) {
11521         break;
11522 #endif
11523       } 
11524     }
11525     printf("%d\n", ((i == n) ? -n : i));
11526     exit(0);
11527 }
11528 EOP
11529 set try
11530
11531 d_nv_preserves_uv="$undef"
11532 if eval $compile; then
11533         d_nv_preserves_uv_bits="`$run ./try`"
11534 fi
11535 case "$d_nv_preserves_uv_bits" in
11536 \-[1-9]*)       
11537         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
11538         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11539         d_nv_preserves_uv="$define"
11540         ;;
11541 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11542         d_nv_preserves_uv="$undef" ;;
11543 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
11544         d_nv_preserves_uv_bits="$undef" ;;
11545 esac
11546
11547 $rm -f try.* try
11548
11549
11550 : check for off64_t
11551 echo " "
11552 echo "Checking to see if you have off64_t..." >&4
11553 $cat >try.c <<EOCP
11554 #include <sys/types.h>
11555 #include <unistd.h>
11556 int main() { off64_t x = 7; }
11557 EOCP
11558 set try
11559 if eval $compile; then
11560         val="$define"
11561         echo "You have off64_t."
11562 else
11563         val="$undef"
11564         echo "You do not have off64_t."
11565         case "$lseeksize" in
11566         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
11567         esac
11568 fi
11569 $rm -f try.* try
11570 set d_off64_t
11571 eval $setvar
11572
11573 : see if POSIX threads are available
11574 set pthread.h i_pthread
11575 eval $inhdr
11576
11577
11578
11579
11580 : how to create joinable pthreads
11581 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
11582         echo " "
11583         echo "Checking what constant to use for creating joinable pthreads..." >&4 
11584         $cat >try.c <<'EOCP'
11585 #include <pthread.h>
11586 int main() {
11587     int detachstate = JOINABLE;
11588 }
11589 EOCP
11590         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
11591         if eval $compile; then
11592                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
11593                 val="$undef" # Yes, undef.
11594                 set d_old_pthread_create_joinable
11595                 eval $setvar
11596                 val=""
11597                 set old_pthread_create_joinable
11598                 eval $setvar
11599         else
11600                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
11601                 if eval $compile; then
11602                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
11603                         val="$define"
11604                         set d_old_pthread_create_joinable
11605                         eval $setvar
11606                         val=PTHREAD_CREATE_UNDETACHED
11607                         set old_pthread_create_joinable
11608                         eval $setvar
11609                 else            
11610                         set try -DJOINABLE=__UNDETACHED
11611                         if eval $compile; then
11612                                 echo "You seem to use __UNDETACHED." >&4
11613                                 val="$define"
11614                                 set d_old_pthread_create_joinable
11615                                 eval $setvar
11616                                 val=__UNDETACHED
11617                                 set old_pthread_create_joinable
11618                                 eval $setvar
11619                         else
11620                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
11621                                 val="$define"
11622                                 set d_old_pthread_create_joinable
11623                                 eval $setvar
11624                                 val=0
11625                                 set old_pthread_create_joinable
11626                                 eval $setvar
11627                         fi
11628                 fi
11629         fi
11630         $rm -f try try.*
11631 else
11632     d_old_pthread_create_joinable="$undef"
11633     old_pthread_create_joinable=""
11634 fi
11635
11636 : see if pause exists
11637 set pause d_pause
11638 eval $inlibc
11639
11640 : see if pipe exists
11641 set pipe d_pipe
11642 eval $inlibc
11643
11644 : see if poll exists
11645 set poll d_poll
11646 eval $inlibc
11647
11648 : see if readlink exists
11649 set readlink d_readlink
11650 eval $inlibc
11651
11652 echo " "
11653 procselfexe=''
11654 val="$undef"
11655 case "$d_readlink" in
11656 "$define")
11657         if $issymlink /proc/self/exe ; then
11658                 $ls -l /proc/self/exe > reflect
11659                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
11660                         echo "You have Linux-like /proc/self/exe."
11661                         procselfexe='"/proc/self/exe"'
11662                         val="$define"
11663                 fi
11664         fi
11665         if $issymlink /proc/curproc/file ; then
11666                 $ls -l /proc/curproc/file > reflect
11667                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
11668                         echo "You have BSD-like /proc/curproc/file."
11669                         procselfexe='"/proc/curproc/file"'
11670                         val="$define"
11671                 fi
11672         fi
11673         ;;
11674 esac
11675 $rm -f reflect
11676 set d_procselfexe
11677 eval $setvar
11678
11679 : see if pthread_atfork exists
11680 set pthread_atfork d_pthread_atfork
11681 eval $inlibc
11682
11683
11684 : see whether the various POSIXish _yields exist
11685 $cat >try.c <<EOP
11686 #include <pthread.h>
11687 #include <stdio.h>
11688 int main() {
11689 #ifdef SCHED_YIELD
11690         sched_yield();
11691 #else
11692 #ifdef PTHREAD_YIELD
11693         pthread_yield();
11694 #else
11695 #ifdef PTHREAD_YIELD_NULL
11696         pthread_yield(NULL);
11697 #endif
11698 #endif
11699 #endif
11700 }
11701 EOP
11702 : see if sched_yield exists
11703 set try -DSCHED_YIELD
11704 if eval $compile; then
11705     val="$define"
11706     sched_yield='sched_yield()'
11707 else
11708     val="$undef"
11709 fi
11710 case "$usethreads" in
11711 $define)
11712         case "$val" in
11713         $define) echo 'sched_yield() found.' >&4        ;;
11714         *)       echo 'sched_yield() NOT found.' >&4    ;;
11715         esac
11716 esac
11717 set d_sched_yield
11718 eval $setvar
11719
11720 : see if pthread_yield exists
11721 set try -DPTHREAD_YIELD
11722 if eval $compile; then
11723     val="$define"
11724     case "$sched_yield" in
11725     '') sched_yield='pthread_yield()' ;;
11726     esac
11727 else
11728     set try -DPTHREAD_YIELD_NULL
11729     if eval $compile; then
11730         val="$define"
11731         case "$sched_yield" in
11732         '') sched_yield='pthread_yield(NULL)' ;;
11733         esac
11734     else
11735         val="$undef"
11736     fi
11737 fi
11738 case "$usethreads" in
11739 $define)
11740         case "$val" in
11741         $define) echo 'pthread_yield() found.' >&4      ;;
11742         *)       echo 'pthread_yield() NOT found.' >&4  ;;
11743         esac
11744         ;;
11745 esac
11746 set d_pthread_yield
11747 eval $setvar
11748
11749 case "$sched_yield" in
11750 '') sched_yield=undef ;;
11751 esac
11752
11753 $rm -f try try.*
11754
11755 : see if this is a pwd.h system
11756 set pwd.h i_pwd
11757 eval $inhdr
11758
11759 case "$i_pwd" in
11760 $define)
11761         xxx=`./findhdr pwd.h`
11762         $cppstdin $cppflags $cppminus < $xxx >$$.h
11763
11764         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11765                 val="$define"
11766         else
11767                 val="$undef"
11768         fi
11769         set d_pwquota
11770         eval $setvar
11771
11772         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11773                 val="$define"
11774         else
11775                 val="$undef"
11776         fi
11777         set d_pwage
11778         eval $setvar
11779
11780         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11781                 val="$define"
11782         else
11783                 val="$undef"
11784         fi
11785         set d_pwchange
11786         eval $setvar
11787
11788         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11789                 val="$define"
11790         else
11791                 val="$undef"
11792         fi
11793         set d_pwclass
11794         eval $setvar
11795
11796         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11797                 val="$define"
11798         else
11799                 val="$undef"
11800         fi
11801         set d_pwexpire
11802         eval $setvar
11803
11804         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11805                 val="$define"
11806         else
11807                 val="$undef"
11808         fi
11809         set d_pwcomment
11810         eval $setvar
11811
11812         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11813                 val="$define"
11814         else
11815                 val="$undef"
11816         fi
11817         set d_pwgecos
11818         eval $setvar
11819
11820         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11821                 val="$define"
11822         else
11823                 val="$undef"
11824         fi
11825         set d_pwpasswd
11826         eval $setvar
11827
11828         $rm -f $$.h
11829         ;;
11830 *)
11831         val="$undef"; 
11832         set d_pwquota; eval $setvar
11833         set d_pwage; eval $setvar
11834         set d_pwchange; eval $setvar
11835         set d_pwclass; eval $setvar
11836         set d_pwexpire; eval $setvar
11837         set d_pwcomment; eval $setvar
11838         set d_pwgecos; eval $setvar
11839         set d_pwpasswd; eval $setvar
11840         ;;
11841 esac
11842
11843 : see if readdir and friends exist
11844 set readdir d_readdir
11845 eval $inlibc
11846 set seekdir d_seekdir
11847 eval $inlibc
11848 set telldir d_telldir
11849 eval $inlibc
11850 set rewinddir d_rewinddir
11851 eval $inlibc
11852
11853 : see if readv exists
11854 set readv d_readv
11855 eval $inlibc
11856
11857 : see if recvmsg exists
11858 set recvmsg d_recvmsg
11859 eval $inlibc
11860
11861 : see if rename exists
11862 set rename d_rename
11863 eval $inlibc
11864
11865 : see if rmdir exists
11866 set rmdir d_rmdir
11867 eval $inlibc
11868
11869 : see if memory.h is available.
11870 val=''
11871 set memory.h val
11872 eval $inhdr
11873
11874 : See if it conflicts with string.h
11875 case "$val" in
11876 $define)
11877         case "$strings" in
11878         '') ;;
11879         *)
11880                 $cppstdin $cppflags $cppminus < $strings > mem.h
11881                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11882                         echo " "
11883                         echo "We won't be including <memory.h>."
11884                         val="$undef"
11885                 fi
11886                 $rm -f mem.h
11887                 ;;
11888         esac
11889 esac
11890 set i_memory
11891 eval $setvar
11892
11893 : can bcopy handle overlapping blocks?
11894 echo " "
11895 val="$undef"
11896 case "$d_memmove" in
11897 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
11898 *)      case "$d_bcopy" in
11899         "$define")
11900                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
11901                 $cat >try.c <<EOCP
11902 #$i_memory I_MEMORY
11903 #$i_stdlib I_STDLIB
11904 #$i_string I_STRING
11905 #$i_unistd I_UNISTD
11906 EOCP
11907         $cat >>try.c <<'EOCP'
11908 #include <stdio.h>
11909 #ifdef I_MEMORY
11910 #  include <memory.h>
11911 #endif
11912 #ifdef I_STDLIB
11913 #  include <stdlib.h>
11914 #endif
11915 #ifdef I_STRING
11916 #  include <string.h>
11917 #else
11918 #  include <strings.h>
11919 #endif
11920 #ifdef I_UNISTD
11921 #  include <unistd.h>  /* Needed for NetBSD */
11922 #endif
11923 int main()
11924 {
11925 char buf[128], abc[128];
11926 char *b;
11927 int len;
11928 int off;
11929 int align;
11930
11931 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11932    try to store the string in read-only memory. */
11933 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11934
11935 for (align = 7; align >= 0; align--) {
11936         for (len = 36; len; len--) {
11937                 b = buf+align;
11938                 bcopy(abc, b, len);
11939                 for (off = 1; off <= len; off++) {
11940                         bcopy(b, b+off, len);
11941                         bcopy(b+off, b, len);
11942                         if (bcmp(b, abc, len))
11943                                 exit(1);
11944                 }
11945         }
11946 }
11947 exit(0);
11948 }
11949 EOCP
11950                 set try
11951                 if eval $compile_ok; then
11952                         if ./try 2>/dev/null; then
11953                                 echo "Yes, it can."
11954                                 val="$define"
11955                         else
11956                                 echo "It can't, sorry."
11957                         fi
11958                 else
11959                         echo "(I can't compile the test program, so we'll assume not...)"
11960                 fi
11961                 ;;
11962         esac
11963         $rm -f try.* try core
11964         ;;
11965 esac
11966 set d_safebcpy
11967 eval $setvar
11968
11969 : can memcpy handle overlapping blocks?
11970 echo " "
11971 val="$undef"
11972 case "$d_memmove" in
11973 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
11974 *)      case "$d_memcpy" in
11975         "$define")
11976                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
11977                 $cat >try.c <<EOCP
11978 #$i_memory I_MEMORY
11979 #$i_stdlib I_STDLIB
11980 #$i_string I_STRING
11981 #$i_unistd I_UNISTD
11982 EOCP
11983         $cat >>try.c <<'EOCP'
11984 #include <stdio.h>
11985 #ifdef I_MEMORY
11986 #  include <memory.h>
11987 #endif
11988 #ifdef I_STDLIB
11989 #  include <stdlib.h>
11990 #endif
11991 #ifdef I_STRING
11992 #  include <string.h>
11993 #else
11994 #  include <strings.h>
11995 #endif
11996 #ifdef I_UNISTD
11997 #  include <unistd.h>  /* Needed for NetBSD */
11998 #endif
11999 int main()
12000 {
12001 char buf[128], abc[128];
12002 char *b;
12003 int len;
12004 int off;
12005 int align;
12006
12007 /* Copy "abcde..." string to char abc[] so that gcc doesn't
12008    try to store the string in read-only memory. */
12009 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
12010
12011 for (align = 7; align >= 0; align--) {
12012         for (len = 36; len; len--) {
12013                 b = buf+align;
12014                 memcpy(b, abc, len);
12015                 for (off = 1; off <= len; off++) {
12016                         memcpy(b+off, b, len);
12017                         memcpy(b, b+off, len);
12018                         if (memcmp(b, abc, len))
12019                                 exit(1);
12020                 }
12021         }
12022 }
12023 exit(0);
12024 }
12025 EOCP
12026                 set try
12027                 if eval $compile_ok; then
12028                         if ./try 2>/dev/null; then
12029                                 echo "Yes, it can."
12030                                 val="$define"
12031                         else
12032                                 echo "It can't, sorry."
12033                         fi
12034                 else
12035                         echo "(I can't compile the test program, so we'll assume not...)"
12036                 fi
12037                 ;;
12038         esac
12039         $rm -f try.* try core
12040         ;;
12041 esac
12042 set d_safemcpy
12043 eval $setvar
12044
12045 : can memcmp be trusted to compare relative magnitude?
12046 val="$undef"
12047 case "$d_memcmp" in
12048 "$define")
12049         echo " "
12050         echo "Checking if your memcmp() can compare relative magnitude..." >&4
12051         $cat >try.c <<EOCP
12052 #$i_memory I_MEMORY
12053 #$i_stdlib I_STDLIB
12054 #$i_string I_STRING
12055 #$i_unistd I_UNISTD
12056 EOCP
12057         $cat >>try.c <<'EOCP'
12058 #include <stdio.h>
12059 #ifdef I_MEMORY
12060 #  include <memory.h>
12061 #endif
12062 #ifdef I_STDLIB
12063 #  include <stdlib.h>
12064 #endif
12065 #ifdef I_STRING
12066 #  include <string.h>
12067 #else
12068 #  include <strings.h>
12069 #endif
12070 #ifdef I_UNISTD
12071 #  include <unistd.h>  /* Needed for NetBSD */
12072 #endif
12073 int main()
12074 {
12075 char a = -1;
12076 char b = 0;
12077 if ((a < b) && memcmp(&a, &b, 1) < 0)
12078         exit(1);
12079 exit(0);
12080 }
12081 EOCP
12082         set try
12083         if eval $compile_ok; then
12084                 if $run ./try 2>/dev/null; then
12085                         echo "Yes, it can."
12086                         val="$define"
12087                 else
12088                         echo "No, it can't (it uses signed chars)."
12089                 fi
12090         else
12091                 echo "(I can't compile the test program, so we'll assume not...)"
12092         fi
12093         ;;
12094 esac
12095 $rm -f try.* try core
12096 set d_sanemcmp
12097 eval $setvar
12098
12099 : see if prototype for sbrk is available
12100 echo " "
12101 set d_sbrkproto sbrk $i_unistd unistd.h
12102 eval $hasproto
12103
12104 : see if select exists
12105 set select d_select
12106 eval $inlibc
12107
12108 : see if semctl exists
12109 set semctl d_semctl
12110 eval $inlibc
12111
12112 : see if semget exists
12113 set semget d_semget
12114 eval $inlibc
12115
12116 : see if semop exists
12117 set semop d_semop
12118 eval $inlibc
12119
12120 : see how much of the 'sem*(2)' library is present.
12121 h_sem=true
12122 echo " "
12123 case "$d_semctl$d_semget$d_semop" in
12124 *"$undef"*) h_sem=false;;
12125 esac
12126 case "$osname" in
12127 freebsd)
12128     case "`ipcs 2>&1`" in
12129     "SVID messages"*"not configured"*)
12130         echo "Your $osname does not have the sem*(2) configured." >&4
12131         h_sem=false
12132         val="$undef"
12133         set semctl d_semctl
12134         eval $setvar
12135         set semget d_semget
12136         eval $setvar
12137         set semop d_semop
12138         eval $setvar
12139         ;;
12140     esac
12141     ;;
12142 esac
12143 : we could also check for sys/ipc.h ...
12144 if $h_sem && $test `./findhdr sys/sem.h`; then
12145         echo "You have the full sem*(2) library." >&4
12146         val="$define"
12147 else
12148         echo "You don't have the full sem*(2) library." >&4
12149         val="$undef"
12150 fi
12151 set d_sem
12152 eval $setvar
12153
12154 : see whether sys/sem.h defines union semun
12155 echo " "
12156 $cat > try.c <<'END'
12157 #include <sys/types.h>
12158 #include <sys/ipc.h>
12159 #include <sys/sem.h>
12160 int main () { union semun semun; semun.buf = 0; }
12161 END
12162 set try
12163 if eval $compile; then
12164     echo "You have union semun in <sys/sem.h>." >&4
12165     val="$define"
12166 else
12167     echo "You do not have union semun in <sys/sem.h>." >&4
12168     val="$undef"
12169 fi
12170 $rm -f try try.c try.h
12171 set d_union_semun
12172 eval $setvar
12173
12174 : see how to do semctl IPC_STAT
12175 case "$d_sem" in
12176 $define)
12177     : see whether semctl IPC_STAT can use union semun
12178     echo " "
12179     $cat > try.h <<END
12180 #ifndef S_IRUSR
12181 #   ifdef S_IREAD
12182 #       define S_IRUSR S_IREAD
12183 #       define S_IWUSR S_IWRITE
12184 #       define S_IXUSR S_IEXEC
12185 #   else
12186 #       define S_IRUSR 0400
12187 #       define S_IWUSR 0200
12188 #       define S_IXUSR 0100
12189 #   endif
12190 #   define S_IRGRP (S_IRUSR>>3)
12191 #   define S_IWGRP (S_IWUSR>>3)
12192 #   define S_IXGRP (S_IXUSR>>3)
12193 #   define S_IROTH (S_IRUSR>>6)
12194 #   define S_IWOTH (S_IWUSR>>6)
12195 #   define S_IXOTH (S_IXUSR>>6)
12196 #endif
12197 #ifndef S_IRWXU
12198 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
12199 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
12200 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
12201 #endif
12202 END
12203
12204     $cat > try.c <<END
12205 #include <sys/types.h>
12206 #include <sys/ipc.h>
12207 #include <sys/sem.h>
12208 #include <sys/stat.h>
12209 #include <stdio.h>
12210 #include <errno.h>
12211 #include "try.h"
12212 #ifndef errno
12213 extern int errno;
12214 #endif
12215 #$d_union_semun HAS_UNION_SEMUN
12216 int main() {
12217     union semun
12218 #ifndef HAS_UNION_SEMUN
12219     {
12220         int val;
12221         struct semid_ds *buf;
12222         unsigned short *array;
12223     }
12224 #endif
12225     arg;
12226     int sem, st;
12227
12228 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
12229     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
12230     if (sem > -1) {
12231         struct semid_ds argbuf;
12232         arg.buf = &argbuf;
12233 #       ifdef IPC_STAT
12234         st = semctl(sem, 0, IPC_STAT, arg);
12235         if (st == 0)
12236             printf("semun\n");
12237         else
12238 #       endif /* IPC_STAT */
12239             printf("semctl IPC_STAT failed: errno = %d\n", errno);
12240 #       ifdef IPC_RMID
12241         if (semctl(sem, 0, IPC_RMID, arg) != 0)
12242 #       endif /* IPC_RMID */
12243             printf("semctl IPC_RMID failed: errno = %d\n", errno);
12244     } else
12245 #endif /* IPC_PRIVATE && ... */
12246         printf("semget failed: errno = %d\n", errno);
12247   return 0;
12248 }
12249 END
12250     val="$undef"
12251     set try
12252     if eval $compile; then
12253         xxx=`$run ./try`
12254         case "$xxx" in
12255         semun) val="$define" ;;
12256         esac
12257     fi
12258     $rm -f try try.c
12259     set d_semctl_semun
12260     eval $setvar
12261     case "$d_semctl_semun" in
12262     $define)
12263         echo "You can use union semun for semctl IPC_STAT." >&4
12264         also='also'
12265         ;;
12266     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
12267         also=''
12268         ;;
12269     esac
12270
12271     : see whether semctl IPC_STAT can use struct semid_ds pointer
12272     $cat > try.c <<'END'
12273 #include <sys/types.h>
12274 #include <sys/ipc.h>
12275 #include <sys/sem.h>
12276 #include <sys/stat.h>
12277 #include "try.h"
12278 #include <stdio.h>
12279 #include <errno.h>
12280 #ifndef errno
12281 extern int errno;
12282 #endif
12283 int main() {
12284     struct semid_ds arg;
12285     int sem, st;
12286
12287 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
12288     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
12289     if (sem > -1) {
12290 #       ifdef IPC_STAT
12291         st = semctl(sem, 0, IPC_STAT, &arg);
12292         if (st == 0)
12293             printf("semid_ds\n");
12294         else
12295 #       endif /* IPC_STAT */
12296             printf("semctl IPC_STAT failed: errno = %d\n", errno);
12297 #       ifdef IPC_RMID
12298         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
12299 #       endif /* IPC_RMID */
12300             printf("semctl IPC_RMID failed: errno = %d\n", errno);
12301     } else
12302 #endif /* IPC_PRIVATE && ... */
12303         printf("semget failed: errno = %d\n", errno);
12304
12305     return 0;
12306 }
12307 END
12308     val="$undef"
12309     set try
12310     if eval $compile; then
12311         xxx=`$run ./try`
12312         case "$xxx" in
12313         semid_ds) val="$define" ;;
12314         esac
12315     fi
12316     $rm -f try try.c
12317     set d_semctl_semid_ds
12318     eval $setvar
12319     case "$d_semctl_semid_ds" in
12320     $define)
12321         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
12322         ;;
12323     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
12324         ;;
12325     esac
12326     $rm -f try.h
12327     ;;
12328 *)  val="$undef"
12329
12330     # We do not have the full sem*(2) library, so assume we can not
12331     # use either.
12332
12333     set d_semctl_semun
12334     eval $setvar
12335
12336     set d_semctl_semid_ds
12337     eval $setvar
12338     ;;
12339 esac
12340
12341 : see if sendmsg exists
12342 set sendmsg d_sendmsg
12343 eval $inlibc
12344
12345 : see if setegid exists
12346 set setegid d_setegid
12347 eval $inlibc
12348
12349 : see if seteuid exists
12350 set seteuid d_seteuid
12351 eval $inlibc
12352
12353 : see if setgrent exists
12354 set setgrent d_setgrent
12355 eval $inlibc
12356
12357 : see if sethostent exists
12358 set sethostent d_sethent
12359 eval $inlibc
12360
12361 : see if setitimer exists
12362 set setitimer d_setitimer
12363 eval $inlibc
12364
12365 : see if setlinebuf exists
12366 set setlinebuf d_setlinebuf
12367 eval $inlibc
12368
12369 : see if setlocale exists
12370 set setlocale d_setlocale
12371 eval $inlibc
12372
12373 : see if setnetent exists
12374 set setnetent d_setnent
12375 eval $inlibc
12376
12377 : see if setprotoent exists
12378 set setprotoent d_setpent
12379 eval $inlibc
12380
12381 : see if setpgid exists
12382 set setpgid d_setpgid
12383 eval $inlibc
12384
12385 : see if setpgrp2 exists
12386 set setpgrp2 d_setpgrp2
12387 eval $inlibc
12388
12389 : see if setpriority exists
12390 set setpriority d_setprior
12391 eval $inlibc
12392
12393 : see if setproctitle exists
12394 set setproctitle d_setproctitle
12395 eval $inlibc
12396
12397 : see if setpwent exists
12398 set setpwent d_setpwent
12399 eval $inlibc
12400
12401 : see if setregid exists
12402 set setregid d_setregid
12403 eval $inlibc
12404 set setresgid d_setresgid
12405 eval $inlibc
12406
12407 : see if setreuid exists
12408 set setreuid d_setreuid
12409 eval $inlibc
12410 set setresuid d_setresuid
12411 eval $inlibc
12412
12413 : see if setrgid exists
12414 set setrgid d_setrgid
12415 eval $inlibc
12416
12417 : see if setruid exists
12418 set setruid d_setruid
12419 eval $inlibc
12420
12421 : see if setservent exists
12422 set setservent d_setsent
12423 eval $inlibc
12424
12425 : see if setsid exists
12426 set setsid d_setsid
12427 eval $inlibc
12428
12429 : see if setvbuf exists
12430 set setvbuf d_setvbuf
12431 eval $inlibc
12432
12433 : see if sfio.h is available
12434 set sfio.h i_sfio
12435 eval $inhdr
12436
12437
12438 : see if sfio library is available
12439 case "$i_sfio" in
12440 $define)
12441         val=''
12442         set sfreserve val
12443         eval $inlibc
12444         ;;
12445 *)
12446         val="$undef"
12447         ;;
12448 esac
12449 : Ok, but do we want to use it.
12450 case "$val" in
12451 $define)
12452         case "$usesfio" in
12453         true|$define|[yY]*) dflt='y';;
12454         *) dflt='n';;
12455         esac
12456         echo "$package can use the sfio library, but it is experimental."
12457         case "$useperlio" in
12458         "$undef")
12459             echo "For sfio also the PerlIO abstraction layer is needed."
12460             echo "Earlier you said you wouldn't want that."
12461             ;;
12462         esac
12463         rp="You seem to have sfio available, do you want to try using it?"
12464         . ./myread
12465         case "$ans" in
12466         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
12467                 useperlio="$define"
12468                 val="$define"
12469                 ;;
12470         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
12471                 val="$undef"
12472                 ;;
12473         esac
12474         ;;
12475 *)      case "$usesfio" in
12476         true|$define|[yY]*)
12477                 echo "Sorry, cannot find sfio on this machine." >&4
12478                 echo "Ignoring your setting of usesfio=$usesfio." >&4
12479                 val="$undef"
12480                 ;;
12481         esac
12482         ;;
12483 esac
12484 set d_sfio
12485 eval $setvar
12486 case "$d_sfio" in
12487 $define) usesfio='true';;
12488 *) usesfio='false';;
12489 esac
12490 case "$d_sfio" in
12491 $define) ;;
12492 *)      : Remove sfio from list of libraries to use
12493         case "$libs" in
12494         *-lsfio*)
12495                 echo "Removing unneeded -lsfio from library list" >&4
12496                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
12497                 shift
12498                 libs="$*"
12499                 echo "libs = $libs" >&4
12500                 ;;
12501         esac
12502 ;;
12503 esac
12504
12505
12506 : see if shmctl exists
12507 set shmctl d_shmctl
12508 eval $inlibc
12509
12510 : see if shmget exists
12511 set shmget d_shmget
12512 eval $inlibc
12513
12514 : see if shmat exists
12515 set shmat d_shmat
12516 eval $inlibc
12517 : see what shmat returns
12518 case "$d_shmat" in
12519 "$define")
12520         $cat >shmat.c <<'END'
12521 #include <sys/shm.h>
12522 void *shmat();
12523 END
12524         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
12525                 shmattype='void *'
12526         else
12527                 shmattype='char *'
12528         fi
12529         echo "and it returns ($shmattype)." >&4
12530         : see if a prototype for shmat is available
12531         xxx=`./findhdr sys/shm.h`
12532         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
12533         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
12534                 val="$define"
12535         else
12536                 val="$undef"
12537         fi
12538         $rm -f shmat.[co]
12539         ;;
12540 *)
12541         val="$undef"
12542         ;;
12543 esac
12544 set d_shmatprototype
12545 eval $setvar
12546
12547 : see if shmdt exists
12548 set shmdt d_shmdt
12549 eval $inlibc
12550
12551 : see how much of the 'shm*(2)' library is present.
12552 h_shm=true
12553 echo " "
12554 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
12555 *"$undef"*) h_shm=false;;
12556 esac
12557 case "$osname" in
12558 freebsd)
12559     case "`ipcs 2>&1`" in
12560     "SVID shared memory"*"not configured"*)
12561         echo "Your $osname does not have the shm*(2) configured." >&4
12562         h_shm=false
12563         val="$undef"
12564         set shmctl d_shmctl
12565         evat $setvar
12566         set shmget d_shmget
12567         evat $setvar
12568         set shmat d_shmat
12569         evat $setvar
12570         set shmdt d_shmdt
12571         evat $setvar
12572         ;;
12573     esac
12574     ;;
12575 esac
12576 : we could also check for sys/ipc.h ...
12577 if $h_shm && $test `./findhdr sys/shm.h`; then
12578         echo "You have the full shm*(2) library." >&4
12579         val="$define"
12580 else
12581         echo "You don't have the full shm*(2) library." >&4
12582         val="$undef"
12583 fi
12584 set d_shm
12585 eval $setvar
12586
12587 echo " "
12588 : see if we have sigaction
12589 if set sigaction val -f d_sigaction; eval $csym; $val; then
12590         echo 'sigaction() found.' >&4
12591         $cat > try.c <<'EOP'
12592 #include <stdio.h>
12593 #include <sys/types.h>
12594 #include <signal.h>
12595 int main()
12596 {
12597     struct sigaction act, oact;
12598     act.sa_flags = 0;
12599     oact.sa_handler = 0;
12600     /* so that act and oact are used */
12601     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
12602 }
12603 EOP
12604         set try
12605         if eval $compile_ok; then
12606                 val="$define"
12607         else
12608                 echo "But you don't seem to have a useable struct sigaction." >&4
12609                 val="$undef"
12610         fi
12611 else
12612         echo 'sigaction NOT found.' >&4
12613         val="$undef"
12614 fi
12615 set d_sigaction; eval $setvar
12616 $rm -f try try$_o try.c
12617
12618 : see if sigprocmask exists
12619 set sigprocmask d_sigprocmask
12620 eval $inlibc
12621
12622 : see if sigsetjmp exists
12623 echo " "
12624 case "$d_sigsetjmp" in
12625 '')
12626         $cat >try.c <<'EOP'
12627 #include <setjmp.h>
12628 sigjmp_buf env;
12629 int set = 1;
12630 int main()
12631 {
12632         if (sigsetjmp(env,1))
12633                 exit(set);
12634         set = 0;
12635         siglongjmp(env, 1);
12636         exit(1);
12637 }
12638 EOP
12639         set try
12640         if eval $compile; then
12641                 if $run ./try >/dev/null 2>&1; then
12642                         echo "POSIX sigsetjmp found." >&4
12643                         val="$define"
12644                 else
12645                         $cat >&4 <<EOM
12646 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
12647 I'll ignore them.
12648 EOM
12649                         val="$undef"
12650                 fi
12651         else
12652                 echo "sigsetjmp not found." >&4
12653                 val="$undef"
12654         fi
12655         ;;
12656 *) val="$d_sigsetjmp"
12657         case "$d_sigsetjmp" in
12658         $define) echo "POSIX sigsetjmp found." >&4;;
12659         $undef) echo "sigsetjmp not found." >&4;;
12660         esac
12661         ;;
12662 esac
12663 set d_sigsetjmp
12664 eval $setvar
12665 $rm -f try.c try
12666
12667 : see if sockatmark exists
12668 set sockatmark d_sockatmark
12669 eval $inlibc
12670
12671 : see if prototype for sockatmark is available
12672 echo " "
12673 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12674 eval $hasproto
12675
12676 : see if socks5_init exists
12677 set socks5_init d_socks5_init
12678 eval $inlibc
12679
12680 : see if prototype for setresgid is available
12681 echo " "
12682 set d_sresgproto setresgid $i_unistd unistd.h
12683 eval $hasproto
12684
12685 : see if prototype for setresuid is available
12686 echo " "
12687 set d_sresuproto setresuid $i_unistd unistd.h
12688 eval $hasproto
12689
12690 : see if sys/stat.h is available
12691 set sys/stat.h i_sysstat
12692 eval $inhdr
12693
12694
12695 : see if stat knows about block sizes
12696 echo " "
12697 echo "Checking to see if your struct stat has st_blocks field..." >&4
12698 set d_statblks stat st_blocks $i_sysstat sys/stat.h
12699 eval $hasfield
12700
12701
12702 : see if this is a sys/vfs.h system
12703 set sys/vfs.h i_sysvfs
12704 eval $inhdr
12705
12706
12707 : see if this is a sys/statfs.h system
12708 set sys/statfs.h i_sysstatfs
12709 eval $inhdr
12710
12711
12712 echo " "
12713 echo "Checking to see if your system supports struct statfs..." >&4
12714 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
12715 eval $hasstruct
12716 case "$d_statfs_s" in
12717 "$define")      echo "Yes, it does."   ;;
12718 *)              echo "No, it doesn't." ;;
12719 esac
12720
12721
12722
12723 : see if struct statfs knows about f_flags
12724 case "$d_statfs_s" in
12725 define) 
12726         echo " "
12727         echo "Checking to see if your struct statfs has f_flags field..." >&4
12728         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
12729         eval $hasfield
12730         ;;
12731 *)      val="$undef"
12732         set d_statfs_f_flags
12733         eval $setvar
12734         ;;
12735 esac
12736 case "$d_statfs_f_flags" in
12737 "$define")      echo "Yes, it does."   ;;
12738 *)              echo "No, it doesn't." ;;
12739 esac
12740
12741 : see if _ptr and _cnt from stdio act std
12742 echo " "
12743
12744 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12745         echo "(Looks like you have stdio.h from BSD.)"
12746         case "$stdio_ptr" in
12747         '') stdio_ptr='((fp)->_p)'
12748                 ptr_lval=$define
12749                 ;;
12750         *)      ptr_lval=$d_stdio_ptr_lval;;
12751         esac
12752         case "$stdio_cnt" in
12753         '') stdio_cnt='((fp)->_r)'
12754                 cnt_lval=$define
12755                 ;;
12756         *)      cnt_lval=$d_stdio_cnt_lval;;
12757         esac
12758         case "$stdio_base" in
12759         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12760         esac
12761         case "$stdio_bufsiz" in
12762         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12763         esac
12764 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12765         echo "(Looks like you have stdio.h from Linux.)"
12766         case "$stdio_ptr" in
12767         '') stdio_ptr='((fp)->_IO_read_ptr)'
12768                 ptr_lval=$define
12769                 ;;
12770         *)      ptr_lval=$d_stdio_ptr_lval;;
12771         esac
12772         case "$stdio_cnt" in
12773         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12774                 cnt_lval=$undef
12775                 ;;
12776         *)      cnt_lval=$d_stdio_cnt_lval;;
12777         esac
12778         case "$stdio_base" in
12779         '') stdio_base='((fp)->_IO_read_base)';;
12780         esac
12781         case "$stdio_bufsiz" in
12782         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12783         esac
12784 else
12785         case "$stdio_ptr" in
12786         '') stdio_ptr='((fp)->_ptr)'
12787                 ptr_lval=$define
12788                 ;;
12789         *)      ptr_lval=$d_stdio_ptr_lval;;
12790         esac
12791         case "$stdio_cnt" in
12792         '') stdio_cnt='((fp)->_cnt)'
12793                 cnt_lval=$define
12794                 ;;
12795         *)      cnt_lval=$d_stdio_cnt_lval;;
12796         esac
12797         case "$stdio_base" in
12798         '') stdio_base='((fp)->_base)';;
12799         esac
12800         case "$stdio_bufsiz" in
12801         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12802         esac
12803 fi
12804
12805 : test whether _ptr and _cnt really work
12806 echo "Checking how std your stdio is..." >&4
12807 $cat >try.c <<EOP
12808 #include <stdio.h>
12809 #define FILE_ptr(fp)    $stdio_ptr
12810 #define FILE_cnt(fp)    $stdio_cnt
12811 int main() {
12812         FILE *fp = fopen("try.c", "r");
12813         char c = getc(fp);
12814         if (
12815                 18 <= FILE_cnt(fp) &&
12816                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12817         )
12818                 exit(0);
12819         exit(1);
12820 }
12821 EOP
12822 val="$undef"
12823 set try
12824 if eval $compile && $to try.c; then
12825         if $run ./try; then
12826                 echo "Your stdio acts pretty std."
12827                 val="$define"
12828         else
12829                 echo "Your stdio isn't very std."
12830         fi
12831 else
12832         echo "Your stdio doesn't appear very std."
12833 fi
12834 $rm -f try.c try
12835 set d_stdstdio
12836 eval $setvar
12837
12838 : Can _ptr be used as an lvalue?
12839 case "$d_stdstdio$ptr_lval" in
12840 $define$define) val=$define ;;
12841 *) val=$undef ;;
12842 esac
12843 set d_stdio_ptr_lval
12844 eval $setvar
12845
12846 : Can _cnt be used as an lvalue?
12847 case "$d_stdstdio$cnt_lval" in
12848 $define$define) val=$define ;;
12849 *) val=$undef ;;
12850 esac
12851 set d_stdio_cnt_lval
12852 eval $setvar
12853
12854
12855 : test whether setting _ptr sets _cnt as a side effect
12856 d_stdio_ptr_lval_sets_cnt="$undef"
12857 d_stdio_ptr_lval_nochange_cnt="$undef"
12858 case "$d_stdio_ptr_lval$d_stdstdio" in
12859 $define$define)
12860         echo "Checking to see what happens if we set the stdio ptr..." >&4
12861 $cat >try.c <<EOP
12862 #include <stdio.h>
12863 /* Can we scream? */
12864 /* Eat dust sed :-) */
12865 /* In the buffer space, no one can hear you scream. */
12866 #define FILE_ptr(fp)    $stdio_ptr
12867 #define FILE_cnt(fp)    $stdio_cnt
12868 #include <sys/types.h>
12869 int main() {
12870         FILE *fp = fopen("try.c", "r");
12871         int c;
12872         char *ptr;
12873         size_t cnt;
12874         if (!fp) {
12875             puts("Fail even to read");
12876             exit(1);
12877         }
12878         c = getc(fp); /* Read away the first # */
12879         if (c == EOF) {
12880             puts("Fail even to read");
12881             exit(1);
12882         }
12883         if (!(
12884                 18 <= FILE_cnt(fp) &&
12885                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12886         )) {
12887                 puts("Fail even to read");
12888                 exit (1);
12889         }
12890         ptr = (char*) FILE_ptr(fp);
12891         cnt = (size_t)FILE_cnt(fp);
12892
12893         FILE_ptr(fp) += 42;
12894
12895         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12896                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12897                 exit (1);
12898         }
12899         if (FILE_cnt(fp) <= 20) {
12900                 printf ("Fail (<20 chars to test)");
12901                 exit (1);
12902         }
12903         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12904                 puts("Fail compare");
12905                 exit (1);
12906         }
12907         if (cnt == FILE_cnt(fp)) {
12908                 puts("Pass_unchanged");
12909                 exit (0);
12910         }       
12911         if (FILE_cnt(fp) == (cnt - 42)) {
12912                 puts("Pass_changed");
12913                 exit (0);
12914         }
12915         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12916         return 1;
12917
12918 }
12919 EOP
12920         set try
12921         if eval $compile && $to try.c; then
12922                 case `$run ./try` in
12923                 Pass_changed)
12924                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12925                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12926                 Pass_unchanged)
12927                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12928                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12929                 Fail*)
12930                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12931                 *)
12932                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12933         esac
12934         else
12935                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12936         fi
12937         $rm -f try.c try
12938         ;;
12939 esac
12940
12941 : see if _base is also standard
12942 val="$undef"
12943 case "$d_stdstdio" in
12944 $define)
12945         $cat >try.c <<EOP
12946 #include <stdio.h>
12947 #define FILE_base(fp)   $stdio_base
12948 #define FILE_bufsiz(fp) $stdio_bufsiz
12949 int main() {
12950         FILE *fp = fopen("try.c", "r");
12951         char c = getc(fp);
12952         if (
12953                 19 <= FILE_bufsiz(fp) &&
12954                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12955         )
12956                 exit(0);
12957         exit(1);
12958 }
12959 EOP
12960         set try
12961         if eval $compile && $to try.c; then
12962                 if $run ./try; then
12963                         echo "And its _base field acts std."
12964                         val="$define"
12965                 else
12966                         echo "But its _base field isn't std."
12967                 fi
12968         else
12969                 echo "However, it seems to be lacking the _base field."
12970         fi
12971         $rm -f try.c try
12972         ;;
12973 esac
12974 set d_stdiobase
12975 eval $setvar
12976
12977 $cat >&4 <<EOM
12978 Checking how to access stdio streams by file descriptor number...
12979 EOM
12980 case "$stdio_stream_array" in
12981 '')     $cat >try.c <<EOCP
12982 #include <stdio.h>
12983 int main() {
12984   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12985     printf("yes\n");
12986 }
12987 EOCP
12988         for s in _iob __iob __sF
12989         do
12990                 set try -DSTDIO_STREAM_ARRAY=$s
12991                 if eval $compile; then
12992                         case "`$run ./try`" in
12993                         yes)    stdio_stream_array=$s; break ;;
12994                         esac
12995                 fi
12996         done
12997         $rm -f try.* try$exe_ext
12998 esac
12999 case "$stdio_stream_array" in
13000 '')     $cat >&4 <<EOM
13001 I can't figure out how to access stdio streams by file descriptor number.
13002 EOM
13003         d_stdio_stream_array="$undef"
13004         ;;
13005 *)      $cat >&4 <<EOM
13006 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
13007 EOM
13008         d_stdio_stream_array="$define"
13009         ;;
13010 esac
13011
13012 : see if strcoll exists
13013 set strcoll d_strcoll
13014 eval $inlibc
13015
13016 : check for structure copying
13017 echo " "
13018 echo "Checking to see if your C compiler can copy structs..." >&4
13019 $cat >try.c <<'EOCP'
13020 int main()
13021 {
13022         struct blurfl {
13023                 int dyick;
13024         } foo, bar;
13025
13026         foo = bar;
13027 }
13028 EOCP
13029 if $cc -c try.c >/dev/null 2>&1 ; then
13030         val="$define"
13031         echo "Yup, it can."
13032 else
13033         val="$undef"
13034         echo "Nope, it can't."
13035 fi
13036 set d_strctcpy
13037 eval $setvar
13038 $rm -f try.*
13039
13040 : see if strerror and/or sys_errlist[] exist
13041 echo " "
13042 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
13043     if set strerror val -f d_strerror; eval $csym; $val; then
13044                 echo 'strerror() found.' >&4
13045                 d_strerror="$define"
13046                 d_strerrm='strerror(e)'
13047                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
13048                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
13049                         d_syserrlst="$define"
13050                 else
13051                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
13052                         d_syserrlst="$undef"
13053                 fi
13054     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
13055                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
13056                 echo 'strerror() found in string header.' >&4
13057                 d_strerror="$define"
13058                 d_strerrm='strerror(e)'
13059                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
13060                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
13061                                 d_syserrlst="$define"
13062                 else
13063                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
13064                         d_syserrlst="$undef"
13065                 fi
13066     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
13067                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
13068                 d_strerror="$undef"
13069                 d_syserrlst="$define"
13070                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
13071     else
13072                 echo 'strerror() and sys_errlist[] NOT found.' >&4
13073                 d_strerror="$undef"
13074                 d_syserrlst="$undef"
13075                 d_strerrm='"unknown"'
13076     fi
13077 fi
13078
13079 : see if strftime exists
13080 set strftime d_strftime
13081 eval $inlibc
13082
13083 : see if strtod exists
13084 set strtod d_strtod
13085 eval $inlibc
13086
13087 : see if strtol exists
13088 set strtol d_strtol
13089 eval $inlibc
13090
13091 : see if strtold exists
13092 set strtold d_strtold
13093 eval $inlibc
13094
13095 : see if strtoll exists
13096 set strtoll d_strtoll
13097 eval $inlibc
13098
13099 case "$d_longlong-$d_strtoll" in
13100 "$define-$define")
13101         $cat <<EOM
13102 Checking whether your strtoll() works okay...
13103 EOM
13104         $cat >try.c <<'EOCP'
13105 #include <errno.h>
13106 #ifdef __hpux
13107 #define strtoll __strtoll
13108 #endif
13109 #ifdef __EMX__
13110 #define strtoll _strtoll
13111 #endif
13112 #include <stdio.h>
13113 extern long long int strtoll(char *s, char **, int); 
13114 static int bad = 0;
13115 int check(char *s, long long ell, int een) {
13116         long long gll;
13117         errno = 0;
13118         gll = strtoll(s, 0, 10);
13119         if (!((gll == ell) && (errno == een)))
13120                 bad++;
13121 }
13122 int main() {
13123         check(" 1",                                      1LL, 0);
13124         check(" 0",                                      0LL, 0);
13125         check("-1",                                     -1LL, 0);
13126         check("-9223372036854775808", -9223372036854775808LL, 0);
13127         check("-9223372036854775808", -9223372036854775808LL, 0);
13128         check(" 9223372036854775807",  9223372036854775807LL, 0);
13129         check("-9223372036854775808", -9223372036854775808LL, 0);
13130         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
13131         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
13132         if (!bad)
13133                 printf("ok\n");
13134 }
13135 EOCP
13136         set try
13137         if eval $compile; then
13138                 yyy=`$run ./try`
13139                 case "$yyy" in
13140                 ok) echo "Your strtoll() seems to be working okay." ;;
13141                 *) cat <<EOM >&4
13142 Your strtoll() doesn't seem to be working okay.
13143 EOM
13144                    d_strtoll="$undef"
13145                    ;;
13146                 esac
13147         else
13148                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13149                 d_strtoll="$undef"
13150         fi
13151         ;;
13152 esac
13153
13154 : see if strtoq exists
13155 set strtoq d_strtoq
13156 eval $inlibc
13157
13158 : see if strtoul exists
13159 set strtoul d_strtoul
13160 eval $inlibc
13161
13162 case "$d_strtoul" in
13163 "$define")
13164         $cat <<EOM
13165 Checking whether your strtoul() works okay...
13166 EOM
13167         $cat >try.c <<'EOCP'
13168 #include <errno.h>
13169 #include <stdio.h>
13170 extern unsigned long int strtoul(char *s, char **, int); 
13171 static int bad = 0;
13172 void check(char *s, unsigned long eul, int een) {
13173         unsigned long gul;
13174         errno = 0;
13175         gul = strtoul(s, 0, 10);
13176         if (!((gul == eul) && (errno == een)))
13177                 bad++;
13178 }
13179 int main() {
13180         check(" 1", 1L, 0);
13181         check(" 0", 0L, 0);
13182 EOCP
13183         case "$longsize" in
13184         8)
13185             $cat >>try.c <<'EOCP'
13186         check("18446744073709551615", 18446744073709551615UL, 0);
13187         check("18446744073709551616", 18446744073709551615UL, ERANGE);
13188 #if 0 /* strtoul() for /^-/ strings is undefined. */
13189         check("-1", 18446744073709551615UL, 0);
13190         check("-18446744073709551614", 2, 0);
13191         check("-18446744073709551615", 1, 0);
13192         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
13193         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
13194 #endif
13195 EOCP
13196                 ;;
13197         4)
13198                     $cat >>try.c <<'EOCP'
13199         check("4294967295", 4294967295UL, 0);
13200         check("4294967296", 4294967295UL, ERANGE);
13201 #if 0 /* strtoul() for /^-/ strings is undefined. */
13202         check("-1", 4294967295UL, 0);
13203         check("-4294967294", 2, 0);
13204         check("-4294967295", 1, 0);
13205         check("-4294967296", 4294967295UL, ERANGE);
13206         check("-4294967297", 4294967295UL, ERANGE);
13207 #endif
13208 EOCP
13209                 ;;
13210         *)
13211 : Should we write these tests to be more portable by sprintf-ing
13212 : ~0 and then manipulating that char string as input for strtol?
13213                 ;;
13214         esac
13215         $cat >>try.c <<'EOCP'
13216         if (!bad)
13217                 printf("ok\n");
13218         return 0;
13219 }
13220 EOCP
13221         set try
13222         if eval $compile; then
13223                 case "`$run ./try`" in
13224                 ok) echo "Your strtoul() seems to be working okay." ;;
13225                 *) cat <<EOM >&4
13226 Your strtoul() doesn't seem to be working okay.
13227 EOM
13228                    d_strtoul="$undef"
13229                    ;;
13230                 esac
13231         fi
13232         ;;
13233 esac
13234
13235 : see if strtoull exists
13236 set strtoull d_strtoull
13237 eval $inlibc
13238
13239 case "$d_longlong-$d_strtoull" in
13240 "$define-$define")
13241         $cat <<EOM
13242 Checking whether your strtoull() works okay...
13243 EOM
13244         $cat >try.c <<'EOCP'
13245 #include <errno.h>
13246 #ifdef __hpux
13247 #define strtoull __strtoull
13248 #endif
13249 #include <stdio.h>
13250 extern unsigned long long int strtoull(char *s, char **, int); 
13251 static int bad = 0;
13252 int check(char *s, long long eull, int een) {
13253         long long gull;
13254         errno = 0;
13255         gull = strtoull(s, 0, 10);
13256         if (!((gull == eull) && (errno == een)))
13257                 bad++;
13258 }
13259 int main() {
13260         check(" 1",                                        1LL, 0);
13261         check(" 0",                                        0LL, 0);
13262         check("18446744073709551615",  18446744073709551615ULL, 0);
13263         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
13264 #if 0 /* strtoull() for /^-/ strings is undefined. */
13265         check("-1",                    18446744073709551615ULL, 0);
13266         check("-18446744073709551614",                     2LL, 0);
13267         check("-18446744073709551615",                     1LL, 0);
13268         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
13269         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
13270 #endif
13271         if (!bad)
13272                 printf("ok\n");
13273 }
13274 EOCP
13275         set try
13276         if eval $compile; then
13277                 case "`$run ./try`" in
13278                 ok) echo "Your strtoull() seems to be working okay." ;;
13279                 *) cat <<EOM >&4
13280 Your strtoull() doesn't seem to be working okay.
13281 EOM
13282                    d_strtoull="$undef"
13283                    ;;
13284                 esac
13285         fi
13286         ;;
13287 esac
13288
13289 : see if strtouq exists
13290 set strtouq d_strtouq
13291 eval $inlibc
13292
13293 case "$d_strtouq" in
13294 "$define")
13295         $cat <<EOM
13296 Checking whether your strtouq() works okay...
13297 EOM
13298         $cat >try.c <<'EOCP'
13299 #include <errno.h>
13300 #include <stdio.h>
13301 extern unsigned long long int strtouq(char *s, char **, int); 
13302 static int bad = 0;
13303 void check(char *s, unsigned long long eull, int een) {
13304         unsigned long long gull;
13305         errno = 0;
13306         gull = strtouq(s, 0, 10);
13307         if (!((gull == eull) && (errno == een)))
13308                 bad++;
13309 }
13310 int main() {
13311         check(" 1",                                        1LL, 0);
13312         check(" 0",                                        0LL, 0);
13313         check("18446744073709551615",  18446744073709551615ULL, 0);
13314         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
13315 #if 0 /* strtouq() for /^-/ strings is undefined. */
13316         check("-1",                    18446744073709551615ULL, 0);
13317         check("-18446744073709551614",                     2LL, 0);
13318         check("-18446744073709551615",                     1LL, 0);
13319         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
13320         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
13321 #endif
13322         if (!bad)
13323                 printf("ok\n");
13324         return 0;
13325 }
13326 EOCP
13327         set try
13328         if eval $compile; then
13329                 case "`$run ./try`" in
13330                 ok) echo "Your strtouq() seems to be working okay." ;;
13331                 *) cat <<EOM >&4
13332 Your strtouq() doesn't seem to be working okay.
13333 EOM
13334                    d_strtouq="$undef"
13335                    ;;
13336                 esac
13337         fi
13338         ;;
13339 esac
13340
13341 : see if strxfrm exists
13342 set strxfrm d_strxfrm
13343 eval $inlibc
13344
13345 : see if symlink exists
13346 set symlink d_symlink
13347 eval $inlibc
13348
13349 : see if syscall exists
13350 set syscall d_syscall
13351 eval $inlibc
13352
13353 : see if prototype for syscall is available
13354 echo " "
13355 set d_syscallproto syscall $i_unistd unistd.h
13356 eval $hasproto
13357
13358 : see if sysconf exists
13359 set sysconf d_sysconf
13360 eval $inlibc
13361
13362 : see if system exists
13363 set system d_system
13364 eval $inlibc
13365
13366 : see if tcgetpgrp exists
13367 set tcgetpgrp d_tcgetpgrp
13368 eval $inlibc
13369
13370 : see if tcsetpgrp exists
13371 set tcsetpgrp d_tcsetpgrp
13372 eval $inlibc
13373
13374 : see if prototype for telldir is available
13375 echo " "
13376 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
13377 eval $hasproto
13378
13379 : see if this is a sys/times.h system
13380 set sys/times.h i_systimes
13381 eval $inhdr
13382
13383 : see if times exists
13384 echo " "
13385 if set times val -f d_times; eval $csym; $val; then
13386         echo 'times() found.' >&4
13387         d_times="$define"
13388         inc=''
13389         case "$i_systimes" in
13390         "$define") inc='sys/times.h';;
13391         esac
13392         rp="What is the type returned by times() on this system?"
13393         set clock_t clocktype long stdio.h sys/types.h $inc
13394         eval $typedef_ask
13395 else
13396         echo 'times() NOT found, hope that will do.' >&4
13397         d_times="$undef"
13398         clocktype='int'
13399 fi
13400
13401 : see if truncate exists
13402 set truncate d_truncate
13403 eval $inlibc
13404
13405 : see if tzname[] exists
13406 echo " "
13407 if set tzname val -a d_tzname; eval $csym; $val; then
13408         val="$define"
13409         echo 'tzname[] found.' >&4
13410 else
13411         val="$undef"
13412         echo 'tzname[] NOT found.' >&4
13413 fi
13414 set d_tzname
13415 eval $setvar
13416
13417 case "$osname" in
13418 next|rhapsody|darwin) multiarch="$define" ;;
13419 esac
13420 case "$multiarch" in
13421 ''|[nN]*) multiarch="$undef" ;;
13422 esac
13423
13424 : check for ordering of bytes in a long
13425 echo " "
13426 case "$usecrosscompile$multiarch" in
13427 *$define*)
13428         $cat <<EOM
13429 You seem to be either cross-compiling or doing a multiarchitecture build,
13430 skipping the byteorder check.
13431
13432 EOM
13433         byteorder='ffff'
13434         ;;
13435 *)
13436         case "$byteorder" in
13437         '')
13438                 $cat <<'EOM'
13439 In the following, larger digits indicate more significance.  A big-endian
13440 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
13441 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
13442 machines may have weird orders like 3412.  A Cray will report 87654321,
13443 an Alpha will report 12345678. If the test program works the default is
13444 probably right.
13445 I'm now running the test program...
13446 EOM
13447                 $cat >try.c <<'EOCP'
13448 #include <stdio.h>
13449 int main()
13450 {
13451         int i;
13452         union {
13453                 unsigned long l;
13454                 char c[sizeof(long)];
13455         } u;
13456
13457         if (sizeof(long) > 4)
13458                 u.l = (0x08070605L << 32) | 0x04030201L;
13459         else
13460                 u.l = 0x04030201L;
13461         for (i = 0; i < sizeof(long); i++)
13462                 printf("%c", u.c[i]+'0');
13463         printf("\n");
13464         exit(0);
13465 }
13466 EOCP
13467                 xxx_prompt=y
13468                 set try
13469                 if eval $compile && ./try > /dev/null; then
13470                         dflt=`$run ./try`
13471                         case "$dflt" in
13472                         [1-4][1-4][1-4][1-4]|12345678|87654321)
13473                                 echo "(The test program ran ok.)"
13474                                 echo "byteorder=$dflt"
13475                                 xxx_prompt=n
13476                         ;;
13477                         ????|????????) echo "(The test program ran ok.)" ;;
13478                         *) echo "(The test program didn't run right for some reason.)" ;;
13479                         esac
13480                 else
13481                         dflt='4321'
13482                         cat <<'EOM'
13483 (I can't seem to compile the test program.  Guessing big-endian...)
13484 EOM
13485                 fi
13486                 case "$xxx_prompt" in
13487                 y)
13488                         rp="What is the order of bytes in a long?"
13489                         . ./myread
13490                         byteorder="$ans"
13491                         ;;
13492                 *)      byteorder=$dflt
13493                         ;;
13494                 esac
13495                 ;;
13496         esac
13497         $rm -f try.c try
13498         ;;
13499 esac
13500
13501
13502 $cat <<EOM
13503
13504 Checking to see whether you can access character data unalignedly...
13505 EOM
13506 case "$d_u32align" in
13507 '')   $cat >try.c <<EOCP
13508 #include <stdio.h>
13509 #define U32 $u32type
13510 #define BYTEORDER 0x$byteorder
13511 #define U8 $u8type
13512 #include <signal.h>
13513 #ifdef SIGBUS
13514 $signal_t bletch(s) int s; { exit(4); }
13515 #endif
13516 int main() {
13517 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
13518     U8 buf[8];
13519     U32 *up;
13520     int i;
13521
13522     if (sizeof(U32) != 4) {
13523         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
13524         exit(1);
13525     }
13526
13527     fflush(stdout);
13528
13529 #ifdef SIGBUS
13530     signal(SIGBUS, bletch);
13531 #endif
13532
13533     buf[0] = 0;
13534     buf[1] = 0;
13535     buf[2] = 0;
13536     buf[3] = 1;
13537     buf[5] = 0;
13538     buf[6] = 0;
13539     buf[7] = 0;
13540     buf[8] = 1;
13541
13542     for (i = 0; i < 4; i++) {
13543         up = (U32*)(buf + i);
13544         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
13545                (*up == 1 << (8*(3-i)))  /* little-endian */
13546               )
13547            )
13548         {
13549             printf("read failed (%x)\n", *up);
13550             exit(2);
13551         }
13552     }
13553
13554     /* write test */
13555     for (i = 0; i < 4; i++) {
13556         up = (U32*)(buf + i);
13557         *up = 0xBeef;
13558         if (*up != 0xBeef) {
13559             printf("write failed (%x)\n", *up);
13560             exit(3);
13561         }
13562     }
13563
13564     exit(0);
13565 #else
13566     printf("1\n");
13567     exit(1);
13568 #endif
13569     return 0;
13570 }
13571 EOCP
13572 set try
13573 if eval $compile_ok; then
13574         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
13575         $run ./try 2>&1 >/dev/null
13576         case "$?" in
13577         0)      cat >&4 <<EOM
13578 You can access character data pretty unalignedly.
13579 EOM
13580                 d_u32align="$undef"
13581                 ;;
13582         *)      cat >&4 <<EOM
13583 It seems that you must access character data in an aligned manner.
13584 EOM
13585                 d_u32align="$define"
13586                 ;;
13587         esac
13588 else
13589         rp='Can you access character data at unaligned addresses?'
13590         dflt='n'
13591         . ./myread
13592         case "$ans" in
13593         [yY]*)  d_u32align="$undef"  ;;
13594         *)      d_u32align="$define" ;;
13595         esac
13596 fi
13597 $rm -f core core.try.* try.core
13598 ;;
13599 esac
13600
13601 : see if ualarm exists
13602 set ualarm d_ualarm
13603 eval $inlibc
13604
13605 : see if umask exists
13606 set umask d_umask
13607 eval $inlibc
13608
13609 : see if unordered exists
13610 set unordered d_unordered
13611 eval $inlibc
13612
13613 : see if usleep exists
13614 set usleep d_usleep
13615 eval $inlibc
13616
13617 : see if prototype for usleep is available
13618 echo " "
13619 set d_usleepproto usleep $i_unistd unistd.h
13620 eval $hasproto
13621
13622 : see if ustat exists
13623 set ustat d_ustat
13624 eval $inlibc
13625
13626 : backward compatibility for d_hvfork
13627 if test X$d_hvfork != X; then
13628         d_vfork="$d_hvfork"
13629         d_hvfork=''
13630 fi
13631 : see if there is a vfork
13632 val=''
13633 set vfork val
13634 eval $inlibc
13635
13636 : Ok, but do we want to use it. vfork is reportedly unreliable in 
13637 : perl on Solaris 2.x, and probably elsewhere.
13638 case "$val" in
13639 $define)
13640         echo " "
13641         case "$usevfork" in
13642         false) dflt='n';;
13643         *) dflt='y';;
13644         esac
13645         cat <<'EOM'
13646  
13647 Perl can only use a vfork() that doesn't suffer from strict
13648 restrictions on calling functions or modifying global data in
13649 the child.  For example, glibc-2.1 contains such a vfork()
13650 that is unsuitable.  If your system provides a proper fork()
13651 call, chances are that you do NOT want perl to use vfork().
13652
13653 EOM
13654         rp="Do you still want to use vfork()?"
13655         . ./myread
13656         case "$ans" in
13657         y|Y) ;;
13658         *)
13659                 echo "Ok, we won't use vfork()."
13660                 val="$undef"
13661                 ;;
13662         esac
13663         ;;
13664 esac
13665 set d_vfork
13666 eval $setvar
13667 case "$d_vfork" in
13668 $define) usevfork='true';;
13669 *) usevfork='false';;
13670 esac
13671
13672 : see if closedir exists
13673 set closedir d_closedir
13674 eval $inlibc
13675
13676 case "$d_closedir" in
13677 "$define")
13678         echo " "
13679         echo "Checking whether closedir() returns a status..." >&4
13680         cat > try.c <<EOM
13681 #$i_dirent I_DIRENT             /**/
13682 #$i_sysdir I_SYS_DIR            /**/
13683 #$i_sysndir I_SYS_NDIR          /**/
13684 #$i_systypes I_SYS_TYPES        /**/
13685
13686 #if defined(I_SYS_TYPES)
13687 #include <sys/types.h>
13688 #endif
13689 #if defined(I_DIRENT)
13690 #include <dirent.h>
13691 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13692 #include <sys/dir.h>
13693 #endif
13694 #else
13695 #ifdef I_SYS_NDIR
13696 #include <sys/ndir.h>
13697 #else
13698 #ifdef I_SYS_DIR
13699 #ifdef hp9000s500
13700 #include <ndir.h>       /* may be wrong in the future */
13701 #else
13702 #include <sys/dir.h>
13703 #endif
13704 #endif
13705 #endif
13706 #endif 
13707 int main() { return closedir(opendir(".")); }
13708 EOM
13709         set try
13710         if eval $compile_ok; then
13711                 if $run ./try > /dev/null 2>&1 ; then
13712                         echo "Yes, it does."
13713                         val="$undef"
13714                 else
13715                         echo "No, it doesn't."
13716                         val="$define"
13717                 fi
13718         else
13719                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13720                 val="$define"
13721         fi
13722         ;;
13723 *)
13724         val="$undef";
13725         ;;
13726 esac
13727 set d_void_closedir
13728 eval $setvar
13729 $rm -f try try.*
13730 : see if there is a wait4
13731 set wait4 d_wait4
13732 eval $inlibc
13733
13734 : see if waitpid exists
13735 set waitpid d_waitpid
13736 eval $inlibc
13737
13738 : see if wcstombs exists
13739 set wcstombs d_wcstombs
13740 eval $inlibc
13741
13742 : see if wctomb exists
13743 set wctomb d_wctomb
13744 eval $inlibc
13745
13746 : see if writev exists
13747 set writev d_writev
13748 eval $inlibc
13749
13750 : preserve RCS keywords in files with variable substitution, grrr
13751 Date='$Date'
13752 Id='$Id'
13753 Log='$Log'
13754 RCSfile='$RCSfile'
13755 Revision='$Revision'
13756
13757 : check for alignment requirements
13758 echo " "
13759 case "$usecrosscompile$multiarch" in
13760 *$define*)
13761         $cat <<EOM
13762 You seem to be either cross-compiling or doing a multiarchitecture build,
13763 skipping the memory alignment check.
13764
13765 EOM
13766         case "$alignbytes" in
13767         '') alignbytes=8 ;;
13768         esac
13769         ;;
13770 *)
13771         case "$alignbytes" in
13772         '') echo "Checking alignment constraints..." >&4
13773                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13774                         $cat >try.c <<'EOCP'
13775 typedef long double NV;
13776 EOCP
13777                 else
13778                         $cat >try.c <<'EOCP'
13779 typedef double NV;
13780 EOCP
13781                 fi
13782                 $cat >>try.c <<'EOCP'
13783 #include <stdio.h>
13784 struct foobar {
13785         char foo;
13786         NV bar;
13787 } try_algn;
13788 int main()
13789 {
13790     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13791     return(0);
13792 }
13793 EOCP
13794                 set try
13795                 if eval $compile_ok; then
13796                         dflt=`$run ./try`
13797                 else
13798                         dflt='8'
13799                         echo "(I can't seem to compile the test program...)"
13800                 fi
13801                 ;;
13802         *) dflt="$alignbytes"
13803                 ;;
13804         esac
13805         rp="Doubles must be aligned on a how-many-byte boundary?"
13806         . ./myread
13807         alignbytes="$ans"
13808         $rm -f try.c try
13809         ;;
13810 esac
13811
13812
13813 : set the base revision
13814 baserev=5.0
13815
13816 : how do we catenate cpp tokens here?
13817 echo " "
13818 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13819 $cat >cpp_stuff.c <<'EOCP'
13820 #define RCAT(a,b)a/**/b
13821 #define ACAT(a,b)a ## b
13822 RCAT(Rei,ser)
13823 ACAT(Cir,cus)
13824 EOCP
13825 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13826 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13827         echo "Oh!  Smells like ANSI's been here." >&4
13828         echo "We can catify or stringify, separately or together!"
13829         cpp_stuff=42
13830 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13831         echo "Ah, yes!  The good old days!" >&4
13832         echo "However, in the good old days we don't know how to stringify and"
13833         echo "catify at the same time."
13834         cpp_stuff=1
13835 else
13836         $cat >&4 <<EOM
13837 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13838 to have to edit the values of CAT[2-5] in config.h...
13839 EOM
13840         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13841 fi
13842 $rm -f cpp_stuff.*
13843
13844 : see if this is a db.h system
13845 set db.h i_db
13846 eval $inhdr
13847
13848 case "$i_db" in
13849 $define)
13850         : Check db version.
13851         echo " "
13852         echo "Checking Berkeley DB version ..." >&4
13853         $cat >try.c <<EOCP
13854 #$d_const HASCONST
13855 #ifndef HASCONST
13856 #define const
13857 #endif
13858 #include <sys/types.h>
13859 #include <stdio.h>
13860 #include <db.h>
13861 int main(int argc, char *argv[])
13862 {
13863 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13864     int Major, Minor, Patch ;
13865     unsigned long Version ;
13866     (void)db_version(&Major, &Minor, &Patch) ;
13867     if (argc == 2) {
13868         printf("%d %d %d %d %d %d\n",
13869                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13870                Major, Minor, Patch);
13871         exit(0);
13872     }
13873     printf("You have Berkeley DB Version 2 or greater.\n");
13874
13875     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13876                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13877     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13878                 Major, Minor, Patch) ;
13879
13880     /* check that db.h & libdb are compatible */
13881     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13882         printf("db.h and libdb are incompatible.\n") ;
13883         exit(3);        
13884     }
13885
13886     printf("db.h and libdb are compatible.\n") ;
13887
13888     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13889                 + DB_VERSION_PATCH ;
13890
13891     /* needs to be >= 2.3.4 */
13892     if (Version < 2003004) {
13893     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13894         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13895         exit(2);        
13896     }
13897
13898     exit(0);
13899 #else
13900 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13901     if (argc == 2) {
13902         printf("1 0 0\n");
13903         exit(0);
13904     }
13905     printf("You have Berkeley DB Version 1.\n");
13906     exit(0);    /* DB version < 2: the coast is clear. */
13907 #else
13908     exit(1);    /* <db.h> not Berkeley DB? */
13909 #endif
13910 #endif
13911 }
13912 EOCP
13913         set try
13914         if eval $compile_ok && $run ./try; then
13915                 echo 'Looks OK.' >&4
13916                 set `$run ./try 1`
13917                 db_version_major=$1
13918                 db_version_minor=$2
13919                 db_version_patch=$3
13920         else
13921                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13922                 i_db=$undef
13923                 case " $libs " in
13924                 *"-ldb "*)
13925                         : Remove db from list of libraries to use
13926                         echo "Removing unusable -ldb from library list" >&4
13927                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13928                         shift
13929                         libs="$*"
13930                         echo "libs = $libs" >&4
13931                         ;;
13932                 esac
13933         fi
13934         $rm -f try.*
13935         ;;
13936 esac
13937
13938 case "$i_db" in
13939 define)
13940         : Check the return type needed for hash 
13941         echo " "
13942         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13943         $cat >try.c <<EOCP
13944 #$d_const HASCONST
13945 #ifndef HASCONST
13946 #define const
13947 #endif
13948 #include <sys/types.h>
13949 #include <db.h>
13950
13951 #ifndef DB_VERSION_MAJOR
13952 u_int32_t hash_cb (ptr, size)
13953 const void *ptr;
13954 size_t size;
13955 {
13956 }
13957 HASHINFO info;
13958 int main()
13959 {
13960         info.hash = hash_cb;
13961 }
13962 #endif
13963 EOCP
13964         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13965                 if $contains warning try.out >>/dev/null 2>&1 ; then
13966                         db_hashtype='int'
13967                 else
13968                         db_hashtype='u_int32_t'
13969                 fi
13970         else
13971                 : XXX Maybe we should just give up here.
13972                 db_hashtype=u_int32_t
13973                 $cat try.out >&4
13974                 echo "Help:  I can't seem to compile the db test program." >&4
13975                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13976         fi
13977         $rm -f try.*
13978         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13979         ;;
13980 *)      db_hashtype=u_int32_t
13981         ;;
13982 esac
13983 case "$i_db" in
13984 define)
13985         : Check the return type needed for prefix 
13986         echo " "
13987         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13988         cat >try.c <<EOCP
13989 #$d_const HASCONST
13990 #ifndef HASCONST
13991 #define const
13992 #endif
13993 #include <sys/types.h>
13994 #include <db.h>
13995
13996 #ifndef DB_VERSION_MAJOR
13997 size_t prefix_cb (key1, key2)
13998 const DBT *key1;
13999 const DBT *key2;
14000 {
14001 }
14002 BTREEINFO info;
14003 int main()
14004 {
14005         info.prefix = prefix_cb;
14006 }
14007 #endif
14008 EOCP
14009         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
14010                 if $contains warning try.out >>/dev/null 2>&1 ; then
14011                         db_prefixtype='int'
14012                 else
14013                         db_prefixtype='size_t'
14014                 fi
14015         else
14016                 db_prefixtype='size_t'
14017                 : XXX Maybe we should just give up here.
14018                 $cat try.out >&4
14019                 echo "Help:  I can't seem to compile the db test program." >&4
14020                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
14021         fi
14022         $rm -f try.*
14023         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
14024         ;;
14025 *)      db_prefixtype='size_t'
14026         ;;
14027 esac
14028
14029
14030 : How can we generate normalized random numbers ?
14031 echo " "
14032 echo "Looking for a random number function..." >&4
14033 case "$randfunc" in
14034 '')
14035         if set drand48 val -f; eval $csym; $val; then
14036                 dflt="drand48"
14037                 echo "Good, found drand48()." >&4
14038         elif set random val -f; eval $csym; $val; then
14039                 dflt="random"
14040                 echo "OK, found random()." >&4
14041         else
14042                 dflt="rand"
14043                 echo "Yick, looks like I have to use rand()." >&4
14044         fi
14045         echo " "
14046         ;;
14047 *)
14048         dflt="$randfunc"
14049         ;;
14050 esac
14051 cont=true
14052
14053 case "$ccflags" in
14054 *-Dmy_rand=*|*-Dmy_srand=*)
14055         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
14056         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
14057         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
14058         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
14059         ;;
14060 esac
14061
14062 while $test "$cont"; do
14063         rp="Use which function to generate random numbers?"
14064         . ./myread
14065         if $test "$ans" = "$dflt"; then
14066                 : null
14067         else
14068                 randbits=''
14069         fi
14070         randfunc="$ans"
14071         if set $ans val -f; eval $csym; $val; then
14072                 cont=''
14073         else
14074                 dflt=y
14075                 rp="I cannot find function $ans. Use that name anyway?"
14076                 . ./myread
14077                 dflt=rand
14078                 case "$ans" in
14079                         [yY]*) cont='';;
14080                 esac
14081         fi
14082         case "$cont" in
14083         '')
14084                 case "$randfunc" in
14085                 drand48)
14086                         drand01="drand48()"
14087                         seedfunc="srand48"
14088                         randbits=48
14089                         randseedtype=long
14090                         ;;
14091                 rand|random)
14092                         case "$randbits" in
14093                         '')
14094 echo "Checking to see how many bits your $randfunc() function produces..." >&4
14095                                 $cat >try.c <<EOCP
14096 #$i_unistd I_UNISTD
14097 #$i_stdlib I_STDLIB
14098 #include <stdio.h>
14099 #ifdef I_UNISTD
14100 #  include <unistd.h>
14101 #endif
14102 #ifdef I_STDLIB
14103 #  include <stdlib.h>
14104 #endif
14105 int main()
14106 {
14107         register int i;
14108         register unsigned long tmp;
14109         register unsigned long max = 0L;
14110
14111         for (i = 1000; i; i--) {
14112                 tmp = (unsigned long) $randfunc();
14113                 if (tmp > max) max = tmp;
14114         }
14115         for (i = 0; max; i++)
14116                 max /= 2;
14117         printf("%d\n",i);
14118 }
14119 EOCP
14120                                 set try
14121                                 if eval $compile_ok; then
14122                                         dflt=`try`
14123                                 else
14124                                         dflt='?'
14125                                         echo "(I can't seem to compile the test program...)"
14126                                 fi
14127                                 ;;
14128                         *)
14129                                 dflt="$randbits"
14130                                 ;;
14131                         esac
14132                         rp="How many bits does your $randfunc() function produce?"
14133                         . ./myread
14134                         randbits="$ans"
14135                         $rm -f try.c try
14136                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
14137                         seedfunc="s$randfunc"
14138                         randseedtype=unsigned
14139                         ;;
14140                 *)
14141                         dflt="31"
14142                         rp="How many bits does your $randfunc() function produce?"
14143                         . ./myread
14144                         randbits="$ans"
14145                         seedfunc="s$randfunc"
14146                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
14147                         if set $seedfunc val -f; eval $csym; $val; then
14148                                 echo "(Using $seedfunc() to seed random generator)"
14149                         else
14150                                 echo "(Warning: no $seedfunc() to seed random generator)"
14151                                 seedfunc=rand
14152                         fi
14153                         randseedtype=unsigned
14154                         ;;
14155                 esac
14156                 ;;
14157         esac
14158 done
14159
14160 echo " "
14161 echo "Determining whether or not we are on an EBCDIC system..." >&4
14162 $cat >try.c <<'EOM'
14163 int main()
14164 {
14165   if ('M'==0xd4) return 0;
14166   return 1;
14167 }
14168 EOM
14169
14170 val=$undef
14171 set try
14172 if eval $compile_ok; then
14173         if $run ./try; then
14174                 echo "You seem to speak EBCDIC." >&4
14175                 val="$define"
14176         else
14177                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
14178         fi
14179 else
14180         echo "I'm unable to compile the test program." >&4
14181         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
14182 fi
14183 $rm -f try try.*
14184 set ebcdic
14185 eval $setvar
14186
14187 echo " "
14188 $cat >&4 <<EOM
14189 Checking how to flush all pending stdio output...
14190 EOM
14191 # I only know how to find the first 32 possibly open files on SunOS.
14192 # See also hints/sunos_4_1.sh and util.c  --AD
14193 case "$osname" in
14194 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
14195 esac
14196 $cat >>try.c <<EOCP
14197 #include <stdio.h>
14198 #$i_unistd I_UNISTD
14199 #ifdef I_UNISTD
14200 # include <unistd.h>
14201 #endif
14202 #$d_sysconf HAS_SYSCONF
14203 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
14204 #ifdef HAS_STDIO_STREAM_ARRAY
14205 # define STDIO_STREAM_ARRAY $stdio_stream_array
14206 #endif
14207 int main() {
14208   FILE* p;
14209   unlink("try.out");
14210   p = fopen("try.out", "w");
14211 #ifdef TRY_FPUTC
14212   fputc('x', p);
14213 #else
14214 # ifdef TRY_FPRINTF
14215   fprintf(p, "x");
14216 # endif
14217 #endif
14218 #ifdef TRY_FFLUSH_NULL
14219   fflush(NULL);
14220 #endif
14221 #ifdef TRY_FFLUSH_ALL
14222   {
14223     long open_max = -1;
14224 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
14225     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
14226 # else
14227 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
14228     open_max = sysconf(_SC_OPEN_MAX);
14229 #  else
14230 #   ifdef FOPEN_MAX
14231     open_max = FOPEN_MAX;
14232 #   else
14233 #    ifdef OPEN_MAX
14234     open_max = OPEN_MAX;
14235 #    else
14236 #     ifdef _NFILE
14237     open_max = _NFILE;
14238 #     endif
14239 #    endif
14240 #   endif
14241 #  endif
14242 # endif 
14243 # ifdef HAS_STDIO_STREAM_ARRAY
14244     if (open_max > 0) {
14245       long i;
14246       for (i = 0; i < open_max; i++)
14247             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
14248                 STDIO_STREAM_ARRAY[i]._file < open_max &&
14249                 STDIO_STREAM_ARRAY[i]._flag)
14250                 fflush(&STDIO_STREAM_ARRAY[i]);
14251     }   
14252   }
14253 # endif
14254 #endif
14255   _exit(42);
14256 }
14257 EOCP
14258 : first we have to find out how _not_ to flush
14259 $to try.c
14260 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
14261     output=''
14262     set try -DTRY_FPUTC
14263     if eval $compile; then
14264             $run ./try 2>/dev/null
14265             code="$?"
14266             $from try.out
14267             if $test ! -s try.out -a "X$code" = X42; then
14268                 output=-DTRY_FPUTC
14269             fi
14270     fi
14271     case "$output" in
14272     '')
14273             set try -DTRY_FPRINTF
14274             if eval $compile; then
14275                     $run ./try 2>/dev/null
14276                     code="$?"
14277                     $from try.out
14278                     if $test ! -s try.out -a "X$code" = X42; then
14279                         output=-DTRY_FPRINTF
14280                     fi
14281             fi
14282         ;;
14283     esac
14284 fi
14285 : check for fflush NULL behaviour
14286 case "$fflushNULL" in
14287 '')     set try -DTRY_FFLUSH_NULL $output
14288         if eval $compile; then
14289                 $run ./try 2>/dev/null
14290                 code="$?"
14291                 $from try.out
14292                 if $test -s try.out -a "X$code" = X42; then
14293                         fflushNULL="`$cat try.out`"
14294                 else
14295                         if $test "X$code" != X42; then
14296                                 $cat >&4 <<EOM
14297 (If this test failed, don't worry, we'll try another method shortly.)
14298 EOM
14299                         fi
14300                 fi
14301         fi
14302         $rm -f core try.core core.try.*
14303         case "$fflushNULL" in
14304         x)      $cat >&4 <<EOM
14305 Your fflush(NULL) works okay for output streams.
14306 Let's see if it clobbers input pipes...
14307 EOM
14308 # As of mid-March 2000 all versions of Solaris appear to have a stdio
14309 # bug that improperly flushes the input end of pipes.  So we avoid the
14310 # autoflush on fork/system/exec support for now. :-(
14311 $cat >tryp.c <<EOCP
14312 #include <stdio.h>
14313 int
14314 main(int argc, char **argv)
14315 {
14316     char buf[1024];
14317     int i;
14318     char *bp = buf;
14319     while (1) {
14320         while ((i = getc(stdin)) != -1
14321                && (*bp++ = i) != '\n'
14322                && bp < &buf[1024])
14323         /* DO NOTHING */ ;
14324         *bp = '\0';
14325         fprintf(stdout, "%s", buf);
14326         fflush(NULL);
14327         if (i == -1)
14328             return 0;
14329         bp = buf;
14330     }
14331 }
14332 EOCP
14333                 fflushNULL="$define"
14334                 set tryp
14335                 if eval $compile; then
14336                     $rm -f tryp.out
14337                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
14338                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
14339                        $cat >&4 <<EOM
14340 fflush(NULL) seems to behave okay with input streams.
14341 EOM
14342                         fflushNULL="$define"
14343                     else
14344                         $cat >&4 <<EOM
14345 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
14346 EOM
14347                         fflushNULL="$undef"
14348                     fi
14349                 fi
14350                 $rm -f core tryp.c tryp.core core.tryp.*
14351                 ;;
14352         '')     $cat >&4 <<EOM
14353 Your fflush(NULL) isn't working (contrary to ANSI C).
14354 EOM
14355                 fflushNULL="$undef"
14356                 ;;
14357         *)      $cat >&4 <<EOM
14358 Cannot figure out whether your fflush(NULL) works or not.
14359 I'm assuming it doesn't (contrary to ANSI C).
14360 EOM
14361                 fflushNULL="$undef"
14362                 ;;
14363         esac
14364         ;;
14365 $define|true|[yY]*)
14366         fflushNULL="$define"
14367         ;;
14368 *)
14369         fflushNULL="$undef"
14370         ;;
14371 esac
14372 : check explicit looping only if NULL did not work, and if the pipe
14373 : bug does not show up on an explicit flush too
14374 case "$fflushNULL" in
14375 "$undef")
14376         $cat >tryp.c <<EOCP
14377 #include <stdio.h>
14378 int
14379 main(int argc, char **argv)
14380 {
14381     char buf[1024];
14382     int i;
14383     char *bp = buf;
14384     while (1) {
14385         while ((i = getc(stdin)) != -1
14386                && (*bp++ = i) != '\n'
14387                && bp < &buf[1024])
14388         /* DO NOTHING */ ;
14389         *bp = '\0';
14390         fprintf(stdout, "%s", buf);
14391         fflush(stdin);
14392         if (i == -1)
14393             return 0;
14394         bp = buf;
14395     }
14396 }
14397 EOCP
14398         set tryp
14399         if eval $compile; then
14400             $rm -f tryp.out
14401             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
14402             if cmp tryp.c tryp.out >/dev/null 2>&1; then
14403                $cat >&4 <<EOM
14404 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
14405 EOM
14406                 : now check for fflushall behaviour
14407                 case "$fflushall" in
14408                 '')     set try -DTRY_FFLUSH_ALL $output
14409                         if eval $compile; then
14410                                 $cat >&4 <<EOM
14411 (Now testing the other method--but note that this also may fail.)
14412 EOM
14413                                 $run ./try 2>/dev/null
14414                                 code=$?
14415                                 $from try.out
14416                                 if $test -s try.out -a "X$code" = X42; then
14417                                         fflushall="`$cat try.out`"
14418                                 fi
14419                         fi
14420                         $rm -f core try.core core.try.*
14421                         case "$fflushall" in
14422                         x)      $cat >&4 <<EOM
14423 Whew. Flushing explicitly all the stdio streams works.
14424 EOM
14425                                 fflushall="$define"
14426                                 ;;
14427                         '')     $cat >&4 <<EOM
14428 Sigh. Flushing explicitly all the stdio streams doesn't work.
14429 EOM
14430                                 fflushall="$undef"
14431                                 ;;
14432                         *)      $cat >&4 <<EOM
14433 Cannot figure out whether flushing stdio streams explicitly works or not.
14434 I'm assuming it doesn't.
14435 EOM
14436                                 fflushall="$undef"
14437                                 ;;
14438                         esac
14439                         ;;
14440                 "$define"|true|[yY]*)
14441                         fflushall="$define"
14442                         ;;
14443                 *)
14444                         fflushall="$undef"
14445                         ;;
14446                 esac
14447             else
14448                 $cat >&4 <<EOM
14449 All is futile.  Even fflush(stdin) clobbers input pipes!
14450 EOM
14451                 fflushall="$undef"
14452             fi
14453         else
14454             fflushall="$undef"
14455         fi
14456         $rm -f core tryp.c tryp.core core.tryp.*
14457         ;;
14458 *)      fflushall="$undef"
14459         ;;
14460 esac
14461
14462 case "$fflushNULL$fflushall" in
14463 undefundef)
14464         $cat <<EOM
14465 OK, I give up.  I cannot figure out how to flush pending stdio output.
14466 We won't be flushing handles at all before fork/exec/popen.
14467 EOM
14468         ;;
14469 esac
14470 $rm -f try.* try$exe_ext
14471
14472 : Store the full pathname to the ar program for use in the C program
14473 : Respect a hint or command line value for full_ar.
14474 case "$full_ar" in
14475 '') full_ar=$ar ;;
14476 esac
14477
14478 : Store the full pathname to the sed program for use in the C program
14479 full_sed=$sed
14480
14481 : see what type gids are declared as in the kernel
14482 echo " "
14483 echo "Looking for the type for group ids returned by getgid()."
14484 set gid_t gidtype xxx stdio.h sys/types.h
14485 eval $typedef
14486 case "$gidtype" in
14487 xxx)
14488         xxx=`./findhdr sys/user.h`
14489         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
14490         case $1 in
14491         unsigned) dflt="$1 $2" ;;
14492         *) dflt="$1" ;;
14493         esac
14494         ;;
14495 *) dflt="$gidtype";;
14496 esac
14497 case "$gidtype" in
14498 gid_t) echo "gid_t found." ;;
14499 *)      rp="What is the type for group ids returned by getgid()?"
14500         . ./myread
14501         gidtype="$ans"
14502         ;;
14503 esac
14504
14505 echo " "
14506 case "$gidtype" in
14507 *_t) zzz="$gidtype"     ;;
14508 *)   zzz="gid"          ;;
14509 esac
14510 echo "Checking the size of $zzz..." >&4 
14511 cat > try.c <<EOCP
14512 #include <sys/types.h>
14513 #include <stdio.h>
14514 int main() {
14515     printf("%d\n", (int)sizeof($gidtype));
14516     exit(0);
14517 }
14518 EOCP
14519 set try
14520 if eval $compile_ok; then
14521         yyy=`$run ./try`
14522         case "$yyy" in
14523         '')     gidsize=4
14524                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
14525                 ;;
14526         *)      gidsize=$yyy
14527                 echo "Your $zzz is $gidsize bytes long."
14528                 ;;
14529         esac
14530 else
14531         gidsize=4
14532         echo "(I can't compile the test program--guessing $gidsize.)" >&4
14533 fi
14534
14535
14536 echo " "
14537 case "$gidtype" in
14538 *_t) zzz="$gidtype"     ;;
14539 *)   zzz="gid"          ;;
14540 esac
14541 echo "Checking the sign of $zzz..." >&4 
14542 cat > try.c <<EOCP
14543 #include <sys/types.h>
14544 #include <stdio.h>
14545 int main() {
14546         $gidtype foo = -1;
14547         if (foo < 0)
14548                 printf("-1\n");
14549         else
14550                 printf("1\n");
14551 }
14552 EOCP
14553 set try
14554 if eval $compile; then
14555         yyy=`$run ./try`
14556         case "$yyy" in
14557         '')     gidsign=1
14558                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14559                 ;;
14560         *)      gidsign=$yyy
14561                 case "$gidsign" in
14562                  1) echo "Your $zzz is unsigned." ;;
14563                 -1) echo "Your $zzz is signed."   ;;
14564                 esac
14565                 ;;
14566         esac
14567 else
14568         gidsign=1
14569         echo "(I can't compile the test program--guessing unsigned.)" >&4
14570 fi
14571
14572
14573 echo " "
14574
14575 if $test X"$quadtype" != X; then
14576
14577 echo "Checking how to print 64-bit integers..." >&4
14578
14579 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
14580         $cat >try.c <<'EOCP'
14581 #include <sys/types.h>
14582 #include <stdio.h>
14583 int main() {
14584   int q = 12345678901;
14585   printf("%ld\n", q);
14586 }
14587 EOCP
14588         set try
14589         if eval $compile; then
14590                 yyy=`$run ./try`
14591                 case "$yyy" in
14592                 12345678901)
14593                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
14594                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
14595                         echo "We will use %d."
14596                         ;;
14597                 esac
14598         fi
14599 fi
14600
14601 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
14602         $cat >try.c <<'EOCP'
14603 #include <sys/types.h>
14604 #include <stdio.h>
14605 int main() {
14606   long q = 12345678901;
14607   printf("%ld\n", q);
14608 }
14609 EOCP
14610         set try
14611         if eval $compile; then
14612                 yyy=`$run ./try`
14613                 case "$yyy" in
14614                 12345678901)
14615                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
14616                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
14617                         echo "We will use %ld."
14618                         ;;
14619                 esac
14620         fi
14621 fi
14622
14623 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
14624         $cat >try.c <<'EOCP'
14625 #include <sys/types.h>
14626 #include <inttypes.h>
14627 #include <stdio.h>
14628 int main() {
14629   int64_t q = 12345678901;
14630   printf("%" PRId64 "\n", q);
14631 }
14632 EOCP
14633         set try
14634         if eval $compile; then
14635                 yyy=`$run ./try`
14636                 case "$yyy" in
14637                 12345678901)
14638                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
14639                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
14640                         echo "We will use the C9X style."
14641                         ;;
14642                 esac
14643         fi
14644 fi
14645
14646 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14647         $cat >try.c <<EOCP
14648 #include <sys/types.h>
14649 #include <stdio.h>
14650 int main() {
14651   $quadtype q = 12345678901;
14652   printf("%Ld\n", q);
14653 }
14654 EOCP
14655         set try
14656         if eval $compile; then
14657                 yyy=`$run ./try`
14658                 case "$yyy" in
14659                 12345678901)
14660                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
14661                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
14662                         echo "We will use %Ld."
14663                         ;;
14664                 esac
14665         fi
14666 fi
14667
14668 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
14669         $cat >try.c <<'EOCP'
14670 #include <sys/types.h>
14671 #include <stdio.h>
14672 int main() {
14673   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
14674   printf("%lld\n", q);
14675 }
14676 EOCP
14677         set try
14678         if eval $compile; then
14679                 yyy=`$run ./try`
14680                 case "$yyy" in
14681                 12345678901)
14682                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
14683                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
14684                         echo "We will use the %lld style."
14685                         ;;
14686                 esac
14687         fi
14688 fi
14689
14690 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14691         $cat >try.c <<EOCP
14692 #include <sys/types.h>
14693 #include <stdio.h>
14694 int main() {
14695   $quadtype q = 12345678901;
14696   printf("%qd\n", q);
14697 }
14698 EOCP
14699         set try
14700         if eval $compile; then
14701                 yyy=`$run ./try`
14702                 case "$yyy" in
14703                 12345678901)
14704                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14705                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14706                         echo "We will use %qd."
14707                         ;;
14708                 esac
14709         fi
14710 fi
14711
14712 if $test X"$sPRId64" = X; then
14713         echo "Cannot figure out how to print 64-bit integers." >&4
14714 fi
14715
14716 $rm -f try try.*
14717
14718 fi
14719
14720 case "$sPRId64" in
14721 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
14722         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
14723         ;;
14724 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
14725         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
14726         ;;
14727 esac
14728
14729
14730 echo " "
14731 $echo "Checking the format strings to be used for Perl's internal types..." >&4
14732
14733 if $test X"$ivsize" = X8; then
14734         ivdformat="$sPRId64"
14735         uvuformat="$sPRIu64"
14736         uvoformat="$sPRIo64"
14737         uvxformat="$sPRIx64"
14738         uvXUformat="$sPRIXU64"
14739 else
14740         if $test X"$ivsize" = X"$longsize"; then
14741                 ivdformat='"ld"'
14742                 uvuformat='"lu"'
14743                 uvoformat='"lo"'
14744                 uvxformat='"lx"'
14745                 uvXUformat='"lX"'
14746         else
14747                 if $test X"$ivsize" = X"$intsize"; then
14748                         ivdformat='"d"'
14749                         uvuformat='"u"'
14750                         uvoformat='"o"'
14751                         uvxformat='"x"'
14752                         uvXUformat='"X"'
14753                 else
14754                         : far out
14755                         if $test X"$ivsize" = X"$shortsize"; then
14756                                 ivdformat='"hd"'
14757                                 uvuformat='"hu"'
14758                                 uvoformat='"ho"'
14759                                 uvxformat='"hx"'
14760                                 uvXUformat='"hX"'
14761                         fi
14762                 fi
14763         fi
14764 fi
14765
14766 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14767         nveformat="$sPRIeldbl"
14768         nvfformat="$sPRIfldbl"
14769         nvgformat="$sPRIgldbl"
14770         nvEUformat="$sPRIEUldbl"
14771         nvFUformat="$sPRIFUldbl"
14772         nvGUformat="$sPRIGUldbl"
14773 else
14774         nveformat='"e"'
14775         nvfformat='"f"'
14776         nvgformat='"g"'
14777         nvEUformat='"E"'
14778         nvFUformat='"F"'
14779         nvGUformat='"G"'
14780 fi
14781
14782 case "$ivdformat" in
14783 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
14784     exit 1
14785     ;;
14786 esac
14787
14788
14789 echo " "
14790 $echo "Checking the format string to be used for gids..." >&4
14791
14792 case "$gidsign" in
14793 -1)     if $test X"$gidsize" = X"$ivsize"; then
14794                 gidformat="$ivdformat"
14795         else
14796                 if $test X"$gidsize" = X"$longsize"; then
14797                         gidformat='"ld"'
14798                 else
14799                         if $test X"$gidsize" = X"$intsize"; then
14800                                 gidformat='"d"'
14801                         else
14802                                 if $test X"$gidsize" = X"$shortsize"; then
14803                                         gidformat='"hd"'
14804                                 fi
14805                         fi
14806                 fi
14807         fi
14808         ;;
14809 *)      if $test X"$gidsize" = X"$uvsize"; then
14810                 gidformat="$uvuformat"
14811         else
14812                 if $test X"$gidsize" = X"$longsize"; then
14813                         gidformat='"lu"'
14814                 else
14815                         if $test X"$gidsize" = X"$intsize"; then
14816                                 gidformat='"u"'
14817                         else
14818                                 if $test X"$gidsize" = X"$shortsize"; then
14819                                         gidformat='"hu"'
14820                                 fi
14821                         fi
14822                 fi
14823         fi
14824         ;;
14825 esac
14826
14827 : see if getgroups exists
14828 set getgroups d_getgrps
14829 eval $inlibc
14830
14831 : see if setgroups exists
14832 set setgroups d_setgrps
14833 eval $inlibc
14834
14835
14836 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14837 echo " "
14838 case "$d_getgrps$d_setgrps" in
14839 *define*)
14840         case "$groupstype" in
14841         '') dflt="$gidtype" ;;
14842         *)  dflt="$groupstype" ;;
14843         esac
14844         $cat <<EOM
14845 What type of pointer is the second argument to getgroups() and setgroups()?
14846 Usually this is the same as group ids, $gidtype, but not always.
14847
14848 EOM
14849         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14850         . ./myread
14851         groupstype="$ans"
14852         ;;
14853 *)  groupstype="$gidtype";;
14854 esac
14855
14856 echo " "
14857 echo "Checking if your $make program sets \$(MAKE)..." >&4
14858 case "$make_set_make" in
14859 '')
14860         $sed 's/^X //' > testmake.mak << 'EOF'
14861 Xall:
14862 X       @echo 'maketemp="$(MAKE)"'
14863 EOF
14864         case "`$make -f testmake.mak 2>/dev/null`" in
14865         *maketemp=*) make_set_make='#' ;;
14866         *)      make_set_make="MAKE=$make" ;;
14867         esac
14868         $rm -f testmake.mak
14869         ;;
14870 esac
14871 case "$make_set_make" in
14872 '#') echo "Yup, it does.";;
14873 *) echo "Nope, it doesn't.";;
14874 esac
14875
14876 : see what type is used for mode_t
14877 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14878 set mode_t modetype int stdio.h sys/types.h
14879 eval $typedef_ask
14880
14881 : see if stdarg is available
14882 echo " "
14883 if $test `./findhdr stdarg.h`; then
14884         echo "<stdarg.h> found." >&4
14885         valstd="$define"
14886 else
14887         echo "<stdarg.h> NOT found." >&4
14888         valstd="$undef"
14889 fi
14890
14891 : see if varags is available
14892 echo " "
14893 if $test `./findhdr varargs.h`; then
14894         echo "<varargs.h> found." >&4
14895 else
14896         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14897 fi
14898
14899 : set up the varargs testing programs
14900 $cat > varargs.c <<EOP
14901 #ifdef I_STDARG
14902 #include <stdarg.h>
14903 #endif
14904 #ifdef I_VARARGS
14905 #include <varargs.h>
14906 #endif
14907
14908 #ifdef I_STDARG
14909 int f(char *p, ...)
14910 #else
14911 int f(va_alist)
14912 va_dcl
14913 #endif
14914 {
14915         va_list ap;
14916 #ifndef I_STDARG
14917         char *p;
14918 #endif
14919 #ifdef I_STDARG
14920         va_start(ap,p);
14921 #else
14922         va_start(ap);
14923         p = va_arg(ap, char *);
14924 #endif
14925         va_end(ap);
14926 }
14927 EOP
14928 $cat > varargs <<EOP
14929 $startsh
14930 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14931         echo "true"
14932 else
14933         echo "false"
14934 fi
14935 $rm -f varargs$_o
14936 EOP
14937 chmod +x varargs
14938
14939 : now check which varargs header should be included
14940 echo " "
14941 i_varhdr=''
14942 case "$valstd" in
14943 "$define")
14944         if `./varargs I_STDARG`; then
14945                 val='stdarg.h'
14946         elif `./varargs I_VARARGS`; then
14947                 val='varargs.h'
14948         fi
14949         ;;
14950 *)
14951         if `./varargs I_VARARGS`; then
14952                 val='varargs.h'
14953         fi
14954         ;;
14955 esac
14956 case "$val" in
14957 '')
14958 echo "I could not find the definition for va_dcl... You have problems..." >&4
14959         val="$undef"; set i_stdarg; eval $setvar
14960         val="$undef"; set i_varargs; eval $setvar
14961         ;;
14962 *) 
14963         set i_varhdr
14964         eval $setvar
14965         case "$i_varhdr" in
14966         stdarg.h)
14967                 val="$define"; set i_stdarg; eval $setvar
14968                 val="$undef"; set i_varargs; eval $setvar
14969                 ;;
14970         varargs.h)
14971                 val="$undef"; set i_stdarg; eval $setvar
14972                 val="$define"; set i_varargs; eval $setvar
14973                 ;;
14974         esac
14975         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14976 esac
14977 $rm -f varargs*
14978
14979 : see if we need va_copy
14980 echo " "
14981 case "$i_stdarg" in
14982 "$define")
14983         $cat >try.c <<EOCP
14984 #include <stdarg.h>
14985 #include <stdio.h>
14986 #$i_stdlib I_STDLIB
14987 #ifdef I_STDLIB
14988 #include <stdlib.h>
14989 #endif
14990 #include <signal.h>
14991
14992 int
14993 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14994 {
14995   return vfprintf(f, fmt, *valp);
14996 }
14997  
14998 int    
14999 myvfprintf(FILE *f, const  char *fmt, va_list val)
15000 {
15001   return ivfprintf(f, fmt, &val);
15002 }
15003       
15004 int
15005 myprintf(char *fmt, ...) 
15006 {
15007   va_list val;
15008   va_start(val, fmt);
15009   return myvfprintf(stdout, fmt, val); 
15010 }         
15011
15012 int
15013 main(int ac, char **av)
15014 {
15015   signal(SIGSEGV, exit);
15016
15017   myprintf("%s%cs all right, then\n", "that", '\'');                            
15018   exit(0);      
15019 }
15020 EOCP
15021         set try
15022         if eval $compile && $run ./try 2>&1 >/dev/null; then
15023                 case "`$run ./try`" in
15024                 "that's all right, then")
15025                         okay=yes
15026                         ;;
15027                 esac
15028         fi
15029         case "$okay" in
15030         yes)    echo "It seems that you don't need va_copy()." >&4
15031                 need_va_copy="$undef"
15032                 ;;
15033         *)      echo "It seems that va_copy() or similar will be needed." >&4
15034                 need_va_copy="$define"
15035                 ;;
15036         esac
15037         $rm -f try.* core core.* *.core *.core.*
15038         ;;
15039 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
15040         ;;
15041 esac
15042
15043 : define a fucntion to check prototypes
15044 $cat > protochk <<EOSH
15045 $startsh
15046 cc="$cc"
15047 optimize="$optimize"
15048 ccflags="$ccflags"
15049 prototype="$prototype"
15050 define="$define"
15051 rm=$rm
15052 EOSH
15053
15054 $cat >> protochk <<'EOSH'
15055
15056 $rm -f try.c
15057 foo="$1"
15058 shift
15059 while test $# -ge 2; do
15060         case "$1" in
15061                 $define) echo "#include <$2>" >> try.c ;;
15062                 literal) echo "$2" >> try.c ;;
15063         esac
15064     shift 2
15065 done
15066 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
15067 cat >> try.c <<'EOCP'
15068 #ifdef CAN_PROTOTYPE
15069 #define _(args) args
15070 #else
15071 #define _(args) ()
15072 #endif
15073 EOCP
15074 echo "$foo" >> try.c
15075 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
15076 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
15077 status=$?
15078 $rm -f try.[co]
15079 exit $status
15080 EOSH
15081 chmod +x protochk
15082 $eunicefix protochk
15083
15084 : see what type is used for size_t
15085 rp="What is the type used for the length parameter for string functions?"
15086 set size_t sizetype 'unsigned int' stdio.h sys/types.h
15087 eval $typedef_ask
15088
15089 : check for type of arguments to gethostbyaddr. 
15090 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
15091         case "$d_gethbyaddr" in
15092         $define)
15093                 $cat <<EOM
15094
15095 Checking to see what type of arguments are accepted by gethostbyaddr().
15096 EOM
15097                 hdrs="$define sys/types.h
15098                         $d_socket sys/socket.h 
15099                         $i_niin netinet/in.h 
15100                         $i_netdb netdb.h
15101                         $i_unistd unistd.h"
15102                 : The first arg can 'char *' or 'void *'
15103                 : The second arg is some of integral type
15104                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
15105                         for yyy in size_t long int; do
15106                                 case "$netdb_host_type" in
15107                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
15108                                         if ./protochk "$try" $hdrs; then
15109                                                 echo "Your system accepts $xxx for the first arg."
15110                                                 echo "...and $yyy for the second arg."
15111                                                 netdb_host_type="$xxx"
15112                                                 netdb_hlen_type="$yyy"
15113                                         fi
15114                                         ;;
15115                                 esac
15116                         done
15117                 done
15118                 : In case none of those worked, prompt the user.
15119                 case "$netdb_host_type" in
15120                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
15121                         dflt='char *'
15122                         . ./myread
15123                         netdb_host_type=$ans
15124                         rp='What is the type for the 2nd argument to gethostbyaddr?'
15125                         dflt="$sizetype"
15126                         . ./myread
15127                         netdb_hlen_type=$ans
15128                         ;;
15129                 esac
15130                 ;;
15131         *)      : no gethostbyaddr, so pick harmless defaults
15132                 netdb_host_type='char *'
15133                 netdb_hlen_type="$sizetype"
15134                 ;;
15135         esac
15136         # Remove the "const" if needed. -- but then we'll have a 
15137         # prototype clash!
15138         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
15139 fi
15140
15141 : check for type of argument to gethostbyname. 
15142 if test "X$netdb_name_type" = X ; then
15143         case "$d_gethbyname" in
15144         $define)
15145                 $cat <<EOM
15146
15147 Checking to see what type of argument is accepted by gethostbyname().
15148 EOM
15149                 hdrs="$define sys/types.h
15150                         $d_socket sys/socket.h 
15151                         $i_niin netinet/in.h 
15152                         $i_netdb netdb.h
15153                         $i_unistd unistd.h"
15154                 for xxx in "const char *" "char *"; do
15155                         case "$netdb_name_type" in
15156                         '')     try="extern struct hostent *gethostbyname($xxx);"
15157                                 if ./protochk "$try" $hdrs; then
15158                                         echo "Your system accepts $xxx."
15159                                         netdb_name_type="$xxx"
15160                                 fi
15161                                 ;;
15162                         esac
15163                 done
15164                 : In case none of those worked, prompt the user.
15165                 case "$netdb_name_type" in
15166                 '')     rp='What is the type for the 1st argument to gethostbyname?'
15167                         dflt='char *'
15168                         . ./myread
15169                         netdb_name_type=$ans
15170                         ;;
15171                 esac
15172                 ;;
15173         *)      : no gethostbyname, so pick harmless default
15174                 netdb_name_type='char *'
15175                 ;;
15176         esac
15177 fi
15178
15179 : check for type of 1st argument to getnetbyaddr. 
15180 if test "X$netdb_net_type" = X ; then
15181         case "$d_getnbyaddr" in
15182         $define)
15183                 $cat <<EOM
15184
15185 Checking to see what type of 1st argument is accepted by getnetbyaddr().
15186 EOM
15187                 hdrs="$define sys/types.h
15188                         $d_socket sys/socket.h 
15189                         $i_niin netinet/in.h 
15190                         $i_netdb netdb.h
15191                         $i_unistd unistd.h"
15192                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
15193                         case "$netdb_net_type" in
15194                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
15195                                 if ./protochk "$try" $hdrs; then
15196                                         echo "Your system accepts $xxx."
15197                                         netdb_net_type="$xxx"
15198                                 fi
15199                                 ;;
15200                         esac
15201                 done
15202                 : In case none of those worked, prompt the user.
15203                 case "$netdb_net_type" in
15204                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
15205                         dflt='long'
15206                         . ./myread
15207                         netdb_net_type=$ans
15208                         ;;
15209                 esac
15210                 ;;
15211         *)      : no getnetbyaddr, so pick harmless default
15212                 netdb_net_type='long'
15213                 ;;
15214         esac
15215 fi
15216 : locate the preferred pager for this system
15217 case "$pager" in
15218 '')
15219         dflt=''
15220         case "$pg" in
15221         /*) dflt=$pg;;
15222         [a-zA-Z]:/*) dflt=$pg;;
15223         esac
15224         case "$more" in
15225         /*) dflt=$more;;
15226         [a-zA-Z]:/*) dflt=$more;;
15227         esac
15228         case "$less" in
15229         /*) dflt=$less;;
15230         [a-zA-Z]:/*) dflt=$less;;
15231         esac
15232         case "$dflt" in
15233         '') dflt=/usr/ucb/more;;
15234         esac
15235         ;;
15236 *) dflt="$pager";;
15237 esac
15238 echo " "
15239 fn=f/
15240 rp='What pager is used on your system?'
15241 . ./getfile
15242 pager="$ans"
15243
15244 : see what type pids are declared as in the kernel
15245 rp="What is the type of process ids on this system?"
15246 set pid_t pidtype int stdio.h sys/types.h
15247 eval $typedef_ask
15248
15249 : Find earliest binary compatible site_perl subdirectory perl can use.
15250 case "$bincompat5005" in
15251 "$define") xs_apiversion='5.005' ;;
15252 *) xs_apiversion=$version ;;   # The current site_perl version.
15253 esac
15254 : Find earliest pure perl site_perl subdirectory perl can use.
15255 : The versioned directories started at 5.005.
15256 pm_apiversion='5.005'
15257
15258 : see if ar generates random libraries by itself
15259 echo " "
15260 echo "Checking how to generate random libraries on your machine..." >&4
15261 echo 'int bar1() { return bar2(); }' > bar1.c
15262 echo 'int bar2() { return 2; }' > bar2.c
15263 $cat > foo.c <<'EOP'
15264 int main() { printf("%d\n", bar1()); exit(0); }
15265 EOP
15266 $cc $ccflags -c bar1.c >/dev/null 2>&1
15267 $cc $ccflags -c bar2.c >/dev/null 2>&1
15268 $cc $ccflags -c foo.c >/dev/null 2>&1
15269 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
15270 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
15271         $run ./foobar >/dev/null 2>&1; then
15272         echo "$ar appears to generate random libraries itself."
15273         orderlib=false
15274         ranlib=":"
15275 elif $ar ts bar$_a >/dev/null 2>&1 &&
15276         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
15277         $run ./foobar >/dev/null 2>&1; then
15278                 echo "a table of contents needs to be added with '$ar ts'."
15279                 orderlib=false
15280                 ranlib="$ar ts"
15281 else
15282         case "$ranlib" in
15283         :) ranlib='';;
15284         '')
15285                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
15286                 $test -f $ranlib || ranlib=''
15287                 ;;
15288         esac
15289         if $test -n "$ranlib"; then
15290                 echo "your system has '$ranlib'; we'll use that."
15291                 orderlib=false
15292         else
15293                 echo "your system doesn't seem to support random libraries"
15294                 echo "so we'll use lorder and tsort to order the libraries."
15295                 orderlib=true
15296                 ranlib=":"
15297         fi
15298 fi
15299 $rm -f foo* bar* 
15300
15301 : check for type of arguments to select. 
15302 case "$selecttype" in
15303 '') case "$d_select" in
15304         $define)
15305                 echo " "
15306                 $cat <<EOM
15307 Checking to see what type of arguments are accepted by select().
15308 EOM
15309                 hdrs="$define sys/types.h
15310                         $i_systime sys/time.h 
15311                         $i_sysselct sys/select.h
15312                         $d_socket sys/socket.h"
15313                 : The first arg can be int, unsigned, or size_t
15314                 : The last arg may or may not be 'const'
15315                 val=''
15316                 : void pointer has been seen but using that
15317                 : breaks the selectminbits test
15318                 for xxx in 'fd_set *' 'int *'; do
15319                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
15320                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
15321                                         case "$val" in
15322                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
15323                                                 if ./protochk "$try" $hdrs; then
15324                                                         echo "Your system accepts $xxx."
15325                                                         val="$xxx"
15326                                                 fi
15327                                                 ;;
15328                                         esac
15329                                 done
15330                         done
15331                 done
15332                 case "$val" in
15333                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
15334                         case "$d_fd_set" in
15335                                 $define) dflt="fd_set *" ;;
15336                                 *)              dflt="int *" ;;
15337                         esac
15338                         . ./myread
15339                         val=$ans
15340                         ;;
15341                 esac
15342                 selecttype="$val"
15343                 ;;
15344         *)      : no select, so pick a harmless default
15345                 selecttype='int *'
15346                 ;;
15347         esac
15348         ;;
15349 esac
15350
15351 : check for the select 'width'
15352 case "$selectminbits" in
15353 '') case "$d_select" in
15354         $define)
15355                 $cat <<EOM
15356
15357 Checking to see on how many bits at a time your select() operates...
15358 EOM
15359                 $cat >try.c <<EOCP
15360 #include <sys/types.h>
15361 #$i_time I_TIME
15362 #$i_systime I_SYS_TIME
15363 #$i_systimek I_SYS_TIME_KERNEL
15364 #ifdef I_TIME
15365 #   include <time.h>
15366 #endif
15367 #ifdef I_SYS_TIME
15368 #   ifdef I_SYS_TIME_KERNEL
15369 #       define KERNEL
15370 #   endif
15371 #   include <sys/time.h>
15372 #   ifdef I_SYS_TIME_KERNEL
15373 #       undef KERNEL
15374 #   endif
15375 #endif
15376 #$i_sysselct I_SYS_SELECT
15377 #ifdef I_SYS_SELECT
15378 #include <sys/select.h>
15379 #endif
15380 #$d_socket HAS_SOCKET
15381 #ifdef HAS_SOCKET
15382 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
15383 #endif
15384 #include <stdio.h>
15385 $selecttype b;
15386 #define S sizeof(*(b))
15387 #define MINBITS 64
15388 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
15389 #define NBITS  (NBYTES * 8)
15390 int main() {
15391     char s[NBYTES];
15392     struct timeval t;
15393     int i;
15394     FILE* fp;
15395     int fd;
15396
15397     fclose(stdin);
15398     fp = fopen("try.c", "r");
15399     if (fp == 0)
15400       exit(1);
15401     fd = fileno(fp);
15402     if (fd < 0)
15403       exit(2);
15404     b = ($selecttype)s;
15405     for (i = 0; i < NBITS; i++)
15406         FD_SET(i, b);
15407     t.tv_sec  = 0;
15408     t.tv_usec = 0;
15409     select(fd + 1, b, 0, 0, &t);
15410     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
15411     printf("%d\n", i + 1);
15412     return 0;
15413 }
15414 EOCP
15415                 set try
15416                 if eval $compile_ok; then
15417                         selectminbits=`$run ./try`
15418                         case "$selectminbits" in
15419                         '')     cat >&4 <<EOM
15420 Cannot figure out on how many bits at a time your select() operates.
15421 I'll play safe and guess it is 32 bits.
15422 EOM
15423                                 selectminbits=32
15424                                 bits="32 bits"
15425                                 ;;
15426                         1)      bits="1 bit" ;;
15427                         *)      bits="$selectminbits bits" ;;
15428                         esac
15429                         echo "Your select() operates on $bits at a time." >&4
15430                 else
15431                         rp='What is the minimum number of bits your select() operates on?'
15432                         case "$byteorder" in
15433                         1234|12345678)  dflt=32 ;;
15434                         *)              dflt=1  ;;
15435                         esac
15436                         . ./myread
15437                         val=$ans
15438                         selectminbits="$val"
15439                 fi
15440                 $rm -f try.* try
15441                 ;;
15442         *)      : no select, so pick a harmless default
15443                 selectminbits='32'
15444                 ;;
15445         esac
15446         ;;
15447 esac
15448
15449 : Trace out the files included by signal.h, then look for SIGxxx names.
15450 : Remove SIGARRAYSIZE used by HPUX.
15451 : Remove SIGSTKSIZE used by Linux.
15452 : Remove SIGSTKSZ used by Posix.
15453 : Remove SIGTYP void lines used by OS2.
15454 : Some cpps, like os390, dont give the file name anywhere
15455 if [ "X$fieldn" = X ]; then
15456         : Just make some guesses.  We check them later.
15457         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
15458 else
15459         xxx=`echo '#include <signal.h>' |
15460         $cppstdin $cppminus $cppflags 2>/dev/null |
15461         $grep '^[       ]*#.*include' | 
15462         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
15463 fi
15464 : Check this list of files to be sure we have parsed the cpp output ok.
15465 : This will also avoid potentially non-existent files, such 
15466 : as ../foo/bar.h
15467 xxxfiles=''
15468 for xx in $xxx /dev/null ; do
15469         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
15470 done
15471 : If we have found no files, at least try signal.h
15472 case "$xxxfiles" in
15473 '')     xxxfiles=`./findhdr signal.h` ;;
15474 esac
15475 xxx=`awk '
15476 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
15477         print substr($2, 4, 20)
15478 }
15479 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
15480         print substr($3, 4, 20)
15481 }' $xxxfiles`
15482 : Append some common names just in case the awk scan failed.
15483 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
15484 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
15485 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
15486 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
15487 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
15488
15489 : generate a few handy files for later
15490 $cat > signal.c <<'EOCP'
15491 #include <sys/types.h>
15492 #include <signal.h>
15493 #include <stdio.h>
15494 int main() {
15495
15496 /* Strange style to avoid deeply-nested #if/#else/#endif */
15497 #ifndef NSIG
15498 #  ifdef _NSIG
15499 #    define NSIG (_NSIG)
15500 #  endif
15501 #endif
15502
15503 #ifndef NSIG
15504 #  ifdef SIGMAX
15505 #    define NSIG (SIGMAX+1)
15506 #  endif
15507 #endif
15508
15509 #ifndef NSIG
15510 #  ifdef SIG_MAX
15511 #    define NSIG (SIG_MAX+1)
15512 #  endif
15513 #endif
15514
15515 #ifndef NSIG
15516 #  ifdef MAXSIG
15517 #    define NSIG (MAXSIG+1)
15518 #  endif
15519 #endif
15520
15521 #ifndef NSIG
15522 #  ifdef MAX_SIG
15523 #    define NSIG (MAX_SIG+1)
15524 #  endif
15525 #endif
15526
15527 #ifndef NSIG
15528 #  ifdef SIGARRAYSIZE
15529 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
15530 #  endif
15531 #endif
15532
15533 #ifndef NSIG
15534 #  ifdef _sys_nsig
15535 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
15536 #  endif
15537 #endif
15538
15539 /* Default to some arbitrary number that's big enough to get most
15540    of the common signals.
15541 */
15542 #ifndef NSIG
15543 #    define NSIG 50
15544 #endif
15545
15546 printf("NSIG %d\n", NSIG);
15547
15548 #ifndef JUST_NSIG
15549
15550 EOCP
15551
15552 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
15553 {
15554         printf "#ifdef SIG"; printf $1; printf "\n"
15555         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
15556         printf $1; printf ");\n"
15557         printf "#endif\n"
15558 }
15559 END {
15560         printf "#endif /* JUST_NSIG */\n";
15561         printf "exit(0);\n}\n";
15562 }
15563 ' >>signal.c
15564 $cat >signal.awk <<'EOP'
15565 BEGIN { ndups = 0 }
15566 $1 ~ /^NSIG$/ { nsig = $2 }
15567 ($1 !~ /^NSIG$/) && (NF == 2) {
15568     if ($2 > maxsig) { maxsig = $2 }
15569     if (sig_name[$2]) {
15570         dup_name[ndups] = $1
15571         dup_num[ndups] = $2
15572         ndups++ 
15573     }
15574     else {
15575         sig_name[$2] = $1
15576         sig_num[$2] = $2
15577     }
15578 }
15579 END { 
15580     if (nsig == 0) {
15581         nsig = maxsig + 1
15582     }
15583     printf("NSIG %d\n", nsig);
15584     for (n = 1; n < nsig; n++) {
15585         if (sig_name[n]) {
15586             printf("%s %d\n", sig_name[n], sig_num[n])
15587         }
15588         else {
15589             printf("NUM%d %d\n", n, n) 
15590         }
15591     }
15592     for (n = 0; n < ndups; n++) {
15593         printf("%s %d\n", dup_name[n], dup_num[n])
15594     }
15595 }
15596 EOP
15597 $cat >signal_cmd <<EOS
15598 $startsh
15599 if $test -s signal.lst; then
15600     echo "Using your existing signal.lst file"
15601         exit 0
15602 fi
15603 xxx="$xxx"
15604 EOS
15605 $cat >>signal_cmd <<'EOS'
15606
15607 set signal
15608 if eval $compile_ok; then
15609         $run ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15610 else
15611         echo "(I can't seem be able to compile the whole test program)" >&4
15612         echo "(I'll try it in little pieces.)" >&4
15613         set signal -DJUST_NSIG
15614         if eval $compile_ok; then
15615                 $run ./signal$_exe > signal.nsg
15616                 $cat signal.nsg
15617         else
15618                 echo "I can't seem to figure out how many signals you have." >&4
15619                 echo "Guessing 50." >&4
15620                 echo 'NSIG 50' > signal.nsg
15621         fi
15622         : Now look at all the signal names, one at a time.
15623         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
15624                 $cat > signal.c <<EOCP
15625 #include <sys/types.h>
15626 #include <signal.h>
15627 #include <stdio.h>
15628 int main() {
15629 printf("$xx %d\n", SIG${xx});
15630 return 0;
15631 }
15632 EOCP
15633                 set signal
15634                 if eval $compile; then
15635                         echo "SIG${xx} found."
15636                         $run ./signal$_exe  >> signal.ls1
15637                 else
15638                         echo "SIG${xx} NOT found."
15639                 fi
15640         done
15641         if $test -s signal.ls1; then
15642                 $cat signal.nsg signal.ls1 |
15643                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15644         fi
15645
15646 fi
15647 if $test -s signal.lst; then
15648         :
15649 else
15650         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
15651         echo 'kill -l' >signal
15652         set X `csh -f <signal`
15653         $rm -f signal
15654         shift
15655         case $# in
15656         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
15657         esac
15658         echo $@ | $tr ' ' $trnl | \
15659             $awk '{ printf "%s %d\n", $1, ++s; }
15660                   END { printf "NSIG %d\n", ++s }' >signal.lst
15661 fi
15662 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
15663 EOS
15664 chmod a+x signal_cmd
15665 $eunicefix signal_cmd
15666
15667 : generate list of signal names
15668 echo " "
15669 case "$sig_name_init" in
15670 '') doinit=yes ;;
15671 *)  case "$sig_num_init" in
15672     ''|*,*) doinit=yes ;;
15673     esac ;;
15674 esac
15675 case "$doinit" in
15676 yes)
15677         echo "Generating a list of signal names and numbers..." >&4
15678         . ./signal_cmd
15679         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
15680         sig_name=`$awk 'BEGIN { printf "ZERO " }
15681                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
15682         sig_num=`$awk  'BEGIN { printf "0 " }
15683                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
15684         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
15685                              !/^NSIG/   { printf "\"%s\", ", $1 }
15686                              END        { printf "0\n" }' signal.lst`
15687         sig_num_init=`$awk  'BEGIN      { printf "0, " }
15688                              !/^NSIG/   { printf "%d, ", $2}
15689                              END        { printf "0\n"}' signal.lst`
15690         ;;
15691 esac
15692 echo "The following $sig_count signals are available:"
15693 echo " "
15694 echo $sig_name | $awk \
15695 'BEGIN { linelen = 0 }
15696 {
15697         for (i = 1; i <= NF; i++) {
15698                 name = "SIG" $i " "
15699                 linelen = linelen + length(name)
15700                 if (linelen > 70) {
15701                         printf "\n"
15702                         linelen = length(name)
15703                 }
15704                 printf "%s", name
15705         }
15706         printf "\n"
15707 }'
15708 sig_size=`echo $sig_name | awk '{print NF}'`
15709 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
15710
15711 echo " "
15712 case "$sizetype" in
15713 *_t) zzz="$sizetype"    ;;
15714 *)   zzz="filesize"     ;;
15715 esac
15716 echo "Checking the size of $zzz..." >&4 
15717 cat > try.c <<EOCP
15718 #include <sys/types.h>
15719 #include <stdio.h>
15720 int main() {
15721     printf("%d\n", (int)sizeof($sizetype));
15722     exit(0);
15723 }
15724 EOCP
15725 set try
15726 if eval $compile_ok; then
15727         yyy=`$run ./try`
15728         case "$yyy" in
15729         '')     sizesize=4
15730                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15731                 ;;
15732         *)      sizesize=$yyy
15733                 echo "Your $zzz size is $sizesize bytes."
15734                 ;;
15735         esac
15736 else
15737         sizesize=4
15738         echo "(I can't compile the test program--guessing $sizesize.)" >&4
15739 fi
15740
15741
15742 : check for socklen_t
15743 echo " "
15744 echo "Checking to see if you have socklen_t..." >&4
15745 $cat >try.c <<EOCP
15746 #include <sys/types.h>
15747 #$d_socket HAS_SOCKET
15748 #ifdef HAS_SOCKET
15749 #include <sys/socket.h>
15750 #endif
15751 int main() { socklen_t x = 16; }
15752 EOCP
15753 set try
15754 if eval $compile; then
15755         val="$define"
15756         echo "You have socklen_t."
15757 else
15758         val="$undef"
15759         echo "You do not have socklen_t."
15760         case "$sizetype" in
15761         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15762         esac
15763 fi
15764 $rm -f try try.*
15765 set d_socklen_t
15766 eval $setvar
15767
15768 : see if this is a socks.h system
15769 set socks.h i_socks
15770 eval $inhdr
15771
15772 : check for type of the size argument to socket calls
15773 case "$d_socket" in
15774 "$define")
15775         $cat <<EOM
15776
15777 Checking to see what type is the last argument of accept().
15778 EOM
15779         yyy=''
15780         case "$d_socklen_t" in
15781         "$define") yyy="$yyy socklen_t"
15782         esac
15783         yyy="$yyy $sizetype int long unsigned"
15784         for xxx in $yyy; do
15785                 case "$socksizetype" in
15786                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
15787                         case "$usesocks" in
15788                         "$define")
15789                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15790                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15791                                         socksizetype="$xxx"
15792                                 fi
15793                                 ;;
15794                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
15795                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15796                                         socksizetype="$xxx"
15797                                 fi
15798                                 ;;
15799                         esac
15800                         ;;
15801                 esac
15802         done
15803 : In case none of those worked, prompt the user.
15804         case "$socksizetype" in
15805         '')     rp='What is the type for socket address structure sizes?'
15806                 dflt='int'
15807                 . ./myread
15808                 socksizetype=$ans
15809                 ;;
15810         esac
15811         ;;
15812 *)      : no sockets, so pick relatively harmless default
15813         socksizetype='int'
15814         ;;
15815 esac
15816
15817 : see what type is used for signed size_t
15818 set ssize_t ssizetype int stdio.h sys/types.h
15819 eval $typedef
15820 dflt="$ssizetype"
15821 $cat > try.c <<EOM
15822 #include <stdio.h>
15823 #include <sys/types.h>
15824 #define Size_t $sizetype
15825 #define SSize_t $dflt
15826 int main()
15827 {
15828         if (sizeof(Size_t) == sizeof(SSize_t))
15829                 printf("$dflt\n");
15830         else if (sizeof(Size_t) == sizeof(int))
15831                 printf("int\n");
15832         else 
15833                 printf("long\n");
15834         exit(0);
15835 }
15836 EOM
15837 echo " "
15838 set try
15839 if eval $compile_ok && $run ./try > /dev/null; then
15840         ssizetype=`$run ./try`
15841         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15842 else
15843         $cat >&4 <<EOM
15844 Help! I can't compile and run the ssize_t test program: please enlighten me!
15845 (This is probably a misconfiguration in your system or libraries, and
15846 you really ought to fix it.  Still, I'll try anyway.)
15847
15848 I need a type that is the same size as $sizetype, but is guaranteed to
15849 be signed.  Common values are ssize_t, int and long.
15850
15851 EOM
15852         rp="What signed type is the same size as $sizetype?"
15853         . ./myread
15854         ssizetype="$ans"
15855 fi
15856 $rm -f try try.*
15857
15858 : see what type of char stdio uses.
15859 echo " "
15860 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15861 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15862         echo "Your stdio uses unsigned chars." >&4
15863         stdchar="unsigned char"
15864 else
15865         echo "Your stdio uses signed chars." >&4
15866         stdchar="char"
15867 fi
15868 $rm -f stdioh
15869
15870
15871
15872 : see if time exists
15873 echo " "
15874 if test "X$d_time" = X -o X"$timetype" = X; then
15875     if set time val -f d_time; eval $csym; $val; then
15876                 echo 'time() found.' >&4
15877                 val="$define"
15878                 rp="What is the type returned by time() on this system?"
15879                 set time_t timetype long stdio.h sys/types.h
15880                 eval $typedef_ask
15881     else
15882                 echo 'time() not found, hope that will do.' >&4
15883                 val="$undef"
15884                 timetype='int';
15885     fi
15886     set d_time
15887     eval $setvar
15888 fi
15889
15890 : see what type uids are declared as in the kernel
15891 echo " "
15892 echo "Looking for the type for user ids returned by getuid()."
15893 set uid_t uidtype xxx stdio.h sys/types.h
15894 eval $typedef
15895 case "$uidtype" in
15896 xxx)
15897         xxx=`./findhdr sys/user.h`
15898         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15899         case $1 in
15900         unsigned) dflt="$1 $2" ;;
15901         *) dflt="$1" ;;
15902         esac
15903         ;;
15904 *) dflt="$uidtype";;
15905 esac
15906 case "$uidtype" in
15907 uid_t)  echo "uid_t found." ;;
15908 *)      rp="What is the type for user ids returned by getuid()?"
15909         . ./myread
15910         uidtype="$ans"
15911         ;;
15912 esac
15913
15914 echo " "
15915 case "$uidtype" in
15916 *_t) zzz="$uidtype"     ;;
15917 *)   zzz="uid"          ;;
15918 esac
15919 echo "Checking the size of $zzz..." >&4 
15920 cat > try.c <<EOCP
15921 #include <sys/types.h>
15922 #include <stdio.h>
15923 int main() {
15924     printf("%d\n", (int)sizeof($uidtype));
15925     exit(0);
15926 }
15927 EOCP
15928 set try
15929 if eval $compile_ok; then
15930         yyy=`$run ./try`
15931         case "$yyy" in
15932         '')     uidsize=4
15933                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15934                 ;;
15935         *)      uidsize=$yyy
15936                 echo "Your $zzz is $uidsize bytes long."
15937                 ;;
15938         esac
15939 else
15940         uidsize=4
15941         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15942 fi
15943
15944 echo " "
15945 case "$uidtype" in
15946 *_t) zzz="$uidtype"     ;;
15947 *)   zzz="uid"          ;;
15948 esac
15949 echo "Checking the sign of $zzz..." >&4
15950 cat > try.c <<EOCP
15951 #include <sys/types.h>
15952 #include <stdio.h>
15953 int main() {
15954         $uidtype foo = -1;
15955         if (foo < 0)
15956                 printf("-1\n");
15957         else
15958                 printf("1\n");
15959 }
15960 EOCP
15961 set try
15962 if eval $compile; then
15963         yyy=`$run ./try`
15964         case "$yyy" in
15965         '')     uidsign=1
15966                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15967                 ;;
15968         *)      uidsign=$yyy
15969                 case "$uidsign" in
15970                  1) echo "Your $zzz is unsigned." ;;
15971                 -1) echo "Your $zzz is signed."   ;;
15972                 esac
15973                 ;;
15974         esac
15975 else
15976         uidsign=1
15977         echo "(I can't compile the test program--guessing unsigned.)" >&4
15978 fi
15979
15980
15981
15982 echo " "
15983 $echo "Checking the format string to be used for uids..." >&4
15984
15985 case "$uidsign" in
15986 -1)     if $test X"$uidsize" = X"$ivsize"; then
15987                 uidformat="$ivdformat"
15988         else
15989                 if $test X"$uidsize" = X"$longsize"; then
15990                         uidformat='"ld"'
15991                 else
15992                         if $test X"$uidsize" = X"$intsize"; then
15993                                 uidformat='"d"'
15994                         else
15995                                 if $test X"$uidsize" = X"$shortsize"; then
15996                                         uidformat='"hd"'
15997                                 fi
15998                         fi
15999                 fi
16000         fi
16001         ;;
16002 *)      if $test X"$uidsize" = X"$uvsize"; then
16003                 uidformat="$uvuformat"
16004         else
16005                 if $test X"$uidsize" = X"$longsize"; then
16006                         uidformat='"lu"'
16007                 else
16008                         if $test X"$uidsize" = X"$intsize"; then
16009                                 uidformat='"u"'
16010                         else
16011                                 if $test X"$uidsize" = X"$shortsize"; then
16012                                         uidformat='"hu"'
16013                                 fi
16014                         fi
16015                 fi
16016         fi
16017         ;;
16018 esac
16019
16020 : determine compiler compiler
16021 case "$yacc" in
16022 '')
16023         dflt=yacc;;
16024 *)
16025         dflt="$yacc";;
16026 esac
16027 echo " "
16028 comp='yacc'
16029 if $test -f "$byacc$_exe"; then
16030         dflt="$byacc"
16031         comp="byacc or $comp"
16032 fi
16033 if $test -f "$bison$_exe"; then
16034         comp="$comp or bison -y"
16035 fi
16036 rp="Which compiler compiler ($comp) shall I use?"
16037 . ./myread
16038 yacc="$ans"
16039 case "$yacc" in
16040 *bis*)
16041         case "$yacc" in
16042         *-y*) ;;
16043         *)
16044                 yacc="$yacc -y"
16045                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
16046                 ;;
16047         esac
16048         ;;
16049 esac
16050
16051 : see if this is a fp.h system
16052 set fp.h i_fp
16053 eval $inhdr
16054
16055 : see if this is a fp_class.h system
16056 set fp_class.h i_fp_class
16057 eval $inhdr
16058
16059 : see if this is a ieeefp.h system
16060 case "$i_ieeefp" in
16061 '' ) set ieeefp.h i_ieeefp
16062      eval $inhdr
16063      ;;
16064 esac
16065
16066 : see if this is a libutil.h system
16067 set libutil.h i_libutil
16068 eval $inhdr
16069
16070 : see if locale.h is available
16071 set locale.h i_locale
16072 eval $inhdr
16073
16074 : see if mach cthreads are available
16075 if test "X$usethreads" = "X$define"; then
16076         set mach/cthreads.h i_machcthr
16077         eval $inhdr
16078 else
16079         i_machcthr="$undef"
16080 fi
16081
16082
16083
16084 : see if this is a math.h system
16085 set math.h i_math
16086 eval $inhdr
16087
16088 : see if this is a mntent.h system
16089 set mntent.h i_mntent
16090 eval $inhdr
16091
16092 : see if ndbm.h is available
16093 set ndbm.h t_ndbm
16094 eval $inhdr
16095
16096 case "$t_ndbm" in
16097 $undef)
16098     # Some Linux distributions such as RedHat 7.1 put the
16099     # ndbm.h header in /usr/include/gdbm/ndbm.h.
16100     if $test -f /usr/include/gdbm/ndbm.h; then
16101         echo '<gdbm/ndbm.h> found.'
16102         ccflags="$ccflags -I/usr/include/gdbm"
16103         cppflags="$cppflags -I/usr/include/gdbm"
16104         t_ndbm=$define
16105     fi
16106     ;;
16107 esac
16108
16109 case "$t_ndbm" in
16110 $define)
16111         : see if dbm_open exists
16112         set dbm_open d_dbm_open
16113         eval $inlibc
16114         case "$d_dbm_open" in
16115         $undef)
16116                 t_ndbm="$undef"
16117                 echo "We won't be including <ndbm.h>"
16118                 ;;
16119         esac
16120         ;;
16121 esac
16122 val="$t_ndbm"
16123 set i_ndbm
16124 eval $setvar
16125
16126 : see if net/errno.h is available
16127 val=''
16128 set net/errno.h val
16129 eval $inhdr
16130
16131 : Unfortunately, it causes problems on some systems.  Arrgh.
16132 case "$val" in
16133 $define)
16134         cat > try.c <<'EOM'
16135 #include <stdio.h>
16136 #include <errno.h>
16137 #include <net/errno.h>
16138 int func()
16139 {
16140         return ENOTSOCK;
16141 }
16142 EOM
16143         if $cc $ccflags -c try.c >/dev/null 2>&1; then
16144                 echo "We'll be including <net/errno.h>." >&4
16145         else
16146                 echo "We won't be including <net/errno.h>." >&4
16147                 val="$undef"
16148         fi
16149         $rm -f try.* try
16150         ;;
16151 esac
16152 set i_neterrno
16153 eval $setvar
16154
16155 : see if netinet/tcp.h is available
16156 set netinet/tcp.h i_netinettcp
16157 eval $inhdr
16158
16159 : see if this is a poll.h system
16160 set poll.h i_poll
16161 eval $inhdr
16162
16163 : see if this is a prot.h system
16164 set prot.h i_prot
16165 eval $inhdr
16166
16167 echo " "
16168 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
16169 $cat <<'EOSH' > Cppsym.know
16170 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
16171 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
16172 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
16173 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
16174 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
16175 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
16176 bull c cadmus clipper CMU COFF COMPILER_VERSION
16177 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
16178 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
16179 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
16180 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
16181 GLIBC GLIBC_MINOR
16182 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
16183 H3050R H3050RX hbullx20 hcx host_mips
16184 hp200 hp300 hp700 HP700 hp800 hp9000
16185 hp9000s200 hp9000s300 hp9000s400 hp9000s500
16186 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
16187 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
16188 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
16189 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
16190 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
16191 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
16192 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
16193 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
16194 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
16195 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
16196 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
16197 MATH_HAS_NO_SIDE_EFFECTS
16198 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
16199 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
16200 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
16201 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
16202 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
16203 NetBSD news1500 news1700 news1800 news1900 news3700
16204 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
16205 ns32016 ns32332 ns32k nsc32000
16206 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
16207 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
16208 pc532 pdp11 PGC PIC plexus PORTAR posix
16209 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
16210 POSIX_C_SOURCE POSIX_SOURCE POWER
16211 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
16212 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
16213 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
16214 sony sony_news sonyrisc sparc sparclite spectrum
16215 stardent stdc STDC_EXT stratos sun sun3 sun386
16216 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
16217 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
16218 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
16219 sysV68 sysV88 Tek4132 Tek4300 titan
16220 TM3200 TM5400 TM5600
16221 tower tower32 tower32_200 tower32_600 tower32_700
16222 tower32_800 tower32_850 tss
16223 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
16224 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
16225 unix UNIX95 UNIX99 unixpc unos
16226 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
16227 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
16228 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
16229 USGr4 USGr4_2
16230 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
16231 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
16232 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
16233 z8000
16234 EOSH
16235 # Maybe put other stuff here too.
16236 cat <<EOSH >>Cppsym.know
16237 $osname
16238 EOSH
16239 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
16240 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
16241 $cat Cppsym.know > Cppsym.c
16242 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
16243 $rm -f Cppsym.a Cppsym.b Cppsym.c
16244 cat <<EOSH > Cppsym
16245 $startsh
16246 if $test \$# -gt 0; then
16247     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
16248     if $test -s Cppsym.got; then
16249         $rm -f Cppsym.got
16250         exit 0
16251     fi
16252     $rm -f Cppsym.got
16253     exit 1
16254 else
16255     $tr " " "$trnl" | ./Cppsym.try
16256     exit 0
16257 fi
16258 EOSH
16259 chmod +x Cppsym
16260 $eunicefix Cppsym
16261 cat <<EOSH > Cppsym.try
16262 $startsh
16263 cat <<'EOCP' > try.c
16264 #include <stdio.h>
16265 int main() {
16266 EOCP
16267 $awk \\
16268 EOSH
16269 cat <<'EOSH' >> Cppsym.try
16270 'length($1) > 0 {
16271     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
16272     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
16273     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
16274     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
16275 }'       >> try.c
16276 echo 'return 0;}' >> try.c
16277 EOSH
16278 cat <<EOSH >> Cppsym.try
16279 ccflags="$ccflags"
16280 case "$osname-$gccversion" in
16281 irix-) ccflags="\$ccflags -woff 1178" ;;
16282 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
16283 esac
16284 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
16285 EOSH
16286 chmod +x Cppsym.try
16287 $eunicefix Cppsym.try
16288 ./Cppsym < Cppsym.know > Cppsym.true
16289 : now check the C compiler for additional symbols
16290 postprocess_cc_v=''
16291 case "$osname" in
16292 aix) postprocess_cc_v="|$tr , ' '" ;;
16293 esac
16294 $cat >ccsym <<EOS
16295 $startsh
16296 $cat >tmp.c <<EOF
16297 extern int foo;
16298 EOF
16299 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
16300 do
16301         case "\$i" in
16302         -D*) echo "\$i" | $sed 's/^-D//';;
16303         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
16304         esac
16305 done
16306 $rm -f try.c
16307 EOS
16308 postprocess_cc_v=''
16309 chmod +x ccsym
16310 $eunicefix ccsym
16311 ./ccsym > ccsym1.raw
16312 if $test -s ccsym1.raw; then
16313        $sort ccsym1.raw | $uniq >ccsym.raw
16314 else
16315        mv ccsym1.raw ccsym.raw
16316 fi
16317
16318 $awk '/\=/ { print $0; next }
16319         { print $0"=1" }' ccsym.raw >ccsym.list
16320 $awk '/\=/ { print $0; next }
16321         { print $0"=1" }' Cppsym.true >ccsym.true
16322 $comm -13 ccsym.true ccsym.list >ccsym.own
16323 $comm -12 ccsym.true ccsym.list >ccsym.com
16324 $comm -23 ccsym.true ccsym.list >ccsym.cpp
16325 also=''
16326 if $test -z ccsym.raw; then
16327         echo "Your C compiler doesn't seem to define any symbols!" >&4
16328         echo " "
16329         echo "However, your C preprocessor defines the following symbols:"
16330         $cat Cppsym.true
16331         ccsymbols=''
16332         cppsymbols=`$cat Cppsym.true`
16333         cppsymbols=`echo $cppsymbols`
16334         cppccsymbols="$cppsymbols"
16335 else
16336         if $test -s ccsym.com; then
16337                 echo "Your C compiler and pre-processor define these symbols:"
16338                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
16339                 also='also '
16340                 symbols='ones'
16341                 cppccsymbols=`$cat ccsym.com`
16342                 cppccsymbols=`echo $cppccsymbols`
16343                 $test "$silent" || sleep 1
16344         fi
16345         if $test -s ccsym.cpp; then
16346                 $test "$also" && echo " "
16347                 echo "Your C pre-processor ${also}defines the following symbols:"
16348                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
16349                 also='further '
16350                 cppsymbols=`$cat ccsym.cpp`
16351                 cppsymbols=`echo $cppsymbols`
16352                 $test "$silent" || sleep 1
16353         fi
16354         if $test -s ccsym.own; then
16355                 $test "$also" && echo " "
16356                 echo "Your C compiler ${also}defines the following cpp symbols:"
16357                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
16358                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
16359                 ccsymbols=`$cat ccsym.own`
16360                 ccsymbols=`echo $ccsymbols`
16361                 $test "$silent" || sleep 1
16362         fi
16363 fi
16364
16365 : see if this is a termio system
16366 val="$undef"
16367 val2="$undef"
16368 val3="$undef"
16369 if $test `./findhdr termios.h`; then
16370         set tcsetattr i_termios
16371         eval $inlibc
16372         val3="$i_termios"
16373 fi
16374 echo " "
16375 case "$val3" in
16376 "$define") echo "You have POSIX termios.h... good!" >&4;;
16377 *) if ./Cppsym pyr; then
16378                 case "`/bin/universe`" in
16379                 ucb) if $test `./findhdr sgtty.h`; then
16380                                 val2="$define"
16381                                 echo "<sgtty.h> found." >&4
16382                         else
16383                                 echo "System is pyramid with BSD universe."
16384                                 echo "<sgtty.h> not found--you could have problems." >&4
16385                         fi;;
16386                 *) if $test `./findhdr termio.h`; then
16387                                 val="$define"
16388                                 echo "<termio.h> found." >&4
16389                         else
16390                                 echo "System is pyramid with USG universe."
16391                                 echo "<termio.h> not found--you could have problems." >&4
16392                         fi;;
16393                 esac
16394         elif ./usg; then
16395                 if $test `./findhdr termio.h`; then
16396                         echo "<termio.h> found." >&4
16397                         val="$define"
16398                 elif $test `./findhdr sgtty.h`; then
16399                         echo "<sgtty.h> found." >&4
16400                         val2="$define"
16401                 else
16402 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
16403                 fi
16404         else
16405                 if $test `./findhdr sgtty.h`; then
16406                         echo "<sgtty.h> found." >&4
16407                         val2="$define"
16408                 elif $test `./findhdr termio.h`; then
16409                         echo "<termio.h> found." >&4
16410                         val="$define"
16411                 else
16412 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
16413                 fi
16414         fi;;
16415 esac
16416 set i_termio; eval $setvar
16417 val=$val2; set i_sgtty; eval $setvar
16418 val=$val3; set i_termios; eval $setvar
16419
16420 : see if this is a shadow.h system
16421 set shadow.h i_shadow
16422 eval $inhdr
16423
16424 : see if stddef is available
16425 set stddef.h i_stddef
16426 eval $inhdr
16427
16428 : see if this is a sunmath.h system
16429 set sunmath.h i_sunmath
16430 eval $inhdr
16431
16432 : see if sys/access.h is available
16433 set sys/access.h i_sysaccess
16434 eval $inhdr
16435
16436 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
16437 set sys/filio.h i_sysfilio
16438 eval $inhdr
16439 echo " "
16440 if $test `./findhdr sys/ioctl.h`; then
16441         val="$define"
16442         echo '<sys/ioctl.h> found.' >&4
16443 else
16444         val="$undef"
16445         if $test $i_sysfilio = "$define"; then
16446             echo '<sys/ioctl.h> NOT found.' >&4
16447         else
16448                 $test $i_sgtty = "$define" && xxx="sgtty.h"
16449                 $test $i_termio = "$define" && xxx="termio.h"
16450                 $test $i_termios = "$define" && xxx="termios.h"
16451 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
16452         fi
16453 fi
16454 set i_sysioctl
16455 eval $setvar
16456
16457 : see if socket ioctl defs are in sys/sockio.h
16458 echo " "
16459 xxx=`./findhdr sys/sockio.h`
16460 if $test "$xxx"; then
16461         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
16462                 val="$define"
16463                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
16464         else
16465                 val="$undef"
16466                 echo "No socket ioctls found in <sys/sockio.h>." >&4
16467         fi
16468 else
16469         val="$undef"
16470         $cat <<EOM
16471 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
16472 EOM
16473 fi
16474 set i_syssockio
16475 eval $setvar
16476
16477
16478 : see if this is a syslog.h system
16479 set syslog.h i_syslog
16480 eval $inhdr
16481
16482
16483 : see if this is a sys/mode.h system
16484 set sys/mode.h i_sysmode
16485 eval $inhdr
16486
16487 : see if sys/resource.h has to be included
16488 set sys/resource.h i_sysresrc
16489 eval $inhdr
16490
16491 : see if sys/security.h is available
16492 set sys/security.h i_syssecrt
16493 eval $inhdr
16494
16495 : see if this is a sys/statvfs.h system
16496 set sys/statvfs.h i_sysstatvfs
16497 eval $inhdr
16498
16499 : see if this is a sys/un.h system
16500 set sys/un.h i_sysun
16501 eval $inhdr
16502
16503
16504 : see if this is a sys/utsname.h system
16505 set sys/utsname.h i_sysutsname
16506 eval $inhdr
16507
16508 : see if this is a syswait system
16509 set sys/wait.h i_syswait
16510 eval $inhdr
16511
16512 : see if this is a ustat.h system
16513 set ustat.h i_ustat
16514 eval $inhdr
16515
16516 : see if this is an utime system
16517 set utime.h i_utime
16518 eval $inhdr
16519
16520 : see if this is a values.h system
16521 set values.h i_values
16522 eval $inhdr
16523
16524 : see if this is a vfork system
16525 case "$d_vfork" in
16526 "$define")
16527         set vfork.h i_vfork
16528         eval $inhdr
16529         ;;
16530 *)
16531         i_vfork="$undef"
16532         ;;
16533 esac
16534
16535 : see if gdbm.h is available
16536 set gdbm.h t_gdbm
16537 eval $inhdr
16538 case "$t_gdbm" in
16539 $define)
16540         : see if gdbm_open exists
16541         set gdbm_open d_gdbm_open
16542         eval $inlibc
16543         case "$d_gdbm_open" in
16544         $undef)
16545                 t_gdbm="$undef"
16546                 echo "We won't be including <gdbm.h>"
16547                 ;;
16548         esac
16549         ;;
16550 esac
16551 val="$t_gdbm"
16552 set i_gdbm
16553 eval $setvar
16554
16555 echo " "
16556 echo "Looking for extensions..." >&4
16557 : If we are using the old config.sh, known_extensions may contain
16558 : old or inaccurate or duplicate values.
16559 known_extensions=''
16560 nonxs_extensions=''
16561 : We do not use find because it might not be available.
16562 : We do not just use MANIFEST because the user may have dropped
16563 : some additional extensions into the source tree and expect them
16564 : to be built.
16565
16566 : Function to recursively find available extensions, ignoring DynaLoader
16567 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
16568 find_extensions='
16569     for xxx in *; do
16570        case "$xxx" in
16571            DynaLoader|dynaload) ;;
16572            *)
16573            if $test -f $xxx/$xxx.xs; then
16574                known_extensions="$known_extensions $1$xxx";
16575            elif $test -f $xxx/Makefile.PL; then
16576                nonxs_extensions="$nonxs_extensions $1$xxx";
16577            else
16578                if $test -d $xxx -a $# -lt 10; then
16579                    set $1$xxx/ $*;
16580                    cd "$xxx";
16581                    eval $find_extensions;
16582                    cd ..;
16583                    shift;
16584                fi;
16585            fi
16586            ;;
16587        esac;
16588     done'
16589 tdir=`pwd`
16590 cd "$rsrc/ext"
16591 set X
16592 shift
16593 eval $find_extensions
16594 # Special case:  Add in threads/shared since it is not picked up by the
16595 # recursive find above (and adding in general recursive finding breaks
16596 # SDBM_File/sdbm).  A.D.  10/25/2001.
16597 known_extensions="$known_extensions threads/shared"
16598 set X $nonxs_extensions
16599 shift
16600 nonxs_extensions="$*"
16601 set X $known_extensions
16602 shift
16603 known_extensions="$*"
16604 cd "$tdir"
16605
16606 : Now see which are supported on this system.
16607 avail_ext=''
16608 for xxx in $known_extensions ; do
16609         case "$xxx" in
16610         DB_File|db_file)
16611                 case "$i_db" in
16612                 $define) avail_ext="$avail_ext $xxx" ;;
16613                 esac
16614                 ;;
16615         GDBM_File|gdbm_fil)
16616                 case "$i_gdbm" in 
16617                 $define) avail_ext="$avail_ext $xxx" ;;
16618                 esac
16619                 ;;
16620         I18N/Langinfo|i18n_lan)
16621                 case "$i_langinfo$d_nl_langinfo" in 
16622                 $define$define) avail_ext="$avail_ext $xxx" ;;
16623                 esac
16624                 ;;
16625         NDBM_File|ndbm_fil)
16626                 case "$i_ndbm" in
16627                 $define)
16628                     case "$osname-$use64bitint" in
16629                     cygwin-*|hpux-define)
16630                         case "$libs" in
16631                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
16632                         esac
16633                         ;;
16634                     *) avail_ext="$avail_ext $xxx" ;;
16635                     esac
16636                     ;;
16637                 esac
16638                 ;;
16639         ODBM_File|odbm_fil) 
16640                 case "${i_dbm}${i_rpcsvcdbm}" in
16641                 *"${define}"*)
16642                     case "$osname-$use64bitint" in
16643                     cygwin-*|hpux-define)
16644                         case "$libs" in
16645                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
16646                         esac
16647                         ;;
16648                     *) avail_ext="$avail_ext $xxx" ;;
16649                     esac
16650                     ;;
16651                 esac
16652                 ;;
16653         POSIX|posix)
16654                 case "$useposix" in
16655                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16656                 esac
16657                 ;;
16658         Opcode|opcode)
16659                 case "$useopcode" in
16660                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16661                 esac
16662                 ;;
16663         Socket|socket)
16664                 case "$d_socket" in 
16665                 true|$define|y)
16666                     case "$osname" in
16667                     beos) ;; # not unless BONE
16668                     *) avail_ext="$avail_ext $xxx" ;;
16669                     esac
16670                     ;;
16671                 esac
16672                 ;;
16673         Sys/Syslog|sys/syslog)
16674                 : XXX syslog requires socket
16675                 case "$d_socket" in 
16676                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16677                 esac
16678                 ;;
16679         Thread|thread)
16680                 case "$usethreads" in
16681                 true|$define|y)
16682                         case "$useithreads" in
16683                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
16684                         esac
16685                 esac
16686                 ;;
16687         threads|threads/shared)
16688                 case "$usethreads" in
16689                 true|$define|y)
16690                         case "$useithreads" in
16691                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
16692                         esac
16693                 esac
16694                 ;;
16695         IPC/SysV|ipc/sysv)
16696                 : XXX Do we need a useipcsysv variable here
16697                 case "${d_msg}${d_sem}${d_shm}" in 
16698                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
16699                 esac
16700                 ;;
16701         *)      avail_ext="$avail_ext $xxx"
16702                 ;;
16703         esac
16704 done
16705
16706 set X $avail_ext
16707 shift
16708 avail_ext="$*"
16709
16710 : Now see which nonxs extensions are supported on this system.
16711 : For now assume all are.
16712 nonxs_ext=''
16713 for xxx in $nonxs_extensions ; do
16714         case "$xxx" in
16715         *)      nonxs_ext="$nonxs_ext $xxx"
16716                 ;;
16717         esac
16718 done
16719
16720 set X $nonxs_ext
16721 shift
16722 nonxs_ext="$*"
16723
16724 case $usedl in
16725 $define)
16726         $cat <<EOM
16727 A number of extensions are supplied with $package.  You may choose to
16728 compile these extensions for dynamic loading (the default), compile
16729 them into the $package executable (static loading), or not include
16730 them at all.  Answer "none" to include no extensions.
16731 Note that DynaLoader is always built and need not be mentioned here.
16732
16733 EOM
16734         case "$dynamic_ext" in
16735         '') dflt="$avail_ext" ;;
16736         *)      dflt="$dynamic_ext"
16737                 # Perhaps we are reusing an old out-of-date config.sh.
16738                 case "$hint" in
16739                 previous)
16740                         if test X"$dynamic_ext" != X"$avail_ext"; then
16741                                 $cat <<EOM
16742 NOTICE:  Your previous config.sh list may be incorrect. 
16743 The extensions now available to you are 
16744         ${avail_ext}
16745 but the default list from your previous config.sh is
16746         ${dynamic_ext} 
16747
16748 EOM
16749                         fi
16750                         ;;
16751                 esac
16752                 ;;
16753         esac
16754         case "$dflt" in
16755         '')     dflt=none;;
16756         esac
16757         rp="What extensions do you wish to load dynamically?"
16758         . ./myread
16759         case "$ans" in
16760         none) dynamic_ext=' ' ;;
16761         *) dynamic_ext="$ans" ;;
16762         esac
16763
16764         case "$static_ext" in
16765         '')
16766                 : Exclude those already listed in dynamic linking
16767                 dflt=''
16768                 for xxx in $avail_ext; do
16769                         case " $dynamic_ext " in
16770                         *" $xxx "*) ;;
16771                         *) dflt="$dflt $xxx" ;;
16772                         esac
16773                 done
16774                 set X $dflt
16775                 shift
16776                 dflt="$*"
16777                 ;;
16778         *)  dflt="$static_ext" 
16779                 ;;
16780         esac
16781
16782         case "$dflt" in
16783         '')     dflt=none;;
16784         esac
16785         rp="What extensions do you wish to load statically?"
16786         . ./myread
16787         case "$ans" in
16788         none) static_ext=' ' ;;
16789         *) static_ext="$ans" ;;
16790         esac
16791         ;;
16792 *)
16793         $cat <<EOM
16794 A number of extensions are supplied with $package.  Answer "none" 
16795 to include no extensions. 
16796 Note that DynaLoader is always built and need not be mentioned here.
16797
16798 EOM
16799         case "$static_ext" in
16800         '') dflt="$avail_ext" ;;
16801         *)      dflt="$static_ext"
16802                 # Perhaps we are reusing an old out-of-date config.sh.
16803                 case "$hint" in
16804                 previous)
16805                         if test X"$static_ext" != X"$avail_ext"; then
16806                                 $cat <<EOM
16807 NOTICE:  Your previous config.sh list may be incorrect. 
16808 The extensions now available to you are 
16809         ${avail_ext}
16810 but the default list from your previous config.sh is
16811         ${static_ext} 
16812
16813 EOM
16814                         fi
16815                         ;;
16816                 esac
16817                 ;;
16818         esac
16819         : Exclude those that are not xs extensions
16820         case "$dflt" in
16821         '')     dflt=none;;
16822         esac
16823         rp="What extensions do you wish to include?"
16824         . ./myread
16825         case "$ans" in
16826         none) static_ext=' ' ;;
16827         *) static_ext="$ans" ;;
16828         esac
16829         ;;
16830 esac
16831
16832 set X $dynamic_ext $static_ext $nonxs_ext
16833 shift
16834 extensions="$*"
16835
16836 : Remove libraries needed only for extensions
16837 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16838 : The exception is SunOS 4.x, which needs them.
16839 case "${osname}X${osvers}" in
16840 sunos*X4*)
16841     perllibs="$libs"
16842     ;;
16843 *) case "$usedl" in
16844     $define|true|[yY]*)
16845             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16846             shift
16847             perllibs="$*"
16848             ;;
16849     *)  perllibs="$libs"
16850             ;;
16851     esac
16852     ;;
16853 esac
16854
16855 : Remove build directory name from cppstdin so it can be used from
16856 : either the present location or the final installed location.
16857 echo " "
16858 : Get out of the UU directory to get correct path name.
16859 cd ..
16860 case "$cppstdin" in
16861 `pwd`/cppstdin)
16862         echo "Stripping down cppstdin path name"
16863         cppstdin=cppstdin
16864         ;;
16865 esac
16866 cd UU
16867
16868 : end of configuration questions
16869 echo " "
16870 echo "End of configuration questions."
16871 echo " "
16872
16873 : back to where it started
16874 if test -d ../UU; then
16875         cd ..
16876 fi
16877
16878 : configuration may be patched via a 'config.arch' file
16879 if $test -f config.arch; then
16880         echo "I see a config.arch file, loading it."
16881         . ./config.arch
16882 fi
16883
16884 : configuration may be patched via a 'config.over' file
16885 if $test -f config.over; then
16886         echo " "
16887         dflt=y
16888         rp='I see a config.over file.  Do you wish to load it?'
16889         . UU/myread
16890         case "$ans" in
16891         n*) echo "OK, I'll ignore it.";;
16892         *)      . ./config.over
16893                 echo "Configuration override changes have been loaded."
16894                 ;;
16895         esac
16896 fi
16897
16898 : in case they want portability, strip down executable paths
16899 case "$d_portable" in
16900 "$define")
16901         echo " "
16902         echo "Stripping down executable paths..." >&4
16903         for file in $loclist $trylist; do
16904                 eval temp=\$$file
16905                 eval $file=`basename $temp`
16906         done
16907         ;;
16908 esac
16909
16910 : create config.sh file
16911 echo " "
16912 echo "Creating config.sh..." >&4
16913 $spitshell <<EOT >config.sh
16914 $startsh
16915 #
16916 # This file was produced by running the Configure script. It holds all the
16917 # definitions figured out by Configure. Should you modify one of these values,
16918 # do not forget to propagate your changes by running "Configure -der". You may
16919 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16920 #
16921
16922 # Package name      : $package
16923 # Source directory  : $src
16924 # Configuration time: $cf_time
16925 # Configured by     : $cf_by
16926 # Target system     : $myuname
16927
16928 Author='$Author'
16929 Date='$Date'
16930 Header='$Header'
16931 Id='$Id'
16932 Locker='$Locker'
16933 Log='$Log'
16934 Mcc='$Mcc'
16935 RCSfile='$RCSfile'
16936 Revision='$Revision'
16937 Source='$Source'
16938 State='$State'
16939 _a='$_a'
16940 _exe='$_exe'
16941 _o='$_o'
16942 afs='$afs'
16943 afsroot='$afsroot'
16944 alignbytes='$alignbytes'
16945 ansi2knr='$ansi2knr'
16946 aphostname='$aphostname'
16947 api_revision='$api_revision'
16948 api_subversion='$api_subversion'
16949 api_version='$api_version'
16950 api_versionstring='$api_versionstring'
16951 ar='$ar'
16952 archlib='$archlib'
16953 archlibexp='$archlibexp'
16954 archname64='$archname64'
16955 archname='$archname'
16956 archobjs='$archobjs'
16957 awk='$awk'
16958 baserev='$baserev'
16959 bash='$bash'
16960 bin='$bin'
16961 bincompat5005='$bincompat5005'
16962 binexp='$binexp'
16963 bison='$bison'
16964 byacc='$byacc'
16965 byteorder='$byteorder'
16966 c='$c'
16967 castflags='$castflags'
16968 cat='$cat'
16969 cc='$cc'
16970 cccdlflags='$cccdlflags'
16971 ccdlflags='$ccdlflags'
16972 ccflags='$ccflags'
16973 ccflags_uselargefiles='$ccflags_uselargefiles'
16974 ccname='$ccname'
16975 ccsymbols='$ccsymbols'
16976 ccversion='$ccversion'
16977 cf_by='$cf_by'
16978 cf_email='$cf_email'
16979 cf_time='$cf_time'
16980 charsize='$charsize'
16981 chgrp='$chgrp'
16982 chmod='$chmod'
16983 chown='$chown'
16984 clocktype='$clocktype'
16985 comm='$comm'
16986 compress='$compress'
16987 contains='$contains'
16988 cp='$cp'
16989 cpio='$cpio'
16990 cpp='$cpp'
16991 cpp_stuff='$cpp_stuff'
16992 cppccsymbols='$cppccsymbols'
16993 cppflags='$cppflags'
16994 cpplast='$cpplast'
16995 cppminus='$cppminus'
16996 cpprun='$cpprun'
16997 cppstdin='$cppstdin'
16998 cppsymbols='$cppsymbols'
16999 cryptlib='$cryptlib'
17000 csh='$csh'
17001 d_Gconvert='$d_Gconvert'
17002 d_PRIEUldbl='$d_PRIEUldbl'
17003 d_PRIFUldbl='$d_PRIFUldbl'
17004 d_PRIGUldbl='$d_PRIGUldbl'
17005 d_PRIXU64='$d_PRIXU64'
17006 d_PRId64='$d_PRId64'
17007 d_PRIeldbl='$d_PRIeldbl'
17008 d_PRIfldbl='$d_PRIfldbl'
17009 d_PRIgldbl='$d_PRIgldbl'
17010 d_PRIi64='$d_PRIi64'
17011 d_PRIo64='$d_PRIo64'
17012 d_PRIu64='$d_PRIu64'
17013 d_PRIx64='$d_PRIx64'
17014 d_SCNfldbl='$d_SCNfldbl'
17015 d__fwalk='$d__fwalk'
17016 d_access='$d_access'
17017 d_accessx='$d_accessx'
17018 d_alarm='$d_alarm'
17019 d_archlib='$d_archlib'
17020 d_atolf='$d_atolf'
17021 d_atoll='$d_atoll'
17022 d_attribut='$d_attribut'
17023 d_bcmp='$d_bcmp'
17024 d_bcopy='$d_bcopy'
17025 d_bincompat5005='$d_bincompat5005'
17026 d_bsd='$d_bsd'
17027 d_bsdgetpgrp='$d_bsdgetpgrp'
17028 d_bsdsetpgrp='$d_bsdsetpgrp'
17029 d_bzero='$d_bzero'
17030 d_casti32='$d_casti32'
17031 d_castneg='$d_castneg'
17032 d_charvspr='$d_charvspr'
17033 d_chown='$d_chown'
17034 d_chroot='$d_chroot'
17035 d_chsize='$d_chsize'
17036 d_class='$d_class'
17037 d_closedir='$d_closedir'
17038 d_cmsghdr_s='$d_cmsghdr_s'
17039 d_const='$d_const'
17040 d_crypt='$d_crypt'
17041 d_csh='$d_csh'
17042 d_cuserid='$d_cuserid'
17043 d_dbl_dig='$d_dbl_dig'
17044 d_dbminitproto='$d_dbminitproto'
17045 d_difftime='$d_difftime'
17046 d_dirfd='$d_dirfd'
17047 d_dirnamlen='$d_dirnamlen'
17048 d_dlerror='$d_dlerror'
17049 d_dlopen='$d_dlopen'
17050 d_dlsymun='$d_dlsymun'
17051 d_dosuid='$d_dosuid'
17052 d_drand48proto='$d_drand48proto'
17053 d_dup2='$d_dup2'
17054 d_eaccess='$d_eaccess'
17055 d_endgrent='$d_endgrent'
17056 d_endhent='$d_endhent'
17057 d_endnent='$d_endnent'
17058 d_endpent='$d_endpent'
17059 d_endpwent='$d_endpwent'
17060 d_endsent='$d_endsent'
17061 d_eofnblk='$d_eofnblk'
17062 d_eunice='$d_eunice'
17063 d_fchdir='$d_fchdir'
17064 d_fchmod='$d_fchmod'
17065 d_fchown='$d_fchown'
17066 d_fcntl='$d_fcntl'
17067 d_fcntl_can_lock='$d_fcntl_can_lock'
17068 d_fd_macros='$d_fd_macros'
17069 d_fd_set='$d_fd_set'
17070 d_fds_bits='$d_fds_bits'
17071 d_fgetpos='$d_fgetpos'
17072 d_finite='$d_finite'
17073 d_finitel='$d_finitel'
17074 d_flexfnam='$d_flexfnam'
17075 d_flock='$d_flock'
17076 d_flockproto='$d_flockproto'
17077 d_fork='$d_fork'
17078 d_fp_class='$d_fp_class'
17079 d_fpathconf='$d_fpathconf'
17080 d_fpclass='$d_fpclass'
17081 d_fpclassify='$d_fpclassify'
17082 d_fpclassl='$d_fpclassl'
17083 d_fpos64_t='$d_fpos64_t'
17084 d_frexpl='$d_frexpl'
17085 d_fs_data_s='$d_fs_data_s'
17086 d_fseeko='$d_fseeko'
17087 d_fsetpos='$d_fsetpos'
17088 d_fstatfs='$d_fstatfs'
17089 d_fstatvfs='$d_fstatvfs'
17090 d_fsync='$d_fsync'
17091 d_ftello='$d_ftello'
17092 d_ftime='$d_ftime'
17093 d_getcwd='$d_getcwd'
17094 d_getespwnam='$d_getespwnam'
17095 d_getfsstat='$d_getfsstat'
17096 d_getgrent='$d_getgrent'
17097 d_getgrps='$d_getgrps'
17098 d_gethbyaddr='$d_gethbyaddr'
17099 d_gethbyname='$d_gethbyname'
17100 d_gethent='$d_gethent'
17101 d_gethname='$d_gethname'
17102 d_gethostprotos='$d_gethostprotos'
17103 d_getitimer='$d_getitimer'
17104 d_getlogin='$d_getlogin'
17105 d_getmnt='$d_getmnt'
17106 d_getmntent='$d_getmntent'
17107 d_getnbyaddr='$d_getnbyaddr'
17108 d_getnbyname='$d_getnbyname'
17109 d_getnent='$d_getnent'
17110 d_getnetprotos='$d_getnetprotos'
17111 d_getpagsz='$d_getpagsz'
17112 d_getpbyname='$d_getpbyname'
17113 d_getpbynumber='$d_getpbynumber'
17114 d_getpent='$d_getpent'
17115 d_getpgid='$d_getpgid'
17116 d_getpgrp2='$d_getpgrp2'
17117 d_getpgrp='$d_getpgrp'
17118 d_getppid='$d_getppid'
17119 d_getprior='$d_getprior'
17120 d_getprotoprotos='$d_getprotoprotos'
17121 d_getprpwnam='$d_getprpwnam'
17122 d_getpwent='$d_getpwent'
17123 d_getsbyname='$d_getsbyname'
17124 d_getsbyport='$d_getsbyport'
17125 d_getsent='$d_getsent'
17126 d_getservprotos='$d_getservprotos'
17127 d_getspnam='$d_getspnam'
17128 d_gettimeod='$d_gettimeod'
17129 d_gnulibc='$d_gnulibc'
17130 d_grpasswd='$d_grpasswd'
17131 d_hasmntopt='$d_hasmntopt'
17132 d_htonl='$d_htonl'
17133 d_index='$d_index'
17134 d_inetaton='$d_inetaton'
17135 d_int64_t='$d_int64_t'
17136 d_isascii='$d_isascii'
17137 d_isfinite='$d_isfinite'
17138 d_isinf='$d_isinf'
17139 d_isnan='$d_isnan'
17140 d_isnanl='$d_isnanl'
17141 d_killpg='$d_killpg'
17142 d_lchown='$d_lchown'
17143 d_ldbl_dig='$d_ldbl_dig'
17144 d_link='$d_link'
17145 d_locconv='$d_locconv'
17146 d_lockf='$d_lockf'
17147 d_longdbl='$d_longdbl'
17148 d_longlong='$d_longlong'
17149 d_lseekproto='$d_lseekproto'
17150 d_lstat='$d_lstat'
17151 d_madvise='$d_madvise'
17152 d_mblen='$d_mblen'
17153 d_mbstowcs='$d_mbstowcs'
17154 d_mbtowc='$d_mbtowc'
17155 d_memchr='$d_memchr'
17156 d_memcmp='$d_memcmp'
17157 d_memcpy='$d_memcpy'
17158 d_memmove='$d_memmove'
17159 d_memset='$d_memset'
17160 d_mkdir='$d_mkdir'
17161 d_mkdtemp='$d_mkdtemp'
17162 d_mkfifo='$d_mkfifo'
17163 d_mkstemp='$d_mkstemp'
17164 d_mkstemps='$d_mkstemps'
17165 d_mktime='$d_mktime'
17166 d_mmap='$d_mmap'
17167 d_modfl='$d_modfl'
17168 d_modfl_pow32_bug='$d_modfl_pow32_bug'
17169 d_mprotect='$d_mprotect'
17170 d_msg='$d_msg'
17171 d_msg_ctrunc='$d_msg_ctrunc'
17172 d_msg_dontroute='$d_msg_dontroute'
17173 d_msg_oob='$d_msg_oob'
17174 d_msg_peek='$d_msg_peek'
17175 d_msg_proxy='$d_msg_proxy'
17176 d_msgctl='$d_msgctl'
17177 d_msgget='$d_msgget'
17178 d_msghdr_s='$d_msghdr_s'
17179 d_msgrcv='$d_msgrcv'
17180 d_msgsnd='$d_msgsnd'
17181 d_msync='$d_msync'
17182 d_munmap='$d_munmap'
17183 d_mymalloc='$d_mymalloc'
17184 d_nice='$d_nice'
17185 d_nl_langinfo='$d_nl_langinfo'
17186 d_nv_preserves_uv='$d_nv_preserves_uv'
17187 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
17188 d_off64_t='$d_off64_t'
17189 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
17190 d_oldpthreads='$d_oldpthreads'
17191 d_oldsock='$d_oldsock'
17192 d_open3='$d_open3'
17193 d_pathconf='$d_pathconf'
17194 d_pause='$d_pause'
17195 d_perl_otherlibdirs='$d_perl_otherlibdirs'
17196 d_phostname='$d_phostname'
17197 d_pipe='$d_pipe'
17198 d_poll='$d_poll'
17199 d_portable='$d_portable'
17200 d_procselfexe='$d_procselfexe'
17201 d_pthread_atfork='$d_pthread_atfork'
17202 d_pthread_yield='$d_pthread_yield'
17203 d_pwage='$d_pwage'
17204 d_pwchange='$d_pwchange'
17205 d_pwclass='$d_pwclass'
17206 d_pwcomment='$d_pwcomment'
17207 d_pwexpire='$d_pwexpire'
17208 d_pwgecos='$d_pwgecos'
17209 d_pwpasswd='$d_pwpasswd'
17210 d_pwquota='$d_pwquota'
17211 d_qgcvt='$d_qgcvt'
17212 d_quad='$d_quad'
17213 d_readdir='$d_readdir'
17214 d_readlink='$d_readlink'
17215 d_readv='$d_readv'
17216 d_recvmsg='$d_recvmsg'
17217 d_rename='$d_rename'
17218 d_rewinddir='$d_rewinddir'
17219 d_rmdir='$d_rmdir'
17220 d_safebcpy='$d_safebcpy'
17221 d_safemcpy='$d_safemcpy'
17222 d_sanemcmp='$d_sanemcmp'
17223 d_sbrkproto='$d_sbrkproto'
17224 d_sched_yield='$d_sched_yield'
17225 d_scm_rights='$d_scm_rights'
17226 d_seekdir='$d_seekdir'
17227 d_select='$d_select'
17228 d_sem='$d_sem'
17229 d_semctl='$d_semctl'
17230 d_semctl_semid_ds='$d_semctl_semid_ds'
17231 d_semctl_semun='$d_semctl_semun'
17232 d_semget='$d_semget'
17233 d_semop='$d_semop'
17234 d_sendmsg='$d_sendmsg'
17235 d_setegid='$d_setegid'
17236 d_seteuid='$d_seteuid'
17237 d_setgrent='$d_setgrent'
17238 d_setgrps='$d_setgrps'
17239 d_sethent='$d_sethent'
17240 d_setitimer='$d_setitimer'
17241 d_setlinebuf='$d_setlinebuf'
17242 d_setlocale='$d_setlocale'
17243 d_setnent='$d_setnent'
17244 d_setpent='$d_setpent'
17245 d_setpgid='$d_setpgid'
17246 d_setpgrp2='$d_setpgrp2'
17247 d_setpgrp='$d_setpgrp'
17248 d_setprior='$d_setprior'
17249 d_setproctitle='$d_setproctitle'
17250 d_setpwent='$d_setpwent'
17251 d_setregid='$d_setregid'
17252 d_setresgid='$d_setresgid'
17253 d_setresuid='$d_setresuid'
17254 d_setreuid='$d_setreuid'
17255 d_setrgid='$d_setrgid'
17256 d_setruid='$d_setruid'
17257 d_setsent='$d_setsent'
17258 d_setsid='$d_setsid'
17259 d_setvbuf='$d_setvbuf'
17260 d_sfio='$d_sfio'
17261 d_shm='$d_shm'
17262 d_shmat='$d_shmat'
17263 d_shmatprototype='$d_shmatprototype'
17264 d_shmctl='$d_shmctl'
17265 d_shmdt='$d_shmdt'
17266 d_shmget='$d_shmget'
17267 d_sigaction='$d_sigaction'
17268 d_sigprocmask='$d_sigprocmask'
17269 d_sigsetjmp='$d_sigsetjmp'
17270 d_sockatmark='$d_sockatmark'
17271 d_sockatmarkproto='$d_sockatmarkproto'
17272 d_socket='$d_socket'
17273 d_socklen_t='$d_socklen_t'
17274 d_sockpair='$d_sockpair'
17275 d_socks5_init='$d_socks5_init'
17276 d_sqrtl='$d_sqrtl'
17277 d_sresgproto='$d_sresgproto'
17278 d_sresuproto='$d_sresuproto'
17279 d_statblks='$d_statblks'
17280 d_statfs_f_flags='$d_statfs_f_flags'
17281 d_statfs_s='$d_statfs_s'
17282 d_statvfs='$d_statvfs'
17283 d_stdio_cnt_lval='$d_stdio_cnt_lval'
17284 d_stdio_ptr_lval='$d_stdio_ptr_lval'
17285 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
17286 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
17287 d_stdio_stream_array='$d_stdio_stream_array'
17288 d_stdiobase='$d_stdiobase'
17289 d_stdstdio='$d_stdstdio'
17290 d_strchr='$d_strchr'
17291 d_strcoll='$d_strcoll'
17292 d_strctcpy='$d_strctcpy'
17293 d_strerrm='$d_strerrm'
17294 d_strerror='$d_strerror'
17295 d_strftime='$d_strftime'
17296 d_strtod='$d_strtod'
17297 d_strtol='$d_strtol'
17298 d_strtold='$d_strtold'
17299 d_strtoll='$d_strtoll'
17300 d_strtoq='$d_strtoq'
17301 d_strtoul='$d_strtoul'
17302 d_strtoull='$d_strtoull'
17303 d_strtouq='$d_strtouq'
17304 d_strxfrm='$d_strxfrm'
17305 d_suidsafe='$d_suidsafe'
17306 d_symlink='$d_symlink'
17307 d_syscall='$d_syscall'
17308 d_syscallproto='$d_syscallproto'
17309 d_sysconf='$d_sysconf'
17310 d_sysernlst='$d_sysernlst'
17311 d_syserrlst='$d_syserrlst'
17312 d_system='$d_system'
17313 d_tcgetpgrp='$d_tcgetpgrp'
17314 d_tcsetpgrp='$d_tcsetpgrp'
17315 d_telldir='$d_telldir'
17316 d_telldirproto='$d_telldirproto'
17317 d_time='$d_time'
17318 d_times='$d_times'
17319 d_truncate='$d_truncate'
17320 d_tzname='$d_tzname'
17321 d_u32align='$d_u32align'
17322 d_ualarm='$d_ualarm'
17323 d_umask='$d_umask'
17324 d_uname='$d_uname'
17325 d_union_semun='$d_union_semun'
17326 d_unordered='$d_unordered'
17327 d_usleep='$d_usleep'
17328 d_usleepproto='$d_usleepproto'
17329 d_ustat='$d_ustat'
17330 d_vendorarch='$d_vendorarch'
17331 d_vendorbin='$d_vendorbin'
17332 d_vendorlib='$d_vendorlib'
17333 d_vfork='$d_vfork'
17334 d_void_closedir='$d_void_closedir'
17335 d_voidsig='$d_voidsig'
17336 d_voidtty='$d_voidtty'
17337 d_volatile='$d_volatile'
17338 d_vprintf='$d_vprintf'
17339 d_wait4='$d_wait4'
17340 d_waitpid='$d_waitpid'
17341 d_wcstombs='$d_wcstombs'
17342 d_wctomb='$d_wctomb'
17343 d_writev='$d_writev'
17344 d_xenix='$d_xenix'
17345 date='$date'
17346 db_hashtype='$db_hashtype'
17347 db_prefixtype='$db_prefixtype'
17348 db_version_major='$db_version_major'
17349 db_version_minor='$db_version_minor'
17350 db_version_patch='$db_version_patch'
17351 defvoidused='$defvoidused'
17352 direntrytype='$direntrytype'
17353 dlext='$dlext'
17354 dlsrc='$dlsrc'
17355 doublesize='$doublesize'
17356 drand01='$drand01'
17357 dynamic_ext='$dynamic_ext'
17358 eagain='$eagain'
17359 ebcdic='$ebcdic'
17360 echo='$echo'
17361 egrep='$egrep'
17362 emacs='$emacs'
17363 eunicefix='$eunicefix'
17364 exe_ext='$exe_ext'
17365 expr='$expr'
17366 extensions='$extensions'
17367 extras='$extras'
17368 fflushNULL='$fflushNULL'
17369 fflushall='$fflushall'
17370 find='$find'
17371 firstmakefile='$firstmakefile'
17372 flex='$flex'
17373 fpossize='$fpossize'
17374 fpostype='$fpostype'
17375 freetype='$freetype'
17376 from='$from'
17377 full_ar='$full_ar'
17378 full_csh='$full_csh'
17379 full_sed='$full_sed'
17380 gccosandvers='$gccosandvers'
17381 gccversion='$gccversion'
17382 gidformat='$gidformat'
17383 gidsign='$gidsign'
17384 gidsize='$gidsize'
17385 gidtype='$gidtype'
17386 glibpth='$glibpth'
17387 gmake='$gmake'
17388 grep='$grep'
17389 groupcat='$groupcat'
17390 groupstype='$groupstype'
17391 gzip='$gzip'
17392 h_fcntl='$h_fcntl'
17393 h_sysfile='$h_sysfile'
17394 hint='$hint'
17395 hostcat='$hostcat'
17396 i16size='$i16size'
17397 i16type='$i16type'
17398 i32size='$i32size'
17399 i32type='$i32type'
17400 i64size='$i64size'
17401 i64type='$i64type'
17402 i8size='$i8size'
17403 i8type='$i8type'
17404 i_arpainet='$i_arpainet'
17405 i_bsdioctl='$i_bsdioctl'
17406 i_db='$i_db'
17407 i_dbm='$i_dbm'
17408 i_dirent='$i_dirent'
17409 i_dld='$i_dld'
17410 i_dlfcn='$i_dlfcn'
17411 i_fcntl='$i_fcntl'
17412 i_float='$i_float'
17413 i_fp='$i_fp'
17414 i_fp_class='$i_fp_class'
17415 i_gdbm='$i_gdbm'
17416 i_grp='$i_grp'
17417 i_ieeefp='$i_ieeefp'
17418 i_inttypes='$i_inttypes'
17419 i_langinfo='$i_langinfo'
17420 i_libutil='$i_libutil'
17421 i_limits='$i_limits'
17422 i_locale='$i_locale'
17423 i_machcthr='$i_machcthr'
17424 i_malloc='$i_malloc'
17425 i_math='$i_math'
17426 i_memory='$i_memory'
17427 i_mntent='$i_mntent'
17428 i_ndbm='$i_ndbm'
17429 i_netdb='$i_netdb'
17430 i_neterrno='$i_neterrno'
17431 i_netinettcp='$i_netinettcp'
17432 i_niin='$i_niin'
17433 i_poll='$i_poll'
17434 i_prot='$i_prot'
17435 i_pthread='$i_pthread'
17436 i_pwd='$i_pwd'
17437 i_rpcsvcdbm='$i_rpcsvcdbm'
17438 i_sfio='$i_sfio'
17439 i_sgtty='$i_sgtty'
17440 i_shadow='$i_shadow'
17441 i_socks='$i_socks'
17442 i_stdarg='$i_stdarg'
17443 i_stddef='$i_stddef'
17444 i_stdlib='$i_stdlib'
17445 i_string='$i_string'
17446 i_sunmath='$i_sunmath'
17447 i_sysaccess='$i_sysaccess'
17448 i_sysdir='$i_sysdir'
17449 i_sysfile='$i_sysfile'
17450 i_sysfilio='$i_sysfilio'
17451 i_sysin='$i_sysin'
17452 i_sysioctl='$i_sysioctl'
17453 i_syslog='$i_syslog'
17454 i_sysmman='$i_sysmman'
17455 i_sysmode='$i_sysmode'
17456 i_sysmount='$i_sysmount'
17457 i_sysndir='$i_sysndir'
17458 i_sysparam='$i_sysparam'
17459 i_sysresrc='$i_sysresrc'
17460 i_syssecrt='$i_syssecrt'
17461 i_sysselct='$i_sysselct'
17462 i_syssockio='$i_syssockio'
17463 i_sysstat='$i_sysstat'
17464 i_sysstatfs='$i_sysstatfs'
17465 i_sysstatvfs='$i_sysstatvfs'
17466 i_systime='$i_systime'
17467 i_systimek='$i_systimek'
17468 i_systimes='$i_systimes'
17469 i_systypes='$i_systypes'
17470 i_sysuio='$i_sysuio'
17471 i_sysun='$i_sysun'
17472 i_sysutsname='$i_sysutsname'
17473 i_sysvfs='$i_sysvfs'
17474 i_syswait='$i_syswait'
17475 i_termio='$i_termio'
17476 i_termios='$i_termios'
17477 i_time='$i_time'
17478 i_unistd='$i_unistd'
17479 i_ustat='$i_ustat'
17480 i_utime='$i_utime'
17481 i_values='$i_values'
17482 i_varargs='$i_varargs'
17483 i_varhdr='$i_varhdr'
17484 i_vfork='$i_vfork'
17485 ignore_versioned_solibs='$ignore_versioned_solibs'
17486 inc_version_list='$inc_version_list'
17487 inc_version_list_init='$inc_version_list_init'
17488 incpath='$incpath'
17489 inews='$inews'
17490 installarchlib='$installarchlib'
17491 installbin='$installbin'
17492 installman1dir='$installman1dir'
17493 installman3dir='$installman3dir'
17494 installprefix='$installprefix'
17495 installprefixexp='$installprefixexp'
17496 installprivlib='$installprivlib'
17497 installscript='$installscript'
17498 installsitearch='$installsitearch'
17499 installsitebin='$installsitebin'
17500 installsitelib='$installsitelib'
17501 installstyle='$installstyle'
17502 installusrbinperl='$installusrbinperl'
17503 installvendorarch='$installvendorarch'
17504 installvendorbin='$installvendorbin'
17505 installvendorlib='$installvendorlib'
17506 intsize='$intsize'
17507 issymlink='$issymlink'
17508 ivdformat='$ivdformat'
17509 ivsize='$ivsize'
17510 ivtype='$ivtype'
17511 known_extensions='$known_extensions'
17512 ksh='$ksh'
17513 ld='$ld'
17514 lddlflags='$lddlflags'
17515 ldflags='$ldflags'
17516 ldflags_uselargefiles='$ldflags_uselargefiles'
17517 ldlibpthname='$ldlibpthname'
17518 less='$less'
17519 lib_ext='$lib_ext'
17520 libc='$libc'
17521 libperl='$libperl'
17522 libpth='$libpth'
17523 libs='$libs'
17524 libsdirs='$libsdirs'
17525 libsfiles='$libsfiles'
17526 libsfound='$libsfound'
17527 libspath='$libspath'
17528 libswanted='$libswanted'
17529 libswanted_uselargefiles='$libswanted_uselargefiles'
17530 line='$line'
17531 lint='$lint'
17532 lkflags='$lkflags'
17533 ln='$ln'
17534 lns='$lns'
17535 locincpth='$locincpth'
17536 loclibpth='$loclibpth'
17537 longdblsize='$longdblsize'
17538 longlongsize='$longlongsize'
17539 longsize='$longsize'
17540 lp='$lp'
17541 lpr='$lpr'
17542 ls='$ls'
17543 lseeksize='$lseeksize'
17544 lseektype='$lseektype'
17545 mail='$mail'
17546 mailx='$mailx'
17547 make='$make'
17548 make_set_make='$make_set_make'
17549 mallocobj='$mallocobj'
17550 mallocsrc='$mallocsrc'
17551 malloctype='$malloctype'
17552 man1dir='$man1dir'
17553 man1direxp='$man1direxp'
17554 man1ext='$man1ext'
17555 man3dir='$man3dir'
17556 man3direxp='$man3direxp'
17557 man3ext='$man3ext'
17558 mips_type='$mips_type'
17559 mkdir='$mkdir'
17560 mmaptype='$mmaptype'
17561 modetype='$modetype'
17562 more='$more'
17563 multiarch='$multiarch'
17564 mv='$mv'
17565 myarchname='$myarchname'
17566 mydomain='$mydomain'
17567 myhostname='$myhostname'
17568 myuname='$myuname'
17569 n='$n'
17570 need_va_copy='$need_va_copy'
17571 netdb_hlen_type='$netdb_hlen_type'
17572 netdb_host_type='$netdb_host_type'
17573 netdb_name_type='$netdb_name_type'
17574 netdb_net_type='$netdb_net_type'
17575 nm='$nm'
17576 nm_opt='$nm_opt'
17577 nm_so_opt='$nm_so_opt'
17578 nonxs_ext='$nonxs_ext'
17579 nroff='$nroff'
17580 nvEUformat='$nvEUformat'
17581 nvFUformat='$nvFUformat'
17582 nvGUformat='$nvGUformat'
17583 nveformat='$nveformat'
17584 nvfformat='$nvfformat'
17585 nvgformat='$nvgformat'
17586 nvsize='$nvsize'
17587 nvtype='$nvtype'
17588 o_nonblock='$o_nonblock'
17589 obj_ext='$obj_ext'
17590 old_pthread_create_joinable='$old_pthread_create_joinable'
17591 optimize='$optimize'
17592 orderlib='$orderlib'
17593 osname='$osname'
17594 osvers='$osvers'
17595 otherlibdirs='$otherlibdirs'
17596 package='$package'
17597 pager='$pager'
17598 passcat='$passcat'
17599 patchlevel='$patchlevel'
17600 path_sep='$path_sep'
17601 perl5='$perl5'
17602 perl='$perl'
17603 perl_patchlevel='$perl_patchlevel'
17604 perladmin='$perladmin'
17605 perllibs='$perllibs'
17606 perlpath='$perlpath'
17607 pg='$pg'
17608 phostname='$phostname'
17609 pidtype='$pidtype'
17610 plibpth='$plibpth'
17611 pm_apiversion='$pm_apiversion'
17612 pmake='$pmake'
17613 pr='$pr'
17614 prefix='$prefix'
17615 prefixexp='$prefixexp'
17616 privlib='$privlib'
17617 privlibexp='$privlibexp'
17618 procselfexe='$procselfexe'
17619 prototype='$prototype'
17620 ptrsize='$ptrsize'
17621 quadkind='$quadkind'
17622 quadtype='$quadtype'
17623 randbits='$randbits'
17624 randfunc='$randfunc'
17625 randseedtype='$randseedtype'
17626 ranlib='$ranlib'
17627 rd_nodata='$rd_nodata'
17628 revision='$revision'
17629 rm='$rm'
17630 rmail='$rmail'
17631 run='$run'
17632 runnm='$runnm'
17633 sPRIEUldbl='$sPRIEUldbl'
17634 sPRIFUldbl='$sPRIFUldbl'
17635 sPRIGUldbl='$sPRIGUldbl'
17636 sPRIXU64='$sPRIXU64'
17637 sPRId64='$sPRId64'
17638 sPRIeldbl='$sPRIeldbl'
17639 sPRIfldbl='$sPRIfldbl'
17640 sPRIgldbl='$sPRIgldbl'
17641 sPRIi64='$sPRIi64'
17642 sPRIo64='$sPRIo64'
17643 sPRIu64='$sPRIu64'
17644 sPRIx64='$sPRIx64'
17645 sSCNfldbl='$sSCNfldbl'
17646 sched_yield='$sched_yield'
17647 scriptdir='$scriptdir'
17648 scriptdirexp='$scriptdirexp'
17649 sed='$sed'
17650 seedfunc='$seedfunc'
17651 selectminbits='$selectminbits'
17652 selecttype='$selecttype'
17653 sendmail='$sendmail'
17654 sh='$sh'
17655 shar='$shar'
17656 sharpbang='$sharpbang'
17657 shmattype='$shmattype'
17658 shortsize='$shortsize'
17659 shrpenv='$shrpenv'
17660 shsharp='$shsharp'
17661 sig_count='$sig_count'
17662 sig_name='$sig_name'
17663 sig_name_init='$sig_name_init'
17664 sig_num='$sig_num'
17665 sig_num_init='$sig_num_init'
17666 sig_size='$sig_size'
17667 signal_t='$signal_t'
17668 sitearch='$sitearch'
17669 sitearchexp='$sitearchexp'
17670 sitebin='$sitebin'
17671 sitebinexp='$sitebinexp'
17672 sitelib='$sitelib'
17673 sitelib_stem='$sitelib_stem'
17674 sitelibexp='$sitelibexp'
17675 siteprefix='$siteprefix'
17676 siteprefixexp='$siteprefixexp'
17677 sizesize='$sizesize'
17678 sizetype='$sizetype'
17679 sleep='$sleep'
17680 smail='$smail'
17681 so='$so'
17682 sockethdr='$sockethdr'
17683 socketlib='$socketlib'
17684 socksizetype='$socksizetype'
17685 sort='$sort'
17686 spackage='$spackage'
17687 spitshell='$spitshell'
17688 src='$src'
17689 ssizetype='$ssizetype'
17690 startperl='$startperl'
17691 startsh='$startsh'
17692 static_ext='$static_ext'
17693 stdchar='$stdchar'
17694 stdio_base='$stdio_base'
17695 stdio_bufsiz='$stdio_bufsiz'
17696 stdio_cnt='$stdio_cnt'
17697 stdio_filbuf='$stdio_filbuf'
17698 stdio_ptr='$stdio_ptr'
17699 stdio_stream_array='$stdio_stream_array'
17700 strings='$strings'
17701 submit='$submit'
17702 subversion='$subversion'
17703 sysman='$sysman'
17704 tail='$tail'
17705 tar='$tar'
17706 targetarch='$targetarch'
17707 tbl='$tbl'
17708 tee='$tee'
17709 test='$test'
17710 timeincl='$timeincl'
17711 timetype='$timetype'
17712 to='$to'
17713 touch='$touch'
17714 tr='$tr'
17715 trnl='$trnl'
17716 troff='$troff'
17717 u16size='$u16size'
17718 u16type='$u16type'
17719 u32size='$u32size'
17720 u32type='$u32type'
17721 u64size='$u64size'
17722 u64type='$u64type'
17723 u8size='$u8size'
17724 u8type='$u8type'
17725 uidformat='$uidformat'
17726 uidsign='$uidsign'
17727 uidsize='$uidsize'
17728 uidtype='$uidtype'
17729 uname='$uname'
17730 uniq='$uniq'
17731 uquadtype='$uquadtype'
17732 use5005threads='$use5005threads'
17733 use64bitall='$use64bitall'
17734 use64bitint='$use64bitint'
17735 usecrosscompile='$usecrosscompile'
17736 usedl='$usedl'
17737 useithreads='$useithreads'
17738 uselargefiles='$uselargefiles'
17739 uselongdouble='$uselongdouble'
17740 usemorebits='$usemorebits'
17741 usemultiplicity='$usemultiplicity'
17742 usemymalloc='$usemymalloc'
17743 usenm='$usenm'
17744 useopcode='$useopcode'
17745 useperlio='$useperlio'
17746 useposix='$useposix'
17747 usereentrant='$usereentrant'
17748 usesfio='$usesfio'
17749 useshrplib='$useshrplib'
17750 usesocks='$usesocks'
17751 usethreads='$usethreads'
17752 usevendorprefix='$usevendorprefix'
17753 usevfork='$usevfork'
17754 usrinc='$usrinc'
17755 uuname='$uuname'
17756 uvXUformat='$uvXUformat'
17757 uvoformat='$uvoformat'
17758 uvsize='$uvsize'
17759 uvtype='$uvtype'
17760 uvuformat='$uvuformat'
17761 uvxformat='$uvxformat'
17762 vendorarch='$vendorarch'
17763 vendorarchexp='$vendorarchexp'
17764 vendorbin='$vendorbin'
17765 vendorbinexp='$vendorbinexp'
17766 vendorlib='$vendorlib'
17767 vendorlib_stem='$vendorlib_stem'
17768 vendorlibexp='$vendorlibexp'
17769 vendorprefix='$vendorprefix'
17770 vendorprefixexp='$vendorprefixexp'
17771 version='$version'
17772 version_patchlevel_string='$version_patchlevel_string'
17773 versiononly='$versiononly'
17774 vi='$vi'
17775 voidflags='$voidflags'
17776 xlibpth='$xlibpth'
17777 xs_apiversion='$xs_apiversion'
17778 yacc='$yacc'
17779 yaccflags='$yaccflags'
17780 zcat='$zcat'
17781 zip='$zip'
17782 EOT
17783
17784 : Add in command line options if available
17785 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17786
17787 : add special variables
17788 $test -f $src/patchlevel.h && \
17789 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
17790 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
17791 echo "PERL_CONFIG_SH=true" >>config.sh
17792
17793 : propagate old symbols
17794 if $test -f UU/config.sh; then
17795         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
17796         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
17797         $sort | $uniq -u >UU/oldsyms
17798         set X `cat UU/oldsyms`
17799         shift
17800         case $# in
17801         0) ;;
17802         *)
17803                 cat <<EOM
17804 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17805 EOM
17806                 echo "# Variables propagated from previous config.sh file." >>config.sh
17807                 for sym in `cat UU/oldsyms`; do
17808                         echo "    Propagating $hint variable "'$'"$sym..."
17809                         eval 'tmp="$'"${sym}"'"'
17810                         echo "$tmp" | \
17811                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17812                 done
17813                 ;;
17814         esac
17815 fi
17816
17817 : Finish up by extracting the .SH files
17818 case "$alldone" in
17819 exit)
17820         $rm -rf UU
17821         echo "Extraction done."
17822         exit 0
17823         ;;
17824 cont)
17825         ;;
17826 '')
17827         dflt=''
17828         nostick=true
17829         $cat <<EOM
17830
17831 If you'd like to make any changes to the config.sh file before I begin
17832 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17833
17834 EOM
17835         rp="Press return or use a shell escape to edit config.sh:"
17836         . UU/myread
17837         nostick=''
17838         case "$ans" in
17839         '') ;;
17840         *) : in case they cannot read
17841                 sh 1>&4 -c "$ans";;
17842         esac
17843         ;;
17844 esac
17845
17846 : if this fails, just run all the .SH files by hand
17847 . ./config.sh
17848
17849 echo " "
17850 exec 1>&4
17851 pwd=`pwd`
17852 . ./UU/extract
17853 cd "$pwd"
17854
17855 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17856         dflt=y
17857         case "$silent" in
17858         true) ;;
17859         *)
17860                 $cat <<EOM
17861
17862 Now you need to generate make dependencies by running "$make depend".
17863 You might prefer to run it in background: "$make depend > makedepend.out &"
17864 It can take a while, so you might not want to run it right now.
17865
17866 EOM
17867                 ;;
17868         esac
17869         rp="Run $make depend now?"
17870         . UU/myread
17871         case "$ans" in
17872         y*)
17873                 $make depend && echo "Now you must run '$make'."
17874                 ;;
17875         *)
17876                 echo "You must run '$make depend' then '$make'."
17877                 ;;
17878         esac
17879 elif test -f [Mm]akefile; then
17880         echo " "
17881         echo "Now you must run a $make."
17882 else
17883         echo "Configure done."
17884 fi
17885
17886 if $test -f Policy.sh; then
17887     $cat <<EOM
17888
17889 If you compile $package on a different machine or from a different object
17890 directory, copy the Policy.sh file from this object directory to the
17891 new one before you run Configure -- this will help you with most of
17892 the policy defaults.
17893
17894 EOM
17895 fi
17896 if $test -f config.msg; then
17897     echo "Hmm.  I also noted the following information while running:"
17898     echo " "
17899     $cat config.msg >&4
17900     $rm -f config.msg
17901 fi
17902 $rm -f kit*isdone ark*isdone
17903 $rm -rf UU
17904
17905 : End of Configure
17906